shopList.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view :style="'margin-top:' +mbConfig+'rpx;background:'+bgColor">
  3. <view class="explosion" :style="'margin:0 '+prConfig+'rpx'">
  4. <view class="common-hd" mode="widthFix" v-if="logoUrl">
  5. <image class="title-img" mode="widthFix" :src="logoUrl"></image>
  6. </view>
  7. <view class="mer-box">
  8. <block v-if="tabConfig == 0">
  9. <view class="mer-item" v-for="(item, index) in brandList" :key="index" :style="'border-radius:'+bgStyle+'rpx'">
  10. <view class="mer-hd" @click="goStore(item.mer_id)" :style="'border-radius:'+bgStyle+'rpx '+bgStyle+'rpx 0 0'">
  11. <image :src="item.mer_banner"></image>
  12. <view class="mer-name">
  13. <image :src="item.mer_avatar"></image>
  14. <view class="txt line1">{{ item.mer_name }}</view>
  15. <text v-if="item.type_name" class="store_type" :style="'background:'+themeColor">{{ item.type_name }}</text>
  16. <text v-else-if="item.is_trader" class="store_type" :style="'background:'+themeColor">自营</text>
  17. </view>
  18. </view>
  19. <view class="pro-box">
  20. <navigator
  21. :url="`/pages/goods_details/index?id=${itemn.product_id}`"
  22. hover-class="none"
  23. class="pro-item"
  24. v-for="(itemn, indexn) in item.recommend"
  25. :key="indexn"
  26. v-if="item.recommend.length <= 3"
  27. >
  28. <view class="picture">
  29. <easy-loadimage mode="widthFix" :image-src="itemn.image"></easy-loadimage>
  30. </view>
  31. <view v-if="titleShow" class="name line1">{{itemn.store_name}}</view>
  32. <view v-if="priceShow" class="price" :style="'color:'+themeColor">
  33. <text>¥</text>
  34. {{ itemn.price }}
  35. </view>
  36. </navigator>
  37. </view>
  38. </view>
  39. </block>
  40. <block v-else>
  41. <view class="mer_count">
  42. <view class="item" v-for="(item, index) in brandList" :key="index" @click="goStore(item.mer_id)">
  43. <easy-loadimage mode="widthFix" :image-src="item.mer_avatar"></easy-loadimage>
  44. </view>
  45. </view>
  46. </block>
  47. <view class="more-shop" @click="moreShop">
  48. <text>更多店铺</text>
  49. <text class="iconfont icon-xiangyou"></text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue';
  57. import { storeMerchantList } from '@/api/store.js';
  58. import { mapGetters } from 'vuex';
  59. import { configMap } from '@/utils';
  60. export default {
  61. computed: configMap(['hide_mer_status']),
  62. components: {
  63. easyLoadimage
  64. },
  65. props: {
  66. dataConfig: {
  67. type: Object,
  68. default: () => {}
  69. }
  70. },
  71. data() {
  72. return {
  73. brandList: [],
  74. mbConfig: this.dataConfig.mbConfig.val*2, //页面间距
  75. prConfig: this.dataConfig.prConfig.val*2, //背景间距
  76. logoUrl: this.dataConfig.logoConfig.url,
  77. bgStyle: this.dataConfig.bgStyle.type ? '16' : 0,
  78. bgColor: this.dataConfig.bgColor.color[0].item,
  79. themeColor: this.dataConfig.themeColor.color[0].item,
  80. tabConfig: this.dataConfig.tabConfig.tabVal, //展示样式
  81. numConfig: this.dataConfig.numConfig.val,
  82. titleShow: this.dataConfig.titleShow.val,
  83. priceShow: this.dataConfig.priceShow.val
  84. }
  85. },
  86. created() {},
  87. mounted() {
  88. this.storeMerchant();
  89. },
  90. methods: {
  91. // 进店看看
  92. goStore(id) {
  93. if (this.hide_mer_status != 1) {
  94. uni.navigateTo({
  95. url: `/pages/store/index?id=${id}`
  96. });
  97. }
  98. },
  99. // 更多店铺
  100. moreShop() {
  101. uni.navigateTo({
  102. url: `/pages/store/shopStreet/index`
  103. });
  104. },
  105. // 品牌好店
  106. storeMerchant() {
  107. storeMerchantList({
  108. page: 1,
  109. limit: this.numConfig ? this.numConfig : 4,
  110. is_best: 1
  111. }).then(res => {
  112. this.brandList = res.data.list;
  113. });
  114. },
  115. }
  116. };
  117. </script>
  118. <style scoped lang="scss">
  119. .explosion {
  120. .common-hd {
  121. display: flex;
  122. align-items: center;
  123. justify-content: center;
  124. .title-img{
  125. width: 242rpx;
  126. }
  127. .title {
  128. padding: 0 80rpx;
  129. font-size: 34rpx;
  130. color: $theme-color;
  131. font-weight: bold;
  132. background-image: url('~@/static/images/index-title.png');
  133. background-repeat: no-repeat;
  134. background-size: 100% auto;
  135. background-position: left center;
  136. }
  137. }
  138. .mer-box {
  139. margin-bottom: 20rpx;
  140. .mer-item {
  141. margin-bottom: 20rpx;
  142. background-color: #fff;
  143. text-align: center;
  144. .mer-hd {
  145. position: relative;
  146. width: 100%;
  147. height: 200rpx;
  148. border-radius: 16rpx 16rpx 0 0;
  149. overflow: hidden;
  150. image {
  151. width: 100%;
  152. height: 100%;
  153. }
  154. .mer-name {
  155. position: absolute;
  156. left: 20rpx;
  157. top: 20rpx;
  158. display: flex;
  159. max-width: 60%;
  160. padding: 8rpx 20rpx;
  161. border-radius: 26rpx;
  162. background: #fff;
  163. font-weight: bold;
  164. font-size: 12px;
  165. image {
  166. width: 38rpx;
  167. height: 38rpx;
  168. margin-right: 10rpx;
  169. border-radius: 50%;
  170. }
  171. .txt {
  172. flex: 1;
  173. line-height: 19px;
  174. height: 19px;
  175. }
  176. .store_type {
  177. font-size: 10px;
  178. color: #fff;
  179. background-color: #e93323;
  180. padding: 0 5px;
  181. line-height: 19px;
  182. height: 19px;
  183. margin-left: 20px;
  184. border-radius: 30rpx;
  185. }
  186. }
  187. }
  188. /deep/.easy-loadimage,/deep/uni-image,image,/deep/.loadfail-img{
  189. width: 100%;
  190. height: 214rpx;
  191. }
  192. .pro-box {
  193. display: flex;
  194. align-items: center;
  195. padding: 20rpx 20rpx 30rpx;
  196. .pro-item {
  197. width: 31.3%;
  198. margin-right: 3.05%;
  199. .picture,/deep/.easy-loadimage,/deep/uni-image,/deep/image,/deep/.loadfail-img {
  200. width: 100%;
  201. height: 214rpx;
  202. }
  203. .name{
  204. padding: 6rpx 9rpx;
  205. margin-top: 6rpx;
  206. }
  207. .price {
  208. margin-top: 5rpx;
  209. font-size: 28rpx;
  210. color: $theme-color;
  211. font-weight: bold;
  212. text {
  213. font-size: 28rpx;
  214. }
  215. }
  216. &:last-child {
  217. margin-right: 0;
  218. }
  219. }
  220. }
  221. }
  222. .more-shop {
  223. display: flex;
  224. align-items: center;
  225. justify-content: center;
  226. background-color: #ffffff;
  227. padding: 27rpx 0;
  228. color: #999999;
  229. font-size: 26rpx;
  230. .icon-xiangyou {
  231. font-size: 22rpx;
  232. }
  233. }
  234. }
  235. }
  236. .mer_count{
  237. display: flex;
  238. flex-wrap: wrap;
  239. padding: 20rpx;
  240. align-items: center;
  241. .item{
  242. width: 23.5%;
  243. height: 140rpx;
  244. margin: 0 2% 10px 0;
  245. background: #FEFEFF;
  246. border-radius: 16rpx;
  247. display: flex;
  248. align-items: center;
  249. justify-content: center;
  250. /deep/uni-image,/deep/image,/deep/.easy-loadimage{
  251. width: 140rpx;
  252. height: 70rpx;
  253. }
  254. &:nth-child(4n){
  255. margin-right: 0;
  256. }
  257. }
  258. }
  259. </style>