jufubao-admin-library 1.1.157 → 1.1.158

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.
@@ -40,18 +40,35 @@
40
40
  <el-button type="primary" size="small" @click="handleSetDesire">设置期望售价</el-button>
41
41
  </el-form-item>
42
42
  </template>
43
+ <template slot="vipDesire">
44
+ <el-form-item prop="vipDesire" label="">
45
+ <el-button type="primary" size="small" @click="handleSetVipDesire">设置期望售价</el-button>
46
+ </el-form-item>
47
+ </template>
43
48
  <template slot="showPrice">
44
49
  <div class="show-price">
45
50
  <div>调整后售价:</div>
46
51
  <div><el-input class="input50" type="number" v-model="showPrice" disabled></el-input></div>
47
52
  </div>
48
53
  </template>
54
+ <template slot="showVipPrice">
55
+ <div class="show-price">
56
+ <div>调整后售价:</div>
57
+ <div><el-input class="input50" type="number" v-model="showVipPrice" disabled></el-input></div>
58
+ </div>
59
+ </template>
49
60
  <template slot="showSelectPrice">
50
61
  <div class="show-price">
51
62
  <div>调整原始价格:</div>
52
63
  <div><el-input class="input50" type="number" v-model="showSelectPrice" disabled></el-input></div>
53
64
  </div>
54
65
  </template>
66
+ <template slot="showVipSelectPrice">
67
+ <div class="show-price">
68
+ <div>调整原始价格:</div>
69
+ <div><el-input class="input50" type="number" v-model="showVipSelectPrice" disabled></el-input></div>
70
+ </div>
71
+ </template>
55
72
  </xd-base-dynamic-field>
56
73
  <xd-dialog
57
74
  v-if="showDesire"
@@ -69,6 +86,22 @@
69
86
  </el-form>
70
87
  </div>
71
88
  </xd-dialog>
89
+ <xd-dialog
90
+ v-if="showVipDesire"
91
+ :show.sync="showVipDesire"
92
+ width="460px"
93
+ @onConfirm="handleVipDesire"
94
+ title='设置'
95
+ >
96
+ <div style="display: flex">
97
+ <el-form ref="desireForm" :model="desireVipForm" :rules="rules" label-width="80px">
98
+ <el-form-item prop="price" label="期望售价">
99
+ <el-input v-model="desireVipForm.price" placeholder="请输入期望售价"></el-input>
100
+ <span style="color:#999;font-size:12px;line-height:20px;display:block">将根据期望售价和选择的基准价格自动计算上调比除不尽时自动进位,故实际售价与期望值会略有偏差</span>
101
+ </el-form-item>
102
+ </el-form>
103
+ </div>
104
+ </xd-dialog>
72
105
  </xd-dialog>
73
106
  <xd-dialog
74
107
  v-if="showPublicSet"
@@ -124,6 +157,7 @@
124
157
  import XdDialog from "@/components/XdDialog"
125
158
  import { getOptions } from "@/utils/options"
126
159
  import XdBaseDynamicField from "@/components/XdBaseDynamicField"
160
+ import checkPermission from "@/utils/permission"
127
161
  import { mapActions, mapState } from "vuex"
