// pages/order/movie/index.js import util from "../../../utils/util" import commonApi from "../../../utils/https/common" import userApi from "../../../utils/https/user" let app = getApp() Page({ /** * 页面的初始数据 */ data: { key:"", tel:'', product:null, price:0, coupon:null, prizeId:null, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options); this.setData({ prizeId:wx.getStorageSync('prizeId') }) let product = app.globalData.product,price=0; product.info.selectSeatInfo = JSON.parse(options.selectSeatInfo) product.info.selectSeatInfo.seatPriceInfo.map(item=>{ price =price +Math.ceil(Number(item.split('-')[1])*1.006 * 100) / 100 }) console.log(product); console.log(price); this.setData({ product:product, price:price*100 }) userApi.user_post("user/getMyInfo").then(res=>{ this.setData({ tel:res.data.mobile }) }) }, changeTel:function(e){ this.setData({ tel:e.detail.value }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, order:function(){ if(!this.data.tel){ wx.showToast({ title: '请输入手机号', icon:'none' }) return; } let product = this.data.product // product.info.selectSeatInfo.map(item=>{ // seats_list.push(item.name); // seats_ids.push({ // ext_id:item.ext_id, // area:item.area || "", // flag:Number(item.flag) // }) // }) let product_list = [{ "type" : "movie",//电影,必填 "product_id": product.product.id, "sku_id": product.product.sku_info.id, "product_num": product.info.selectSeatInfo.seatInfo.length,//也就是锁定的座位数,必填 "reserve_mobile": this.data.tel, "use_date": product.info.show_date,//使用日期,Y-m-d日期格式字符串,必填 "use_time": product.info.show_time+'-'+product.info.close_time,//场次时间,直接传字符串,必填 "show_version": product.info.show_version,//场次版本,必填 "scene_id": product.product.scene_id,//场景id,我方系统的场景id,必填 "schedules_name": product.info.hallName,//放映厅名称,必填 "seats_list": product.info.selectSeatInfo.seatInfo.join(","),//座位中文名称,多个座位逗号分隔,必填 // "key": this.data.key,//锁座返回的key,必填 "schedules_id": product.info.schedule_id,//淘票票场次id,必填 "seats_ids": product.info.selectSeatInfo.seatPriceInfo }]; let data = { product_list:product_list, source:"WECHATXCX", coupon_id:this.data.coupon?this.data.coupon.id:null } if(app.globalData.from){ data.system_name = app.globalData.from; } if(this.data.prizeId){ data.lottery_id = this.data.prizeId } if(app.globalData.retailId){ data.commission_code = app.globalData.retailId; app.globalData.retailId = null; } if(app.globalData.category_id){ data.category_id = app.globalData.category_id; } commonApi.user_post("order/create",{ data:JSON.stringify(data) }).then(res=>{ console.log(res) }) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.setData({ coupon:app.globalData.couponInfo }) console.log(this.coupon); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { app.globalData.couponInfo = null }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { } })