Files
sgy-web/pages/recruit/exchange/exchange.js

94 lines
2.1 KiB
JavaScript

/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
barHeight : getApp().globalData.barHeight, // 状态栏高度
address : '', // 地址
addressId : '', // 地址id
dataShow : '', // 数据
exchangesHide: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
onShow() {
// 水滴兑换商品前置
this.createInfo();
// 水滴兑换商品展示
this.ShowInfo();
},
/**
* 水滴兑换商品前置
*/
createInfo (){
wx.$api.recruit.exchangesCreate({address_id: this.data.addressId,}).then(res => {
this.setData({
address : res.data.address,
addressId : res.data.address.address_id
})
}).catch(err => { })
},
/**
* 水滴兑换商品展示
*/
ShowInfo (){
wx.$api.recruit.exchangesShow().then(res => {
this.setData({
dataShow: res.data
})
}).catch(err => { })
},
/**
* 水滴兑换提交
*/
createGo (){
wx.showModal({
title : '兑换提示',
content : '尊敬的用户,是否确认兑换此商品',
cancelText: '暂不兑换',
confirmText: '确认兑换',
success : res=> {
if (res.confirm) {
wx.$api.recruit.exchangesPost({address_id: this.data.addressId}).then(res => {
this.setData({
exchangesHide: true
})
}).catch(err => { })
}
}
})
},
// 返回上一页
returnGo() {
wx.navigateBack({
delta: 1
})
},
/**
* 关闭弹框
*/
refertoTap() {
this.setData({
exchangesHide: false
})
wx.redirectTo({
url: '/pages/user/index'
})
}
})