Commit c5ca7802 authored by 罗超's avatar 罗超

完成订单创建流程

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