list.vue 5.2 KB

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