jufubao-mall 2.0.72 → 2.0.74-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-mall",
3
- "version": "2.0.72",
3
+ "version": "2.0.74-beta1",
4
4
  "private": false,
5
5
  "description": "聚福宝商城业务组件插件包",
6
6
  "main": "index.js",
@@ -97,7 +97,7 @@
97
97
  :style="[{marginRight:(column_num ===1 && columnOneLayout ==='H' ? 0:(columnSpacing + 'rpx'))}]"
98
98
  >
99
99
  <view
100
- v-for="(item,idx) in getItemData(index,prodList)"
100
+ v-for="(item,idx) in columnedProdList[index]"
101
101
  :key="item.product_id"
102
102
  :style="[item.is_poster ==='Y'?posterProductStyles:contProductStyles]"
103
103
  >
@@ -185,7 +185,7 @@
185
185
  closeMask: true,
186
186
  isPreview: false,
187
187
  prodList: null, //数据
188
- nextPagesData:{}, //上一次数据
188
+ _columnedCache: null,
189
189
  allPagesData:{}, //所有页面数据
190
190
  curCategoryId:0,//当前分类ID
191
191
  delayDelCurOtherTimeer:null,
@@ -297,6 +297,20 @@
297
297
  stateCity: state => state.cityLocation.city
298
298
  }),
299
299
 
300
+ columnedProdList() {
301
+ const list = this.prodList;
302
+ const cols = this.column_num;
303
+ if (list === null) {
304
+ return this._columnedCache || [];
305
+ }
306
+ const result = [];
307
+ for (let i = 0; i < cols; i++) {
308
+ result[i] = list.filter((_, idx) => idx % cols === i);
309
+ }
310
+ this._columnedCache = result;
311
+ return result;
312
+ },
313
+
300
314
  bodyStyleComp(){
301
315
  return {
302
316
  padding: this.getMarginAndPadding(this.bodyPadding,0),
@@ -640,19 +654,6 @@
640
654
  })
641
655
  },
642
656
 
643
- delayDelCurOther(){
644
- if(this.delayDelCurOtherTimeer) clearTimeout(this.delayDelCurOtherTimeer);
645
- this.delayDelCurOtherTimeer = setTimeout(()=>{
646
- console.log('allPagesData',this.$xdUniHelper.cloneDeep(this.allPagesData));
647
- Object.keys(this.allPagesData).map(key=>{
648
- if(this.curCategoryId + '' !== key) {
649
- delete this.allPagesData[key];
650
- }
651
- })
652
- console.warn(`删除当前分类以外的分类:curID=${this.curCategoryId}`);
653
- console.log(this.allPagesData)
654
- }, 10000);
655
- },
656
657
 
657
658
  getList(isTabLoading=false){
658
659
  const { navList, navIndex, page_token = 1, page_size, sort } = this;
@@ -793,19 +794,6 @@
793
794
  else this.prodList = (this.prodList||[]).concat(list);
794
795
  }
795
796
 
796
- //保存所以列表数据
797
- this.allPagesData[category_id] = (this.allPagesData[category_id]||[]).concat(list);
798
-
799
- //#ifdef H5
800
- window['allPagesData'] = this.allPagesData;
801
- //#endif
802
-
803
-
804
- //延期删除当前组件意外的数据
805
- console.log('allPagesData',this.$xdUniHelper.cloneDeep(this.allPagesData));
806
- this.delayDelCurOther();
807
-
808
-
809
797
  this.page_token = res.next_page_token;
810
798
  this.hasNext = !!res.next_page_token;
811
799
 
@@ -834,22 +822,11 @@
834
822
  })
835
823
 
836
824
  }).catch(err => {
837
- console.log("err", err);
838
825
  this.$xdHideLoading();
839
826
  this.$xdLog.catch(err);
840
827
  })
841
828
  },
842
829
 
843
- getItemData(cellIndex,data){
844
- let list = this.$xdUniHelper.cloneDeep(data);
845
- if(list === null) return this.$xdUniHelper.cloneDeep(this.nextPagesData[cellIndex]);
846
- let listData = list.filter((it,index) => {
847
- return index % this.column_num === cellIndex;
848
- });
849
- this.nextPagesData[cellIndex] = this.$xdUniHelper.cloneDeep(listData);
850
- return listData;
851
- },
852
-
853
830
  toProductInfo({isCart,...prod}){
854
831
  if(this.$configProject['isPreview']) return;
855
832
  toProductDetail(this, prod, this.productInfoPath,isCart ==='Y');
@@ -864,9 +841,9 @@
864
841
  },
865
842
 
