|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<view class="page" :style="{'height':(h)+'px','padding-top':mt+'px'}">
|
|
|
- <c-nav-bar title="新增订单" :showIcon="true"></c-nav-bar>
|
|
|
+ <c-nav-bar :title="!dataForm.id?'新增订单':!orderStatus?'编辑订单':'办理入住'" :showIcon="true"></c-nav-bar>
|
|
|
<view class="box box1">
|
|
|
<view class="tit">预订信息</view>
|
|
|
<u-cell-group :border="false" customStyle="margin:0 -30rpx">
|
|
@@ -97,8 +97,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</u-swipe-action-item>
|
|
|
- <u-swipe-action-item :show="item.show" :index="index" class=""
|
|
|
- v-for="(item, index) in dataForm.detailFormList[0].otherData" :key="index" @click="click2(index)"
|
|
|
+ <u-swipe-action-item :show="item.show" :index="index2" class=""
|
|
|
+ v-for="(item, index2) in dataForm.detailFormList[0].otherData" :key="index2" @click="click2(index2)"
|
|
|
:options="options">
|
|
|
<view class="goodsInfo item">
|
|
|
<view class="title-wrap">
|
|
@@ -112,9 +112,9 @@
|
|
|
<view class="tit tit2"><text>收款信息</text> <u-icon @click="addpay()" name="plus-circle" label="添加收款"
|
|
|
labelColor="#1372FF" labelSize="24" color="1372FF" size="30"></u-icon></view>
|
|
|
<u-swipe-action>
|
|
|
- <u-swipe-action-item :show="item.show" :index="index" class="goodsInfo"
|
|
|
+ <u-swipe-action-item :show="item.show" :index="index" class=""
|
|
|
v-for="(item, index) in dataForm.flowRecord" :key="index" @click="click3(index)" :options="options">
|
|
|
- <view class="item">
|
|
|
+ <view class="goodsInfo item">
|
|
|
<view class="title-wrap">
|
|
|
<text
|
|
|
class="title u-line-2">{{item.flowTypeName}}/{{item.payTypeName}}/{{item.amount}}</text>
|
|
@@ -126,8 +126,9 @@
|
|
|
<view class="footer">
|
|
|
<view class="total"><text>订单金额:</text><text>¥{{totalMOney}}</text></view>
|
|
|
<view class="btns">
|
|
|
- <text @click="confirmOrder(2)">直接入住</text>
|
|
|
- <text @click="confirmOrder(1)">提交订单</text>
|
|
|
+ {{today}}
|
|
|
+ <text @click="confirmOrder(2)" v-if="today==1">直接入住</text>
|
|
|
+ <text @click="confirmOrder(1)">提交</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<u-picker :itemHeight="88" :immediateChange="true" :show="showLaiyuan" :columns="laiyuan" title="来源选择"
|
|
@@ -157,6 +158,7 @@
|
|
|
backgroundColor: '#dd524d'
|
|
|
}
|
|
|
}],
|
|
|
+ orderStatus:'',
|
|
|
totalMOney: 0, //订单总金额
|
|
|
dataForm: {
|
|
|
arriveDate: "",
|
|
@@ -201,24 +203,60 @@
|
|
|
]
|
|
|
],
|
|
|
roomId: '',
|
|
|
- laiyuan: [[]]
|
|
|
+ laiyuan: [
|
|
|
+ []
|
|
|
+ ],
|
|
|
+ currentDate: '',
|
|
|
+ today:''
|
|
|
}
|
|
|
},
|
|
|
onLoad(opt) {
|
|
|
this.getLaiyuan();
|
|
|
- this.roomId = opt.roomId.split(',');
|
|
|
+ if (opt.roomId) {
|
|
|
+ this.roomId = opt.roomId.split(',');
|
|
|
+ }
|
|
|
if (opt.id) { //编辑
|
|
|
if (opt.orderStatus) {
|
|
|
this.orderStatus = opt.orderStatus;
|
|
|
}
|
|
|
+ console.log(this.orderStatus)
|
|
|
this.dataForm.id = opt.id;
|
|
|
this.getInfo2()
|
|
|
} else {
|
|
|
//新增获取简单信息
|
|
|
this.getInfo();
|
|
|
}
|
|
|
+ // 当前日期
|
|
|
+ this.getleftData();
|
|
|
+ let myDate = new Date();
|
|
|
+ let year = myDate.getFullYear();
|
|
|
+ let mon = myDate.getMonth() + 1;
|
|
|
+ let day = myDate.getDate();
|
|
|
+ mon = mon > 9 ? mon : '0' + mon;
|
|
|
+ day = day > 9 ? day : '0' + day;
|
|
|
+ this.currentDate = year + '-' + mon + '-' + day;
|
|
|
},
|
|
|
methods: {
|
|
|
+ compareDate(data) {
|
|
|
+ if (
|
|
|
+ new Date(data).getTime() < new Date(this.currentDate).getTime()
|
|
|
+ ) {
|
|
|
+ this.today = -1;
|
|
|
+ //v.push("-1"); //有时间小于今天
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ new Date(newval[i]).getTime() == new Date(this.currentDate).getTime()
|
|
|
+ ) {
|
|
|
+ this.today = 1;
|
|
|
+ v.push("1"); //有时间等于今天
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ new Date(newval[i]).getTime() > new Date(this.currentDate).getTime()
|
|
|
+ ) {
|
|
|
+ this.today = 2;
|
|
|
+ //v.push("2"); //有时间大于今天
|
|
|
+ }
|
|
|
+ },
|
|
|
//添加早餐
|
|
|
addBreast() {
|
|
|
let list = JSON.stringify(this.dataForm.detailFormList[0].breakfastData);
|
|
@@ -234,13 +272,21 @@
|
|
|
item.num !=
|
|
|
0);
|
|
|
this.totalMOney = this.dataForm.detailFormList[0].roomAmount;
|
|
|
+ this.dataForm.detailFormList[0].breakfastAmount = 0;
|
|
|
+ this.dataForm.detailFormList[0].otherAmount = 0;
|
|
|
for (let i = 0; i < this.dataForm.detailFormList[0].breakfastData.length; i++) {
|
|
|
this.totalMOney += parseFloat(this.dataForm.detailFormList[0].breakfastData[i]
|
|
|
- .price);
|
|
|
+ .price)*this.dataForm.detailFormList[0].breakfastData[i].num;
|
|
|
+ this.dataForm.detailFormList[0].breakfastAmount += parseFloat(this.dataForm
|
|
|
+ .detailFormList[0].breakfastData[i]
|
|
|
+ .price)*this.dataForm.detailFormList[0].breakfastData[i].num;
|
|
|
}
|
|
|
for (let i = 0; i < this.dataForm.detailFormList[0].otherData.length; i++) {
|
|
|
this.totalMOney += parseFloat(this.dataForm.detailFormList[0].otherData[i]
|
|
|
- .defaultPrice);
|
|
|
+ .defaultPrice)*this.dataForm.detailFormList[0].otherData[i].num;
|
|
|
+ this.dataForm.detailFormList[0].otherAmount += parseFloat(this.dataForm
|
|
|
+ .detailFormList[0].otherData[i]
|
|
|
+ .defaultPrice)*this.dataForm.detailFormList[0].otherData[i].num;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -254,6 +300,7 @@
|
|
|
events: {
|
|
|
addSuccess: data => {
|
|
|
if (data.data.amount != 0) {
|
|
|
+ this.dataForm.flowRecord = this.dataForm.flowRecord || [];
|
|
|
this.dataForm.flowRecord.push(data.data)
|
|
|
// if(data.data.flowType==1){ //收款
|
|
|
// this.totalMOney+=parseFloat(data.data.amount);
|
|
@@ -267,10 +314,21 @@
|
|
|
},
|
|
|
confirmOrder(orderStatus) {
|
|
|
//orderStatus//预约入住 1,直接入住2
|
|
|
- this.dataForm.orderStatus = orderStatus
|
|
|
- this.$api.post('/merchant/hotel/order/placeOrder', this.dataForm).then(res => {
|
|
|
+ if(orderStatus){
|
|
|
+ this.dataForm.orderStatus = orderStatus;
|
|
|
+ }
|
|
|
+ let url = '';
|
|
|
+ if (this.dataForm.id) {
|
|
|
+ url = '/merchant/hotel/order/updOrder'
|
|
|
+ if(this.orderStatus){
|
|
|
+ this.dataForm.orderStatus=this.orderStatus;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ url = '/merchant/hotel/order/placeOrder'
|
|
|
+ }
|
|
|
+ this.$api.post(url, this.dataForm).then(res => {
|
|
|
if (res.data.code == 0) {
|
|
|
- this.$showToast('下单成功');
|
|
|
+ this.$showToast('操作成功');
|
|
|
setTimeout(() => {
|
|
|
uni.reLaunch({
|
|
|
url: '/pagesMy/orderList/orderList'
|
|
@@ -280,10 +338,13 @@
|
|
|
})
|
|
|
},
|
|
|
click(index) {
|
|
|
- console.log(index)
|
|
|
+ this.dataForm.detailFormList[0].breakfastAmount-=this.dataForm.detailFormList[0].breakfastData[index].price*this.dataForm.detailFormList[0].breakfastData[index].num;
|
|
|
+ this.totalMOney-=this.dataForm.detailFormList[0].breakfastData[index].price*this.dataForm.detailFormList[0].breakfastData[index].num;
|
|
|
this.dataForm.detailFormList[0].breakfastData.splice(index, 1);
|
|
|
},
|
|
|
click2(index) {
|
|
|
+ this.dataForm.detailFormList[0].otherAmount-=this.dataForm.detailFormList[0].otherData[index].defaultPrice*this.dataForm.detailFormList[0].otherData[index].num;
|
|
|
+ this.totalMOney-=this.dataForm.detailFormList[0].otherData[index].defaultPrice*this.dataForm.detailFormList[0].otherData[index].num;
|
|
|
this.dataForm.detailFormList[0].otherData.splice(index, 1);
|
|
|
},
|
|
|
click3(index) {
|
|
@@ -299,8 +360,18 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- getInfo2(){//详情信息
|
|
|
-
|
|
|
+ getInfo2() { //详情信息
|
|
|
+ this.$api.get('/merchant/hotel/order/getOrderDetail/' + this.dataForm.id).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.dataForm = {
|
|
|
+ ...this.dataForm,
|
|
|
+ ...res.data.data,
|
|
|
+ };
|
|
|
+ this.totalMOney = this.dataForm.orderAmount;
|
|
|
+ this.compareDate(this.dataForm.arriveDate)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 房型列表
|
|
|
getInfo() {
|
|
@@ -356,7 +427,7 @@
|
|
|
width: 100%;
|
|
|
background-color: #fff;
|
|
|
left: 0;
|
|
|
- z-index: 9;
|
|
|
+ z-index: 99;
|
|
|
padding: 30rpx;
|
|
|
box-sizing: border-box;
|
|
|
|
|
@@ -386,6 +457,7 @@
|
|
|
border-radius: 48rpx;
|
|
|
border: 1rpx solid #D1D1D1;
|
|
|
color: #999;
|
|
|
+ flex:1;
|
|
|
|
|
|
&:last-child {
|
|
|
background-color: #1372FF;
|