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.
 

116 lines
2.4 KiB

// pages/order/showOrder/index.js
let app = getApp()
import commonApi from "../../../utils/https/common"
Page({
/**
* 页面的初始数据
*/
data: {
product:app.globalData.product,
contact:[],
coupon:null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
product:app.globalData.product
})
},
setLinkman:function(e){
console.log(e)
this.setData({
contact:e.detail
})
},
order:function(){
let product = this.data.product,contact = this.data.contact;
if(contact.length!=product.seats.length){
wx.showToast({
title: '请选择'+product.seats.length+"个出行人",
icon:'none'
})
return;
}
let contactIds = [];
contact.map(item=>{
contactIds.push(item.id)
})
let data = {
coupon_id:this.data.coupon?this.data.coupon.id:null,
source:"WECHATXCX",
product_list:[{
"type" : "show",//演出
"product_id": product.id,
"sku_id": product.sku[0].id,
"use_date": product.timeInfo.sale_date,
"start_time": product.timeInfo.screen[0].start_time,
"end_time": product.timeInfo.screen[0].end_time,
"visitors": contactIds.join(","),
"product_num": product.seats.length,
"seats_ids":product.seats
}]
};
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)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
coupon:app.globalData.couponInfo
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
}
})