功能:完善门店能力与用户安全配置

This commit is contained in:
xiaowang
2026-05-18 10:04:57 +08:00
parent 4563dd2538
commit 3797938616
356 changed files with 24983 additions and 1858 deletions
+36
View File
@@ -9,6 +9,10 @@ function getBenefitText(coupon) {
return `满 ${coupon.minAmount} 减 ${coupon.reduceAmount}`
}
/**
* coupons 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,
@@ -24,6 +28,10 @@ Page({
]
},
/**
* `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.loadCoupons()
},
@@ -35,6 +43,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({
coupons: [],
@@ -74,11 +86,19 @@ Page({
}
},
/**
* `applyFilter` 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.
*/
applyFilter(filterValue, sourceCoupons) {
const activeFilter = filterValue || 'all'
const coupons = Array.isArray(sourceCoupons) ? sourceCoupons : this.data.coupons
let filteredCoupons = coupons
/**
* `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 (activeFilter === 'available') {
filteredCoupons = coupons.filter(item => Number(item.status) === 1)
} else if (activeFilter === 'used') {
@@ -93,18 +113,34 @@ Page({
})
},
/**
* `handleFilterChange` 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.
*/
handleFilterChange(event) {
const value = event.currentTarget.dataset.value
/**
* `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 (!value || value === this.data.activeFilter) {
return
}
this.applyFilter(value)
},
/**
* `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/coupons/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')
}