list.vue 5.0 KB

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