goods-classify.vue 33 KB

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