jufubao-admin-library 1.1.217 → 1.1.219

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.
@@ -25,7 +25,6 @@
25
25
  :show.sync="showAdjust"
26
26
  title="手动调整售价"
27
27
  width="60%"
28
- @onConfirm="handleAdjustConfirm"
29
28
  >
30
29
  <xd-base-dynamic-field
31
30
  ref="adjust"
@@ -92,39 +91,56 @@
92
91
  label="规格"
93
92
  min-width="120"
94
93
  />
94
+ <el-table-column
95
+ prop="unit_label"
96
+ label="调价方式"
97
+ min-width="80"
98
+ />
95
99
  <el-table-column
96
100
  prop="base_label"
97
101
  label="基于价格"
98
102
  min-width="100"
99
- />
103
+ >
104
+ <template slot-scope="scope">
105
+ {{ scope.row.unit === 'fixed' ? '-' : scope.row.base_label }}
106
+ </template>
107
+ </el-table-column>
100
108
  <el-table-column
101
109
  prop="original_price"
102
110
  label="调整原始价格"
103
111
  min-width="120"
104
112
  >
105
113
  <template slot-scope="scope">
106
- {{ scope.row.original_price }}
114
+ {{ scope.row.unit === 'fixed' ? '-' : scope.row.original_price + '元' }}
107
115
  </template>
108
116
  </el-table-column>
109
- <el-table-column
110
- prop="unit_label"
111
- label="调价方式"
112
- min-width="80"
113
- />
114
117
  <el-table-column
115
118
  prop="adjust_value"
116
119
  label="上调/下调"
117
120
  min-width="100"
118
121
  >
119
122
  <template slot-scope="scope">
120
- {{ scope.row.adjust_value }}{{ scope.row.unit === 'ratio' ? '%' : '元' }}
123
+ {{ scope.row.unit === 'fixed' ? '-' : (scope.row.adjust_value + (scope.row.unit === 'ratio' ? '%' : '元')) }}
121
124
  </template>
122
125
  </el-table-column>
123
126
  <el-table-column
124
127
  prop="decimal_label"
125
128
  label="小数点保留"
126
129
  min-width="100"
127
- />
130
+ >
131
+ <template slot-scope="scope">
132
+ {{ scope.row.unit === 'fixed' ? '-' : scope.row.decimal_label }}
133
+ </template>
134
+ </el-table-column>
135
+ <el-table-column
136
+ prop="rounding_method_label"
137
+ label="取数方式"
138
+ min-width="100"
139
+ >
140
+ <template slot-scope="scope">
141
+ {{ scope.row.unit === 'fixed' ? '-' : scope.row.rounding_method_label }}
142
+ </template>
143
+ </el-table-column>
128
144
  <el-table-column
129
145
  prop="adjusted_price"
130
146
  label="调整后售价"
@@ -224,6 +240,11 @@
224
240
  </template>
225
241
  </xd-base-dynamic-field>
226
242
  </xd-dialog>
243
+ <div slot="btn">
244
+ <el-button @click="adjustStatus = false;showAdjust = false">关闭</el-button>
245
+ <el-button v-if="dialogRow&&dialogRow.can_cancel_modifyprice===true" @click="handleCancelAdjust">取消调价</el-button>
246
+ <el-button type="primary" @click="handleAdjustConfirm">确定修改售价</el-button>
247
+ </div>
227
248
  </xd-dialog>
228
249
  <xd-dialog
229
250
  v-if="showPublicSet"
