list.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. longitude:121.436289,//经度
  36. latitude:28.651485,//纬度
  37. type: 0,//3->开通会员选择门店 4->自提选择门店
  38. };
  39. },
  40. watch: {
  41. keyword(newValue, oldValue) {
  42. this.keyword = newValue;
  43. console.log(newValue);
  44. this.search();
  45. }
  46. },
  47. onLoad(opt) {
  48. if(opt.type) {
  49. this.type = opt.type
  50. }
  51. this.getShoping();
  52. },
  53. // #ifndef MP
  54. // 点击键盘搜索事件
  55. onNavigationBarSearchInputConfirmed(e) {
  56. this.search();
  57. },
  58. // 搜索栏内容变化事件
  59. onNavigationBarSearchInputChanged(e) {
  60. this.keyword = e.text;
  61. },
  62. // #endif
  63. methods: {
  64. ...mapMutations(['setLat', 'setLon','setStoreInfo']),
  65. // 查询店铺信息
  66. search(title) {
  67. let obj = this;
  68. obj.list.forEach(e => {
  69. if (e.title.indexOf(obj.keyword) >= 0) {
  70. e.show = true;
  71. } else {
  72. e.show = false;
  73. }
  74. });
  75. },
  76. // 跳转店铺页面
  77. navProduct(item) {
  78. uni.navigateTo({
  79. url: './index?merid=' + item.id
  80. });
  81. },
  82. //获取商店信息
  83. getShoping() {
  84. let obj = this;
  85. store_list({
  86. longitude:121.436289,//经度
  87. latitude:28.651485,//纬度
  88. })
  89. .then(function({ data }) {
  90. console.log(data)
  91. obj.list = data.list.map(e => {
  92. e.show = true;
  93. return e;
  94. });
  95. })
  96. .catch(e => {
  97. console.log(e);
  98. });
  99. },
  100. //选择门店
  101. chooseStore(item) {
  102. if(this.type == 3) {
  103. this.$api.prePage().storeInfo = item
  104. uni.navigateBack({
  105. })
  106. }else if(this.type == 4) {
  107. this.$api.prePage().shopAddress = item
  108. uni.navigateBack({
  109. })
  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>