866
843
  onJfbScroll({e, options}){
867
- if(this.isPreview || this.loading === false) return;
844
+ if(this.isPreview || this.isNextLoading === true) return;
868
845
  //调用子组件方法
869
- this.$refs.VT.topData(e.scrollTop);
846
+ this.$refs.VT.topData(e.scrollTop);
870
847
  this.scrollTop = e.scrollTop;
871
848
  this.$xdUniHelper.getWindowHeight(['.jfb-mall-home-product-list__body'], this)
872
849
  .then(res => {
@@ -21,7 +21,8 @@
21
21
  <view
22
22
  class="jfb-mall-product-type__body"
23
23
  :style="{
24
- minHeight: layoutInfo.bodyMinHeightRpx + 'rpx'
24
+ minHeight: layoutInfo.bodyMinHeightRpx + 'rpx',
25
+ '--main-color': mainColor
25
26
  }"
26
27
  >
27
28
  <view v-if="loadingList" class="skeleton-wrap">
@@ -94,26 +95,53 @@
94
95
  {{item.category_name}}
95
96
  </view>
96
97
  </scroll-view>
97
- <scroll-view :scroll-top="scrollTop" @scroll="handleScroll" @scrolltolower="handleScrolltolower" :style="{height:'100%'}" scroll-y="true" class="jfb-mall-product-type__body_type2_content_product">
98
- <view :key="productKey" v-if="productList&&productList.length">
99
- <view v-for="(item,index) in productList" :key="index" :style="[contProductStyles]">
100
- <cus-product
101
- :image-radius="imageRadius"
102
- :brand-color="brandColor"
103
- :height="contProductImageHeight"
104
- :cell="column_num"
105
- :name-font="itemFontStyle"
106
- :product-config="productConfig"
107
- :isPlus="is_plus_site"
108
- :item="item"
109
- :row-spacing="rowSpacing"
110
- :cell-spacing="itemSpacing"
111
- @on-product-detail="toProductInfo"
112
- ></cus-product>
98
+ <view class="jfb-mall-product-type__body_type2_content_right">
99
+ <view class="jfb-mall-product-type__body_type2_content_sort">
100
+ <view class="sort_item" :class="{active: sortType === 'default'}" @click="handleSort('default')">综合</view>
101
+ <view class="sort_item sort_item_with_icon" :class="{active: sortType === 'price_asc' || sortType === 'price_desc'}" @click="handleSort('price')">
102
+ <view>价格</view>
103
+ <view class="sort_icon_wrap">
104
+ <view class="sort_icon_item" :class="{highlight: sortType === 'price_asc'}">
105
+ <xd-font-icon icon="iconrepository-xialaxuanxiangup" :color="sortType === 'price_asc' ? mainColor : '#ccc'" size="18"></xd-font-icon>
106
+ </view>
107
+ <view class="sort_icon_item" :class="{highlight: sortType === 'price_desc'}">
108
+ <xd-font-icon icon="iconrepository-xialaxuanxiangdown" :color="sortType === 'price_desc' ? mainColor : '#ccc'" size="18"></xd-font-icon>
109
+ </view>
110
+ </view>
111
+ </view>
112
+ <view class="sort_item sort_item_with_icon" :class="{active: sortType === 'sale_num_asc' || sortType === 'sale_num_desc'}" @click="handleSort('sale_num')">
113
+ <view>销量</view>
114
+ <view class="sort_icon_wrap">
115
+ <view class="sort_icon_item" :class="{highlight: sortType === 'sale_num_asc'}">
116
+ <xd-font-icon icon="iconrepository-xialaxuanxiangup" :color="sortType === 'sale_num_asc' ? mainColor : '#ccc'" size="18"></xd-font-icon>
117
+ </view>
118
+ <view class="sort_icon_item" :class="{highlight: sortType === 'sale_num_desc'}">
119
+ <xd-font-icon icon="iconrepository-xialaxuanxiangdown" :color="sortType === 'sale_num_desc' ? mainColor : '#ccc'" size="18"></xd-font-icon>
120
+ </view>
121
+ </view>
113
122
  </view>
114
- <view v-if="!hasNext" class="noMore">—— 我是有底线的 ——</view>
115
123
  </view>
116
- </scroll-view>
124
+ <scroll-view :scroll-top="scrollTop" @scroll="handleScroll" @scrolltolower="handleScrolltolower" :style="{height:'calc(100% - 80rpx)'}" scroll-y="true" class="jfb-mall-product-type__body_type2_content_product">
125
+ <view :key="productKey" v-if="productList&&productList.length">
126
+ <view v-for="(item,index) in productList" :key="index" :style="[contProductStyles]">
127
+ <cus-product
128
+ :image-radius="imageRadius"
129
+ :brand-color="brandColor"
130
+ :height="contProductImageHeight"
131
+ :cell="column_num"
132
+ :name-font="itemFontStyle"
133
+ :product-config="productConfig"
134
+ :isPlus="is_plus_site"
135
+ :item="item"
136
+ :row-spacing="rowSpacing"
137
+ :cell-spacing="itemSpacing"
138
+ @on-product-detail="toProductInfo"
139
+ ></cus-product>
140
+ </view>
141
+ <view v-if="!hasNext" class="noMore">—— 我是有底线的 ——</view>
142
+ </view>
143
+ </scroll-view>
144
+ </view>
117
145
  </view>
118
146
  <xd-no-data v-else height="300rpx">{{noData}}</xd-no-data>
119
147
  </view>
@@ -188,6 +216,10 @@
188
216
  is_plus_site: false,
189
217
  productKey: 'productKey',
190
218
  curParentIndex: 0,
219
+ hideMask: true,
220
+
221
+ // 排序功能
222
+ sortType: 'default', // default, price_desc, price_asc, sale_num_desc, sale_num_asc
191
223
  }
192
224
  },
