增加一个渠道绑定
This commit is contained in:
@@ -140,25 +140,17 @@
|
||||
size="78%"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
@closed="editing = false"
|
||||
>
|
||||
<pay-config-detail
|
||||
v-loading="detailLoading || !!savingRowKey"
|
||||
v-loading="detailLoading"
|
||||
:product="detail"
|
||||
:editable="editing"
|
||||
:editable="true"
|
||||
:saving-row-key="savingRowKey"
|
||||
@save-row="saveProductRow"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="detailVisible = false">关闭</el-button>
|
||||
<el-button v-if="detail" @click="downloadSource(detail)" v-hasPermi="['price:pay:query']">下载源文件</el-button>
|
||||
<el-button
|
||||
v-if="!editing"
|
||||
type="primary"
|
||||
@click="editing = true"
|
||||
v-hasPermi="['price:pay:import']"
|
||||
>编辑</el-button>
|
||||
<el-button v-else @click="editing = false">完成</el-button>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</div>
|
||||
@@ -174,7 +166,6 @@ const tableRef = ref()
|
||||
const importRef = ref()
|
||||
const detailVisible = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const editing = ref(false)
|
||||
const savingRowKey = ref('')
|
||||
const detail = ref(null)
|
||||
const historyVisible = ref(false)
|
||||
@@ -292,7 +283,6 @@ function handleDelete(ids) {
|
||||
|
||||
function openDetail(row) {
|
||||
detailVisible.value = true
|
||||
editing.value = false
|
||||
savingRowKey.value = ''
|
||||
detailLoading.value = true
|
||||
detail.value = null
|
||||
@@ -303,25 +293,34 @@ function openDetail(row) {
|
||||
})
|
||||
}
|
||||
|
||||
function saveProductRow(payload) {
|
||||
if (!detail.value || savingRowKey.value) return
|
||||
async function saveProductRow(payload) {
|
||||
if (!detail.value || savingRowKey.value) {
|
||||
payload?.done?.(false)
|
||||
return
|
||||
}
|
||||
cleanMoney(detail.value)
|
||||
;(detail.value.surcharges || []).forEach(row => {
|
||||
if (row.amount === '') row.amount = null
|
||||
})
|
||||
const productId = detail.value.productId
|
||||
savingRowKey.value = payload?.rowKey || 'row'
|
||||
updatePay(detail.value).then(() => {
|
||||
let ok = false
|
||||
try {
|
||||
await updatePay(detail.value)
|
||||
ok = true
|
||||
proxy.$modal.msgSuccess('该行已保存')
|
||||
if (!productId) return
|
||||
return getPay(productId).then(res => {
|
||||
if (res.data) detail.value = res.data
|
||||
})
|
||||
}).then(() => {
|
||||
tableRef.value?.refresh()
|
||||
}).finally(() => {
|
||||
} catch (e) {
|
||||
ok = false
|
||||
} finally {
|
||||
savingRowKey.value = ''
|
||||
})
|
||||
payload?.done?.(ok)
|
||||
}
|
||||
if (!ok || !productId) return
|
||||
try {
|
||||
const res = await getPay(productId)
|
||||
if (res.data) detail.value = res.data
|
||||
tableRef.value?.refresh()
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function cleanMoney(product) {
|
||||
|
||||
Reference in New Issue
Block a user