挂账记录重置更新

This commit is contained in:
GaoHao 2024-11-27 14:01:58 +08:00
parent e62ff19b5f
commit 971cdd8f36
3 changed files with 20 additions and 4 deletions

View File

@ -38,6 +38,18 @@ export function addCreditBuyer(data) {
})
}
/**
* 编辑挂账人
* @returns
*/
export function editCreditBuyer(data) {
return request({
url: '/api/credit/buyer',
method: 'put',
data
})
}
/**
* 还款
* @returns

View File

@ -127,7 +127,7 @@ export default {
* 重置
*/
reset() {
this.query = { ...this.resetQuery }
this.query.paymentMethod = ''
this.getTableData()
}
}

View File

@ -50,7 +50,7 @@
</template>
<script>
import { addCreditBuyer } from '@/api/credit'
import { addCreditBuyer, editCreditBuyer } from '@/api/credit'
export default {
// eslint-disable-next-line vue/require-prop-types
@ -131,8 +131,12 @@ export default {
try {
this.loading = true
if (!this.form.shopId) { this.form.shopId = localStorage.getItem('shopId') }
// eslint-disable-next-line no-unused-vars, prefer-const
let res = await addCreditBuyer(this.form)
let res
if (!this.form.id) {
res = await addCreditBuyer(this.form)
} else {
res = await editCreditBuyer(this.form)
}
this.$notify({
title: '成功',
message: `${this.form.id ? '编辑' : '添加'}成功`,