shopList.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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.all_recommend"
  25. :key="indexn"
  26. v-if="item.all_recommend.length <= 3"
  27. >
  28. <view class="picture">
  29. <easy-loadimage mode="widthFix" :image-src="itemn.image"></easy-loadimage>
  30. <view v-if="itemn.border_pic" :style="{ backgroundImage: `url(${itemn.border_pic})` }" class="border-picture"></view>
  31. </view>
  32. <view v-if="titleShow" class="name line1">{{itemn.store_name}}</view>
  33. <view v-if="priceShow" class="price" :style="'color:'+themeColor">
  34. <text>¥</text>
  35. {{ itemn.price }}
  36. </view>
  37. </navigator>
  38. </view>
  39. </view>
  40. </block>
  41. <block v-else>
  42. <view class="mer_count">
  43. <view class="item" v-for="(item, index) in brandList" :key="index" @click="goStore(item.mer_id)">
  44. <image :src="item.mer_avatar" mode="widthFix"></image>
  45. </view>
  46. </view>
  47. </block>
  48. <view class="more-shop" @click="moreShop">
  49. <text>更多店铺</text>
  50. <text class="iconfont icon-xiangyou"></text>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. // +----------------------------------------------------------------------
  58. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  59. // +----------------------------------------------------------------------
  60. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  61. // +----------------------------------------------------------------------
  62. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  63. // +----------------------------------------------------------------------
  64. // | Author: CRMEB Team <admin@crmeb.com>
  65. // +----------------------------------------------------------------------
  66. import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue';
  67. import { storeList } from '@/api/api.js';
  68. import { mapGetters } from 'vuex';
  69. import { configMap } from '@/utils';
  70. export default {
  71. computed: configMap(['hide_mer_status']),
  72. components: {
  73. easyLoadimage
  74. },
  75. props: {
  76. dataConfig: {
  77. type: Object,
  78. default: () => {}
  79. }
  80. },
  81. data() {
  82. return {
  83. brandList: [],
  84. mbConfig: this.dataConfig.mbConfig.val*2, //页面间距
  85. prConfig: this.dataConfig.prConfig.val*2, //背景间距
  86. logoUrl: this.dataConfig.logoConfig.url,
  87. bgStyle: this.dataConfig.bgStyle.type ? '16' : 0,
  88. bgColor: this.dataConfig.bgColor.color[0].item,
  89. themeColor: this.dataConfig.themeColor.color[0].item,
  90. tabConfig: this.dataConfig.tabConfig.tabVal, //展示样式
  91. numConfig: this.dataConfig.numConfig.val,
  92. titleShow: this.dataConfig.titleShow.val,
  93. priceShow: this.dataConfig.priceShow.val,
  94. diy_id: this.dataConfig.did,
  95. unique: this.dataConfig.timestamp,
  96. }
  97. },
  98. created() {},
  99. mounted() {
  100. this.storeMerchant();
  101. },
  102. methods: {
  103. // 进店看看
  104. goStore(id) {
  105. if (this.hide_mer_status != 1) {
  106. uni.navigateTo({
  107. url: `/pages/store/home/index?id=${id}`
  108. });
  109. }
  110. },
  111. // 更多店铺
  112. moreShop() {
  113. uni.navigateTo({
  114. url: `/pages/store/shopStreet/index?cate_id=&type_id=`
  115. });
  116. },
  117. // 品牌好店
  118. storeMerchant() {
  119. storeList({
  120. diy_id: this.diy_id,
  121. unique: this.unique,
  122. page: 1,
  123. limit: this.numConfig ? this.numConfig : 4,
  124. is_best: 1
  125. }).then(res => {
  126. this.brandList = res.data.list;
  127. });
  128. },
  129. }
  130. };
  131. </script>
  132. <style scoped lang="scss">
  133. .explosion {
  134. .common-hd {
  135. display: flex;
  136. align-items: center;
  137. justify-content: center;
  138. .title-img{
  139. width: 242rpx;
  140. margin: 20rpx 0;
  141. }
  142. }
  143. .mer-box {
  144. margin-bottom: 20rpx;
  145. .mer-item {
  146. margin-bottom: 20rpx;
  147. background-color: #fff;
  148. text-align: center;
  149. .mer-hd {
  150. position: relative;
  151. width: 100%;
  152. height: 200rpx;
  153. border-radius: 16rpx 16rpx 0 0;
  154. overflow: hidden;
  155. image {
  156. width: 100%;
  157. height: 100%;
  158. }
  159. .mer-name {
  160. position: absolute;
  161. left: 20rpx;
  162. top: 20rpx;
  163. display: flex;
  164. max-width: 60%;
  165. padding: 8rpx 8rpx 8rpx 4rpx;
  166. border-radius: 26rpx;
  167. background: #fff;
  168. font-weight: bold;
  169. font-size: 12px;
  170. align-items: center;
  171. image {
  172. width: 38rpx;
  173. height: 38rpx;
  174. margin-right: 10rpx;
  175. border-radius: 50%;
  176. }
  177. .txt {
  178. flex: 1;
  179. line-height: 19px;
  180. height: 19px;
  181. }
  182. .store_type {
  183. font-size: 10px;
  184. color: #fff;
  185. background-color: #e93323;
  186. padding: 0 5px;
  187. line-height: 19px;
  188. height: 19px;
  189. margin-left: 20rpx;
  190. border-radius: 30rpx;
  191. }
  192. }
  193. }
  194. /deep/.easy-loadimage,/deep/uni-image,image,/deep/.loadfail-img{
  195. width: 100%;
  196. height: 214rpx;
  197. }
  198. .pro-box {
  199. display: flex;
  200. align-items: center;
  201. padding: 20rpx 20rpx 30rpx;
  202. .pro-item {
  203. width: 31.3%;
  204. margin-right: 3.05%;
  205. .picture,/deep/.easy-loadimage,/deep/uni-image,/deep/image,/deep/.loadfail-img {
  206. width: 100%;
  207. height: 214rpx;
  208. position: relative;
  209. }
  210. .sell_out {
  211. display: flex;
  212. width: 110rpx;
  213. height: 110rpx;
  214. align-items: center;
  215. justify-content: center;
  216. border-radius: 100%;
  217. background: rgba(0,0,0,.6);
  218. color: #fff;
  219. font-size: 24rpx;
  220. position: absolute;
  221. top: 50%;
  222. left: 50%;
  223. margin: -55rpx 0 0 -55rpx;
  224. &::before{
  225. content: "";
  226. display: block;
  227. width: 100rpx;
  228. height: 100rpx;
  229. border-radius: 100%;
  230. border: 1px dashed #fff;
  231. position: absolute;
  232. top: 5rpx;
  233. left: 5rpx;
  234. }
  235. }
  236. .border-picture {
  237. position: absolute;
  238. top: 0;
  239. left: 0;
  240. width: 100%;
  241. height: 100%;
  242. background: center/cover no-repeat;
  243. }
  244. .name{
  245. padding: 6rpx 9rpx;
  246. margin-top: 6rpx;
  247. }
  248. .price {
  249. margin-top: 5rpx;
  250. font-size: 28rpx;
  251. color: $theme-color;
  252. font-weight: bold;
  253. text {
  254. font-size: 28rpx;
  255. }
  256. }
  257. &:last-child {
  258. margin-right: 0;
  259. }
  260. .picture {
  261. position: relative;
  262. }
  263. .border-picture {
  264. position: absolute;
  265. top: 0;
  266. left: 0;
  267. width: 100%;
  268. height: 100%;
  269. background: center/cover no-repeat;
  270. }
  271. }
  272. }
  273. }
  274. .more-shop {
  275. display: flex;
  276. align-items: center;
  277. justify-content: center;
  278. background-color: #ffffff;
  279. padding: 27rpx 0;
  280. color: #999999;
  281. font-size: 26rpx;
  282. .icon-xiangyou {
  283. font-size: 22rpx;
  284. }
  285. }
  286. }
  287. }
  288. .mer_count{
  289. display: flex;
  290. flex-wrap: wrap;
  291. padding: 20rpx;
  292. align-items: center;
  293. .item{
  294. flex: 4;
  295. height: 140rpx;
  296. margin: 0 2% 30rpx 0;
  297. background: #FEFEFF;
  298. border-radius: 16rpx;
  299. display: flex;
  300. align-items: center;
  301. justify-content: center;
  302. /deep/uni-image,/deep/image,/deep/.easy-loadimage{
  303. width: 100%!important;
  304. max-height: 140rpx;
  305. }
  306. &:nth-child(4n){
  307. margin-right: 0;
  308. }
  309. }
  310. }
  311. </style>