goods-classify.vue 34 KB

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