Commit ca1876e2 authored by youjie's avatar youjie

机票下单

parent 0cadf8d0
......@@ -129,16 +129,25 @@
<view class="fz26 color9999A5 MT5">共 {{dataModel.GuestNum}} 人</view>
</view>
<view class="row-aic-n">
<view v-if="dataModel.OrderState==1||dataModel.OrderState==2||dataModel.OrderState==3"
<!-- #ifdef MP-DI -->
<view v-if="dataModel.OrderState==1"
class="fz32 relative TicketOrderListCard-PrQx MR20"
:class="[loading?'color9999A5':'colorDEBF7B']"
@click="cancelOrder(dataModel)">取 消</view>
<!-- <view v-if="dataModel.OrderState==1||dataModel.OrderState==2"
@click="cancelOrderZK()">取 消</view>
<view v-if="dataModel.OrderState==1"
class="airTicketDetailsFooter-order PXY2463 row-ajc-w fontBold"
:class="[loading?'bgF5':'bgDEBF7B']"
@click="queren(orderMsg.ID)">
@click="submitGetCodeByOrderNo">
<text class="fz32">立即支付</text>
</view> -->
</view>
<!-- #endif -->
<!-- #ifdef MP-AG -->
<view v-if="dataModel.OrderState==1||dataModel.OrderState==2||dataModel.OrderState==3"
class="fz32 relative TicketOrderListCard-PrQx MR20"
:class="[loading?'color9999A5':'colorDEBF7B']"
@click="cancelOrder(dataModel)">取 消</view>
<!-- #endif -->
<view v-if="dataModel.OrderState==5||dataModel.OrderState==4"
class="airTicketDetailsFooter-order PXY2463 row-ajc-w fontBold bgDEBF7B borderDEBF7B"
@click="goUndOrder(dataModel.TCID)">
......@@ -185,7 +194,8 @@
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1696906397000_762.png',
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1696906709000_896.png'
],
title:'订单详情'
title:'订单详情',
OrderNo: '',
}
},
onLoad(options){
......@@ -193,8 +203,14 @@
backgroundColor: '#ECDFC4',
frontColor:'#000000'
})
if (options.orderId){
this.orderMsg.ID = options.orderId
this.getOrderDetails()
} else if(options.OrderNo){
this.OrderNo = options.OrderNo
this.getOrderInfoHandler(this.OrderNo)
}
let that = this;
uni.getSystemInfo({
success(res) {
......@@ -212,6 +228,70 @@
},
methods: {
submitGetCodeByOrderNo() {
if (this.submit || this.submitCancel) return;
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)
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.dataModel = res.data
this.orderMsg.ID = res.data.ErpOrderId
this.getOrderDetails()
}else{
}
})
},
goUndOrder(TCID){
uni.navigateTo({
url: '/pages/airTicket/airIndex'
......@@ -235,7 +315,9 @@
this.orderData = res.data;
// IsChargeLossOrders 1是收损单 2否
// IsApplyForCancel 1是小程序端发起取消 2否
// #ifdef MP-AG
this.dataModel = res.data.model
// #endif
this.orderData.model.GuestList.forEach(x=>{
let obj = {
SurName:x.SurName+x.Name,
......@@ -475,6 +557,34 @@
);
}
},
cancelOrderZK(){
let that = this
if(this.loading){
return
}
uni.showLoading({
title: "请稍等片刻...",
})
this.loading = true
this.apipost(
"GetCancelOrder_post", {
OrderNo: this.OrderNo
},
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
that.getOrderDetails()
}
this.loading = false
},
(err) => {
this.loading = false
}
);
},
//微信支付
queren(OrderId) {
if(this.loading){
......
......@@ -144,6 +144,7 @@
},
checkedChange(){
const r = this.guests.filter(x=>x.Checked)
console.log('checkedChange----',r)
this.$emit('selected',r)
},
selectedHandle(val){
......
......@@ -58,7 +58,7 @@
required>
</u-field>
</view>
<!-- #ifdef MP-AG -->
<view class="flight-card q-mt-md" v-if="sales.length>1">
<view class="title">服务专员</view>
<u-field
......@@ -72,6 +72,7 @@
required>
</u-field>
</view>
<!-- #endif -->
<view class="flight-card q-mt-md">
<view class="title">
......@@ -162,7 +163,12 @@
<text style="color: #6e6e6e; font-size: 24rpx;font-family: microsoft yahei ui light;">共计{{ guest.length }}</text>
</view>
<button class="jz_OrderReNow" @click="orderHandler" :disabled="submit" :loading="submit">
<!-- #ifdef MP-DI -->
立即支付
<!-- #endif -->
<!-- #ifdef MP-AG -->
立即预定
<!-- #endif -->
</button>
</view>
</view>
......@@ -242,7 +248,8 @@
saleVisable:false,
statusVisible:false,
backVisible:false,
goVisible:false
goVisible:false,
orderInfo: {},
}
},
components: {
......@@ -313,15 +320,94 @@
created() {
this.mainColor = this.$uiConfig.mainColor
this.customer = uni.getStorageSync("b2b_user");
console.log(this.customer,'----')
this.getUserCouponList()
// #ifdef MP-DI
this.createBy.CreateBy = this.customer.pid
let employeeId = this.customer.directCustomerId?this.customer.directCustomerId:0
this.createBy.CreateBy = employeeId
// #endif
// #ifdef MP-AG
this.getSalesHandle()
// #endif
},
methods: {
submitB2COrderHandler(OrderId) {
let guestInfo = `${this.guest.length}人; `;
let msg = {
SurName: this.contactName,
Name: '',
ContactNumber: this.contactPhone,
Mailbox: this.customer.Mailbox,
GoodsId: this.currentPriceInfo.tcid,
GoodsName: `${this.goList[0].DepartureName}${this.backList[0].DepartureName}`,
GoodsPic: this.goList[0].AirlineUrl? this.goList[0].AirlineUrl : '',
GoodsType: 16,
OrderMake: `${guestInfo} ${this.goList[0].FlightDate}${this.goList[0].DepartureName}出发到${this.backList[0].DepartureName}; ${this.backList[this.backList.length-1].FlightDate}出发回${this.backList[this.backList.length-1].ArrivalCityName}`,
TotalPrice: this.price,
PreferentialPrice: this.currentCoupon.discountMoney,
ErpOrderId: OrderId,
Country: 0,
PlatformTax: 0,
Income: 0,
Refund: 0,
MallBaseId: uni.getStorageSync('mall_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) {
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);
that.submit = false;
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
that.price +
"&isFrom=1",
});
}, 100);
},
fail: function(err) {
console.log("fail:", err);
that.submit=false
uni.showToast({
title: "支付失败",
icon: "none",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/airTicket/TicketOrderDetails?OrderNo=" + OrderNo,
});
}, 100);
},
});
},
getSalesHandle(){
const p = { CustomerId: this.customer.customerId }
this.apipost( "b2b_get_GetCustomerCreateByList", p,(res) => {
......@@ -355,14 +441,22 @@
const p = this.createParameter()
this.apipost('sellorder_post_SetOrderInfoForAirTicket',p,r=>{
if(r.resultCode==1){
let tempData = r.data
// #ifdef MP-DI
this.submitB2COrderHandler(tempData.OrderId)
// #endif
// #ifdef MP-AG
this.successVisible=true
// #endif
}else{
uni.showToast({
icon:'error',
title: r.message
})
}
// #ifdef MP-AG
this.submit=false
// #endif
},e=>{
this.submit=false
})
......@@ -382,7 +476,9 @@
} else if(this.contactPhone=='' || this.contactPhone.length!=11){
msg = '请输入11位联系电话'
} else if(this.createBy.CreateBy==0){
// #ifdef MP-AG
msg = '请选择与你对接的服务人员'
// #endif
}
return msg
},
......@@ -397,16 +493,20 @@
PassportExpiry:x.PassportExpired,
Birthday:x.BrithDay,
MobilePhone:x.Mobile,
Nationality:x.CountryId
Nationality:x.CountryId,
}
return n
})
let PriceNum = 0
var CreateBy = 0
var DirectCustomerId = 0
//#ifdef MP-DI
PriceNum = this.flight.B2CPrice
DirectCustomerId = this.createBy.CreateBy
//#endif
//#ifdef MP-AG
PriceNum = this.flight.B2CPrice
CreateBy = this.createBy.CreateBy
//#endif
const p = {
OrderId:0,
......@@ -429,10 +529,24 @@
GuestNum:this.crCount+this.etCount+this.babyCount,
PlaceOrderFrom:2,
MiniAppUserId:mallUser.UserId,
DirectCustomerId:0,
DirectCustomerId:DirectCustomerId,
EnterID:0,
GuestList:list,
CreateBy:this.createBy.CreateBy
CreateBy:CreateBy,
// #ifdef MP-DI
OrderSource: 7,
// #endif
// #ifdef MP-AG
OrderSource: 5,
// #endif
// #ifdef MP-DI
ClientType: 2,
// #endif
// #ifdef MP-AG
ClientType: 1,
// #endif
CreateBy: CreateBy, //同行联系人创建人 CustomerCreateBy
DirectCustomerId: DirectCustomerId, //直客Id
}
return p
},
......
......@@ -2074,7 +2074,7 @@
let createBy = 0
// #ifdef MP-DI
let employeeId = this.customer.salesBaseInfo&&this.customer.salesBaseInfo.employeeId?this.customer.salesBaseInfo.employeeId:0
let employeeId = this.customer.directCustomerId?this.customer.directCustomerId:0
createBy = this.createBy>0?this.createBy:employeeId
// #endif
// #ifdef MP-AG
......
......@@ -680,7 +680,6 @@
this.apipost("AddOrderInfo_post", msg, (res) => {
if (res.resultCode == 1) {
this.orderInfo =JSON.parse(res.data.sPayInfo)
console.log(this.orderInfo,'----orderInfo');
uni.showToast({
icon: 'none',
title: '订单创建成功'
......@@ -697,7 +696,6 @@
});
},
goPayHandler(OrderNo) {
//pay.OrderNo
let that = this;
uni.requestPayment({
provider: "wxpay",
......@@ -708,21 +706,21 @@
paySign: this.orderInfo.sign,
success: function(res) {
console.log("success", res);
this.submit = false;
that.submit = false;
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
this.price +
that.price +
"&isFrom=1",
});
}, 100);
},
fail: function(err) {
console.log("fail:", err);
this.submit = false;
that.submit = false;
uni.showToast({
title: "支付失败",
icon: "none",
......
......@@ -544,20 +544,29 @@
</view>
<view class="jz_orderbox flex">
<view style="display: flex" v-if="showPayBtn">
<button class="jz_OrderReNow" @click="goCancel"
<!-- #ifdef MP-DI -->
<button class="jz_OrderReNow" @click="goCancelZK"
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>
</button>
<!-- #ifdef MP-DI -->
<button class="jz_OrderReNow"
style="margin-left: 20rpx;"
@click="submitGetCodeByOrderNo" :disabled="submit" :loading="submit">
立即支付
</button>
<!-- #endif -->
<!-- #ifdef MP-AG -->
<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>
</button>
<!-- #endif -->
<!-- 返回上一页 -->
<!-- <view
class="jz_OrderReNow"
......@@ -622,6 +631,7 @@
},
methods: {
submitGetCodeByOrderNo() {
if (this.submit || this.submitCancel) return;
this.submit = true
this.apipost("GetCodeByOrderNo_post", {
OrderNo: this.OrderNo,
......@@ -629,7 +639,6 @@
}, (res) => {
if (res.resultCode == 1) {
this.orderInfo =JSON.parse(res.data.sPayInfo)
console.log(this.orderInfo,'----orderInfo');
this.goPayHandler();
} else {
uni.showToast({
......@@ -652,14 +661,14 @@
paySign: this.orderInfo.sign,
success: function(res) {
console.log("success", res);
this.submit = false;
that.submit = false;
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
this.price +
that.price +
"&isFrom=1",
});
}, 100);
......@@ -678,6 +687,11 @@
this.apipost("GetDetailsByOrderNo_post",{OrderNo},res=>{
if(res.resultCode==1){
this.initOrderInfo(res.data.ErpOrderId);
this.formatStatus(
res.data.OrderStatus,
null,
null
);
}else{
}
......@@ -746,6 +760,32 @@
);
}
},
goCancelZK() {
if (this.submit || this.submitCancel) return;
this.submitCancel = true;
if (this.orderData.model.OrderState == 2) {
this.apipost(
"GetCancelOrder_post", {
OrderNo: this.OrderNo
},
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
uni.navigateTo({
url: "/pages/jiuzhai/jz_MyOrder",
});
}
this.submitCancel = false
},
(err) => {
this.submitCancel = false
}
);
}
},
getWeek(date) {
var weekArray = new Array("日", "一", "二", "三", "四", "五", "六");
var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
......@@ -767,12 +807,16 @@
msg,
(res) => {
if (res.resultCode == 1) {
this.orderData = res.data;
this.orderData = {
...res.data
};
// #ifdef MP-AG
this.formatStatus(
this.orderData.model.OrderState,
this.orderData.model.IsChargeLossOrders,
this.orderData.model.IsApplyForCancel
);
// #endif
} else {
this.orderData = {
result: -1,
......@@ -784,6 +828,27 @@
);
},
formatStatus(status, loss, isCancel) {
console.log(status, '------');
// #ifdef MP-DI
if(status==1){
this.orderStatus.code = 0;
this.orderStatus.text = "待付款";
this.showPayBtn = true;
}else if(status==2){
this.orderStatus.code = 1;
this.orderStatus.text = "已付款";
this.showPayBtn = false;
}else if(status==3){
this.orderStatus.code = 1;
this.orderStatus.text = "已完成";
this.showPayBtn = false;
}else if(status==4){
this.orderStatus.code = -1;
this.orderStatus.text = "已取消";
this.showPayBtn = false;
}
// #endif
// #ifdef MP-AG
loss = loss ? loss : -1;
//1、已申请;!=1未申请
if (loss == 1 || status == 4) {
......@@ -797,9 +862,7 @@
} else if (status == 3 && isCancel != 1) {
this.orderStatus.code = 0;
this.orderStatus.text = "候补中";
// #ifdef MP-AG
this.showPayBtn = true;
// #endif
} else if (status == 2 && isCancel == 1) {
this.orderStatus.code = -2;
this.orderStatus.text = "审核中";
......@@ -809,6 +872,7 @@
this.orderStatus.text = "正常";
this.showPayBtn = false;
}
// #endif
},
// #ifdef MP-WEIXIN
goFukuan() {
......
......@@ -728,7 +728,7 @@
// #endif
let createBy = 0
// #ifdef MP-DI
let employeeId = this.customer.salesBaseInfo&&this.customer.salesBaseInfo.employeeId?this.customer.salesBaseInfo.employeeId:0
let employeeId = this.customer.directCustomerId?this.customer.directCustomerId:0
createBy = this.createBy>0?this.createBy:employeeId
// #endif
// #ifdef MP-AG
......
......@@ -896,21 +896,21 @@
paySign: this.orderInfo.sign,
success: function(res) {
console.log("success", res);
this.submit = false;
that.submit = false;
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
this.price +
that.price +
"&isFrom=1",
});
}, 100);
},
fail: function(err) {
console.log("fail:", err);
this.submit = false;
that.submit = false;
uni.showToast({
title: "支付失败",
icon: "none",
......
......@@ -512,19 +512,29 @@
</view>
<view class="jz_orderbox flex" v-if="showPayBtn">
<view style="display: flex">
<button class="jz_OrderReNow" @click="goCancel"
<!-- #ifdef MP-DI -->
<button class="jz_OrderReNow" @click="goCancelZK"
style="background: #fff; color: #111; border: 1px solid #111"
:disabled="submitCancel" :loading="submitCancel">
:disabled="submitCancel"
:loading="submitCancel">
<text v-if="!submitCancel">取消</text>
<u-loading v-if="submitCancel" size="32" color="#111"></u-loading>
</button>
<!-- #ifdef MP-DI -->
<button class="jz_OrderReNow"
style="margin-left: 20rpx;"
@click="submitGetCodeByOrderNo" :disabled="submit" :loading="submit">
立即支付
</button>
<!-- #endif -->
<!-- #ifdef MP-AG -->
<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>
</button>
<!-- #endif -->
<!-- 返回上一页 -->
<!-- <view
class="jz_OrderReNow"
......@@ -590,6 +600,7 @@
},
methods: {
submitGetCodeByOrderNo() {
if (this.submit || this.submitCancel) return;
this.submit = true
this.apipost("GetCodeByOrderNo_post", {
OrderNo: this.OrderNo,
......@@ -597,7 +608,6 @@
}, (res) => {
if (res.resultCode == 1) {
this.orderInfo =JSON.parse(res.data.sPayInfo)
console.log(this.orderInfo,'----orderInfo');
this.goPayHandler();
} else {
uni.showToast({
......@@ -620,14 +630,14 @@
paySign: this.orderInfo.sign,
success: function(res) {
console.log("success", res);
this.submit = false;
that.submit = false;
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
this.price +
that.price +
"&isFrom=1",
});
}, 100);
......@@ -646,6 +656,12 @@
this.apipost("GetDetailsByOrderNo_post",{OrderNo},res=>{
if(res.resultCode==1){
this.initOrderInfo(res.data.ErpOrderId);
this.formatStatus(
res.data.OrderStatus,
null,
null,
null
);
}else{
}
......@@ -702,6 +718,32 @@
})
}
},
goCancelZK() {
if (this.submit || this.submitCancel) return;
this.submitCancel = true;
if (this.orderData.model.OrderState == 2) {
this.apipost(
"GetCancelOrder_post", {
OrderNo: this.OrderNo
},
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
uni.navigateTo({
url: "/pages/jiuzhai/jz_MyOrder",
});
}
this.submitCancel = false
},
(err) => {
this.submitCancel = false
}
);
}
},
getWeek(date) {
var weekArray = new Array("日", "一", "二", "三", "四", "五", "六");
var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
......@@ -723,12 +765,15 @@
(res) => {
if (res.resultCode == 1) {
this.orderData = res.data;
// #ifdef MP-AG
this.formatStatus(
this.orderData.OrderModel.VisaOrderStatus,
this.orderData.OrderModel.Income,
this.orderData.OrderModel.TotalPrice,
this.orderData.OrderModel.PlatformTax
);
// #endif
} else {
this.orderData = {
result: -1,
......@@ -739,6 +784,26 @@
);
},
formatStatus(status,Income,TotalPrice,PlatformTax) {
// #ifdef MP-DI
if(status==1){
this.orderStatus.code = 0;
this.orderStatus.text = "待付款";
this.showPayBtn = true;
}else if(status==2){
this.orderStatus.code = 1;
this.orderStatus.text = "已付款";
this.showPayBtn = false;
}else if(status==3){
this.orderStatus.code = 1;
this.orderStatus.text = "已完成";
this.showPayBtn = false;
}else if(status==4){
this.orderStatus.code = -1;
this.orderStatus.text = "已取消";
this.showPayBtn = false;
}
// #endif
// #ifdef MP-AG
if (status == 2) {
this.orderStatus.code = -1;
this.orderStatus.text = "已取消";
......@@ -756,6 +821,7 @@
this.orderStatus.text = "已付款";
this.showPayBtn = false;
}
// #endif
},
// #ifdef MP-WEIXIN
goFukuan() {
......
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