This commit is contained in:
@@ -1083,11 +1083,10 @@
|
||||
}})
|
||||
</span>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="选择套餐" prop="package_ids">
|
||||
<ElFormItem label="选择套餐" prop="package_id">
|
||||
<ElSelect
|
||||
v-model="rechargeForm.package_ids"
|
||||
v-model="rechargeForm.package_id"
|
||||
placeholder="请选择套餐"
|
||||
multiple
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
@@ -1422,8 +1421,7 @@
|
||||
TransactionType,
|
||||
AssetWalletResponse,
|
||||
CreateOrderRequest,
|
||||
PackageResponse,
|
||||
PurchaseCheckRequest
|
||||
PackageResponse
|
||||
} from '@/types/api'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
@@ -1500,11 +1498,11 @@
|
||||
const rechargeLoading = ref(false)
|
||||
const rechargeFormRef = ref<FormInstance>()
|
||||
const rechargeForm = reactive({
|
||||
package_ids: [] as number[],
|
||||
package_id: 0,
|
||||
payment_method: 'wallet' as 'wallet' | 'offline'
|
||||
})
|
||||
const rechargeRules: FormRules = {
|
||||
package_ids: [{ required: true, message: '请选择套餐', trigger: 'change' }],
|
||||
package_id: [{ required: true, message: '请选择套餐', trigger: 'change' }],
|
||||
payment_method: [{ required: true, message: '请选择支付方式', trigger: 'change' }]
|
||||
}
|
||||
const packageOptions = ref<PackageResponse[]>([])
|
||||
@@ -2660,42 +2658,14 @@
|
||||
if (valid) {
|
||||
rechargeLoading.value = true
|
||||
try {
|
||||
// 获取订单类型和资源ID
|
||||
const orderType: 'single_card' | 'device' =
|
||||
cardInfo.value.asset_type === 'card' ? 'single_card' : 'device'
|
||||
const resourceId = cardInfo.value.asset_id
|
||||
// 获取资产标识符
|
||||
const identifier =
|
||||
cardInfo.value.asset_type === 'card' ? cardInfo.value.iccid : cardInfo.value.virtual_no
|
||||
|
||||
// 调用套餐购买预检接口
|
||||
const checkData: PurchaseCheckRequest = {
|
||||
order_type: orderType,
|
||||
resource_id: resourceId,
|
||||
package_ids: rechargeForm.package_ids
|
||||
}
|
||||
|
||||
const checkResponse = await OrderService.purchaseCheck(checkData)
|
||||
|
||||
// 检查预检结果
|
||||
if (checkResponse.code === 0 && checkResponse.data) {
|
||||
const checkResult = checkResponse.data
|
||||
|
||||
// 如果需要强充,显示确认对话框
|
||||
if (checkResult.need_force_recharge) {
|
||||
const confirmMessage = `${checkResult.message || '钱包余额不足'}\n\n套餐总价: ¥${(checkResult.total_package_amount! / 100).toFixed(2)}\n需要强充: ¥${(checkResult.force_recharge_amount! / 100).toFixed(2)}\n钱包到账: ¥${(checkResult.wallet_credit! / 100).toFixed(2)}\n实际支付: ¥${(checkResult.actual_payment! / 100).toFixed(2)}\n\n是否继续创建订单?`
|
||||
|
||||
await ElMessageBox.confirm(confirmMessage, '购买预检提示', {
|
||||
confirmButtonText: '继续创建',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 预检通过或用户确认后,创建订单
|
||||
// 创建订单
|
||||
const data: CreateOrderRequest = {
|
||||
identifier,
|
||||
package_ids: rechargeForm.package_ids,
|
||||
package_id: rechargeForm.package_id,
|
||||
payment_method: rechargeForm.payment_method
|
||||
}
|
||||
|
||||
@@ -2731,7 +2701,7 @@
|
||||
// 关闭充值对话框
|
||||
const handleRechargeDialogClosed = () => {
|
||||
rechargeFormRef.value?.resetFields()
|
||||
rechargeForm.package_ids = []
|
||||
rechargeForm.package_id = 0
|
||||
rechargeForm.payment_method = 'wallet'
|
||||
packageOptions.value = []
|
||||
}
|
||||
|
||||
@@ -235,6 +235,78 @@
|
||||
</template>
|
||||
</ArtTable>
|
||||
</ElTabPane>
|
||||
|
||||
<!-- 预充值钱包流水 Tab -->
|
||||
<ElTabPane label="预充值钱包流水" name="mainWallet">
|
||||
<ArtTable
|
||||
ref="mainWalletTableRef"
|
||||
row-key="id"
|
||||
:loading="mainWalletLoading"
|
||||
:data="mainWalletRecords"
|
||||
:currentPage="mainWalletPagination.page"
|
||||
:pageSize="mainWalletPagination.pageSize"
|
||||
:total="mainWalletPagination.total"
|
||||
:marginTop="10"
|
||||
:height="500"
|
||||
@size-change="handleMainWalletSizeChange"
|
||||
@current-change="handleMainWalletCurrentChange"
|
||||
>
|
||||
<template #default>
|
||||
<ElTableColumn label="交易类型" prop="transaction_type" width="120">
|
||||
<template #default="scope">
|
||||
<ElTag
|
||||
:type="
|
||||
scope.row.transaction_type === 'recharge'
|
||||
? 'success'
|
||||
: scope.row.transaction_type === 'deduct'
|
||||
? 'warning'
|
||||
: 'info'
|
||||
"
|
||||
>
|
||||
{{
|
||||
scope.row.transaction_type === 'recharge'
|
||||
? '充值入账'
|
||||
: scope.row.transaction_type === 'deduct'
|
||||
? '套餐扣款'
|
||||
: scope.row.transaction_type === 'refund'
|
||||
? '退款'
|
||||
: scope.row.transaction_type
|
||||
}}
|
||||
</ElTag>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="交易金额" prop="amount" width="120">
|
||||
<template #default="scope">
|
||||
<span
|
||||
:style="{
|
||||
fontWeight: 500,
|
||||
color:
|
||||
scope.row.amount > 0 ? 'var(--el-color-success)' : 'var(--el-color-danger)'
|
||||
}"
|
||||
>
|
||||
{{ scope.row.amount > 0 ? '+' : '' }}{{ formatMoney(scope.row.amount) }}
|
||||
</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="交易前余额" prop="balance_before" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatMoney(scope.row.balance_before) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="交易后余额" prop="balance_after" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatMoney(scope.row.balance_after) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="备注" prop="remark" min-width="200" show-overflow-tooltip />
|
||||
<ElTableColumn label="交易时间" prop="created_at" width="180">
|
||||
<template #default="scope">
|
||||
{{ formatDateTime(scope.row.created_at) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</template>
|
||||
</ArtTable>
|
||||
</ElTabPane>
|
||||
</ElTabs>
|
||||
</ElDrawer>
|
||||
|
||||
@@ -303,10 +375,11 @@
|
||||
import { ElMessage, ElMessageBox, ElTag } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type {
|
||||
ShopCommissionSummaryItem,
|
||||
ShopFundSummaryItem,
|
||||
ShopCommissionRecordItem,
|
||||
WithdrawalRequestItem,
|
||||
CommissionResolveAction
|
||||
CommissionResolveAction,
|
||||
MainWalletTransactionItem
|
||||
} from '@/types/api/commission'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
@@ -328,7 +401,7 @@
|
||||
// 主表格状态
|
||||
const loading = ref(false)
|
||||
const tableRef = ref()
|
||||
const summaryList = ref<ShopCommissionSummaryItem[]>([])
|
||||
const summaryList = ref<ShopFundSummaryItem[]>([])
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
@@ -345,8 +418,8 @@
|
||||
|
||||
// 详情抽屉状态
|
||||
const detailDrawerVisible = ref(false)
|
||||
const activeTab = ref<'commission' | 'withdrawal'>('commission')
|
||||
const currentShop = ref<ShopCommissionSummaryItem | null>(null)
|
||||
const activeTab = ref<'commission' | 'withdrawal' | 'mainWallet'>('commission')
|
||||
const currentShop = ref<ShopFundSummaryItem | null>(null)
|
||||
|
||||
// 佣金明细状态
|
||||
const commissionLoading = ref(false)
|
||||
@@ -396,12 +469,23 @@
|
||||
remark: [{ max: 500, message: '备注最多500字符', trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
// 预充值钱包流水状态
|
||||
const mainWalletLoading = ref(false)
|
||||
const mainWalletTableRef = ref()
|
||||
const mainWalletRecords = ref<MainWalletTransactionItem[]>([])
|
||||
const mainWalletPagination = reactive({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
// 列配置
|
||||
const columnOptions = [
|
||||
{ label: '店铺编码', prop: 'shop_code' },
|
||||
{ label: '店铺名称', prop: 'shop_name' },
|
||||
{ label: '用户名', prop: 'username' },
|
||||
{ label: '手机号', prop: 'phone' },
|
||||
{ label: '预充值余额', prop: 'main_balance' },
|
||||
{ label: '总佣金', prop: 'total_commission' },
|
||||
{ label: '可提现', prop: 'available_commission' },
|
||||
{ label: '冻结中', prop: 'frozen_commission' },
|
||||
@@ -411,7 +495,7 @@
|
||||
]
|
||||
|
||||
// 处理名称点击
|
||||
const handleNameClick = (row: ShopCommissionSummaryItem) => {
|
||||
const handleNameClick = (row: ShopFundSummaryItem) => {
|
||||
if (hasAuth('agent_commission:detail')) {
|
||||
showDetail(row)
|
||||
} else {
|
||||
@@ -431,7 +515,7 @@
|
||||
label: '店铺名称',
|
||||
minWidth: 180,
|
||||
showOverflowTooltip: true,
|
||||
formatter: (row: ShopCommissionSummaryItem) => {
|
||||
formatter: (row: ShopFundSummaryItem) => {
|
||||
return h(
|
||||
'span',
|
||||
{
|
||||
@@ -455,17 +539,29 @@
|
||||
label: '手机号',
|
||||
width: 130
|
||||
},
|
||||
{
|
||||
prop: 'main_balance',
|
||||
label: '预充值余额',
|
||||
width: 130,
|
||||
formatter: (row: ShopFundSummaryItem) => {
|
||||
return h(
|
||||
'span',
|
||||
{ style: 'color: var(--el-color-primary); font-weight: 500' },
|
||||
formatMoney(row.main_balance)
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'total_commission',
|
||||
label: '总佣金',
|
||||
width: 120,
|
||||
formatter: (row: ShopCommissionSummaryItem) => formatMoney(row.total_commission)
|
||||
formatter: (row: ShopFundSummaryItem) => formatMoney(row.total_commission)
|
||||
},
|
||||
{
|
||||
prop: 'available_commission',
|
||||
label: '可提现',
|
||||
width: 120,
|
||||
formatter: (row: ShopCommissionSummaryItem) => {
|
||||
formatter: (row: ShopFundSummaryItem) => {
|
||||
return h(
|
||||
'span',
|
||||
{ style: 'color: var(--el-color-success); font-weight: 500' },
|
||||
@@ -477,13 +573,13 @@
|
||||
prop: 'frozen_commission',
|
||||
label: '冻结中',
|
||||
width: 120,
|
||||
formatter: (row: ShopCommissionSummaryItem) => formatMoney(row.frozen_commission)
|
||||
formatter: (row: ShopFundSummaryItem) => formatMoney(row.frozen_commission)
|
||||
},
|
||||
{
|
||||
prop: 'withdrawing_commission',
|
||||
label: '提现中',
|
||||
width: 120,
|
||||
formatter: (row: ShopCommissionSummaryItem) => {
|
||||
formatter: (row: ShopFundSummaryItem) => {
|
||||
return h(
|
||||
'span',
|
||||
{ style: 'color: var(--el-color-warning)' },
|
||||
@@ -495,13 +591,13 @@
|
||||
prop: 'withdrawn_commission',
|
||||
label: '已提现',
|
||||
width: 120,
|
||||
formatter: (row: ShopCommissionSummaryItem) => formatMoney(row.withdrawn_commission)
|
||||
formatter: (row: ShopFundSummaryItem) => formatMoney(row.withdrawn_commission)
|
||||
},
|
||||
{
|
||||
prop: 'unwithdraw_commission',
|
||||
label: '未提现',
|
||||
width: 120,
|
||||
formatter: (row: ShopCommissionSummaryItem) => formatMoney(row.unwithdraw_commission)
|
||||
formatter: (row: ShopFundSummaryItem) => formatMoney(row.unwithdraw_commission)
|
||||
}
|
||||
])
|
||||
|
||||
@@ -519,7 +615,7 @@
|
||||
shop_name: searchForm.shop_name || undefined,
|
||||
shop_code: searchForm.shop_code || undefined
|
||||
}
|
||||
const res = await CommissionService.getShopCommissionSummary(params)
|
||||
const res = await CommissionService.getShopFundSummary(params)
|
||||
if (res.code === 0) {
|
||||
summaryList.value = res.data.items || []
|
||||
pagination.total = res.data.total || 0
|
||||
@@ -563,7 +659,7 @@
|
||||
}
|
||||
|
||||
// 显示详情抽屉
|
||||
const showDetail = (row: ShopCommissionSummaryItem) => {
|
||||
const showDetail = (row: ShopFundSummaryItem) => {
|
||||
currentShop.value = row
|
||||
detailDrawerVisible.value = true
|
||||
activeTab.value = 'commission'
|
||||
@@ -571,13 +667,14 @@
|
||||
// 重置分页
|
||||
commissionPagination.page = 1
|
||||
withdrawalPagination.page = 1
|
||||
mainWalletPagination.page = 1
|
||||
|
||||
// 加载佣金明细
|
||||
loadCommissionRecords()
|
||||
}
|
||||
|
||||
// 获取操作按钮
|
||||
const getActions = (row: ShopCommissionSummaryItem) => {
|
||||
const getActions = (row: ShopFundSummaryItem) => {
|
||||
const actions: any[] = []
|
||||
|
||||
if (hasAuth('agent_commission:detail')) {
|
||||
@@ -597,6 +694,8 @@
|
||||
loadCommissionRecords()
|
||||
} else if (newTab === 'withdrawal') {
|
||||
loadWithdrawalRecords()
|
||||
} else if (newTab === 'mainWallet') {
|
||||
loadMainWalletRecords()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -691,6 +790,43 @@
|
||||
loadWithdrawalRecords()
|
||||
}
|
||||
|
||||
// 加载预充值钱包流水
|
||||
const loadMainWalletRecords = async () => {
|
||||
if (!currentShop.value) return
|
||||
|
||||
mainWalletLoading.value = true
|
||||
try {
|
||||
const params = {
|
||||
page: mainWalletPagination.page,
|
||||
pageSize: mainWalletPagination.pageSize
|
||||
}
|
||||
const res = await CommissionService.getMainWalletTransactions(
|
||||
currentShop.value.shop_id,
|
||||
params
|
||||
)
|
||||
if (res.code === 0) {
|
||||
mainWalletRecords.value = res.data.items || []
|
||||
mainWalletPagination.total = res.data.total || 0
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
ElMessage.error('获取预充值钱包流水失败')
|
||||
} finally {
|
||||
mainWalletLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 预充值钱包流水分页
|
||||
const handleMainWalletSizeChange = (newPageSize: number) => {
|
||||
mainWalletPagination.pageSize = newPageSize
|
||||
loadMainWalletRecords()
|
||||
}
|
||||
|
||||
const handleMainWalletCurrentChange = (newCurrentPage: number) => {
|
||||
mainWalletPagination.page = newCurrentPage
|
||||
loadMainWalletRecords()
|
||||
}
|
||||
|
||||
// 处理佣金修正
|
||||
const handleResolveCommission = (
|
||||
row: ShopCommissionRecordItem,
|
||||
|
||||
@@ -218,11 +218,19 @@
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { formatDateTime, formatMoney } from '@/utils/business/format'
|
||||
|
||||
defineOptions({ name: 'MyCommission' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 获取当前用户的 shop_id
|
||||
const currentShopId = computed(() => userStore.userInfo?.shop_id)
|
||||
|
||||
// 如果没有 shop_id,显示提示
|
||||
const hasShopId = computed(() => !!currentShopId.value)
|
||||
|
||||
// 标签页
|
||||
const activeTab = ref('commission')
|
||||
@@ -378,6 +386,11 @@
|
||||
|
||||
// 获取佣金明细
|
||||
const getCommissionList = async () => {
|
||||
if (!currentShopId.value) {
|
||||
ElMessage.warning('未找到店铺信息')
|
||||
return
|
||||
}
|
||||
|
||||
commissionLoading.value = true
|
||||
try {
|
||||
const params = {
|
||||
@@ -388,7 +401,7 @@
|
||||
start_time: commissionSearchForm.start_time || undefined,
|
||||
end_time: commissionSearchForm.end_time || undefined
|
||||
} as CommissionRecordQueryParams
|
||||
const res = await CommissionService.getMyCommissionRecords(params)
|
||||
const res = await CommissionService.getShopCommissionRecords(currentShopId.value, params)
|
||||
if (res.code === 0) {
|
||||
commissionList.value = res.data.items || []
|
||||
commissionPagination.total = res.data.total || 0
|
||||
@@ -566,6 +579,11 @@
|
||||
|
||||
// 获取提现记录
|
||||
const getWithdrawalList = async () => {
|
||||
if (!currentShopId.value) {
|
||||
ElMessage.warning('未找到店铺信息')
|
||||
return
|
||||
}
|
||||
|
||||
withdrawalLoading.value = true
|
||||
try {
|
||||
const params = {
|
||||
@@ -575,7 +593,7 @@
|
||||
start_time: withdrawalSearchForm.start_time || undefined,
|
||||
end_time: withdrawalSearchForm.end_time || undefined
|
||||
} as WithdrawalRequestQueryParams
|
||||
const res = await CommissionService.getMyWithdrawalRequests(params)
|
||||
const res = await CommissionService.getShopWithdrawalRequests(currentShopId.value, params)
|
||||
if (res.code === 0) {
|
||||
withdrawalList.value = res.data.items || []
|
||||
withdrawalPagination.total = res.data.total || 0
|
||||
@@ -695,6 +713,10 @@
|
||||
// 提交提现申请
|
||||
const handleSubmitWithdrawal = async () => {
|
||||
if (!withdrawalFormRef.value) return
|
||||
if (!currentShopId.value) {
|
||||
ElMessage.warning('未找到店铺信息')
|
||||
return
|
||||
}
|
||||
|
||||
await withdrawalFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
@@ -713,7 +735,7 @@
|
||||
params.bank_name = withdrawalForm.bank_name
|
||||
}
|
||||
|
||||
await CommissionService.submitWithdrawalRequest(params)
|
||||
await CommissionService.submitShopWithdrawalRequest(currentShopId.value, params)
|
||||
ElMessage.success('提现申请提交成功')
|
||||
withdrawalDialogVisible.value = false
|
||||
|
||||
@@ -735,10 +757,28 @@
|
||||
|
||||
// 加载佣金概览
|
||||
const loadSummary = async () => {
|
||||
if (!currentShopId.value) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await CommissionService.getMyCommissionSummary()
|
||||
if (res.code === 0) {
|
||||
summary.value = res.data
|
||||
// 调用 fund-summary 接口,通过 shop_id 过滤获取自己的数据
|
||||
const res = await CommissionService.getShopFundSummary({
|
||||
page: 1,
|
||||
pageSize: 1
|
||||
})
|
||||
if (res.code === 0 && res.data.items && res.data.items.length > 0) {
|
||||
// 从结果中找到当前用户的店铺数据
|
||||
const myShopData = res.data.items.find(item => item.shop_id === currentShopId.value)
|
||||
if (myShopData) {
|
||||
summary.value = {
|
||||
total_commission: myShopData.total_commission,
|
||||
available_commission: myShopData.available_commission,
|
||||
frozen_commission: myShopData.frozen_commission,
|
||||
withdrawing_commission: myShopData.withdrawing_commission,
|
||||
withdrawn_commission: myShopData.withdrawn_commission
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@@ -755,6 +795,10 @@
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (!hasShopId.value) {
|
||||
ElMessage.warning('当前账号未关联店铺,无法查看佣金信息')
|
||||
return
|
||||
}
|
||||
loadSummary()
|
||||
getCommissionList()
|
||||
})
|
||||
|
||||
@@ -87,10 +87,16 @@
|
||||
<script setup lang="ts">
|
||||
import { CommissionService } from '@/api/modules'
|
||||
import type { MyCommissionSummary } from '@/types/api/commission'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { formatMoney } from '@/utils/business/format'
|
||||
|
||||
defineOptions({ name: 'CommissionSummaryWidget' })
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 获取当前用户的 shop_id
|
||||
const currentShopId = computed(() => userStore.userInfo?.shop_id)
|
||||
|
||||
// 错误信息
|
||||
const errorMsg = ref<string>('')
|
||||
|
||||
@@ -105,13 +111,33 @@
|
||||
|
||||
// 加载佣金概览
|
||||
const loadSummary = async () => {
|
||||
if (!currentShopId.value) {
|
||||
errorMsg.value = '当前账号未关联店铺'
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await CommissionService.getMyCommissionSummary()
|
||||
if (res.code === 0) {
|
||||
summary.value = res.data
|
||||
errorMsg.value = ''
|
||||
// 调用 fund-summary 接口,通过 shop_id 过滤获取自己的数据
|
||||
const res = await CommissionService.getShopFundSummary({
|
||||
page: 1,
|
||||
pageSize: 1
|
||||
})
|
||||
if (res.code === 0 && res.data.items && res.data.items.length > 0) {
|
||||
// 从结果中找到当前用户的店铺数据
|
||||
const myShopData = res.data.items.find(item => item.shop_id === currentShopId.value)
|
||||
if (myShopData) {
|
||||
summary.value = {
|
||||
total_commission: myShopData.total_commission,
|
||||
available_commission: myShopData.available_commission,
|
||||
frozen_commission: myShopData.frozen_commission,
|
||||
withdrawing_commission: myShopData.withdrawing_commission,
|
||||
withdrawn_commission: myShopData.withdrawn_commission
|
||||
}
|
||||
errorMsg.value = ''
|
||||
} else {
|
||||
errorMsg.value = '未找到佣金数据'
|
||||
}
|
||||
} else {
|
||||
// 显示错误信息
|
||||
errorMsg.value = res.msg || '获取佣金概览失败'
|
||||
}
|
||||
} catch (error: any) {
|
||||
|
||||
@@ -120,11 +120,10 @@
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<ElFormItem :label="'套餐'" prop="package_ids">
|
||||
<ElFormItem :label="'套餐'" prop="package_id">
|
||||
<ElSelect
|
||||
v-model="createForm.package_ids"
|
||||
v-model="createForm.package_id"
|
||||
:placeholder="'请选择套餐'"
|
||||
multiple
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
@@ -300,8 +299,7 @@
|
||||
OrderCommissionStatus,
|
||||
StandaloneIotCard,
|
||||
Device,
|
||||
PackageResponse,
|
||||
PurchaseCheckRequest
|
||||
PackageResponse
|
||||
} from '@/types/api'
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
@@ -531,7 +529,7 @@
|
||||
|
||||
const createForm = reactive<CreateOrderRequest>({
|
||||
order_type: 'single_card',
|
||||
package_ids: [],
|
||||
package_id: 0,
|
||||
iot_card_id: null,
|
||||
device_id: null,
|
||||
payment_method: 'wallet', // 默认使用钱包支付
|
||||
@@ -977,7 +975,7 @@
|
||||
|
||||
// 重置表单数据到初始值
|
||||
createForm.order_type = 'single_card'
|
||||
createForm.package_ids = []
|
||||
createForm.package_id = 0
|
||||
createForm.iot_card_id = null
|
||||
createForm.device_id = null
|
||||
createForm.payment_method = 'wallet'
|
||||
@@ -1030,38 +1028,10 @@
|
||||
identifier = selectedDevice.virtual_no
|
||||
}
|
||||
|
||||
// 调用套餐购买预检接口
|
||||
const checkData: PurchaseCheckRequest = {
|
||||
order_type: createForm.order_type!,
|
||||
resource_id:
|
||||
createForm.order_type === 'single_card'
|
||||
? createForm.iot_card_id!
|
||||
: createForm.device_id!,
|
||||
package_ids: createForm.package_ids
|
||||
}
|
||||
|
||||
const checkResponse = await OrderService.purchaseCheck(checkData)
|
||||
|
||||
// 检查预检结果
|
||||
if (checkResponse.code === 0 && checkResponse.data) {
|
||||
const checkResult = checkResponse.data
|
||||
|
||||
// 如果需要强充,显示确认对话框
|
||||
if (checkResult.need_force_recharge) {
|
||||
const confirmMessage = `${checkResult.message || '钱包余额不足'}\n\n套餐总价: ¥${(checkResult.total_package_amount! / 100).toFixed(2)}\n需要强充: ¥${(checkResult.force_recharge_amount! / 100).toFixed(2)}\n钱包到账: ¥${(checkResult.wallet_credit! / 100).toFixed(2)}\n实际支付: ¥${(checkResult.actual_payment! / 100).toFixed(2)}\n\n是否继续创建订单?`
|
||||
|
||||
await ElMessageBox.confirm(confirmMessage, '购买预检提示', {
|
||||
confirmButtonText: '继续创建',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 预检通过或用户确认后,创建订单
|
||||
// 创建订单
|
||||
const data: CreateOrderRequest = {
|
||||
identifier,
|
||||
package_ids: createForm.package_ids,
|
||||
package_id: createForm.package_id,
|
||||
payment_method: createForm.payment_method
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user