perf(订单):信息展示

This commit is contained in:
Ankkaya 2024-08-21 18:09:07 +08:00
parent fcf65c7352
commit 05ce9595e7
5 changed files with 92 additions and 25 deletions

View File

@ -22,22 +22,22 @@
<view class="income flex justify-between align-center"> <view class="income flex justify-between align-center">
<view class="left flex align-center"> <view class="left flex align-center">
<view class="unit self-start"></view> <view class="unit self-start"></view>
<view class="sincome ss-font-60">{{ state.statistic.todayPaymentAmount || 0 }}</view> <view class="sincome ss-font-60">{{ fen2yuan(state.statistic.todayPaymentAmount || 0) }}</view>
</view> </view>
<!-- <button class="right-btn ss-reset-button">查看详情</button> --> <!-- <button class="right-btn ss-reset-button">查看详情</button> -->
</view> </view>
<view class="des ss-m-t-20"> <view class="des ss-m-t-20">
总销售额 {{ state.statistic.totalSalesAmount }} | 成功退款 {{ state.statistic.refundCount }} | 总销售额 {{ fen2yuan(state.statistic.totalSalesAmount) }} | 成功退款
退款金额 {{ state.statistic.refundAmount }} {{ state.statistic.refundCount }} | 退款金额 {{ fen2yuan(state.statistic.refundAmount) }}
</view> </view>
</view> </view>
<view class="more ss-m-t-70"> <view class="more ss-m-t-70">
<view class="title ss-m-b-30">基础数据</view> <view class="title ss-m-b-30">基础数据</view>
<view class="items"> <view class="items">
<view class="item" v-for="item in state.more" :key="item.name"> <view class="item" v-for="(item, index) in state.more" :key="item.name">
<view class="label">{{ item.name }}</view> <view class="label">{{ item.name }}</view>
<view class="value">{{ item.value }}</view> <view class="value">{{ index !== 0 ? item.value : fen2yuan(item.value) }}</view>
<view class="last"> 昨日 {{ item.last }} </view> <view class="last"> 昨日 {{ item.last }} </view>
</view> </view>
</view> </view>
@ -51,7 +51,9 @@ import { ref, computed } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import peach from '@/peach' import peach from '@/peach'
import $store from '@/peach/store' import $store from '@/peach/store'
import { fen2yuan } from '@/peach/hooks/useGoods'
import UserUtil from '@/peach/api/member/user' import UserUtil from '@/peach/api/member/user'
import OrderUtil from '@/peach/api/trade/order'
import bg from '@/static/bg-page.png' import bg from '@/static/bg-page.png'
const bgStyle = { const bgStyle = {
@ -121,7 +123,37 @@ async function getStatistic() {
* @param {Type} - * @param {Type} -
* @returns {Type} * @returns {Type}
*/ */
function checkVerifi() {} function checkVerifi() {
//
uni.scanCode({
success: (res) => {
uni.showModal({
title: '提示',
content: '是否核销该订单',
success: function (sres) {
if (sres.confirm) {
OrderUtil.orderVerification({
verifyCode: res.result,
}).then((res) => {
uni.showToast({
title: '订单核销成功',
icon: 'success',
})
setTimeout(() => {
peach.$router.go('/pages/order/detail', {
id: res.data,
})
}, 500)
})
}
},
})
},
fail: (err) => {
console.log(err)
},
})
}
onShow(() => { onShow(() => {
getStatistic() getStatistic()

View File

@ -151,19 +151,33 @@ const tabMaps = [
name: '全部', name: '全部',
}, },
{ {
name: '付款', name: '付款',
value: 0, value: '50,60',
}, },
{ {
name: '待核销', name: '已评价',
value: 50, value: '30',
}, },
{ {
name: '待配送', name: '已退货',
value: 60, value: '10,20',
}, },
] ]
function onDelivery(id) {
OrderApi.orderComplete({ orderId: id }).then(() => {
uni.showToast({
title: '配送成功',
icon: 'success',
})
setTimeout(() => {
peach.$router.go('/pages/order/detail', {
id: id,
})
}, 500)
})
}
// //
function totalNumsPerOrder(order) { function totalNumsPerOrder(order) {
if (order.items.length) { if (order.items.length) {
@ -206,14 +220,14 @@ async function getOrderList() {
let { data } = await OrderApi.getOrderPage({ let { data } = await OrderApi.getOrderPage({
pageNo: state.value.pagination.pageNo, pageNo: state.value.pagination.pageNo,
pageSize: state.value.pagination.pageSize, pageSize: state.value.pagination.pageSize,
status: tabMaps[state.value.currentTab].value, status: state.value.currentTab !== 3 ? tabMaps[state.value.currentTab].value : undefined,
refundStatus: state.value.currentTab === 3 ? tabMaps[state.value.currentTab].value : undefined,
}) })
data.list.forEach((item) => { data.list.forEach((item) => {
handleOrderButtons(item) handleOrderButtons(item)
}) })
state.value.pagination.list = _.concat(state.value.pagination.list, data.list) state.value.pagination.list = _.concat(state.value.pagination.list, data.list)
console.log(state.value.pagination.list)
state.value.pagination.total = data.total state.value.pagination.total = data.total
let currentPageTotal = state.value.pagination.length let currentPageTotal = state.value.pagination.length
state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore' state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore'

View File

@ -77,7 +77,7 @@
:price="item.price" :price="item.price"
:num="item.count" :num="item.count"
> >
<template #tool> <!-- <template #tool>
<view class="ss-flex"> <view class="ss-flex">
<button <button
class="ss-reset-button apply-btn" class="ss-reset-button apply-btn"
@ -114,7 +114,7 @@
退款成功 退款成功
</button> </button>
</view> </view>
</template> </template> -->
<template #priceSuffix> <template #priceSuffix>
<button class="ss-reset-button tag-btn" v-if="item.status_text"> <button class="ss-reset-button tag-btn" v-if="item.status_text">
{{ item.status_text }} {{ item.status_text }}

View File

@ -18,6 +18,24 @@ const OrderUtil = {
params: data, params: data,
}) })
}, },
// 商品核销
orderVerification: (data) => {
return request({
url: '/trade/order/verify-code',
method: 'POST',
data: data,
})
},
// 完成订单
orderComplete: (data) => {
return request({
url: '/trade/order/completed-order',
method: 'POST',
data: data,
})
},
} }
export default OrderUtil export default OrderUtil

View File

@ -73,7 +73,7 @@ export function formatOrderStatusDescription(order) {
return '商家已发货,请耐心等待' return '商家已发货,请耐心等待'
} }
if (order.status === 30 && !order.commentStatus) { if (order.status === 30 && !order.commentStatus) {
return '已收货,快去评价一下吧' return '已收货,待评价'
} }
if (order.status === 30 && order.commentStatus) { if (order.status === 30 && order.commentStatus) {
return '交易完成,感谢您的支持' return '交易完成,感谢您的支持'
@ -81,6 +81,9 @@ export function formatOrderStatusDescription(order) {
if (order.status === 50) { if (order.status === 50) {
return '请及时到店核销商品' return '请及时到店核销商品'
} }
if (order.status === 60) {
return '商家已接单,待配送'
}
return '交易关闭' return '交易关闭'
} }
@ -151,18 +154,18 @@ export function handleOrderButtons(order) {
order.buttons.push('cancel') order.buttons.push('cancel')
// order.buttons.push('pay'); // order.buttons.push('pay');
} }
if (order.status === 30 && !order.commentStatus) { // if (order.status === 30 && !order.commentStatus) {
// 发起评价 // // 发起评价
order.buttons.push('comment') // order.buttons.push('comment')
} // }
if (order.status === 40) { if (order.status === 40) {
// 删除订单 // 删除订单
// order.buttons.push('delete') // order.buttons.push('delete')
} }
if (order.status === 50) { // if (order.status === 50) {
// 核销订单 // // 核销订单
order.buttons.push('verification') // order.buttons.push('verification')
} // }
if (order.status === 60) { if (order.status === 60) {
// 配送完成 // 配送完成
order.buttons.push('delivery') order.buttons.push('delivery')