功能:完善门店能力与用户安全配置
This commit is contained in:
@@ -6,6 +6,10 @@ const { resolveLegacyImage } = require('../../utils/file')
|
||||
const { formatDateTime, formatPrice, getOrderStatusClass, getOrderStatusText } = require('../../utils/format')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
|
||||
/**
|
||||
* orders page logic.
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
loading: false,
|
||||
@@ -13,6 +17,10 @@ Page({
|
||||
orders: []
|
||||
},
|
||||
|
||||
/**
|
||||
* `onShow` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
onShow() {
|
||||
this.loadOrders()
|
||||
},
|
||||
@@ -24,6 +32,10 @@ Page({
|
||||
loading: isLoggedIn
|
||||
})
|
||||
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!isLoggedIn) {
|
||||
this.setData({
|
||||
orders: [],
|
||||
@@ -39,6 +51,7 @@ Page({
|
||||
...order,
|
||||
statusText: getOrderStatusText(order),
|
||||
statusClass: getOrderStatusClass(order),
|
||||
shopNameText: order.shopName ? `所属店铺:${order.shopName}` : '',
|
||||
actualAmountText: `\u00a5${formatPrice(order.actualAmount)}`,
|
||||
items: await Promise.all((order.items || []).map(async item => ({
|
||||
...item,
|
||||
@@ -66,16 +79,28 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleOpenAuth` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
handleOpenAuth() {
|
||||
navigation.openAuth('/pages/orders/index')
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleBack` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
handleBack() {
|
||||
navigation.goBack('/pages/profile/index')
|
||||
},
|
||||
|
||||
async handleCancelOrder(event) {
|
||||
const orderId = event.currentTarget.dataset.orderId
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!orderId) {
|
||||
return
|
||||
}
|
||||
@@ -90,6 +115,10 @@ Page({
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!confirmed) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user