// pages/rechargeCard/rechargeCard.js const { get, post } = require('../../api/request.js'); Page({ /** * 页面的初始数据 */ data: { confirmBtn: { content: '确认' }, currentTab: 0, // 当前显示的表格,默认为第一个表格 allCardPoints: [{ "id": "string", "inUse": 0, "inUseName": "string", "money": 110, "vcNum": "200030000000" }, { "id": "string", "inUse": 0, "inUseName": "string", "money": 110, "vcNum": "200030000000" }, { "id": "string", "inUse": 0, "inUseName": "string", "money": 110, "vcNum": "200030000000" }, { "id": "string", "inUse": 0, "inUseName": "string", "money": 110, "vcNum": "200030000000" }, { "id": "string", "inUse": 1, "inUseName": "string", "money": 110, "vcNum": "200030000000" }], allWaterPoints: [{ "id": "string", "inUse": 1, "inUseName": "string", "money": 110, "vcNum": "200030000000" },{ "id": "string", "inUse": 1, "inUseName": "string", "money": 110, "vcNum": "200030000000" },{ "id": "string", "inUse": 1, "inUseName": "string", "money": 110, "vcNum": "200030000000" },{ "id": "string", "inUse": 1, "inUseName": "string", "money": 110, "vcNum": "200030000000" },{ "id": "string", "inUse": 1, "inUseName": "string", "money": 110, "vcNum": "200030000000" }], showDialog: false }, // 切换 Tabs switchTab: function (e) { const tab = parseInt(e.currentTarget.dataset.tab); this.setData({ currentTab: tab }); }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getCardList(); this.getWaterCardList(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { }, //获取虚拟卡列表 getCardList() { get({ url: 'https://d4x9787456.vicp.fun/sell/virtual_card/get', data: { operator: getApp().globalData.sessionId } }) .then((data) => { if (data.success && data.code === "0001") { this.setData({ allCardPoints: data.content }); } else { wx.showToast({ title: data.msg, }) } }) .catch((error) => { }); }, getWaterCardList() { get({ url: 'https://d4x9787456.vicp.fun/sell/virtual_card/get', data: { operator: getApp().globalData.sessionId } }) .then((data) => { if (data.success && data.code === "0001") { this.setData({ allWaterPoints: data.content }); } else { wx.showToast({ title: data.msg, }) } console.log('Failed to add item:'); }) .catch((error) => { console.error('Failed to add item:', error); }); }, rechargeCard(item) { wx.navigateTo({ url: '/pages/rechargeMoney/rechargMoney' // 首页的路径,根据实际情况填写 }); }, ruinCard() { this.setData({ showDialog: true }) }, closeDialog() { this.setData({ showDialog: false }) } })