Files
code-bang/frontend/miniapp/pages/promotion-detail/index.js
T
2026-10-20 18:34:45 +08:00

52 lines
1.0 KiB
JavaScript

import Toast from 'tdesign-miniprogram/toast/index';
import { fetchPromotion } from '../../services/promotion/detail';
Page({
data: {
list: [],
banner: '',
time: 0,
showBannerDesc: false,
statusTag: '',
},
onLoad(query) {
const promotionID = parseInt(query.promotion_id);
this.getGoodsList(promotionID);
},
getGoodsList(promotionID) {
fetchPromotion(promotionID).then(
({ list, banner, time, showBannerDesc, statusTag }) => {
const goods = list.map((item) => ({
...item,
tags: item.tags.map((v) => v.title),
}));
this.setData({
list: goods,
banner,
time,
showBannerDesc,
statusTag,
});
},
);
},
cardClickHandle() {
Toast({
context: this,
selector: '#t-toast',
message: '点击加购',
});
},
bannerClickHandle() {
Toast({
context: this,
selector: '#t-toast',
message: '点击规则详情',
});
},
});