Browse Source

feat: 房型管理

2912631854@qq.com 3 months ago
parent
commit
8798647823
3 changed files with 42 additions and 46 deletions
  1. 42 19
      pages/HotelMerchandise/index.vue
  2. 0 0
      pages/HotelMerchandise/index2.vue
  3. 0 27
      pages/my/roomType.vue

+ 42 - 19
pages/HotelMerchandise/index.vue

@@ -293,7 +293,10 @@
 				showPricinggaijia: false,
 				newprice: '',
 				id: '',
-				from: {}
+				from: {
+					ids: [],
+					status: null
+				}
 			}
 		},
 		onLoad(option) {
@@ -305,21 +308,33 @@
 		methods: {
 
 			Pricinged() {
-				this.$api.del('/merchant/hotel/repast', this.ids).then(res => {
-					if (res.data.code == 0) {
-						this.getRepast()
-						this.showPricing = false
-						this.ids = []
-					} else this.$showToast(res.data.msg);
-				})
+				if (this.ids.length != 0) {
+
+					this.$api.del('/merchant/hotel/repast', this.ids).then(res => {
+						if (res.data.code == 0) {
+							this.getRepast()
+							this.showPricing = false
+							this.Selected = false;
+							this.selectedTags = [];
+							this.ids = []
+						} else this.$showToast(res.data.msg);
+					})
+				} else this.$showToast('请选择商品');
 			},
 
 			piliangxiajia() {
-				this.$api.post('/merchant/hotel/repast/batchPutAway', this.from).then(res => {
-					this.selectedTags = [];
-					this.Selected = false;
-					this.getRepast(); //获取商品列表
-				})
+
+
+				if (this.from.ids.length != 0) {
+					this.$api.post('/merchant/hotel/repast/batchPutAway', this.from).then(res => {
+						if (res.data.code == 0) {
+							this.selectedTags = [];
+							this.Selected = false;
+							this.getRepast(); //获取商品列表
+						} else this.$showToast(res.data.msg);
+
+					})
+				} else this.$showToast('请选择商品');
 			},
 
 			quedingjiae() {
@@ -352,10 +367,9 @@
 				} else {
 					this.selectedTags.push(e);
 					this.ids.push(e.id)
-					this.from = {
-						ids: this.ids,
-						status: e.status == 1 ? 0 : 1
-					}
+					this.from.ids = this.ids
+					this.from.status = e.status == 1 ? 0 : 1
+
 				}
 			},
 			// 添加商品
@@ -432,18 +446,27 @@
 				if (index == 0) {
 					this.fromData.status = 1
 					this.getRepast()
+					this.ids = []
+					this.from.ids = []
+					this.from.status = null
+
 				} else {
 					this.fromData.status = 0
 					this.getRepast()
+					this.ids = []
+					this.from.ids = []
+					this.from.status = null
 				}
 
 			},
 			// 批量显示
 			showList() {
 				this.Selected = !this.Selected
-			},
+			}
+
+		},
+
 
-		}
 	}
 </script>
 

pages/HotelMerchandise/index1.vue → pages/HotelMerchandise/index2.vue


+ 0 - 27
pages/my/roomType.vue

@@ -226,7 +226,6 @@
 			}
 		},
 		onLoad() {
-			// console.log(this.homestayId)
 			this.getHomestayId()
 		},
 		methods: {
@@ -244,7 +243,6 @@
 			addTime() {
 				this.fromData.homestayId = uni.getStorageSync('homestayId')
 				this.$api.post('/merchant/hotel/room/state/batchDefineRoomPrice', this.fromData).then(res => {
-					console.log(res.data);
 					if (res.data.code == 0) {
 						this.$showToast('定价成功')
 						setTimeout(() => {
@@ -262,26 +260,20 @@
 				})
 			},
 			confirmOne(e) {
-				console.log('1111', e);
 				this.showOne = false
 				if (this.typeIndex == 1) {
 					this.valueTimeOne = e[0]
-					console.log(this.valueTimeOne);
 				} else if (this.typeIndex == 2) {
 					this.valueTimeOne = e[0]
-					console.log(this.valueTimeOne);
 				}
 				this.fromData.rentDateStart = e[0]
 			},
 			confirmTwo(e) {
-				console.log('22222', e);
 				this.showTwo = false
 				if (this.typeIndex == 1) {
 					this.valueTimeTwo = e[0]
-					console.log(this.valueTimeTwo);
 				} else if (this.typeIndex == 2) {
 					this.valueTimeTwo = e[0]
-					console.log(this.valueTimeTwo);
 				}
 				this.fromData.rentDateEnd = e[0]
 			},
@@ -291,7 +283,6 @@
 
 			},
 			selectType(type) {
-				console.log(type);
 				this.typeIndex = type;
 			},
 
@@ -302,7 +293,6 @@
 						isPutaway: 0,
 						idList: this.fromData.houseBaseIdList
 					}
-					console.log(this.selectedTags);
 					this.$api.post('/merchant/hotel/room/state/updPutawayState', obj).then(res => {
 						if (res.data.code == 0) {
 							this.$showToast('下架成功')
@@ -327,7 +317,6 @@
 						idList: this.fromData.houseBaseIdList
 					}
 					this.$api.post('/merchant/hotel/room/state/updPutawayState', obj).then(res => {
-						console.log(res);
 						if (res.data.code == 0) {
 							this.$showToast('上架成功')
 							setTimeout(() => {
@@ -340,24 +329,13 @@
 						} else this.$showToast(res.data.msg)
 					})
 				} else this.$showToast('请选择房型')
-
-
-
 			},
 
-
-
-
-
-
 			selectPerson(e, i) {
-				console.log(e, i);
 				if (this.selectedTags.includes(e)) {
 					this.selectedTags = this.selectedTags.filter(t => t !== e);
 					this.ids.splice(i, 1)
-					console.log('1111');
 				} else {
-					console.log('2222');
 					this.selectedTags.push(e);
 					this.fromData.houseBaseIdList.push(e.houseBaseId)
 					// this.from = {
@@ -372,7 +350,6 @@
 			},
 			open() {},
 			Pricing() {
-				console.log('11111111');
 				if (this.fromData.houseBaseIdList.length != 0) {
 					this.showPricing = true
 				} else this.$showToast('请选择房型')
@@ -387,12 +364,9 @@
 				this.$api.get(`/merchant/hotel/mine/getHouseBaseList/${this.homestayId}`, {
 					homestayId: this.homestayId
 				}).then((res) => {
-					// console.log(res)
 					this.roomType = res.data.data
 
 					// let roomSymbleName=this.roomType.name
-					// console.log(roomSymbleName)
-					// console.log(this.roomType)
 				})
 			},
 			// 新增房型
@@ -406,7 +380,6 @@
 				uni.navigateTo({
 					url: `/pages/my/houseList?houseBaseId=${houseBaseId}`
 				})
-				console.log(houseBaseId)
 			}
 		}
 	}