@@ -316,7 +337,18 @@ export default {
316
337
  watch: {
317
338
  'adjustListValue.unit' : {
318
339
  handler(n,o){
319
- if(n&&n!==o){
340
+ if(n && n !== o && o !== undefined){
341
+ if(n === 'fixed') {
342
+ this.adjustListValue.moneyValue = '';
343
+ this.adjustListValue.ratioValue = '';
344
+ this.adjustListValue.base = '';
345
+ this.adjustListValue.decimal = 2;
346
+ } else if(n === 'ratio') {
347
+ this.adjustListValue.moneyValue = '';
348
+ } else if(n === 'money') {
349
+ this.adjustListValue.ratioValue = '';
350
+ this.adjustListValue.moneyValue = '';
351
+ }
320
352
  this.getAdjustForm(this.adjustListValue)
321
353
  }
322
354
  }
@@ -330,12 +362,17 @@ export default {
330
362
  },
331
363
  'skuAdjustValue.unit': {
332
364
  handler(n,o){
333
- if(n&&n!==o){
334
- // 切换单位时清空另一个单位的值
365
+ if(n && o !== undefined && o !== n){
335
366
  if(n === 'ratio') {
336
367
  this.skuAdjustValue.moneyValue = '';
337
- } else {
368
+ } else if(n === 'money') {
369
+ this.skuAdjustValue.ratioValue = '';
370
+ this.skuAdjustValue.moneyValue = '';
371
+ } else if(n === 'fixed') {
372
+ this.skuAdjustValue.moneyValue = '';
338
373
  this.skuAdjustValue.ratioValue = '';
374
+ this.skuAdjustValue.base = '';
375
+ this.skuAdjustValue.decimal = 2;
339
376
  }
340
377
  this.getSkuAdjustForm(this.skuAdjustValue);
341
378
  }
@@ -394,22 +431,25 @@ export default {
394
431
  }
395
432
  }
396
433
  },
397
- // 规格调价 - 切换商品规格时重新计算
434
+ // 规格调价 - 切换商品规格时重置数据
398
435
  'skuAdjustValue.product_sku': {
399
436
  handler(n,o){
400
- if(n && n !== o && this.skuDesireForm.price && this.skuAdjustValue.base){
401
- // 重新计算上调/下调值
402
- let unit = 'moneyValue';
403
- if(this.skuAdjustValue['unit'] === 'ratio') unit = 'ratioValue';
404
-
405
- const skuData = this.skuList.find(sku => sku.value === n);
406
- if (skuData && skuData.prices[this.skuAdjustValue.base]) {
407
- let price = skuData.prices[this.skuAdjustValue.base];
408
- let value = this.$xdHelper.divisionFloatNumber(this.$xdHelper.multiplyFloatNumber(this.skuDesireForm.price, 100) - price, price);
409
- this.skuAdjustValue[unit] = this.$xdHelper.multiplyFloatNumber(value, 100).toFixed(2);
410
- this.getSkuAdjustForm(this.skuAdjustValue);
411
- this.skuAdjustKey = Date.now();
437
+ if(n && n !== o && o !== undefined){
438
+ this.skuAdjustValue.base = '';
439
+ this.skuAdjustValue.moneyValue = '';
440
+ this.skuAdjustValue.ratioValue = '';
441
+ if(this.skuDesireForm.price && this.skuAdjustValue.base){
442
+ const skuData = this.skuList.find(sku => sku.value === n);
443
+ if (skuData && skuData.prices[this.skuAdjustValue.base]) {
444
+ let unit = 'moneyValue';
445
+ if(this.skuAdjustValue['unit'] === 'ratio') unit = 'ratioValue';
446
+ let price = skuData.prices[this.skuAdjustValue.base];
447
+ let value = this.$xdHelper.divisionFloatNumber(this.$xdHelper.multiplyFloatNumber(this.skuDesireForm.price, 100) - price, price);
448
+ this.skuAdjustValue[unit] = this.$xdHelper.multiplyFloatNumber(value, 100).toFixed(2);
449
+ }
412
450
  }
451
+ this.getSkuAdjustForm(this.skuAdjustValue);
452
+ this.skuAdjustKey = Date.now();
413
453
  }
414
454
  }
415
455
  },
@@ -498,6 +538,7 @@ export default {
498
538
  skuList: [],
499
539
  currentEditSku: null,
500
540
  sku_count: 0,
541
+ adjust_product_id:'',
501
542
  }
502
543
  },
503
544
  computed: {
@@ -516,12 +557,45 @@ export default {
516
557
  temp = this.$xdHelper.multiplyFloatNumber(value, price)
517
558
  }
518
559
  let priceNew = this.$xdHelper.divisionFloatNumber(temp, 100);
519
- return this.$xdHelper.divisionFloatNumber(priceNew * Math.pow(10, toFixed), Math.pow(10, toFixed)).toFixed(this.adjustListValue.decimal)
560
+ let roundingMethod = this.adjustListValue.rounding_method || 'ceil';
561
+ if(this.adjustListValue.decimal === -1) {
562
+ if(roundingMethod === 'ceil') {
563
+ return Math.ceil(priceNew);
564
+ } else if(roundingMethod === 'floor') {
565
+ return Math.floor(priceNew);
566
+ } else {
567
+ return Math.round(priceNew);
568
+ }
569
+ }
570
+ let pow = Math.pow(10, toFixed);
571
+ let roundedPrice = 0;
572
+ if(roundingMethod === 'ceil') {
573
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.ceil(this.$xdHelper.multiplyFloatNumber(priceNew, pow)), pow);
574
+ } else if(roundingMethod === 'floor') {
575
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.floor(this.$xdHelper.multiplyFloatNumber(priceNew, pow)), pow);
576
+ } else {
577
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.round(this.$xdHelper.multiplyFloatNumber(priceNew, pow)), pow);
578
+ }
579
+ return roundedPrice.toFixed(this.adjustListValue.decimal)
520
580
  };
521
581
 
522
582
  if(!this.adjustListValue.base
523
583
  || !this.adjustListValue.unit
524
584
  ) return '';
585
+ if(this.adjustListValue.unit === 'fixed') {
586
+ let roundingMethod = this.adjustListValue.rounding_method || 'ceil';
587
+ let value = Number(this.adjustListValue.moneyValue);
588
+ if(this.adjustListValue.decimal === -1) {
589
+ if(roundingMethod === 'ceil') {
590
+ return Math.ceil(value);
591
+ } else if(roundingMethod === 'floor') {
592
+ return Math.floor(value);
593
+ } else {
594
+ return Math.round(value);
595
+ }
596
+ }
597
+ return value.toFixed(this.adjustListValue.decimal);
598
+ }
525
599
  if(!this.dialogRow['specs'][this.adjustListValue.base]) return '';
526
600
  let value = null;
527
601
  if(this.adjustListValue.unit === 'money') {
@@ -549,12 +623,45 @@ export default {
549
623
  temp = this.$xdHelper.multiplyFloatNumber(value, price)
550
624
  }
551
625
  let priceNew = this.$xdHelper.divisionFloatNumber(temp, 100);
552
- return this.$xdHelper.divisionFloatNumber(priceNew * Math.pow(10, toFixed), Math.pow(10, toFixed)).toFixed(this.adjustListValue.vip_decimal)
626
+ let roundingMethod = this.adjustListValue.vip_rounding_method || 'ceil';
627
+ if(this.adjustListValue.vip_decimal === -1) {
628
+ if(roundingMethod === 'ceil') {
629
+ return Math.ceil(priceNew);
630
+ } else if(roundingMethod === 'floor') {
631
+ return Math.floor(priceNew);
632
+ } else {
633
+ return Math.round(priceNew);
634
+ }
635
+ }
636
+ let pow = Math.pow(10, toFixed);
637
+ let roundedPrice = 0;
638
+ if(roundingMethod === 'ceil') {
639
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.ceil(this.$xdHelper.multiplyFloatNumber(priceNew, pow)), pow);
640
+ } else if(roundingMethod === 'floor') {
641
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.floor(this.$xdHelper.multiplyFloatNumber(priceNew, pow)), pow);
642
+ } else {
643
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.round(this.$xdHelper.multiplyFloatNumber(priceNew, pow)), pow);
644
+ }
645
+ return roundedPrice.toFixed(this.adjustListValue.vip_decimal)
553
646
  };
554
647
 
555
648
  if(!this.adjustListValue.vip_base
556
649
  || !this.adjustListValue.vip_unit
557
650
  ) return '';
