my-shop.vue 30 KB

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