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

@@ -14,12 +14,8 @@
</view>
<view class="filter-item">
<text class="label-txt">筛选条件:</text>
<view class="select-mock" style="width: 100px;">
<text class="select-val">请选择</text>
<text class="arrow-down">▼</text>
</view>
<input class="search-input" style="width: 180px;" placeholder="请输入搜索内容" v-model="searchQuery" />
<text class="label-txt">搜索订单:</text>
<input class="search-input" style="width: 280px;" placeholder="请输入订单号搜索" v-model="searchQuery" @confirm="handleQuery" />
</view>
<view class="filter-item">
@@ -42,7 +38,7 @@
<view class="table-header-row">
<view class="th" style="width: 200px;">订单号</view>
<view class="th" style="width: 150px;">用户信息</view>
<view class="th" style="width: 320px;">商品信息</view>
<view class="th" style="flex: 1;">商品信息</view>
<view class="th" style="width: 100px;">实际支付</view>
<view class="th" style="width: 100px;">核销员</view>
<view class="th" style="width: 120px;">核销门店</view>
@@ -52,10 +48,16 @@
</view>
<view class="table-body">
<view v-for="(item, index) in recordList" :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="recordList.length === 0" class="table-empty" style="padding: 40px; text-align: center;">
<text>暂无核销记录</text>
</view>
<view v-else v-for="(item, index) in recordList" :key="index" class="table-row">
<view class="td" style="width: 200px;"><text class="td-txt">{{ item.orderId }}</text></view>
<view class="td" style="width: 150px;"><text class="td-txt">{{ item.userInfo }}</text></view>
<view class="td" style="width: 320px;">
<view class="td" style="flex: 1;">
<view class="product-info">
<image class="product-img" :src="item.productImg" mode="aspectFill"></image>
<view class="product-detail">
@@ -63,7 +65,7 @@
</view>
</view>
</view>
<view class="td" style="width: 100px;"><text class="td-txt">{{ item.payPrice }}</text></view>
<view class="td" style="width: 100px;"><text class="td-txt">¥{{ item.payPrice.toFixed(2) }}</text></view>
<view class="td" style="width: 100px;"><text class="td-txt">{{ item.verifier }}</text></view>
<view class="td" style="width: 120px;"><text class="td-txt">{{ item.storeName }}</text></view>
<view class="td" style="width: 100px;"><text class="td-txt">{{ item.payStatus }}</text></view>
@@ -78,17 +80,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 disabled"><</text>
<text class="p-btn active">1</text>
<text class="p-btn">></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" />
<input class="jump-input" v-model="jumpPage" type="number" @confirm="goToJumpPage" />
<text class="jump-txt">页</text>
</view>
</view>
@@ -98,14 +103,15 @@
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { ref, onMounted, computed } from 'vue'
import { fetchWriteOffRecordPage } from '@/services/orderService.uts'
interface WriteOffRecord {
orderId: string
userInfo: string
productImg: string
productName: string
payPrice: string
payPrice: number
verifier: string
storeName: string
payStatus: string
@@ -114,71 +120,105 @@ interface WriteOffRecord {
}
const searchQuery = ref('')
const total = ref(10)
const recordList = ref<WriteOffRecord[]>([
{
orderId: 'cp470547161164021760',
userInfo: '张迪/77418',
productImg: 'https://p.demo.crmeb.net/uploads/attach/2024/09/20240905/66d87e35b7e9b.jpg',
productName: '小米家保温杯云米电热水杯杯旅行便携式烧水壶真空304不锈钢热水壶智能恒...',
payPrice: '93',
verifier: '总平台',
storeName: '提货点222',
payStatus: '余额支付',
orderStatus: '已完成',
createTime: '2025-07-22 11:06:25'
},
{
orderId: 'cp470289876680441856',
userInfo: '130****0000/22919',
productImg: 'https://p.demo.crmeb.net/uploads/attach/2024/09/20240905/66d87e35b7e9b.jpg',
productName: '米妍 (meyarn) 刮舌苔清洁器舌苔刷清新口气成人清洁舌苔口腔2支装 粉+蓝',
payPrice: '28.4',
verifier: '总平台',
storeName: '提货点222',
payStatus: '余额支付',
orderStatus: '待评价',
createTime: '2025-07-21 18:04:04'
},
{
orderId: 'cp462914742369910784',
userInfo: '您好亲亲/76738',
productImg: 'https://p.demo.crmeb.net/uploads/attach/2024/09/20240905/66d87e35b7e9b.jpg',
productName: '小米家保温杯云米电热水杯杯旅行便携式烧水壶真空304不锈钢热水壶智能恒...',
payPrice: '89.1',
verifier: '总平台',
storeName: '关东科技',
payStatus: '线下支付',
orderStatus: '已完成',
createTime: '2025-07-01 09:37:55'
},
{
orderId: 'cp450327064277417984',
userInfo: 'Leo/74412',
productImg: 'https://p.demo.crmeb.net/uploads/attach/2024/09/20240905/66d87e35b7e9b.jpg',
productName: '361度运动鞋男鞋【飞羽2】夏季轻透气网面缓震回弹便捷跑步鞋 羽毛白冰河...',
payPrice: '369',
verifier: '总平台',
storeName: '提货点222',
payStatus: '线下支付',
orderStatus: '待评价',
createTime: '2025-05-27 15:58:58'
},
{
orderId: 'cp439425186874261504',
userInfo: '白茶/73171',
productImg: 'https://p.demo.crmeb.net/uploads/attach/2024/09/20240905/66d87e35b7e9b.jpg',
productName: '【明星同款】FILA FUSION裴乐潮牌卫衣情侣老花男女宽松上衣',
payPrice: '649',
verifier: '总平台',
storeName: '关东科技',
payStatus: '余额支付',
orderStatus: '待评价',
createTime: '2025-04-27 13:58:48'
}
])
const total = ref(0)
const recordList = ref<WriteOffRecord[]>([])
const loading = ref(false)
const page = ref(1)
const pageSize = ref(15)
const jumpPage = ref('')
const handleQuery = () => { console.log('Searching...') }
const totalPages = computed((): number => {
if (pageSize.value <= 0) return 1
return Math.ceil(total.value / pageSize.value)
})
const loadRecords = async () => {
loading.value = true
try {
const res = await fetchWriteOffRecordPage(
page.value,
pageSize.value,
searchQuery.value || null
)
recordList.value = res.items.map((item: any): WriteOffRecord => {
return {
orderId: String(item.order_no),
userInfo: `${String(item.customer_name ?? '未知')} | ${String(item.customer_phone ?? '')}`,
productImg: String(item.product_summary?.image_url ?? ''),
productName: String(item.product_summary?.product_name ?? '多商品订单'),
payPrice: parseFloat(String(item.total_amount ?? '0')),
verifier: String(item.verifier_name ?? '--'),
storeName: '--', // 目前 DDL 尚未返回门店
payStatus: getPaymentStatusName(parseInt(String(item.payment_status ?? '1'))),
orderStatus: getOrderStatusName(parseInt(String(item.order_status ?? '1'))),
createTime: String(item.created_at ?? '--')
} as WriteOffRecord
})
total.value = res.total
} catch (e) {
uni.showToast({ title: '加载核销记录失败', icon: 'none' })
} finally {
loading.value = false
}
}
onMounted(() => {
loadRecords()
})
const handleQuery = () => {
page.value = 1
loadRecords()
}
const prevPage = () => {
if (page.value > 1) {
page.value--
loadRecords()
}
}
const nextPage = () => {
if (page.value < totalPages.value) {
page.value++
loadRecords()
}
}
const goToJumpPage = () => {
const targetPage = parseInt(jumpPage.value)
if (!isNaN(targetPage) && targetPage >= 1 && targetPage <= totalPages.value) {
page.value = targetPage
loadRecords()
jumpPage.value = ''
} else {
uni.showToast({ title: '页码无效', icon: 'none' })
}
}
function getPaymentStatusName(status: number): string {
switch (status) {
case 1: return '未支付'
case 2: return '已支付'
case 3: return '部分退款'
case 4: return '全额退款'
default: return '未知'
}
}
function getOrderStatusName(status: number): string {
switch (status) {
case 1: return '待付款'
case 2: return '待发货'
case 3: return '待收货'
case 4: return '已完成'
case 5: return '已取消'
case 6: return '退款中'
case 7: return '已退款'
default: return '未知'
}
}
</script>
<style scoped lang="scss">
@@ -276,6 +316,8 @@ const handleQuery = () => { console.log('Searching...') }
padding: 20px;
}
.table-container { padding: 0; }
.table-header-row {
display: flex;
flex-direction: row;
@@ -323,6 +365,7 @@ const handleQuery = () => { console.log('Searching...') }
height: 40px;
border-radius: 2px;
background-color: #f5f5f5;
flex-shrink: 0;
}
.p-name {
font-size: 12px;
@@ -346,9 +389,8 @@ const handleQuery = () => { console.log('Searching...') }
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;
@@ -357,13 +399,12 @@ const handleQuery = () => { console.log('Searching...') }
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; }
.jump-input { width: 40px; height: 32px; border: 1px solid #dcdfe6; text-align: center; border-radius: 4px; font-size: 14px; }
</style>