You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
219 lines
4.3 KiB
219 lines
4.3 KiB
// pages/order_detail/order_detail.js
|
|
import {
|
|
http
|
|
} from '../../../utils/util'
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
// checked: false,
|
|
show: false,
|
|
a_id:0
|
|
},
|
|
sub(e){
|
|
let a_id =e.currentTarget.dataset.a_id
|
|
console.log(a_id)
|
|
if(a_id==0){
|
|
a_id=this.data.a.length-1
|
|
}else{
|
|
a_id=a_id-1
|
|
}
|
|
this.setData({a_id})
|
|
},
|
|
plus(e){
|
|
let a_id =e.currentTarget.dataset.a_id
|
|
console.log(a_id)
|
|
if(a_id==this.data.a.length-1){
|
|
a_id=0
|
|
}else{
|
|
a_id=a_id+1
|
|
}
|
|
this.setData({a_id})
|
|
},
|
|
/* check(event) {
|
|
this.setData({
|
|
checked: event.detail,
|
|
});
|
|
},
|
|
agreement() {
|
|
this.setData({
|
|
show1: true
|
|
})
|
|
}, */
|
|
loc(e) {
|
|
if (e.currentTarget.dataset.longitude && e.currentTarget.dataset.latitude) {
|
|
wx.openLocation({
|
|
latitude: e.currentTarget.dataset.latitude,
|
|
longitude: e.currentTarget.dataset.longitude,
|
|
name: this.data.show_info.theater_name,
|
|
address: this.data.show_info.traffic_info
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: '地址信息错误',
|
|
icon: "error",
|
|
duration: 2000
|
|
})
|
|
}
|
|
|
|
},
|
|
showPopup() {
|
|
this.setData({
|
|
show: true
|
|
});
|
|
},
|
|
onChange(event) {
|
|
this.setData({
|
|
checked: event.detail,
|
|
});
|
|
},
|
|
onClose() {
|
|
this.setData({
|
|
show: false
|
|
});
|
|
},
|
|
cancel(e) {
|
|
let that = this
|
|
wx.showModal({
|
|
content: '是否取消订单',
|
|
success(res) {
|
|
if (res.confirm) {
|
|
http("/api/v1/order-cancel", "post", {
|
|
order_no: that.data.order_no
|
|
}).then(res => {
|
|
wx.showToast({
|
|
title: '取消订单成功!',
|
|
duration: 2000
|
|
})
|
|
wx.navigateBack()
|
|
var pages = getCurrentPages(); //获取页面栈
|
|
if (pages.length > 1) {
|
|
//上一个页面实例对象
|
|
var prePage = pages[pages.length - 2];
|
|
//调用上一个页面的onShow方法
|
|
prePage.onLoad({})
|
|
}
|
|
})
|
|
}}})
|
|
|
|
},
|
|
pay() {
|
|
http("/api/v1/pay", "post", {
|
|
order_no: this.data.order_no
|
|
}).then(res => {
|
|
wx.requestPayment({
|
|
timeStamp: res.timestamp,
|
|
nonceStr: res.nonceStr,
|
|
package: res.package,
|
|
signType: res.signType,
|
|
paySign: res.paySign,
|
|
success(res) {
|
|
console.log(res)
|
|
wx.showToast({
|
|
title: '支付成功!',
|
|
icon: 'success',
|
|
duration: 2000
|
|
})
|
|
},
|
|
fail(res) {
|
|
console.log(res)
|
|
wx.showToast({
|
|
title: '支付未成功',
|
|
icon: 'error',
|
|
duration: 2000
|
|
})
|
|
}
|
|
})
|
|
})
|
|
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
let order_no = options.order_no
|
|
let _type = options._type
|
|
this.setData({
|
|
order_no,_type
|
|
})
|
|
if (order_no&&_type) {
|
|
http("/api/v1/order-detail", "get", {
|
|
order_no,type:_type
|
|
}).then(res => {
|
|
this.setData({
|
|
order_info: res.order_info,
|
|
show_info: res.show_info,
|
|
ticket_info: res.ticket_info,
|
|
viewer_info: res.viewer_info
|
|
})
|
|
let arr = res.ticket_info
|
|
let a = []
|
|
for (let x in arr) {
|
|
for (let i in arr[x].list) {
|
|
arr[x].list[i].price=arr[x].price
|
|
a.push(arr[x].list[i])
|
|
}
|
|
}
|
|
this.setData({a})
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: '未正常传入订单号',
|
|
icon: 'error',
|
|
duration: 2000
|
|
})
|
|
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
}) |