651
+ if(this.adjustListValue.vip_unit === 'fixed') {
652
+ let roundingMethod = this.adjustListValue.vip_rounding_method || 'ceil';
653
+ let value = Number(this.adjustListValue.vipMoneyValue);
654
+ if(this.adjustListValue.vip_decimal === -1) {
655
+ if(roundingMethod === 'ceil') {
656
+ return Math.ceil(value);
657
+ } else if(roundingMethod === 'floor') {
658
+ return Math.floor(value);
659
+ } else {
660
+ return Math.round(value);
661
+ }
662
+ }
663
+ return value.toFixed(this.adjustListValue.vip_decimal);
664
+ }
558
665
  if(!this.dialogRow['specs'][this.adjustListValue.vip_base]) return '';
559
666
  let value = null;
560
667
  if(this.adjustListValue.vip_unit === 'money') {
@@ -580,16 +687,29 @@ export default {
580
687
  },
581
688
  showSkuOriginalPrice(){
582
689
  if(!this.skuAdjustValue.product_sku || !this.skuAdjustValue.base) return '';
690
+ if(this.skuAdjustValue.unit === 'fixed') return '';
583
691
  let skuData = this.skuList.find(sku => sku.value === this.skuAdjustValue.product_sku);
584
692
  if(!skuData || !skuData.prices[this.skuAdjustValue.base]) return '';
585
693
  let price = skuData.prices[this.skuAdjustValue.base];
586
694
  return this.$xdHelper.divisionFloatNumber(price, 100);
587
695
  },
588
696
  showSkuAdjustedPrice(){
589
- if(!this.skuAdjustValue.product_sku || !this.skuAdjustValue.base || !this.skuAdjustValue.unit) return '';
697
+ if(!this.skuAdjustValue.product_sku || !this.skuAdjustValue.unit) return '';
698
+ if(this.skuAdjustValue.unit !== 'fixed' && !this.skuAdjustValue.base) return '';
699
+ if(this.skuAdjustValue.unit !== 'fixed') {
700
+ let skuData = this.skuList.find(sku => sku.value === this.skuAdjustValue.product_sku);
701
+ if(!skuData || !skuData.prices[this.skuAdjustValue.base]) return '';
702
+ }
703
+
704
+ if(this.skuAdjustValue.unit === 'fixed') {
705
+ let value = Number(this.skuAdjustValue.moneyValue);
706
+ if(isNaN(value)) return '';
707
+ return value.toFixed(2);
708
+ }
709
+
590
710
  let skuData = this.skuList.find(sku => sku.value === this.skuAdjustValue.product_sku);
591
711
  if(!skuData || !skuData.prices[this.skuAdjustValue.base]) return '';
592
-
712
+
593
713
  const handle = (price, value, type) => {
594
714
  let toFixed = 0;
595
715
  if(this.skuAdjustValue.decimal > 0) toFixed = this.skuAdjustValue.decimal;
@@ -602,9 +722,28 @@ export default {
602
722
  temp = this.$xdHelper.multiplyFloatNumber(value, price)
603
723
  }
604
724
  let priceNew = this.$xdHelper.divisionFloatNumber(temp, 100);
605
- return this.$xdHelper.divisionFloatNumber(priceNew * Math.pow(10, toFixed), Math.pow(10, toFixed), toFixed).toFixed(this.skuAdjustValue.decimal)
725
+ let roundingMethod = this.skuAdjustValue.rounding_method || 'ceil';
726
+ if(this.skuAdjustValue.decimal === -1) {
727
+ if(roundingMethod === 'ceil') {
728
+ return Math.ceil(priceNew);
729
+ } else if(roundingMethod === 'floor') {
730
+ return Math.floor(priceNew);
731
+ } else {
732
+ return Math.round(priceNew);
733
+ }
734
+ }
735
+ let pow = Math.pow(10, toFixed);
736
+ let roundedPrice = 0;
737
+ if(roundingMethod === 'ceil') {
738
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.ceil(this.$xdHelper.multiplyFloatNumber(priceNew, pow)), pow);
739
+ } else if(roundingMethod === 'floor') {
740
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.floor(this.$xdHelper.multiplyFloatNumber(priceNew, pow)), pow);
741
+ } else {
742
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.round(this.$xdHelper.multiplyFloatNumber(priceNew, pow)), pow);
743
+ }
744
+ return roundedPrice.toFixed(this.skuAdjustValue.decimal)
606
745
  };
607
-
746
+
608
747
  let price = skuData.prices[this.skuAdjustValue.base];
609
748
  let value = null;
610
749
  if(this.skuAdjustValue.unit === 'money') {
@@ -614,7 +753,7 @@ export default {
614
753
  if(this.skuAdjustValue.ratioValue !== '') value = Number(this.skuAdjustValue.ratioValue);
615
754
  }
616
755
  if(value === null) return '';
617
-
756
+
618
757
  return handle(price, value, this.skuAdjustValue.unit === 'money');
619
758
  },
