|
|
@@ -19,10 +19,17 @@
|
|
|
type="warning"
|
|
|
:disabled="detailData.seeDisabled"
|
|
|
size="small"
|
|
|
- @click="applySettlement"
|
|
|
+ @click="applySettlement('收费')"
|
|
|
>生成账单</el-button>
|
|
|
<el-button
|
|
|
class="el-button--small-yh"
|
|
|
+ type="warning"
|
|
|
+ :disabled="detailData.seeDisabled"
|
|
|
+ size="small"
|
|
|
+ @click="applySettlement('申请')"
|
|
|
+ >退款</el-button>
|
|
|
+ <el-button
|
|
|
+ class="el-button--small-yh"
|
|
|
type="primary"
|
|
|
:disabled="detailData.seeDisabled"
|
|
|
size="small"
|
|
|
@@ -617,7 +624,7 @@ export default {
|
|
|
saveLoading: false,
|
|
|
disabled: false,
|
|
|
form: {},
|
|
|
- billType:"销售", //账单类型
|
|
|
+ billType:"收费", //账单类型
|
|
|
billData:{}, //账单需要数据
|
|
|
applySettlementDialog:false,//生成账单组件
|
|
|
configuration: {
|
|
|
@@ -1111,14 +1118,14 @@ export default {
|
|
|
prop: 'packageRemarks',
|
|
|
rules: [
|
|
|
{
|
|
|
- required: true,
|
|
|
+ required: false,
|
|
|
message: ' ',
|
|
|
trigger: 'blur'
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
label: '销售订单号',
|
|
|
- prop: 'orgOrderNo',
|
|
|
+ prop: 'orderNo',
|
|
|
disabled: true,
|
|
|
rules: [
|
|
|
{
|
|
|
@@ -1383,21 +1390,10 @@ export default {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
- }).then(() => {
|
|
|
- this.editCustomer(false)
|
|
|
+ }).then(async () => {
|
|
|
+ await this.editCustomer(false, '采购')
|
|
|
}).catch(() => {
|
|
|
this.$message.info('已取消')
|
|
|
- // this.$confirm("是否生成采购单?", {
|
|
|
- // confirmButtonText: "确定",
|
|
|
- // cancelButtonText: "取消",
|
|
|
- // type: "warning"
|
|
|
- // }).then(() => {
|
|
|
- // saveSell(this.form.id).then(res => {
|
|
|
- // if (res.data.code == 200) {
|
|
|
- // this.$message.success("生成成功");
|
|
|
- // }
|
|
|
- // });
|
|
|
- // });
|
|
|
})
|
|
|
} else {
|
|
|
this.$confirm("是否生成采购单?", {
|
|
|
@@ -1478,6 +1474,20 @@ export default {
|
|
|
this.pageLoading = false
|
|
|
let goodsData = []
|
|
|
res.data.forEach(item => {
|
|
|
+ getMarketPrice({code: item.code}).then(res => {
|
|
|
+ if (res.data.data.length > 0) {
|
|
|
+ this.$set(item, 'price', res.data.data[0].salesPrice)
|
|
|
+ } else {
|
|
|
+ this.$set(item, 'price', '0')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ getPurchasePrice({code: item.code}).then(res => {
|
|
|
+ if (res.data.data.length > 0) {
|
|
|
+ this.$set(item, 'purchaseAmount', res.data.data[0].purchasePrice)
|
|
|
+ } else {
|
|
|
+ this.$set(item, 'purchaseAmount', '0')
|
|
|
+ }
|
|
|
+ })
|
|
|
this.$set(item, 'priceType', '一般')
|
|
|
this.$set(item, 'actualQuantity', '0')
|
|
|
this.$set(item, 'purchaseAmount', '0')
|
|
|
@@ -1522,7 +1532,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//生成发货单
|
|
|
- generateShipmentD() {
|
|
|
+ async generateShipmentD() {
|
|
|
let lsit = []
|
|
|
if (contrastObj(this.form, this.oldForm) ||
|
|
|
contrastList(this.contactsData, this.oldGoodsList) ||
|
|
|
@@ -1534,29 +1544,14 @@ export default {
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
}).then(() => {
|
|
|
- this.editCustomer(false)
|
|
|
+ this.editCustomer(false, '发货')
|
|
|
}).catch(() => {
|
|
|
this.$message({
|
|
|
type: 'info',
|
|
|
message: '已取消'
|
|
|
});
|
|
|
- // this.selection.forEach(item => {
|
|
|
- // lsit.push(item.id)
|
|
|
- // })
|
|
|
- // let data = {
|
|
|
- // id: this.form.id,
|
|
|
- // orderItemIds: lsit
|
|
|
- // }
|
|
|
- // generateShipment(data).then(res => {
|
|
|
- // this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
|
|
|
- // this.$router.push({
|
|
|
- // path: "/businessManagement/deliveryNotice/index",
|
|
|
- // query: {form: JSON.stringify(res.data.data)},
|
|
|
- // });
|
|
|
- // })
|
|
|
})
|
|
|
} else {
|
|
|
- // lsit.push(this.selection[item].id)
|
|
|
this.selection.forEach(item => {
|
|
|
lsit.push(item.id)
|
|
|
})
|
|
|
@@ -1574,7 +1569,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 生成结算
|
|
|
- applySettlement() {
|
|
|
+ applySettlement(type) {
|
|
|
if (contrastObj(this.form, this.oldForm) ||
|
|
|
contrastList(this.contactsData, this.oldGoodsList) ||
|
|
|
contrastList(this.advantageProjectData, this.oldFeesList) ||
|
|
|
@@ -1589,20 +1584,25 @@ export default {
|
|
|
}).catch(() => {
|
|
|
})
|
|
|
} else {
|
|
|
- this.beforeBillData(true)
|
|
|
+ this.beforeBillData(true,type)
|
|
|
this.applySettlementDialog = true;
|
|
|
}
|
|
|
},
|
|
|
//生成账单 拿到主表信息
|
|
|
- beforeBillData(type){
|
|
|
+ beforeBillData(bool,type){
|
|
|
+ this.billType = type
|
|
|
this.billData = {
|
|
|
srcOrderno:this.form.orgOrderNo,
|
|
|
itemType:"销售",
|
|
|
corpsName:this.form.corpName,
|
|
|
corpId:this.form.corpId,
|
|
|
srcParentId: this.form.id,
|
|
|
+ currency: 'CNY',
|
|
|
+ exchangeRate: '1',
|
|
|
+ taxRate: '0',
|
|
|
+ accDate: this.form.businesDate,
|
|
|
}
|
|
|
- if(type){ //申请货款
|
|
|
+ if(bool){ //申请货款
|
|
|
this.billData.srcId = -1
|
|
|
}
|
|
|
},
|
|
|
@@ -1738,7 +1738,20 @@ export default {
|
|
|
this.$set(this.tableData[item], 'orderQuantity', 0)
|
|
|
this.$set(this.tableData[item], 'actualQuantity', 0)
|
|
|
this.$set(this.tableData[item], 'purchaseAmount', '0')
|
|
|
- this.tableData[item].price = '0'
|
|
|
+ getMarketPrice({code: this.tableData[item].code}).then(res => {
|
|
|
+ if (res.data.data.length > 0) {
|
|
|
+ this.$set(this.tableData[item], 'price', res.data.data[0].salesPrice)
|
|
|
+ } else {
|
|
|
+ this.$set(this.tableData[item], 'price', '0')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ getPurchasePrice({code: this.tableData[item].code}).then(res => {
|
|
|
+ if (res.data.data.length > 0) {
|
|
|
+ this.$set(this.tableData[item], 'purchaseAmount', res.data.data[0].purchasePrice)
|
|
|
+ } else {
|
|
|
+ this.$set(this.tableData[item], 'purchaseAmount', '0')
|
|
|
+ }
|
|
|
+ })
|
|
|
this.tableData[item].amount = 0
|
|
|
this.tableData[item].sort = this.maxGoodsNum + 1
|
|
|
delete this.tableData[item].id
|
|
|
@@ -2073,7 +2086,7 @@ export default {
|
|
|
done();
|
|
|
},
|
|
|
//修改提交触发
|
|
|
- editCustomer(isBack = false) {
|
|
|
+ editCustomer(isBack = false, type) {
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
for (let item in this.contactsData) {
|
|
|
@@ -2081,8 +2094,14 @@ export default {
|
|
|
return this.$message.error('商品信息第'+ (parseInt(item) + 1) + '行订货数量不能小于发货数量')
|
|
|
}
|
|
|
}
|
|
|
+ let packFee;
|
|
|
+ if (this.form.packageRemarks) {
|
|
|
+ packFee = this.advantageProjectData.findIndex(item => item.feeName == '包装费')
|
|
|
+ }
|
|
|
+ if (packFee == -1) {
|
|
|
+ return this.$message.error('费用明细未有包装费')
|
|
|
+ }
|
|
|
// 计算毛利额
|
|
|
- // this.$set(this.form, 'grossProfit', 0)
|
|
|
this.$set(this.form, 'orderAmount', 0)
|
|
|
// 成本价
|
|
|
let purchaseAmount = 0
|
|
|
@@ -2091,25 +2110,11 @@ export default {
|
|
|
if (item.purchaseAmount) {
|
|
|
purchaseAmount += (Number(item.purchaseAmount) * Number(item.orderQuantity)).toFixed(2)
|
|
|
}
|
|
|
- // this.form.grossProfit += Number(item.amount)
|
|
|
this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
|
|
|
})
|
|
|
- // this.form.grossProfit = (Number(this.form.orderAmount) - Number(purchaseAmount)).toFixed(2)
|
|
|
- // if (this.form.orderAmount && this.form.overPayment) {
|
|
|
- // this.form.debitAmount = Number(this.form.orderAmount) - Number(this.form.overPayment)
|
|
|
- // }
|
|
|
if (this.form.orderAmount && this.form.settlmentAmount) {
|
|
|
this.$set(this.form, "balanceAmount", (Number(this.form.orderAmount) - Number(this.form.settlmentAmount)).toFixed(2));
|
|
|
}
|
|
|
- // 计算毛利率
|
|
|
- // if (this.form.orderAmount) {
|
|
|
- // this.form.grossProfitRate = ((Number(this.form.grossProfit) / Number(this.form.orderAmount)) * 100).toFixed(2)
|
|
|
- // }
|
|
|
- // 计算应收账款
|
|
|
- // this.$set(this.form, 'debitAmount', 0)
|
|
|
- // this.contactsData.forEach(item => {
|
|
|
- // this.form.debitAmount += Number(item.amount)
|
|
|
- // })
|
|
|
//商品信息
|
|
|
this.form.orderItemsList = this.contactsData
|
|
|
this.form.orderFeesList = this.advantageProjectData
|
|
|
@@ -2127,6 +2132,35 @@ export default {
|
|
|
} else {
|
|
|
this.queryData(res.data.data.id)
|
|
|
}
|
|
|
+ if (type == '发货') {
|
|
|
+ let lsit = []
|
|
|
+ this.selection.forEach(item => {
|
|
|
+ lsit.push(item.id)
|
|
|
+ })
|
|
|
+ let data = {
|
|
|
+ id: this.form.id,
|
|
|
+ orderItemIds: lsit
|
|
|
+ }
|
|
|
+ generateShipment(data).then(res => {
|
|
|
+ this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
|
|
|
+ this.$router.push({
|
|
|
+ path: "/businessManagement/deliveryNotice/index",
|
|
|
+ query: {form: JSON.stringify(res.data.data)},
|
|
|
+ });
|
|
|
+ })
|
|
|
+ } else if (type == '采购') {
|
|
|
+ this.$confirm("是否生成采购单?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ saveSell(this.form.id).then(res => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.$message.success("生成成功");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
}).finally(() => {
|
|
|
this.saveLoading = false
|
|
|
})
|