|
|
|
// pack-activity/pack/confirmPayment.js
|
|
|
|
import util from '../../utils/util';
|
|
|
|
import util, { unixtoTime } from '../../utils/util';
|
|
|
|
import App from '../../utils/api';
|
|
|
|
Page({
|
|
|
|
|
|
...
|
...
|
@@ -13,14 +13,28 @@ Page({ |
|
|
|
totalize:'',
|
|
|
|
},
|
|
|
|
type: '',
|
|
|
|
price:'',
|
|
|
|
detail:{},
|
|
|
|
time: 300,
|
|
|
|
countdown: '',
|
|
|
|
tip: '',
|
|
|
|
date: "",
|
|
|
|
sex:"先生",
|
|
|
|
sexObj:{},
|
|
|
|
index:0,
|
|
|
|
sexList:[
|
|
|
|
{
|
|
|
|
sex:'先生',
|
|
|
|
value:'1',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
sex:'女士',
|
|
|
|
value:'2',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
sex:'公司',
|
|
|
|
value:'3',
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
...
|
...
|
@@ -29,9 +43,10 @@ Page({ |
|
|
|
opt:{
|
|
|
|
detail:options.detail?JSON.parse(options.detail):'',
|
|
|
|
orderId:options.orderId,
|
|
|
|
totalize:options.totalize?options.totalize:''
|
|
|
|
totalize:options.totalize?options.totalize:'',
|
|
|
|
sellerid:options.sellerid?options.sellerid:'',
|
|
|
|
},
|
|
|
|
type:options.type
|
|
|
|
type:options.type,
|
|
|
|
})
|
|
|
|
console.log('onLoad',{...this.data.opt});
|
|
|
|
this.countdown()
|
|
...
|
...
|
@@ -40,31 +55,17 @@ Page({ |
|
|
|
showModal() {
|
|
|
|
this.modal.showModal() //调用组件中打开模态框方法
|
|
|
|
},
|
|
|
|
recharge(){
|
|
|
|
console.log('11111111111111111',this.data.opt.detail.oid);
|
|
|
|
this.closeModal()
|
|
|
|
wx.reLaunch({
|
|
|
|
url: `/miniprogram/pages/customer/detail_owner_invitation_new.wxml?id=${this.data.opt.detail.oid}&hasInvitation=1&hasSellerShare=1&tplid=1`
|
|
|
|
})
|
|
|
|
},
|
|
|
|
certificate(){
|
|
|
|
console.log('11111111111111111',this.data.opt.detail.oid);
|
|
|
|
this.closeModal()
|
|
|
|
wx.reLaunch({
|
|
|
|
url: '/miniprogram/pages/me/coupon_news'
|
|
|
|
})
|
|
|
|
},
|
|
|
|
confirmPayment(){
|
|
|
|
console.log(11111);
|
|
|
|
App.PayOnline.CombineTransactionsByRecharge({
|
|
|
|
id:this.data.opt.orderId
|
|
|
|
}).then(res=>{
|
|
|
|
console.log(res.ret);
|
|
|
|
console.log(res.data);
|
|
|
|
let that=this;
|
|
|
|
if(res.ret!='200'){
|
|
|
|
return util.toast(res.msg,'none');
|
|
|
|
}
|
|
|
|
if(res.ret=='200'){
|
|
|
|
console.log(res.ret);
|
|
|
|
this.setData({
|
|
|
|
price:res.data.price
|
|
|
|
})
|
|
|
|
wx.requestPayment({
|
|
|
|
timeStamp: res.data.timeStamp+'',
|
|
|
|
nonceStr: res.data.nonceStr,
|
|
...
|
...
|
@@ -72,22 +73,40 @@ Page({ |
|
|
|
signType: res.data.signType,
|
|
|
|
paySign: res.data.paySign,
|
|
|
|
success (ress) {
|
|
|
|
this.showModal()
|
|
|
|
if (ress.errMsg == 'requestPayment:ok') {
|
|
|
|
that.showModal()
|
|
|
|
console.log('支付成功',ress);
|
|
|
|
}
|
|
|
|
console.log('支付失败',ress);
|
|
|
|
},
|
|
|
|
fail (ress) {
|
|
|
|
console.log(ress);
|
|
|
|
}
|
|
|
|
console.log('支付失败',ress);
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
recharge(){
|
|
|
|
console.log('充值完成跳转',this.data.opt.detail.oid);
|
|
|
|
this.closeModal()
|
|
|
|
wx.reLaunch({
|
|
|
|
url: `/pages/customer/detail_owner_invitation_new?id=${this.data.opt.detail.oid}&hasInvitation=1&hasSellerShare=1&tplid=1`
|
|
|
|
})
|
|
|
|
},
|
|
|
|
certificate(){
|
|
|
|
this.closeModal()
|
|
|
|
wx.reLaunch({
|
|
|
|
url: '/pages/me/coupon_news'
|
|
|
|
})
|
|
|
|
},
|
|
|
|
closeModal() {
|
|
|
|
this.modal.closeModal() //调用组件中关闭模态框方法
|
|
|
|
},
|
|
|
|
// 充值————点击确认支付
|
|
|
|
// 点击确认支付
|
|
|
|
formSubmit(e) {
|
|
|
|
console.log(this.data.type);
|
|
|
|
if(this.data.time==0){
|
|
|
|
return util.toast('当前订单已过期,请重新进入优惠券购买页面下单', 'none');
|
|
|
|
}
|
|
|
|
if(this.data.type=='2'){
|
|
|
|
let form=e.detail.value
|
|
|
|
if (!form.name) {
|
|
...
|
...
|
@@ -102,18 +121,47 @@ Page({ |
|
|
|
util.toast('手机号码错误', 'none')
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let recharge_money=this.data.opt.detail.recharge_money*1;
|
|
|
|
if(recharge_money==0){
|
|
|
|
setTimeout(() => {
|
|
|
|
util.toast('您的会员充值已经在办理中,到店消费时请和收银核实,谢谢!','none',3000);
|
|
|
|
wx.navigateBack(1)
|
|
|
|
}, 3500);
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.addInfo(form)
|
|
|
|
}else{
|
|
|
|
this.confirmPayment()
|
|
|
|
}
|
|
|
|
console.log(1111);
|
|
|
|
this.confirmPayment()
|
|
|
|
},
|
|
|
|
addInfo(form){
|
|
|
|
App.GuestManage.InsGuest({
|
|
|
|
sellerid:this.data.opt.sellerid,
|
|
|
|
rname:form.name,
|
|
|
|
sex:this.data.sexObj.value,//1男 2女 3公司
|
|
|
|
phone:form.phone,
|
|
|
|
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 选择日期
|
|
|
|
bind_ChangeDate(event) {
|
|
|
|
console.log();
|
|
|
|
let date = event.detail.value
|
|
|
|
this.setData({
|
|
|
|
date
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 选择性别
|
|
|
|
bind_Changesex(event){
|
|
|
|
console.log('event.detail',{...event.detail});
|
|
|
|
let index = event.detail.value
|
|
|
|
let sexObj = this.data.sexList[index]
|
|
|
|
this.setData({
|
|
|
|
sexObj,
|
|
|
|
index
|
|
|
|
})
|
|
|
|
console.log('sexsexsex',sexObj);
|
|
|
|
console.log('index',index);
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
...
|
...
|
@@ -129,15 +177,24 @@ Page({ |
|
|
|
},
|
|
|
|
// 倒计时
|
|
|
|
countdown() {
|
|
|
|
var minute = Math.floor(this.data.time / 60);
|
|
|
|
var second = this.data.time % 60
|
|
|
|
var minute = Math.floor(this.data.time*1 / 60);
|
|
|
|
var second = this.data.time % 60;
|
|
|
|
second < 10 ? second = '0' + second : '';
|
|
|
|
this.setData({
|
|
|
|
countdown: minute + ':' + second,
|
|
|
|
time: this.data.time - 1
|
|
|
|
})
|
|
|
|
if(this.data.time==0){
|
|
|
|
this.setData({
|
|
|
|
countdown: '0:00'
|
|
|
|
})
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
setTimeout(this.countdown, 1000);
|
|
|
|
},
|
|
|
|
navEvent(){
|
|
|
|
wx.navigateBack(2);
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
...
|
...
|
|