consumer模块完成度95%,安卓端大部分页面能正常获取数据,页面样式显示基本正常,逐渐完善;消费者端的积分、余额、评价、优惠券等小模块正在完善
This commit is contained in:
@@ -39,18 +39,22 @@ const loadCoupons = async () => {
|
||||
uni.showLoading({ title: '加载中...' })
|
||||
try {
|
||||
const userCoupons = await supabaseService.getUserCoupons(1)
|
||||
coupons.value = userCoupons.map((item: UserCoupon): Coupon => {
|
||||
const couponList: Coupon[] = []
|
||||
for (let i = 0; i < userCoupons.length; i++) {
|
||||
const item = userCoupons[i]
|
||||
const amountVal = item.amount ?? 0
|
||||
const expiryVal = (item.expire_at != null && item.expire_at !== '')
|
||||
? item.expire_at.substring(0, 10)
|
||||
: '长期有效'
|
||||
return {
|
||||
const coupon: Coupon = {
|
||||
id: item.id,
|
||||
title: (item.template_name != null && item.template_name !== '') ? item.template_name : '优惠券',
|
||||
amount: `¥${amountVal}`,
|
||||
expiry: expiryVal
|
||||
} as Coupon
|
||||
})
|
||||
couponList.push(coupon)
|
||||
}
|
||||
coupons.value = couponList
|
||||
} catch (e) {
|
||||
console.error('加载优惠券失败', e)
|
||||
coupons.value = []
|
||||
|
||||
Reference in New Issue
Block a user