feat(admin): full repair of order module including list, statistics, aftersales, cashier, and write-off records with real RPC integration

This commit is contained in:
comlibmb
2026-02-10 23:01:23 +08:00
parent 1d9915cd77
commit cd7b92d496
12 changed files with 397 additions and 138 deletions

View File

@@ -15,12 +15,12 @@
<view class="filter-item">
<text class="label-txt">订单号:</text>
<input class="search-input" placeholder="请输入订单号" v-model="orderId" />
<input class="search-input" placeholder="请输入订单号" v-model="orderId" @confirm="handleQuery" />
</view>
<view class="filter-item">
<text class="label-txt">用户名:</text>
<input class="search-input" placeholder="请输入用户名" v-model="username" />
<input class="search-input" placeholder="请输入用户名" v-model="username" @confirm="handleQuery" />
</view>
<view class="btn-query" @click="handleQuery">
@@ -47,11 +47,17 @@
</view>
<view class="table-body">
<view v-for="(item, index) in orderList" :key="index" class="table-row">
<view v-if="loading" class="table-loading" style="padding: 40px; text-align: center;">
<text>加载中...</text>
</view>
<view v-else-if="orderList.length === 0" class="table-empty" style="padding: 40px; text-align: center;">
<text>暂无收银订单</text>
</view>
<view v-else v-for="(item, index) in orderList" :key="index" class="table-row">
<view class="td" style="flex: 1.5;"><text class="td-txt">{{ item.orderId }}</text></view>
<view class="td" style="flex: 1.2;"><text class="td-txt">{{ item.userInfo }}</text></view>
<view class="td" style="width: 150px;"><text class="td-txt">{{ item.payPrice.toFixed(2) }}</text></view>
<view class="td" style="width: 150px;"><text class="td-txt">{{ item.discountPrice.toFixed(2) }}</text></view>
<view class="td" style="width: 150px;"><text class="td-txt">¥{{ item.payPrice.toFixed(2) }}</text></view>
<view class="td" style="width: 150px;"><text class="td-txt">¥{{ item.discountPrice.toFixed(2) }}</text></view>
<view class="td" style="width: 200px;"><text class="td-txt">{{ item.payTime }}</text></view>
</view>
</view>
@@ -62,17 +68,20 @@
<view class="page-total">
<text class="total-txt">共 {{ total }} 条</text>
</view>
<view class="page-select">
<text class="page-val">15条/页 ▼</text>
</view>
<view class="page-btns">
<text :class="['p-btn', page <= 1 ? 'disabled' : '']" @click="prevPage"><</text>
<text class="p-btn active">{{ page }}</text>
<text :class="['p-btn', page >= totalPages ? 'disabled' : '']" @click="nextPage">></text>
<view class="page-btn" :class="{ disabled: page <= 1 }" @click="prevPage">
<text><</text>
</view>
<view class="page-btn active">
<text>{{ page }}</text>
</view>
<view class="page-btn" :class="{ disabled: page >= totalPages }" @click="nextPage">
<text>></text>
</view>
</view>
<view class="page-jump">
<text class="jump-txt">前往</text>
<input class="jump-input" placeholder="1" v-model="jumpPage" @confirm="goToJumpPage" />
<input class="jump-input" v-model="jumpPage" type="number" @confirm="goToJumpPage" />
<text class="jump-txt">页</text>
</view>
</view>
@@ -120,15 +129,13 @@ const username = ref('')
const total = ref(0)
const orderList = ref<CashierOrder[]>([])
const loading = ref(false)
const page = ref(1)
const pageSize = ref(15)
const jumpPage = ref('')
const totalPages = computed((): number => {
if (pageSize.value <= 0) return 1
const pages = Math.ceil(total.value / pageSize.value)
return pages <= 0 ? 1 : pages
return Math.ceil(total.value / pageSize.value)
})
const loadCashierOrders = async () => {
@@ -143,17 +150,16 @@ const loadCashierOrders = async () => {
orderList.value = res.items.map((item: any): CashierOrder => {
return {
orderId: String(item.order_no ?? '--'),
orderId: String(item.order_no),
userInfo: `${String(item.customer_name ?? '未知')} | ${String(item.customer_phone ?? '')}`,
payPrice: parseFloat(String(item.total_amount ?? item.pay_amount ?? '0')),
payPrice: parseFloat(String(item.total_amount ?? '0')),
discountPrice: parseFloat(String(item.discount_amount ?? '0')),
payTime: String(item.paid_at ?? '--')
} as CashierOrder
})
total.value = res.total
} catch (e) {
uni.showToast({ title: '收银订单加载失败', icon: 'none' })
uni.showToast({ title: '加载收银订单失败', icon: 'none' })
} finally {
loading.value = false
}
@@ -189,7 +195,7 @@ const goToJumpPage = () => {
loadCashierOrders()
jumpPage.value = ''
} else {
uni.showToast({ title: '请输入有效的页码', icon: 'none' })
uni.showToast({ title: '页码无效', icon: 'none' })
}
}
@@ -345,9 +351,8 @@ const closeQrModal = () => {
gap: 12px;
}
.total-txt { font-size: 14px; color: #606266; }
.page-val { font-size: 14px; color: #606266; border: 1px solid #dcdfe6; padding: 4px 10px; border-radius: 4px; }
.page-btns { display: flex; flex-direction: row; gap: 8px; }
.p-btn {
.page-btn {
width: 32px;
height: 32px;
border: 1px solid #dcdfe6;
@@ -356,9 +361,10 @@ const closeQrModal = () => {
align-items: center;
justify-content: center;
font-size: 14px;
cursor: pointer;
}
.p-btn.active { background-color: #2d8cf0; border-color: #2d8cf0; color: #fff; }
.p-btn.disabled { color: #c0c4cc; background-color: #f5f7fa; }
.page-btn.active { background-color: #2d8cf0; border-color: #2d8cf0; color: #fff; }
.page-btn.disabled { color: #c0c4cc; background-color: #f5f7fa; cursor: not-allowed; }
.page-jump { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.jump-txt { font-size: 14px; color: #606266; }
@@ -453,5 +459,3 @@ const closeQrModal = () => {
to { background-color: rgba(0, 0, 0, 0); }
}
</style>