consumerm模块完成度90%,完善消费者和商家端数据库表,商品、聊天、订单数据对接好了supabase,和商家端对接了聊天功能,安卓端编译通过了css样式,剩余几个页面在处理函数规范问题
This commit is contained in:
@@ -35,20 +35,20 @@ type Coupon = {
|
||||
|
||||
const coupons = ref<Coupon[]>([])
|
||||
|
||||
onMounted(() => {
|
||||
loadCoupons()
|
||||
})
|
||||
|
||||
const loadCoupons = async () => {
|
||||
uni.showLoading({ title: '加载中...' })
|
||||
try {
|
||||
const userCoupons = await supabaseService.getUserCoupons(1) // 1: unused
|
||||
coupons.value = userCoupons.map((item: UserCoupon) => {
|
||||
const userCoupons = await supabaseService.getUserCoupons(1)
|
||||
coupons.value = userCoupons.map((item: UserCoupon): Coupon => {
|
||||
const amountVal = item.amount ?? 0
|
||||
const expiryVal = (item.expire_at != null && item.expire_at !== '')
|
||||
? item.expire_at.substring(0, 10)
|
||||
: '长期有效'
|
||||
return {
|
||||
id: item.id,
|
||||
title: item.template_name || '优惠券',
|
||||
amount: `¥${item.amount || 0}`,
|
||||
expiry: item.expire_at ? item.expire_at.substring(0, 10) : '长期有效'
|
||||
title: (item.template_name != null && item.template_name !== '') ? item.template_name : '优惠券',
|
||||
amount: `¥${amountVal}`,
|
||||
expiry: expiryVal
|
||||
} as Coupon
|
||||
})
|
||||
} catch (e) {
|
||||
@@ -59,6 +59,10 @@ const loadCoupons = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadCoupons()
|
||||
})
|
||||
|
||||
const useCoupon = (coupon: Coupon) => {
|
||||
uni.switchTab({
|
||||
url: '/pages/mall/consumer/index'
|
||||
@@ -70,7 +74,7 @@ const useCoupon = (coupon: Coupon) => {
|
||||
.coupons-page {
|
||||
padding: 15px;
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
|
||||
Reference in New Issue
Block a user