goods-classify.vue 35 KB

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