|
@@ -111,6 +111,8 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="线路">
|
|
|
<el-input v-model="form.route" placeholder="线路" readonly></el-input>
|
|
|
+
|
|
|
+ <!-- {{ getRoute(form.route) }} -->
|
|
|
</el-form-item>
|
|
|
</span>
|
|
|
<span v-else-if="form.supply_type == '1'">
|
|
@@ -135,7 +137,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="计费方式">
|
|
|
- <el-select v-model="form.supplier.mode" placeholder="计费方式">
|
|
|
+ <el-select v-model="form.supplier.mode" placeholder="计费方式" @change="changeStyle">
|
|
|
<el-option v-for="item in modeList" :key="item.label" :label="item.name" :value="item.id"> </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -159,8 +161,8 @@
|
|
|
<el-col :span="24" class="list">
|
|
|
<el-col :span="24" class="rate">
|
|
|
<el-col :span="6" class="rateMoney">税前应收:{{ statNum.sq_ys || 0 }}</el-col>
|
|
|
- <el-col :span="6" class="rateMoney">税前实收:{{ statNum.sq_ss || 0 }}</el-col>
|
|
|
<el-col :span="6" class="rateMoney">税后应收:{{ statNum.sh_ys || 0 }}</el-col>
|
|
|
+ <el-col :span="6" class="rateMoney">税前实收:{{ statNum.sq_ss || 0 }}</el-col>
|
|
|
<el-col :span="6" class="rateMoney">税后实收:{{ statNum.sh_ss || 0 }}</el-col>
|
|
|
</el-col>
|
|
|
<data-table :fields="detailFields" :data="goodsList" :usePage="false">
|
|
@@ -206,6 +208,8 @@ const { mapActions: treaty } = createNamespacedHelpers('treaty');
|
|
|
const { mapActions: project } = createNamespacedHelpers('project');
|
|
|
// 计算方式
|
|
|
const { mapActions: mode } = createNamespacedHelpers('mode');
|
|
|
+//货物收入
|
|
|
+const { mapActions: inBill } = createNamespacedHelpers('inBill');
|
|
|
export default {
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|
|
@@ -247,8 +251,8 @@ export default {
|
|
|
{ label: '重量(t)', model: 'weight' },
|
|
|
{ label: '体积(m²)', model: 'volume' },
|
|
|
{ label: '税前应收', model: 'sq_ys' },
|
|
|
- { label: '税前实收', model: 'sq_ss' },
|
|
|
{ label: '税后应收', model: 'sh_ys' },
|
|
|
+ { label: '税前实收', model: 'sq_ss' },
|
|
|
{ label: '税后实收', model: 'sh_ss' },
|
|
|
],
|
|
|
goodsList: [],
|
|
@@ -272,6 +276,8 @@ export default {
|
|
|
depositRoute: '',
|
|
|
num: true,
|
|
|
newObj: {},
|
|
|
+ InGoodsList: [],
|
|
|
+ computedStyle: '',
|
|
|
};
|
|
|
},
|
|
|
async created() {
|
|
@@ -288,6 +294,7 @@ export default {
|
|
|
...treaty({ treatyQuery: 'query' }),
|
|
|
...project({ projectQuery: 'query' }),
|
|
|
...mode({ modeQuery: 'query' }),
|
|
|
+ ...inBill({ inBillQuery: 'query' }),
|
|
|
async search({ skip = 0, limit = this.limit, ...info } = {}) {
|
|
|
//查订单
|
|
|
let res = await this.transportQuery({ skip, limit, ...info });
|
|
@@ -321,12 +328,20 @@ export default {
|
|
|
if (this.$checkRes(res)) {
|
|
|
const { data, total } = res;
|
|
|
this.$set(this, `routeList`, data);
|
|
|
+ // console.log(this.routeList);
|
|
|
}
|
|
|
// 查询税率
|
|
|
res = await this.tree('sl');
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `taxesList`, res);
|
|
|
}
|
|
|
+ //查货物收入
|
|
|
+ res = await this.inBillQuery();
|
|
|
+ // console.log(res);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `InGoodsList`, res.data);
|
|
|
+ // console.log(this.InGoodsList);
|
|
|
+ }
|
|
|
},
|
|
|
// 发车
|
|
|
async toExport() {
|
|
@@ -353,7 +368,8 @@ export default {
|
|
|
this.$message.warning('有未填写 收入 的货物! 请先填写收入再装车');
|
|
|
return;
|
|
|
}
|
|
|
- let depositRoute = `${routeData.s_p}-${routeData.s_c}至${routeData.e_p}-${routeData.e_c}`;
|
|
|
+ // let depositRoute = `${routeData.s_p}-${routeData.s_c}至${routeData.e_p}-${routeData.e_c}`;
|
|
|
+ let depositRoute = routeData.name;
|
|
|
this.$set(this, `depositRoute`, depositRoute);
|
|
|
this.$set(this, `goodsList`, goods);
|
|
|
this.$set(this, `form`, data);
|
|
@@ -370,7 +386,6 @@ export default {
|
|
|
// 生成装车单
|
|
|
async onSubmit() {
|
|
|
let data = this.form;
|
|
|
- // console.log(data);
|
|
|
data.goods = this.goodsList;
|
|
|
let res = await this.transportCreate(data);
|
|
|
if (this.$checkRes(res)) {
|
|
@@ -379,6 +394,7 @@ export default {
|
|
|
type: 'success',
|
|
|
});
|
|
|
}
|
|
|
+ this.back();
|
|
|
},
|
|
|
// 过滤客户
|
|
|
getclient(value) {
|
|
@@ -427,31 +443,85 @@ export default {
|
|
|
let res = await this.modeQuery({ route: value });
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `modeList`, res.data);
|
|
|
+ // console.log(this.modeList);
|
|
|
}
|
|
|
let item = this.supRouteList.find(i => i.id == value);
|
|
|
if (item) {
|
|
|
this.$set(this.form, `route`, item.name);
|
|
|
}
|
|
|
},
|
|
|
+ //改变计费方式
|
|
|
+ changeStyle(value) {
|
|
|
+ let style = this.modeList.find(i => i.id === value);
|
|
|
+ if (style.is_lf) {
|
|
|
+ this.computedStyle = `${style.price}-量份`;
|
|
|
+ } else if (style.send_type == '零担') {
|
|
|
+ this.computedStyle = `${style.price}-${style.send_type}-${style.computed_type}`;
|
|
|
+ } else {
|
|
|
+ this.computedStyle = `${style.price}-整车`;
|
|
|
+ }
|
|
|
+ if (this.computedStyle) {
|
|
|
+ let arr = _.split(this.computedStyle, '-', 3);
|
|
|
+ for (let item of this.goodsList) {
|
|
|
+ if (_.indexOf(arr, '量份') !== -1) {
|
|
|
+ item.hh = item.number;
|
|
|
+ } else if (_.indexOf(arr, '整车') !== -1) {
|
|
|
+ item.hh = 1;
|
|
|
+ } else if (_.indexOf(arr, '按体积') !== -1) {
|
|
|
+ item.hh = item.volume;
|
|
|
+ } else {
|
|
|
+ item.hh = item.weight;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.log(this.goodsList);
|
|
|
+ }
|
|
|
+ let newData = _.cloneDeep(this.goodsList);
|
|
|
+ for (let val of newData) {
|
|
|
+ val = this.changeCost(val);
|
|
|
+ }
|
|
|
+ this.$set(this, `goodsList`, newData);
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
// 选择税率
|
|
|
changeTaxes(value) {
|
|
|
- let newData = this.goodsList;
|
|
|
- for (const val of newData) {
|
|
|
+ let newData = _.cloneDeep(this.goodsList);
|
|
|
+ // console.log(newData);
|
|
|
+ for (let val of newData) {
|
|
|
val.taxes = value;
|
|
|
+ val = this.changeCost(val);
|
|
|
}
|
|
|
- this.goodsList = [];
|
|
|
+ // this.goodsList = [];
|
|
|
this.$set(this, `goodsList`, newData);
|
|
|
+ this.$forceUpdate();
|
|
|
},
|
|
|
// 计算税收
|
|
|
changeCost(data) {
|
|
|
- data.sq_ys = data.cost;
|
|
|
- data.sq_ss = data.cost;
|
|
|
- data.sh_ys = _.round(data.cost * data.taxes, 2);
|
|
|
- data.sh_ss = _.round(data.cost * data.taxes, 2);
|
|
|
+ if (data) {
|
|
|
+ if (data.hh) {
|
|
|
+ let num = Number(data.hh);
|
|
|
+ data.sq_ys = data.cost * num;
|
|
|
+ data.sq_ss = data.cost * num;
|
|
|
+ data.sh_ys = _.round(data.cost * data.taxes * num, 2);
|
|
|
+ data.sh_ss = _.round(data.cost * data.taxes * num, 2);
|
|
|
+ } else {
|
|
|
+ data.sq_ys = data.cost;
|
|
|
+ data.sq_ss = data.cost;
|
|
|
+ data.sh_ys = _.round(data.cost * data.taxes, 2);
|
|
|
+ data.sh_ss = _.round(data.cost * data.taxes, 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!data.cost) {
|
|
|
+ data.sq_ys = 0;
|
|
|
+ data.sq_ss = 0;
|
|
|
+ data.sh_ys = 0;
|
|
|
+ data.sh_ss = 0;
|
|
|
+ }
|
|
|
+ // console.log(data);
|
|
|
return data;
|
|
|
},
|
|
|
// 计算税收总数
|
|
|
searchSh() {
|
|
|
+ // console.log(this.goodsList);
|
|
|
let data = {
|
|
|
sq_ys: _.round(
|
|
|
this.goodsList.reduce((p, n) => p + (n['sq_ys'] * 1 || 0), 0),
|
|
@@ -474,6 +544,7 @@ export default {
|
|
|
this.goodsList.reduce((p, n) => p + (n['sq_ys'] * 1 || 0), 0),
|
|
|
2
|
|
|
);
|
|
|
+ // console.log(data);
|
|
|
if (data) this.$set(this, `statNum`, data);
|
|
|
},
|
|
|
// 返回列表
|
|
@@ -493,7 +564,7 @@ export default {
|
|
|
handleSelectionChange(val, index) {
|
|
|
let obj = this.newObj;
|
|
|
let numberIndex;
|
|
|
- console.log(this.num);
|
|
|
+ // console.log(this.num);
|
|
|
//如果返回来的数组为空,那么就是这个list全部取消
|
|
|
if (val.length === 0) {
|
|
|
let newArray = _.differenceWith(this.selected, this.list[index].split, _.isEqual);
|
|
@@ -522,6 +593,16 @@ export default {
|
|
|
this.num = selection.length && selection.indexOf(row) !== -1;
|
|
|
this.newObj = row;
|
|
|
},
|
|
|
+ //过滤路线
|
|
|
+ getRoute(data) {
|
|
|
+ // console.log(data);
|
|
|
+ let routeIdList = _.split(data, '至', 2);
|
|
|
+ let newArray;
|
|
|
+ console.log(routeIdList);
|
|
|
+ if (routeIdList) {
|
|
|
+ newArray = routeIdList.map(item => {});
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|