list.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view class="content">
  3. <view class="varHeight"></view>
  4. <view class="jg" style="height: 20rpx;"></view>
  5. <block :key="ind" v-for="(lss, ind) in list">
  6. <view class="goodsList-item" v-if="lss.show" @click="chooseStore(lss)">
  7. <view class="info-top flex">
  8. <image :src="lss.image" lazy-load mode="scaleToFill"></image>
  9. <view class="store-name clamp2">
  10. {{lss.name}}
  11. </view>
  12. </view>
  13. <view class="tag">
  14. 门店
  15. </view>
  16. <view class="goodsList-content">
  17. <view class="info-tit">地区:<text class="info-val">{{lss.address}}</text></view>
  18. <view class="info-tit">电话:<text class="info-val">{{lss.phone }}</text></view>
  19. <view class="info-tit">地址:<text class="info-val">{{lss.detailed_address}}</text></view>
  20. </view>
  21. </view>
  22. </block>
  23. <view class="jg" style="height: 20rpx;"></view>
  24. </view>
  25. </template>
  26. <script>
  27. import { mapState, mapMutations } from 'vuex';
  28. import { store_list } from '@/api/index.js';
  29. export default {
  30. data() {
  31. return {
  32. // 当前选中的滑块
  33. list: [],
  34. keyword: '' ,//查询中的内容
  35. type: 0,//3->开通会员选择门店 4->自提选择门店 5->附近门店进入不做任何操作
  36. };
  37. },
  38. watch: {
  39. keyword(newValue, oldValue) {
  40. this.keyword = newValue;
  41. console.log(newValue);
  42. this.search();
  43. }
  44. },
  45. computed: {
  46. ...mapState(['latitude','longitude'])
  47. },
  48. onLoad(opt) {
  49. if(opt.type) {
  50. this.type = opt.type
  51. }
  52. this.getShoping();
  53. },
  54. // #ifndef MP
  55. // 点击键盘搜索事件
  56. onNavigationBarSearchInputConfirmed(e) {
  57. this.search();
  58. },
  59. // 搜索栏内容变化事件
  60. onNavigationBarSearchInputChanged(e) {
  61. this.keyword = e.text;
  62. },
  63. // #endif
  64. methods: {
  65. ...mapMutations(['setLat', 'setLon','setStoreInfo']),
  66. // 查询店铺信息
  67. search(title) {
  68. let obj = this;
  69. obj.list.forEach(e => {
  70. if (e.title.indexOf(obj.keyword) >= 0) {
  71. e.show = true;
  72. } else {
  73. e.show = false;
  74. }
  75. });
  76. },
  77. // 跳转店铺页面
  78. navProduct(item) {
  79. uni.navigateTo({
  80. url: './index?merid=' + item.id
  81. });
  82. },
  83. //获取商店信息
  84. getShoping() {
  85. let obj = this;
  86. console.log(obj.longitude,obj.latitude)
  87. store_list({
  88. longitude:obj.longitude,//经度
  89. latitude:obj.latitude,//纬度
  90. })
  91. .then(function({ data }) {
  92. console.log(data)
  93. obj.list = data.list.map(e => {
  94. e.show = true;
  95. return e;
  96. });
  97. })
  98. .catch(e => {
  99. console.log(e);
  100. });
  101. },
  102. //选择门店
  103. chooseStore(item) {
  104. if(this.type == 3) {
  105. this.$api.prePage().storeInfo = item
  106. uni.navigateBack({
  107. })
  108. }else if(this.type == 4) {
  109. this.$api.prePage().shopAddress = item
  110. uni.navigateBack({
  111. })
  112. }else if(this.type == 5) {
  113. }else {
  114. this.setStoreInfo(item)
  115. uni.navigateBack({
  116. })
  117. }
  118. }
  119. }
  120. };
  121. </script>
  122. <style lang="scss">
  123. page,
  124. .content {
  125. height: 100%;
  126. }
  127. .varHeight {
  128. height: var(--status-bar-height);
  129. }
  130. $slider-color: #fe9398; //滑块左侧颜色
  131. .goodsList-item {
  132. // background-color: #ffffff;
  133. // padding: 30rpx;
  134. // border-bottom: 1px solid $border-color-light;
  135. margin: 0 auto 20rpx;
  136. width: 710rpx;
  137. height: 231rpx;
  138. padding: 25rpx 20rpx;
  139. background: #FFFFFF;
  140. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  141. border-radius: 10rpx;
  142. position: relative;
  143. .tag {
  144. width: 60rpx;
  145. line-height: 40rpx;
  146. background: #FF6F0F;
  147. border-radius: 5rpx;
  148. font-size: 24rpx;
  149. font-family: PingFang SC;
  150. font-weight: 500;
  151. color: #FFFFFF;
  152. text-align: center;
  153. position: absolute;
  154. top: 25rpx;
  155. right: 20rpx;
  156. }
  157. .info-top {
  158. justify-content: flex-start;
  159. .store-name {
  160. max-width: 500rpx;
  161. font-size: 32rpx;
  162. font-family: PingFang SC;
  163. font-weight: bold;
  164. color: #333333;
  165. padding-left: 11rpx;
  166. }
  167. }
  168. image {
  169. flex-shrink: 0;
  170. // border-radius: $border-radius-sm;
  171. // height: 180rpx;
  172. // width: 180rpx;
  173. width: 65rpx;
  174. height: 65rpx;
  175. border-radius: 50%;
  176. }
  177. .slider {
  178. margin-top: 15rpx;
  179. justify-content: flex-start;
  180. .slider-box {
  181. width: 196rpx;
  182. border-radius: 99px;
  183. border: 1px solid $slider-color;
  184. height: 16rpx;
  185. .slider-action {
  186. background-color: $slider-color;
  187. height: 100%;
  188. }
  189. }
  190. .sales-nub {
  191. color: $font-color-light;
  192. font-size: 24rpx;
  193. height: 2.5em;
  194. overflow: hidden;
  195. }
  196. }
  197. .goodsList-content {
  198. // margin-left: 20rpx;
  199. flex-grow: 1;
  200. // height: 180rpx;
  201. position: relative;
  202. padding-top: 20rpx;
  203. .info-tit {
  204. line-height: 1.5;
  205. font-size: 24rpx;
  206. font-family: PingFang SC;
  207. font-weight: bold;
  208. color: #333333;
  209. .info-val {
  210. font-weight: 500;
  211. }
  212. }
  213. .title {
  214. font-size: $font-base;
  215. color: $font-color-dark;
  216. font-weight: 500;
  217. width: 0;
  218. min-width: 100%;
  219. }
  220. .goods-money {
  221. position: absolute;
  222. left: 0;
  223. bottom: 0;
  224. width: 100%;
  225. .money-box {
  226. .money {
  227. font-size: $font-lg + 10rpx;
  228. color: $color-red;
  229. font-weight: bold;
  230. }
  231. .otMoney-box {
  232. font-size: $font-sm;
  233. .otMoney {
  234. color: $font-color-light;
  235. padding-right: 20rpx;
  236. }
  237. .sales {
  238. color: $font-color-light;
  239. }
  240. }
  241. }
  242. .cart {
  243. font-size: $font-base - 2rpx;
  244. border-radius: 99px;
  245. padding: 10rpx 20rpx;
  246. line-height: 1;
  247. color: #ffffff;
  248. background-color: $color-gray;
  249. &.seckill-action {
  250. border: 1px solid $color-red;
  251. background-color: $color-red;
  252. }
  253. }
  254. }
  255. }
  256. }
  257. </style>