Commit eb4bc7fe authored by daniel's avatar daniel

feat(guide): 页面优化+1

parent dea22533
......@@ -174,8 +174,6 @@
c.city as city,
c.province as province,
c.area as area,
c.cmpt_status as cmptStatus,
c.audit_status as auditStatus,
c.location as location
from gk_cmpt a left join common.neucmpt b on a.cmpt_id=b.gtCmptId
left join raceenroll.competition c on b.gcmptid=c.cmptid
......
......@@ -136,7 +136,7 @@
</n-tabs>
</div>
<div class="ml-auto" v-if="!isConfigTab">
<n-input v-model:value="query.markNo" placeholder="请输入参赛号" :clearable="true" @change="fetchOrders" />
<n-input v-model:value="query.markNo" placeholder="请输入参赛号" :clearable="true" @change="fetchOrders(true)" />
</div>
</div>
<div class="w-full gap-x-2 flex flex-row items-center mt-3">
......@@ -144,6 +144,9 @@
<n-button type="error" @click="refundAll">
一键退款
</n-button>
<n-button type="success" @click="exportOrder">
一键导出
</n-button>
<n-button v-if="checkedRowKeys.length" @click="batchRefund" type="error">
批量退款{{checkedRowKeys.length>0?'(已选择'+checkedRowKeys.length+'条订单)':''}}
</n-button>
......@@ -478,6 +481,8 @@
const ORDER_REFUND_ALL_URL = BASE_ECC_URL + "/api-refund/v1/refund-all"
// 编辑订单
const EDIT_ORDER_URL = BASE_ECC_URL + "/api-order/v1/edit"
// 导出名单
const EXPORT_ORDER = BASE_ECC_URL + "/api-order/v1/export-order"
// qr二维码
const qrCodeUrl = window.location.origin + '/gk/wechatMini/wxQrCode'
// 一键退款
......@@ -760,7 +765,6 @@
const pagination = reactive({
pageSize: 20,
page: 1,
pageCount: 0,
showSizePicker: true,
itemCount: 0,
pageSizes: [20, 50, 200, 500],
......@@ -868,9 +872,10 @@
}
}
// 获取自助选号分页列表
const fetchOrders = async () => {
const fetchOrders = async (isReset = false) => {
orders.value = []
loading.value = true
pagination.page = isReset ? 1 : pagination.page
let params = {
...query,
current: pagination.page,
......@@ -1182,6 +1187,56 @@
showRefundModal.value = true
refundOrderValue.refundAmount = depositForm.value.amount
}
const exportOrder = async () => {
loading.value = true
try {
const response = await fetch(EXPORT_ORDER, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
tradeStatus: query.tradeStatus,
orderType: 1,
cmptId: getCId()
})
})
if (!response.ok) {
throw new Error('导出失败')
}
// ⭐ 关键:转成 blob
const blob = await response.blob()
const status = tradeStatusOptions.value.find(item => item.value === query.tradeStatus)?.name || '_所有'
// 从 header 中取文件名(可选但推荐)
const contentDisposition = response.headers.get('content-disposition')
let filename = getCId() + status + '订单_' + new Date().getTime() + '.xlsx'
if (contentDisposition) {
const match = contentDisposition.match(/filename\*=UTF-8''(.+)/)
if (match) filename = decodeURIComponent(match[1])
}
// 触发下载
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = filename
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
window.URL.revokeObjectURL(url)
message.success('导出成功')
} catch (err) {
message.error(err.message || '导出失败')
} finally {
loading.value = false
}
}
// 一键退款
const refundAll = async () => {
const confirmFlag = confirm('是否确定发起一键退款,该操作会将已归还设备的押金全额退款?')
......@@ -1264,6 +1319,7 @@
getDeposit,
batchRefund,
refundAll,
exportOrder,
// 编辑相关
editOrderValue,
editOrderRules,
......
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