goods-classify.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  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 ? '#F3B574' : '#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 ? '#F3B574' : '#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 ? '#F3B574' : '#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"></tui-loadmore>
  287. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text="nomoreText"></tui-nomore>
  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"></modal-layer>
  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. this.checkedBrandList.push(brand.id)
  733. } else {
  734. this.checkedBrandList.splice(index, 1)
  735. }
  736. this.isAllcheckedBrand = false
  737. this.checkedBrandLength = this.checkedBrandList.length
  738. console.log('checkedBrandList', this.checkedBrandList)
  739. this.listQuery.brandIds = this.checkedBrandList.join(',')
  740. console.log('this.listQuery.brandIds', this.listQuery.brandIds)
  741. },
  742. choiceBrandAll() {
  743. // 点击选择全部品牌
  744. this.isAllcheckedBrand = true
  745. this.listQuery.brandIds = ''
  746. this.brandLists.forEach(el => {
  747. el.isChecked = false
  748. })
  749. },
  750. choiceNewType() {
  751. // 选择筛选项新品
  752. this.isChoiceNewType = !this.isChoiceNewType
  753. if (this.isChoiceNewType) {
  754. this.listQuery.newFlag = 1
  755. } else {
  756. this.listQuery.newFlag = 0
  757. }
  758. },
  759. choiceActiType() {
  760. // 选择筛选项促销商品
  761. this.isChoiceActiType = !this.isChoiceActiType
  762. if (this.isChoiceActiType) {
  763. this.listQuery.promotionFlag = 1
  764. } else {
  765. this.listQuery.promotionFlag = 0
  766. }
  767. },
  768. SetScrollHeight() {
  769. let obj = {}
  770. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  771. uni.getSystemInfo({
  772. success: res => {
  773. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  774. this.drawerH = res.windowHeight - uni.upx2px(180) - this.height
  775. }
  776. })
  777. this.windowHeight = windowHeight - 1
  778. this.scrollHeight = windowHeight - 1
  779. },
  780. setHeaderBtnPosi() {
  781. // 获得胶囊按钮位置信息
  782. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  783. return headerBtnPosi
  784. },
  785. searchClickFn() {
  786. //弹出抽屉
  787. this.rightDrawer = true
  788. },
  789. closeDrawer(e) {
  790. //关闭抽屉
  791. this.rightDrawer = false
  792. },
  793. setSysteminfo() {
  794. let systeminfo
  795. uni.getSystemInfo({
  796. // 获取设备信息
  797. success: res => {
  798. systeminfo = res
  799. }
  800. })
  801. return systeminfo
  802. }
  803. },
  804. onPullDownRefresh() {
  805. setTimeout(() => {
  806. this.GetProductListInfo()
  807. uni.stopPullDownRefresh()
  808. }, 200)
  809. },
  810. onReachBottom() {
  811. if (this.totalPage > this.listData.length) {
  812. this.loadding = true
  813. this.pullUpOn = true
  814. this.GetOnReachBottomData()
  815. }
  816. },
  817. onShareAppMessage(res) {
  818. //分享转发
  819. if (res.from === 'button') {
  820. // 来自页面内转发按钮
  821. }
  822. return {
  823. title: `点击查看“${this.classData.name}”相关的商品`,
  824. path: `pages/goods/goods-classify?type=share&classType=${this.classifyType}&id=${this.listQuery.id}&title=${
  825. this.classData.name
  826. }`
  827. }
  828. },
  829. onShow() {}
  830. }
  831. </script>
  832. <style lang="scss">
  833. page {
  834. background: #ffffff;
  835. .all-type-list-wrapper {
  836. display: flex;
  837. flex-direction: column;
  838. }
  839. }
  840. .container-list {
  841. width: 100%;
  842. height: auto;
  843. }
  844. .all-type-list-content {
  845. height: 216rpx;
  846. padding: 24rpx;
  847. background: #fff;
  848. margin-bottom: 2rpx;
  849. display: flex;
  850. flex-direction: row;
  851. box-sizing: content-box;
  852. .list-details-image{
  853. width: 218rpx;
  854. height: 218rpx !important;
  855. margin-right: 26rpx;
  856. border-radius: 10rpx;
  857. border: 2rpx solid #f3f3f3;
  858. position: relative;
  859. .list-img {
  860. width: 218rpx;
  861. height: 218rpx !important;
  862. }
  863. .list-details-type{
  864. width: 64rpx;
  865. height: 64rpx;
  866. text-align: justify;
  867. box-sizing: border-box;
  868. padding: 10rpx;
  869. border-radius: 0 0 8rpx 8rpx;
  870. background-color: #33CCBF;
  871. font-size: $font-size-22;
  872. color: #FFFFFF;
  873. line-height: 25rpx;
  874. position: absolute;
  875. top: 0;
  876. right: 10rpx;
  877. }
  878. }
  879. }
  880. .list-details-info {
  881. width: 466rpx;
  882. display: flex;
  883. flex-direction: column;
  884. font-size: 26rpx;
  885. position: relative;
  886. .list-details-title {
  887. position: relative;
  888. .mclap {
  889. line-height: 38rpx;
  890. text-overflow: ellipsis;
  891. overflow: hidden;
  892. display: -webkit-box;
  893. -webkit-line-clamp: 2;
  894. line-clamp: 2;
  895. -webkit-box-orient: vertical;
  896. &.indent {
  897. text-indent: 95rpx;
  898. }
  899. }
  900. .mclap-tag {
  901. display: block;
  902. width: 84rpx;
  903. height: 32rpx;
  904. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  905. border-radius: 4rpx 48rpx 4px 4px;
  906. line-height: 32rpx;
  907. font-size: $font-size-22;
  908. color: #ffffff;
  909. text-align: center;
  910. position: absolute;
  911. left: 0;
  912. top: 0;
  913. }
  914. }
  915. .list-details-specs {
  916. margin-top: 8rpx;
  917. color: #666666;
  918. }
  919. .list-details-miniQuantity {
  920. margin-top: 7rpx;
  921. }
  922. }
  923. .list-details-price {
  924. width: 100%;
  925. height: 54rpx;
  926. line-height: 54rpx;
  927. position: absolute;
  928. bottom: -10rpx;
  929. right: 0;
  930. .floor-item-act {
  931. height: 54rpx;
  932. text-align: center;
  933. box-sizing: border-box;
  934. float: right;
  935. padding: 11rpx 0;
  936. }
  937. .price-icon {
  938. width: 22rpx;
  939. height: 28rpx;
  940. vertical-align: middle;
  941. margin-right: 10rpx;
  942. }
  943. .price-icon + text {
  944. font-size: 25rpx;
  945. vertical-align: middle;
  946. }
  947. .list-login-now {
  948. color: #f8c499;
  949. float: left;
  950. line-height: 54rpx;
  951. .p-no {
  952. float: left;
  953. font-size: $font-size-24;
  954. color: $text-color;
  955. }
  956. }
  957. .login-now {
  958. padding: 10rpx 10rpx 10rpx 0;
  959. }
  960. .list-price {
  961. color: #ff2a2a;
  962. height: 44rpx;
  963. float: left;
  964. .price-larger {
  965. width: 100%;
  966. height: 44rpx;
  967. font-size: 32rpx;
  968. &.none {
  969. text-decoration: line-through;
  970. color: #999999;
  971. }
  972. &.small {
  973. font-size: $font-size-24;
  974. }
  975. .txt {
  976. font-size: $font-size-24;
  977. display: inline-block;
  978. line-height: 44rpx;
  979. text-align: left;
  980. float: left;
  981. }
  982. }
  983. }
  984. .add-cart-btn {
  985. width: 156rpx;
  986. height: 64rpx;
  987. line-height: 64rpx;
  988. border-radius: 32rpx;
  989. color: #fff;
  990. font-size: 26rpx;
  991. margin-right: 0;
  992. background: linear-gradient(45deg, rgba(255, 41, 41, 1) 0%, rgba(255, 109, 27, 1) 100%);
  993. }
  994. }
  995. /*screen*/
  996. .tui-header-screen {
  997. width: 100%;
  998. box-sizing: border-box;
  999. background: #fff;
  1000. position: fixed;
  1001. z-index: 1000;
  1002. /* padding-top: 12rpx; */
  1003. }
  1004. .tui-screen-top,
  1005. .tui-screen-bottom {
  1006. display: flex;
  1007. align-items: center;
  1008. justify-content: space-between;
  1009. font-size: 28rpx;
  1010. color: #999999;
  1011. }
  1012. .tui-screen-top {
  1013. height: 88rpx;
  1014. position: relative;
  1015. background: #fff;
  1016. border-bottom: 1px solid #efefef;
  1017. }
  1018. .tui-top-item {
  1019. height: 28rpx;
  1020. line-height: 28rpx;
  1021. flex: 1;
  1022. display: flex;
  1023. align-items: center;
  1024. justify-content: center;
  1025. }
  1026. .icon-shangxiajiantou {
  1027. font-size: 20rpx;
  1028. color: #999999;
  1029. margin-left: 8rpx;
  1030. }
  1031. .tui-topitem-active {
  1032. color: #F3B574;
  1033. }
  1034. .tui-screen-bottom {
  1035. height: 100rpx;
  1036. padding: 0 30rpx;
  1037. box-sizing: border-box;
  1038. font-size: 24rpx;
  1039. align-items: center;
  1040. overflow: hidden;
  1041. }
  1042. .tui-bottom-text {
  1043. line-height: 26rpx;
  1044. max-width: 82%;
  1045. white-space: nowrap;
  1046. overflow: hidden;
  1047. text-overflow: ellipsis;
  1048. }
  1049. .tui-bottom-item {
  1050. flex: 1;
  1051. width: 0;
  1052. display: flex;
  1053. align-items: center;
  1054. justify-content: center;
  1055. padding: 0 12rpx;
  1056. box-sizing: border-box;
  1057. background: #f7f7f7;
  1058. margin-right: 20rpx;
  1059. white-space: nowrap;
  1060. height: 60rpx;
  1061. border-radius: 40rpx;
  1062. }
  1063. .tui-bottom-item:last-child {
  1064. margin-right: 0;
  1065. }
  1066. .tui-btmItem-active {
  1067. background: #fcedea !important;
  1068. color: #F3B574;
  1069. font-weight: bold;
  1070. position: relative;
  1071. }
  1072. .tui-btmItem-active::after {
  1073. content: '';
  1074. position: absolute;
  1075. border: 1rpx solid #F3B574;
  1076. width: 100%;
  1077. height: 100%;
  1078. border-radius: 40rpx;
  1079. left: 0;
  1080. top: 0;
  1081. }
  1082. .tui-btmItem-tap {
  1083. position: relative;
  1084. border-bottom-left-radius: 0;
  1085. border-bottom-right-radius: 0;
  1086. }
  1087. .tui-btmItem-tap::after {
  1088. content: '';
  1089. position: absolute;
  1090. width: 100%;
  1091. height: 22rpx;
  1092. background: #f7f7f7;
  1093. left: 0;
  1094. top: 58rpx;
  1095. }
  1096. .tui-active {
  1097. color: #F3B574;
  1098. }
  1099. .tui-icon-ml .tui-icon-class {
  1100. margin-left: 6rpx;
  1101. }
  1102. .tui-ml {
  1103. margin-left: 6rpx;
  1104. }
  1105. .tui-seizeaseat-20 {
  1106. height: 20rpx;
  1107. }
  1108. .tui-seizeaseat-30 {
  1109. height: 30rpx;
  1110. }
  1111. .tui-icon-middle .tui-icon-class {
  1112. vertical-align: middle;
  1113. }
  1114. .tui-middle {
  1115. vertical-align: middle;
  1116. }
  1117. /*screen*/
  1118. .drawer-container {
  1119. width: 580rpx;
  1120. height: 100%;
  1121. padding: 80rpx 0;
  1122. overflow: hidden;
  1123. box-sizing: border-box;
  1124. background-color: #f7f7f7;
  1125. .drawer-title {
  1126. width: 100%;
  1127. height: 72rpx;
  1128. line-height: 72rpx;
  1129. box-sizing: border-box;
  1130. padding: 0 30rpx;
  1131. float: left;
  1132. background-color: #f7f7f7;
  1133. .drawer-title-h1 {
  1134. font-size: $font-size-26;
  1135. color: #F3B574;
  1136. font-weight: bold;
  1137. text-align: left;
  1138. float: left;
  1139. }
  1140. .drawer-title-p {
  1141. font-size: $font-size-24;
  1142. float: right;
  1143. color: #333333;
  1144. .text {
  1145. color: #F3B574;
  1146. }
  1147. }
  1148. }
  1149. .drawer-main {
  1150. width: 100%;
  1151. height: auto;
  1152. box-sizing: border-box;
  1153. float: left;
  1154. .drawer-main-cell {
  1155. width: 100%;
  1156. height: auto;
  1157. box-sizing: border-box;
  1158. padding: 12rpx 24rpx 24rpx 24rpx;
  1159. background-color: #ffffff;
  1160. .drawer-item-cell {
  1161. width: 100%;
  1162. height: auto;
  1163. float: left;
  1164. .drawer-item-title {
  1165. width: 100%;
  1166. height: 82rpx;
  1167. line-height: 82rpx;
  1168. text-align: left;
  1169. font-size: $font-size-26;
  1170. color: $text-color;
  1171. float: left;
  1172. }
  1173. .drawer-item-main {
  1174. width: 100%;
  1175. height: auto;
  1176. float: left;
  1177. &.none {
  1178. margin-top: 24rpx;
  1179. }
  1180. .drawer-item-text {
  1181. display: inline-block;
  1182. float: left;
  1183. padding: 0 30rpx;
  1184. height: 56rpx;
  1185. border-radius: 28rpx;
  1186. background-color: #f7f7f7;
  1187. line-height: 56rpx;
  1188. text-align: center;
  1189. color: #999999;
  1190. font-size: $font-size-26;
  1191. margin-right: 24rpx;
  1192. margin-bottom: 24rpx;
  1193. &.checked {
  1194. background-color: #fef6f3;
  1195. color: $color-system;
  1196. }
  1197. }
  1198. }
  1199. }
  1200. }
  1201. .drawer-main-brand {
  1202. width: 100%;
  1203. height: auto;
  1204. box-sizing: border-box;
  1205. padding: 12rpx 24rpx 24rpx 24rpx;
  1206. background-color: #ffffff;
  1207. .drawer-brand-list {
  1208. width: 160rpx;
  1209. height: 56rpx;
  1210. line-height: 56rpx;
  1211. text-align: center;
  1212. font-size: 26rpx;
  1213. background-color: #f7f7f7;
  1214. color: #999999;
  1215. border-radius: 30rpx;
  1216. box-sizing: border-box;
  1217. padding: 0 15rpx;
  1218. float: left;
  1219. margin: 12rpx 24rpx 12rpx 0;
  1220. text-overflow: ellipsis;
  1221. overflow: hidden;
  1222. display: -webkit-box;
  1223. -webkit-line-clamp: 1;
  1224. line-clamp: 1;
  1225. -webkit-box-orient: vertical;
  1226. &.checked {
  1227. background-color: #fef6f3;
  1228. color: #F3B574;
  1229. }
  1230. &:nth-child(3n) {
  1231. margin-right: 0;
  1232. }
  1233. }
  1234. .drawer-brand-more {
  1235. width: 100%;
  1236. height: 42rpx;
  1237. line-height: 42rpx;
  1238. float: left;
  1239. font-size: $font-size-24;
  1240. color: #999999;
  1241. text-align: center;
  1242. }
  1243. }
  1244. .drawer-main-radio {
  1245. width: 100%;
  1246. height: 72rpx;
  1247. background-color: #ffffff;
  1248. margin-top: 20rpx;
  1249. box-sizing: border-box;
  1250. padding: 0 24rpx;
  1251. .drawer-radio-name {
  1252. float: left;
  1253. line-height: 72rpx;
  1254. font-size: $font-size-26;
  1255. color: #333333;
  1256. }
  1257. .drawer-radio-input {
  1258. width: 72rpx;
  1259. height: 72rpx;
  1260. float: right;
  1261. line-height: 72rpx;
  1262. text-align: right;
  1263. .iconfont {
  1264. font-size: $font-size-36;
  1265. &.icon-weixuanze {
  1266. color: #b2b2b2;
  1267. }
  1268. &.icon-yixuanze {
  1269. color: #F3B574;
  1270. }
  1271. }
  1272. }
  1273. }
  1274. }
  1275. .drawer-input {
  1276. width: 100%;
  1277. float: left;
  1278. box-sizing: border-box;
  1279. padding: 24rpx 10rpx 0 10rpx;
  1280. border: 1px solid rgba(0, 0, 0, 0.2);
  1281. border-radius: 4rpx;
  1282. position: relative;
  1283. background-color: #ffffff;
  1284. &.btn {
  1285. border: none;
  1286. display: flex;
  1287. position: fixed;
  1288. left: 0;
  1289. bottom: 0;
  1290. }
  1291. .drawer-btn {
  1292. width: 210rpx;
  1293. height: 84rpx;
  1294. border-radius: 42rpx;
  1295. background: $btn-confirm;
  1296. line-height: 84rpx;
  1297. text-align: center;
  1298. font-size: $font-size-26;
  1299. color: #ffffff;
  1300. flex: 1;
  1301. margin: 0 10rpx;
  1302. &.comfrim {
  1303. background: $btn-confirm;
  1304. }
  1305. &.clear {
  1306. background: #e1e1e1;
  1307. }
  1308. }
  1309. }
  1310. }
  1311. </style>