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.
109 lines
2.4 KiB
109 lines
2.4 KiB
// pages/order/show/index.js
|
|
let app = getApp();
|
|
import commonApi from "../../../utils/https/common"
|
|
import util from "../../../utils/util"
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
times:[],
|
|
product:null,
|
|
dateindex:-1,
|
|
timeindex:-1
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
let product = app.globalData.product,start_date = util.formatDate(new Date());
|
|
this.setData({
|
|
product:product
|
|
})
|
|
let end_date = util.formatDate(new Date(new Date(start_date.replace(/-/g,'/')).getTime() + 30 * 24 * 60 * 60 * 1000));
|
|
commonApi.user_post("show/get_show_sku_seats_price_by_date",{
|
|
sku_id:product.sku[0].id,
|
|
start_date:start_date,
|
|
end_date:end_date
|
|
}).then(res=>{
|
|
let dateindex = -1,timeindex=-1;
|
|
for(let i=0;i<res.data.length;i++){
|
|
for(let j =0;j<res.data[i].screen.length;j++){
|
|
if(res.data[i].screen[j].is_ticket==1 && dateindex==-1 && timeindex==-1){
|
|
dateindex = i;
|
|
timeindex = j;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
this.setData({
|
|
times:res.data,
|
|
dateindex:dateindex,
|
|
timeindex:timeindex
|
|
})
|
|
console.log(res)
|
|
})
|
|
},
|
|
|
|
selectTime:function(e){
|
|
let dateindex = e.currentTarget.dataset.dateindex,times = this.data.times,timeindex=e.currentTarget.dataset.timeindex;
|
|
if(times[dateindex].screen[timeindex].is_ticket==1){
|
|
this.setData({
|
|
timeindex:timeindex,
|
|
dateindex:dateindex
|
|
})
|
|
}
|
|
},
|
|
next:function(){
|
|
let product = app.globalData.product;
|
|
product.timeInfo = this.data.times[this.data.dateindex];
|
|
product.timeInfo.screen = [this.data.times[this.data.dateindex].screen[this.data.timeindex]];
|
|
app.globalData.product = product;
|
|
wx.navigateTo({
|
|
url: '../showSeat/index',
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
}
|
|
})
|