list.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. .then(function({ data }) {
  89. console.log(data)
  90. obj.list = data.list.map(e => {
  91. e.show = true;
  92. return e;
  93. });
  94. })
  95. .catch(e => {
  96. console.log(e);
  97. });
  98. },
  99. //选择门店
  100. chooseStore(item) {
  101. if(this.type == 3) {
  102. this.$api.prePage().storeInfo = item
  103. uni.navigateBack({
  104. })
  105. }else if(this.type == 4) {
  106. this.$api.prePage().shopAddress = item
  107. uni.navigateBack({
  108. })
  109. }else if(this.type == 5) {
  110. }else {
  111. this.setStoreInfo(item)
  112. uni.navigateBack({
  113. })
  114. }
  115. }
  116. }
  117. };
  118. </script>
  119. <style lang="scss">
  120. page,
  121. .content {
  122. height: 100%;
  123. }
  124. .varHeight {
  125. height: var(--status-bar-height);
  126. }
  127. $slider-color: #fe9398; //滑块左侧颜色
  128. .goodsList-item {
  129. // background-color: #ffffff;
  130. // padding: 30rpx;
  131. // border-bottom: 1px solid $border-color-light;
  132. margin: 0 auto 20rpx;
  133. width: 710rpx;
  134. height: 231rpx;
  135. padding: 25rpx 20rpx;
  136. background: #FFFFFF;
  137. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  138. border-radius: 10rpx;
  139. position: relative;
  140. .tag {
  141. width: 60rpx;
  142. line-height: 40rpx;
  143. background: #FF6F0F;
  144. border-radius: 5rpx;
  145. font-size: 24rpx;
  146. font-family: PingFang SC;
  147. font-weight: 500;
  148. color: #FFFFFF;
  149. text-align: center;
  150. position: absolute;
  151. top: 25rpx;
  152. right: 20rpx;
  153. }
  154. .info-top {
  155. justify-content: flex-start;
  156. .store-name {
  157. max-width: 500rpx;
  158. font-size: 32rpx;
  159. font-family: PingFang SC;
  160. font-weight: bold;
  161. color: #333333;
  162. padding-left: 11rpx;
  163. }
  164. }
  165. image {
  166. flex-shrink: 0;
  167. // border-radius: $border-radius-sm;
  168. // height: 180rpx;
  169. // width: 180rpx;
  170. width: 65rpx;
  171. height: 65rpx;
  172. border-radius: 50%;
  173. }
  174. .slider {
  175. margin-top: 15rpx;
  176. justify-content: flex-start;
  177. .slider-box {
  178. width: 196rpx;
  179. border-radius: 99px;
  180. border: 1px solid $slider-color;
  181. height: 16rpx;
  182. .slider-action {
  183. background-color: $slider-color;
  184. height: 100%;
  185. }
  186. }
  187. .sales-nub {
  188. color: $font-color-light;
  189. font-size: 24rpx;
  190. height: 2.5em;
  191. overflow: hidden;
  192. }
  193. }
  194. .goodsList-content {
  195. // margin-left: 20rpx;
  196. flex-grow: 1;
  197. // height: 180rpx;
  198. position: relative;
  199. padding-top: 20rpx;
  200. .info-tit {
  201. line-height: 1.5;
  202. font-size: 24rpx;
  203. font-family: PingFang SC;
  204. font-weight: bold;
  205. color: #333333;
  206. .info-val {
  207. font-weight: 500;
  208. }
  209. }
  210. .title {
  211. font-size: $font-base;
  212. color: $font-color-dark;
  213. font-weight: 500;
  214. width: 0;
  215. min-width: 100%;
  216. }
  217. .goods-money {
  218. position: absolute;
  219. left: 0;
  220. bottom: 0;
  221. width: 100%;
  222. .money-box {
  223. .money {
  224. font-size: $font-lg + 10rpx;
  225. color: $color-red;
  226. font-weight: bold;
  227. }
  228. .otMoney-box {
  229. font-size: $font-sm;
  230. .otMoney {
  231. color: $font-color-light;
  232. padding-right: 20rpx;
  233. }
  234. .sales {
  235. color: $font-color-light;
  236. }
  237. }
  238. }
  239. .cart {
  240. font-size: $font-base - 2rpx;
  241. border-radius: 99px;
  242. padding: 10rpx 20rpx;
  243. line-height: 1;
  244. color: #ffffff;
  245. background-color: $color-gray;
  246. &.seckill-action {
  247. border: 1px solid $color-red;
  248. background-color: $color-red;
  249. }
  250. }
  251. }
  252. }
  253. }
  254. </style>