list.vue 5.7 KB

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