193
225
  computed: {
@@ -316,7 +348,7 @@
316
348
  random_score_seed: this.random_score_seed,
317
349
  page_token: this.page_token,
318
350
  page_size: this.page_size,
319
- sort: "default",
351
+ sort: this.sortType,
320
352
  custom_category_id: this.selectNav.category_id,
321
353
  }
322
354
  if(this.productConfig.isShowDiscount==='Y'){
@@ -518,6 +550,7 @@
518
550
  handleChoseParentNav(data, index) {
519
551
  this.navChildrenList = data.children;
520
552
  this.curParentIndex = index;
553
+ this.sortType = 'default';
521
554
  if(data.children.length){
522
555
  this.selectNav = this.navChildrenList[0]
523
556
  this.selectNavIndex = 0;
@@ -532,6 +565,31 @@
532
565
  handleChoseNav(data,index) {
533
566
  this.selectNav = data;
534
567
  this.selectNavIndex = index;
568
+ this.sortType = 'default';
569
+ },
570
+
571
+ handleSort(type) {
572
+ if (type === 'default') {
573
+ this.sortType = 'default';
574
+ } else if (type === 'price') {
575
+ if (this.sortType === 'price_asc') {
576
+ this.sortType = 'price_desc';
577
+ } else if (this.sortType === 'price_desc') {
578
+ this.sortType = 'price_asc';
579
+ } else {
580
+ this.sortType = 'price_asc';
581
+ }
582
+ } else if (type === 'sale_num') {
583
+ if (this.sortType === 'sale_num_asc') {
584
+ this.sortType = 'sale_num_desc';
585
+ } else if (this.sortType === 'sale_num_desc') {
586
+ this.sortType = 'sale_num_asc';
587
+ } else {
588
+ this.sortType = 'sale_num_desc';
589
+ }
590
+ }
591
+ this.page_token = '1';
592
+ this.getProductList();
535
593
  },
536
594
 
537
595
  /**
@@ -831,6 +889,51 @@
831
889
  padding: 20rpx 0;
832
890
  }
833
891
  }
892
+ &_content_right {
893
+ flex: 1;
894
+ display: flex;
895
+ flex-direction: column;
896
+ overflow: hidden;
897
+ }
898
+ &_content_sort {
899
+ height: 80rpx;
900
+ display: flex;
901
+ align-items: center;
902
+ justify-content: space-between;
903
+ padding: 0 24rpx;
904
+ background-color: #fff;
905
+ border-bottom: 1rpx solid #f5f5f5;
906
+ flex-shrink: 0;
907
+ .sort_item {
908
+ font-size: 26rpx;
909
+ color: #333;
910
+ display: flex;
911
+ align-items: center;
912
+ &.active {
913
+ color: var(--main-color);
914
+ font-weight: 500;
915
+ }
916
+ &.sort_item_with_icon {
917
+ justify-content: center;
918
+ align-items: center;
919
+ .sort_icon_wrap {
920
+ display: flex;
921
+ flex-direction: column;
922
+ align-items: center;
923
+ margin-left: 6rpx;
924
+ .sort_icon_item {
925
+ line-height: 1;
926
+ &.highlight {
927
+ color: var(--main-color);
928
+ }
929
+ & + .sort_icon_item {
930
+ margin-top: 2rpx;
931
+ }
932
+ }
933
+ }
934
+ }
935
+ }
936
+ }
834
937
  }
835
938
  }
836
939
  }
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * @description 第三方库
5
- * @param threePackagePath {String} 第三方库所在项目路径存放路径路
6
- * @param packname {String} 包名字
7
- * @returns {string|*}
8
- */
9
- const getPackagePath = (threePackagePath, packname = 'gxd-commands-bussiness')=>{
10
- if(packname === 'gxd-commands-bussiness') {
11
- return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-commands-bussiness/${threePackagePath}`;
12
- }
13
-
14
- if (packname === 'gxd-uni-library-editx') {
15
- return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-uni-library-editx/${threePackagePath}`;
16
- }
17
-
18
- };
19
-
20
- module.exports = {
21
- getPackagePath
22
- }