Ver código fonte

feat: 房型管理

2912631854@qq.com 5 meses atrás
pai
commit
96ed44d260
1 arquivos alterados com 45 adições e 57 exclusões
  1. 45 57
      pages/my/roomType.vue

+ 45 - 57
pages/my/roomType.vue

@@ -90,7 +90,8 @@
 						每天价格
 					</view>
 
-					<u-radio-group @change="selectType" size="32" iconSize="24" placement="row" activeColor='#1372FF'>
+					<u-radio-group @change="selectType" size="32" v-model="typeIndex" iconSize="24" placement="row"
+						activeColor='#1372FF'>
 						<u-radio labelSize='30' label="固定设置" :name='1'></u-radio>
 						<u-radio labelSize='30' label="按天设置" :name='2' v-if="tabIndex==0"></u-radio>
 					</u-radio-group>
@@ -234,31 +235,11 @@
 			},
 			showTimeOne() {
 				this.showOne = true
-
-				// if (this.typeIndex == 1) {
 				this.mode = 'single'
-				// this.valueTimeOne = ''
-				// this.valueTimeTwo = ''
-				// this.fromData.price = ''
-				// } else if (this.typeIndex == 2) {
-				// 	this.mode = 'single'
-				// 	this.valueTimeOne = ''
-				// 	this.valueTimeTwo = ''
-				// }
 			},
 			showTimeTwo() {
 				this.showTwo = true
-
-				// if (this.typeIndex == 1) {
 				this.mode = 'single'
-				// this.valueTimeOne = ''
-				// this.valueTimeTwo = ''
-				// this.fromData.price = ''
-				// } else if (this.typeIndex == 2) {
-				// 	this.mode = 'range'
-				// 	this.valueTimeOne = ''
-				// 	this.valueTimeTwo = ''
-				// }
 			},
 			addTime() {
 				this.fromData.homestayId = uni.getStorageSync('homestayId')
@@ -316,46 +297,51 @@
 
 			// 下架
 			piliangxiajia() {
-				let obj = {
-					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('下架成功')
-						setTimeout(() => {
-							this.showPricing = false
-							this.getHomestayId()
-							this.Selected = false
-							this.selectedTags = []
-							this.fromData.houseBaseIdList = []
-						}, 1000)
-					} else this.$showToast(res.data.msg)
-
-				})
+				if (this.fromData.houseBaseIdList.length != 0) {
+					let obj = {
+						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('下架成功')
+							setTimeout(() => {
+								this.showPricing = false
+								this.getHomestayId()
+								this.Selected = false
+								this.selectedTags = []
+								this.fromData.houseBaseIdList = []
+							}, 1000)
+						} else this.$showToast(res.data.msg)
+
+					})
+				} else this.$showToast('请选择房型')
 			},
 
 			// 上架
 			piliangshangjia() {
+				if (this.fromData.houseBaseIdList.length != 0) {
+					let obj = {
+						isPutaway: 1,
+						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(() => {
+								this.showPricing = false
+								this.getHomestayId()
+								this.Selected = false
+								this.selectedTags = []
+								this.fromData.houseBaseIdList = []
+							}, 1000)
+						} else this.$showToast(res.data.msg)
+					})
+				} else this.$showToast('请选择房型')
+
 
-				let obj = {
-					isPutaway: 1,
-					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(() => {
-							this.showPricing = false
-							this.getHomestayId()
-							this.Selected = false
-							this.selectedTags = []
-							this.fromData.houseBaseIdList = []
-						}, 1000)
-					} else this.$showToast(res.data.msg)
-				})
 
 			},
 
@@ -387,7 +373,9 @@
 			open() {},
 			Pricing() {
 				console.log('11111111');
-				this.showPricing = true
+				if (this.fromData.houseBaseIdList.length != 0) {
+					this.showPricing = true
+				} else this.$showToast('请选择房型')
 			},
 			// 批量显示
 			showList() {