|
|
|
@ -10,30 +10,34 @@ Page({
|
|
|
|
|
* 页面的初始数据
|
|
|
|
|
*/
|
|
|
|
|
data: {
|
|
|
|
|
rolled:true,
|
|
|
|
|
max_viewer_num:6
|
|
|
|
|
rolled: true,
|
|
|
|
|
max_viewer_num: 6
|
|
|
|
|
},
|
|
|
|
|
roll_spread() {
|
|
|
|
|
this.setData({
|
|
|
|
|
rolled: !this.data.rolled
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
viewer_nav(){
|
|
|
|
|
viewer_nav() {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/pages/user/viewer_list/viewer_list?_add=1',
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
de(){
|
|
|
|
|
this.setData({fee_detail:!this.data.fee_detail})
|
|
|
|
|
de() {
|
|
|
|
|
this.setData({
|
|
|
|
|
fee_detail: !this.data.fee_detail
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
check(event){
|
|
|
|
|
check(event) {
|
|
|
|
|
this.setData({
|
|
|
|
|
checked: event.detail,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
agreement(){
|
|
|
|
|
this.setData({show:true})
|
|
|
|
|
agreement() {
|
|
|
|
|
this.setData({
|
|
|
|
|
show: true
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
viewer_sel(event) {
|
|
|
|
|
this.setData({
|
|
|
|
@ -51,56 +55,63 @@ this.setData({show:true})
|
|
|
|
|
|
|
|
|
|
noop() {},
|
|
|
|
|
onSubmit() {
|
|
|
|
|
if(this.data._info.show_info.is_real_name==1){
|
|
|
|
|
if (this.data._info.show_info.is_real_name == 1) {
|
|
|
|
|
var tid = this.data.tid
|
|
|
|
|
var viewer_id = this.data.viewer_sel
|
|
|
|
|
if (viewer_id && tid.split(',').length == viewer_id.length) {
|
|
|
|
|
if(this.data.checked){
|
|
|
|
|
this.setData({show1:true})
|
|
|
|
|
}else{
|
|
|
|
|
if (this.data.checked) {
|
|
|
|
|
this.setData({
|
|
|
|
|
show1: true
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '请勾选服务条款',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 2000
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
} else {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '观演人数和座位数不符',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 2000
|
|
|
|
|
})
|
|
|
|
|
}}else if(this.data._info.show_info.is_real_name==2){
|
|
|
|
|
}
|
|
|
|
|
} else if (this.data._info.show_info.is_real_name == 2) {
|
|
|
|
|
var tid = this.data.tid
|
|
|
|
|
var viewer_id = this.data.viewer_sel
|
|
|
|
|
if (viewer_id && viewer_id.length==1) {
|
|
|
|
|
if(this.data.checked){
|
|
|
|
|
this.setData({show1:true})
|
|
|
|
|
}else{
|
|
|
|
|
if (viewer_id && viewer_id.length == 1) {
|
|
|
|
|
if (this.data.checked) {
|
|
|
|
|
this.setData({
|
|
|
|
|
show1: true
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '请勾选服务条款',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 2000
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '观演人数和座位数不符',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 2000
|
|
|
|
|
})
|
|
|
|
|
}}
|
|
|
|
|
else{
|
|
|
|
|
if(this.data.checked){
|
|
|
|
|
this.setData({show1:true})
|
|
|
|
|
}else{
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (this.data.checked) {
|
|
|
|
|
this.setData({
|
|
|
|
|
show1: true
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '请勾选服务条款',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 2000
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
pay() {
|
|
|
|
|
var tid = this.data.tid
|
|
|
|
@ -111,17 +122,17 @@ else{
|
|
|
|
|
}
|
|
|
|
|
viewer_id = arr.substring(1)
|
|
|
|
|
var order_data
|
|
|
|
|
let coupon =this.data.coupon
|
|
|
|
|
let coupon = this.data.coupon
|
|
|
|
|
if (coupon && coupon.coupon_id && "underfined" !== coupon.coupon_id) {
|
|
|
|
|
order_data = {
|
|
|
|
|
order_type:8,
|
|
|
|
|
order_type: 8,
|
|
|
|
|
tid,
|
|
|
|
|
viewer_id,
|
|
|
|
|
coupon_id: coupon.coupon_id
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
order_data = {
|
|
|
|
|
order_type:8,
|
|
|
|
|
order_type: 8,
|
|
|
|
|
tid,
|
|
|
|
|
viewer_id
|
|
|
|
|
}
|
|
|
|
@ -140,7 +151,7 @@ else{
|
|
|
|
|
icon: 'success',
|
|
|
|
|
duration: 1000
|
|
|
|
|
})
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
wx.reLaunch({
|
|
|
|
|
url: '/pages/user/my_order/my_order'
|
|
|
|
|
})
|
|
|
|
@ -149,10 +160,10 @@ else{
|
|
|
|
|
fail(res) {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '支付未成功',
|
|
|
|
|
icon:'error',
|
|
|
|
|
icon: 'error',
|
|
|
|
|
duration: 2000
|
|
|
|
|
})
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
wx.reLaunch({
|
|
|
|
|
url: '/pages/user/my_order/my_order'
|
|
|
|
|
})
|
|
|
|
@ -163,6 +174,51 @@ else{
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 使用最大减免优惠券
|
|
|
|
|
getRecommendCoupons(drama_id,tid){
|
|
|
|
|
http('/api/v1/coupon-list', "post", {drama_id,tid,mode:1}).then(Response => {
|
|
|
|
|
if (Response.coupon_list.length > 0) {
|
|
|
|
|
let coupon_list = Response.coupon_list
|
|
|
|
|
|
|
|
|
|
// 去除日期格式
|
|
|
|
|
let a = []
|
|
|
|
|
coupon_list.forEach((item) => {
|
|
|
|
|
item.end_date = item.end_date.replace(/[\u4e00-\u9fa5]/g, '')
|
|
|
|
|
a.push(item)
|
|
|
|
|
})
|
|
|
|
|
coupon_list = a
|
|
|
|
|
|
|
|
|
|
// 优惠券筛选策略
|
|
|
|
|
function couponSort(list, params) {
|
|
|
|
|
let descList
|
|
|
|
|
if (arguments[2] == 'asc') {
|
|
|
|
|
descList = list.sort((a, b) => {
|
|
|
|
|
return a[params] - b[params]
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
descList = list.sort((a, b) => {
|
|
|
|
|
return b[params] - a[params]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let l = []
|
|
|
|
|
l.push(descList[0])
|
|
|
|
|
descList.forEach((item, index) => {
|
|
|
|
|
if (index != 0 && item[params] == l[0][params]) {
|
|
|
|
|
l.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let recommendCoupons = couponSort(couponSort(couponSort(coupon_list, "subtract"), 'full'), 'end_date', 'asc')
|
|
|
|
|
if (recommendCoupons && recommendCoupons.length > 0) {
|
|
|
|
|
this.setData({
|
|
|
|
|
coupon: recommendCoupons[0]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -170,16 +226,20 @@ else{
|
|
|
|
|
*/
|
|
|
|
|
onLoad: function (options) {
|
|
|
|
|
http("/api/v1/order-confirm", "post", {
|
|
|
|
|
tid:options.tid
|
|
|
|
|
tid: options.tid
|
|
|
|
|
}).then(res => {
|
|
|
|
|
let _info=res
|
|
|
|
|
let _info = res
|
|
|
|
|
/* ??????自己算总价???????? */
|
|
|
|
|
let tprice = 0
|
|
|
|
|
for(let i in _info.ticket_info){
|
|
|
|
|
tprice+=_info.ticket_info[i].price*_info.ticket_info[i].tkt_num
|
|
|
|
|
for (let i in _info.ticket_info) {
|
|
|
|
|
tprice += _info.ticket_info[i].price * _info.ticket_info[i].tkt_num
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.getRecommendCoupons(options.drama_id,options.tid)
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
_info,tprice,
|
|
|
|
|
_info,
|
|
|
|
|
tprice,
|
|
|
|
|
tid: options.tid,
|
|
|
|
|
drama_id: options.drama_id,
|
|
|
|
|
})
|
|
|
|
|