Commit 6f1abe91 authored by youjie's avatar youjie

Merge branch 'B2C' of http://gitlab.oytour.com/zk123/jz_travel into B2C

parents bd78b251 949e79b2
......@@ -363,6 +363,7 @@
Income: 0,
Refund: 0,
MallBaseId: uni.getStorageSync('mall_UserInfo').MallBaseId,
DOrderType:1,
};
this.apipost("AddOrderInfo_post", msg, (res) => {
if (res.resultCode == 1) {
......
......@@ -7,9 +7,12 @@
<view class="o-timer">
<view class="row-sb-n">
<view class="row items-center">
<view class="time-item">{{getDate(dayObj.start)}}<text>{{ getWeek(dayObj.start) }}</text></view>
<view class="time-item">
{{getDate(dayObj.start)}}<text>{{ getWeek(dayObj.start) }}</text>
</view>
<view class="time-itemZhi"><text>-</text></view>
<view class="time-item">{{getDate(dayObj.end)}}<text>{{ getWeek(dayObj.end) }}</text></view>
<view class="time-item">{{getDate(dayObj.end)}}<text>{{ getWeek(dayObj.end) }}</text>
</view>
<view class="timeline"></view>
<view class="time-split">
<view>{{dayObj.day?dayObj.day:''}}</view>
......@@ -74,8 +77,10 @@
</view>
<view class="LastNameBox column val" style="width: 1px;flex: 1;">
<view class="row items-center" v-for="(sItem,i) in item.GuestInfo" :key="i">
<input type="text" v-model="sItem.LastName" :placeholder="`${sItem.IsAdult?'住客'+(i+1):sItem.Age+'岁儿童'}姓`" />
<input type="text" v-model="sItem.FirstName" :placeholder="`${sItem.IsAdult?'住客'+(i+1):sItem.Age+'岁儿童'}名`" />
<input type="text" v-model="sItem.LastName"
:placeholder="`${sItem.IsAdult?'住客'+(i+1):sItem.Age+'岁儿童'}姓`" />
<input type="text" v-model="sItem.FirstName"
:placeholder="`${sItem.IsAdult?'住客'+(i+1):sItem.Age+'岁儿童'}名`" />
<!--<view class="row" style="margin-left:20rpx;">
<image v-if="item.GuestInfo.length>1"
style="width: 27rpx;height: 27rpx;display: block;"
......@@ -125,8 +130,7 @@
</view>
</view>
<view>
<textarea class="jz_TextArea"
placeholder="请输入备注信息" v-model="orderMsg.Remarks"></textarea>
<textarea class="jz_TextArea" placeholder="请输入备注信息" v-model="orderMsg.Remarks"></textarea>
</view>
</view>
<view class="CouponBox">
......@@ -140,7 +144,8 @@
<text style="flex: 1;"
v-if="useCouponIds == 0 &&couponList.length>0">{{couponList.length}}张可用优惠券</text>
<text class="content" style="color:grey" v-else-if="couponList.length==0">暂无优惠券</text>
<text class="content" v-else :style="{ color: mainColor }">已优惠{{currentCoupon.discountMoney}} </text>
<text class="content" v-else
:style="{ color: mainColor }">已优惠{{currentCoupon.discountMoney}} </text>
<!-- <u-icon name="ellipsis" size="36" v-if="couponList.length > 0"></u-icon> -->
</text>
<u-icon name="arrow" :size="32" color="#111" v-if="couponList.length>0"></u-icon>
......@@ -247,7 +252,7 @@
<u-button :ripple="true" :hair-line="false"
:disabled="(this.orderMsg&&this.orderMsg.TotalPrice==0)||submit"
:custom-style="(this.orderMsg&&this.orderMsg.TotalPrice==0)||submit?btnStyle2:btnStyle"
@click="buyRoom" :loading="submit">立即购买</u-button>
@click="submitB2COrderHandler" :loading="submit">立即购买</u-button>
</view>
</view>
<u-picker v-model="showtime" mode="time" @confirm='confirm' :params="paramsTime"
......@@ -302,11 +307,11 @@
RatePlanID: "",
CheckOutDate: "", //离店时间
RoomCount: "", //房间数量
guestLastName: "", //英文姓
guestFirstName: "", //英文名
guestLastName: "", //英文姓
guestFirstName: "无误", //英文名
guestAddress: "",
guestPhoneNumber: "",
guestEmail: "", //Email
guestPhoneNumber: "13344445555",
guestEmail: "123@qq.com", //Email
BookingID: "",
HotelName: "", //酒店名称
HotelPic: "", //酒店封面
......@@ -408,15 +413,11 @@
this.orderMsg.ProductId = this.RoomInfo.RoomTypeID;
this.orderMsg.RatePlanID = this.RoomInfo.RatePlanID
this.orderMsg.RoomCount = this.searchObj.rooms
this.getGroupData()
this.price = this.RoomInfo.Currency + this.RoomInfo.RatePlanPrice
this.getUserCouponList()
this.CalTotalPrice();
this.GetCountryInfo()
},
created() {
this.mainColor = this.$uiConfig.mainColor;
......@@ -449,12 +450,12 @@
});
},
methods: {
getGroupData(){
getGroupData() {
this.orderMsg.GuestList = [];
this.searchObj.searchroomGroup.forEach((item, index) => {
var guestInfoList = [];
let allprople = Number(item.numberOfAdults) + Number(item.numberOfChildren)
for (let i = 0; i <= Number(item.numberOfAdults)-1; i++) {
for (let i = 0; i <= Number(item.numberOfAdults) - 1; i++) {
let obj = {
IsAdult: 1,
LastName: "",
......@@ -463,7 +464,7 @@
};
guestInfoList.push(obj);
}
for (let i = 0; i <= Number(item.numberOfChildren)-1; i++) {
for (let i = 0; i <= Number(item.numberOfChildren) - 1; i++) {
let obj = {
IsAdult: 0,
LastName: "",
......@@ -487,7 +488,17 @@
var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
return "周" + week;
},
submitB2COrderHandler(OrderId) {
submitB2COrderHandler() {
const error = this.validate()
if (error != '') {
uni.showToast({
icon: 'none',
title: error
})
return
}
if (this.submit) return;
this.submit = true;
let userInfo = uni.getStorageSync("mall_UserInfo");
let guestInfo = `成人x${this.searchObj.adultsNumber}; `;
if (this.orderMsg.ChirdNeedBedNum > 0) {
......@@ -498,34 +509,70 @@
Name: this.orderMsg.Name,
ContactNumber: this.orderMsg.guestPhoneNumber,
Mailbox: this.orderMsg.guestEmail,
//GoodsId: this.orderMsg.RatePlanID,
GoodsId: this.HotelInfo.hotelId,
GoodsName: this.HotelInfo.name,
GoodsPic: "",
GoodsType: 9,
OrderMake: `${this.orderMsg.CheckInDate}入住;${this.orderMsg.CheckOutDate}离店 ${guestInfo}`,
TotalPrice: this.orderMsg.TotalPrice, //this.getPrice(this.orderMsg.TotalPrice)
TotalPrice: this.orderMsg.TotalPrice,
PreferentialPrice: this.currentCoupon.discountMoney,
ErpOrderId: OrderId,
CouponAllotIds:"",
ErpOrderId: 0,
Country: 0,
PlatformTax: 0,
Income: 0,
Refund: 0,
MallBaseId: userInfo.MallBaseId,
CreateBy: 0
CreateBy: 0,
DOrderType: 1,
OpenId: "",
DiDaHotelParams: {},
};
let CouponAllotIds = ''
if (this.useCouponIds.length > 0) {
CouponAllotIds = this.useCouponIds.join(',')
}
msg.CouponAllotIds = CouponAllotIds;
if (this.HotelInfo.images && this.HotelInfo.images.length > 0) {
msg.GoodsPic = this.HotelInfo.images[0].Path;
}
// #ifdef MP-DI
msg.DOrderType = 1;
if (this.customer.salesBaseInfo && this.customer.salesBaseInfo.employeeId) {
msg.CreateBy = this.customer.salesBaseInfo.employeeId
msg.CreateBy = this.customer.salesBaseInfo.employeeId;
}
// #endif
// #ifdef MP-AG
msg.DOrderType = 2; //同业订单
if (userInfo && userInfo.OpenId) {
msg.OpenId = userInfo.OpenId;
}
// #endif
//道旅酒店参数
let that = this;
var CreateBy = 0
// #ifdef MP-DI
that.orderMsg.DirectCustomerId = this.customer.customerId;
if (this.customer && this.customer.erpBaseInfo && this.customer.erpBaseInfo.employeeId) {
that.orderMsg.EmployeeIdStr = this.customer.erpBaseInfo.employeeId;
}
// #endif
// #ifdef MP-AG
CreateBy = this.CreateBy
that.orderMsg.CustomerId = this.customer.customerId
that.orderMsg.EmployeeIdStr = CreateBy
// #endif
this.orderMsg.CouponAllotIds = CouponAllotIds;
msg.DiDaHotelParams = this.orderMsg;
//道旅参数END
console.log("AddOrderInfo_post", msg);
this.apipost("AddOrderInfo_post", msg, (res) => {
this.submit = false;
if (res.resultCode == 1) {
console.log(res.data,'-----33');
this.orderInfo = JSON.parse(res.data.sPayInfo)
uni.showToast({
icon: 'none',
......@@ -538,12 +585,13 @@
icon: 'none',
duration: 3000
})
this.submit = false;
}
}, fail => {
this.submit = false;
});
},
goPayHandler(item) {
let OrderNo=item.OrderNo;
let OrderNo = item.OrderNo;
let that = this;
uni.requestPayment({
provider: "wxpay",
......@@ -558,14 +606,15 @@
title: "支付成功",
});
setTimeout(() => {
// (that.getPrice(that.orderMsg.TotalPrice) - that
// .currentCoupon.discountMoney).toFixed(2) +
// "&isFrom=5
uni.redirectTo({
url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
(that.orderMsg.TotalPrice - that.currentCoupon.discountMoney).toFixed(2) +
"&isFrom=5",
});
//创建道旅订单
//that.createDiDaOrder();
// uni.redirectTo({
// url: "/pages/jiuzhai/paysuccess?PreferPrice=" +
// (that.orderMsg.TotalPrice - that.currentCoupon
// .discountMoney).toFixed(2) +
// "&isFrom=5",
// });
}, 100);
},
fail: function(err) {
......@@ -582,6 +631,50 @@
},
});
},
//创建道旅订单
createDiDaOrder() {
let that = this;
var CreateBy = 0
// #ifdef MP-DI
that.orderMsg.DirectCustomerId = this.customer.customerId;
if (this.customer && this.customer.erpBaseInfo && this.customer.erpBaseInfo.employeeId) {
that.orderMsg.EmployeeIdStr = this.customer.erpBaseInfo.employeeId;
}
// #endif
// #ifdef MP-AG
CreateBy = this.CreateBy
that.orderMsg.CustomerId = this.customer.customerId
that.orderMsg.EmployeeIdStr = CreateBy
// #endif
let CouponAllotIds = ''
if (this.useCouponIds.length > 0) {
CouponAllotIds = this.useCouponIds.join(',')
}
this.orderMsg.CouponAllotIds = CouponAllotIds
console.log("酒店下单", that.orderMsg);
that.apipost('dmc_post_GetDiDaBookingConfirm', that.orderMsg,
res => {
if (res.resultCode == 1) {
const tempData = res.data
// #ifdef MP-DI
//this.submitB2COrderHandler(tempData.orderId)
// #endif
// #ifdef MP-AG
this.submit = false
uni.showToast({
title: '订单创建成功.',
icon: 'none'
})
uni.redirectTo({
url: `/pages/AggregateOrders/AggregateOrdersList?OrderTypeStr=7`,
});
// #endif
}
}
);
},
//日期格式化
getformatDateStr(value) {
var dt = new Date(value);
......@@ -606,8 +699,7 @@
this.roomRateDetails = res.data.PriceDetails.HotelList[0];
this.orderMsg.BookingID = res.data.PriceDetails.ReferenceNo;
this.orderMsg.checkInTime = res.data.PriceDetails.CheckInDate;
this.orderMsg.TotalPrice = this.roomRateDetails
.TotalPrice //this.getPrice(this.roomRateDetails.TotalPrice);
this.orderMsg.TotalPrice = this.roomRateDetails.TotalPrice
if (this.roomRateDetails.RatePlanList && this.roomRateDetails.RatePlanList.length > 0) {
this.orderMsg.roomType = this.roomRateDetails.RatePlanList[0].BedType
}
......@@ -618,7 +710,6 @@
title: err.message,
icon: 'none',
})
// this.submit = false;
});
},
getPrice(price) {
......@@ -784,14 +875,13 @@
return arr[1] + '月' + arr[2] + '日'
}
},
//选择时间
confirm(val) {
this.orderMsg.ArrivalTime = val.hour + ':' + val.minute;
},
//计算总价
CalTotalPrice() {
this.price = this.orderMsg.TotalPrice*this.orderMsg.RoomCount
this.price = this.orderMsg.TotalPrice * this.orderMsg.RoomCount
},
validate() {
let email = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
......@@ -825,63 +915,7 @@
}
return msg
},
//立即购买
buyRoom() {
const error = this.validate()
if (error != '') {
uni.showToast({
icon: 'none',
title: error
})
return
}
if (this.submit) return;
this.submit = true;
let that = this;
var CreateBy = 0
// #ifdef MP-DI
that.orderMsg.DirectCustomerId = this.customer.customerId;
if (this.customer && this.customer.erpBaseInfo && this.customer.erpBaseInfo.employeeId) {
that.orderMsg.EmployeeIdStr = this.customer.erpBaseInfo.employeeId;
}
// #endif
// #ifdef MP-AG
CreateBy = this.CreateBy
that.orderMsg.CustomerId = this.customer.customerId
// if (this.customer && this.customer.salesBaseInfo && this.customer.salesBaseInfo.employeeId) {
// this.orderMsg.EmployeeIdStr = this.customer.salesBaseInfo.employeeId
// }
that.orderMsg.EmployeeIdStr = CreateBy
// #endif
let CouponAllotIds = ''
if(this.useCouponIds.length>0){
CouponAllotIds = this.useCouponIds.join(',')
}
this.orderMsg.CouponAllotIds = CouponAllotIds
console.log("酒店下单", that.orderMsg);
that.apipost('dmc_post_GetDiDaBookingConfirm', that.orderMsg,
res => {
if (res.resultCode == 1) {
const tempData = res.data
// #ifdef MP-DI
this.submitB2COrderHandler(tempData.orderId)
// #endif
// #ifdef MP-AG
this.submit = false
uni.showToast({
title: '订单创建成功.',
icon: 'none'
})
uni.redirectTo({
url: `/pages/AggregateOrders/AggregateOrdersList?OrderTypeStr=7`,
});
// #endif
}
}
);
},
}
}
</script>
......@@ -1280,6 +1314,7 @@
.LastNameBox view:last-child {
margin-bottom: 0;
}
.jz_TextArea {
height: 50px;
margin-bottom: 10px;
......
......@@ -680,7 +680,8 @@
Income: 0,
Refund: 0,
MallBaseId: this.userInfo.MallBaseId,
CreateBy:0
CreateBy:0,
DOrderType:1
};
// #ifdef MP-DI
if(this.customer.salesBaseInfo&&this.customer.salesBaseInfo.employeeId){
......
......@@ -871,6 +871,7 @@
Income: 0,
Refund: 0,
MallBaseId: this.userInfo.MallBaseId,
DOrderType:1
};
this.apipost("AddOrderInfo_post", msg, (res) => {
if (res.resultCode == 1) {
......
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