|
|
@ -8,46 +8,23 @@ |
|
|
</el-button> |
|
|
</el-button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<el-card |
|
|
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never"> |
|
|
class="box-card !border-none my-[10px] table-search-wrap" |
|
|
<el-form :inline="true" :model="orderTableTable.searchParam" ref="searchFormRef"> |
|
|
shadow="never" |
|
|
|
|
|
> |
|
|
|
|
|
<el-form |
|
|
|
|
|
:inline="true" |
|
|
|
|
|
:model="orderTableTable.searchParam" |
|
|
|
|
|
ref="searchFormRef" |
|
|
|
|
|
> |
|
|
|
|
|
<el-form-item :label="t('orderStatus')" prop="order_status"> |
|
|
<el-form-item :label="t('orderStatus')" prop="order_status"> |
|
|
<el-select |
|
|
<el-select class="w-[280px]" v-model="orderTableTable.searchParam.order_status" clearable |
|
|
class="w-[280px]" |
|
|
:placeholder="t('orderStatusPlaceholder')"> |
|
|
v-model="orderTableTable.searchParam.order_status" |
|
|
|
|
|
clearable |
|
|
|
|
|
:placeholder="t('orderStatusPlaceholder')" |
|
|
|
|
|
> |
|
|
|
|
|
<el-option label="全部" value=""></el-option> |
|
|
<el-option label="全部" value=""></el-option> |
|
|
<el-option |
|
|
<el-option v-for="(item, index) in order_statusList" :key="index" :label="item.name" |
|
|
v-for="(item, index) in order_statusList" |
|
|
:value="item.value" /> |
|
|
:key="index" |
|
|
|
|
|
:label="item.name" |
|
|
|
|
|
:value="item.value" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
<el-form-item :label="t('paymentType')" prop="payment_type"> |
|
|
<el-form-item :label="t('paymentType')" prop="payment_type"> |
|
|
<el-select |
|
|
<el-select class="w-[280px]" v-model="orderTableTable.searchParam.payment_type" clearable |
|
|
class="w-[280px]" |
|
|
:placeholder="t('paymentTypePlaceholder')"> |
|
|
v-model="orderTableTable.searchParam.payment_type" |
|
|
|
|
|
clearable |
|
|
|
|
|
:placeholder="t('paymentTypePlaceholder')" |
|
|
|
|
|
> |
|
|
|
|
|
<el-option label="全部" value=""></el-option> |
|
|
<el-option label="全部" value=""></el-option> |
|
|
<el-option |
|
|
<el-option v-for="(item, index) in payment_typeList" :key="index" :label="item.name" |
|
|
v-for="(item, index) in payment_typeList" |
|
|
:value="item.value" /> |
|
|
:key="index" |
|
|
|
|
|
:label="item.name" |
|
|
|
|
|
:value="item.value" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
@ -63,27 +40,15 @@ |
|
|
</el-card> |
|
|
</el-card> |
|
|
|
|
|
|
|
|
<div class="mt-[10px]"> |
|
|
<div class="mt-[10px]"> |
|
|
<el-table |
|
|
<el-table :data="orderTableTable.data" size="large" v-loading="orderTableTable.loading"> |
|
|
:data="orderTableTable.data" |
|
|
|
|
|
size="large" |
|
|
|
|
|
v-loading="orderTableTable.loading" |
|
|
|
|
|
> |
|
|
|
|
|
<template #empty> |
|
|
<template #empty> |
|
|
<span>{{ !orderTableTable.loading ? t('emptyData') : '' }}</span> |
|
|
<span>{{ !orderTableTable.loading ? t('emptyData') : '' }}</span> |
|
|
</template> |
|
|
</template> |
|
|
<el-table-column |
|
|
<el-table-column prop="resource_id_name" :label="t('resourceId')" min-width="120" |
|
|
prop="resource_id_name" |
|
|
:show-overflow-tooltip="true" /> |
|
|
:label="t('resourceId')" |
|
|
|
|
|
min-width="120" |
|
|
<el-table-column :label="t('orderStatus')" min-width="180" align="center" |
|
|
:show-overflow-tooltip="true" |
|
|
:show-overflow-tooltip="true"> |
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<el-table-column |
|
|
|
|
|
:label="t('orderStatus')" |
|
|
|
|
|
min-width="180" |
|
|
|
|
|
align="center" |
|
|
|
|
|
:show-overflow-tooltip="true" |
|
|
|
|
|
> |
|
|
|
|
|
<template #default="{ row }"> |
|
|
<template #default="{ row }"> |
|
|
<div v-for="(item, index) in order_statusList"> |
|
|
<div v-for="(item, index) in order_statusList"> |
|
|
<div v-if="item.value == row.order_status">{{ item.name }}</div> |
|
|
<div v-if="item.value == row.order_status">{{ item.name }}</div> |
|
|
@ -91,12 +56,8 @@ |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
<el-table-column |
|
|
<el-table-column :label="t('paymentType')" min-width="180" align="center" |
|
|
:label="t('paymentType')" |
|
|
:show-overflow-tooltip="true"> |
|
|
min-width="180" |
|
|
|
|
|
align="center" |
|
|
|
|
|
:show-overflow-tooltip="true" |
|
|
|
|
|
> |
|
|
|
|
|
<template #default="{ row }"> |
|
|
<template #default="{ row }"> |
|
|
<div v-for="(item, index) in payment_typeList"> |
|
|
<div v-for="(item, index) in payment_typeList"> |
|
|
<div v-if="item.value == row.payment_type">{{ item.name }}</div> |
|
|
<div v-if="item.value == row.payment_type">{{ item.name }}</div> |
|
|
@ -104,47 +65,26 @@ |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
<el-table-column |
|
|
<el-table-column prop="order_amount" :label="t('orderAmount')" min-width="120" |
|
|
prop="order_amount" |
|
|
:show-overflow-tooltip="true" /> |
|
|
:label="t('orderAmount')" |
|
|
|
|
|
min-width="120" |
|
|
<el-table-column prop="course_id_name" :label="t('courseId')" min-width="120" |
|
|
:show-overflow-tooltip="true" |
|
|
:show-overflow-tooltip="true" /> |
|
|
/> |
|
|
|
|
|
|
|
|
<el-table-column prop="class_id_name" :label="t('classId')" min-width="120" |
|
|
<el-table-column |
|
|
:show-overflow-tooltip="true" /> |
|
|
prop="course_id_name" |
|
|
|
|
|
:label="t('courseId')" |
|
|
<el-table-column prop="staff_id_name" :label="t('staffId')" min-width="120" |
|
|
min-width="120" |
|
|
:show-overflow-tooltip="true" /> |
|
|
:show-overflow-tooltip="true" |
|
|
|
|
|
/> |
|
|
<el-table-column prop="payment_time" :label="t('paymentTime')" min-width="120" |
|
|
|
|
|
:show-overflow-tooltip="true" /> |
|
|
<el-table-column |
|
|
|
|
|
prop="class_id_name" |
|
|
<el-table-column :label="t('operation')" fixed="right" min-width="120"> |
|
|
:label="t('classId')" |
|
|
|
|
|
min-width="120" |
|
|
|
|
|
:show-overflow-tooltip="true" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<el-table-column |
|
|
|
|
|
prop="staff_id_name" |
|
|
|
|
|
:label="t('staffId')" |
|
|
|
|
|
min-width="120" |
|
|
|
|
|
:show-overflow-tooltip="true" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<el-table-column |
|
|
|
|
|
prop="payment_time" |
|
|
|
|
|
:label="t('paymentTime')" |
|
|
|
|
|
min-width="120" |
|
|
|
|
|
:show-overflow-tooltip="true" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<el-table-column |
|
|
|
|
|
:label="t('operation')" |
|
|
|
|
|
fixed="right" |
|
|
|
|
|
min-width="120" |
|
|
|
|
|
> |
|
|
|
|
|
<template #default="{ row }"> |
|
|
<template #default="{ row }"> |
|
|
|
|
|
|
|
|
|
|
|
<el-button type="primary" link @click="startPayment(row.id)" v-if="row.order_status == 'pending'">支付</el-button> |
|
|
|
|
|
|
|
|
<el-button type="primary" link @click="editEvent(row)">{{ |
|
|
<el-button type="primary" link @click="editEvent(row)">{{ |
|
|
t('edit') |
|
|
t('edit') |
|
|
}}</el-button> |
|
|
}}</el-button> |
|
|
@ -155,24 +95,29 @@ |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
<div class="mt-[16px] flex justify-end"> |
|
|
<div class="mt-[16px] flex justify-end"> |
|
|
<el-pagination |
|
|
<el-pagination v-model:current-page="orderTableTable.page" v-model:page-size="orderTableTable.limit" |
|
|
v-model:current-page="orderTableTable.page" |
|
|
layout="total, sizes, prev, pager, next, jumper" :total="orderTableTable.total" |
|
|
v-model:page-size="orderTableTable.limit" |
|
|
@size-change="loadOrderTableList()" @current-change="loadOrderTableList" /> |
|
|
layout="total, sizes, prev, pager, next, jumper" |
|
|
|
|
|
:total="orderTableTable.total" |
|
|
|
|
|
@size-change="loadOrderTableList()" |
|
|
|
|
|
@current-change="loadOrderTableList" |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<edit ref="editOrderTableDialog" @complete="loadOrderTableList" /> |
|
|
<edit ref="editOrderTableDialog" @complete="loadOrderTableList" /> |
|
|
</el-card> |
|
|
</el-card> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-dialog v-model="showDialog" title="请扫码支付" width="320px" center @close="handleClose"> |
|
|
|
|
|
<div v-if="qrCodeUrl" class="qr-box"> |
|
|
|
|
|
<img :src="qrCodeUrl" alt="二维码" class="qr-img" /> |
|
|
|
|
|
<p class="pay-id">支付编号:{{ payId }}</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { reactive, ref, watch } from 'vue' |
|
|
import QrcodeVue from '@/app/views/order_table/components/qrcode.vue' |
|
|
|
|
|
import { reactive, ref, watch, onBeforeUnmount } from 'vue' |
|
|
import { t } from '@/lang' |
|
|
import { t } from '@/lang' |
|
|
import { useDictionary } from '@/app/api/dict' |
|
|
import { useDictionary } from '@/app/api/dict' |
|
|
import { |
|
|
import { |
|
|
@ -183,6 +128,12 @@ import { |
|
|
getWithClassGradeList, |
|
|
getWithClassGradeList, |
|
|
getWithPersonnelList, |
|
|
getWithPersonnelList, |
|
|
} from '@/app/api/order_table' |
|
|
} from '@/app/api/order_table' |
|
|
|
|
|
import { |
|
|
|
|
|
orderPay, |
|
|
|
|
|
checkPaymentStatus |
|
|
|
|
|
} from '@/app/api/pay' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { img } from '@/utils/common' |
|
|
import { img } from '@/utils/common' |
|
|
import { ElMessageBox, FormInstance } from 'element-plus' |
|
|
import { ElMessageBox, FormInstance } from 'element-plus' |
|
|
import Edit from '@/app/views/order_table/components/order-table-edit.vue' |
|
|
import Edit from '@/app/views/order_table/components/order-table-edit.vue' |
|
|
@ -190,6 +141,7 @@ import { useRoute } from 'vue-router' |
|
|
const route = useRoute() |
|
|
const route = useRoute() |
|
|
const pageName = route.meta.title |
|
|
const pageName = route.meta.title |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let orderTableTable = reactive({ |
|
|
let orderTableTable = reactive({ |
|
|
page: 1, |
|
|
page: 1, |
|
|
limit: 10, |
|
|
limit: 10, |
|
|
@ -199,9 +151,69 @@ let orderTableTable = reactive({ |
|
|
searchParam: { |
|
|
searchParam: { |
|
|
order_status: '', |
|
|
order_status: '', |
|
|
payment_type: '', |
|
|
payment_type: '', |
|
|
|
|
|
resource_id: route.query.resource_id ?? '' |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const showDialog = ref(false) |
|
|
|
|
|
const qrCodeUrl = ref('') |
|
|
|
|
|
const payId = ref('') |
|
|
|
|
|
let checkTimer: ReturnType<typeof setInterval> | null = null |
|
|
|
|
|
|
|
|
|
|
|
const startPayment = async (order_id : number) => { |
|
|
|
|
|
|
|
|
|
|
|
orderPay({ |
|
|
|
|
|
order_id: order_id |
|
|
|
|
|
}) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
qrCodeUrl.value = res.data.qrcode_url |
|
|
|
|
|
payId.value = res.data.out_trade_no |
|
|
|
|
|
showDialog.value = true |
|
|
|
|
|
|
|
|
|
|
|
// 开始轮询检查支付状态 |
|
|
|
|
|
startCheckingStatus() |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const startCheckingStatus = () => { |
|
|
|
|
|
if (checkTimer) clearInterval(checkTimer) |
|
|
|
|
|
checkTimer = setInterval(async () => { |
|
|
|
|
|
checkPaymentStatus({ |
|
|
|
|
|
out_trade_no: payId.value |
|
|
|
|
|
}) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
if (res.data.order_status === 'paid') { |
|
|
|
|
|
clearInterval(checkTimer!) |
|
|
|
|
|
showDialog.value = false |
|
|
|
|
|
handlePaymentSuccess() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
}, 3000) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleClose = () => { |
|
|
|
|
|
if (checkTimer) clearInterval(checkTimer) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const handlePaymentSuccess = () => { |
|
|
|
|
|
// 处理支付成功后的逻辑 |
|
|
|
|
|
loadOrderTableList(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onBeforeUnmount(() => { |
|
|
|
|
|
if (checkTimer) clearInterval(checkTimer) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const searchFormRef = ref<FormInstance>() |
|
|
const searchFormRef = ref<FormInstance>() |
|
|
|
|
|
|
|
|
// 选中数据 |
|
|
// 选中数据 |
|
|
@ -320,4 +332,32 @@ const resetForm = (formEl: FormInstance | undefined) => { |
|
|
-webkit-line-clamp: 2; |
|
|
-webkit-line-clamp: 2; |
|
|
-webkit-box-orient: vertical; |
|
|
-webkit-box-orient: vertical; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.qr-box { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
flex-direction: column; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
padding: 16px; |
|
|
|
|
|
background-color: #fdfdfd; |
|
|
|
|
|
border-radius: 12px; |
|
|
|
|
|
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); |
|
|
|
|
|
transition: all 0.3s ease-in-out; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.qr-img { |
|
|
|
|
|
width: 200px; |
|
|
|
|
|
height: 200px; |
|
|
|
|
|
border-radius: 8px; |
|
|
|
|
|
object-fit: contain; |
|
|
|
|
|
border: 1px solid #e5e5e5; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.pay-id { |
|
|
|
|
|
margin-top: 14px; |
|
|
|
|
|
font-size: 13px; |
|
|
|
|
|
color: #666; |
|
|
|
|
|
word-break: break-all; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |