my-shop.vue 30 KB

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