|
@@ -92,11 +92,13 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="返利金额" min-width="100" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
- {{scope.row.price * scope.row.qty * scope.row.rebateRate}}
|
|
|
+ {{(scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100}}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="格力折扣" min-width="100" show-overflow-tooltip>
|
|
|
- {{scope.row.qty * scope.row.discAmount}}
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.qty * scope.row.discAmount}}
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="现金钱包" prop="walletRebateId2" min-width="160" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
@@ -113,7 +115,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="实付金额" prop="qty" min-width="100" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
- {{(scope.row.price * scope.row.qty) - (scope.row.price * scope.row.qty * scope.row.rebateRate) - (scope.row.qty * scope.row.discAmount)}}
|
|
|
+ {{((scope.row.price * scope.row.qty) * 100 - ((scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100) * 100 - ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) / 100}}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100">
|
|
@@ -132,8 +134,16 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip v-if="!listItem">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag :type="scope.row.status1 | statusTagFilter">{{ scope.row.status1 | statusFilter }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip v-if="!listItem">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag :type="scope.row.status2 | statusTagFilter">{{ scope.row.status2 | statusFilter }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column align="center" label="操作" width="100" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
|
|
@@ -257,6 +267,24 @@ export default {
|
|
|
name: 'RetailForm',
|
|
|
componentName: 'RetailForm',
|
|
|
props: ['listItem'],
|
|
|
+ filters: {
|
|
|
+ statusFilter(val) {
|
|
|
+ if (val === '') return '未检查';
|
|
|
+ const MAP = {
|
|
|
+ 0: '库存不足',
|
|
|
+ 1: '库存充足'
|
|
|
+ }
|
|
|
+ return MAP[val];
|
|
|
+ },
|
|
|
+ statusTagFilter(val) {
|
|
|
+ if (val === '') return 'info';
|
|
|
+ const MAP = {
|
|
|
+ 0: 'danger',
|
|
|
+ 1: 'success'
|
|
|
+ }
|
|
|
+ return MAP[val];
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
mainForm: {
|
|
@@ -332,7 +360,15 @@ export default {
|
|
|
// 获取详情
|
|
|
getDetail() {
|
|
|
getDetail({id: this.listItem.id}).then(res => {
|
|
|
-
|
|
|
+ let data = res.data;
|
|
|
+ this.mainForm.date = data.theTime;
|
|
|
+ this.mainForm.type = data.mainId;
|
|
|
+ this.mainForm.remark = data.remark;
|
|
|
+ data.retailOrderItemList.forEach(item => {
|
|
|
+ item.status1 = '';
|
|
|
+ item.status2 = '';
|
|
|
+ })
|
|
|
+ this.goodsList = data.retailOrderItemList;
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -546,6 +582,9 @@ export default {
|
|
|
if(!this.warehouseValue) {
|
|
|
return this.$errorMsg('请选择仓库');
|
|
|
}
|
|
|
+ if(!this.goodsList) {
|
|
|
+ return this.$errorMsg('请添加货品');
|
|
|
+ }
|
|
|
let ids = [];
|
|
|
this.goodsList.forEach(item => {
|
|
|
ids.push(item.materialId);
|
|
@@ -554,7 +593,12 @@ export default {
|
|
|
correspondId: this.warehouseValue,
|
|
|
materialId: ids.join(',')
|
|
|
}).then(res => {
|
|
|
-
|
|
|
+ if(res.data) {
|
|
|
+ this.goodsList.forEach((item, index) => {
|
|
|
+ item.status1 = res.data[index].allStockStatus;
|
|
|
+ item.status2 = res.data[index].stockStatus;
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -562,6 +606,13 @@ export default {
|
|
|
clickSubmitForm() {
|
|
|
this.$refs.mainForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ for(let i=0; i<this.goodsList.length; i++) {
|
|
|
+ if(!this.goodsList[i].walletRebateId2) {
|
|
|
+ this.$errorMsg('请选择现金钱包');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let mainName = this.typeList[findElem(this.typeList, 'dictCode', this.mainForm.type)].dictValue;
|
|
|
let params = {
|
|
|
theTime: this.mainForm.date + ' 00:00:00',
|
|
@@ -571,12 +622,20 @@ export default {
|
|
|
type: 1, // 1:普通零售单,2:政策零售单
|
|
|
retailOrderItemList: this.goodsList
|
|
|
}
|
|
|
- addData(params).then(res => {
|
|
|
- this.$successMsg('添加成功');
|
|
|
- this.goBack();
|
|
|
- this.$parent.getList();
|
|
|
- })
|
|
|
-
|
|
|
+ if(this.listItem) {
|
|
|
+ params.id = this.listItem.id;
|
|
|
+ editData(params).then(res => {
|
|
|
+ this.$successMsg('编辑成功');
|
|
|
+ this.goBack();
|
|
|
+ this.$parent.getList();
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ addData(params).then(res => {
|
|
|
+ this.$successMsg('添加成功');
|
|
|
+ this.goBack();
|
|
|
+ this.$parent.getList();
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|