goods-classify.vue 28 KB

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