first commit
This commit is contained in:
118
衣莎项目/源码/YiShaXiYi/user/payment/card/card.js
Normal file
118
衣莎项目/源码/YiShaXiYi/user/payment/card/card.js
Normal file
@@ -0,0 +1,118 @@
|
||||
// user/payment/card/card.js
|
||||
const app = getApp();
|
||||
const regeneratorRuntime = app.loadAsync()
|
||||
const model = app.loadModel("index")
|
||||
const http = app.loadHttp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
system: app.globalData.system, //设备相关信息
|
||||
pageTitle: "会员卡支付", //头部标题
|
||||
isBack: true,//显示返回
|
||||
current: '1',//当前所在的标签的 key 值
|
||||
cardList: [],//会员卡列表
|
||||
type: '',//1为商城订单
|
||||
},
|
||||
|
||||
// tab选中事件
|
||||
handleChange({ detail }) {
|
||||
this.setData({
|
||||
current: detail.key
|
||||
});
|
||||
this.userCard()
|
||||
},
|
||||
// 获取礼品卡
|
||||
async userCard() {
|
||||
this.setData({
|
||||
cardList: []
|
||||
})
|
||||
let res = await http.http.request2({ url: `${http.api.userCard}/${this.data.current}`, method: "POST", data: { kind: this.data.type } })
|
||||
this.setData({
|
||||
cardList: res.data.data
|
||||
})
|
||||
},
|
||||
// 选择礼品卡
|
||||
async selectGiftCard(e) {
|
||||
let item = e.currentTarget.dataset.item
|
||||
await model.storage.setStorage("itemGiftCard", item)
|
||||
let giftCard = {
|
||||
id: item.id,
|
||||
price: item.discount / 10,
|
||||
title: item.title,
|
||||
logo: item.logo
|
||||
}
|
||||
await model.storage.setStorage("giftCard", giftCard)
|
||||
wx.navigateBack({
|
||||
|
||||
})
|
||||
},
|
||||
// 办卡
|
||||
goCard(){
|
||||
wx.navigateTo({
|
||||
url:`/user/balance/balance?index=${this.data.current}`
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
if (!!options.type) {
|
||||
this.setData({
|
||||
type: options.type
|
||||
})
|
||||
}
|
||||
this.userCard()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user