my-shop.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015
  1. <template>
  2. <view class="container shop clearfix" :style="{ paddingTop: CustomBar + 'px' }">
  3. <!-- 主页内容 -->
  4. <tui-skeleton
  5. v-if="skeletonShow"
  6. backgroundColor="#fafafa"
  7. borderRadius="10rpx"
  8. :isLoading="true"
  9. :loadingType="5"
  10. ></tui-skeleton>
  11. <template v-else>
  12. <view class="shop-search-main">
  13. <view class="shop-search">
  14. <text class="iconfont icon-sousuo"></text>
  15. <input
  16. class="input"
  17. maxlength="20"
  18. type="text"
  19. value=""
  20. @focus="onFocus"
  21. @input="onShowClose"
  22. v-model.trim="listQuery.keyword"
  23. confirm-type="search"
  24. @confirm="SubMitSearch()"
  25. placeholder="搜索本店铺商品"
  26. />
  27. <text class="iconfont icon-shanchu1" v-if="isShowClose" @click.stop="delInputText()"></text>
  28. </view>
  29. </view>
  30. <view class="container-shop tui-skeleton">
  31. <!-- 轮播 -->
  32. <view class="product-supplier" @click="goSupplier">
  33. <view class="logo"
  34. ><img
  35. :src="shopLogo ? shopLogo : 'https://static.caimei365.com/app/img/icon/icon-shoplogo.png'"
  36. alt=""
  37. /></view>
  38. <view class="main">
  39. <view class="name">{{ shopName }}</view>
  40. <view class="massgs">
  41. <view class="label">满意度:</view>
  42. <view class="p-stars">
  43. <uni-stars
  44. :stars="6"
  45. :iconClass="iconClass"
  46. :iconColor="iconColor"
  47. :fontSize="36"
  48. :widthInfo="176"
  49. ></uni-stars>
  50. </view>
  51. <view class="acount">
  52. <text> {{ normalNum }} </text>件商品
  53. </view>
  54. </view>
  55. </view>
  56. <view class="right"><text class="iconfont icon-xiayibu"></text></view>
  57. </view>
  58. <banner :list="bannerImageList"></banner>
  59. </view>
  60. <view class="container-section tui-skeleton" v-if="!isEmpty">
  61. <view class="tab-title">主推商品</view>
  62. <view class="section-product clearfix">
  63. <view class="floor-item-none" v-if="isHomeProduct">
  64. <image class="none-image" :src="iconNoneData" mode=""></image>
  65. <view class="none-text">暂无主推商品~</view>
  66. </view>
  67. <view
  68. v-else
  69. class="floor-item"
  70. v-for="(prop, index) in recommendList"
  71. :key="index"
  72. @click.stop="navToDetailPage(prop.productId)"
  73. >
  74. <image class="item-img tui-skeleton-fillet" :src="prop.image" mode="aspectFill"></image>
  75. <view class="floor-item-content">
  76. <view class="title tui-skeleton-rect">
  77. <text class="mclap-tag" v-if="prop.beautyActFlag == '1'">美博会</text>
  78. <text class="mclap" :class="prop.beautyActFlag == '1' ? 'indent' : ''">{{
  79. prop.name
  80. }}</text>
  81. </view>
  82. <view class="floor-item-act">
  83. <template v-if="userIdentity === 3">
  84. <view class="coupon-tags" v-if="prop.couponsLogo">优惠券</view>
  85. <template v-if="prop.actStatus === 1">
  86. <view class="floor-tags" v-if="PromotionsFormat(prop.promotions)">
  87. {{ prop.promotions.name }}
  88. <text v-if="hasLogin && prop.priceFlag != 1 && prop.shopId == shopId"
  89. >:¥{{ prop.price | NumFormat }}</text
  90. >
  91. </view>
  92. <view class="floor-tags" v-else>{{ prop.promotions.name }}</view>
  93. </template>
  94. <template v-if="prop.svipProductFlag == 1">
  95. <template v-if="prop.priceFlag != 1">
  96. <view class="svip-tags">
  97. <view class="tags">SVIP</view>
  98. <view class="price" v-if="prop.shopId == shopId">{{
  99. prop.svipPriceTag
  100. }}</view>
  101. </view>
  102. </template>
  103. <template v-else>
  104. <view class="svip-tags"> <view class="tags none">SVIP</view> </view>
  105. </template>
  106. </template>
  107. </template>
  108. <template v-else>
  109. <view class="coupon-tags" v-if="prop.couponsLogo">优惠券</view>
  110. <template v-if="prop.actStatus === 1">
  111. <view class="floor-tags" v-if="PromotionsFormat(prop.promotions)">
  112. {{ prop.promotions.name }}
  113. <text v-if="hasLogin && prop.priceFlag != 1"
  114. >:¥{{ prop.price | NumFormat }}</text
  115. >
  116. </view>
  117. <view class="floor-tags" v-else>{{ prop.promotions.name }}</view>
  118. </template>
  119. <template v-if="prop.svipProductFlag == 1">
  120. <view class="svip-tags">
  121. <view class="tags" :class="{ none: !isShowVipFlag(pros) }">SVIP</view>
  122. <view class="price" v-if="isShowVipFlag(pros)">{{
  123. pros.svipPriceTag
  124. }}</view>
  125. </view>
  126. </template>
  127. </template>
  128. </view>
  129. <view class="" v-if="hasLogin">
  130. <template v-if="userIdentity == 3">
  131. <template v-if="prop.shopId == shopId">
  132. <view class="title-none" v-if="prop.priceFlag === 1">
  133. <text class="p big">¥未公开价格</text>
  134. </view>
  135. <view
  136. class="price tui-skeleton-rect"
  137. v-else
  138. :class="PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? 'none' : ''"
  139. >
  140. <text class="p sm">¥</text>
  141. <text class="p big">{{
  142. (PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? prop.originalPrice : prop.price)
  143. | NumFormat
  144. }}</text>
  145. </view>
  146. </template>
  147. <template v-else>
  148. <view class="no-price">
  149. <view class="p-stars">
  150. <text class="p-no">¥</text>
  151. <uni-grader :grade="Number(prop.priceGrade)" :margin="14"></uni-grader>
  152. </view>
  153. </view>
  154. </template>
  155. </template>
  156. <template v-else-if="userIdentity === 4">
  157. <view class="title-none" v-if="prop.priceFlag === 1">
  158. <text class="p big">¥未公开价格</text>
  159. </view>
  160. <view class="title-none" v-else-if="prop.priceFlag === 2">
  161. <text class="p big">¥价格仅会员可见</text>
  162. </view>
  163. <view class="title-none" v-else-if="prop.priceFlag === 3">
  164. <text class="p big">¥仅医美机构可见</text>
  165. </view>
  166. <view
  167. class="price tui-skeleton-rect"
  168. v-if="prop.priceFlag === 0"
  169. :class="PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? 'none' : ''"
  170. >
  171. <text class="p sm">¥</text>
  172. <text class="p big">{{
  173. (PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? prop.originalPrice : prop.price)
  174. | NumFormat
  175. }}</text>
  176. </view>
  177. </template>
  178. <template v-else-if="userIdentity === 2">
  179. <view class="title-none" v-if="prop.priceFlag === 1">
  180. <text class="p big">¥未公开价格</text>
  181. </view>
  182. <view class="title-none" v-else-if="prop.priceFlag === 3 && (firstClubType!=1)">
  183. <text class="p big">¥仅医美机构可见</text>
  184. </view>
  185. <view
  186. class="price tui-skeleton-rect"
  187. v-else
  188. :class="PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? 'none' : ''"
  189. >
  190. <text class="p sm">¥</text>
  191. <text class="p big">{{
  192. (PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? prop.originalPrice : prop.price)
  193. | NumFormat
  194. }}</text>
  195. </view>
  196. </template>
  197. <template v-else>
  198. <view class="title-none" v-if="prop.priceFlag === 1">
  199. <text class="p big">¥未公开价格</text>
  200. </view>
  201. <view
  202. class="price tui-skeleton-rect"
  203. v-else
  204. :class="PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? 'none' : ''"
  205. >
  206. <text class="p sm">¥</text>
  207. <text class="p big">{{
  208. (PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? prop.originalPrice : prop.price)
  209. | NumFormat
  210. }}</text>
  211. </view>
  212. </template>
  213. </view>
  214. <view v-else class="no-price">
  215. <view class="p-stars">
  216. <text class="p-no">¥</text>
  217. <uni-grader :grade="Number(prop.priceGrade)"></uni-grader>
  218. <template v-if="prop.actStatus == 1">
  219. <view class="floor-tags" v-if="PromotionsFormat(prop.promotions)">
  220. {{ prop.promotions.name
  221. }}<text v-if="hasLogin && prop.priceFlag != 1"
  222. >:¥{{ prop.price | NumFormat }}</text
  223. >
  224. </view>
  225. <view class="floor-tags" v-else>{{ prop.promotions.name }}</view>
  226. </template>
  227. </view>
  228. </view>
  229. </view>
  230. </view>
  231. </view>
  232. </view>
  233. <view class="container-section tui-skeleton">
  234. <view class="tab-title" v-if="!isEmpty">全部商品</view>
  235. <view class="section-product clearfix">
  236. <view class="floor-item-none" v-if="isEmpty">
  237. <image class="none-image" :src="iconNoneData1" mode=""></image>
  238. <view class="none-text">暂未发布任何商品~</view>
  239. </view>
  240. <view
  241. v-else
  242. class="floor-item"
  243. v-for="(prop, index) in productList"
  244. :key="index"
  245. @click.stop="navToDetailPage(prop.productId)"
  246. >
  247. <image class="item-img tui-skeleton-fillet" :src="prop.image" mode="aspectFill"></image>
  248. <view class="floor-item-content">
  249. <view class="title tui-skeleton-rect">
  250. <text class="mclap-tag" v-if="prop.priceFlag == '1'">美博会</text>
  251. <text class="mclap" :class="prop.priceFlag == '1' ? 'indent' : ''">{{
  252. isInterceptHtmlFn(prop.name)
  253. }}</text>
  254. </view>
  255. <view class="floor-item-act">
  256. <template v-if="userIdentity === 3">
  257. <view class="coupon-tags" v-if="prop.couponsLogo">优惠券</view>
  258. <template v-if="prop.actStatus === 1">
  259. <view class="floor-tags" v-if="PromotionsFormat(prop.promotions)">
  260. {{ prop.promotions.name }}
  261. <text v-if="hasLogin && prop.priceFlag != 1 && prop.shopId == shopId"
  262. >:¥{{ prop.price | NumFormat }}</text
  263. >
  264. </view>
  265. <view class="floor-tags" v-else>{{ prop.promotions.name }}</view>
  266. </template>
  267. <template v-if="prop.svipProductFlag == 1">
  268. <template v-if="prop.priceFlag != 1">
  269. <view class="svip-tags">
  270. <view class="tags">SVIP</view>
  271. <view class="price" v-if="prop.shopId == shopId">{{
  272. prop.svipPriceTag
  273. }}</view>
  274. </view>
  275. </template>
  276. <template v-else>
  277. <view class="svip-tags"> <view class="tags none">SVIP</view> </view>
  278. </template>
  279. </template>
  280. </template>
  281. <template v-else>
  282. <view class="coupon-tags" v-if="prop.couponsLogo">优惠券</view>
  283. <template v-if="prop.actStatus === 1">
  284. <view class="floor-tags" v-if="PromotionsFormat(prop.promotions)">
  285. {{ prop.promotions.name }}
  286. <text v-if="hasLogin && prop.priceFlag != 1"
  287. >:¥{{ prop.price | NumFormat }}</text
  288. >
  289. </view>
  290. <view class="floor-tags" v-else>{{ prop.promotions.name }}</view>
  291. </template>
  292. <template v-if="prop.svipProductFlag == 1">
  293. <view class="svip-tags">
  294. <view class="tags" :class="{ none: !isShowVipFlag(pros) }">SVIP</view>
  295. <view class="price" v-if="isShowVipFlag(pros)">{{
  296. pros.svipPriceTag
  297. }}</view>
  298. </view>
  299. </template>
  300. </template>
  301. </view>
  302. <view class="" v-if="hasLogin">
  303. <template v-if="userIdentity == 3">
  304. <template v-if="prop.shopId == shopId">
  305. <view class="title-none" v-if="prop.priceFlag === 1">
  306. <text class="p big">¥未公开价格</text>
  307. </view>
  308. <view
  309. class="price tui-skeleton-rect"
  310. v-else
  311. :class="PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? 'none' : ''"
  312. >
  313. <text class="p sm">¥</text>
  314. <text class="p big">{{
  315. (PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? prop.originalPrice : prop.price)
  316. | NumFormat
  317. }}</text>
  318. </view>
  319. </template>
  320. <template v-else>
  321. <view class="no-price">
  322. <view class="p-stars">
  323. <text class="p-no">¥</text>
  324. <uni-grader :grade="Number(prop.priceGrade)" :margin="14"></uni-grader>
  325. </view>
  326. </view>
  327. </template>
  328. </template>
  329. <template v-else-if="userIdentity === 4">
  330. <view class="title-none" v-if="prop.priceFlag === 1">
  331. <text class="p big">¥未公开价格</text>
  332. </view>
  333. <view class="title-none" v-else-if="prop.priceFlag === 2">
  334. <text class="p big">¥价格仅会员可见</text>
  335. </view>
  336. <view class="title-none" v-else-if="prop.priceFlag === 3">
  337. <text class="p big">¥仅医美机构可见</text>
  338. </view>
  339. <view
  340. class="price tui-skeleton-rect"
  341. v-if="prop.priceFlag === 0"
  342. :class="PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? 'none' : ''"
  343. >
  344. <text class="p sm">¥</text>
  345. <text class="p big">{{
  346. (PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? prop.originalPrice : prop.price)
  347. | NumFormat
  348. }}</text>
  349. </view>
  350. </template>
  351. <template v-else-if="userIdentity === 2">
  352. <view class="title-none" v-if="prop.priceFlag === 1">
  353. <text class="p big">¥未公开价格</text>
  354. </view>
  355. <view class="title-none" v-else-if="prop.priceFlag === 3 && (firstClubType!=1)">
  356. <text class="p big">¥仅医美机构可见</text>
  357. </view>
  358. <view
  359. class="price tui-skeleton-rect"
  360. v-else
  361. :class="PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? 'none' : ''"
  362. >
  363. <text class="p sm">¥</text>
  364. <text class="p big">{{
  365. (PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? prop.originalPrice : prop.price)
  366. | NumFormat
  367. }}</text>
  368. </view>
  369. </template>
  370. <template v-else>
  371. <view class="title-none" v-if="prop.priceFlag === 1">
  372. <text class="p big">¥未公开价格</text>
  373. </view>
  374. <view
  375. class="price tui-skeleton-rect"
  376. v-else
  377. :class="PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? 'none' : ''"
  378. >
  379. <text class="p sm">¥</text>
  380. <text class="p big">{{
  381. (PromotionsFormat(prop.promotions) || prop.svipProductFlag == 1 ? prop.originalPrice : prop.price)
  382. | NumFormat
  383. }}</text>
  384. </view>
  385. </template>
  386. </view>
  387. <view v-else class="no-price">
  388. <view class="p-stars">
  389. <text class="p-no">¥</text>
  390. <uni-grader :grade="Number(prop.priceGrade)"></uni-grader>
  391. </view>
  392. </view>
  393. </view>
  394. </view>
  395. </view>
  396. </view>
  397. </template>
  398. <!-- 侧边 -->
  399. <scroll-top :isScrollTop="isScrollTop" :bottom="200"></scroll-top>
  400. </view>
  401. </template>
  402. <script>
  403. import { mapState, mapMutations } from 'vuex'
  404. import banner from '@/components/cm-module/supplier/banner.vue'
  405. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  406. import authorize from '@/common/config/authorize.js'
  407. import wxLogin from '@/common/config/wxLogin.js'
  408. export default {
  409. components: {
  410. banner,
  411. uniGrader
  412. },
  413. data() {
  414. return {
  415. userId: 0,
  416. supplierId: 0,
  417. shopId: 0,
  418. iconClass: 'icon-aixin',
  419. iconColor: '#ff9100',
  420. iconNoneData: 'https://static.caimei365.com/app/img/icon/icon-prnone.png',
  421. iconNoneData1: 'https://static.caimei365.com/app/img/icon/icon-pbnone.png',
  422. isScrollTop: false,
  423. shopName: '',
  424. shopLogo: '',
  425. normalNum: 0,
  426. isFocus: false,
  427. isEmpty: false,
  428. isShowClose: false, //是否显示清空输入框图标
  429. skeletonShow: true,
  430. bannerImageList: [],
  431. recommendList: [],
  432. productList: [],
  433. userIdentity: 0,
  434. firstClubType:0,
  435. listQuery: {
  436. keyword: '',
  437. pageSize: 10,
  438. pageNum: 1,
  439. id: 0,
  440. identity:0
  441. },
  442. isHomeProduct: false,
  443. total: 0
  444. }
  445. },
  446. computed: {
  447. ...mapState(['hasLogin', 'userInfo', 'isActivity', 'identity', 'clubType'])
  448. },
  449. onLoad(option) {
  450. if (option.type == 'share') {
  451. wxLogin.wxLoginAuthorize()
  452. }
  453. this.listQuery.id = this.supplierId = option.shopId
  454. this.initGetStotage()
  455. },
  456. filters: {
  457. NumFormat: function(text) {
  458. //处理金额
  459. return Number(text).toFixed(2)
  460. }
  461. },
  462. methods: {
  463. ...mapMutations(['login', 'logout']),
  464. async initGetStotage(option) {
  465. const userInfo = await this.$api.getStorage()
  466. this.shopId = userInfo.shopId ? userInfo.shopId : 0
  467. this.userId = userInfo.userId ? userInfo.userId : 0
  468. this.listQuery.identity = this.identity
  469. this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
  470. this.vipFlag = userInfo.vipFlag ? userInfo.vipFlag : 0
  471. this.firstClubType = this.clubType
  472. //初始化请求数据
  473. this.GetSupplierHomeBanner()
  474. this.GetSupplierHomeDeatils()
  475. this.GetSupplierHomeProduct()
  476. this.GetSupplierHomeProductList()
  477. this.skeletonShow = false
  478. },
  479. GetSupplierHomeBanner() {
  480. //轮播图
  481. this.ShopService.GetSupplierHomeBanner({ shopId: this.supplierId })
  482. .then(response => {
  483. this.bannerImageList = response.data
  484. })
  485. .catch(error => {
  486. this.$util.msg(error.msg, 2000)
  487. })
  488. },
  489. GetSupplierHomeDeatils() {
  490. //商铺详情
  491. this.ShopService.GetSupplierHomeDeatils({ shopId: this.supplierId })
  492. .then(response => {
  493. let data = response.data
  494. this.normalNum = data.normalNum
  495. this.shopName = data.name
  496. this.shopLogo = data.logo
  497. })
  498. .catch(error => {
  499. this.$util.msg(error.msg, 2000)
  500. })
  501. },
  502. GetSupplierHomeProduct() {
  503. //主推商品
  504. this.ShopService.GetSupplierHomeProduct({ shopId: this.supplierId, identity: this.identity })
  505. .then(response => {
  506. let data = response.data
  507. console.log('主推商品', data)
  508. if (data.length > 0) {
  509. this.isHomeProduct = false
  510. this.QueryProductPrice(data)
  511. } else {
  512. this.isHomeProduct = true
  513. }
  514. })
  515. .catch(error => {
  516. this.$util.msg(error.msg, 2000)
  517. })
  518. },
  519. GetSupplierHomeProductList() {
  520. //全部商品
  521. this.ShopService.GetSupplierHomeProductList(this.listQuery)
  522. .then(response => {
  523. let data = JSON.parse(response.data)
  524. console.log('全部商品', data)
  525. let dataList = data.items
  526. this.total = data.total
  527. if (this.total > 0) {
  528. this.isEmpty = false
  529. this.productList = dataList
  530. this.QueryProductPrice1(this.productList)
  531. } else {
  532. this.isEmpty = true
  533. }
  534. })
  535. .catch(error => {
  536. this.$util.msg(error.msg, 2000)
  537. })
  538. },
  539. GetMoreSupplierHomeProductList() {
  540. //加载分页
  541. this.listQuery.pageNum += 1
  542. this.ShopService.GetSupplierHomeProductList(this.listQuery)
  543. .then(response => {
  544. let data = JSON.parse(response.data)
  545. this.total = data.total
  546. this.productList = this.productList.concat(data.items)
  547. this.QueryProductPrice1(this.productList)
  548. })
  549. .catch(error => {
  550. this.$util.msg(error.msg, 2000)
  551. })
  552. },
  553. QueryProductPrice(data) {
  554. //处理主推商品商品或者活动价格
  555. let productIdArr = []
  556. let productIds = ''
  557. data.map(item => {
  558. // 0公开价格 1不公开价格 2仅对资质机构公开
  559. productIdArr.push(item.productId)
  560. })
  561. productIds = productIdArr.join(',')
  562. this.ProductService.querySearchProductPrice({
  563. userId: this.userId,
  564. productIds: productIds,
  565. source: 2
  566. })
  567. .then(response => {
  568. this.recommendList = this.ReturnNewProducts(data, response.data)
  569. })
  570. .catch(error => {
  571. this.$util.msg(error.msg, 2000)
  572. })
  573. },
  574. QueryProductPrice1(data) {
  575. //获取商品或者活动价格
  576. let productIdArr = []
  577. let productIds = ''
  578. data.map(item => {
  579. // 0公开价格 1不公开价格 2仅对资质机构公开
  580. productIdArr.push(item.productId)
  581. })
  582. productIds = productIdArr.join(',')
  583. this.ProductService.querySearchProductPrice({
  584. userId: this.userId,
  585. productIds: productIds,
  586. source: 2
  587. })
  588. .then(response => {
  589. this.productList = this.ReturnNewProducts(data, response.data)
  590. console.log('合并价格后', this.productList)
  591. })
  592. .catch(error => {
  593. this.$util.msg(error.msg, 2000)
  594. })
  595. },
  596. ReturnNewProducts(listA, listB) {
  597. let NewArray = []
  598. listA.map(item => {
  599. for (let i = 0; i < listB.length; i++) {
  600. if (item.productId == listB[i].productId) {
  601. NewArray.push(Object.assign(item, listB[i]))
  602. }
  603. }
  604. })
  605. return NewArray
  606. },
  607. SubMitSearch() {
  608. //搜索
  609. this.listQuery.pageNum = 1
  610. this.GetSupplierHomeProductList()
  611. },
  612. PromotionsFormat(promo) {
  613. //促销活动类型数据处理
  614. if (promo != null) {
  615. if (promo.type == 1 && promo.mode == 1) {
  616. return true
  617. } else {
  618. return false
  619. }
  620. }
  621. return false
  622. },
  623. onShowClose() {
  624. //输入框输入时触发
  625. this.inputEmpty(this.listQuery.keyword)
  626. },
  627. onFocus() {
  628. //输入框获取焦点时触发
  629. this.inputEmpty(this.listQuery.keyword)
  630. },
  631. delInputText() {
  632. //清除输入框内容
  633. this.listQuery.keyword = ''
  634. this.isShowClose = false
  635. this.isShowWrapper = false
  636. this.inputEmpty(this.listQuery.keyword)
  637. this.initGetSerachRecord()
  638. },
  639. inputEmpty(val) {
  640. if (val != '') {
  641. this.isShowClose = true
  642. this.isFocus = true
  643. } else {
  644. this.isShowClose = false
  645. this.isFocus = true
  646. }
  647. },
  648. isInterceptHtmlFn(text) {
  649. let name = this.$reg.interceptHtmlFn(text)
  650. return name
  651. },
  652. goSupplier() {
  653. //跳供应商资料页
  654. this.$api.navigateTo('/pages/supplier/user/supplier?shopId=' + this.supplierId)
  655. },
  656. navToDetailPage(id) {
  657. //跳转商品详情页
  658. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  659. },
  660. isShowVipFlag(pros) {
  661. /**
  662. *显示SVIP和超级会员价格:
  663. * 个人机构(不是超级会员,但价格所有机构可见),
  664. * 资质机构(不是超级会员,但价格所有机构可见或仅会员可见),
  665. * 超级会员(价格所有机构可见或仅会员可见),超级会员(是医美机构,价格仅医美可见)
  666. *商品价格是否可见:priceFlag 0:所有机构可见 1:未公开价格 2:仅会员可见 3:仅医美机构可见
  667. * 普通机构
  668. * 超级会员 && priceFlag === 0
  669. * 资质机构
  670. * priceFlag !== 1 ||
  671. * 超级会员
  672. * 商品priceFlag === 3 && 是否是医美机构
  673. */
  674. // 未登录 || 非会员
  675. if(!this.hasLogin || !this.vipFlag === 1) return false
  676. // 商品所有机构可见
  677. if(pros.priceFlag === 0 ) return true
  678. // 商品价格仅资质机构可见
  679. if((pros.priceFlag === 2 && this.userIdentity === 2) || this.userIdentity === 1) return true
  680. // 商品价格仅医美机构可见
  681. if((pros.priceFlag === 3 && this.userIdentity === 2 && this.firstClubType == 1) || this.userIdentity === 1) return true
  682. // 其它
  683. return false
  684. },
  685. },
  686. onPageScroll(e) {
  687. //实时获取到滚动的值
  688. if (e.scrollTop > 400) {
  689. this.isScrollTop = true
  690. } else {
  691. this.isScrollTop = false
  692. }
  693. },
  694. onPullDownRefresh() {
  695. //下拉刷新
  696. this.listQuery.pageNum = 1
  697. this.productList = []
  698. this.InitShopDataInfo()
  699. uni.stopPullDownRefresh()
  700. },
  701. onReachBottom() {
  702. //上滑加载分页
  703. if (this.total > this.productList.length) {
  704. this.loadding = true
  705. this.pullUpOn = true
  706. this.GetMoreSupplierHomeProductList()
  707. }
  708. },
  709. onShareAppMessage(res) {
  710. //分享转发
  711. if (res.from === 'button') {
  712. // 来自页面内转发按钮
  713. }
  714. return {
  715. title: '进入店铺,发现惊喜',
  716. path: `pages/supplier/user/my-shop?type=share&shopId=${this.listQuery.id}`
  717. }
  718. },
  719. onShow() {}
  720. }
  721. </script>
  722. <style lang="scss">
  723. page {
  724. background-color: #f7f7f7;
  725. }
  726. .shop {
  727. width: 100%;
  728. height: auto;
  729. }
  730. .shop-search-main {
  731. width: 100%;
  732. height: 86rpx;
  733. background-color: #ffffff;
  734. box-sizing: border-box;
  735. padding: 10rpx 24rpx;
  736. position: fixed;
  737. top: 0;
  738. left: 0;
  739. z-index: 999;
  740. .shop-search {
  741. width: 100%;
  742. height: 66rpx;
  743. border-radius: 33rpx;
  744. background-color: #f7f7f7;
  745. box-sizing: border-box;
  746. position: relative;
  747. .icon-sousuo {
  748. width: 80rpx;
  749. height: 66rpx;
  750. display: block;
  751. float: left;
  752. color: #707070;
  753. line-height: 66rpx;
  754. text-align: center;
  755. font-size: 36rpx;
  756. }
  757. .icon-shanchu1 {
  758. width: 80rpx;
  759. height: 66rpx;
  760. display: block;
  761. color: #8a8a8a;
  762. line-height: 66rpx;
  763. text-align: center;
  764. font-size: 36rpx;
  765. position: absolute;
  766. right: 0;
  767. top: 0;
  768. z-index: 100;
  769. }
  770. .input {
  771. width: 580rpx;
  772. height: 66rpx;
  773. box-sizing: border-box;
  774. color: #666666;
  775. overflow: hidden;
  776. font-size: $font-size-24;
  777. }
  778. }
  779. }
  780. .container-shop {
  781. width: 100%;
  782. height: auto;
  783. padding: 24rpx;
  784. box-sizing: border-box;
  785. background-color: #ffffff;
  786. margin-top: 96rpx;
  787. }
  788. .product-supplier {
  789. width: 100%;
  790. height: 140rpx;
  791. padding: 30rpx 0 10rpx 0;
  792. box-sizing: border-box;
  793. background-color: #ffffff;
  794. position: relative;
  795. box-sizing: border-box;
  796. .logo {
  797. width: 128rpx;
  798. height: 92rpx;
  799. float: left;
  800. border: 1px solid #efefef;
  801. border-radius: 6rpx;
  802. image {
  803. width: 100%;
  804. height: 100%;
  805. display: block;
  806. border-radius: 6rpx;
  807. }
  808. }
  809. .main {
  810. width: 470rpx;
  811. height: 92rpx;
  812. float: left;
  813. margin-left: 20rpx;
  814. .name {
  815. width: 100%;
  816. line-height: 46rpx;
  817. float: left;
  818. font-size: $font-size-28;
  819. color: $text-color;
  820. float: right;
  821. overflow: hidden;
  822. text-overflow: ellipsis;
  823. white-space: nowrap;
  824. text-align: left;
  825. }
  826. .massgs {
  827. width: 100%;
  828. line-height: 46rpx;
  829. float: left;
  830. font-size: $font-size-24;
  831. color: #999999;
  832. .label {
  833. float: left;
  834. }
  835. .p-stars {
  836. float: left;
  837. margin-left: 20rpx;
  838. }
  839. .acount {
  840. float: right;
  841. text {
  842. color: $color-system;
  843. }
  844. }
  845. }
  846. }
  847. .icon-xiayibu {
  848. line-height: 154rpx;
  849. display: inline-block;
  850. position: absolute;
  851. width: 48rpx;
  852. top: 0;
  853. right: 0;
  854. color: #b2b2b2;
  855. }
  856. }
  857. .container-section {
  858. width: 100%;
  859. height: auto;
  860. background-color: #f7f7f7;
  861. box-sizing: border-box;
  862. padding: 0 24rpx;
  863. .tab-title {
  864. width: 100%;
  865. height: 88rpx;
  866. line-height: 88rpx;
  867. font-size: $font-size-30;
  868. font-weight: bold;
  869. }
  870. .section-product {
  871. width: 100%;
  872. height: auto;
  873. .floor-item-none {
  874. min-height: 300rpx;
  875. display: flex;
  876. flex-direction: column;
  877. align-items: center;
  878. .none-image {
  879. width: 260rpx;
  880. height: 260rpx;
  881. }
  882. .none-text {
  883. text-align: center;
  884. font-size: $font-size-28;
  885. color: #999999;
  886. line-height: 40rpx;
  887. }
  888. }
  889. .floor-item {
  890. width: 341rpx;
  891. height: auto;
  892. margin-right: 20rpx;
  893. font-size: $font-size-24;
  894. color: $text-color;
  895. background: #ffffff;
  896. line-height: 36rpx;
  897. border-radius: 20rpx;
  898. margin-bottom: 20rpx;
  899. float: left;
  900. box-sizing: border-box;
  901. padding-bottom: 10rpx;
  902. &:nth-child(2n) {
  903. margin-right: 0;
  904. }
  905. .item-img {
  906. width: 341rpx;
  907. height: 341rpx;
  908. border-radius: 20rpx 20rpx 0 0;
  909. display: block;
  910. margin-bottom: 20rpx;
  911. }
  912. .floor-item-content {
  913. width: 311rpx;
  914. padding: 0 15rpx;
  915. }
  916. .floor-item-act {
  917. display: block;
  918. width: 100%;
  919. height: 68rpx;
  920. text-align: center;
  921. box-sizing: border-box;
  922. padding: 16rpx 0;
  923. margin-top: 8rpx;
  924. }
  925. .title-none {
  926. font-size: $font-size-26;
  927. color: #ff2a2a;
  928. line-height: 54rpx;
  929. .btn {
  930. display: inline-block;
  931. float: right;
  932. width: 112rpx;
  933. height: 44rpx;
  934. background: $btn-confirm;
  935. line-height: 44rpx;
  936. font-size: $font-size-24;
  937. color: #ffffff;
  938. text-align: center;
  939. border-radius: 22rpx;
  940. margin-top: 17rpx;
  941. }
  942. }
  943. .title {
  944. width: 100%;
  945. height: 72rpx;
  946. display: flex;
  947. flex-direction: column;
  948. margin-bottom: 15rpx;
  949. padding: 0;
  950. position: relative;
  951. .mclap {
  952. width: 100%;
  953. line-height: 40rpx;
  954. text-overflow: ellipsis;
  955. display: -webkit-box;
  956. word-break: break-all;
  957. -webkit-box-orient: vertical;
  958. -webkit-line-clamp: 2;
  959. overflow: hidden;
  960. font-size: 26rpx;
  961. &.indent {
  962. text-indent: 95rpx;
  963. }
  964. }
  965. .mclap-tag {
  966. display: block;
  967. width: 84rpx;
  968. height: 32rpx;
  969. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  970. border-radius: 4rpx 48rpx 4px 4px;
  971. line-height: 32rpx;
  972. font-size: $font-size-22;
  973. color: #ffffff;
  974. text-align: center;
  975. position: absolute;
  976. left: 0;
  977. top: 0;
  978. }
  979. }
  980. .no-price {
  981. height: 54rpx;
  982. line-height: 54rpx;
  983. display: flex;
  984. box-sizing: border-box;
  985. .p-no {
  986. font-size: $font-size-30;
  987. color: $text-color;
  988. display: block;
  989. float: left;
  990. }
  991. .p-stars {
  992. float: left;
  993. }
  994. }
  995. .price {
  996. color: #ff2a2a;
  997. line-height: 54rpx;
  998. &.none {
  999. text-decoration: line-through;
  1000. color: #999999;
  1001. }
  1002. .sm {
  1003. font-size: $font-size-24;
  1004. }
  1005. .big {
  1006. font-size: $font-size-28;
  1007. }
  1008. }
  1009. }
  1010. }
  1011. }
  1012. </style>