Commit ebe649fb authored by Facius's avatar Facius

feat: 通用账单复制

parent befaec7f
...@@ -620,9 +620,23 @@ export default { ...@@ -620,9 +620,23 @@ export default {
} }
}, },
copyBill() { copyBill() {
this.toCreatePage({ if (this.isCollection) {
copyId: this.billId this.$u.route({
}, 'redirectTo'); url: '/pages/maintain-bill/normal-create',
type: 'redirectTo',
params: {
copyId: this.billId
}
});
} else {
this.$u.route({
url: 'pages/maintain-bill/create',
type: 'redirectTo',
params: {
copyId: this.billId
}
});
}
}, },
handleClickPreview(index) { handleClickPreview(index) {
uni.previewImage({ uni.previewImage({
......
...@@ -156,6 +156,8 @@ ...@@ -156,6 +156,8 @@
}, },
data() { data() {
return { return {
copyId: '',
billId: '',
chooseMemberImage: billBaseUrl + 'tiaozhuantongxunlu@3x.png', chooseMemberImage: billBaseUrl + 'tiaozhuantongxunlu@3x.png',
loading: false, loading: false,
buttonLoading: false, buttonLoading: false,
...@@ -216,13 +218,15 @@ ...@@ -216,13 +218,15 @@
onLoad(options) { onLoad(options) {
// 测试数据 // 测试数据
// options.billId = '1550685581418168320' // options.billId = '1550685581418168320'
if (options && options.copyId) {
this.copyId = options.copyId;
}
if (options && options.billId) { if (options && options.billId) {
this.billId = options.billId; this.billId = options.billId;
} }
if (this.billId) { if (this.billId || this.copyId) {
this.repairDetail(); this.repairDetail(this.billId || this.copyId);
} }
// uni.$on('maintain-bill-detail', res => { // uni.$on('maintain-bill-detail', res => {
// this.repairDetail(); // this.repairDetail();
...@@ -247,10 +251,10 @@ ...@@ -247,10 +251,10 @@
this.form.customerPhone = item.phone; this.form.customerPhone = item.phone;
this.showMember = false; this.showMember = false;
}, },
repairDetail() { repairDetail(id) {
this.loading = true; this.loading = true;
repairDetail({ repairDetail({
id: this.billId id: id
}) })
.then(res => { .then(res => {
if (res.data) { if (res.data) {
...@@ -264,10 +268,10 @@ ...@@ -264,10 +268,10 @@
}, },
setForm(data) { setForm(data) {
this.form = { this.form = {
id: data.id,
actualAmount: data.actualAmount, actualAmount: data.actualAmount,
customerName: data.customerName, customerName: data.customer.name,
customerPhone: data.customerPhone, customerPhone: data.customer.phone,
remark: data.remark,
extend: { extend: {
collectionReason: data.extend.collectionReason, collectionReason: data.extend.collectionReason,
collectionTime: data.extend.collectionTime, collectionTime: data.extend.collectionTime,
...@@ -277,6 +281,13 @@ ...@@ -277,6 +281,13 @@
receivableAmount: data.receivableAmount, receivableAmount: data.receivableAmount,
type: data.type || 'collection', // 收据样式 type: data.type || 'collection', // 收据样式
}; };
if (this.billId) {
this.form.id = data.id
this.form.copyId = ''
} else if (this.copyId) {
this.form.id = ''
this.form.copyId = data.id
}
}, },
handleSelectType(name) { handleSelectType(name) {
this.form.extend.payType = name this.form.extend.payType = name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment