功能:新增下一阶段运营能力和生产部署

This commit is contained in:
xiaowang
2026-05-24 18:09:11 +08:00
parent 8116abc9b5
commit 1d077d4089
157 changed files with 9206 additions and 74 deletions
@@ -3,6 +3,8 @@
* Usage: call getOrderDetail with the current route id before displaying the order detail page.
*/
const orderApi = require('../../api/order')
const paymentApi = require('../../api/payment')
const permission = require('../../utils/permission')
/**
* Purpose: navigation supports index.js by holding or executing the navigation page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
@@ -14,6 +16,20 @@ const navigation = require('../../utils/navigation')
*/
const format = require('../../utils/format')
const { getTempRecord, clearTempRecord } = require('../../utils/storage')
const { markDirty } = require('../../utils/page-state')
function getPaymentStatusText(status) {
if (status === 'PAID') {
return '已支付'
}
if (status === 'PAYING') {
return '支付中'
}
if (status === 'REFUNDED') {
return '已退款'
}
return '未支付'
}
Page({
/**
@@ -35,7 +51,8 @@ Page({
* Purpose: order supports index.js by holding or executing the order page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
order: null
order: null,
canManualConfirmPay: false
},
/**
@@ -43,11 +60,13 @@ Page({
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
onLoad(options) {
const permissionCodes = getApp().globalData.permissionCodes || []
const cachedOrder = getTempRecord('currentOrder', null)
const orderId = (options && options.id) || (cachedOrder && cachedOrder.id) || ''
this.setData({
orderId,
order: cachedOrder ? this.formatOrder(cachedOrder) : null
order: cachedOrder ? this.formatOrder(cachedOrder) : null,
canManualConfirmPay: permission.hasPermission(permissionCodes, 'payment:manage')
})
if (orderId) {
@@ -82,11 +101,16 @@ Page({
*/
formatOrder(order) {
const items = Array.isArray(order && order.items) ? order.items : []
const paymentStatus = order && order.paymentStatus ? order.paymentStatus : 'UNPAID'
return order ? {
...order,
displayStatusText: format.getOrderStatusText(order),
displayPaymentStatusText: getPaymentStatusText(paymentStatus),
displayCreateTime: format.formatDateTime(order.createTime),
displayPayAmount: format.formatPrice(order.payAmount),
displayPayAmount: format.formatPrice(order.payAmount || order.actualAmount),
displayPaidAmount: format.formatPrice(order.paidAmount),
displayPayTime: format.formatDateTime(order.payTime),
canManualConfirmPay: paymentStatus !== 'PAID' && paymentStatus !== 'REFUNDED',
items: items.map(item => ({
...item,
displayAppointmentTime: item.appointmentTime ? format.formatDateTime(item.appointmentTime) : '',
@@ -108,6 +132,55 @@ Page({
this.loadOrderDetail(this.data.orderId)
},
async handleManualConfirmPay() {
if (!this.data.canManualConfirmPay) {
wx.showToast({
title: '当前账号没有确认支付权限',
icon: 'none'
})
return
}
const order = this.data.order
if (!order) {
return
}
const remark = await new Promise(resolve => {
wx.showModal({
title: '手动确认支付',
content: `确认将订单 ${order.orderNo || order.id} 标记为已支付?`,
editable: true,
placeholderText: '备注,可留空',
confirmText: '确认',
success: result => {
if (!result.confirm) {
resolve(null)
return
}
resolve(String(result.content || '').trim())
},
fail: () => resolve(null)
})
})
if (remark === null) {
return
}
try {
await paymentApi.manualConfirmOrder(order.id, remark)
markDirty('admin-orders')
markDirty('admin-workbench')
wx.showToast({
title: '支付已确认',
icon: 'none'
})
this.loadOrderDetail(order.id)
} catch (error) {
wx.showToast({
title: error.message || '确认支付失败',
icon: 'none'
})
}
},
/**
* Purpose: onUnload supports index.js by holding or executing the on unload page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.