merchant.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <!-- 店铺街 -->
  3. <view>
  4. <view class='indexList tui-skeleton' :style="[boxStyle]" v-if="merList.length>0">
  5. <view class='title acea-row row-between-wrapper'>
  6. <view class='text line1 tui-skeleton-rect acea-row'>
  7. <image :src="logoUrl"></image>
  8. <text class='label' :style="[titleColor]">{{dataConfig.titleConfig.val}}</text>
  9. </view>
  10. <view class='more tui-skeleton-rect fs-12' :style="[moreColor]" hover-class="none" @click="more()">
  11. 更多
  12. <text class="iconfont icon-jiantou fs-12"></text>
  13. </view>
  14. </view>
  15. <view class='tips mb20'>Good brand store</view>
  16. <view class='merList' :style="[gridGap]" v-if="listStyle == 0">
  17. <view class='item' v-for="(item,index) in merList" :key='index'>
  18. <navigator :url="`/pages/merchant/home/index?merId=${item.id}`" hover-class="none">
  19. <view class='pic tui-skeleton-rect'>
  20. <easy-loadimage :image-src="item.coverImage"
  21. :radius="dataConfig.contentStyle.val"></easy-loadimage>
  22. </view>
  23. <image class="lines left" :src="urlDomain+'crmebimage/presets/lianjie.png'"></image>
  24. <view v-show="logoShow" class='logo tui-skeleton-rect'>
  25. <image :src='item.rectangleLogo'></image>
  26. </view>
  27. <image class="lines right" :src="urlDomain+'crmebimage/presets/lianjie.png'"></image>
  28. <view class='merName tui-skeleton-rect'>
  29. <view class='neme line1 line-heightOne' v-show="nameShow" :style="[nameColor]">{{item.name}}</view>
  30. <view v-show="typeShow"><text class='label'
  31. :style="[labelColor]">{{item.typeId | merchantTypeFilter}}</text></view>
  32. </view>
  33. </navigator>
  34. </view>
  35. </view>
  36. <view v-if="listStyle == 1">
  37. <mer-card :merchantList="merList" :merchantStyle="merchantStyle" :isShowHome="isShowHome" :isStreet="true" :isHome="true"></mer-card>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. // +----------------------------------------------------------------------
  44. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  45. // +----------------------------------------------------------------------
  46. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  47. // +----------------------------------------------------------------------
  48. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  49. // +----------------------------------------------------------------------
  50. // | Author: CRMEB Team <admin@crmeb.com>
  51. // +----------------------------------------------------------------------
  52. import {
  53. getDiyMerListApi,
  54. getMerListbyidsApi
  55. } from '@/api/merchant.js';
  56. import merCard from '@/components/merchantList/index.vue'
  57. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  58. let app = getApp()
  59. export default {
  60. name: 'merchantList',
  61. props: {
  62. dataConfig: {
  63. type: Object,
  64. default: () => {}
  65. },
  66. },
  67. data() {
  68. return {
  69. urlDomain: this.$Cache.get("imgHost"),
  70. merList: [],
  71. isShowHome: {} ,//首页中展示字段判断
  72. merchantStyle: null ,//样式二中的样式集合
  73. themeColor:this.$options.filters.filterTheme(app.globalData.theme)
  74. }
  75. },
  76. components: {
  77. merCard,
  78. easyLoadimage
  79. },
  80. computed: {
  81. //店铺数据类型,0默认,1自定义
  82. listConfig(){
  83. return this.dataConfig.listConfig.tabVal
  84. },
  85. //店铺数据自定义,选中商户的id集合
  86. activeValueMer(){
  87. return this.dataConfig.activeValueMer.activeValue
  88. },
  89. //样式类型,0,1
  90. listStyle() {
  91. return this.dataConfig.tabConfig.tabVal
  92. },
  93. //最外层盒子的样式
  94. boxStyle() {
  95. return {
  96. borderRadius: this.dataConfig.bgStyle.val * 2 + 'rpx',
  97. background: `linear-gradient(${this.dataConfig.bgColor.color[0].item}, ${this.dataConfig.bgColor.color[1].item})`,
  98. margin: this.dataConfig.mbConfig.val * 2 + 'rpx' + ' ' + '20rpx' + ' ' + 0,
  99. padding: this.dataConfig.upConfig.val * 2 + 'rpx' + ' ' + '10px' + ' ' + this.dataConfig.downConfig
  100. .val * 2 + 'rpx'
  101. }
  102. },
  103. //图片样式
  104. contentStyle() {
  105. return {
  106. 'border-radius': this.dataConfig.contentStyle.val + 'px',
  107. }
  108. },
  109. //内容间距
  110. gridGap() {
  111. return {
  112. 'grid-gap': this.dataConfig.contentConfig.val + 'px'
  113. }
  114. },
  115. //标题颜色
  116. titleColor() {
  117. return {
  118. 'color': this.dataConfig.titleColor.color[0].item
  119. }
  120. },
  121. //名称颜色
  122. nameColor() {
  123. return {
  124. 'color': this.dataConfig.nameColor.color[0].item
  125. }
  126. },
  127. //更多颜色
  128. moreColor() {
  129. return {
  130. 'color': this.dataConfig.moreColor.color[0].item
  131. }
  132. },
  133. // 价格颜色
  134. priceColor(){
  135. return {
  136. 'color': this.dataConfig.themeStyleConfig.tabVal?this.dataConfig.priceColor.color[0].item:this.themeColor
  137. }
  138. },
  139. //标题图片
  140. logoUrl() {
  141. return this.dataConfig.logoConfig.url
  142. },
  143. //标签
  144. labelColor() {
  145. return {
  146. 'backgroundColor': this.dataConfig.themeStyleConfig.tabVal?this.dataConfig.labelColor.color[0].item:this.themeColor,
  147. 'color': this.dataConfig.labelFontColor.color[0].item
  148. }
  149. },
  150. //店铺名称
  151. nameShow() {
  152. if (this.dataConfig.typeConfig.activeValue.indexOf(0) !== -1) {
  153. return true;
  154. } else {
  155. return false;
  156. }
  157. },
  158. //店铺logo
  159. logoShow() {
  160. if (this.dataConfig.typeConfig.activeValue.indexOf(1) !== -1) {
  161. return true;
  162. } else {
  163. return false;
  164. }
  165. },
  166. //店铺类型
  167. typeShow() {
  168. if (this.dataConfig.typeConfig.activeValue.indexOf(2) !== -1) {
  169. return true;
  170. } else {
  171. return false;
  172. }
  173. },
  174. //店铺数量
  175. numConfig(){
  176. return this.dataConfig.numConfig.val
  177. }
  178. },
  179. mounted() {
  180. this.merchantStyle = {
  181. contentStyle: this.contentStyle,
  182. nameColor: this.nameColor,
  183. labelColor: this.labelColor,
  184. priceColor: this.priceColor
  185. }
  186. this.$store.dispatch('MerCategoryList');
  187. this.$store.dispatch('MerTypeList');
  188. if(this.listConfig === 0){
  189. this.getMerList();
  190. }else{
  191. this.getMerListbyids();
  192. }
  193. this.isShowHome = {
  194. typeShow: this.typeShow,
  195. nameShow: this.nameShow,
  196. logoShow: this.logoShow
  197. }
  198. },
  199. methods: {
  200. more() {
  201. this.$util.navigateTo(this.dataConfig.linkConfig.val)
  202. },
  203. //默认店铺数据
  204. getMerList() {
  205. getDiyMerListApi(this.numConfig).then((res) => {
  206. this.merList = res.data.list;
  207. });
  208. },
  209. //自定义店铺数据
  210. getMerListbyids(){
  211. getMerListbyidsApi(this.activeValueMer.join(',')).then((res) => {
  212. this.merList = res.data;
  213. });
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. .indexList {}
  220. .merList {
  221. display: grid;
  222. grid-template-columns: repeat(3, 1fr);
  223. grid-template-rows: auto;
  224. width: 100%;
  225. .item {
  226. position: relative;
  227. .lines {
  228. width: 8rpx;
  229. height: 34rpx;
  230. position: absolute;
  231. z-index: 1;
  232. }
  233. .left {
  234. left: 14rpx;
  235. top: 204rpx;
  236. }
  237. .right {
  238. right: 14rpx;
  239. top: 204rpx;
  240. }
  241. .pic {
  242. width: 100%;
  243. height: 220rpx;
  244. overflow: hidden;
  245. image {
  246. width: 100%;
  247. height: 100%;
  248. }
  249. }
  250. .logo {
  251. width: 150rpx;
  252. height: 44rpx;
  253. background: #FFFFFF;
  254. box-shadow: 0rpx 3rpx 6rpx 1rpx rgba(0, 0, 0, 0.1000);
  255. border-radius: 33rpx;
  256. opacity: 1;
  257. margin: auto;
  258. position: absolute;
  259. z-index: 1;
  260. left: 16%;
  261. top: 59%;
  262. image {
  263. margin: auto;
  264. width: 130rpx;
  265. height: 44rpx;
  266. display: block;
  267. }
  268. }
  269. .merName {
  270. width: 100%;
  271. height: 110rpx;
  272. background: #FFFFFF;
  273. border-radius: 14rpx;
  274. opacity: 1;
  275. padding: 30rpx 0 14rpx 0;
  276. display: flex;
  277. flex-direction: column;
  278. align-items: center;
  279. .neme {
  280. font-weight: bold;
  281. color: #333333;
  282. font-size: 22rpx;
  283. text-align: center;
  284. margin-bottom: 4rpx;
  285. width: 210rpx;
  286. }
  287. .label {
  288. height: 28rpx;
  289. line-height: 28rpx;
  290. border-radius: 14rpx;
  291. opacity: 1;
  292. text-align: center;
  293. font-size: 18rpx;
  294. padding: 0 12rpx;
  295. }
  296. }
  297. }
  298. }
  299. .fs-12{
  300. font-size: 24rpx !important;
  301. }
  302. </style>