|
|
@@ -361,6 +361,7 @@
|
|
|
<a-select
|
|
|
placeholder="订单来源"
|
|
|
v-model="model.orderInfo.customerSource"
|
|
|
+ @change="customerSourceChange"
|
|
|
>
|
|
|
<a-select-option
|
|
|
:value="item.id"
|
|
|
@@ -1131,7 +1132,7 @@ export default {
|
|
|
contractTeamProtocolName: "",
|
|
|
customerSource: "",
|
|
|
},
|
|
|
- roomIds: [],
|
|
|
+ roomIds: [{customerSource:''}],
|
|
|
livingRoomDayPrices: [],
|
|
|
roomPrices: [],
|
|
|
orderFees: [],
|
|
|
@@ -1185,6 +1186,7 @@ export default {
|
|
|
roomLayoutList: [],
|
|
|
amount: 0,
|
|
|
roomIdsIndex: 0,
|
|
|
+ roomIdsIndexId:null,
|
|
|
oldBusMemberCardList: [],
|
|
|
busMemberCardList: [],
|
|
|
payTypeList: [],
|
|
|
@@ -1224,13 +1226,15 @@ export default {
|
|
|
// price:0
|
|
|
// };
|
|
|
// }
|
|
|
+ console.log(this.model.roomPrices);
|
|
|
console.log('99999999999999999999999',this.daysBetween(this.model.orderInfo.arrivalTime2, this.model.orderInfo.dueOutTimeSpan));
|
|
|
let copy = JSON.parse(JSON.stringify(this.model.roomPrices));
|
|
|
for (let i = 0; i < copy.length; i++) {
|
|
|
let money = copy[i].prefPrice;
|
|
|
let brr = [];
|
|
|
// brr.length = this.model.orderInfo.dayCount;
|
|
|
- brr.length = this.daysBetween(this.model.orderInfo.arrivalTime2, this.model.orderInfo.dueOutTime2)
|
|
|
+ // brr.length = this.daysBetween(this.model.orderInfo.arrivalTime2, this.model.orderInfo.dueOutTime2)
|
|
|
+ brr.length = copy[i].day;
|
|
|
for (let j = 0; j < brr.length; j++) {
|
|
|
brr[j] = {
|
|
|
day: this.addDate(this.model.orderInfo.arrivalTime2, j),
|
|
|
@@ -1254,8 +1258,12 @@ export default {
|
|
|
// price:money
|
|
|
// };
|
|
|
copy[i].edit = brr;
|
|
|
+ // copy[i].day = this.model.roomPrices.filter(item=>item.roomId == copy[i].roomId)[0].day
|
|
|
+ if (this.roomIdsIndex==0) {
|
|
|
+ copy[i].day = this.daysBetween(this.model.orderInfo.arrivalTime2, this.model.orderInfo.dueOutTime2)
|
|
|
+ }
|
|
|
// copy[i].day = this.model.orderInfo.dayCount;
|
|
|
- copy[i].day = this.daysBetween(this.model.orderInfo.arrivalTime2, this.model.orderInfo.dueOutTime2)
|
|
|
+ // copy[i].day = this.daysBetween(this.model.orderInfo.arrivalTime2, this.model.orderInfo.dueOutTime2)
|
|
|
}
|
|
|
console.log(copy);
|
|
|
this.PriceData = copy;
|
|
|
@@ -1291,6 +1299,17 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
+ 'model.roomIds'(val){
|
|
|
+ if (val.length > 0) {
|
|
|
+ val.forEach(ele=>{
|
|
|
+ if (!ele.customerSource) {
|
|
|
+ ele.customerSource = this.model.orderInfo.customerSource
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(this.model.roomIds);
|
|
|
+ // model.roomIds[roomIdsIndex].customerSource = model.orderInfo.customerSource
|
|
|
+ }
|
|
|
+ },
|
|
|
'model.orderInfo.bookingType'(val,old){
|
|
|
debugger
|
|
|
if (val) {
|
|
|
@@ -1598,6 +1617,11 @@ export default {
|
|
|
// this.getcesRoomLayout();
|
|
|
},
|
|
|
methods: {
|
|
|
+ customerSourceChange(e){
|
|
|
+ console.log(e);
|
|
|
+ let idx = this.model.roomIds.findIndex(item=>item.id == this.roomIdsIndexId)
|
|
|
+ this.model.roomIds[idx].customerSource = e
|
|
|
+ },
|
|
|
//计算两个日期之间相隔多少天
|
|
|
daysBetween(date1, date2) {
|
|
|
const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
|
|
|
@@ -1908,7 +1932,7 @@ export default {
|
|
|
|
|
|
//根据传入的数字将日期加上对应的天数
|
|
|
addDate(date, days) {
|
|
|
- console.log(date, days);
|
|
|
+ // console.log(date, days);
|
|
|
let time = new Date(date);
|
|
|
time.setDate(time.getDate() + days);
|
|
|
let m = time.getMonth() + 1;
|
|
|
@@ -2175,13 +2199,20 @@ export default {
|
|
|
this.loadRooms();
|
|
|
|
|
|
// this.edit(this.modelDefault);
|
|
|
- var i = 0;
|
|
|
- this.model.roomPrices.forEach((t) => {
|
|
|
- t.day = this.model.orderInfo.dayCount;
|
|
|
- this.editPriceIndex = i;
|
|
|
+ if (this.roomIdsIndex==0) {
|
|
|
+ var i = 0;
|
|
|
+ this.model.roomPrices.forEach((t) => {
|
|
|
+ t.day = this.model.orderInfo.dayCount;
|
|
|
+ this.editPriceIndex = i;
|
|
|
+ this.editPriceOk();
|
|
|
+ i++;
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.model.roomPrices[this.roomIdsIndex].day = this.model.orderInfo.dayCount;
|
|
|
+ this.editPriceIndex = this.roomIdsIndex;
|
|
|
this.editPriceOk();
|
|
|
- i++;
|
|
|
- });
|
|
|
+ }
|
|
|
+
|
|
|
console.log(this.model.roomPrices);
|
|
|
},
|
|
|
disabledDate(current) {
|
|
|
@@ -2485,10 +2516,15 @@ export default {
|
|
|
find2.receivable = deposit2;
|
|
|
}
|
|
|
this.amount = sum;
|
|
|
+ this.roomIdsIndex = 0;
|
|
|
},
|
|
|
tabClick(e) {
|
|
|
console.log("tabClick", e);
|
|
|
var index = this.model.roomIds.findIndex((t) => t.id == e);
|
|
|
+ console.log("index", index);
|
|
|
+ this.model.orderInfo.customerSource = this.model.roomIds[index].customerSource;
|
|
|
+ this.model.orderInfo.dayCount = this.model.roomPrices[index].day;
|
|
|
+ this.roomIdsIndexId = e
|
|
|
this.roomIdsIndex = index;
|
|
|
},
|
|
|
modalFormOk(e) {
|
|
|
@@ -2789,6 +2825,21 @@ export default {
|
|
|
// console.log("orderFees", orderFees);
|
|
|
|
|
|
this.loadOrderFees();
|
|
|
+ // this.depositSplit(this.depositSplit)
|
|
|
+ if (!this.depositSplit) {
|
|
|
+ var yajin = this.model.roomPrices.reduce((sum, val) => {
|
|
|
+ let total = sum + val.deposit;
|
|
|
+ return isNaN(total) ? 0 : total;
|
|
|
+ }, 0);
|
|
|
+ this.model.roomPrices.forEach((t) => {
|
|
|
+ t.deposit = 0;
|
|
|
+ });
|
|
|
+ this.model.roomPrices[0].deposit = yajin;
|
|
|
+ } else {
|
|
|
+ this.model.roomPrices.forEach((t) => {
|
|
|
+ t.deposit = this.compuleDeposit(t.marketPrice);
|
|
|
+ });
|
|
|
+ }
|
|
|
// this.model.orderFees = [...this.model.orderFees, ...orderFees];
|
|
|
}
|
|
|
},
|
|
|
@@ -2804,6 +2855,7 @@ export default {
|
|
|
},
|
|
|
submitForm() {
|
|
|
const that = this;
|
|
|
+ console.log(that.model.orderInfo);
|
|
|
that.model.livingRoomDayPrices = [];
|
|
|
console.log("that.model.roomPrices", that.model.roomPrices);
|
|
|
that.model.roomPrices.forEach((t) => {
|
|
|
@@ -2811,22 +2863,47 @@ export default {
|
|
|
var dayTime = moment(this.model.orderInfo.arrivalTime2)
|
|
|
.add(b, "days")
|
|
|
.format("YYYY-MM-DD");
|
|
|
- that.model.livingRoomDayPrices.push({
|
|
|
- livingType: 1,
|
|
|
- dayTime: t.editPriceTime ? t.editPriceTime[b].toString() : dayTime,
|
|
|
- // price: t.editPrice? t.editPrice[b].toString() : t.prefPrice,
|
|
|
- price:
|
|
|
- t.editPrice && t.editPriceTime && t.editPriceTime[b] == dayTime
|
|
|
- ? t.editPrice[b].toString()
|
|
|
- : t.prefPrice,
|
|
|
- // dayTime: dayTime,
|
|
|
- // price: t.prefPrice,
|
|
|
- roomLayoutId: t.layoutId,
|
|
|
- roomId: t.roomId,
|
|
|
- });
|
|
|
+ console.log(t.editPriceTime);
|
|
|
+ if (t.editPriceTime && t.editPriceTime[b]) {
|
|
|
+ that.model.livingRoomDayPrices.push({
|
|
|
+ livingType: 1,
|
|
|
+ dayTime: t.editPriceTime ? (t.editPriceTime[b] || '').toString() : dayTime,
|
|
|
+ // price: t.editPrice? t.editPrice[b].toString() : t.prefPrice,
|
|
|
+ price:
|
|
|
+ t.editPrice && t.editPriceTime && t.editPriceTime[b] == dayTime
|
|
|
+ ? t.editPrice[b].toString()
|
|
|
+ : t.prefPrice,
|
|
|
+ // dayTime: dayTime,
|
|
|
+ // price: t.prefPrice,
|
|
|
+ roomLayoutId: t.layoutId,
|
|
|
+ roomId: t.roomId,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (!t.editPriceTime) {
|
|
|
+ that.model.livingRoomDayPrices.push({
|
|
|
+ livingType: 1,
|
|
|
+ dayTime: dayTime,
|
|
|
+ // price: t.editPrice? t.editPrice[b].toString() : t.prefPrice,
|
|
|
+ price:t.prefPrice,
|
|
|
+ // dayTime: dayTime,
|
|
|
+ // price: t.prefPrice,
|
|
|
+ roomLayoutId: t.layoutId,
|
|
|
+ roomId: t.roomId,
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
+ // let arr = JSON.parse(JSON.stringify(that.model.roomIds))
|
|
|
that.model.roomIds.forEach((t) => {
|
|
|
+ console.log(t);
|
|
|
+ console.log(that.model.roomPrices.findIndex((item) => item.roomId == t.id))
|
|
|
+ let info = {}
|
|
|
+ let idx;
|
|
|
+ idx = that.model.roomPrices.findIndex((item) => item.roomId == t.id)
|
|
|
+ info = JSON.parse(JSON.stringify(that.model.orderInfo))
|
|
|
+ info.dueOutTime = that.model.roomPrices[idx].editPriceTime[that.model.roomPrices[idx].editPriceTime.length-1] + " " + moment(that.model.orderInfo.dueOutTimeSpan).format("HH:mm")
|
|
|
+ t.roomOrderInfo = info
|
|
|
+ t.roomOrderInfo.customerSource = t.customerSource
|
|
|
t.roomId = t.id;
|
|
|
var obj = {
|
|
|
certNo: t.key4,
|
|
|
@@ -2845,11 +2922,13 @@ export default {
|
|
|
t.livingCustomers = [...[obj], ...t.livingCustomers2];
|
|
|
}
|
|
|
});
|
|
|
+ // this.model.roomIds = arr
|
|
|
console.log("this.model", this.model);
|
|
|
if (that.model.roomIds.length <= 0) {
|
|
|
that.$message.warning("请先添加房间");
|
|
|
return;
|
|
|
}
|
|
|
+ // return
|
|
|
// 触发表单验证
|
|
|
this.$refs.form.validate((valid, err) => {
|
|
|
if (valid) {
|