Commit 0cadf8d0 authored by youjie's avatar youjie

签证支付

parent c239db09
......@@ -207,6 +207,7 @@
font-weight: 600;
margin-right: 60rpx;
flex-shrink: 0;
width: 115rpx;
}
.jz_form .form-items .val {
flex: 1;
......@@ -394,6 +395,14 @@
{{ orderData.model.CreateDate.replace("T", " ") }}
</view>
</view>
<!-- #ifdef MP-DI -->
<view class="form-items">
<view class="label">联系人</view>
<view class="jz_SureVal">
{{ orderData.model.ContactName+'/'+orderData.model.ContactMobile }}
</view>
</view>
<!-- #endif -->
<!-- <view class="form-items">
<view class="label">下单日期</view>
<view class="jz_SureVal">
......@@ -509,7 +518,7 @@
}}</view>
</view>
<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index" v-if=" orderData.model&& orderData.model.DiscountMoney&&orderData.model.DiscountMoney>0">
<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index" v-if="orderData.model.DiscountMoney&&orderData.model.DiscountMoney>0">
<view style="flex: 1">
<text style="margin-right: 30rpx">优惠金额</text>
</view>
......@@ -604,7 +613,6 @@
onLoad(option) {
if (option.orderData) {
this.orderData = JSON.parse(decodeURIComponent(option.orderData));
this.getOrderInfoHandler()
} else if (option.orderId) {
this.initOrderInfo(option.orderId);
} else if(option.OrderNo){
......@@ -622,10 +630,6 @@
if (res.resultCode == 1) {
this.orderInfo =JSON.parse(res.data.sPayInfo)
console.log(this.orderInfo,'----orderInfo');
uni.showToast({
icon: 'none',
title: '支付中...',
})
this.goPayHandler();
} else {
uni.showToast({
......@@ -662,7 +666,7 @@
},
fail: function(err) {
console.log("fail:", err);
this.submit = false;
that.submit = false;
uni.showToast({
title: "支付失败",
icon: "none",
......
......@@ -93,6 +93,7 @@
</view>
<!-- #ifdef MP-DI -->
<view class="line-flex col" style="padding: 30rpx; background: #fff;margin-top: 20rpx"
v-if="createBy==0&&SaleList&&SaleList.length>1"
@click="showSalePreviwe=true">
......@@ -113,6 +114,7 @@
<u-icon name="arrow-down" size="24"></u-icon>
</view>
</view>
<!-- #endif -->
<view class="visaDetailDesBox">
<view class="visaDetailDes">
<view class="visaDetailDesTitle">签证说明</view>
......@@ -521,7 +523,7 @@
"lineId": '', //线路ID
"lineteamId": '', //系列ID
"userId": this.customer.accountId, //AccountId
"CouponsUseScope": 3, //特定使用平台(当地游=8 跟团游=2 小包团=10)
"CouponsUseScope": 3, //签证优惠券
"isExpansion": 0, //是否启动膨胀金1-是
// #ifdef MP-DI
"CustomerType": 1, //客户类型 0-同行,1-直客
......
......@@ -498,10 +498,6 @@
<view class="row items-center visaProductTextBox">
<view class="visaProduct_rColor visaProductTextL">*</view>
<view class="visaProductTitle">订购人信息</view>
<view v-if="tipsText" class="row visaProduct_rColor visaProductTextR items-center">
<view>{{tipsText}}</view>
<img style="width: 19rpx;height: 19rpx;margin-left: 5rpx;" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638751271514841634.png"/>
</view>
</view>
<view class="row visaProductNumBox">
<!-- <view class="visaProductNum column">
......@@ -807,7 +803,6 @@
showCity: false,
provinceList: [],
cityList: [],
tipsText: '',
userInfo:{},
};
},
......@@ -819,6 +814,7 @@
this.activeStyle = `background:${this.mainColor};`;
},
onLoad(option) {
let that = this;
uni.getSystemInfo({
success(res) {
......@@ -832,8 +828,10 @@
});
this.mainColor = this.$uiConfig.mainColor;
this.userInfo = uni.getStorageSync("mall_UserInfo");
this.customer = uni.getStorageSync("b2b_user");
this.customer.Mailbox = ''
this.orderMsg.RelationName = this.customer.name
this.calcMoney()
if (option.id) {
this.orderMsg.Pid = option.id
......@@ -846,6 +844,85 @@
this.initCountry()
},
methods: {
submitB2COrderHandler(OrderId) {
let guestInfo = `${this.orderMsg.AdultPeopleNum} 人; `;
if (this.orderMsg.ChildPeopleNum > 0) {
guestInfo += `儿童x${this.orderMsg.ChildPeopleNum}; `;
}
let msg = {
SurName: this.orderMsg.RelationName,
Name: '',
ContactNumber: this.customer.contactNumber,
Mailbox: this.customer.Mailbox,
GoodsId: this.orderMsg.Pid,
GoodsName: this.dataList.Name,
GoodsPic: this.dataList.CoverImageList[0].Url? this.dataList.CoverImageList[0].Url : '',
GoodsType: 15,
OrderMake: `${guestInfo} ${this.dataList.SendCityName?'送签地:'+this.dataList.SendCityName+';':''} ${this.dataList.VisaValidity?'有效日期:'+this.dataList.VisaValidity+';':''} ${this.orderMsg.EnterCountryTime}入境 `,
TotalPrice: this.price,
PreferentialPrice: this.currentCoupon.discountMoney,
ErpOrderId: OrderId,
Country: 0,
PlatformTax: 0,
Income: 0,
Refund: 0,
MallBaseId: this.userInfo.MallBaseId,
};
this.apipost("AddOrderInfo_post", msg, (res) => {
if (res.resultCode == 1) {
this.orderInfo =JSON.parse(res.data.sPayInfo)
uni.showToast({
icon: 'none',
title: '订单创建成功'
})
this.goPayHandler(res.data.OrderNo);
} else {
uni.showToast({
title:res.message,
icon:'none',
duration:3000
})
this.submit = false;
}
});
},
goPayHandler(OrderNo) {
uni.requestPayment({
provider: "wxpay",
timeStamp: this.orderInfo.timeStamp,
nonceStr: this.orderInfo.nonceStr,
package: this.orderInfo.package,
signType: this.orderInfo.signType,
paySign: this.orderInfo.sign,
success: function(res) {
console.log("success", res);
this.submit = false;
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
this.price +
"&isFrom=1",
});
}, 100);
},
fail: function(err) {
console.log("fail:", err);
this.submit = false;
uni.showToast({
title: "支付失败",
icon: "none",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/visa/visa_SureOrder?OrderNo=" + OrderNo,
});
}, 100);
},
});
},
editNum(type) {
if (type == 1) {
if(this.orderMsg.AdultPeopleNum>1)this.orderMsg.AdultPeopleNum--;
......@@ -1007,7 +1084,7 @@
"lineId": '', //线路ID
"lineteamId": 0, //系列ID
"userId": this.customer.accountId,
"CouponsUseScope": 3, //特定使用平台(当地游=8 跟团游=2 小包团=10)
"CouponsUseScope": 3, //签证优惠券
"isExpansion": 0, //是否启动膨胀金1-是
"CustomerType": 0, //客户类型 0-同行,1-直客
"TCID": '',
......@@ -1120,104 +1197,45 @@
this.price = money;
},
//去支付
goPay() {
if (this.orderMsg.EnterCountryTime == "") {
uni.showToast({
title: `请选择入境日期`,
icon: "none",
});
return;
}
this.tipsText = ''
if (this.orderMsg.RelationName == "") {
this.tipsText = '请输入姓名'
return;
}
if (this.customer.PhoneCountryStr == "") {
this.tipsText = '请选择国家/地区'
return;
}
if (this.customer.contactNumber == "") {
this.tipsText = '请输入电话'
return;
}
if (this.customer.contactNumber&&this.customer.contactNumber.length<11) {
this.tipsText = '请输入正确的电话'
return;
}
if (this.customer.Mailbox == "") {
this.tipsText = '请输入邮箱地址'
uni.showToast({
title: `请输入邮箱地址`,
icon: "none",
});
return;
}
validate(){
let email = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
if (!email.test(this.customer.Mailbox)) {
this.tipsText = '请输入正确的邮箱地址'
uni.showToast({
title: `请输入正确的邮箱地址`,
icon: "none",
});
return;
}
if (this.orderMsg.Receiver == "") {
uni.showToast({
title: `请输入收件人`,
icon: "none",
});
return;
let msg = ''
if(this.orderMsg.EnterCountryTime == ""){
msg = '请选择入境日期'
}else if(this.orderMsg.RelationName==''){
msg = '请输入姓名'
}else if(this.customer.contactNumber==''){
msg = '请输入电话'
} else if(this.customer.contactNumber&&this.customer.contactNumber.length!=11){
msg = '请输入正确的电话'
}else if(this.customer.Mailbox==''){
msg = '请输入邮箱地址'
}else if (!email.test(this.customer.Mailbox)) {
msg = '请输入正确的邮箱地址'
}else if (this.orderMsg.Receiver == "") {
msg = '请输入收件人'
}else if (this.orderMsg.ReceiverPhone == "") {
msg = '请输入收件人电话'
}else if (this.orderMsg.ReceiverPhone&&this.orderMsg.ReceiverPhone.length!=11) {
msg = '请输入正确的收件人电话'
}else if (this.orderMsg.ReceiverProvince=="") {
msg = '请选择省'
}else if (this.orderMsg.ReceiverCity=="") {
msg = '请选择市'
}else if (this.orderMsg.ReceiverAddress=="") {
msg = '请输入收件人地址'
}
if (this.orderMsg.RelationPhoneType == "") {
uni.showToast({
title: `请选择收件人国家/地区`,
icon: "none",
});
return;
}
if (this.orderMsg.ReceiverPhone == "") {
uni.showToast({
title: `请输入收件人电话`,
icon: "none",
});
return;
}
if (this.orderMsg.ReceiverPhone&&this.orderMsg.ReceiverPhone.length<11) {
return msg
},
//去支付
goPay() {
const error = this.validate()
if(error!=''){
uni.showToast({
title: `请输入正确的收件人电话`,
icon: "none",
});
return;
}
if (this.orderMsg.RelationPhoneType == "") {
uni.showToast({
title: `请选择收件人国家/地区`,
icon: "none",
});
return;
}
if (this.orderMsg.ReceiverProvince == "") {
uni.showToast({
title: `请选择省`,
icon: "none",
});
return;
}
if (this.orderMsg.ReceiverCity == "") {
uni.showToast({
title: `请选择市`,
icon: "none",
});
return;
}
if (this.orderMsg.ReceiverAddress == "") {
uni.showToast({
title: `请输入收件人地址`,
icon: "none",
});
return;
icon:'none',
title:error
})
return
}
// #ifdef MP-AG
if(!this.CreateBy){
......@@ -1284,20 +1302,22 @@
msg,
(res) => {
if (res.resultCode == 1) {
if (this.isUpdateUserInfo) {
this.setUserInfoHandler();
}
const tempData = res.data
if(tempData.CounponList && tempData.CounponList.length>0){
uni.setStorageSync('coupons',tempData.CounponList)
}
uni.showToast({
title: '订单创建成功.',
icon: 'none'
})
uni.redirectTo({
url: "/pages/visa/visa_MyOrder",
});
// #ifdef MP-DI
this.submitB2COrderHandler(tempData.airOrderId)
// #endif
// #ifdef MP-AG
uni.showToast({
title: '订单创建成功.',
icon: 'none'
})
uni.redirectTo({
url: "/pages/visa/visa_MyOrder",
});
// #endif
} else {
uni.showToast({
title:res.message,
......@@ -1305,7 +1325,9 @@
duration:3000
})
}
this.submit = false;
// #ifdef MP-AG
this.submit = false;
// #endif
},
(e) => {
this.submit = false;
......@@ -1317,22 +1339,6 @@
}
);
},
setUserInfoHandler() {
this.apipost("UpdateUserInfo_post", {
Mailbox: '',
Surname:'',//姓,
Name:'',//名,
EnSurname:'',//英文-姓,
EnName:'',//英文名,
Moblie:'',//手机号码,
Countr:'',//国家,
Appellation:'',//称谓,
PhoneCountry:'',//手机号所属国家,
BirthDate:'',//生日
}, (r) => {
console.log(r,'-----同步会员接口');
});
},
// #ifdef MP-WEIXIN
//微信支付
queren(OrderId) {
......
......@@ -207,6 +207,7 @@
font-weight: 600;
margin-right: 60rpx;
flex-shrink: 0;
width: 115rpx;
}
.jz_form .form-items .val {
flex: 1;
......@@ -485,7 +486,7 @@
</view>
</view>
<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index" v-if=" orderData.model&& orderData.OrderModel.DiscountMoney&&orderData.OrderModel.DiscountMoney>0">
<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index" v-if="orderData.OrderModel.DiscountMoney&&orderData.OrderModel.DiscountMoney>0">
<view style="flex: 1">
<text style="margin-right: 30rpx">优惠金额</text>
</view>
......@@ -511,10 +512,19 @@
</view>
<view class="jz_orderbox flex" v-if="showPayBtn">
<view style="display: flex">
<view class="jz_OrderReNow" @click="goCancel" style="background: #fff; color: #111; border: 1px solid #111">
<button class="jz_OrderReNow" @click="goCancel"
style="background: #fff; color: #111; border: 1px solid #111"
:disabled="submitCancel" :loading="submitCancel">
<text v-if="!submitCancel">取消</text>
<u-loading v-if="submitCancel" size="32" color="#111"></u-loading>
</view>
</button>
<!-- #ifdef MP-DI -->
<button class="jz_OrderReNow"
style="margin-left: 20rpx;"
@click="submitGetCodeByOrderNo" :disabled="submit" :loading="submit">
立即支付
</button>
<!-- #endif -->
<!-- 返回上一页 -->
<!-- <view
class="jz_OrderReNow"
......@@ -563,6 +573,8 @@
submitCancel: false,
showPayBtn: true,
Refund: 0,
orderInfo:null,
OrderNo: '',
};
},
created() {},
......@@ -571,9 +583,74 @@
this.orderData = JSON.parse(decodeURIComponent(option.orderData));
} else if (option.orderId) {
this.initOrderInfo(option.orderId);
} else if(option.OrderNo){
this.OrderNo = option.OrderNo
this.getOrderInfoHandler(this.OrderNo)
}
},
methods: {
submitGetCodeByOrderNo() {
this.submit = true
this.apipost("GetCodeByOrderNo_post", {
OrderNo: this.OrderNo,
MallBaseId: uni.getStorageSync("mall_UserInfo").MallBaseId
}, (res) => {
if (res.resultCode == 1) {
this.orderInfo =JSON.parse(res.data.sPayInfo)
console.log(this.orderInfo,'----orderInfo');
this.goPayHandler();
} else {
uni.showToast({
title:res.message,
icon:'none',
duration:3000
})
this.submit = false;
}
});
},
goPayHandler() {
let that = this;
uni.requestPayment({
provider: "wxpay",
timeStamp: this.orderInfo.timeStamp,
nonceStr: this.orderInfo.nonceStr,
package: this.orderInfo.package,
signType: this.orderInfo.signType,
paySign: this.orderInfo.sign,
success: function(res) {
console.log("success", res);
this.submit = false;
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
this.price +
"&isFrom=1",
});
}, 100);
},
fail: function(err) {
console.log("fail:", err);
that.submit = false;
uni.showToast({
title: "支付失败",
icon: "none",
});
},
});
},
getOrderInfoHandler(OrderNo){
this.apipost("GetDetailsByOrderNo_post",{OrderNo},res=>{
if(res.resultCode==1){
this.initOrderInfo(res.data.ErpOrderId);
}else{
}
})
},
goDetail() {
uni.navigateTo({
url: "/pages/visa/visaDetail?id="+this.orderData.ProductModel.Id
......@@ -590,6 +667,7 @@
if (this.orderData.OrderModel.VisaOrderStatus!=2&&
(this.orderData.OrderModel.VisaOrderStatus==1&&this.orderData.OrderModel.Income==0)
||(this.orderData.OrderModel.VisaOrderStatus==3)) {
this.submitCancel = true
let that = this
wx.showModal({
title: '提示',
......@@ -613,12 +691,13 @@
});
}
uni.hideLoading()
this.submitCancel = false
},
(err) => {
uni.hideLoading()
}
);
}
}else this.submitCancel = false
}
})
}
......@@ -755,11 +834,11 @@
},
fail: function(err) {
console.log("fail:", err);
that.submit = false;
uni.showToast({
title: "支付失败",
icon: "none",
});
that.submit = false;
that.initOrderInfo(that.orderData.OrderModel.Id);
},
});
......@@ -858,8 +937,8 @@
},
(err) => {
console.log("err", err);
uni.hideLoading();
that.submit = false;
uni.hideLoading();
uni.showToast({
title: "支付失败",
icon: "none",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment