|
@@ -3,7 +3,7 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="detail">
|
|
|
<el-col :span="24" class="top">
|
|
|
- <el-button size="mini" type="primary" @click="$router.go(-1)">返回</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="toReturn">返回</el-button>
|
|
|
<span>收入详情</span>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="rate">
|
|
@@ -16,24 +16,24 @@
|
|
|
<el-col :span="12" class="form">
|
|
|
<el-form ref="form" :model="detailForm" label-width="90px">
|
|
|
<el-form-item label="订单">
|
|
|
- {{ detailForm.number }}
|
|
|
+ {{ detailForm.order_no }}
|
|
|
</el-form-item>
|
|
|
<el-form-item label="客户">
|
|
|
- {{ detailForm.name }}
|
|
|
+ {{ name }}
|
|
|
</el-form-item>
|
|
|
<el-form-item label="合同">
|
|
|
- <el-select v-model="detailForm.contract" placeholder="请选择合同">
|
|
|
- <el-option v-for="(item, index) in contractList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
+ <el-select v-model="detailForm.treaty" placeholder="请选择合同" @change="treayChange">
|
|
|
+ <el-option v-for="(item, index) in contractList" :key="index" :label="item.number" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="项目">
|
|
|
- <el-select v-model="detailForm.project" placeholder="请选择合同">
|
|
|
- <el-option v-for="(item, index) in projectList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
+ <el-select v-model="detailForm.item" placeholder="请选择项目" @change="projectChange">
|
|
|
+ <el-option v-for="(item, index) in projectList" :key="index" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="项目线路">
|
|
|
- <el-select v-model="detailForm.route" placeholder="请选择合同">
|
|
|
- <el-option v-for="(item, index) in routeList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
+ <el-select v-model="detailForm.route" placeholder="请选择线路" @change="routeChange">
|
|
|
+ <el-option v-for="(item, index) in routeList" :key="index" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -41,25 +41,37 @@
|
|
|
<el-col :span="17" class="list">
|
|
|
<el-tabs v-model="activeName">
|
|
|
<el-tab-pane label="货物列表" name="first">
|
|
|
- <el-table :data="detailList" border show-summary style="width: 100%">
|
|
|
+ <el-table :data="detailForm.goods" border show-summary style="width: 100%">
|
|
|
<el-table-column prop="name" label="货物名称"> </el-table-column>
|
|
|
- <el-table-column prop="way" label="计费方式">
|
|
|
+ <el-table-column prop="mode" 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
|
|
|
+ v-model="scope.row.mode"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="
|
|
|
+ val => {
|
|
|
+ change(val, scope.$index);
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-option v-for="(item, index) in wayList" :key="index" :label="item.hh" :value="item.id"> </el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="taxes" label="税率"
|
|
|
+ ><template slot-scope="scope">
|
|
|
+ {{ scope.row.taxes }}
|
|
|
+ </template>
|
|
|
+ </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="备注">
|
|
|
+ <el-table-column prop="cvalue" label="数量"> </el-table-column>
|
|
|
+ <el-table-column prop="sq_ys" label="税前应收"> </el-table-column>
|
|
|
+ <el-table-column prop="sh_ys" label="税后应收"> </el-table-column>
|
|
|
+ <el-table-column prop="sq_ss" label="税前实收"> </el-table-column>
|
|
|
+ <el-table-column prop="sh_ss" label="税后实收"> </el-table-column>
|
|
|
+ <el-table-column align="center" label="备注" prop="remark">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input type="textarea" placeholder="请输入备注" v-model="scope.row.desc"> </el-input>
|
|
|
+ <el-input type="textarea" v-model="scope.row.remark" placeholder="请输入备注"></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -69,18 +81,18 @@
|
|
|
<el-button type="primary" @click="addGoods">添加收费项</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
- <el-table :data="listData" stripe border show-summary>
|
|
|
- <el-table-column align="center" label="收入项" prop="income">
|
|
|
+ <el-table :data="detailForm.in_bill" stripe border show-summary>
|
|
|
+ <el-table-column align="center" label="收入项" prop="item">
|
|
|
<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>
|
|
|
+ <el-select v-model="scope.row.item" placeholder="请选择">
|
|
|
+ <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="税率">
|
|
|
<template slot-scope="scope">
|
|
|
<el-select
|
|
|
- v-model="scope.row.rate"
|
|
|
+ v-model="scope.row.taxes"
|
|
|
placeholder="请选择"
|
|
|
@change="
|
|
|
val => {
|
|
@@ -88,14 +100,14 @@
|
|
|
}
|
|
|
"
|
|
|
>
|
|
|
- <el-option v-for="item in rateList" :key="item.name" :label="item.name" :value="item.name"> </el-option>
|
|
|
+ <el-option v-for="item in rateList" :key="item.label" :label="item.label" :value="item.label"> </el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="税前应收" prop="before">
|
|
|
+ <el-table-column align="center" label="税前应收" prop="sq_ys">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
- v-model="scope.row.before"
|
|
|
+ v-model="scope.row.sq_ys"
|
|
|
placeholder="请输入税前应收"
|
|
|
@change="
|
|
|
val => {
|
|
@@ -105,15 +117,15 @@
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="税后应收" prop="after">
|
|
|
+ <el-table-column align="center" label="税后应收" prop="sh_ys">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.after" readonly></el-input>
|
|
|
+ <el-input v-model="scope.row.sh_ys" readonly></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="税前实收" prop="paidBefor">
|
|
|
+ <el-table-column align="center" label="税前实收" prop="sq_ss">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
- v-model="scope.row.paidBefor"
|
|
|
+ v-model="scope.row.sq_ss"
|
|
|
placeholder="请输入税前实收"
|
|
|
@change="
|
|
|
val => {
|
|
@@ -123,16 +135,16 @@
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="税后实收" prop="paidAfter">
|
|
|
+ <el-table-column align="center" label="税后实收" prop="sh_ss">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.paidAfter" readonly></el-input>
|
|
|
+ <el-input v-model="scope.row.sh_ss" readonly></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="备注" prop="desc">
|
|
|
+ <!-- <el-table-column align="center" label="备注" prop="remark">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input type="textarea" v-model="scope.row.desc" placeholder="请输入备注"></el-input>
|
|
|
+ <el-input type="textarea" v-model="scope.row.remark" placeholder="请输入备注"></el-input>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
<el-table-column align="center" label="操作" width="70px">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
|
|
@@ -142,11 +154,7 @@
|
|
|
</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-row> </el-row>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -154,221 +162,307 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+const { mapActions: project } = createNamespacedHelpers('project');
|
|
|
+const { mapActions: route } = createNamespacedHelpers('route');
|
|
|
+const { mapActions: mode } = createNamespacedHelpers('mode');
|
|
|
+const { mapActions: treaty } = createNamespacedHelpers('treaty');
|
|
|
+const { mapActions: dictionary } = createNamespacedHelpers('dictionary');
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
export default {
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|
|
|
},
|
|
|
name: 'inDetail',
|
|
|
- props: {},
|
|
|
+ props: {
|
|
|
+ detailForm: { type: Object },
|
|
|
+ nameList: { type: Array },
|
|
|
+ },
|
|
|
+ model: {
|
|
|
+ prop: 'detailForm',
|
|
|
+ event: 'change',
|
|
|
+ },
|
|
|
components: {},
|
|
|
data: function() {
|
|
|
return {
|
|
|
- detailForm: { name: '伟巴斯特(长春)车顶系统有限公司-北京天津线', number: '1234', contract: '合同一', route: '线路一', project: '项目一' },
|
|
|
+ // detailForm1: { name: '伟巴斯特(长春)车顶系统有限公司-北京天津线', number: '1234', contract: '合同一', route: '线路一', project: '项目一' },
|
|
|
//合同列表
|
|
|
contractList: [],
|
|
|
//项目列表
|
|
|
projectList: [],
|
|
|
//线路列表
|
|
|
- routeList: [{ name: '线路二' }],
|
|
|
- detailFields: [
|
|
|
- { label: '货物名称', model: 'name' },
|
|
|
- { label: '计费方式', model: 'way' },
|
|
|
- { label: '单价', model: 'price' },
|
|
|
- { label: '税率', model: 'rate', custom: 'true' },
|
|
|
- { label: '税前应收', model: 'before' },
|
|
|
- { label: '税后应收', model: 'after' },
|
|
|
- { label: '税前实收', model: 'paidBefor' },
|
|
|
- { label: '税后应收', model: 'paidAfter' },
|
|
|
- { label: '备注', model: 'desc', custom: 'true' },
|
|
|
- ],
|
|
|
- detailList: [
|
|
|
- {
|
|
|
- name: '1',
|
|
|
- way: '整车-100',
|
|
|
- price: '',
|
|
|
- before: '',
|
|
|
- after: '',
|
|
|
- paidBefor: '',
|
|
|
- paidAfter: '',
|
|
|
- rate: 1.1,
|
|
|
- num: 20,
|
|
|
- },
|
|
|
- ],
|
|
|
+ routeList: [],
|
|
|
+ detailList: [],
|
|
|
activeName: 'first',
|
|
|
//收入项列表
|
|
|
- options: [{ name: '保费' }, { name: '提送货费' }, { name: '运费' }],
|
|
|
+ options: [],
|
|
|
//税率列表
|
|
|
- rateList: [{ name: '1' }, { name: '1.1' }, { name: '2' }],
|
|
|
+ rateList: [],
|
|
|
listData: [],
|
|
|
- wayoptions: [{ name: '整车-100' }, { name: '零担-10' }],
|
|
|
+ //方式列表
|
|
|
+ wayoptions: [],
|
|
|
cost1: 0,
|
|
|
cost2: 0,
|
|
|
cost3: 0,
|
|
|
cost4: 0,
|
|
|
+ name: '',
|
|
|
+ treatyValue: '',
|
|
|
+ routeValue: '',
|
|
|
+ wayValue: '',
|
|
|
+ priceOptions: [],
|
|
|
+ prNumber: '',
|
|
|
+ wayList: [],
|
|
|
+ //单价列表
|
|
|
+ priceList: [],
|
|
|
+ number1: 0,
|
|
|
+ weight: 0,
|
|
|
+ volume: 0,
|
|
|
+ projectObj: {},
|
|
|
};
|
|
|
},
|
|
|
- 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;
|
|
|
+ async created() {
|
|
|
+ await this.roleSelect(this.detailForm.client);
|
|
|
+ await this.search();
|
|
|
+ await this.searchTree();
|
|
|
+ await this.isTreaty();
|
|
|
+ // await this.assign();
|
|
|
+ // this.ifMode();
|
|
|
+ await this.computRate();
|
|
|
+ console.log(this.detailForm);
|
|
|
},
|
|
|
methods: {
|
|
|
+ //查合同
|
|
|
+ ...treaty(['query', 'create', 'update', 'delete']),
|
|
|
+ ...project({ projectQuery: 'query' }),
|
|
|
+ ...route({ routeQuery: 'query' }),
|
|
|
+ ...mode({ modeQuery: 'query' }),
|
|
|
+ ...dictionary(['tree']),
|
|
|
+
|
|
|
+ async search() {
|
|
|
+ let client = this.detailForm.client;
|
|
|
+ let obj = {};
|
|
|
+ if (this.user.role !== '0') obj.owner = this.user.id;
|
|
|
+ obj.client = client;
|
|
|
+ const res = await this.query(obj);
|
|
|
+ if (res.data.length == 0) {
|
|
|
+ this.projectList = [];
|
|
|
+ this.routeList = [];
|
|
|
+ this.contractList = [];
|
|
|
+ this.detailForm.item = '';
|
|
|
+ this.detailForm.route = '';
|
|
|
+ this.detailForm.treaty = '';
|
|
|
+ } else {
|
|
|
+ const { data, total } = res;
|
|
|
+ this.$set(this, `contractList`, data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //查项目
|
|
|
+ async searchProject() {
|
|
|
+ // console.log('查项目');
|
|
|
+ let goods = this.detailForm.goods;
|
|
|
+ const res = await this.projectQuery({ treaty: this.treatyValue });
|
|
|
+ // console.log(res);
|
|
|
+ if (res.data.length == 0) {
|
|
|
+ this.projectList = [];
|
|
|
+ this.routeList = [];
|
|
|
+ this.detailForm.item = '';
|
|
|
+ this.detailForm.route = '';
|
|
|
+ } else {
|
|
|
+ const { data, total } = res;
|
|
|
+ this.$set(this, `projectList`, data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //查线路
|
|
|
+ async searchRoute() {
|
|
|
+ const res = await this.routeQuery({ item: this.routeValue });
|
|
|
+ if (res.data.length == 0) {
|
|
|
+ this.routeList = [];
|
|
|
+ this.detailForm.route = '';
|
|
|
+ } else {
|
|
|
+ const { data } = res;
|
|
|
+ this.$set(this, `routeList`, data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //查计费方式列表
|
|
|
+ async searchWay() {
|
|
|
+ // let hh;
|
|
|
+ let test1 = [];
|
|
|
+ const res = await this.modeQuery({ route: this.wayValue });
|
|
|
+ if (res) {
|
|
|
+ this.$set(this, `wayList`, res.data);
|
|
|
+ for (let i of this.wayList) {
|
|
|
+ if (i.is_lf) {
|
|
|
+ i.hh = `${i.price}-量份`;
|
|
|
+ } else if (i.send_type == '零担') {
|
|
|
+ i.hh = `${i.price}-${i.send_type}-${i.computed_type}`;
|
|
|
+ } else {
|
|
|
+ i.hh = `${i.price}-整车`;
|
|
|
+ }
|
|
|
+ // test1.push(hh);
|
|
|
+ }
|
|
|
+ // let newTest = _.slice(test1, 0, this.wayList.length + 1);
|
|
|
+ // this.$set(this, `wayoptions`, newTest);
|
|
|
+ // console.log(this.wayList);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async searchTree() {
|
|
|
+ //查询其他收费项
|
|
|
+ const res = await this.tree('sr');
|
|
|
+ if (res) {
|
|
|
+ this.$set(this, `options`, res[0].children);
|
|
|
+ // console.log(this.options);
|
|
|
+ }
|
|
|
+ //查其他收费项的税率
|
|
|
+ const res1 = await this.tree('sl');
|
|
|
+ if (res1) {
|
|
|
+ this.$set(this, `rateList`, res1[0].children);
|
|
|
+ }
|
|
|
+ },
|
|
|
handleChange(value) {
|
|
|
console.log(value);
|
|
|
},
|
|
|
//添加收費項目
|
|
|
addGoods() {
|
|
|
- this.listData.push({});
|
|
|
+ this.detailForm.in_bill.push({ taxes: 1, item: '保費' });
|
|
|
},
|
|
|
//刪除
|
|
|
handleDelete(index, row) {
|
|
|
- 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);
|
|
|
- }
|
|
|
+ if (index > -1) {
|
|
|
+ this.detailForm.in_bill.splice(index, 1);
|
|
|
}
|
|
|
+ this.computRate();
|
|
|
},
|
|
|
- //选择计费方式
|
|
|
- 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;
|
|
|
+ //选择货物的计费方式
|
|
|
+ async change(data, index) {
|
|
|
+ let priceDate = this.wayList.find(i => i.id === data);
|
|
|
+ // console.log(priceDate);
|
|
|
+ let goods = this.detailForm.goods[index];
|
|
|
+ let price = priceDate.hh.split('-');
|
|
|
+ goods.price = price[0];
|
|
|
+ // console.log(goods);
|
|
|
+ let arr = _.split(priceDate.hh, '-', 3);
|
|
|
+ // console.log(arr);
|
|
|
+ if (_.indexOf(arr, '量份') !== -1) {
|
|
|
+ goods.cvalue = goods.number;
|
|
|
+ } else if (_.indexOf(arr, '整车') !== -1) {
|
|
|
+ goods.cvalue = 1;
|
|
|
+ } else if (_.indexOf(arr, '按体积') !== -1) {
|
|
|
+ console.log('按体积');
|
|
|
+ goods.cvalue = goods.volume;
|
|
|
} else {
|
|
|
- this.detailList[0].num = 9;
|
|
|
+ console.log('按重量');
|
|
|
+ goods.cvalue = goods.weight;
|
|
|
}
|
|
|
- this.computRate(this.detailList[0].price, this.detailList[0].num);
|
|
|
+ goods.sq_ys = _.round(goods.cvalue * goods.price, 2);
|
|
|
+ goods.sh_ys = _.round(goods.taxes * goods.cvalue * goods.price, 2);
|
|
|
+ goods.sq_ss = _.round(goods.cvalue * goods.price, 2);
|
|
|
+ goods.sh_ss = _.round(goods.taxes * goods.cvalue * goods.price, 2);
|
|
|
+ // console.log(goods);
|
|
|
+ this.$set(this.detailForm.goods, index, goods);
|
|
|
+
|
|
|
+ this.computRate();
|
|
|
},
|
|
|
//計算价格
|
|
|
- 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';
|
|
|
+ async computRate() {
|
|
|
+ let num1 = 0;
|
|
|
+ let num2 = 0;
|
|
|
+ let num3 = 0;
|
|
|
+ let num4 = 0;
|
|
|
+ let num5 = 0;
|
|
|
+ let num6 = 0;
|
|
|
+ let num7 = 0;
|
|
|
+ let num8 = 0;
|
|
|
+ let goods = this.detailForm.goods; //goods是个数组
|
|
|
+ let in_bill = this.detailForm.in_bill; //in_bill是个数组
|
|
|
+ for (let row1 of goods) {
|
|
|
+ num1 = _.round(num1 + row1.sq_ys, 2);
|
|
|
+ num2 = _.round(num2 + row1.sh_ys, 2);
|
|
|
+ num3 = _.round(num3 + row1.sq_ss, 2);
|
|
|
+ num4 = _.round(num4 + row1.sh_ss, 2);
|
|
|
+ }
|
|
|
+ for (let val of in_bill) {
|
|
|
+ num5 = _.round(num5 + Number(val.sq_ys), 2);
|
|
|
+ num6 = _.round(num6 + val.sh_ys, 2);
|
|
|
+ num7 = _.round(num7 + Number(val.sq_ss), 2);
|
|
|
+ num8 = _.round(num8 + val.sh_ss, 2);
|
|
|
}
|
|
|
- this.cost1 = listData.before;
|
|
|
- this.cost2 = listData.after;
|
|
|
- this.cost3 = listData.paidBefor;
|
|
|
- this.cost4 = listData.paidAfter;
|
|
|
+ this.$set(this, `cost1`, _.round(num1 + num5, 2));
|
|
|
+ this.$set(this, `cost2`, _.round(num2 + num6, 2));
|
|
|
+ this.$set(this, `cost3`, _.round(num3 + num7, 2));
|
|
|
+ this.$set(this, `cost4`, _.round(num4 + num8, 2));
|
|
|
},
|
|
|
//税前应收
|
|
|
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;
|
|
|
- }
|
|
|
- }
|
|
|
+ let bill = this.detailForm.in_bill[index]; //bill是数组
|
|
|
+ let sh_ys = _.round(bill.sq_ys * bill.taxes, 2);
|
|
|
+ this.$set(bill, `sh_ys`, sh_ys);
|
|
|
+ let sq_ss = _.round(bill.sq_ys, 2);
|
|
|
+ this.$set(bill, `sq_ss`, sq_ss);
|
|
|
+ let sh_ss = _.round(bill.sq_ss * bill.taxes, 2);
|
|
|
+ this.$set(bill, `sh_ss`, sh_ss);
|
|
|
+ this.computRate();
|
|
|
},
|
|
|
//税前实收
|
|
|
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;
|
|
|
- }
|
|
|
- }
|
|
|
+ console.log(val, index);
|
|
|
+ let bill = this.detailForm.in_bill[index]; //bill是数组
|
|
|
+ let sh_ss = _.round(bill.sq_ss * bill.taxes, 2);
|
|
|
+ this.$set(bill, `sh_ss`, sh_ss);
|
|
|
+ this.computRate();
|
|
|
},
|
|
|
//选择税率
|
|
|
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;
|
|
|
- }
|
|
|
- }
|
|
|
+ let bill = this.detailForm.in_bill[index]; //bill是数组
|
|
|
+ this.inputChange(val, index);
|
|
|
},
|
|
|
//保存
|
|
|
save() {
|
|
|
console.log('保存');
|
|
|
console.log(this.listData);
|
|
|
},
|
|
|
+ //返回
|
|
|
+ toReturn() {
|
|
|
+ this.$emit('toReturn');
|
|
|
+ },
|
|
|
+ roleSelect(value) {
|
|
|
+ let arr = this.nameList.find(i => i.id === value);
|
|
|
+ this.name = arr.name;
|
|
|
+ },
|
|
|
+ //合同改变
|
|
|
+ async treayChange(data) {
|
|
|
+ this.treatyValue = data;
|
|
|
+ await this.searchProject();
|
|
|
+ },
|
|
|
+ //项目改变 项目改变就有税率
|
|
|
+ async projectChange(data) {
|
|
|
+ this.$set(this, `routeValue`, data);
|
|
|
+ await this.searchRoute();
|
|
|
+ const res = this.projectList.find(f => f.id == data);
|
|
|
+ if (res) {
|
|
|
+ const { taxes } = res;
|
|
|
+ let duplicate = _.cloneDeep(this.detailForm.goods);
|
|
|
+ duplicate = duplicate.map(i => {
|
|
|
+ i.taxes = taxes;
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ this.$set(this.detailForm, `goods`, duplicate);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //线路改变
|
|
|
+ routeChange(data, type) {
|
|
|
+ this.wayValue = data;
|
|
|
+ this.searchWay();
|
|
|
+ console.log(data);
|
|
|
+ if (type) return;
|
|
|
+ for (let item of this.detailForm.goods) {
|
|
|
+ item.mode = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async isTreaty() {
|
|
|
+ if (this.detailForm.treaty) this.treayChange(this.detailForm.treaty);
|
|
|
+ if (this.detailForm.item) this.projectChange(this.detailForm.item);
|
|
|
+ //判断是不是第一次进入,如果是第一次那么不清空,如果是自己手动触发则要清空
|
|
|
+ if (this.detailForm.route) await this.routeChange(this.detailForm.route, true);
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
@@ -422,4 +516,7 @@ export default {
|
|
|
/deep/.el-table .cell {
|
|
|
text-align: center;
|
|
|
}
|
|
|
+/deep/.el-input__inner {
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
</style>
|