goods-classify.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333
  1. <template>
  2. <view class="container all-type-list-wrapper">
  3. <!-- 自定义顶部 -->
  4. <custom-floor :systeminfo="systeminfo" :navbar-data="nvabarData" :headerBtnPosi="headerBtnPosi"></custom-floor>
  5. <view class="tui-header-screen" :style="{ top: CustomBar + 'px' }">
  6. <view class="tui-screen-top">
  7. <view
  8. class="tui-top-item"
  9. :class="[tabIndex == 0 ? 'tui-active' : '']"
  10. @tap="handleScreen"
  11. data-index="0"
  12. >综合</view
  13. >
  14. <view
  15. class="tui-top-item tui-icon-ml"
  16. :class="[tabIndex == 1 ? 'tui-active' : '']"
  17. data-index="1"
  18. @tap="handleScreen"
  19. >
  20. <view>销量</view> <text class="iconfont icon-shangxiajiantou" v-if="isSearchSalesFirst"></text>
  21. <template v-else>
  22. <tui-icon
  23. :name="isSearchSales ? 'turningdown' : 'turningup'"
  24. :size="18"
  25. :color="tabIndex == 1 ? '#FF5B00' : '#999'"
  26. tui-icon-class="tui-ml"
  27. ></tui-icon>
  28. </template>
  29. </view>
  30. <view
  31. class="tui-top-item tui-icon-ml"
  32. :class="[tabIndex == 2 ? 'tui-active' : '']"
  33. data-index="2"
  34. @tap="handleScreen"
  35. >
  36. <view>人气</view> <text class="iconfont icon-shangxiajiantou" v-if="isSearchMoodFirst"></text>
  37. <template v-else>
  38. <tui-icon
  39. :name="isSearchMood ? 'turningdown' : 'turningup'"
  40. :size="18"
  41. :color="tabIndex == 2 ? '#FF5B00' : '#999'"
  42. tui-icon-class="tui-ml"
  43. ></tui-icon>
  44. </template>
  45. </view>
  46. <view
  47. class="tui-top-item tui-icon-ml"
  48. :class="[tabIndex == 3 ? 'tui-active' : '']"
  49. data-index="3"
  50. @tap="handleScreen"
  51. >
  52. <view>价格</view> <text class="iconfont icon-shangxiajiantou" v-if="isSearchPriceFirst"></text>
  53. <template v-else>
  54. <tui-icon
  55. :name="isSearchPrice ? 'turningdown' : 'turningup'"
  56. :size="18"
  57. :color="tabIndex == 3 ? '#FF5B00' : '#999'"
  58. tui-icon-class="tui-ml"
  59. ></tui-icon>
  60. </template>
  61. </view>
  62. <view class="tui-top-item" @tap="handleScreen" data-index="4">
  63. <view>筛选</view> <text class="iconfont icon-shaixuan"></text>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- 商品列表 -->
  68. <list-skeleton v-if="showSkeleton" :listType="0"></list-skeleton>
  69. <template v-else>
  70. <view class="empty-container" v-if="showEmpty">
  71. <image
  72. class="empty-container-image"
  73. src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png"
  74. ></image>
  75. <text class="error-text">{{ emptyText }}</text>
  76. </view>
  77. <template v-else>
  78. <view
  79. class="container-list"
  80. :style="{ height: scrollHeight + 'px', paddingTop: CustomBar + 44 + 'px' }"
  81. >
  82. <view
  83. v-for="(pros, index) in listData"
  84. :key="index"
  85. :id="pros.productId"
  86. class="all-type-list-content commodity-list"
  87. @click.stop="navToDetailPage(pros.productId)"
  88. >
  89. <view class="list-details-image">
  90. <image mode="widthFix" :src="pros.image" class="list-img" alt="list-img"></image>
  91. <view class="list-details-type" v-if="pros.productType == 2">医疗器械</view>
  92. </view>
  93. <view class="list-details-info">
  94. <text class="list-details-title">
  95. <text class="mclap-tag" v-if="pros.beautyActFlag == 1">美博会</text>
  96. <text class="mclap" :class="pros.beautyActFlag == 1 ? 'indent' : ''">{{
  97. pros.name
  98. }}</text>
  99. </text>
  100. <text class="list-details-specs">规格:{{ pros.unit }}</text>
  101. <view class="list-details-specs" v-if="pros.code != '' && pros.code != null"
  102. >商品编码:{{ pros.code }}</view
  103. >
  104. <view class="list-details-price">
  105. <template v-if="userIdentity == 3">
  106. <view class="floor-item-act">
  107. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  108. <template v-if="pros.actStatus == 1">
  109. <view class="floor-tags" v-if="PromotionsFormat(pros.promotions)">
  110. {{ pros.promotions.name }}
  111. <text v-if="hasLogin && userIdentity == 3 && pros.priceFlag != 1"
  112. >:¥{{ pros.price | NumFormat }}</text
  113. >
  114. </view>
  115. <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
  116. </template>
  117. <template v-if="pros.svipProductFlag == 1">
  118. <view
  119. class="svip-tags"
  120. v-if="hasLogin && userIdentity == 3 && pros.priceFlag != 1"
  121. >
  122. <view class="tags">SVIP</view>
  123. <view class="price">{{ pros.svipPriceTag }}</view>
  124. </view>
  125. <view class="svip-tags" v-else> <view class="tags none">SVIP</view> </view>
  126. </template>
  127. </view>
  128. </template>
  129. <template v-else-if="userIdentity == 1">
  130. <view class="floor-item-act">
  131. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  132. <template v-if="pros.actStatus == 1">
  133. <view
  134. class="floor-tags"
  135. v-if="pros.actStatus == 1 && PromotionsFormat(pros.promotions)"
  136. >
  137. {{ pros.promotions.name }} <text>:¥{{ pros.price | NumFormat }}</text>
  138. </view>
  139. <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
  140. </template>
  141. <template v-if="pros.svipProductFlag == 1">
  142. <view class="svip-tags"><view class="tags none">SVIP</view> </view>
  143. </template>
  144. </view>
  145. </template>
  146. <template v-else>
  147. <view class="floor-item-act">
  148. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  149. <template v-if="pros.actStatus == 1">
  150. <view
  151. class="floor-tags"
  152. v-if="pros.actStatus == 1 && PromotionsFormat(pros.promotions)"
  153. >
  154. {{ pros.promotions.name }}
  155. <text v-if="hasLogin && ((userIdentity === 4 && pros.priceFlag === 0) || (userIdentity === 2 && pros.priceFlag !== 1))"
  156. >:¥{{ pros.price | NumFormat }}</text
  157. >
  158. </view>
  159. <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
  160. </template>
  161. <template v-if="pros.svipProductFlag == 1">
  162. <view class="svip-tags">
  163. <view class="tags" :class="{ none: !isShowVipFlag(pros) }">SVIP</view>
  164. <view class="price" v-if="isShowVipFlag(pros)">{{
  165. pros.svipPriceTag
  166. }}</view>
  167. </view>
  168. </template>
  169. </view>
  170. </template>
  171. <view v-if="hasLogin" class="list-price">
  172. <template v-if="userIdentity == 1">
  173. <text v-if="priceLoading" class="price-larger small">正在获取价格...</text>
  174. <template v-else>
  175. <text
  176. class="price-larger"
  177. :class="
  178. PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  179. ? 'none'
  180. : ''
  181. "
  182. >
  183. ¥{{
  184. (PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  185. ? pros.originalPrice
  186. : pros.price) | NumFormat
  187. }}
  188. </text>
  189. </template>
  190. </template>
  191. <template v-if="userIdentity == 4 && vipFlag != 1">
  192. <view class="price-larger" v-if="pros.priceFlag == 1">
  193. <text class="txt">¥未公开价格</text>
  194. </view>
  195. <text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
  196. <template v-else>
  197. <view class="price-larger" v-if="pros.priceFlag == 2">
  198. <text class="txt">¥价格仅会员可见</text>
  199. </view>
  200. <view class="price-larger" v-else-if="pros.priceFlag == 3">
  201. <text class="txt">¥仅医美机构可见</text>
  202. </view>
  203. <text
  204. v-else
  205. class="price-larger"
  206. :class="
  207. PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  208. ? 'none'
  209. : ''
  210. "
  211. >
  212. ¥{{
  213. (PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  214. ? pros.originalPrice
  215. : pros.price) | NumFormat
  216. }}
  217. </text>
  218. </template>
  219. </template>
  220. <template v-if="userIdentity == 3">
  221. <template v-if="pros.supplierId === shopId">
  222. <view class="price-larger" v-if="pros.priceFlag == 1">
  223. <text class="txt">¥未公开价格</text>
  224. </view>
  225. <text v-else-if="priceLoading" class="price-larger small"
  226. >正在获取价格...</text
  227. >
  228. <text
  229. v-else
  230. class="price-larger"
  231. :class="
  232. PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  233. ? 'none'
  234. : ''
  235. "
  236. >
  237. ¥{{
  238. (PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  239. ? pros.originalPrice
  240. : pros.price) | NumFormat
  241. }}
  242. </text>
  243. </template>
  244. <template v-else>
  245. <view class="list-login-now">
  246. <text class="p-no">¥</text>
  247. <uni-grader :grade="Number(pros.priceGrade)"></uni-grader>
  248. </view>
  249. </template>
  250. </template>
  251. <template v-if="userIdentity == 2 || (userIdentity == 4 && vipFlag == 1)">
  252. <view class="price-larger" v-if="pros.priceFlag == 1">
  253. <text class="txt">¥未公开价格</text>
  254. </view>
  255. <text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
  256. <template v-else>
  257. <view class="price-larger" v-if="pros.priceFlag == 3 && (firstClubType!=1)">
  258. <text class="txt">¥仅医美机构可见</text>
  259. </view>
  260. <text
  261. v-else
  262. class="price-larger"
  263. :class="
  264. PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  265. ? 'none'
  266. : ''
  267. "
  268. >
  269. ¥{{
  270. (PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  271. ? pros.originalPrice
  272. : pros.price) | NumFormat
  273. }}
  274. </text>
  275. </template>
  276. </template>
  277. </view>
  278. <view v-else class="list-login-now">
  279. <text class="p-no">¥</text>
  280. <uni-grader :grade="Number(pros.priceGrade)"></uni-grader>
  281. </view>
  282. </view>
  283. </view>
  284. </view>
  285. <!--加载loadding-->
  286. <tui-loadmore :visible="loadding" :index="3" type="black" />
  287. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text="nomoreText" />
  288. <!--加载loadding-->
  289. </view>
  290. </template>
  291. </template>
  292. <!--右抽屉-->
  293. <tui-drawer mode="right" :visible="rightDrawer" @close="closeDrawer">
  294. <view
  295. class="drawer-container clearfix"
  296. scroll-y
  297. :style="{ paddingTop: CustomBar + 'px', paddingBottom: isIphoneX ? '180rpx' : '146rpx' }"
  298. >
  299. <scroll-view class="tui-drawer-scroll" scroll-y :style="{ height: drawerH + 'px' }">
  300. <view class="drawer-title">
  301. <view class="drawer-title-h1">品牌</view>
  302. <view class="drawer-title-p"
  303. >已选中<text class="text">{{ checkedBrandLength }}</text
  304. >个品牌</view
  305. >
  306. </view>
  307. <view class="drawer-main">
  308. <view class="drawer-main-brand clearfix">
  309. <view
  310. class="drawer-brand-list"
  311. :class="isAllcheckedBrand ? 'checked' : ''"
  312. @click="choiceBrandAll"
  313. >全部</view
  314. >
  315. <view
  316. class="drawer-brand-list"
  317. :class="brand.isChecked ? 'checked' : ''"
  318. v-for="(brand, index) in brandLists"
  319. :key="index"
  320. @click="choiceBrand(brand, index)"
  321. >
  322. {{ brand.name }}
  323. </view>
  324. <view class="drawer-brand-more" v-if="!isShowAllBrands" @click="showAllBrands"
  325. >查看全部<text class="iconfont icon-xiangxiajiantou"></text
  326. ></view>
  327. </view>
  328. <view class="drawer-main-radio">
  329. <view class="drawer-radio-name">新品</view>
  330. <view class="drawer-radio-input" @click="choiceNewType">
  331. <text
  332. class="iconfont"
  333. :class="isChoiceNewType ? 'icon-yixuanze' : 'icon-weixuanze'"
  334. ></text>
  335. </view>
  336. </view>
  337. <view class="drawer-main-radio">
  338. <view class="drawer-radio-name">促销商品</view>
  339. <view class="drawer-radio-input" @click="choiceActiType">
  340. <text
  341. class="iconfont"
  342. :class="isChoiceActiType ? 'icon-yixuanze' : 'icon-weixuanze'"
  343. ></text>
  344. </view>
  345. </view>
  346. </view>
  347. </scroll-view>
  348. <view class="drawer-input btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  349. <view class="drawer-btn clear" @click="closeDrawer">取消</view>
  350. <view class="drawer-btn comfrim" @click="handSearchList">确定</view>
  351. </view>
  352. </view>
  353. </tui-drawer>
  354. <!-- 透明模态层 -->
  355. <modal-layer v-if="isModallayer" />
  356. </view>
  357. </template>
  358. <script>
  359. import { mapState, mapMutations } from 'vuex'
  360. import listSkeleton from '@/components/cm-module/listTemplate/listSkeleton'
  361. import customFloor from '@/components/cm-custom/custom-floor' //自定义导航
  362. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  363. import modalLayer from '@/components/modal-layer'
  364. import authorize from '@/common/config/authorize.js'
  365. import wxLogin from '@/common/config/wxLogin.js'
  366. export default {
  367. components: {
  368. customFloor,
  369. listSkeleton,
  370. uniGrader,
  371. modalLayer
  372. },
  373. data() {
  374. return {
  375. shopId: 0,
  376. tabIndex: 0,
  377. isModallayer: false,
  378. isShowAllBrands: false,
  379. isSearchSalesFirst: true,
  380. isSearchMoodFirst: true,
  381. isSearchPriceFirst: true,
  382. isSearchSales: true,
  383. isSearchMood: true,
  384. isSearchPrice: true,
  385. isChoiceNewType: false,
  386. isChoiceActiType: false,
  387. isAllcheckedBrand: false,
  388. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  389. systeminfo: this.setSysteminfo(), //获取设备信息
  390. CustomBar: this.CustomBar, // 顶部导航栏高度
  391. isIphoneX: this.$store.state.isIphoneX,
  392. emptyText: '该分类暂时还没有商品哟,去逛逛别的吧~',
  393. isRequest: false,
  394. showSkeleton: true,
  395. showEmpty: false,
  396. userId: 0,
  397. vipFlag: 0,
  398. userIdentity: 0,
  399. listData: [],
  400. brandLists: [],
  401. checkedBrandList: [],
  402. checkedBrandLength: 0,
  403. windowHeight: '',
  404. scrollHeight: '',
  405. pathQueryId:0,
  406. firstClubType:0,
  407. listQuery: {
  408. id: 0,
  409. identity: 0,
  410. pageNum: 1,
  411. pageSize: 10,
  412. sortField: '',
  413. sortType: 1,
  414. brandIds: '', // 品牌Id
  415. newFlag: 0, // 查询新品标记,默认0,新品1
  416. promotionFlag: 0, // 查询促销标记,默认0,促销1
  417. idType: 0 //一级
  418. },
  419. brandParam: {
  420. keyword: '',
  421. id: '',
  422. idType: '',
  423. identity: 0
  424. },
  425. priceLoading: true,
  426. loadding: false,
  427. pullUpOn: true,
  428. pullFlag: true,
  429. totalPage: 0,
  430. nomoreText: '上拉显示更多',
  431. rightDrawer: false,
  432. classifyType: 0,
  433. classData: {},
  434. searchCheckedId: null,
  435. height: 0,
  436. drawerH: 0 // 抽屉内部scrollview高度
  437. }
  438. },
  439. computed: {
  440. ...mapState(['hasLogin', 'userInfo', 'identity', 'clubType'])
  441. },
  442. onLoad(option) {
  443. console.log(option)
  444. if (option.type == 'share') {
  445. wxLogin.wxLoginAuthorize()
  446. }
  447. this.SetScrollHeight()
  448. this.initGetStotage(option)
  449. },
  450. filters: {
  451. NumFormat: function(text) {
  452. //处理金额
  453. return Number(text).toFixed(2)
  454. }
  455. },
  456. methods: {
  457. async initGetStotage(option) {
  458. const userInfo = await this.$api.getStorage()
  459. this.firstClubType = this.clubType
  460. this.listQuery.id = this.pathQueryId = this.brandParam.id = option.id
  461. this.listQuery.identity = this.identity
  462. this.listQuery.idType = this.classifyType = this.brandParam.idType = Number(option.classType)
  463. uni.setStorageSync('pageLabel',option.title)
  464. uni.setNavigationBarTitle({ title: option.title })
  465. this.userId = userInfo.userId ? userInfo.userId : 0
  466. this.shopId = userInfo.shopId ? userInfo.shopId : 0
  467. this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
  468. this.vipFlag = userInfo.vipFlag ? userInfo.vipFlag : 0
  469. this.isRequest = true
  470. this.GetProductListInfo()
  471. this.GetProductOneClassly()
  472. this.getCommoditySearchQUeryBrand()
  473. console.log(this.classifyID)
  474. },
  475. GetProductOneClassly() {
  476. //根据分类ID 查询二三级分类
  477. this.CommonService.GetProductOneClassly({
  478. typeId: this.listQuery.id,
  479. idType: this.classifyType,
  480. source: 'crm'
  481. })
  482. .then(response => {
  483. this.classData = response.data
  484. })
  485. .catch(error => {
  486. this.$util.msg(error.msg, 2000)
  487. })
  488. },
  489. getCommoditySearchQUeryBrand() {
  490. // 查询筛选项品牌
  491. this.ProductService.getCommoditySearchQUeryBrand(this.brandParam)
  492. .then(response => {
  493. const data = response.data
  494. this.defaultBrandLists = data.map((el, index) => {
  495. el.isChecked = false
  496. return el
  497. })
  498. if(this.defaultBrandLists.length>11){
  499. this.isShowAllBrands = false
  500. }else{
  501. this.isShowAllBrands = true
  502. }
  503. this.brandLists = this.defaultBrandLists.slice(0, 11)
  504. console.log('品牌=============>', this.brandLists)
  505. })
  506. .catch(error => {
  507. console.log('查询品牌列表异常')
  508. })
  509. },
  510. GetProductListInfo() {
  511. //查询分类商品列表
  512. this.listQuery.pageNum = 1
  513. this.ProductService.GetSearchProductTypeData(this.listQuery)
  514. .then(response => {
  515. const resData = JSON.parse(response.data)
  516. const resList = resData.items
  517. this.showSkeleton = false
  518. if (resList && resList.length > 0) {
  519. this.showEmpty = false
  520. this.totalPage = resData.total
  521. this.listData = [...resList]
  522. this.GetProductPrice()
  523. // 防上拉暴滑
  524. this.pullFlag = false
  525. setTimeout(() => {
  526. this.pullFlag = true
  527. }, 500)
  528. // 底部提示文案
  529. if (this.totalPage > this.listData.length) {
  530. this.pullUpOn = false
  531. this.nomoreText = '上拉显示更多'
  532. } else {
  533. if (this.listData.length > 4) {
  534. this.pullUpOn = false
  535. this.loadding = false
  536. this.nomoreText = '已至底部'
  537. } else {
  538. this.pullUpOn = true
  539. this.loadding = false
  540. this.nomoreText = '已至底部'
  541. }
  542. }
  543. console.log(this.listData)
  544. } else {
  545. this.showEmpty = true
  546. }
  547. })
  548. .catch(error => {
  549. this.$util.msg(error.msg, 2000)
  550. })
  551. },
  552. GetOnReachBottomData() {
  553. //上拉加载
  554. this.listQuery.pageNum += 1
  555. this.ProductService.GetSearchProductTypeData(this.listQuery)
  556. .then(response => {
  557. const resData = JSON.parse(response.data)
  558. const resList = resData.items
  559. this.totalPage = resData.total
  560. this.listData = [...this.listData, ...resList]
  561. this.GetProductPrice()
  562. // 防上拉暴滑
  563. this.pullFlag = false
  564. setTimeout(() => {
  565. this.pullFlag = true
  566. }, 500)
  567. // 底部提示文案
  568. if (this.totalPage > this.listData.length) {
  569. this.pullUpOn = false
  570. this.nomoreText = '上拉显示更多'
  571. } else {
  572. this.pullUpOn = false
  573. this.loadding = false
  574. this.nomoreText = '已至底部'
  575. }
  576. })
  577. .catch(error => {
  578. this.$util.msg(error.msg, 2000)
  579. })
  580. },
  581. GetProductPrice() {
  582. //获取价格
  583. let productIdArr = []
  584. this.listData.map(item => {
  585. // 0公开价格 1不公开价格 2仅对资质机构公开
  586. productIdArr.push(item.productId)
  587. })
  588. this.priceLoading = true
  589. this.productIds = productIdArr.join(',')
  590. this.ProductService.querySearchProductPrice({
  591. userId: this.userId,
  592. productIds: this.productIds,
  593. source: 2
  594. })
  595. .then(response => {
  596. if (response.data) {
  597. this.listData = this.ReturnNewProducts(this.listData, response.data)
  598. }
  599. this.priceLoading = false
  600. })
  601. .catch(error => {
  602. this.$util.msg(error.msg, 2000)
  603. })
  604. },
  605. ReturnNewProducts(Array, list) {
  606. //处理对应商品ID的商品价格
  607. let NewArray = []
  608. Array.map(item => {
  609. for (let i = 0; i < list.length; i++) {
  610. if (item.productId == list[i].productId) {
  611. NewArray.push(Object.assign(item, list[i]))
  612. }
  613. }
  614. })
  615. return NewArray
  616. },
  617. handleScreen(e) {
  618. let index = e.currentTarget.dataset.index
  619. console.log(index)
  620. if (index == 0) {
  621. this.tabIndex = 0
  622. this.isSearchSalesFirst = true
  623. this.isSearchMoodFirst = true
  624. this.isSearchPriceFirst = true
  625. this.listQuery.sortType = 1
  626. this.listQuery.sortField = ''
  627. this.GetProductListInfo()
  628. } else if (index == 1) {
  629. this.tabIndex = 1
  630. this.isSearchSalesFirst = false
  631. this.isSearchMoodFirst = true
  632. this.isSearchPriceFirst = true
  633. this.isSearchSales = !this.isSearchSales
  634. if (this.isSearchSales) {
  635. this.listQuery.sortType = 1
  636. } else {
  637. this.listQuery.sortType = 0
  638. }
  639. this.listQuery.sortField = 'sales'
  640. this.GetProductListInfo()
  641. } else if (index == 2) {
  642. this.tabIndex = 2
  643. this.isSearchSalesFirst = true
  644. this.isSearchPriceFirst = true
  645. this.isSearchMoodFirst = false
  646. this.isSearchMood = !this.isSearchMood
  647. if (this.isSearchMood) {
  648. this.listQuery.sortType = 1
  649. } else {
  650. this.listQuery.sortType = 0
  651. }
  652. this.listQuery.sortField = 'favorite'
  653. this.GetProductListInfo()
  654. } else if (index == 3) {
  655. this.tabIndex = 3
  656. this.isSearchSalesFirst = true
  657. this.isSearchMoodFirst = true
  658. this.isSearchPriceFirst = false
  659. this.isSearchPrice = !this.isSearchPrice
  660. if (this.isSearchPrice) {
  661. this.listQuery.sortType = 1
  662. } else {
  663. this.listQuery.sortType = 0
  664. }
  665. this.listQuery.sortField = 'price'
  666. this.GetProductListInfo()
  667. } else if (index == 4) {
  668. console.log('type', this.listQuery.id)
  669. this.searchClickFn()
  670. }
  671. },
  672. handSearchList() {
  673. //确定筛选
  674. if (this.searchCheckedId == null) {
  675. this.listQuery.id = this.pathQueryId
  676. } else {
  677. this.listQuery.id = this.searchCheckedId
  678. }
  679. this.rightDrawer = false
  680. this.GetProductListInfo()
  681. },
  682. navToDetailPage(id) {
  683. this.isModallayer = true
  684. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  685. this.isModallayer = false
  686. },
  687. PromotionsFormat(promo) {
  688. //促销活动类型数据处理
  689. if (promo != null) {
  690. if (promo.type == 1 && promo.mode == 1) {
  691. return true
  692. } else {
  693. return false
  694. }
  695. }
  696. return false
  697. },
  698. isShowVipFlag(pros) {
  699. /**
  700. *显示SVIP和超级会员价格:
  701. * 个人机构(不是超级会员,但价格所有机构可见),
  702. * 资质机构(不是超级会员,但价格所有机构可见或仅会员可见),
  703. * 超级会员(价格所有机构可见或仅会员可见),超级会员(是医美机构,价格仅医美可见)
  704. *商品价格是否可见:priceFlag 0:所有机构可见 1:未公开价格 2:仅会员可见 3:仅医美机构可见
  705. * 普通机构
  706. * 超级会员 && priceFlag === 0
  707. * 资质机构
  708. * priceFlag !== 1 ||
  709. * 超级会员
  710. * 商品priceFlag === 3 && 是否是医美机构
  711. */
  712. // 未登录 || 非会员
  713. if(!this.hasLogin || !this.vipFlag === 1) return false
  714. // 商品所有机构可见
  715. if(pros.priceFlag === 0 ) return true
  716. // 商品价格仅资质机构可见
  717. if(pros.priceFlag === 2 && this.userIdentity === 2) return true
  718. // 商品价格仅医美机构可见
  719. if(pros.priceFlag === 3 && this.userIdentity === 2 && this.firstClubType == 1) return true
  720. // 其它
  721. return false
  722. },
  723. showAllBrands() {
  724. // 显示全部品牌
  725. this.isShowAllBrands = true
  726. this.brandLists = this.defaultBrandLists
  727. },
  728. choiceBrand(brand, index) {
  729. // 选择品牌
  730. brand.isChecked = !brand.isChecked
  731. if (brand.isChecked) {
  732. if(!this.contains(this.checkedBrandList,brand.id)){
  733. this.checkedBrandList.push(brand.id)
  734. }
  735. } else {
  736. this.checkedBrandList.splice(this.checkedBrandList.indexOf(brand.id), 1)
  737. }
  738. this.isAllcheckedBrand = false
  739. this.checkedBrandLength = this.checkedBrandList.length
  740. console.log('checkedBrandList', this.checkedBrandList)
  741. this.listQuery.brandIds = this.checkedBrandList.join(',')
  742. console.log('this.listQuery.brandIds', this.listQuery.brandIds)
  743. },
  744. contains(arr, val) {// 校验
  745. return arr.some(item => item === val)
  746. },
  747. choiceBrandAll() {
  748. // 点击选择全部品牌
  749. this.isAllcheckedBrand = true
  750. this.listQuery.brandIds = ''
  751. this.brandLists.forEach(el => {
  752. el.isChecked = false
  753. })
  754. },
  755. choiceNewType() {
  756. // 选择筛选项新品
  757. this.isChoiceNewType = !this.isChoiceNewType
  758. if (this.isChoiceNewType) {
  759. this.listQuery.newFlag = 1
  760. } else {
  761. this.listQuery.newFlag = 0
  762. }
  763. },
  764. choiceActiType() {
  765. // 选择筛选项促销商品
  766. this.isChoiceActiType = !this.isChoiceActiType
  767. if (this.isChoiceActiType) {
  768. this.listQuery.promotionFlag = 1
  769. } else {
  770. this.listQuery.promotionFlag = 0
  771. }
  772. },
  773. SetScrollHeight() {
  774. let obj = {}
  775. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  776. uni.getSystemInfo({
  777. success: res => {
  778. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  779. this.drawerH = res.windowHeight - uni.upx2px(180) - this.height
  780. }
  781. })
  782. this.windowHeight = windowHeight - 1
  783. this.scrollHeight = windowHeight - 1
  784. },
  785. setHeaderBtnPosi() {
  786. // 获得胶囊按钮位置信息
  787. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  788. return headerBtnPosi
  789. },
  790. searchClickFn() {
  791. //弹出抽屉
  792. this.rightDrawer = true
  793. },
  794. closeDrawer(e) {
  795. //关闭抽屉
  796. this.rightDrawer = false
  797. },
  798. setSysteminfo() {
  799. let systeminfo
  800. uni.getSystemInfo({
  801. // 获取设备信息
  802. success: res => {
  803. systeminfo = res
  804. }
  805. })
  806. return systeminfo
  807. }
  808. },
  809. onPullDownRefresh() {
  810. setTimeout(() => {
  811. this.GetProductListInfo()
  812. uni.stopPullDownRefresh()
  813. }, 200)
  814. },
  815. onReachBottom() {
  816. if (this.totalPage > this.listData.length) {
  817. this.loadding = true
  818. this.pullUpOn = true
  819. this.GetOnReachBottomData()
  820. }
  821. },
  822. onShareAppMessage(res) {
  823. //分享转发
  824. if (res.from === 'button') {
  825. // 来自页面内转发按钮
  826. }
  827. return {
  828. title: `点击查看“${this.classData.name}”相关的商品`,
  829. path: `pages/goods/goods-classify?type=share&classType=${this.classifyType}&id=${this.listQuery.id}&title=${
  830. this.classData.name
  831. }`
  832. }
  833. },
  834. onShow() {}
  835. }
  836. </script>
  837. <style lang="scss">
  838. page {
  839. background: #ffffff;
  840. .all-type-list-wrapper {
  841. display: flex;
  842. flex-direction: column;
  843. }
  844. }
  845. .container-list {
  846. width: 100%;
  847. height: auto;
  848. }
  849. .all-type-list-content {
  850. height: 216rpx;
  851. padding: 24rpx;
  852. background: #fff;
  853. margin-bottom: 2rpx;
  854. display: flex;
  855. flex-direction: row;
  856. box-sizing: content-box;
  857. .list-details-image{
  858. width: 218rpx;
  859. height: 218rpx !important;
  860. margin-right: 26rpx;
  861. border-radius: 10rpx;
  862. border: 2rpx solid #f3f3f3;
  863. position: relative;
  864. .list-img {
  865. width: 218rpx;
  866. height: 218rpx !important;
  867. }
  868. .list-details-type{
  869. width: 64rpx;
  870. height: 64rpx;
  871. text-align: justify;
  872. box-sizing: border-box;
  873. padding: 10rpx;
  874. border-radius: 0 0 8rpx 8rpx;
  875. background-color: #33CCBF;
  876. font-size: $font-size-22;
  877. color: #FFFFFF;
  878. line-height: 25rpx;
  879. position: absolute;
  880. top: 0;
  881. right: 10rpx;
  882. }
  883. }
  884. }
  885. .list-details-info {
  886. width: 466rpx;
  887. display: flex;
  888. flex-direction: column;
  889. font-size: 26rpx;
  890. position: relative;
  891. .list-details-title {
  892. position: relative;
  893. .mclap {
  894. line-height: 38rpx;
  895. text-overflow: ellipsis;
  896. overflow: hidden;
  897. display: -webkit-box;
  898. -webkit-line-clamp: 2;
  899. line-clamp: 2;
  900. -webkit-box-orient: vertical;
  901. &.indent {
  902. text-indent: 95rpx;
  903. }
  904. }
  905. .mclap-tag {
  906. display: block;
  907. width: 84rpx;
  908. height: 32rpx;
  909. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  910. border-radius: 4rpx 48rpx 4px 4px;
  911. line-height: 32rpx;
  912. font-size: $font-size-22;
  913. color: #ffffff;
  914. text-align: center;
  915. position: absolute;
  916. left: 0;
  917. top: 0;
  918. }
  919. }
  920. .list-details-specs {
  921. margin-top: 8rpx;
  922. color: #666666;
  923. }
  924. .list-details-miniQuantity {
  925. margin-top: 7rpx;
  926. }
  927. }
  928. .list-details-price {
  929. width: 100%;
  930. height: 54rpx;
  931. line-height: 54rpx;
  932. position: absolute;
  933. bottom: -10rpx;
  934. right: 0;
  935. .floor-item-act {
  936. height: 54rpx;
  937. text-align: center;
  938. box-sizing: border-box;
  939. float: right;
  940. padding: 11rpx 0;
  941. }
  942. .price-icon {
  943. width: 22rpx;
  944. height: 28rpx;
  945. vertical-align: middle;
  946. margin-right: 10rpx;
  947. }
  948. .price-icon + text {
  949. font-size: 25rpx;
  950. vertical-align: middle;
  951. }
  952. .list-login-now {
  953. color: #f8c499;
  954. float: left;
  955. line-height: 54rpx;
  956. .p-no {
  957. float: left;
  958. font-size: $font-size-24;
  959. color: $text-color;
  960. }
  961. }
  962. .login-now {
  963. padding: 10rpx 10rpx 10rpx 0;
  964. }
  965. .list-price {
  966. color: #ff2a2a;
  967. height: 44rpx;
  968. float: left;
  969. .price-larger {
  970. width: 100%;
  971. height: 44rpx;
  972. font-size: 32rpx;
  973. &.none {
  974. text-decoration: line-through;
  975. color: #999999;
  976. }
  977. &.small {
  978. font-size: $font-size-24;
  979. }
  980. .txt {
  981. font-size: $font-size-24;
  982. display: inline-block;
  983. line-height: 44rpx;
  984. text-align: left;
  985. float: left;
  986. }
  987. }
  988. }
  989. .add-cart-btn {
  990. width: 156rpx;
  991. height: 64rpx;
  992. line-height: 64rpx;
  993. border-radius: 32rpx;
  994. color: #fff;
  995. font-size: 26rpx;
  996. margin-right: 0;
  997. background: linear-gradient(45deg, rgba(255, 41, 41, 1) 0%, rgba(255, 109, 27, 1) 100%);
  998. }
  999. }
  1000. /*screen*/
  1001. .tui-header-screen {
  1002. width: 100%;
  1003. box-sizing: border-box;
  1004. background: #fff;
  1005. position: fixed;
  1006. z-index: 1000;
  1007. /* padding-top: 12rpx; */
  1008. }
  1009. .tui-screen-top,
  1010. .tui-screen-bottom {
  1011. display: flex;
  1012. align-items: center;
  1013. justify-content: space-between;
  1014. font-size: 28rpx;
  1015. color: #999999;
  1016. }
  1017. .tui-screen-top {
  1018. height: 88rpx;
  1019. position: relative;
  1020. background: #fff;
  1021. border-bottom: 1px solid #efefef;
  1022. }
  1023. .tui-top-item {
  1024. height: 28rpx;
  1025. line-height: 28rpx;
  1026. flex: 1;
  1027. display: flex;
  1028. align-items: center;
  1029. justify-content: center;
  1030. }
  1031. .icon-shangxiajiantou {
  1032. font-size: 20rpx;
  1033. color: #999999;
  1034. margin-left: 8rpx;
  1035. }
  1036. .tui-topitem-active {
  1037. color: #FF5B00;
  1038. }
  1039. .tui-screen-bottom {
  1040. height: 100rpx;
  1041. padding: 0 30rpx;
  1042. box-sizing: border-box;
  1043. font-size: 24rpx;
  1044. align-items: center;
  1045. overflow: hidden;
  1046. }
  1047. .tui-bottom-text {
  1048. line-height: 26rpx;
  1049. max-width: 82%;
  1050. white-space: nowrap;
  1051. overflow: hidden;
  1052. text-overflow: ellipsis;
  1053. }
  1054. .tui-bottom-item {
  1055. flex: 1;
  1056. width: 0;
  1057. display: flex;
  1058. align-items: center;
  1059. justify-content: center;
  1060. padding: 0 12rpx;
  1061. box-sizing: border-box;
  1062. background: #f7f7f7;
  1063. margin-right: 20rpx;
  1064. white-space: nowrap;
  1065. height: 60rpx;
  1066. border-radius: 40rpx;
  1067. }
  1068. .tui-bottom-item:last-child {
  1069. margin-right: 0;
  1070. }
  1071. .tui-btmItem-active {
  1072. background: #fcedea !important;
  1073. color: #FF5B00;
  1074. font-weight: bold;
  1075. position: relative;
  1076. }
  1077. .tui-btmItem-active::after {
  1078. content: '';
  1079. position: absolute;
  1080. border: 1rpx solid #FF5B00;
  1081. width: 100%;
  1082. height: 100%;
  1083. border-radius: 40rpx;
  1084. left: 0;
  1085. top: 0;
  1086. }
  1087. .tui-btmItem-tap {
  1088. position: relative;
  1089. border-bottom-left-radius: 0;
  1090. border-bottom-right-radius: 0;
  1091. }
  1092. .tui-btmItem-tap::after {
  1093. content: '';
  1094. position: absolute;
  1095. width: 100%;
  1096. height: 22rpx;
  1097. background: #f7f7f7;
  1098. left: 0;
  1099. top: 58rpx;
  1100. }
  1101. .tui-active {
  1102. color: #FF5B00;
  1103. }
  1104. .tui-icon-ml .tui-icon-class {
  1105. margin-left: 6rpx;
  1106. }
  1107. .tui-ml {
  1108. margin-left: 6rpx;
  1109. }
  1110. .tui-seizeaseat-20 {
  1111. height: 20rpx;
  1112. }
  1113. .tui-seizeaseat-30 {
  1114. height: 30rpx;
  1115. }
  1116. .tui-icon-middle .tui-icon-class {
  1117. vertical-align: middle;
  1118. }
  1119. .tui-middle {
  1120. vertical-align: middle;
  1121. }
  1122. /*screen*/
  1123. .drawer-container {
  1124. width: 580rpx;
  1125. height: 100%;
  1126. padding: 80rpx 0;
  1127. overflow: hidden;
  1128. box-sizing: border-box;
  1129. background-color: #f7f7f7;
  1130. .drawer-title {
  1131. width: 100%;
  1132. height: 72rpx;
  1133. line-height: 72rpx;
  1134. box-sizing: border-box;
  1135. padding: 0 30rpx;
  1136. float: left;
  1137. background-color: #f7f7f7;
  1138. .drawer-title-h1 {
  1139. font-size: $font-size-26;
  1140. color: #FF5B00;
  1141. font-weight: bold;
  1142. text-align: left;
  1143. float: left;
  1144. }
  1145. .drawer-title-p {
  1146. font-size: $font-size-24;
  1147. float: right;
  1148. color: #333333;
  1149. .text {
  1150. color: #FF5B00;
  1151. }
  1152. }
  1153. }
  1154. .drawer-main {
  1155. width: 100%;
  1156. height: auto;
  1157. box-sizing: border-box;
  1158. float: left;
  1159. .drawer-main-cell {
  1160. width: 100%;
  1161. height: auto;
  1162. box-sizing: border-box;
  1163. padding: 12rpx 24rpx 24rpx 24rpx;
  1164. background-color: #ffffff;
  1165. .drawer-item-cell {
  1166. width: 100%;
  1167. height: auto;
  1168. float: left;
  1169. .drawer-item-title {
  1170. width: 100%;
  1171. height: 82rpx;
  1172. line-height: 82rpx;
  1173. text-align: left;
  1174. font-size: $font-size-26;
  1175. color: $text-color;
  1176. float: left;
  1177. }
  1178. .drawer-item-main {
  1179. width: 100%;
  1180. height: auto;
  1181. float: left;
  1182. &.none {
  1183. margin-top: 24rpx;
  1184. }
  1185. .drawer-item-text {
  1186. display: inline-block;
  1187. float: left;
  1188. padding: 0 30rpx;
  1189. height: 56rpx;
  1190. border-radius: 28rpx;
  1191. background-color: #f7f7f7;
  1192. line-height: 56rpx;
  1193. text-align: center;
  1194. color: #999999;
  1195. font-size: $font-size-26;
  1196. margin-right: 24rpx;
  1197. margin-bottom: 24rpx;
  1198. &.checked {
  1199. background-color: #fef6f3;
  1200. color: $color-system;
  1201. }
  1202. }
  1203. }
  1204. }
  1205. }
  1206. .drawer-main-brand {
  1207. width: 100%;
  1208. height: auto;
  1209. box-sizing: border-box;
  1210. padding: 12rpx 24rpx 24rpx 24rpx;
  1211. background-color: #ffffff;
  1212. .drawer-brand-list {
  1213. width: 160rpx;
  1214. height: 56rpx;
  1215. line-height: 56rpx;
  1216. text-align: center;
  1217. font-size: 26rpx;
  1218. background-color: #f7f7f7;
  1219. color: #999999;
  1220. border-radius: 30rpx;
  1221. box-sizing: border-box;
  1222. padding: 0 15rpx;
  1223. float: left;
  1224. margin: 12rpx 24rpx 12rpx 0;
  1225. text-overflow: ellipsis;
  1226. overflow: hidden;
  1227. display: -webkit-box;
  1228. -webkit-line-clamp: 1;
  1229. line-clamp: 1;
  1230. -webkit-box-orient: vertical;
  1231. &.checked {
  1232. background-color: #fef6f3;
  1233. color: #FF5B00;
  1234. }
  1235. &:nth-child(3n) {
  1236. margin-right: 0;
  1237. }
  1238. }
  1239. .drawer-brand-more {
  1240. width: 100%;
  1241. height: 42rpx;
  1242. line-height: 42rpx;
  1243. float: left;
  1244. font-size: $font-size-24;
  1245. color: #999999;
  1246. text-align: center;
  1247. }
  1248. }
  1249. .drawer-main-radio {
  1250. width: 100%;
  1251. height: 72rpx;
  1252. background-color: #ffffff;
  1253. margin-top: 20rpx;
  1254. box-sizing: border-box;
  1255. padding: 0 24rpx;
  1256. .drawer-radio-name {
  1257. float: left;
  1258. line-height: 72rpx;
  1259. font-size: $font-size-26;
  1260. color: #333333;
  1261. }
  1262. .drawer-radio-input {
  1263. width: 72rpx;
  1264. height: 72rpx;
  1265. float: right;
  1266. line-height: 72rpx;
  1267. text-align: right;
  1268. .iconfont {
  1269. font-size: $font-size-36;
  1270. &.icon-weixuanze {
  1271. color: #b2b2b2;
  1272. }
  1273. &.icon-yixuanze {
  1274. color: #FF5B00;
  1275. }
  1276. }
  1277. }
  1278. }
  1279. }
  1280. .drawer-input {
  1281. width: 100%;
  1282. float: left;
  1283. box-sizing: border-box;
  1284. padding: 24rpx 10rpx 0 10rpx;
  1285. border: 1px solid rgba(0, 0, 0, 0.2);
  1286. border-radius: 4rpx;
  1287. position: relative;
  1288. background-color: #ffffff;
  1289. &.btn {
  1290. border: none;
  1291. display: flex;
  1292. position: fixed;
  1293. left: 0;
  1294. bottom: 0;
  1295. }
  1296. .drawer-btn {
  1297. width: 210rpx;
  1298. height: 84rpx;
  1299. border-radius: 42rpx;
  1300. background: $btn-confirm;
  1301. line-height: 84rpx;
  1302. text-align: center;
  1303. font-size: $font-size-26;
  1304. color: #ffffff;
  1305. flex: 1;
  1306. margin: 0 10rpx;
  1307. &.comfrim {
  1308. background: $btn-confirm;
  1309. }
  1310. &.clear {
  1311. background: #e1e1e1;
  1312. }
  1313. }
  1314. }
  1315. }
  1316. </style>