|
@@ -55,6 +55,7 @@ export default {
|
|
|
infoFields: [
|
|
|
{ label: '商品名称', model: 'goods', custom: true },
|
|
|
{ label: '商品规格', model: 'spec', type: 'select' },
|
|
|
+ { label: '团长价', model: 'leader_price', type: 'text' },
|
|
|
{ label: '团购价', model: 'price', type: 'number' },
|
|
|
{ label: '团长提成金额', model: 'leader_get', type: 'number' },
|
|
|
{ label: '运费', model: 'freight', type: 'number' },
|
|
@@ -100,7 +101,12 @@ export default {
|
|
|
if (this.$checkRes(arr)) this.goodsList.push(arr.data);
|
|
|
// 规格
|
|
|
let aee = await this.specFetch(res.data.spec);
|
|
|
- if (this.$checkRes(aee)) this.specList.push(aee.data);
|
|
|
+ if (this.$checkRes(aee)) {
|
|
|
+ this.specList.push(aee.data);
|
|
|
+ if (!_.get(res, 'data.leader_price')) {
|
|
|
+ res.data.leader_price = _.get(aee, 'data.leader_price', _.get(aee, 'data.sell_money'));
|
|
|
+ }
|
|
|
+ }
|
|
|
this.$set(this, `form`, res.data);
|
|
|
}
|
|
|
} else {
|
|
@@ -130,12 +136,13 @@ export default {
|
|
|
if (info && info.buy_limit) this.$set(this.form, 'buy_limit', info.buy_limit);
|
|
|
if (info && info.limit_num) this.$set(this.form, 'limit_num', info.limit_num);
|
|
|
}
|
|
|
- if (this.leader_price && this.form.price) {
|
|
|
- let price = util.minus(this.form.price, this.leader_price);
|
|
|
+ if (model === 'price') {
|
|
|
+ const spec = this.specList.find((f) => f._id === this.form.spec);
|
|
|
+ if (!spec) return;
|
|
|
+ const leader_price = _.get(spec, 'leader_price');
|
|
|
+ let price = util.minus(this.form.price, leader_price);
|
|
|
if (price > 0) this.$set(this.form, 'leader_get', price);
|
|
|
else this.$set(this.form, 'leader_get', 0);
|
|
|
- } else if (!this.leader_price && this.form.price) {
|
|
|
- this.$set(this.form, 'leader_get', 0);
|
|
|
}
|
|
|
},
|
|
|
// 保存
|