goods-classify.vue 27 KB

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