jufubao-admin-library 1.1.2 → 1.1.4

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,6 +40,18 @@
40
40
  <el-button type="primary" size="small" @click="handleSetDesire">设置期望售价</el-button>
41
41
  </el-form-item>
42
42
  </template>
43
+ <template slot="showPrice">
44
+ <div class="show-price">
45
+ <div>调整后售价:</div>
46
+ <div><el-input class="input50" type="number" v-model="showPrice" disabled></el-input></div>
47
+ </div>
48
+ </template>
49
+ <template slot="showSelectPrice">
50
+ <div class="show-price">
51
+ <div>调整原始价格:</div>
52
+ <div><el-input class="input50" type="number" v-model="showSelectPrice" disabled></el-input></div>
53
+ </div>
54
+ </template>
43
55
  </xd-base-dynamic-field>
44
56
  <xd-dialog
45
57
  v-if="showDesire"
@@ -52,7 +64,7 @@
52
64
  <el-form ref="desireForm" :model="desireForm" :rules="rules" label-width="80px">
53
65
  <el-form-item prop="price" label="期望售价">
54
66
  <el-input v-model="desireForm.price" placeholder="请输入期望售价"></el-input>
55
- <span style="color:'#999';font-size:12px;line-height:20px;display:block">将根据期望售价和选择的基准价格自动计算上调比除不尽时自动进位,故实际售价与期望值会略有偏差</span>
67
+ <span style="color:#999;font-size:12px;line-height:20px;display:block">将根据期望售价和选择的基准价格自动计算上调比除不尽时自动进位,故实际售价与期望值会略有偏差</span>
56
68
  </el-form-item>
57
69
  </el-form>
58
70
  </div>
@@ -61,7 +73,7 @@
61
73
  <xd-dialog
62
74
  v-if="showPublicSet"
63
75
  :show.sync="showPublicSet"
64
- title="商品配置"
76
+ title="商品配置"
65
77
  width="460px"
66
78
  @onConfirm="handlePublicSet"
67
79
  >
@@ -77,7 +89,7 @@
77
89
  </el-radio-group>
78
90
  </el-form-item>
79
91
  <el-form-item prop="partner_product_tags" label="商品标签">
80
- <el-checkbox-group
92
+ <el-checkbox-group
81
93
  v-model="setForm.partner_product_tags"
82
94
  >
83
95
  <el-checkbox v-for="(item,index) in tagData" :label="item.value" :key="index">{{item.label}}</el-checkbox>
@@ -122,7 +134,7 @@ export default {
122
134
  watch: {
123
135
  'adjustListValue.unit' (value) {
124
136
  this.getAdjustForm(this.adjustListValue)
125
- }
137
+ },
126
138
  },
