// 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 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let key = options.key; if(!key){ util.back() return; } let product = app.globalData.product,price=0; product.info.selectSeatInfo.map(item=>{ price = Number(item.price) + Number(price) }) this.setData({ product:product, key:key, price:price }) 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,seats_list=[],seats_ids=[]; 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.length,//也就是锁定的座位数,必填 "reserve_mobile": this.data.tel, "use_date": product.info.show_date,//使用日期,Y-m-d日期格式字符串,必填 "use_time": product.info.start_end_time,//场次时间,直接传字符串,必填 "show_version": product.info.show_version,//场次版本,必填 "scene_id": product.product.scene_id,//场景id,我方系统的场景id,必填 "schedules_name": product.info.hallName,//放映厅名称,必填 "seats_list": seats_list.join(","),//座位中文名称,多个座位逗号分隔,必填 "key": this.data.key,//锁座返回的key,必填 "schedules_id": product.info.schedule_id,//淘票票场次id,必填 "seats_ids": seats_ids }]; 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(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 }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { } })