jufubao-mall 2.0.52 → 2.0.53-beta2

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.52",
3
+ "version": "2.0.53-beta2",
4
4
  "private": false,
5
5
  "description": "聚福宝商城业务组件插件包",
6
6
  "main": "index.js",
@@ -103,6 +103,16 @@
103
103
  </template>
104
104
  </view>
105
105
  </view>
106
+ <view v-if="menuAct === 'filter'" class="filter_item" :style="[otherMenuContComp]">
107
+ <view class="filter_title">
108
+ <view>价格区间</view>
109
+ </view>
110
+ <view class="filter_tab">
111
+ <input type="digit" v-model.trim="startPrice" @blur="handlePriceBlur($event, 'start')" class="input_price" placeholder="最低价"></input>
112
+ <view class="divide_price">--</view>
113
+ <input type="digit" v-model.trim="endPrice" @blur="handlePriceBlur($event, 'end')" class="input_price" placeholder="最高价"></input>
114
+ </view>
115
+ </view>
106
116
  </view>
107
117
  <view class="bottom_btn" v-if="isShowBtn">
108
118
  <xd-button class="xd-button" type="info" width="248rpx" size="normal" @click="onOtherReset">重置</xd-button>
@@ -188,6 +198,12 @@ export default {
188
198
  return {}
189
199
  }
190
200
  },
201
+ priceRange: {
202
+ type: Array,
203
+ default(){
204
+ return ['','']
205
+ }
206
+ },
191
207
  //是否在筛选项过滤配置项
