goods-classify.vue 28 KB

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