Bläddra i källkod

房态修改价格

17755135699 7 månader sedan
förälder
incheckning
7d49a8c8ef
1 ändrade filer med 72 tillägg och 18 borttagningar
  1. 72 18
      pages/house/index.vue

+ 72 - 18
pages/house/index.vue

@@ -78,30 +78,30 @@
 								<view class="tr" v-for="(item2,index2) in item" :key="index2">
 									<view class="td" :style="{'left':scrollLeft+'px'}">{{item2.roomNumber}}</view>
 									<view class="td" v-for="(roomData,ind) in xdata" :key="ind"
-										:class="'s'+delDataStatus(item2.roomNumber,item2.houseBaseId,roomData.roomDataList,'status')">
+										:class="'s'+delDataStatus(item2.roomNumber,item2.houseBaseId,roomData.roomDataList,'status',item2.floor)">
 										<!-- 空置房-->
 										<template
-											v-if="delDataStatus(item2.roomNumber,item2.houseBaseId,roomData.roomDataList,'status') == 1">
+											v-if="delDataStatus(item2.roomNumber,item2.houseBaseId,roomData.roomDataList,'status',item2.floor) == 1">
 											<view v-if="disTabCli(roomData) == 1" class="cellBox disT">
-												¥{{item2.roomNumber|delDataStatus(item2.houseBaseId,roomData.roomDataList,'price')}}
+												¥{{item2.roomNumber|delDataStatus(item2.houseBaseId,roomData.roomDataList,'price',item2.floor)}}
 											</view>
 											<view v-else
-												@click="check(item2.roomNumber,item2.houseBaseId,roomData,i + '-'+index2+ '-'+ ind)"
+												@click="check(item2.roomNumber,item2.houseBaseId,roomData,i + '-'+index2+ '-'+ ind,item2.floor)"
 												class="cellBox">
-												¥{{item2.roomNumber|delDataStatus(item2.houseBaseId,roomData.roomDataList,'price')}}
+												¥{{item2.roomNumber|delDataStatus(item2.houseBaseId,roomData.roomDataList,'price',item2.floor)}}
 											</view>
 										</template>
 										<template v-else>
 											<view
 												@click="tabCli(item2.roomNumber,item2.houseBaseId,roomData.roomDataList)"
 												class="tdP">
-												<text>{{item2.roomNumber|delDataStatus(item2.houseBaseId,roomData.roomDataList,'guestName')}}</text>
-												<text>{{item2.roomNumber|delDataStatus(item2.houseBaseId,roomData.roomDataList,'status')}}</text>
+												<text>{{item2.roomNumber|delDataStatus(item2.houseBaseId,roomData.roomDataList,'guestName',item2.floor)}}</text>
+												<text>{{item2.roomNumber|delDataStatus(item2.houseBaseId,roomData.roomDataList,'status',item2.floor)}}</text>
 											</view>
 										</template>
 										<!-- 点击时状态 -->
 										<view class="cover" v-if="checkPosition.indexOf(i + '-'+index2+ '-'+ ind) > -1"
-											@click="check(item2.roomNumber,item2.houseBaseId,roomData,i + '-'+index2+ '-'+ ind)">
+											@click="check(item2.roomNumber,item2.houseBaseId,roomData,i + '-'+index2+ '-'+ ind,item2.item2.floor)">
 											<u-icon name="checkbox-mark" size="36" color="#fff"></u-icon>
 										</view>
 									</view>
@@ -114,6 +114,7 @@
 			<view class="opration" v-if="checkDataRoomId.length!=0">
 				<text @click="areaShow=true">关房</text>
 				<text @click="createOrder()">预订</text>
+				<text @click="priceShow=true">修改价格</text>
 			</view>
 		</view>
 		<Tabbar :tabbarIndex="1"></Tabbar>
@@ -121,6 +122,17 @@
 		<u-picker :itemHeight="88" :immediateChange="true" :show="areaShow" :columns="areaTxt" title="房态选择"
 			:defaultIndex="passengerDefault" @cancel="areaShow=false;clearData();"
 			@confirm="passengerConfirm"></u-picker>
+		<!-- 修改价格 -->
+		<u-popup :show="priceShow" mode="center">
+			<view class="changePrice">
+				<u--input placeholder="请设置新价格" type="number" border="surround" v-model="newPrice"></u--input>
+				<view class="btns">
+					<u-button text="取消" type="info" size="mini" @click="priceShow=false;clearData()"></u-button>
+					<u-button text="确定" type="primary" size="mini" @click="changePrice()"></u-button>
+				</view>
+			</view>
+
+		</u-popup>
 	</view>
 </template>
 
