goods-classify.vue 29 KB

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