|
|
@@ -154,18 +154,18 @@
|
|
|
<el-row :gutter="24" type="flex" justify="left">
|
|
|
<el-col :span="5">
|
|
|
<el-form-item size="small" label="数量">
|
|
|
- <el-input type="number" v-model="form.printQty" placeholder="数量" style="width: 53%"></el-input>
|
|
|
+ <el-input type="number" v-model="form.printQty" placeholder="数量" style="width: 53%" @input="calculatePrintMoneyTotal"></el-input>
|
|
|
<el-input v-model="form.printQtyUnit" placeholder="单位" style="width: 20%"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="3">
|
|
|
<el-form-item size="small" label="单价">
|
|
|
- <el-input type="number" v-model="form.printPrice"></el-input>
|
|
|
+ <el-input type="number" v-model="form.printPrice" @input="calculatePrintMoneyTotal"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="3">
|
|
|
<el-form-item size="small" label="总金额">
|
|
|
- <el-input type="number" v-model="form.printMoneyTotal"></el-input>
|
|
|
+ <el-input type="number" v-model="form.printMoneyTotal" @input="calculatePrintPrice"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="3">
|
|
|
@@ -249,22 +249,22 @@
|
|
|
<el-row :gutter="24" type="flex">
|
|
|
<el-col :span="4">
|
|
|
<el-form-item size="small" label="数量">
|
|
|
- <el-input type="number" v-model="form.outQty"></el-input>
|
|
|
+ <el-input type="number" v-model="form.outQty" @input="calculateOutMoneyTotal"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="4">
|
|
|
<el-form-item size="small" label="单价">
|
|
|
- <el-input type="number" v-model="form.outPrice"></el-input>
|
|
|
+ <el-input type="number" v-model="form.outPrice" @input="calculateOutMoneyTotal"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="4">
|
|
|
<el-form-item size="small" label="金额">
|
|
|
- <el-input type="number" style="width: 145%" v-model="form.outMoneyTotal"></el-input>
|
|
|
+ <el-input type="number" style="width: 145%" v-model="form.outMoneyTotal" @input="calculateOutPrice"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="4">
|
|
|
<el-form-item size="small" label="运费">
|
|
|
- <el-input type="number" v-model="form.outSendMoney"></el-input>
|
|
|
+ <el-input type="number" v-model="form.outSendMoney" @input="calculateOrderGrossProfitRate"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="4">
|
|
|
@@ -300,19 +300,21 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row :gutter="2" type="flex" justify="left">
|
|
|
- <el-col :span="5">
|
|
|
+ <el-col :span="4">
|
|
|
<el-form-item size="small" label="合计成本">
|
|
|
- <el-input type="number" v-model="form.orderCost"></el-input>
|
|
|
+ <el-input type="number" v-model="form.orderCost" @input="calculateOrderGrossProfitRate"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="5">
|
|
|
+ <el-col :span="4">
|
|
|
<el-form-item size="small" label="毛利">
|
|
|
- <el-input type="number" v-model="form.orderGrossProfit"></el-input>
|
|
|
+ <el-input type="number" :disabled="true" v-model="form.orderGrossProfit"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="5">
|
|
|
- <el-form-item size="small" label="毛利率(%)">
|
|
|
- <el-input type="number" v-model="form.orderGrossProfitRate"></el-input>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item size="small" label="毛利率">
|
|
|
+ <el-input type="number" :disabled="true" v-model="form.orderGrossProfitRate">
|
|
|
+ <template slot="append">%</template>
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -585,13 +587,72 @@ export default {
|
|
|
var reg = /^((?!0)\d{1,2}|100)$/;
|
|
|
if (!elValue.match(reg)) {
|
|
|
elValue = '';
|
|
|
- console.log('b')
|
|
|
return false;
|
|
|
} else {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
},
|
|
|
+ calculatePrintMoneyTotal() {
|
|
|
+ const _that = this;
|
|
|
+ let printQty = _that.form.printQty;
|
|
|
+ let printPrice = _that.form.printPrice;
|
|
|
+ let printMoneyTotal = 0;
|
|
|
+ if (printQty === null || printPrice === null ||printQty === '' || printPrice === '') {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ printMoneyTotal = printQty * printPrice;
|
|
|
+ _that.form.printMoneyTotal = printMoneyTotal.toFixed(2);
|
|
|
+ if (_that.form.printMoneyTotal <= 0 ) {
|
|
|
+ this.$message.warning('请注意,订单总金额是0');
|
|
|
+ }
|
|
|
+ _that.calculateOrderGrossProfitRate();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ calculatePrintPrice() {
|
|
|
+ const _that = this;
|
|
|
+ let printQty = _that.form.printQty;
|
|
|
+ let printPrice = 0;
|
|
|
+ printPrice = _that.form.printMoneyTotal / printQty;
|
|
|
+ _that.form.printPrice = printPrice.toFixed(2);
|
|
|
+ _that.calculateOrderGrossProfitRate();
|
|
|
+ },
|
|
|
+ calculateOutMoneyTotal() {
|
|
|
+ const _that = this;
|
|
|
+ let outQty = _that.form.outQty;
|
|
|
+ let outPrice = _that.form.outPrice;
|
|
|
+ if (outQty === null || outPrice === null ||outQty === '' || outPrice === '') {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ _that.form.outMoneyTotal = (outQty * outPrice).toFixed(2);
|
|
|
+ if (_that.form.outMoneyTotal <= 0 ) {
|
|
|
+ this.$message.warning('请注意,外协费用是0');
|
|
|
+ }
|
|
|
+ _that.calculateOrderGrossProfitRate();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ calculateOutPrice() {
|
|
|
+ const _that = this;
|
|
|
+ let outQty = _that.form.outQty;
|
|
|
+ let outPrice = 0;
|
|
|
+ outPrice = _that.form.outMoneyTotal / outQty;
|
|
|
+ _that.form.outPrice = outPrice.toFixed(2);
|
|
|
+ _that.calculateOrderGrossProfitRate();
|
|
|
+ },
|
|
|
+ calculateOrderGrossProfitRate() {
|
|
|
+ const _that = this;
|
|
|
+ let outSendMoney = _that.form.outSendMoney;
|
|
|
+ let orderGrossProfitRate = '';
|
|
|
+ if (_that.form.printMoneyTotal === null || _that.form.printMoneyTotal === '' || _that.form.outMoneyTotal ===null || _that.form.outMoneyTotal ==='') {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ _that.form.orderGrossProfit = _that.form.printMoneyTotal - _that.form.outMoneyTotal - outSendMoney;
|
|
|
+ orderGrossProfitRate = _that.form.orderGrossProfit / _that.form.printMoneyTotal;
|
|
|
+ orderGrossProfitRate = orderGrossProfitRate.toFixed(2);
|
|
|
+ orderGrossProfitRate = (orderGrossProfitRate * 100).toFixed(0);
|
|
|
+ _that.form.orderGrossProfitRate = orderGrossProfitRate;
|
|
|
+ }
|
|
|
+ },
|
|
|
chooseClient(data) {
|
|
|
this.createInnerVisible = false
|
|
|
// console.log(data);
|