620
759
  isShowVipSet(){
@@ -625,6 +764,7 @@ export default {
625
764
  async created () {
626
765
  console.warn(`created.dialogRow:${JSON.stringify(this.dialogRow)}`)
627
766
  console.warn(`created.dialogType:${this.dialogType}`);
767
+ console.log(this.channelParams,'this.channelParams')
628
768
  this.cookieKey = `${this.commonParams.xsiteid}.${this.commonParams.xnamespace}.${this.pagesType}.channel`
629
769
  //开启电子码查看
630
770
  if (this.dialogType === 'showCode') {
@@ -642,8 +782,9 @@ export default {
642
782
 
643
783
  //手动调整售价
644
784
  if (this.dialogType === 'showAdjust') {
645
- let { id, product_id, product_name,sku_count } = this.dialogRow;
785
+ let { id, product_id, product_name,sku_count,can_cancel_modifyprice } = this.dialogRow;
646
786
  product_id = product_id || id;
787
+ this.adjust_product_id = product_id;
647
788
  this.sku_count = sku_count||0;
648
789
  let info = await this.getOnePriceInfo({ product_id });
649
790
  this.priceTypeList = info.data['price_options'];
@@ -664,13 +805,87 @@ export default {
664
805
  product_id, product_name,
665
806
  modifyprice_method_name: info.data['modifyprice_method_name'],
666
807
  };
667
- //设置调价值
668
808
  if(params.unit === 'money') params['moneyValue'] = this.$xdHelper.divisionFloatNumber(params['value'], 100);
669
- else params['ratioValue'] = this.$xdHelper.divisionFloatNumber(params['value'], 100);
670
- //设置vip_plus调价值
809
+ else if(params.unit === 'ratio') params['ratioValue'] = this.$xdHelper.divisionFloatNumber(params['value'], 100);
810
+ else if(params.unit === 'fixed') params['moneyValue'] = this.$xdHelper.divisionFloatNumber(params['value'], 100);
671
811
  if(params.vip_unit === 'money') params['vipMoneyValue'] = this.$xdHelper.divisionFloatNumber(params['vip_value'], 100);
672
- else params['vipRatioValue'] = this.$xdHelper.divisionFloatNumber(params['vip_value'], 100);
812
+ else if(params.vip_unit === 'ratio') params['vipRatioValue'] = this.$xdHelper.divisionFloatNumber(params['vip_value'], 100);
813
+ else if(params.vip_unit === 'fixed') params['vipMoneyValue'] = this.$xdHelper.divisionFloatNumber(params['vip_value'], 100);
673
814
  this.getAdjustForm(params);
815
+
816
+ if(info.data.skus && info.data.skus.length > 0) {
817
+ await this.getSkuList();
818
+
819
+ this.skuAdjustList = info.data.skus.map(skuItem => {
820
+ const skuData = this.skuList.find(s => s.value === skuItem.product_sku);
821
+ const originalPriceData = skuData && skuData.prices ? skuData.prices[skuItem.formula.price.base] : '';
822
+ const originalPrice = originalPriceData
823
+ ? this.$xdHelper.divisionFloatNumber(originalPriceData, 100)
824
+ : '';
825
+
826
+ let adjustValue = '';
827
+ if(skuItem.formula.price.unit === 'money') {
828
+ adjustValue = this.$xdHelper.divisionFloatNumber(skuItem.formula.price.value, 100);
829
+ } else if(skuItem.formula.price.unit === 'ratio') {
830
+ adjustValue = this.$xdHelper.divisionFloatNumber(skuItem.formula.price.value, 100);
831
+ } else if(skuItem.formula.price.unit === 'fixed') {
832
+ adjustValue = this.$xdHelper.divisionFloatNumber(skuItem.formula.price.value, 100);
833
+ }
834
+
835
+ const basePrice = skuData && skuData.prices ? skuData.prices[skuItem.formula.price.base] : 0;
836
+ let adjustedPrice = '';
837
+ const formatPrice = (price, decimal, roundingMethod) => {
838
+ if(decimal === -1) {
839
+ if(roundingMethod === 'ceil') {
840
+ return Math.ceil(price);
841
+ } else if(roundingMethod === 'floor') {
842
+ return Math.floor(price);
843
+ } else {
844
+ return Math.round(price);
845
+ }
846
+ }
847
+ let pow = Math.pow(10, decimal);
848
+ let roundedPrice = 0;
849
+ if(roundingMethod === 'ceil') {
850
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.ceil(this.$xdHelper.multiplyFloatNumber(price, pow)), pow);
851
+ } else if(roundingMethod === 'floor') {
852
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.floor(this.$xdHelper.multiplyFloatNumber(price, pow)), pow);
853
+ } else {
854
+ roundedPrice = this.$xdHelper.divisionFloatNumber(Math.round(this.$xdHelper.multiplyFloatNumber(price, pow)), pow);
855
+ }
856
+ return Number(roundedPrice.toFixed(decimal));
857
+ };
858
+ if(skuItem.formula.price.unit === 'fixed') {
859
+ adjustedPrice = formatPrice(adjustValue, 2, 'round');
860
+ } else {
861
+ const tempPrice = skuItem.formula.price.unit === 'money'
862
+ ? this.$xdHelper.addFloatNumber(this.$xdHelper.multiplyFloatNumber(adjustValue, 100), basePrice)
863
+ : this.$xdHelper.multiplyFloatNumber(this.$xdHelper.addFloatNumber(this.$xdHelper.divisionFloatNumber(adjustValue, 100), 1), basePrice);
864
+ adjustedPrice = formatPrice(
865
+ this.$xdHelper.divisionFloatNumber(tempPrice, 100),
866
+ skuItem.formula.price.decimal,
867
+ skuItem.formula.price.rounding_method || 'ceil'
868
+ );
869
+ }
870
+
871
+ return {
872
+ product_sku: skuItem.product_sku,
873
+ sku_name: skuData?.label || skuItem.product_sku_name,
874
+ base: skuItem.formula.price.base,
875
+ base_label: this.priceTypeList.find(p => p.value === skuItem.formula.price.base)?.label || skuItem.formula.price.base,
876
+ unit: skuItem.formula.price.unit,
877
+ unit_label: skuItem.formula.price.unit === 'money' ? '按金额' : skuItem.formula.price.unit === 'ratio' ? '按比例' : '固定售价',
878
+ decimal: skuItem.formula.price.decimal,
879
+ decimal_label: skuItem.formula.price.decimal === -1 ? '零位' : skuItem.formula.price.decimal === 1 ? '一位' : '两位',
880
+ rounding_method: skuItem.formula.price.rounding_method || 'ceil',
881
+ rounding_method_label: skuItem.formula.price.rounding_method === 'ceil' ? '向上' : skuItem.formula.price.rounding_method === 'floor' ? '向下' : '四舍五入',
882
+ adjust_value: adjustValue,
883
+ original_price: originalPrice,
884
+ adjusted_price: adjustedPrice
885
+ };
886
+ });
887
+ }
888
+
674
889
  this.adjustStatus = true;
675
890
  this.showAdjust = true;
676
891
  }
@@ -798,6 +1013,24 @@ export default {
798
1013
  size: 'small',
799
1014
  },
800
1015
  {
1016
+ label: "调价方式:",
1017
+ ele: "xd-radio",
1018
+ valueKey: "unit",
1019
+ value: params['unit'] || 'money',
1020
+ list: [
1021
+ { "label": "按金额", "value": "money" },
1022
+ { "label": "按比例", "value": "ratio" },
1023
+ this.channelParams.showFixed&&this.sku_count<=1 && { "label": "固定售价", "value": "fixed" },
1024
+ ].filter(i=>i),
1025
+ notice: params.unit === 'fixed' ? '<span style="color:red;">此选项可能会导致亏本售卖,请谨慎设置 如低于成本价,则按成本价作为售价</span>' : '',
1026
+ inline: false,
1027
+ rules: [{
1028
+ required: true,
1029
+ message: '请选择调价方式',
1030
+ trigger: 'change'
1031
+ }],
1032
+ },
1033
+ params.unit !== 'fixed' && {
801
1034
  label: '基于:',
802
1035
  ele: 'xd-select-list',
803
1036
  valueKey: 'base',
@@ -815,22 +1048,12 @@ export default {
815
1048
  notice: '<span style="color:#000; font-size: 14px;">调整</span><span style="color:#f00; font-size: 14px;">售价</span>',
816
1049
  inline: true
817
1050
  },
818
- {
1051
+ params.unit !== 'fixed' && {
819
1052
  keys: Date.now(),
820
1053
  label: "",
821
1054
  ele: 'slot',
822
1055
  slot:'showSelectPrice'
823
1056
  },
824
- {
825
- label: "",
826
- ele: "xd-radio",
827
- valueKey: "unit",
828
- value: params['unit'] || 'money',
829
- list: [
830
- { "label": "按金额", "value": "money" },
831
- { "label": "按比例", "value": "ratio" },
832
- ],
833
- },
834
1057
  params.unit==='ratio'&& {
835
1058
  label: "",
836
1059
  ele: 'slot',
@@ -877,12 +1100,31 @@ export default {
877
1100
  notice: '可设置正负值,负值时为下调',
878
1101
  inline: false
879
1102
  },
880
- {
1103
+ params.unit === 'fixed' && {
1104
+ label: '固定售价:',
1105
+ ele: 'xd-input-unit',
1106
+ valueKey: 'moneyValue',
1107
+ value: params['moneyValue'],
1108
+ setting: {
1109
+ unit: '元',
1110
+ pos: 'append',
1111
+ type: 'number'
1112
+ },
1113
+ placeholder: {
1114
+ unitPlaceholder: '请输入固定售价',
1115
+ },
1116
+ rules: [
1117
+ { required: true, message: '请输入固定售价', trigger: 'blur' },
1118
+ ],
1119
+ inline: false,
1120
+ notice: '支持小数点后两位',
1121
+ },
1122
+ params.unit !== 'fixed' && {
881
1123
  label: '小数点保留位数:',
882
1124
  ele: 'xd-select-list',
883
1125
  valueKey: 'decimal',
884
1126
  className:'input50',
885
- value: params.decimal || 2,
1127
+ value: params.decimal ?? 2,
886
1128
  placeholder: '请选择小数点保留位数',
887
1129
  multiple: false,
888
1130
  list: [
@@ -896,7 +1138,26 @@ export default {
896
1138
  trigger: 'change'
897
1139
  }],
898
1140
  },
899
- {
1141
+ params.unit !== 'fixed' && {
1142
+ label: '取数方式:',
1143
+ ele: 'xd-select-list',
1144
+ valueKey: 'rounding_method',
1145
+ className: 'input50',
1146
+ value: params.rounding_method || 'ceil',
1147
+ placeholder: '请选择取数方式',
1148
+ multiple: false,
1149
+ list: [
1150
+ { "label": "向上(默认)", "value": 'ceil' },
1151
+ { "label": "向下", "value": 'floor'},
1152
+ { "label": "四舍五入", "value": 'round' },
1153
+ ],
1154
+ rules: [{
1155
+ required: true,
1156
+ message: '请选择取数方式',
1157
+ trigger: 'change'
1158
+ }],
1159
+ },
1160
+ params.unit !== 'fixed' && {
900
1161
  label: "调整后售价",
901
1162
  ele: 'slot',
902
1163
  slot:'showPrice'
@@ -907,6 +1168,24 @@ export default {
907
1168
  size: 'small',
908
1169
  },
909
1170
  this.isShowVipSet&&{
1171
+ label: "PLUS调价方式:",
1172
+ ele: "xd-radio",
1173
+ valueKey: "vip_unit",
1174
+ value: params['vip_unit'] || 'money',
1175
+ list: [
1176
+ { "label": "按金额", "value": "money" },
1177
+ { "label": "按比例", "value": "ratio" },
1178
+ this.channelParams.showFixed && { "label": "固定售价", "value": "fixed" },
1179
+ ].filter(i=>i),
1180
+ notice: params.vip_unit === 'fixed' ? '此选项可能会导致亏本售卖,请谨慎设置 如低于成本价,则按成本价作为售价' : '',
1181
+ inline: false,
1182
+ rules: [{
1183
+ required: true,
1184
+ message: '请选择调价方式',
1185
+ trigger: 'change'
1186
+ }],
1187
+ },
1188
+ this.isShowVipSet&&params.vip_unit !== 'fixed' && {
910
1189
  label: 'PLUS售价基于:',
911
1190
  ele: 'xd-select-list',
912
1191
  valueKey: 'vip_base',
@@ -924,22 +1203,13 @@ export default {
924
1203
  notice: '<span style="color:#000; font-size: 14px;">调整</span><span style="color:#f00; font-size: 14px;">PLUS售价</span>',
925
1204
  inline: true
926
1205
  },
927
- this.isShowVipSet&&{
1206
+ this.isShowVipSet&&params.vip_unit !== 'fixed' && {
928
1207
  keys: Date.now(),
929
1208
  label: "",
930
1209
  ele: 'slot',
931
1210
  slot:'showVipSelectPrice'
932
1211
  },
933
- this.isShowVipSet&&{
934
- label: "",
935
- ele: "xd-radio",
936
- valueKey: "vip_unit",
937
- value: params['vip_unit'] || 'money',
938
- list: [
939
- { "label": "按金额", "value": "money" },
940
- { "label": "按比例", "value": "ratio" },
941
- ],
942
- },
1212
+
943
1213
  this.isShowVipSet&&params.vip_unit==='ratio'&& {
944
1214
  label: "",
945
1215
  ele: 'slot',
@@ -986,12 +1256,32 @@ export default {
986
1256
  notice: '可设置正负值,负值时为下调',
987
1257
  inline: false
988
1258
  },
989
- this.isShowVipSet&&{
1259
+ this.isShowVipSet&&params.vip_unit === 'fixed' && {
1260
+ label: '固定售价:',
1261
+ ele: 'xd-input-unit',
1262
+ valueKey: 'vipMoneyValue',
1263
+ keys: Date.now(),
1264
+ value: params['vipMoneyValue'],
1265
+ setting: {
1266
+ unit: '元',
1267
+ pos: 'append',
1268
+ type: 'number'
1269
+ },
1270
+ placeholder: {
1271
+ unitPlaceholder: '请输入固定售价',
1272
+ },
1273
+ rules: [
1274
+ { required: true, message: '请输入固定售价', trigger: 'blur' },
1275
+ ],
1276
+ inline: false,
1277
+ notice: '支持小数点后两位',
1278
+ },
1279
+ this.isShowVipSet&&params.vip_unit !== 'fixed' && {
990
1280
  label: '小数点保留位数:',
991
1281
  ele: 'xd-select-list',
992
1282
  valueKey: 'vip_decimal',
993
1283
  className:'input50',
994
- value: params.vip_decimal || 2,
1284
+ value: params.vip_decimal ?? 2,
995
1285
  placeholder: '请选择小数点保留位数',
996
1286
  multiple: false,
997
1287
  list: [
@@ -1005,7 +1295,26 @@ export default {
1005
1295
  trigger: 'change'
1006
1296
  }],
1007
1297
  },
1008
- this.isShowVipSet&&{
1298
+ this.isShowVipSet&&params.vip_unit !== 'fixed' && {
1299
+ label: '取数方式:',
1300
+ ele: 'xd-select-list',
1301
+ valueKey: 'vip_rounding_method',
1302
+ className: 'input50',
1303
+ value: params.vip_rounding_method || 'ceil',
1304
+ placeholder: '请选择取数方式',
1305
+ multiple: false,
1306
+ list: [
1307
+ { "label": "向上(默认)", "value": 'ceil' },
1308
+ { "label": "向下", "value": 'floor'},
1309
+ { "label": "四舍五入", "value": 'round' },
1310
+ ],
1311
+ rules: [{
1312
+ required: true,
1313
+ message: '请选择取数方式',
1314
+ trigger: 'change'
1315
+ }],
1316
+ },
1317
+ this.isShowVipSet&&params.vip_unit !== 'fixed' && {
1009
1318
  label: "调整后售价",
1010
1319
  ele: 'slot',
1011
1320
  slot:'showVipPrice'
@@ -1104,29 +1413,34 @@ export default {
1104
1413
  });
1105
1414
  },
1106
1415
  getAdjustParams () {
1107
- const { product_id, unit, base,decimal,ratioValue, moneyValue,vip_unit, vip_base,vip_decimal,vipRatioValue, vipMoneyValue} = this.adjustListValue;
1416
+ const { product_id, unit, base,decimal,rounding_method,ratioValue, moneyValue,vip_unit, vip_base,vip_decimal,vip_rounding_method,vipRatioValue, vipMoneyValue} = this.adjustListValue;
1108
1417
  let value = 0;
1109
1418
  if(unit === 'ratio') value = Number(ratioValue);
1110
1419
  if(unit === 'money') value = Number(moneyValue);
1420
+ if(unit === 'fixed') value = Number(moneyValue);
1421
+
1111
1422
  let vip_value = 0;
1112
1423
  if(vip_unit === 'ratio') vip_value = Number(vipRatioValue);
1113
1424
  if(vip_unit === 'money') vip_value = Number(vipMoneyValue);
1425
+ if(vip_unit === 'fixed') vip_value = Number(vipMoneyValue);
1114
1426
 
1115
1427
  const formula = {
1116
1428
  sale_price: {
1117
1429
  unit,
1118
- base,
1119
1430
  value: this.$xdHelper.multiplyFloatNumber(Number(value), 100),
1120
- decimal
1431
+ base: unit === 'fixed' ? 'jfb_price' : base,
1432
+ decimal: unit === 'fixed' ? 0 : decimal,
1433
+ rounding_method: unit === 'fixed' ? 'ceil' : rounding_method,
1121
1434
  }
1122
1435
  };
1123
-
1436
+
1124
1437
  if(this.isShowVipSet){
1125
1438
  formula.vip_price = {
1126
- unit:vip_unit,
1127
- base:vip_base,
1439
+ unit: vip_unit,
1440
+ base: vip_unit === 'fixed' ? 'jfb_price' : vip_base,
1441
+ decimal: vip_unit === 'fixed' ? 0 : vip_decimal,
1442
+ rounding_method: vip_unit === 'fixed' ? 'ceil' : vip_rounding_method,
1128
1443
  value: this.$xdHelper.multiplyFloatNumber(Number(vip_value), 100),
1129
- decimal:vip_decimal
1130
1444
  };
1131
1445
  }
1132
1446
 
@@ -1141,30 +1455,34 @@ export default {
1141
1455
  let sku_value = 0;
1142
1456
  if(item.unit === 'ratio') sku_value = Number(item.adjust_value);
1143
1457
  if(item.unit === 'money') sku_value = Number(item.adjust_value);
1144
-
1458
+ if(item.unit === 'fixed') sku_value = Number(item.adjust_value);
1459
+
1145
1460
  const skuFormula = {
1146
1461
  sale_price: {
1147
1462
  unit: item.unit,
1148
- base: item.base,
1149
1463
  value: this.$xdHelper.multiplyFloatNumber(Number(sku_value), 100),
1150
- decimal: item.decimal
1464
+ base: item.unit === 'fixed' ? 'jfb_price' : item.base,
1465
+ decimal: item.unit === 'fixed' ? 0 : item.decimal,
1466
+ rounding_method: item.unit === 'fixed' ? 'ceil' : item.rounding_method,
1151
1467
  }
1152
1468
  };
1153
-
1469
+
1154
1470
  // 如果支持VIP价格,添加vip_price到规格的formula中
1155
1471
  if(this.isShowVipSet && item.vip_unit && item.vip_base){
1156
1472
  let vip_sku_value = 0;
1157
1473
  if(item.vip_unit === 'ratio') vip_sku_value = Number(item.vip_adjust_value);
1158
1474
  if(item.vip_unit === 'money') vip_sku_value = Number(item.vip_adjust_value);
1159
-
1475
+ if(item.vip_unit === 'fixed') vip_sku_value = Number(item.vip_adjust_value);
1476
+
1160
1477
  skuFormula.vip_price = {
1161
1478
  unit: item.vip_unit,
1162
- base: item.vip_base,
1163
1479
  value: this.$xdHelper.multiplyFloatNumber(Number(vip_sku_value), 100),
1164
- decimal: item.vip_decimal
1480
+ base: item.vip_unit === 'fixed' ? 'jfb_price' : item.vip_base,
1481
+ decimal: item.vip_unit === 'fixed' ? 0 : item.vip_decimal,
1482
+ rounding_method: item.vip_unit === 'fixed' ? 'ceil' : item.vip_rounding_method,
1165
1483
  };
1166
1484
  }
1167
-
1485
+
1168
1486
  return {
1169
1487
  product_sku: item.product_sku,
1170
1488
  formula: skuFormula
@@ -1196,6 +1514,22 @@ export default {
1196
1514
  })
1197
1515
  .catch()
1198
1516
  },
1517
+ //取消调价
1518
+ handleCancelAdjust(){
1519
+ this.$confirm("确认取消调价", "提示")
1520
+ .then(() => {
1521
+ this.cancelAdjust({product_id: this.adjust_product_id}).then(() => {
1522
+ this.adjustStatus = false
1523
+ this.showAdjust = false
1524
+ this.$message({
1525
+ message: '操作成功',
1526
+ type: 'success'
1527
+ })
1528
+ this.handleDialogSuccess()
1529
+ })
1530
+ })
1531
+ .catch((err) => { })
1532
+ },
1199
1533
  //==调价==============================
1200
1534
 
1201
1535
  //商品配置-是否公开
@@ -1349,27 +1683,33 @@ export default {
1349
1683
  ratioValue: ''
1350
1684
  };
1351
1685
  this.getSkuAdjustForm(this.skuAdjustValue);
1686
+ this.skuAdjustKey = Date.now();
1352
1687
  this.skuAdjustStatus = true;
1353
1688
  this.showAddSkuAdjust = true;
1354
1689
  },
1355
1690
 
1356
1691
  handleEditSkuAdjust(row) {
1357
1692
  this.currentEditSku = row;
1358
- this.skuAdjustValue = {
1359
- product_sku: row.product_sku,
1360
- base: row.base,
1361
- unit: row.unit,
1362
- decimal: row.decimal,
1363
- moneyValue: row.unit === 'money' ? row.adjust_value : '',
1364
- ratioValue: row.unit === 'ratio' ? row.adjust_value : ''
1365
- };
1366
- // 如果是按比例,回显期望售价为调整后售价
1367
- if (row.unit === 'ratio') {
1368
- this.skuDesireForm.price = row.adjusted_price;
1369
- }
1370
- this.getSkuAdjustForm(this.skuAdjustValue);
1371
- this.skuAdjustStatus = true;
1372
- this.showAddSkuAdjust = true;
1693
+ this._isSkuAdjustEditing = true;
1694
+ this.skuAdjustValue = {};
1695
+ this.$nextTick(() => {
1696
+ this.skuAdjustValue = {
1697
+ product_sku: row.product_sku,
1698
+ base: row.base,
1699
+ unit: row.unit,
1700
+ decimal: row.decimal,
1701
+ moneyValue: row.unit === 'money' || row.unit === 'fixed' ? row.adjust_value : '',
1702
+ ratioValue: row.unit === 'ratio' ? row.adjust_value : '',
1703
+ rounding_method: row.rounding_method || 'ceil'
1704
+ };
1705
+ if (row.unit === 'ratio') {
1706
+ this.skuDesireForm.price = row.adjusted_price;
1707
+ }
1708
+ this.skuAdjustStatus = true;
1709
+ this.getSkuAdjustForm(this.skuAdjustValue);
1710
+ this.showAddSkuAdjust = true;
1711
+ this._isSkuAdjustEditing = false;
1712
+ });
1373
1713
  },
1374
1714
 
1375
1715
  handleDeleteSkuAdjust(index) {
@@ -1391,7 +1731,7 @@ export default {
1391
1731
  handleAddSkuAdjustConfirm() {
1392
1732
  this.$refs['skuAdjust'].submitAll()
1393
1733
  .then(res => {
1394
- const { product_sku, base, unit, decimal, moneyValue, ratioValue } = this.skuAdjustValue;
1734
+ const { product_sku, base, unit, decimal, moneyValue, ratioValue, rounding_method } = this.skuAdjustValue;
1395
1735
  const skuData = this.skuList.find(sku => sku.value === product_sku);
1396
1736
  if (!skuData) return;
1397
1737
 
@@ -1405,7 +1745,7 @@ export default {
1405
1745
  }
1406
1746
 
1407
1747
  const originalPrice = this.$xdHelper.divisionFloatNumber(skuData.prices[base], 100);
1408
- const adjustValue = unit === 'money' ? moneyValue : ratioValue;
1748
+ const adjustValue = unit === 'fixed' ? moneyValue : (unit === 'money' ? moneyValue : ratioValue);
1409
1749
  const adjustedPrice = this.showSkuAdjustedPrice;
1410
1750
 
1411
1751
  const adjustItem = {
@@ -1414,9 +1754,11 @@ export default {
1414
1754
  base,
1415
1755
  base_label: this.priceTypeList.find(item => item.value === base)?.label || base,
1416
1756
  unit,
1417
- unit_label: unit === 'money' ? '按金额' : '按比例',
1757
+ unit_label: unit === 'money' ? '按金额' : unit === 'ratio' ? '按比例' : '固定售价',
1418
1758
  decimal,
1419
1759
  decimal_label: decimal === -1 ? '零位' : decimal === 1 ? '一位' : '两位',
1760
+ rounding_method,
1761
+ rounding_method_label: rounding_method === 'ceil' ? '向上' : rounding_method === 'floor' ? '向下' : '四舍五入',
1420
1762
  adjust_value: adjustValue,
1421
1763
  original_price: originalPrice,
1422
1764
  adjusted_price: adjustedPrice
@@ -1464,6 +1806,7 @@ export default {
1464
1806
  },
1465
1807
 
1466
1808
  getSkuAdjustForm(params) {
1809
+ console.log(params,this.priceTypeList,'ppppp')
1467
1810
  // 确保当切换单位时,清空另一个单位的值
1468
1811
  if (params.unit === 'ratio' && params.moneyValue !== '') {
1469
1812
  this.skuAdjustValue.moneyValue = '';
@@ -1490,6 +1833,24 @@ export default {
1490
1833
  inline: true
1491
1834
  },
1492
1835
  {
1836
+ label: "调价方式:",
1837
+ ele: "xd-radio",
1838
+ valueKey: "unit",
1839
+ value: params.unit || 'money',
1840
+ list: [
1841
+ { "label": "按金额", "value": "money" },
1842
+ { "label": "按比例", "value": "ratio" },
1843
+ this.channelParams.showFixed && { "label": "固定售价", "value": "fixed" },
1844
+ ].filter(i=>i),
1845
+ notice: params.unit === 'fixed' ? '<span style="color:red;">此选项可能会导致亏本售卖,请谨慎设置 如低于成本价,则按成本价作为售价</span>' : '',
1846
+ inline: false,
1847
+ rules: [{
1848
+ required: true,
1849
+ message: '请选择调价方式',
1850
+ trigger: 'change'
1851
+ }],
1852
+ },
1853
+ params.unit !== 'fixed' && {
1493
1854
  label: '基于:',
1494
1855
  ele: 'xd-select-list',
1495
1856
  valueKey: 'base',
@@ -1507,22 +1868,13 @@ export default {
1507
1868
  notice: '<span style="color:#000; font-size: 14px;">调整</span><span style="color:#f00; font-size: 14px;">售价</span>',
1508
1869
  inline: true
1509
1870
  },
1510
- {
1871
+ params.unit !== 'fixed' && {
1511
1872
  keys: Date.now(),
1512
1873
  label: "",
1513
1874
  ele: 'slot',
1514
1875
  slot: 'showSkuOriginalPrice'
1515
1876
  },
1516
- {
1517
- label: "",
1518
- ele: "xd-radio",
1519
- valueKey: "unit",
1520
- value: params.unit || 'money',
1521
- list: [
1522
- { "label": "按金额", "value": "money" },
1523
- { "label": "按比例", "value": "ratio" },
1524
- ],
1525
- },
1877
+
1526
1878
  this.skuAdjustValue.unit==='ratio' && {
1527
1879
  keys: Date.now(),
1528
1880
  label: "",
@@ -1570,12 +1922,32 @@ export default {
1570
1922
  notice: '可设置正负值,负值时为下调',
1571
1923
  inline: false
1572
1924
  },
1573
- {
1925
+ params.unit === 'fixed' && {
1926
+ label: '固定售价:',
1927
+ ele: 'xd-input-unit',
1928
+ valueKey: 'moneyValue',
1929
+ keys: Date.now(),
1930
+ value: params['moneyValue'],
1931
+ setting: {
1932
+ unit: '元',
1933
+ pos: 'append',
1934
+ type: 'number'
1935
+ },
1936
+ placeholder: {
1937
+ unitPlaceholder: '请输入固定售价',
1938
+ },
1939
+ rules: [
1940
+ { required: true, message: '请输入固定售价', trigger: 'blur' },
1941
+ ],
1942
+ inline: false,
1943
+ notice: '支持小数点后两位',
1944
+ },
1945
+ params.unit !== 'fixed' && {
1574
1946
  label: '小数点保留位数:',
1575
1947
  ele: 'xd-select-list',
1576
1948
  valueKey: 'decimal',
1577
1949
  className: 'input50',
1578
- value: params.decimal || 2,
1950
+ value: params.decimal ?? 2,
1579
1951
  placeholder: '请选择小数点保留位数',
1580
1952
  multiple: false,
1581
1953
  list: [
@@ -1589,7 +1961,26 @@ export default {
1589
1961
  trigger: 'change'
1590
1962
  }],
1591
1963
  },
1592
- {
1964
+ params.unit !== 'fixed' && {
1965
+ label: '取数方式:',
1966
+ ele: 'xd-select-list',
1967
+ valueKey: 'rounding_method',
1968
+ className: 'input50',
1969
+ value: params.rounding_method || 'ceil',
1970
+ placeholder: '请选择取数方式',
1971
+ multiple: false,
1972
+ list: [
1973
+ { "label": "向上(默认)", "value": 'ceil' },
1974
+ { "label": "向下", "value": 'floor'},
1975
+ { "label": "四舍五入", "value": 'round' },
1976
+ ],
1977
+ rules: [{
1978
+ required: true,
1979
+ message: '请选择取数方式',
1980
+ trigger: 'change'
1981
+ }],
1982
+ },
1983
+ params.unit !== 'fixed' && {
1593
1984
  label: "调整后售价",
1594
1985
  ele: 'slot',
1595
1986
  slot: 'showSkuAdjustedPrice'
@@ -471,6 +471,13 @@ export default {
471
471
  },
472
472
  notice: "市场价和分销价",
473
473
  },
474
+ this.channelParams.scene === 'selected'&&{
475
+ label: "商品条码:", //label
476
+ ele: "el-input", //package 名称
477
+ valueKey: "product_bar_code", //form[valueKey]
478
+ value: "", //v-model
479
+ placeholder: "请输入商品条码,即69码",
480
+ },
474
481
  this.projectType!=='wholesale'&&{
475
482
  label: "按折扣:", //label
476
483
  ele: "xd-input-range", //package 名称
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-admin-library",
3
- "version": "1.1.217",
3
+ "version": "1.1.219",
4
4
  "description": "聚福宝福利后台管理系统公共模块",
5
5
  "author": "goashiyong <gaoshiyong1272@vip.163.com>",
6
6
  "scripts": {