Commit c5ca7802 authored by 罗超's avatar 罗超

完成订单创建流程

parent 4322c9ab
...@@ -121,6 +121,17 @@ export default { ...@@ -121,6 +121,17 @@ export default {
if(this.chosenCouponId.length>1){ if(this.chosenCouponId.length>1){
this.chosenCouponId.splice(0,1) this.chosenCouponId.splice(0,1)
} }
let t= null
if(this.chosenCouponId.length==1){
t=this.coupons.find(x=>x.couponId==this.chosenCouponId[0])
if(t.couponsType==1){
t.discountMoney=t.denomination
}else{
t.discountMoney=((1-parseFloat(t.denomination)/10.0)*parseFloat(this.currentPrice)).toFixed(2)
}
}
console.log(t)
this.$emit("change",t)
}, },
getProductCouponHandler(){ getProductCouponHandler(){
this.apiJavaPost( this.apiJavaPost(
......
...@@ -41,7 +41,12 @@ ...@@ -41,7 +41,12 @@
> >
<div class="col"> <div class="col">
<q-card flat class="q-pa-md"> <q-card flat class="q-pa-md">
<div class="text-subtitle1 text-weight-bolder" ref="baseUserInfoTitle">訂購人資訊</div> <div
class="text-subtitle1 text-weight-bolder"
ref="baseUserInfoTitle"
>
訂購人資訊
</div>
<q-separator color="grey-2" class="q-my-md" /> <q-separator color="grey-2" class="q-my-md" />
<q-form ref="baseUserInfo"> <q-form ref="baseUserInfo">
<div class="row q-col-gutter-md"> <div class="row q-col-gutter-md">
...@@ -99,7 +104,12 @@ ...@@ -99,7 +104,12 @@
v-model="userInfo.Mailbox" v-model="userInfo.Mailbox"
label="郵箱地址" label="郵箱地址"
ref="mailbox" ref="mailbox"
:rules="[(val) => /^[a-zA-Z0-9]+([-_.][A-Za-zd]+)*@([a-zA-Z0-9]+[-.])+[A-Za-zd]{2,5}$/.test(val) || '請輸入正確的郵箱地址']" :rules="[
(val) =>
/^[a-zA-Z0-9]+([-_.][A-Za-zd]+)*@([a-zA-Z0-9]+[-.])+[A-Za-zd]{2,5}$/.test(
val
) || '請輸入正確的郵箱地址',
]"
/> />
</div> </div>
<div :class="filedWidth"> <div :class="filedWidth">
...@@ -110,7 +120,7 @@ ...@@ -110,7 +120,7 @@
</q-card> </q-card>
<q-card flat class="q-pa-md q-mt-lg"> <q-card flat class="q-pa-md q-mt-lg">
<div class="text-subtitle1 text-weight-bolder q-mb-md">旅客資料{{ price.realPrice }}</div> <div class="text-subtitle1 text-weight-bolder q-mb-md">旅客資料</div>
<div class="row"> <div class="row">
<q-img <q-img
...@@ -152,7 +162,11 @@ ...@@ -152,7 +162,11 @@
> >
</div> </div>
</div> </div>
<div class="text-right">
<q-toggle v-model="isCreateGuest" label="是否預填旅客信息" />
</div>
<q-separator color="grey-2" class="q-mt-md" /> <q-separator color="grey-2" class="q-mt-md" />
<template v-if="isCreateGuest">
<div <div
class="bg-grey-1 rounded-borders q-pa-md q-mt-md guest-item" class="bg-grey-1 rounded-borders q-pa-md q-mt-md guest-item"
v-for="(x, i) in guests" v-for="(x, i) in guests"
...@@ -290,8 +304,8 @@ ...@@ -290,8 +304,8 @@
</div> </div>
</div> </div>
</q-form> </q-form>
</div> </div>
</template>
<div class="text-subtitle1 q-my-md text-weight-bold"> <div class="text-subtitle1 q-my-md text-weight-bold">
特殊需求備註: 特殊需求備註:
</div> </div>
...@@ -306,7 +320,12 @@ ...@@ -306,7 +320,12 @@
/> />
</q-card> </q-card>
<coupon v-if="price && price.tcid" :product-type="productType" :current-price="sumPrice"></coupon> <coupon
v-if="price && price.tcid"
:product-type="productType"
:current-price="sumPrice"
@change="changeDiscountHandler"
></coupon>
</div> </div>
<div <div
class="relative-position" class="relative-position"
...@@ -348,11 +367,19 @@ ...@@ -348,11 +367,19 @@
<div class="q-mt-md text-grey-6"> <div class="q-mt-md text-grey-6">
<div class="row"> <div class="row">
<div style="width: 80px">出發城市:</div> <div style="width: 80px">出發城市:</div>
<div class="q-ml-md">{{ unionCity?unionCity.cityName:trip.startCityName }}起止</div> <div class="q-ml-md">
{{ unionCity ? unionCity.cityName : trip.startCityName }}起止
</div>
</div> </div>
<div class="row"> <div class="row">
<div style="width: 80px">出發日期:</div> <div style="width: 80px">出發日期:</div>
<div class="q-ml-md">{{ unionCity && unionCity.goFlight? unionCity.goFlight.startDate :price.startDate }}</div> <div class="q-ml-md">
{{
unionCity && unionCity.goFlight
? unionCity.goFlight.startDate
: price.startDate
}}
</div>
</div> </div>
</div> </div>
<q-separator color="grey-2" class="q-my-md" /> <q-separator color="grey-2" class="q-my-md" />
...@@ -363,38 +390,84 @@ ...@@ -363,38 +390,84 @@
</div> </div>
<div class="row q-mb-sm" v-if="chosenObj.etzcCount > 0"> <div class="row q-mb-sm" v-if="chosenObj.etzcCount > 0">
<div class="col">兒童佔床 x {{ chosenObj.etzcCount }}</div> <div class="col">兒童佔床 x {{ chosenObj.etzcCount }}</div>
<div>CNY {{ moneyFormat(price.originalB2CPrice+price.childNeedPrice, 2) }}</div> <div>
CNY
{{
moneyFormat(price.originalB2CPrice + price.childNeedPrice, 2)
}}
</div>
</div> </div>
<div class="row q-mb-sm" v-if="chosenObj.etbzcCount > 0"> <div class="row q-mb-sm" v-if="chosenObj.etbzcCount > 0">
<div class="col">兒童不佔床 x {{ chosenObj.etbzcCount }}</div> <div class="col">兒童不佔床 x {{ chosenObj.etbzcCount }}</div>
<div>CNY {{ moneyFormat(price.originalB2CPrice-price.childNoNeedPrice, 2) }}</div> <div>
CNY
{{
moneyFormat(
price.originalB2CPrice - price.childNoNeedPrice,
2
)
}}
</div>
</div> </div>
<div class="row q-mb-sm" v-if="chosenObj.yeCount > 0"> <div class="row q-mb-sm" v-if="chosenObj.yeCount > 0">
<div class="col">嬰兒不佔床 x {{ chosenObj.yeCount }}</div> <div class="col">嬰兒不佔床 x {{ chosenObj.yeCount }}</div>
<div>CNY {{ moneyFormat(price.babyPrice, 2) }}</div> <div>CNY {{ moneyFormat(price.babyPrice, 2) }}</div>
</div> </div>
<div v-if="price.safeMoney>0"> <div v-if="price.safeMoney > 0">
<hr <hr
style="border: none; border-top: 1px dashed #eee !important" style="border: none; border-top: 1px dashed #eee !important"
class="bg-transparent q-mb-sm" class="bg-transparent q-mb-sm"
/> />
<div class="row q-mb-sm" v-if="price.safeMoney > 0"> <div class="row q-mb-sm" v-if="price.safeMoney > 0">
<div class="col">保險費 x {{ price.safeMoney }}/人</div> <div class="col">保險費 x {{ price.safeMoney }}/人</div>
<div>CNY {{ moneyFormat(price.safeMoney*(chosenObj.crCount+chosenObj.etCount+chosenObj.yeCount), 2) }}</div> <div>
CNY
{{
moneyFormat(
price.safeMoney *
(chosenObj.crCount +
chosenObj.etCount +
chosenObj.yeCount),
2
)
}}
</div> </div>
</div> </div>
<div v-if="price.visaPrice>0||price.otherPrice>0"> </div>
<div v-if="price.visaPrice > 0 || price.otherPrice > 0">
<hr <hr
style="border: none; border-top: 1px dashed #eee !important" style="border: none; border-top: 1px dashed #eee !important"
class="bg-transparent q-mb-sm" class="bg-transparent q-mb-sm"
/> />
<div class="row q-mb-sm" v-if="price.visaPrice > 0"> <div class="row q-mb-sm" v-if="price.visaPrice > 0">
<div class="col">簽證費 x {{ price.visaPrice }}/人</div> <div class="col">簽證費 x {{ price.visaPrice }}/人</div>
<div>CNY {{ moneyFormat(price.visaPrice*(chosenObj.crCount+chosenObj.etCount+chosenObj.yeCount), 2) }}</div> <div>
CNY
{{
moneyFormat(
price.visaPrice *
(chosenObj.crCount +
chosenObj.etCount +
chosenObj.yeCount),
2
)
}}
</div>
</div> </div>
<div class="row q-mb-sm" v-if="price.otherPrice > 0"> <div class="row q-mb-sm" v-if="price.otherPrice > 0">
<div class="col">雜費 x {{ price.otherPrice }}/人</div> <div class="col">雜費 x {{ price.otherPrice }}/人</div>
<div>CNY {{ moneyFormat(price.otherPrice*(chosenObj.crCount+chosenObj.etCount+chosenObj.yeCount), 2) }}</div> <div>
CNY
{{
moneyFormat(
price.otherPrice *
(chosenObj.crCount +
chosenObj.etCount +
chosenObj.yeCount),
2
)
}}
</div>
</div> </div>
</div> </div>
<hr <hr
...@@ -422,8 +495,11 @@ ...@@ -422,8 +495,11 @@
/> />
<div class="row q-mb-sm items-center"> <div class="row q-mb-sm items-center">
<div class="col">優惠金額</div> <div class="col">優惠金額</div>
<div class="text-subtitle2 text-weight-bolder text-teal" v-if="price.discountPrice>0"> <div
CNY - {{ moneyFormat(9999, 2) }} class="text-subtitle2 text-weight-bolder text-teal"
v-if="price.discountPrice > 0"
>
CNY - {{ moneyFormat(price.discountPrice, 2) }}
</div> </div>
<div class="text-grey-5" v-else>暫無優惠</div> <div class="text-grey-5" v-else>暫無優惠</div>
</div> </div>
...@@ -432,12 +508,18 @@ ...@@ -432,12 +508,18 @@
<div <div
class="text-h6 text-weight-bolder text-primary product-price" class="text-h6 text-weight-bolder text-primary product-price"
> >
CNY {{ moneyFormat(sumPrice-price.discountPrice, 2) }} CNY {{ moneyFormat(sumPrice - price.discountPrice, 2) }}
</div> </div>
</div> </div>
</div> </div>
<div class="text-right q-mt-md"> <div class="text-right q-mt-md">
<q-btn unelevated color="primary" label="立即支付" :loading="submiting" @click="submitHandler"/> <q-btn
unelevated
color="primary"
label="立即支付"
:loading="submiting"
@click="submitHandler"
/>
</div> </div>
</div> </div>
</div> </div>
...@@ -457,9 +539,9 @@ ...@@ -457,9 +539,9 @@
import coupon from "../../components/common/coupon.vue"; import coupon from "../../components/common/coupon.vue";
import NoneData from "src/components/common/noneData.vue"; import NoneData from "src/components/common/noneData.vue";
import auth from "src/components/common/auth.vue"; import auth from "src/components/common/auth.vue";
import {date} from 'quasar' import { date } from "quasar";
import ProductTypeEnum from '../../utils/producttypeenum' import ProductTypeEnum from "../../utils/producttypeenum";
import EnumHelper from '../../utils/enumhelper' import EnumHelper from "../../utils/enumhelper";
export default { export default {
components: { components: {
coupon, coupon,
...@@ -508,10 +590,10 @@ export default { ...@@ -508,10 +590,10 @@ export default {
countrys: [], countrys: [],
areaCodes: [], areaCodes: [],
guest: { guest: {
Id:0, Id: 0,
TCID:0, TCID: 0,
OrderId:0, OrderId: 0,
VisaPlanId:0, VisaPlanId: 0,
SurName: "羅", SurName: "羅",
Name: "超", Name: "超",
PassportNo: "D56465465", PassportNo: "D56465465",
...@@ -525,19 +607,19 @@ export default { ...@@ -525,19 +607,19 @@ export default {
RoomType: 0, RoomType: 0,
IsSignRoom: false, IsSignRoom: false,
Sex: 1, Sex: 1,
IdCard:'', IdCard: "",
PassportIssued:'', PassportIssued: "",
Purpose: "观光", Purpose: "观光",
IsBed:1, IsBed: 1,
IsNeedAirticket:2, IsNeedAirticket: 2,
IsNeedSafe:1, IsNeedSafe: 1,
IsVisaFree:2, IsVisaFree: 2,
IssuingAuthority:2, IssuingAuthority: 2,
IsCriminalRecord:2, IsCriminalRecord: 2,
IsDepartureRecord:2, IsDepartureRecord: 2,
IsHightSchool:2, IsHightSchool: 2,
IsB2B:1, IsB2B: 1,
Birthday:'1990-12-26' Birthday: "1990-12-26",
}, },
guests: [], guests: [],
disableSign: false, disableSign: false,
...@@ -546,10 +628,11 @@ export default { ...@@ -546,10 +628,11 @@ export default {
trip: null, trip: null,
price: null, price: null,
unionCity: null, unionCity: null,
sumPrice:0, sumPrice: 0,
submiting:false, submiting: false,
CouponIds:[], CouponIds: [],
productType:0 productType: 0,
isCreateGuest:false
}; };
}, },
computed: { computed: {
...@@ -564,207 +647,263 @@ export default { ...@@ -564,207 +647,263 @@ export default {
"col-12": this.$q.screen.width < 1200, "col-12": this.$q.screen.width < 1200,
"col-4": this.$q.screen.width >= 1200, "col-4": this.$q.screen.width >= 1200,
}; };
} },
}, },
created() { created() {
if (this.checkParamsHandler()) { if (this.checkParamsHandler()) {
this.initGuestHandler(); this.initGuestHandler()
this.getTripData(); this.getTripData();
this.getUserInfoHandler(); this.getUserInfoHandler();
} }
}, },
mounted() {}, mounted() {},
methods: { methods: {
async submitHandler(){ async submitHandler() {
this.submiting=true this.submiting = true;
let flag = true let flag = true;
flag = await this.formValidateHandler('baseUserInfo') flag = await this.formValidateHandler("baseUserInfo");
if(!flag){ if (!flag) {
this.goScrollToForm('baseUserInfoTitle') this.goScrollToForm("baseUserInfoTitle");
} else { } else {
if(this.isCreateGuest){
for (let i = 0; i < this.guests.length; i++) { for (let i = 0; i < this.guests.length; i++) {
flag = await this.formValidateHandler('guest'+i) flag = await this.formValidateHandler("guest" + i);
if(!flag){ if (!flag) {
this.goScrollToForm(`guest${i}Title`) this.goScrollToForm(`guest${i}Title`);
break; break;
} }
} }
if(flag){ }
this.submitOrderHandler() if (flag) {
this.submitOrderHandler();
//this.submitB2COrderHandler(81192) //this.submitB2COrderHandler(81192)
return; return;
} }
} }
this.submiting=false this.submiting = false;
}, },
submitOrderHandler() {
let msg = {
submitOrderHandler(){ OrderId: 0,
let msg={ TCID: this.order.order.tcid,
OrderId:0, CustomerType: 4,
TCID:this.order.order.tcid, GroupType: 1,
CustomerType:4, ContactName: this.userInfo.Surname + this.userInfo.Name,
GroupType:1, ContactMobile:
ContactName:this.userInfo.Surname+this.userInfo.Name, this.userInfo.PhoneCountryStr + " " + this.userInfo.Moblie,
ContactMobile:this.userInfo.PhoneCountryStr+' '+this.userInfo.Moblie, CustomerId: 0,
CustomerId:0, DepartureCityId: this.order.order.startCityId,
DepartureCityId:this.order.order.startCityId, IsIntermodal: this.unionCity ? 1 : 2,
IsIntermodal:this.unionCity?1:2, Unit_Price: this.price.realPrice,
Unit_Price:this.price.realPrice, TC_Price: this.price.realPrice,
TC_Price:this.price.realPrice, ManNum: this.chosenObj.crCount,
ManNum:this.chosenObj.crCount, ChirdNum: this.chosenObj.etCount,
ChirdNum:this.chosenObj.etCount, ChirdNeedBedNum: this.chosenObj.etzcCount,
ChirdNeedBedNum:this.chosenObj.etzcCount, BabyNum: this.chosenObj.yeCount,
BabyNum:this.chosenObj.yeCount,
OldPeopleNum: 0, OldPeopleNum: 0,
SingleRoomNum:this.chosenObj.df, SingleRoomNum: this.chosenObj.df,
PreferPrice:this.sumPrice, PreferPrice: this.sumPrice,
DiscountMoney:this.discountPrice, DiscountMoney: this.price.discountPrice,
CouponAllotIds: this.CouponIds.join(','), CouponAllotIds: this.CouponIds.join(","),
YSeatNum:this.chosenObj.crCount+this.chosenObj.etCount, YSeatNum: this.chosenObj.crCount + this.chosenObj.etCount,
ESeatNum:0, ESeatNum: 0,
FSeatNum:0, FSeatNum: 0,
Commission:0,//todo 提成 Commission: 0, //todo 提成
ClientSource:3, ClientSource: 3,
BrandId:0, BrandId: 0,
TradeWay:0, TradeWay: 0,
PlatformOrder:'', PlatformOrder: "",
GuestNum:this.chosenObj.crCount+this.chosenObj.etCount, GuestNum: this.chosenObj.crCount + this.chosenObj.etCount,
IsChildrenTour:this.price.isSupportChildren, IsChildrenTour: this.price.isSupportChildren,
IsBirdDiscount:2, IsBirdDiscount: 2,
PredictRoomNum:(parseFloat((this.chosenObj.crCount+this.chosenObj.etzcCount-this.chosenObj.df))/2.0)+this.chosenObj.df, PredictRoomNum:
BigRoomNum:0, parseFloat(
TripleRoomNum:0, this.chosenObj.crCount +
TradeDate:date.formatDate(new Date(),'YYYY-MM-DD'), this.chosenObj.etzcCount -
CostType:0, this.chosenObj.df
MinOrderPrice:0, ) /
Remarks:this.chosenObj.remark, 2.0 +
VisaNum:this.chosenObj.crCount+this.chosenObj.etCount+this.chosenObj.yeCount, this.chosenObj.df,
SafeNum:this.chosenObj.crCount+this.chosenObj.etCount+this.chosenObj.yeCount, BigRoomNum: 0,
AirticketNum:0, TripleRoomNum: 0,
ReturnArriveCityId:this.unionCity && this.unionCity.backFlight?this.unionCity.backFlight.arrivalCityId:this.trip.returnArriveCityId, TradeDate: date.formatDate(new Date(), "YYYY-MM-DD"),
IsReturnIntermodal:this.unionCity && this.unionCity.backFlight?1:2, CostType: 0,
GoCityTime:this.unionCity && this.unionCity.goFlight ? this.unionCity.goFlight.startDate:'', MinOrderPrice: 0,
BackCityTime:this.unionCity && this.unionCity.backFlight ? this.unionCity.backFlight.startDate:'', Remarks: this.chosenObj.remark,
ScenicRefundArr:[], VisaNum:
CommissionSharePeople:0, this.chosenObj.crCount +
CommissionShareMoney:0, this.chosenObj.etCount +
OrderSource:3, this.chosenObj.yeCount,
RedEnvelopeMoney: 0 SafeNum:
} this.chosenObj.crCount +
this.apipost("sellorder_post_SetOrderInfoForB2B",msg, this.chosenObj.etCount +
res => { this.chosenObj.yeCount,
if(res.data.resultCode==1){ AirticketNum: 0,
this.uploadGuests(0,res.data.data.OrderId) ReturnArriveCityId:
}else{ this.unionCity && this.unionCity.backFlight
this.$message.error(res.data.message) ? this.unionCity.backFlight.arrivalCityId
this.submiting=false : this.trip.returnArriveCityId,
IsReturnIntermodal: this.unionCity && this.unionCity.backFlight ? 1 : 2,
GoCityTime:
this.unionCity && this.unionCity.goFlight
? this.unionCity.goFlight.startDate
: "",
BackCityTime:
this.unionCity && this.unionCity.backFlight
? this.unionCity.backFlight.startDate
: "",
ScenicRefundArr: [],
CommissionSharePeople: 0,
CommissionShareMoney: 0,
OrderSource: 3,
RedEnvelopeMoney: 0,
};
this.apipost(
"sellorder_post_SetOrderInfoForB2B",
msg,
(res) => {
if (res.data.resultCode == 1) {
if (this.isUpdateUserInfo) {
this.setUserInfoHandler();
}
if (this.isCreateGuest) {
this.uploadGuests(0, res.data.data.OrderId);
} else {
this.submitB2COrderHandler(res.data.data.OrderId);
}
} else {
this.$message.error(res.data.message);
this.submiting = false;
} }
}, },
err => { (err) => {
this.submiting=false this.submiting = false;
}); }
);
}, },
uploadGuests(i,orderId){ uploadGuests(i, orderId) {
let currentGuest = this.guests[i] let currentGuest = this.guests[i];
currentGuest.OrderId=orderId currentGuest.OrderId = orderId;
currentGuest.TCID = this.order.order.tcid currentGuest.TCID = this.order.order.tcid;
this.apipost('sellorder_post_SetTravelGuestInfo_V2',currentGuest,r=>{ this.apipost(
console.log(r) "sellorder_post_SetTravelGuestInfo_V2",
if(i<this.guests.length-1){ currentGuest,
i++ (r) => {
this.uploadGuests(i,orderId) console.log(r);
}else{ if (i < this.guests.length - 1) {
this.submitB2COrderHandler(orderId) i++;
this.uploadGuests(i, orderId);
} else {
this.submitB2COrderHandler(orderId);
}
} }
}) );
}, },
submitB2COrderHandler(orderId){ submitB2COrderHandler(orderId) {
let guestInfo = `成人x${this.chosenObj.crCount}; ` let guestInfo = `成人x${this.chosenObj.crCount}; `;
if(this.chosenObj.etzcCount>0){ if (this.chosenObj.etzcCount > 0) {
guestInfo += `佔床兒童x${this.chosenObj.etzcCount}; ` guestInfo += `佔床兒童x${this.chosenObj.etzcCount}; `;
} }
if(this.chosenObj.etbzcCount>0){ if (this.chosenObj.etbzcCount > 0) {
guestInfo += `不佔床兒童x${this.chosenObj.etbzcCount}; ` guestInfo += `不佔床兒童x${this.chosenObj.etbzcCount}; `;
} }
if(this.chosenObj.yeCount>0){ if (this.chosenObj.yeCount > 0) {
guestInfo += `嬰兒x${this.chosenObj.yeCount}; ` guestInfo += `嬰兒x${this.chosenObj.yeCount}; `;
} }
if(this.chosenObj.df>0){ if (this.chosenObj.df > 0) {
guestInfo += `單房x${this.chosenObj.df}; ` guestInfo += `單房x${this.chosenObj.df}; `;
} }
if(this.chosenObj.visaPrice>0){ if (this.chosenObj.visaPrice > 0) {
guestInfo += `簽證x${this.chosenObj.crCount+this.chosenObj.etCount+this.chosenObj.yeCount}; ` guestInfo += `簽證x${
this.chosenObj.crCount +
this.chosenObj.etCount +
this.chosenObj.yeCount
}; `;
} }
if(this.chosenObj.safeMoney>0){ if (this.chosenObj.safeMoney > 0) {
guestInfo += `旅行保險x${this.chosenObj.crCount+this.chosenObj.etCount+this.chosenObj.yeCount};` guestInfo += `旅行保險x${
this.chosenObj.crCount +
this.chosenObj.etCount +
this.chosenObj.yeCount
};`;
} }
let msg = { let msg = {
SurName:this.userInfo.Surname, SurName: this.userInfo.Surname,
Name:this.userInfo.Name, Name: this.userInfo.Name,
ContactNumber:this.userInfo.PhoneCountryStr+' '+this.userInfo.Moblie, ContactNumber:
Mailbox:this.userInfo.Mailbox, this.userInfo.PhoneCountryStr + " " + this.userInfo.Moblie,
GoodsId:this.order.order.tcid, Mailbox: this.userInfo.Mailbox,
GoodsName:this.trip.title, GoodsId: this.order.order.tcid,
GoodsPic:this.trip.imgCover[0].Url, GoodsName: this.trip.title,
GoodsType:this.productType, GoodsPic: this.trip.imgCover[0].Url,
OrderMake:`${ this.unionCity && this.unionCity.goFlight? this.unionCity.goFlight.startDate :this.price.startDate}${this.unionCity?this.unionCity.cityName:this.trip.startCityName }出發 ${guestInfo}`, GoodsType: this.productType,
TotalPrice:this.sumPrice, OrderMake: `${
PreferentialPrice:this.chosenObj.discountPrice, this.unionCity && this.unionCity.goFlight
ErpOrderId:orderId, ? this.unionCity.goFlight.startDate
Country:this.userInfo.Country, : this.price.startDate
PlatformTax:0, }${
Income:0, this.unionCity ? this.unionCity.cityName : this.trip.startCityName
Refund:0 }出發 ${guestInfo}`,
} TotalPrice: this.sumPrice,
this.apipost("AddOrderInfo_post",msg,r=>{ PreferentialPrice: this.price.discountPrice,
if(r.data.resultCode==1){ ErpOrderId: orderId,
this.$message.success("訂單創建成功") Country: this.userInfo.Country,
this.goPayHandler(r.data.data) PlatformTax: 0,
Income: 0,
Refund: 0,
};
this.apipost("AddOrderInfo_post", msg, (r) => {
if (r.data.resultCode == 1) {
this.$message.success("訂單創建成功");
this.goPayHandler(r.data.data);
} else { } else {
this.$message.error(r.data.message) this.$message.error(r.data.message);
} }
}) });
}, },
getProductTypeHandler(){ getProductTypeHandler() {
return (this.price.teamType==0?ProductTypeEnum.TEAM_TRIP:(this.price.teamType==2?ProductTypeEnum.ONE_DAY:ProductTypeEnum.UNIT_TRIP)).value return (
this.price.teamType == 0
? ProductTypeEnum.TEAM_TRIP
: this.price.teamType == 2
? ProductTypeEnum.ONE_DAY
: ProductTypeEnum.UNIT_TRIP
).value;
}, },
goPayHandler(pay){ goPayHandler(pay) {
let key = this.$md5(JSON.stringify(pay)) let key = this.$md5(JSON.stringify(pay));
let pays = localStorage.getItem('pays') let pays = localStorage.getItem("pays");
pays = pays?JSON.parse(pays):[] pays = pays ? JSON.parse(pays) : [];
pays.push({ pays.push({
key, key,
pay pay,
}) });
localStorage.setItem("pays",JSON.stringify(pays)) localStorage.setItem("pays", JSON.stringify(pays));
let lineCars = localStorage.getItem('lineCars') let lineCars = localStorage.getItem("lineCars");
lineCars = lineCars?JSON.parse(lineCars):[] lineCars = lineCars ? JSON.parse(lineCars) : [];
let i = lineCars.findIndex(x=>x.key==this.orderKey) let i = lineCars.findIndex((x) => x.key == this.orderKey);
if(i>=0){ if (i >= 0) {
lineCars.splice(i,1) lineCars.splice(i, 1);
localStorage.setItem("lineCars",JSON.stringify(lineCars)) localStorage.setItem("lineCars", JSON.stringify(lineCars));
} }
this.CommonJump('/pay/'+key, {}); this.CommonJump("/pay/" + key, {});
}, },
GUID() { GUID() {
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) { return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = Math.random()*16|0, var r = (Math.random() * 16) | 0,
v = c == 'x' ? r : (r&0x3|0x8); v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16); return v.toString(16);
}) });
}, },
async formValidateHandler(formName){ async formValidateHandler(formName) {
let temp=this.$refs[formName] let temp = this.$refs[formName];
let formObj = temp instanceof Array ? temp[0] : temp let formObj = temp instanceof Array ? temp[0] : temp;
return formObj.validate() return formObj.validate();
}, },
goScrollToForm(formName){ goScrollToForm(formName) {
let temp=this.$refs[formName] let temp = this.$refs[formName];
let formObj = temp instanceof Array ? temp[0] : temp let formObj = temp instanceof Array ? temp[0] : temp;
window.scrollTo(0,formObj.offsetTop) window.scrollTo(0, formObj.offsetTop);
}, },
checkParamsHandler() { checkParamsHandler() {
try { try {
...@@ -786,13 +925,28 @@ export default { ...@@ -786,13 +925,28 @@ export default {
} }
if (this.orderKey == "") { if (this.orderKey == "") {
setTimeout(() => { setTimeout(() => {
location.href=location.origin location.href = location.origin;
}, 3000); }, 3000);
} }
return this.orderKey != ""; return this.orderKey != "";
}, },
changeDiscountHandler(coupon) {
if (coupon) {
this.price.discountPrice = coupon.discountMoney;
this.CouponIds = [coupon.couponId];
} else {
this.price.discountPrice = 0;
this.CouponIds = [];
}
console.log(this.price);
this.calcMoney();
this.$forceUpdate();
},
calcMoney() { calcMoney() {
let money = this.price.originalB2CPrice * this.chosenObj.crCount; let money = this.price.originalB2CPrice * this.chosenObj.crCount;
this.price.discountPrice = this.price.discountPrice
? this.price.discountPrice
: 0;
money += money +=
(this.price.originalB2CPrice - (this.price.originalB2CPrice -
this.price.childNoNeedPrice + this.price.childNoNeedPrice +
...@@ -806,7 +960,7 @@ export default { ...@@ -806,7 +960,7 @@ export default {
money += this.price.babyPrice * this.chosenObj.yeCount; money += this.price.babyPrice * this.chosenObj.yeCount;
money += this.price.singleRoomPrice * this.chosenObj.df; money += this.price.singleRoomPrice * this.chosenObj.df;
let sumCount = this.chosenObj.crCount + this.chosenObj.etCount let sumCount = this.chosenObj.crCount + this.chosenObj.etCount;
money += this.price.visaPrice * sumCount; money += this.price.visaPrice * sumCount;
money += this.price.safeMoney * sumCount; money += this.price.safeMoney * sumCount;
money += this.price.otherPrice * sumCount; money += this.price.otherPrice * sumCount;
...@@ -824,8 +978,8 @@ export default { ...@@ -824,8 +978,8 @@ export default {
if (this.chosenObj.df > 0) { if (this.chosenObj.df > 0) {
obj.EnableSignRoom = true; obj.EnableSignRoom = true;
} }
obj.IsBed=1 obj.IsBed = 1;
obj.IdCard=this.GUID() obj.IdCard = this.GUID();
this.guests.push(obj); this.guests.push(obj);
} }
for (let i = 0; i < this.chosenObj.etzcCount; i++) { for (let i = 0; i < this.chosenObj.etzcCount; i++) {
...@@ -835,24 +989,24 @@ export default { ...@@ -835,24 +989,24 @@ export default {
if (this.chosenObj.df > 0) { if (this.chosenObj.df > 0) {
obj.EnableSignRoom = true; obj.EnableSignRoom = true;
} }
obj.IsBed=1 obj.IsBed = 1;
obj.IdCard=this.GUID() obj.IdCard = this.GUID();
this.guests.push(obj); this.guests.push(obj);
} }
for (let i = 0; i < this.chosenObj.etbzcCount; i++) { for (let i = 0; i < this.chosenObj.etbzcCount; i++) {
let obj = JSON.parse(JSON.stringify(this.guest)); let obj = JSON.parse(JSON.stringify(this.guest));
obj.GuestType = 3; obj.GuestType = 3;
obj.FormatTypeName = `儿童不占床 ${i + 1}:`; obj.FormatTypeName = `儿童不占床 ${i + 1}:`;
obj.IsBed=0 obj.IsBed = 0;
obj.IdCard=this.GUID() obj.IdCard = this.GUID();
this.guests.push(obj); this.guests.push(obj);
} }
for (let i = 0; i < this.chosenObj.yeCount; i++) { for (let i = 0; i < this.chosenObj.yeCount; i++) {
let obj = JSON.parse(JSON.stringify(this.guest)); let obj = JSON.parse(JSON.stringify(this.guest));
obj.GuestType = 4; obj.GuestType = 4;
obj.FormatTypeName = `婴儿 ${i + 1}:`; obj.FormatTypeName = `婴儿 ${i + 1}:`;
obj.IsBed=0 obj.IsBed = 0;
obj.IdCard=this.GUID() obj.IdCard = this.GUID();
this.guests.push(obj); this.guests.push(obj);
} }
}, },
...@@ -894,9 +1048,10 @@ export default { ...@@ -894,9 +1048,10 @@ export default {
}); });
} }
}, },
setUserInfoHandler() {
this.apipost("UpdateUserInfo_post", this.userInfo, (r) => {});
},
getTripData() { getTripData() {
this.$q.loading.show(); this.$q.loading.show();
let msg = { let msg = {
cityId: this.order.order.startCityId, cityId: this.order.order.startCityId,
...@@ -916,19 +1071,27 @@ export default { ...@@ -916,19 +1071,27 @@ export default {
this.trip.imgCover = JSON.parse(this.trip.imgCover); this.trip.imgCover = JSON.parse(this.trip.imgCover);
this.price = this.trip.currentPriceInfo; this.price = this.trip.currentPriceInfo;
this.price.realPrice=this.price.originalB2CPrice this.price.realPrice = this.price.originalB2CPrice;
if(this.order.order.startCityId && this.order.order.startCityId!=this.trip.startCityId){ if (
this.unionCity = this.price.unionCityList.find(x=>x.cityId == this.order.order.startCityId) this.order.order.startCityId &&
if(this.unionCity.backFlight && this.unionCity.backFlight.addPrice){ this.order.order.startCityId != this.trip.startCityId
this.price.originalB2CPrice+=this.unionCity.backFlight.addPrice ) {
this.unionCity = this.price.unionCityList.find(
(x) => x.cityId == this.order.order.startCityId
);
if (
this.unionCity.backFlight &&
this.unionCity.backFlight.addPrice
) {
this.price.originalB2CPrice +=
this.unionCity.backFlight.addPrice;
} }
if(this.unionCity.goFlight && this.unionCity.goFlight.addPrice){ if (this.unionCity.goFlight && this.unionCity.goFlight.addPrice) {
this.price.originalB2CPrice+=this.unionCity.goFlight.addPrice this.price.originalB2CPrice += this.unionCity.goFlight.addPrice;
} }
} }
this.calcMoney() this.calcMoney();
this.productType=this.getProductTypeHandler() this.productType = this.getProductTypeHandler();
} else { } else {
this.$q.notify({ this.$q.notify({
type: "negative", type: "negative",
...@@ -938,7 +1101,6 @@ export default { ...@@ -938,7 +1101,6 @@ export default {
}); });
} }
this.$q.loading.hide(); this.$q.loading.hide();
}, },
null null
); );
......
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