[本时生活小程序-线上备份]

This commit is contained in:
张慢慢
2021-05-21 15:02:18 +08:00
commit f0302de899
206 changed files with 12884 additions and 0 deletions

View File

@@ -0,0 +1,134 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
statusHeight : app.globalData.statusBarHeight,
order : '' //订单详情
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// 获取商品活动订单详情
this.orderInfo(options.id);
},
/**
* 商品活动订单详情
*/
orderInfo(id) {
wx.$api.exchange.show(id).then(res=>{
this.setData({
order : res.data
})
})
},
/**
* 取消订单
*/
orderDelete(e) {
let orderId = e.currentTarget.dataset.id
wx.showModal({
title : '订单取消',
content : '确认取消吗?',
success : res=> {
if (res.confirm) {
wx.$api.exchange.cancel(orderId).then(res=>{
wx.reLaunch({
url: '/pages/order/order'
})
wx.showToast({
title: res.data,
icon : 'none'
})
})
} else if (res.cancel) {
wx.showToast({
title : '取消',
icon : 'loading',
duration: 1000
})
}
}
})
},
/**
* 支付提交
*/
orderPay(e) {
let orderid = e.currentTarget.dataset.id
wx.$api.exchange.payments(orderid).then(res=>{
wx.$api.index.wechat(res.data.trade_no).then(res=>{
let payInfo = JSON.parse(res.data)
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr : payInfo.nonceStr,
package : payInfo.package,
paySign : payInfo.paySign,
signType : payInfo.signType,
success : res=>{
if(res.errMsg == "requestPayment:ok"){
wx.showToast({
title: '支付成功',
icon : 'success'
})
setTimeout(()=>{
wx.reLaunch({
url: '/pages/coupon/coupon?type=couponPublic'
})
},2000)
}
},
fail : res=>{
wx.reLaunch({
url: '/pages/order/order?stateType=unpay'
})
}
})
})
})
},
/**
* 返回上一页
*/
orderRun() {
wx.navigateBack({
delta: 1
})
},
/**
* 复制快递单号
*/
copyText (e) {
let text = e.currentTarget.dataset.text
wx.setClipboardData({
data : text,
success : res=> {
wx.getClipboardData({
success: res => {
wx.showToast({
title: '复制成功'
})
}
})
}
})
}
})