192
208
  filterFields:{
193
209
  type: Array,
@@ -368,7 +384,12 @@ export default {
368
384
  remoteList(){
369
385
  this.initFilterData()
370
386
  },
371
-
387
+ priceRange(arr){
388
+ if(arr && arr.length === 2){
389
+ if(arr[0]) this.startPrice = this.$xdUniHelper.divisionFloatNumber(arr[0], 100);
390
+ if(arr[1]) this.endPrice = this.$xdUniHelper.divisionFloatNumber(arr[1], 100);
391
+ }
392
+ }
372
393
  },
373
394
  data(){
374
395
  return {
@@ -390,6 +411,9 @@ export default {
390
411
  isShowBtn: false, //是单选还是多选
391
412
  filterTabs: [],//当前下拉菜单数据
392
413
  filterTabsOrg:[], //下拉菜单原始数据
414
+
415
+ startPrice: '',
416
+ endPrice: '',
393
417
  }
394
418
  },
395
419
  created() {
@@ -632,6 +656,8 @@ export default {
632
656
  if(item['filter_keys'] === false) nenuItems.push(item.value)
633
657
  });
634
658
  this.initSelected(nenuItems);
659
+ this.startPrice = '';
660
+ this.endPrice = '';
635
661
  }
636
662
  else {
637
663
  this.$set(this.selectedNenuIds, this.menuAct, []);
@@ -643,6 +669,25 @@ export default {
643
669
  this.update();
644
670
  this.closeQueryModal();
645
671
  },
672
+ // 价格输入格式化,保留两位小数
673
+ handlePriceBlur(e, type) {
674
+ const value = e.target.value;
675
+ if (!value) {
676
+ if (type === 'start') this.startPrice = '';
677
+ else this.endPrice = '';
678
+ return;
679
+ }
680
+ // 保留两位小数
681
+ const numValue = parseFloat(value);
682
+ if (!isNaN(numValue)) {
683
+ const formatted = numValue.toFixed(2);
684
+ if (type === 'start') this.startPrice = formatted;
685
+ else this.endPrice = formatted;
686
+ } else {
687
+ if (type === 'start') this.startPrice = '';
688
+ else this.endPrice = '';
689
+ }
690
+ },
646
691
  switchOtherOpen(tab){
647
692
  this.filterTabs = this.filterTabs.map(item => {
648
693
  if(JSON.stringify(tab.value) === JSON.stringify(item.value)) item['open'] = !item['open'];
@@ -739,6 +784,9 @@ export default {
739
784
  update(){
740
785
  let params = {};
741
786
  if(this.sort) params['sort'] = this.sort;
787
+ //价格单位为元,需要转换成分
788
+ if(this.startPrice) params['startPrice'] = this.$xdUniHelper.multiplyFloatNumber(this.startPrice, 100);
789
+ if(this.endPrice) params['endPrice'] = this.$xdUniHelper.multiplyFloatNumber(this.endPrice, 100);
742
790
  Object.keys(this.selectedNenuIds).map(key=>{
743
791
  if(key === 'filter') {
744
792
  if( this.selectedNenuIds[key].length > 0) params['filter_keys'] = this.selectedNenuIds[key].join(',');
@@ -921,7 +969,21 @@ export default {
921
969
  }
922
970
  }
923
971
 
924
-
972
+ .input_price{
973
+ background-color: #f8f8f8;
974
+ width: 300rpx;
975
+ height: 62rpx;
976
+ border-radius: 4rpx;
977
+ flex: 1;
978
+ text-align: center;
979
+ font-size: 24rpx;
980
+ }
981
+ .divide_price{
982
+ width: 100rpx;
983
+ display: flex;
984
+ align-items: center;
985
+ justify-content: center;
986
+ }
925
987
  }
926
988
 
927
989
  }
@@ -82,6 +82,7 @@
82
82
  :filter-fields="isFilterMenuForFilterFields"
83
83
  :def-sort="sort"
84
84
  :def-remote="defMenuValue"
85
+ :price-range="[startPrice, endPrice]"
85
86
  @on-change="handleFitlerChange"
86
87
  ></com-filter-query>
87
88
  </template>
@@ -283,6 +284,8 @@
283
284
  trueCateId:'',//分类二级(用于是查询商品列表操作)
284
285
  defMenuValue:{}, //菜单选中
285
286
  menuSelectParams:null, //null|object null未初始化 object已初始化
287
+ startPrice: "",
288
+ endPrice: "",
286
289
  //==搜索条件=============
287
290
 
288
291
  //面板
@@ -486,6 +489,13 @@
486
489
  this.setNameSpace(options);
487
490
  this.options = options;
488
491
  let defMenuValue = {};
492
+ if(options.price){
493
+ let priceRange = options.price.split(',');
494
+ if(priceRange[0]) this.startPrice = this.$xdUniHelper.multiplyFloatNumber(priceRange[0], 100);
495
+ if(priceRange[1]) this.endPrice = this.$xdUniHelper.multiplyFloatNumber(priceRange[1], 100);
496
+ }
497
+ if(options.startPrice) this.startPrice = options.startPrice;
498
+ if( options.endPrice) this.endPrice = options.endPrice;
489
499
  if( options.keyword) this.keyword = options.keyword;
490
500
  if( options.pid) this.pid = Number(options.pid);
491
501
  if( options.cateId || options.cateid) this.cateId = Number(options.cateId||options.cateid);
@@ -516,6 +526,8 @@
516
526
  page_token: this.page_token,
517
527
  page_size: this.page_size,
518
528
  need_show_tags: this.need_show_tags.join(),
529
+ start_price: this.startPrice,
530
+ end_price: this.endPrice
519
531
  }
520
532
 
521
533
  if(this.keyword) data['keyword'] = this.keyword;
@@ -1219,6 +1231,8 @@
1219
1231
  if(params['sort']) menuSelectParams['sort'] = params['sort'];
1220
1232
  if(params['delivery_method']) menuSelectParams['delivery_method'] = params['delivery_method'];
1221
1233
  if(params['filter_keys']) menuSelectParams['filter_keys'] = params['filter_keys'];
1234
+ this.startPrice = params['startPrice'] || "";
1235
+ this.endPrice = params['endPrice'] || "";
1222
1236
  this.menuSelectParams = menuSelectParams;
1223
1237
  console.log('getProductListParams',JSON.stringify(this.menuSelectParams));
1224
1238
  this.clearProductData(); //清除商品列表数据
@@ -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
- }