127
139
  data () {
128
140
  return {
@@ -186,29 +198,49 @@ export default {
186
198
  },
187
199
  computed: {
188
200
  ...mapState(['commonParams']),
189
- },
190
- watch:{
191
- 'adjustListValue.unit': {
192
- handler (n, o) {
193
- console.log(n, o, 'nnnn')
194
- this.adjustListValue.after_price = ''
195
- this.adjustListValue.value = ''
196
- this.getAdjustForm(this.adjustListValue)
197
- }
198
- },
199
- 'adjustListValue.value':{
200
- handler (n, o) {
201
- console.log(n, o,this.dialogRow['specs'][this.adjustListValue['base']], 'nnnn')
202
- if(this.adjustListValue.unit==='money'){
203
- this.adjustListValue.after_price = this.$xdHelper.divisionFloatNumber(this.dialogRow['specs'][this.adjustListValue['base']], 100)+Number(n);
204
- this.getAdjustForm(this.adjustListValue)
201
+ showPrice(){
202
+ const handle = (price, value, type)=>{
203
+ console.warn(`adjustList:{price:${price},value:${value},type:${type}`);
204
+ let toFixed = 0;
205
+ if(this.adjustListValue.decimal > 0) toFixed = this.adjustListValue.decimal;
206
+ let temp = 0;
207
+ if(type) {
208
+ value = this.$xdHelper.multiplyFloatNumber(value, 100);
209
+ temp = this.$xdHelper.addFloatNumber(value, price)
210
+ } else {
211
+ value = this.$xdHelper.addFloatNumber(this.$xdHelper.divisionFloatNumber(value, 100), 1);
212
+ temp = this.$xdHelper.multiplyFloatNumber(value, price)
205
213
  }
214
+ return this.$xdHelper.divisionFloatNumber(temp, 100).toFixed(toFixed)
215
+ };
216
+
217
+ if(!this.adjustListValue.base
218
+ || !this.adjustListValue.unit
219
+ ) return '';
220
+ if(!this.dialogRow['specs'][this.adjustListValue.base]) return '';
221
+ let value = null;
222
+ if(this.adjustListValue.unit === 'money') {
223
+ if(this.adjustListValue.moneyValue) value = Number(this.adjustListValue.moneyValue);
206
224
  }
225
+ if(this.adjustListValue.unit === 'ratio') {
226
+ if(this.adjustListValue.ratioValue) value = Number(this.adjustListValue.ratioValue);
227
+ }
228
+ if(value === null) return '';
229
+
230
+ let price = this.dialogRow['specs'][this.adjustListValue.base];
231
+ return handle(price,value, this.adjustListValue.unit === 'money');
207
232
  },
233
+
234
+ showSelectPrice(){
235
+ if(!this.adjustListValue.base) return '';
236
+ let price = this.dialogRow['specs'][this.adjustListValue.base];
237
+ return this.$xdHelper.divisionFloatNumber(price, 100)
238
+ }
208
239
  },
209
- async created () {
210
240
 
211
- console.log('created', this.dialogRow, this.dialogType)
241
+ async created () {
242
+ console.warn(`created.dialogRow:${JSON.stringify(this.dialogRow)}`)
243
+ console.warn(`created.dialogType:${this.dialogType}`);
212
244
  this.cookieKey = `${this.commonParams.xsiteid}.${this.commonParams.xnamespace}.${this.pagesType}.channel`
213
245
  //开启电子码查看
214
246
  if (this.dialogType === 'showCode') {
@@ -226,20 +258,20 @@ export default {
226
258
 
227
259
  //手动调整售价
228
260
  if (this.dialogType === 'showAdjust') {
229
- let { id, product_id, product_name } = this.dialogRow
230
- product_id = product_id || id
231
- let info = await this.getOnePriceInfo({ product_id })
232
- this.priceTypeList = info.data['price_options']
233
- let params = info.data['formula']['price']
261
+ let { id, product_id, product_name } = this.dialogRow;
262
+ product_id = product_id || id;
263
+ let info = await this.getOnePriceInfo({ product_id });
264
+ this.priceTypeList = info.data['price_options'];
265
+ let params = info.data['formula']['price'];
234
266
  params = {
235
267
  ...params,
236
268
  product_id, product_name,
237
269
  modifyprice_method_name: info.data['modifyprice_method_name'],
238
270
  value: this.$xdHelper.divisionFloatNumber(params['value'], 100)
239
- }
240
- this.getAdjustForm(params)
241
- this.adjustStatus = true
242
- this.showAdjust = true
271
+ };
272
+ this.getAdjustForm(params);
273
+ this.adjustStatus = true;
274
+ this.showAdjust = true;
243
275
  }
244
276
  //是否公开配置
245
277
  if (this.dialogType === 'showSet') {
@@ -322,7 +354,12 @@ export default {
322
354
  })
323
355
  },
324
356
 
357
+
358
+
325
359
  //==调价==============================
360
+ getShowPrice(){
361
+
362
+ },
326
363
  getAdjustForm (params) {
327
364
  this.adjustListForm = [
328
365
  params['modifyprice_method_name'] && {
@@ -365,11 +402,17 @@ export default {
365
402
  rules: [{
366
403
  required: true,
367
404
  message: '请选择调价基准类型',
368
- trigger: 'blur'
405
+ trigger: 'change'
369
406
  }],
370
407
  notice: '<span style="color:#000; font-size: 14px;">调整</span><span style="color:#f00; font-size: 14px;">售价</span>',
371
408
  inline: true
372
409
  },
410
+ {
411
+ keys: Date.now(),
412
+ label: "",
413
+ ele: 'slot',
414
+ slot:'showSelectPrice'
415
+ },
373
416
  {
374
417
  label: "",
375
418
  ele: "xd-radio",
@@ -380,16 +423,38 @@ export default {
380
423
  { "label": "按比例", "value": "ratio" },
381
424
  ],
382
425
  },
383
- params.unit==='ratio'&&{
426
+ params.unit==='ratio'&& {
384
427
  label: "",
385
428
  ele: 'slot',
386
429
  slot:'desire'
387
430
  },
388
- {
431
+ params.unit==='ratio' && {
389
432
  label: '上调/下调:',
390
433
  ele: 'xd-input-unit',
391
- valueKey: 'value',
392
- value: params['value'],
434
+ valueKey: 'ratioValue',
435
+ keys: Date.now(),
436
+ value: params['ratioValue'],
437
+ className:'input50',
438
+ setting: {
439
+ unit: params['unit'] === 'money' ? '元' : '%',
440
+ pos: 'append',
441
+ type: 'number'
442
+ },
443
+ placeholder:{
444
+ unitPlaceholder:params['unit'] === 'money' ? '请输入金额' : '请输入比例',
445
+ },
446
+ rules: [
447
+ { required: true, message: params['unit'] === 'money' ? '请输入金额' : '请输入比例', trigger: 'blur' },
448
+ ],
449
+ notice: '可设置正负值,负值时为下调',
450
+ inline: false
451
+ },
452
+ params.unit==='money' && {
453
+ label: '上调/下调:',
454
+ ele: 'xd-input-unit',
455
+ valueKey: 'moneyValue',
456
+ keys: Date.now(),
457
+ value: params['moneyValue'],
393
458
  setting: {
394
459
  unit: params['unit'] === 'money' ? '元' : '%',
395
460
  pos: 'append',
@@ -408,7 +473,7 @@ export default {
408
473
  label: '小数点保留位数:',
409
474
  ele: 'xd-select-list',
410
475
  valueKey: 'decimal',
411
- className:'input60',
476
+ className:'input50',
412
477
  value: params.decimal || 2,
413
478
  placeholder: '请选择小数点保留位数',
414
479
  multiple: false,
@@ -420,20 +485,15 @@ export default {
420
485
  rules: [{
421
486
  required: true,
422
487
  message: '请选择小数点保留位数',
423
- trigger: 'blur'
488
+ trigger: 'change'
424
489
  }],
425
490
  },
426
491
  {
427
- label: '调整后售价:',
428
- ele: 'el-input',
429
- type: 'text',
430
- valueKey: 'after_price',
431
- value: params.after_price,
432
- className: 'input90',
433
- disabled: true
492
+ label: "调整后售价",
493
+ ele: 'slot',
494
+ slot:'showPrice'
434
495
  },
435
496
  ].filter(i => i)
436
- this.adjustListKey = Date.now()
437
497
  },
438
498
  /**设置期望售价**/
439
499
  handleSetDesire(){
@@ -447,14 +507,16 @@ export default {
447
507
  handleDesire(){
448
508
  this.$refs['desireForm'].validate((valid) => {
449
509
  if (valid) {
450
- let value =this.$xdHelper.divisionFloatNumber(this.$xdHelper.multiplyFloatNumber(this.desireForm.price, 100)-this.dialogRow['specs'][this.adjustListValue['base']], this.dialogRow['specs'][this.adjustListValue['base']]);
451
- this.adjustListValue.value = this.$xdHelper.multiplyFloatNumber(value, 100).toFixed(2)
452
- console.log(value,this.adjustListValue.value,'this.adjustListValue.value')
453
- this.adjustListValue.after_price = this.desireForm.price
454
- this.getAdjustForm(this.adjustListValue)
510
+ if(!this.adjustListValue.base || !this.desireForm.price) return false;
511
+ let unit = 'moneyValue';
512
+ if(this.adjustListValue['unit'] === 'ratio') unit = 'ratioValue';
513
+ let price = this.dialogRow['specs'][this.adjustListValue['base']];
514
+ let value = this.$xdHelper.divisionFloatNumber( this.$xdHelper.multiplyFloatNumber(this.desireForm.price, 100) - price, price);
515
+ this.adjustListValue[unit] = this.$xdHelper.multiplyFloatNumber(value, 100).toFixed(2);
516
+ this.getAdjustForm(this.adjustListValue);
517
+ this.adjustListKey = Date.now()
455
518
  this.showDesire = false
456
519
  } else {
457
- console.log('error submit!!');
458
520
  return false;
459
521
  }
460
522
  });
@@ -462,7 +524,11 @@ export default {
462
524
  },
463
525
 
464
526
  getAdjustParams () {
465
- const { product_id, unit, base, value,decimal } = this.adjustListValue
527
+ const { product_id, unit, base,decimal,ratioValue, moneyValue} = this.adjustListValue;
528
+ let value = 0;
529
+ if(unit === 'ratio') value = Number(ratioValue);
530
+ if(unit === 'money') value = Number(moneyValue);
531
+ debugger
466
532
  return {
467
533
  product_id,
468
534
  formula: {
@@ -637,4 +703,25 @@ export default {
637
703
  </script>
638
704
 
639
705
  <style scoped>
706
+ .show-price {
707
+ box-sizing: border-box;
708
+ margin: 5px 0;
709
+ display: flex;
710
+ justify-content: flex-start;
711
+ align-items: center;
712
+ height: 36px;
713
+ line-height: 36px;
714
+
715
+ & > div:first-child {
716
+ width: 130px;
717
+ flex-shrink: 0;
718
+ font-weight: 500;
719
+ color: #666;
720
+ text-align: right;
721
+ }
722
+
723
+ & > div:last-child {
724
+ flex: 1;
725
+ }
726
+ }
640
727
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-admin-library",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "聚福宝福利后台管理系统公共模块",
5
5
  "author": "goashiyong <gaoshiyong1272@vip.163.com>",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "element-ui": "2.13.2",
27
27
  "gxd-file-preview": "1.2.1",
28
28
  "gxd-helper": "2.0.21",
29
- "gxd-vue-library": "1.1.68",
29
+ "gxd-vue-library": "1.1.69",
30
30
  "js-base64": "^3.4.5",
31
31
  "js-cookie": "2.2.0",
32
32
  "md5": "^2.3.0",