|
@@ -8,10 +8,10 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="rate">
|
|
|
<el-col :span="24" class="tip"><span>关于长途运费:若是改成 他运且想根据设置的不同方式进行计算 需要重新生成订单,目前还无法处理这种情况</span></el-col>
|
|
|
- <el-col :span="6" class="rateMoney">税前应收:{{ detailList1.cost1 }}</el-col>
|
|
|
- <el-col :span="6" class="rateMoney">税后应收:{{ detailList1.cost2 }}</el-col>
|
|
|
- <el-col :span="6" class="rateMoney">税前实收:{{ detailList1.cost3 }}</el-col>
|
|
|
- <el-col :span="6" class="rateMoney">税后应收:{{ detailList1.cost4 }}</el-col>
|
|
|
+ <el-col :span="6" class="rateMoney">税前应收:{{ cost1 }}</el-col>
|
|
|
+ <el-col :span="6" class="rateMoney">税后应收:{{ cost2 }}</el-col>
|
|
|
+ <el-col :span="6" class="rateMoney">税前实收:{{ cost3 }}</el-col>
|
|
|
+ <el-col :span="6" class="rateMoney">税后应收:{{ cost4 }}</el-col>
|
|
|
</el-col>
|
|
|
<el-col :span="12" class="form">
|
|
|
<el-form ref="form" :model="detailForm" label-width="90px">
|
|
@@ -41,23 +41,36 @@
|
|
|
<el-col :span="17" class="list">
|
|
|
<el-tabs v-model="activeName">
|
|
|
<el-tab-pane label="货物列表" name="first">
|
|
|
- <data-table :fields="detailFields" :data="detailList" :usePage="false">
|
|
|
- <template #custom="{item}">
|
|
|
- <template v-if="item.model == 'rate'">
|
|
|
- <el-input-number v-model="item.rate" controls-position="right" @change="handleChange" :min="1" :max="10" size="mini"></el-input-number>
|
|
|
+ <el-table :data="detailList" border show-summary style="width: 100%">
|
|
|
+ <el-table-column prop="name" label="货物名称"> </el-table-column>
|
|
|
+ <el-table-column prop="way" label="计费方式">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-select v-model="scope.row.way" placeholder="请选择" @change="change">
|
|
|
+ <el-option v-for="item in wayoptions" :key="item.name" :label="item.name" :value="item.name"> </el-option>
|
|
|
+ </el-select>
|
|
|
</template>
|
|
|
- <template v-if="item.model == 'desc'">
|
|
|
- <el-input type="textarea" placeholder="请输入备注" v-model="item.desc"> </el-input>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="price" label="单价"> </el-table-column>
|
|
|
+ <el-table-column prop="rate" label="税率"> </el-table-column>
|
|
|
+ <el-table-column prop="num" label="数量"> </el-table-column>
|
|
|
+ <el-table-column prop="before" label="税前应收"> </el-table-column>
|
|
|
+ <el-table-column prop="after" label="税后应收"> </el-table-column>
|
|
|
+ <el-table-column prop="paidBefor" label="税前实收"> </el-table-column>
|
|
|
+ <el-table-column prop="paidAfter" label="税后实收"> </el-table-column>
|
|
|
+ <el-table-column prop="desc" label="备注">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input type="textarea" placeholder="请输入备注" v-model="scope.row.desc"> </el-input>
|
|
|
</template>
|
|
|
- </template> </data-table
|
|
|
- ></el-tab-pane>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
<el-tab-pane label="其他收费项" name="second">
|
|
|
<el-col :span="24" style="text-align:right;margin-bottom: 10px">
|
|
|
<el-button type="primary" @click="addGoods">添加收费项</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
- <el-table :data="listData" stripe border>
|
|
|
- <el-table-column align="center" label="收入项">
|
|
|
+ <el-table :data="listData" stripe border show-summary>
|
|
|
+ <el-table-column align="center" label="收入项" prop="income">
|
|
|
<template slot-scope="scope">
|
|
|
<el-select v-model="scope.row.income" placeholder="请选择">
|
|
|
<el-option v-for="item in options" :key="item.name" :label="item.name" :value="item.name"> </el-option>
|
|
@@ -66,32 +79,56 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="税率">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-select v-model="scope.row.rate" placeholder="请选择">
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.rate"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="
|
|
|
+ val => {
|
|
|
+ selectChange(val, scope.$index);
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >
|
|
|
<el-option v-for="item in rateList" :key="item.name" :label="item.name" :value="item.name"> </el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="税前应收">
|
|
|
+ <el-table-column align="center" label="税前应收" prop="before">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.before" placeholder="请输入税前应收"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.before"
|
|
|
+ placeholder="请输入税前应收"
|
|
|
+ @change="
|
|
|
+ val => {
|
|
|
+ inputChange(val, scope.$index);
|
|
|
+ }
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="税后应收">
|
|
|
+ <el-table-column align="center" label="税后应收" prop="after">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.after" placeholder="请输入税前应收" disabled></el-input>
|
|
|
+ <el-input v-model="scope.row.after" readonly></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="税前实收">
|
|
|
+ <el-table-column align="center" label="税前实收" prop="paidBefor">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.paidBefor" placeholder="请输入税前应收" disabled></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.paidBefor"
|
|
|
+ placeholder="请输入税前实收"
|
|
|
+ @change="
|
|
|
+ val => {
|
|
|
+ otherChange(val, scope.$index);
|
|
|
+ }
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="税后实收">
|
|
|
+ <el-table-column align="center" label="税后实收" prop="paidAfter">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.paidAfter" placeholder="请输入税前应收" disabled></el-input>
|
|
|
+ <el-input v-model="scope.row.paidAfter" readonly></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="备注">
|
|
|
+ <el-table-column align="center" label="备注" prop="desc">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input type="textarea" v-model="scope.row.desc" placeholder="请输入备注"></el-input>
|
|
|
</template>
|
|
@@ -105,6 +142,11 @@
|
|
|
</el-col>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" style="text-align:center;margin:40px 0px">
|
|
|
+ <el-button type="primary" size="mini" @click="save()">保存</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -122,13 +164,7 @@ export default {
|
|
|
components: {},
|
|
|
data: function() {
|
|
|
return {
|
|
|
- detailList1: {
|
|
|
- cost1: '200',
|
|
|
- cost2: '300',
|
|
|
- cost3: '400',
|
|
|
- cost4: '500',
|
|
|
- },
|
|
|
- detailForm: { name: '1111', number: '1234', contract: '合同一', route: '线路一', project: '项目一' },
|
|
|
+ detailForm: { name: '伟巴斯特(长春)车顶系统有限公司-北京天津线', number: '1234', contract: '合同一', route: '线路一', project: '项目一' },
|
|
|
//合同列表
|
|
|
contractList: [],
|
|
|
//项目列表
|
|
@@ -149,35 +185,190 @@ export default {
|
|
|
detailList: [
|
|
|
{
|
|
|
name: '1',
|
|
|
- way: '123',
|
|
|
- price: '111',
|
|
|
- before: '33',
|
|
|
- after: '3',
|
|
|
- paidBefor: '40',
|
|
|
- paidAfter: '50',
|
|
|
+ way: '整车-100',
|
|
|
+ price: '',
|
|
|
+ before: '',
|
|
|
+ after: '',
|
|
|
+ paidBefor: '',
|
|
|
+ paidAfter: '',
|
|
|
+ rate: 1.1,
|
|
|
+ num: 20,
|
|
|
},
|
|
|
],
|
|
|
activeName: 'first',
|
|
|
//收入项列表
|
|
|
options: [{ name: '保费' }, { name: '提送货费' }, { name: '运费' }],
|
|
|
//税率列表
|
|
|
- rateList: [{ name: '1' }, { name: '2' }],
|
|
|
+ rateList: [{ name: '1' }, { name: '1.1' }, { name: '2' }],
|
|
|
listData: [],
|
|
|
+ wayoptions: [{ name: '整车-100' }, { name: '零担-10' }],
|
|
|
+ cost1: 0,
|
|
|
+ cost2: 0,
|
|
|
+ cost3: 0,
|
|
|
+ cost4: 0,
|
|
|
};
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.change(this.detailList[0].way);
|
|
|
+ // this.all();
|
|
|
+ this.cost1 = this.detailList[0].before;
|
|
|
+ this.cost2 = this.detailList[0].after;
|
|
|
+ this.cost3 = this.detailList[0].paidBefor;
|
|
|
+ this.cost4 = this.detailList[0].paidAfter;
|
|
|
+ },
|
|
|
methods: {
|
|
|
handleChange(value) {
|
|
|
console.log(value);
|
|
|
},
|
|
|
+ //添加收費項目
|
|
|
addGoods() {
|
|
|
this.listData.push({});
|
|
|
},
|
|
|
+ //刪除
|
|
|
handleDelete(index, row) {
|
|
|
- if (index > -1) {
|
|
|
- this.listData.splice(index, 1);
|
|
|
+ if (index >= 0) {
|
|
|
+ this.cost1 = _.round(this.cost1 - Number(row.before), 2);
|
|
|
+ this.cost2 = _.round(this.cost2 - Number(row.after), 2);
|
|
|
+ this.cost3 = _.round(this.cost3 - Number(row.paidBefor), 2);
|
|
|
+ this.cost4 = _.round(this.cost4 - Number(row.paidAfter), 2);
|
|
|
+ if (index > -1) {
|
|
|
+ this.listData.splice(index, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //选择计费方式
|
|
|
+ change(data) {
|
|
|
+ const arr = _.split(data, '-', 2);
|
|
|
+ this.detailList[0].price = Number(arr[arr.length - 1]);
|
|
|
+ if (arr.indexOf('整车') != -1) {
|
|
|
+ this.detailList[0].num = 1;
|
|
|
+ } else {
|
|
|
+ this.detailList[0].num = 9;
|
|
|
+ }
|
|
|
+ this.computRate(this.detailList[0].price, this.detailList[0].num);
|
|
|
+ },
|
|
|
+ //計算价格
|
|
|
+ computRate(price, num) {
|
|
|
+ const listData = this.detailList[0];
|
|
|
+ if (Number(listData.rate) != 0) {
|
|
|
+ listData.before = price * num;
|
|
|
+ listData.paidBefor = price * num;
|
|
|
+ listData.after = _.round(listData.rate * listData.before);
|
|
|
+ listData.paidAfter = _.round(listData.rate * listData.paidBefor);
|
|
|
+ } else {
|
|
|
+ listData.before = price * num;
|
|
|
+ listData.paidBefor = price * num;
|
|
|
+ listData.after = '0';
|
|
|
+ listData.paidAfter = '0';
|
|
|
+ }
|
|
|
+ this.cost1 = listData.before;
|
|
|
+ this.cost2 = listData.after;
|
|
|
+ this.cost3 = listData.paidBefor;
|
|
|
+ this.cost4 = listData.paidAfter;
|
|
|
+ },
|
|
|
+ //税前应收
|
|
|
+ inputChange(val, index) {
|
|
|
+ const rateList = this.listData[index];
|
|
|
+ if (rateList.rate && rateList.before) {
|
|
|
+ const after1 = _.round(Number(val) * rateList.rate, 2);
|
|
|
+ this.$set(rateList, `after`, after1);
|
|
|
+ this.$set(rateList, `paidBefor`, Number(val));
|
|
|
+ this.$set(rateList, `paidAfter`, after1);
|
|
|
+ //当只建立一条数据的时候
|
|
|
+ if (this.listData.length == 1) {
|
|
|
+ if (this.cost1 == this.detailList[0].before) {
|
|
|
+ console.log('jianli1');
|
|
|
+ this.cost1 += Number(rateList.before);
|
|
|
+ this.cost2 += Number(rateList.after);
|
|
|
+ this.cost3 += Number(rateList.paidBefor);
|
|
|
+ this.cost4 += Number(rateList.paidAfter);
|
|
|
+ } else {
|
|
|
+ console.log('不是一地辞了');
|
|
|
+ this.cost1 = _.round(this.detailList[0].before + Number(rateList.before), 2);
|
|
|
+ this.cost2 = _.round(this.detailList[0].after + rateList.after, 2);
|
|
|
+ this.cost3 = _.round(this.detailList[0].paidBefor + rateList.paidBefor, 2);
|
|
|
+ this.cost4 = _.round(this.detailList[0].paidAfter + rateList.paidAfter, 2);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //建立多条数据的时候
|
|
|
+ let num1 = this.detailList[0].before;
|
|
|
+ let num2 = this.detailList[0].after;
|
|
|
+ let num3 = this.detailList[0].paidBefor;
|
|
|
+ let num4 = this.detailList[0].paidAfter;
|
|
|
+ //判断是否有建立数据但是没有填写内容的
|
|
|
+ for (let item of this.listData) {
|
|
|
+ // let arr = Object.keys(item);
|
|
|
+ if (item.before) {
|
|
|
+ num1 = _.round(num1 + Number(item.before), 2);
|
|
|
+ num2 = _.round(num2 + Number(item.after), 2);
|
|
|
+ num3 = _.round(num3 + Number(item.paidBefor), 2);
|
|
|
+ num4 = _.round(num4 + Number(item.paidAfter), 2);
|
|
|
+ } else {
|
|
|
+ // item.before = '';
|
|
|
+ // item.after = '';
|
|
|
+ // item.paidBefor = '';
|
|
|
+ // item.paidAfter = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.cost1 = num1;
|
|
|
+ this.cost2 = num2;
|
|
|
+ this.cost3 = num3;
|
|
|
+ this.cost4 = num4;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //税前实收
|
|
|
+ otherChange(val, index) {
|
|
|
+ const rateList = this.listData[index];
|
|
|
+ if (rateList.rate != 0) {
|
|
|
+ const paidAfter1 = _.round(Number(val) * rateList.rate, 2);
|
|
|
+ this.$set(rateList, `paidAfter`, paidAfter1);
|
|
|
+ if (this.listData.length == 1) {
|
|
|
+ this.cost3 = _.round(this.detailList[0].paidBefor + Number(rateList.paidBefor), 2);
|
|
|
+ this.cost4 = _.round(this.detailList[0].paidAfter + rateList.paidAfter, 2);
|
|
|
+ } else {
|
|
|
+ //建立多条数据的时候
|
|
|
+ let num3 = this.detailList[0].paidBefor;
|
|
|
+ let num4 = this.detailList[0].paidAfter;
|
|
|
+ for (let item of this.listData) {
|
|
|
+ num3 = _.round(num3 + Number(item.paidBefor), 2);
|
|
|
+ num4 = _.round(num4 + Number(item.paidAfter), 2);
|
|
|
+ }
|
|
|
+ this.cost3 = num3;
|
|
|
+ this.cost4 = num4;
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
+ //选择税率
|
|
|
+ selectChange(val, index) {
|
|
|
+ const rateList = this.listData[index];
|
|
|
+ if (rateList.rate && rateList.before) {
|
|
|
+ const data = _.round(Number(val) * rateList.before, 2);
|
|
|
+ this.$set(rateList, `after`, data);
|
|
|
+ const data1 = _.round(Number(val) * rateList.paidBefor, 2);
|
|
|
+ this.$set(rateList, `paidAfter`, data1);
|
|
|
+ if (this.listData.length == 1) {
|
|
|
+ this.cost2 = rateList.after + this.detailList[0].after;
|
|
|
+ this.cost4 = rateList.paidAfter + this.detailList[0].paidAfter;
|
|
|
+ } else {
|
|
|
+ //建立多条数据的时候
|
|
|
+ let num2 = this.detailList[0].after;
|
|
|
+ let num4 = this.detailList[0].paidAfter;
|
|
|
+ for (let item of this.listData) {
|
|
|
+ console.log(item);
|
|
|
+ num2 = _.round(num2 + Number(item.after), 2);
|
|
|
+ num4 = _.round(num4 + Number(item.paidAfter), 2);
|
|
|
+ }
|
|
|
+ this.cost2 = num2;
|
|
|
+ this.cost4 = num4;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //保存
|
|
|
+ save() {
|
|
|
+ console.log('保存');
|
|
|
+ console.log(this.listData);
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
@@ -228,4 +419,7 @@ export default {
|
|
|
/deep/.el-input--mini {
|
|
|
width: 81px;
|
|
|
}
|
|
|
+/deep/.el-table .cell {
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
</style>
|