销售发货
This commit is contained in:
@@ -94,8 +94,9 @@
|
||||
<!-- 添加或修改应收款管理(宽松版)对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="客户ID" prop="customerId">
|
||||
<CustomerSelect v-model="form.customerId" />
|
||||
<el-form-item label="客户" prop="customerId">
|
||||
<el-input v-if="fixedCustomer" :model-value="fixedCustomerLabel" disabled />
|
||||
<CustomerSelect v-else v-model="form.customerId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="到期日" prop="dueDate">
|
||||
<el-date-picker clearable
|
||||
@@ -141,6 +142,7 @@
|
||||
<script>
|
||||
import { listReceivable, getReceivable, delReceivable, addReceivable, updateReceivable, updatePaidAmount } from "@/api/finance/receivable";
|
||||
import CustomerSelect from '@/components/CustomerSelect/index.vue';
|
||||
import { getCustomer } from "@/api/oms/customer";
|
||||
|
||||
export default {
|
||||
name: "Receivable",
|
||||
@@ -151,6 +153,25 @@ export default {
|
||||
orderId: {
|
||||
type: [String, Number],
|
||||
required: true
|
||||
},
|
||||
customerId: {
|
||||
type: [String, Number],
|
||||
required: false,
|
||||
default: undefined
|
||||
},
|
||||
customerName: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ""
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
fixedCustomer() {
|
||||
return this.customerId != null && String(this.customerId) !== ""
|
||||
},
|
||||
fixedCustomerLabel() {
|
||||
const name = String(this.customerName || this.fixedCustomerName || "").trim()
|
||||
return name || "—"
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -179,7 +200,7 @@ export default {
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
customerId: undefined,
|
||||
customerId: this.customerId != null && String(this.customerId) !== "" ? this.customerId : undefined,
|
||||
orderId: this.orderId,
|
||||
dueDate: undefined,
|
||||
amount: undefined,
|
||||
@@ -195,7 +216,8 @@ export default {
|
||||
// 收款表单参数
|
||||
receiveForm: {},
|
||||
// 是否显示收款弹出层
|
||||
receiveOpen: false
|
||||
receiveOpen: false,
|
||||
fixedCustomerName: ""
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -205,9 +227,35 @@ export default {
|
||||
orderId(newVal) {
|
||||
this.queryParams.orderId = newVal;
|
||||
this.getList();
|
||||
},
|
||||
customerId(newVal) {
|
||||
this.queryParams.customerId = newVal != null && String(newVal) !== "" ? newVal : undefined
|
||||
this.loadFixedCustomerName()
|
||||
},
|
||||
customerName() {
|
||||
this.loadFixedCustomerName()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadFixedCustomerName() {
|
||||
if (!this.fixedCustomer) {
|
||||
this.fixedCustomerName = ""
|
||||
return
|
||||
}
|
||||
const name = String(this.customerName || "").trim()
|
||||
if (name) {
|
||||
this.fixedCustomerName = name
|
||||
return
|
||||
}
|
||||
const id = this.customerId
|
||||
if (id == null || String(id) === "") return
|
||||
getCustomer(id).then(res => {
|
||||
const d = res && res.data ? res.data : null
|
||||
this.fixedCustomerName = (d && d.name) ? String(d.name) : ""
|
||||
}).catch(() => {
|
||||
this.fixedCustomerName = ""
|
||||
})
|
||||
},
|
||||
/** 查询应收款管理(宽松版)列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
@@ -226,7 +274,7 @@ export default {
|
||||
reset() {
|
||||
this.form = {
|
||||
receivableId: undefined,
|
||||
customerId: undefined,
|
||||
customerId: this.fixedCustomer ? this.customerId : undefined,
|
||||
orderId: this.orderId,
|
||||
dueDate: undefined,
|
||||
amount: undefined,
|
||||
@@ -263,6 +311,7 @@ export default {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加应收款管理(宽松版)";
|
||||
this.loadFixedCustomerName()
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
@@ -291,7 +340,11 @@ export default {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addReceivable(this.form).then(response => {
|
||||
const payload = Object.assign({}, this.form, {
|
||||
customerId: this.fixedCustomer ? this.customerId : this.form.customerId,
|
||||
orderId: this.orderId
|
||||
})
|
||||
addReceivable(payload).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
||||
Reference in New Issue
Block a user