128
162
  export default {
129
163
  name: "JfbProductDialog",
@@ -132,10 +166,22 @@ export default {
132
166
  XdBaseDynamicField
133
167
  },
134
168
  watch: {
135
- 'adjustListValue.unit' (value) {
136
- this.getAdjustForm(this.adjustListValue)
169
+ 'adjustListValue.unit' : {
170
+ handler(n,o){
171
+ if(n&&n!==o){
172
+ this.getAdjustForm(this.adjustListValue)
173
+ }
174
+ }
175
+ },
176
+ 'adjustListValue.vip_unit':{
177
+ handler(n,o){
178
+ if(n&&n!==o){
179
+ this.getAdjustForm(this.adjustListValue)
180
+ }
181
+ }
137
182
  },
138
183
  },
184
+
139
185
  data () {
140
186
  return {
141
187
  showCount: false,
@@ -178,6 +224,7 @@ export default {
178
224
  is_allow_public_product:true,
179
225
  cookieKey:'cookieKey',
180
226
  showDesire:false,
227
+ showVipDesire:false,
181
228
  desireForm:{
182
229
  price:''
183
230
  },
@@ -186,6 +233,14 @@ export default {
186
233
  { required: true, message: '请输入期望售价', trigger: 'change' }
187
234
  ],
188
235
  },
236
+ desireVipForm:{
237
+ price:''
238
+ },
239
+ vipRules: {
240
+ price: [
241
+ { required: true, message: '请输入期望售价', trigger: 'change' }
242
+ ],
243
+ },
189
244
  setRules:{
190
245
  public: [
191
246
  { required: true, message: '请选择是否公开', trigger: 'change' }
@@ -231,11 +286,51 @@ export default {
231
286
  let price = this.dialogRow['specs'][this.adjustListValue.base];
232
287
  return handle(price,value, this.adjustListValue.unit === 'money');
233
288
  },
289
+ showVipPrice(){
290
+ const handle = (price, value, type)=>{
291
+ console.warn(`adjustList:{price:${price},value:${value},type:${type}`);
292
+ let toFixed = 0;
293
+ if(this.adjustListValue.vip_decimal > 0) toFixed = this.adjustListValue.vip_decimal;
294
+ let temp = 0;
295
+ if(type) {
296
+ value = this.$xdHelper.multiplyFloatNumber(value, 100);
297
+ temp = this.$xdHelper.addFloatNumber(value, price)
298
+ } else {
299
+ value = this.$xdHelper.addFloatNumber(this.$xdHelper.divisionFloatNumber(value, 100), 1);
300
+ temp = this.$xdHelper.multiplyFloatNumber(value, price)
301
+ }
302
+ let priceNew = this.$xdHelper.divisionFloatNumber(temp, 100);
303
+ return Math.ceil(priceNew * Math.pow(10, toFixed)) / Math.pow(10, toFixed)
304
+ };
305
+
306
+ if(!this.adjustListValue.vip_base
307
+ || !this.adjustListValue.vip_unit
308
+ ) return '';
309
+ if(!this.dialogRow['specs'][this.adjustListValue.vip_base]) return '';
310
+ let value = null;
311
+ if(this.adjustListValue.vip_unit === 'money') {
312
+ if(this.adjustListValue.vipMoneyValue) value = Number(this.adjustListValue.vipMoneyValue);
313
+ }
314
+ if(this.adjustListValue.vip_unit === 'ratio') {
315
+ if(this.adjustListValue.vipRatioValue) value = Number(this.adjustListValue.vipRatioValue);
316
+ }
317
+ if(value === null) return '';
234
318
 
319
+ let price = this.dialogRow['specs'][this.adjustListValue.vip_base];
320
+ return handle(price,value, this.adjustListValue.vip_unit === 'money');
321
+ },
235
322
  showSelectPrice(){
236
323
  if(!this.adjustListValue.base) return '';
237
324
  let price = this.dialogRow['specs'][this.adjustListValue.base];
238
325
  return this.$xdHelper.divisionFloatNumber(price, 100)
326
+ },
327
+ showVipSelectPrice(){
328
+ if(!this.adjustListValue.vip_base) return '';
329
+ let price = this.dialogRow['specs'][this.adjustListValue.vip_base];
330
+ return this.$xdHelper.divisionFloatNumber(price, 100)
331
+ },
332
+ isShowVipSet(){
333
+ return this.channelParams.group_key&&this.channelParams.group_key==='vip'
239
334
  }
240
335
  },
241
336
 
@@ -264,14 +359,28 @@ export default {
264
359
  let info = await this.getOnePriceInfo({ product_id });
265
360
  this.priceTypeList = info.data['price_options'];
266
361
  let params = info.data['formula']['price'];
362
+ let vip_params = null;
363
+ if(info.data['formula']['vip_price']){
364
+ vip_params = {
365
+ vip_base: info.data['formula']['vip_price']['base'],
366
+ vip_unit: info.data['formula']['vip_price']['unit'],
367
+ vip_decimal: info.data['formula']['vip_price']['decimal'],
368
+ vip_no_high_market_price: info.data['formula']['vip_price']['no_high_market_price'],
369
+ vip_value: info.data['formula']['vip_price']['value'],
370
+ }
371
+ }
267
372
  params = {
268
373
  ...params,
374
+ ...vip_params,
269
375
  product_id, product_name,
270
376
  modifyprice_method_name: info.data['modifyprice_method_name'],
271
377
  };
272
378
  //设置调价值
273
379
  if(params.unit === 'money') params['moneyValue'] = this.$xdHelper.divisionFloatNumber(params['value'], 100);
274
380
  else params['ratioValue'] = this.$xdHelper.divisionFloatNumber(params['value'], 100);
381
+ //设置vip_plus调价值
382
+ if(params.vip_unit === 'money') params['vipMoneyValue'] = this.$xdHelper.divisionFloatNumber(params['vip_value'], 100);
383
+ else params['vipRatioValue'] = this.$xdHelper.divisionFloatNumber(params['vip_value'], 100);
275
384
  this.getAdjustForm(params);
276
385
  this.adjustStatus = true;
277
386
  this.showAdjust = true;
@@ -392,6 +501,11 @@ export default {
392
501
  className: 'input90',
393
502
  disabled: true
394
503
  },
504
+ {
505
+ label: '售价调整',
506
+ ele: 'title',
507
+ size: 'small',
508
+ },
395
509
  {
396
510
  label: '基于:',
397
511
  ele: 'xd-select-list',
@@ -496,7 +610,117 @@ export default {
496
610
  ele: 'slot',
497
611
  slot:'showPrice'
498
612
  },
613
+ this.isShowVipSet&&{
614
+ label: 'PLUS售价调整',
615
+ ele: 'title',
616
+ size: 'small',
617
+ },
618
+ this.isShowVipSet&&{
619
+ label: 'PLUS售价基于:',
620
+ ele: 'xd-select-list',
621
+ valueKey: 'vip_base',
622
+ value: params['vip_base'],
623
+ placeholder: '请选择调价基准类型',
624
+ multiple: false,
625
+ list: this.priceTypeList,
626
+ disabled: this.priceTypeList.length === 1,
627
+ className: 'input70',
628
+ rules: [{
629
+ required: true,
630
+ message: '请选择调价基准类型',
631
+ trigger: 'change'
632
+ }],
633
+ notice: '<span style="color:#000; font-size: 14px;">调整</span><span style="color:#f00; font-size: 14px;">PLUS售价</span>',
634
+ inline: true
635
+ },
636
+ this.isShowVipSet&&{
637
+ keys: Date.now(),
638
+ label: "",
639
+ ele: 'slot',
640
+ slot:'showVipSelectPrice'
641
+ },
642
+ this.isShowVipSet&&{
643
+ label: "",
644
+ ele: "xd-radio",
645
+ valueKey: "vip_unit",
646
+ value: params['vip_unit'] || 'money',
647
+ list: [
648
+ { "label": "按金额", "value": "money" },
649
+ { "label": "按比例", "value": "ratio" },
650
+ ],
651
+ },
652
+ this.isShowVipSet&&params.vip_unit==='ratio'&& {
653
+ label: "",
654
+ ele: 'slot',
655
+ slot:'vipDesire'
656
+ },
657
+ this.isShowVipSet&&params.vip_unit==='ratio' && {
658
+ label: '上调/下调:',
659
+ ele: 'xd-input-unit',
660
+ valueKey: 'vipRatioValue',
661
+ keys: Date.now(),
662
+ value: params['vipRatioValue'],
663
+ className:'input50',
664
+ setting: {
665
+ unit: params['vip_unit'] === 'money' ? '元' : '%',
666
+ pos: 'append',
667
+ type: 'number'
668
+ },
669
+ placeholder:{
670
+ unitPlaceholder:params['unit'] === 'money' ? '请输入金额' : '请输入比例',
671
+ },
672
+ rules: [
673
+ { required: true, message: params['unit'] === 'money' ? '请输入金额' : '请输入比例', trigger: 'blur' },
674
+ ],
675
+ notice: '可设置正负值,负值时为下调',
676
+ inline: false
677
+ },
678
+ this.isShowVipSet&&params.vip_unit==='money' && {
679
+ label: '上调/下调:',
680
+ ele: 'xd-input-unit',
681
+ valueKey: 'vipMoneyValue',
682
+ keys: Date.now(),
683
+ value: params['vipMoneyValue'],
684
+ setting: {
685
+ unit: params['vip_unit'] === 'money' ? '元' : '%',
686
+ pos: 'append',
687
+ type: 'number'
688
+ },
689
+ placeholder:{
690
+ unitPlaceholder:params['vip_unit'] === 'money' ? '请输入金额' : '请输入比例',
691
+ },
692
+ rules: [
693
+ { required: true, message: params['vip_unit'] === 'money' ? '请输入金额' : '请输入比例', trigger: 'blur' },
694
+ ],
695
+ notice: '可设置正负值,负值时为下调',
696
+ inline: false
697
+ },
698
+ this.isShowVipSet&&{
699
+ label: '小数点保留位数:',
700
+ ele: 'xd-select-list',
701
+ valueKey: 'vip_decimal',
702
+ className:'input50',
703
+ value: params.vip_decimal || 2,
704
+ placeholder: '请选择小数点保留位数',
705
+ multiple: false,
706
+ list: [
707
+ { "label": "零位", "value": -1 },
708
+ { "label": "一位", "value": 1 },
709
+ { "label": "两位", "value": 2 },
710
+ ],
711
+ rules: [{
712
+ required: true,
713
+ message: '请选择小数点保留位数',
714
+ trigger: 'change'
715
+ }],
716
+ },
717
+ this.isShowVipSet&&{
718
+ label: "调整后售价",
719
+ ele: 'slot',
720
+ slot:'showVipPrice'
721
+ },
499
722
  ].filter(i => i)
723
+ this.adjustListKey = Date.now()
500
724
  },
501
725
  /**设置期望售价**/
502
726
  handleSetDesire(){
@@ -506,6 +730,14 @@ export default {
506
730
  }
507
731
  this.showDesire = true
508
732
  },
733
+ /**设置VIP_PLUS期望售价**/
734
+ handleSetVipDesire(){
735
+ if(!this.adjustListValue['vip_base']){
736
+ this.$message.error('请选择基于类型')
737
+ return
738
+ }
739
+ this.showVipDesire = true
740
+ },
509
741
  /**设置期望售价确定**/
510
742
  handleDesire(){
511
743
  this.$refs['desireForm'].validate((valid) => {
@@ -525,24 +757,65 @@ export default {
525
757
  });
526
758
  // this.desireForm.price:''
527
759
  },
528
-
760
+ /**设置PLUS期望售价确定**/
761
+ handleVipDesire(){
762
+ this.$refs['desireVipForm'].validate((valid) => {
763
+ if (valid) {
764
+ if(!this.adjustListValue.vip_base || !this.desireVipForm.price) return false;
765
+ let unit = 'vipMoneyValue';
766
+ if(this.adjustListValue['vip_unit'] === 'ratio') unit = 'vipRatioValue';
767
+ let price = this.dialogRow['specs'][this.adjustListValue['vip_base']];
768
+ let value = this.$xdHelper.divisionFloatNumber( this.$xdHelper.multiplyFloatNumber(this.desireVipForm.price, 100) - price, price);
769
+ this.adjustListValue[vip_unit] = this.$xdHelper.multiplyFloatNumber(value, 100).toFixed(2);
770
+ this.getAdjustForm(this.adjustListValue);
771
+ this.adjustListKey = Date.now()
772
+ this.showVipDesire = false
773
+ } else {
774
+ return false;
775
+ }
776
+ });
777
+ // this.desireForm.price:''
778
+ },
529
779
  getAdjustParams () {
530
- const { product_id, unit, base,decimal,ratioValue, moneyValue} = this.adjustListValue;
780
+ const { product_id, unit, base,decimal,ratioValue, moneyValue,vip_unit, vip_base,vip_decimal,vipRatioValue, vipMoneyValue} = this.adjustListValue;
531
781
  let value = 0;
532
782
  if(unit === 'ratio') value = Number(ratioValue);
533
783
  if(unit === 'money') value = Number(moneyValue);
534
- debugger
535
- return {
536
- product_id,
537
- formula: {
538
- sale_price: {
539
- unit,
540
- base,
541
- value: this.$xdHelper.multiplyFloatNumber(Number(value), 100),
542
- decimal
784
+ let vip_value = 0;
785
+ if(vip_unit === 'ratio') vip_value = Number(vipRatioValue);
786
+ if(vip_unit === 'money') vip_value = Number(vipMoneyValue);
787
+ if(this.isShowVipSet){
788
+ return {
789
+ product_id,
790
+ formula: {
791
+ sale_price: {
792
+ unit,
793
+ base,
794
+ value: this.$xdHelper.multiplyFloatNumber(Number(value), 100),
795
+ decimal
796
+ },
797
+ vip_price:{
798
+ unit:vip_unit,
799
+ base:vip_base,
800
+ value: this.$xdHelper.multiplyFloatNumber(Number(vip_value), 100),
801
+ decimal:vip_decimal
802
+ }
803
+ }
804
+ }
805
+ }else{
806
+ return {
807
+ product_id,
808
+ formula: {
809
+ sale_price: {
810
+ unit,
811
+ base,
812
+ value: this.$xdHelper.multiplyFloatNumber(Number(value), 100),
813
+ decimal
814
+ },
543
815
  }
544
816
  }
545
817
  }
818
+
546
819
  },
547
820
 
548
821
  handleAdjustConfirm () {
@@ -705,7 +978,7 @@ export default {
705
978
  }
706
979
  </script>
707
980
 
708
- <style scoped>
981
+ <style scoped lang="scss">
709
982
  .show-price {
710
983
  box-sizing: border-box;
711
984
  margin: 5px 0;
@@ -95,6 +95,7 @@
95
95
  <script>
96
96
  import JfbRuleCreate from "./lib/JfbRuleCreate";
97
97
  import XdBaseDynamicField from "@/components/XdBaseDynamicField";
98
+ import checkPermission from "@/utils/permission"
98
99
  import {mapState} from 'vuex';
99
100
 
100
101
  export default {
@@ -232,6 +233,9 @@
232
233
  ...this.channelParams,
233
234
  agg_channel_code: this.channelActiveName
234
235
  }
236
+ },
237
+ isShowVipSet(){
238
+ return this.channelParams.group_key&&this.channelParams.group_key==='vip'
235
239
  }
236
240
  },
237
241
 
@@ -311,6 +315,14 @@
311
315
  formulaData['sale_price_value'] = this.$xdHelper.divisionFloatNumber(formula.sale_price.value, 100);
312
316
  formulaData['decimal'] = formula.sale_price.decimal;
313
317
  }
318
+ if(formula && formula.vip_price) {
319
+ // plus会员
320
+ formulaData['vip_price_base'] = formula.vip_price.base;
321
+ formulaData['vip_price_unit'] = formula.vip_price.unit;
322
+ formulaData['vip_price_no_high_market_price'] = formula.vip_price.no_high_market_price;
323
+ formulaData['vip_price_value'] = this.$xdHelper.divisionFloatNumber(formula.vip_price.value, 100);
324
+ formulaData['vip_price_decimal'] = formula.vip_price.decimal;
325
+ }
314
326
  // //按标签设置
315
327
  if (conditions.partner_product_tags !== undefined) {
316
328
  console.log('bbbbb')
@@ -368,6 +380,23 @@
368
380
  },
369
381
  sale_price_value: {
370
382
  "enabled": true,
383
+ },
384
+ vip_price_base: {
385
+ "enabled": true,
386
+ "options": [
387
+ {"label": "分销价", "value": 'dist_price'},
388
+ {"label": "市场价", "value": 'market_price'},
389
+ ]
390
+ },
391
+ vip_price_unit: {
392
+ "enabled": true,
393
+ "options": [
394
+ {"label": "按金额", "value": "money"},
395
+ {"label": "按比例", "value": "ratio"},
396
+ ]
397
+ },
398
+ vip_price_value: {
399
+ "enabled": true,
371
400
  }
372
401
  }
373
402
  }