@@ -129,6 +141,8 @@
 	export default {
 		data() {
 			return {
+				priceShow: false,
+				newPrice: '',
 				homestayId: uni.getStorageSync('homestayId') || 0,
 				areaShow: false,
 				passengerDefault: [0],
@@ -157,8 +171,8 @@
 				xdata: [], //纵向列
 				leftData: [], //横向列,
 				indexArr: [], //楼层索引,
-				indexHouseBaseIdArr:[],
-				indexHouseNameArr:[],
+				indexHouseBaseIdArr: [],
+				indexHouseNameArr: [],
 				indexNameArr: [], //楼层Id索引,
 				opens: [],
 				statusTxt: {
@@ -187,9 +201,9 @@
 			this.getTj();
 		},
 		filters: {
-			delDataStatus(roomNumber, id, roomId, name) {
+			delDataStatus(roomNumber, id, roomId, name,floor) {
 				for (let i = 0; i < roomId.length; i++) {
-					if (id == roomId[i].houseBaseId && roomNumber == roomId[i].roomNumber) {
+					if (floor==roomId[i].floor&&id == roomId[i].houseBaseId && roomNumber == roomId[i].roomNumber) {
 						if (name == "status") {
 							return that.statusTxt[roomId[i][name]]
 						} else {
@@ -259,6 +273,25 @@
 
 				})
 			},
+			changePrice() {
+				this.$api
+					.post("/merchant/hotel/room/state/updRoomPrice", {
+						idList: this.checkDataRoomId,
+						price: this.newPrice,
+					})
+					.then((res) => {
+						if (res.data.code !== 0) {
+							return this.$showToast(res.data.msg);
+						} else {
+							this.$showToast('操作成功');
+							setTimeout(() => {
+								this.clearData();
+								this.priceShow = false;
+								this.init()
+							}, 500)
+						}
+					});
+			},
 			//新增订单
 			createOrder() {
 				this.clearData()
@@ -279,9 +312,9 @@
 				}
 				this.$forceUpdate();
 			},
-			delDataStatus(roomNumber, id, roomId, name) {
+			delDataStatus(roomNumber, id, roomId, name,floor) {
 				for (let i = 0; i < roomId.length; i++) {
-					if (id == roomId[i].houseBaseId && roomNumber == roomId[i].roomNumber) {
+					if (floor == roomId[i].floor &&id == roomId[i].houseBaseId && roomNumber == roomId[i].roomNumber) {
 						return roomId[i][name] + 1;
 					}
 				}
@@ -293,6 +326,7 @@
 			},
 			clearData() {
 				setTimeout(() => {
+					this.newPrice='';
 					this.checkDataDate = [];
 					this.checkPrice = [];
 					this.checkDataRoomId = [];
@@ -300,10 +334,10 @@
 				}, 1500);
 			},
 			//选择房间
-			check(roomNumber, id, item, position) {
+			check(roomNumber, id, item, position, floor) {
 				for (let i = 0; i < item.roomDataList.length; i++) {
 					if (
-						id == item.roomDataList[i].houseBaseId &&
+						floor == item.roomDataList[i].floor && id == item.roomDataList[i].houseBaseId &&
 						roomNumber == item.roomDataList[i].roomNumber
 					) {
 						//宫格位置标识
@@ -353,8 +387,8 @@
 					if (res.data.code == 0) {
 						for (let i in res.data.data) {
 							let F = i.split('-')[0];
-							let houseBaseId=res.data.data[i][0].houseBaseId;
-							let name=res.data.data[i][0].name;
+							let houseBaseId = res.data.data[i][0].houseBaseId;
+							let name = res.data.data[i][0].name;
 							if (this.indexHouseBaseIdArr.indexOf(houseBaseId) < 0) {
 								this.indexArr.push(F);
 								this.indexHouseBaseIdArr.push(houseBaseId)
@@ -386,6 +420,26 @@
 </script>
 
 <style scoped lang="less">
+	.changePrice {
+		padding: 40rpx;
+		border-radius: 20rpx;
+
+		.btns {
+			margin-top: 40rpx;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+
+			text {
+				display: inline-block;
+				width: 130rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				text-align: center;
+			}
+		}
+	}
+
 	.opration {
 		height: 140rpx;
 		padding: 0 30rpx;