2 Commits 8632d8e575 ... ef5e912850

Auteur SHA1 Bericht Datum
  liwei2496 ef5e912850 Merge branch 'master' of http://git.ringzle.com:3000/htcwl/hotelHomestayWx 8 maanden geleden
  liwei2496 e62ab73e5a 1 8 maanden geleden
2 gewijzigde bestanden met toevoegingen van 301 en 107 verwijderingen
  1. 0 12
      http/baseApi.js
  2. 301 95
      pagesHouse/HotelMerchandise/index.vue

+ 0 - 12
http/baseApi.js

@@ -1,12 +0,0 @@
-// const BaseApi = 'http://192.168.2.190:8080' //汪瑶
-// const BaseApi = 'http://192.168.2.205:8080' //汪辉
-// const BaseApi = 'http://192.168.2.19:8080' //李勇
-// const BaseApi = 'http://192.168.3.13:8080' //徐涛
-// const BaseApi = 'http://192.168.2.39:8080' //肖添伟
-// const BaseApi = 'http://192.168.3.6:8080' //朱壮波
-
-const BaseApi = 'https://i.ringzle.com/island-cloud-server' //测试服务器 
-
-export {
-	BaseApi
-}

+ 301 - 95
pagesHouse/HotelMerchandise/index.vue

@@ -71,12 +71,12 @@
 					</view>
 					<view class="right-right">
 						<view class="top">
-							<text style="font-size: 30rpx; color: #333;">{{item.name}}</text>
+							<text style="font-size: 30rpx; color: #333;">{{item.name||item.goodsName}}</text>
 						</view>
 						<view class="under">
-							<view style="font-size: 24rpx; color: #777;">销量:{{item.salesVolume}}</view>
+							<view style="font-size: 24rpx; color: #777;">销量:{{item.salesVolume||item.soldNum}}</view>
 							<view style="font-size: 36rpx; color: #FF4141; font-weight: Bold; margin-top: 16rpx;">
-								¥{{item.discountPrice}}</view>
+								¥{{item.discountPrice||item.normalPrice}}</view>
 						</view>
 					</view>
 				</view>
@@ -91,9 +91,13 @@
 						<view class="" @click="gaijia(item,index)">
 							改价格
 						</view>
-						<view class="" @click="xiajia(item,index)">
+						<view v-if="canyinmeishi" class="" @click="xiajia(item,index)">
 							{{fromData.status==0?'下架':'上架'}}
 						</view>
+
+						<view v-if="!canyinmeishi" class="" @click="xiajia1(item,index)">
+							{{fromData.status==0?'上架':'下架'}}
+						</view>
 					</view>
 				</view>
 
@@ -114,9 +118,12 @@
 					</view>
 				</view>
 				<view class="right">
-					<view class="right-btn" @click="piliangxiajia">
+					<view v-if="canyinmeishi" class="right-btn" @click="piliangxiajia">
 						{{fromData.status==0?'批量下架':'批量上架'}}
 					</view>
+					<view v-if="!canyinmeishi" class="right-btn" @click="piliangxiajia">
+						{{fromData.status==0?'批量上架':'批量下架'}}
+					</view>
 					<view class="right-btn" @click="piliangshanchu">
 						批量删除
 					</view>
@@ -153,6 +160,13 @@
 		<u-modal :show="xiajiashow" :title="fromData.status==0?'下架选中的商品':'上架选中的商品'"
 			:content="fromData.status==0?'下架后商品不可在前台继续售卖,是否继续?':'上架后商品可在前台售卖,是否继续?'" showConfirmButton='true'
 			showCancelButton='true' @confirm='quedingxiajia' @cancel='quxiaoxiajia'></u-modal>
+
+<!-- 下架弹出框渔家乐 -->
+		<u-modal :show="xiajiashow1" :title="fromData.status==1?'下架选中的商品':'上架选中的商品'"
+			:content="fromData.status==1?'下架后商品不可在前台继续售卖,是否继续?':'上架后商品可在前台售卖,是否继续?'" showConfirmButton='true'
+			showCancelButton='true' @confirm='quedingxiajia' @cancel='quxiaoxiajia'></u-modal>
+
+
 		<!-- 删除弹出框 -->
 		<u-modal :show="shanchushow" title="删除选中的商品" content='删除后的商品不可在前台继续售卖,是否继续?' showConfirmButton='true'
 			showCancelButton='true' @confirm='quedingshanchu' @cancel='quxiaoshanchu'></u-modal>
@@ -185,23 +199,13 @@
 				newprice: '',
 				lsdata: {},
 				current: 0,
+				canyinmeishi: false,
 				xiajiashow: false,
+					xiajiashow1: false,
 				shanchushow: false,
-				tabList: [{
-						name: '出售中',
-						id: 0
-					},
-					{
-						name: '待上架',
-						id: 1
-					},
-				],
+				tabList: [],
 				homestayId: uni.getStorageSync('homestayId') || 0,
-				roomType: [{
-					image: 'https://i.ringzle.com/file/20240316/03eec514efd64b528c183804124961e0.png',
-					name: '4人套餐',
-					price: '126'
-				}],
+				roomType: [],
 				selectedTags: [],
 				mytotal: 0,
 				isSelect: false,
@@ -236,14 +240,45 @@
 			}
 		},
 		onLoad(option) {
-			this.getRepast(); //获取商品列表
 
 
+			console.log('111111111111111111', uni.getStorageSync('merchantType'))
 			//this.getHousekeeping();
-			// if (uni.getStorageSync('merchantType') == 4) {
-			//this.getRepast()
-			// } else {
-			// }
+			if (uni.getStorageSync('merchantType') == 4) {
+				this.canyinmeishi = true;
+				this.tabList = [{
+						name: '出售中',
+						id: 0
+					},
+					{
+						name: '待上架',
+						id: 1
+					},
+				]
+				this.getRepast(); //获取商品列表(餐饮美食)
+
+			} else {
+				this.canyinmeishi = false;
+				this.tabList = [{
+						name: '出售中',
+						id: 1
+					},
+					{
+						name: '待上架',
+						id: 0
+					},
+				]
+				this.fromData = {
+					merchantId: uni.getStorageSync('merchantId'), //商户id
+					limit: 99999,
+					page: 1,
+					sortType: '', //选择条件:1创建时间 2销量从高到低 3价格从高到低 4价格从低到高
+					status: 1, //状态:0上架1下架
+				}
+
+				this.yujialedata(); //获取商品列表(渔家乐)
+			}
+
 		},
 		methods: {
 			getHousekeeping() {
@@ -260,38 +295,106 @@
 					// })					
 				})
 			},
+
 			piliangxiajia() {
-				if (this.selectedTags.length == 0) {
-					this.$refs.uToast.show({
-						type: 'success',
-						title: '',
-						message: "请选择数据",
-						iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
-					})
+				if (uni.getStorageSync('merchantType') == 4) {
+					if (this.selectedTags.length == 0) {
+						this.$refs.uToast.show({
+							type: 'success',
+							title: '',
+							message: "请选择数据",
+							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+						})
+
+					} else {
+						let namesArray = this.selectedTags.map(obj => obj.id);
+						let postdata = {
+							discountPrice: 0,
+							id: namesArray,
+							status: this.fromData.status == 1 ? 0 : 1,
+						};
+						this.$api.post('/scenic/goods/batchUpDownFrame', postdata).then(res => {
+							this.$refs.uToast.show({
+								type: 'success',
+								title: '',
+								message: "成功",
+								iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+							})
+							this.selectedTags = [];
+							this.Selected = false;
+							this.getRepast(); //获取商品列表
+						})
+					}
 
 				} else {
-					let namesArray = this.selectedTags.map(obj => obj.id);
-					let postdata = {
-						discountPrice: 0,
-						ids: namesArray,
-						status: this.fromData.status,
-					};
-					this.$api.post('/api/merchant/food/updateStatus', postdata).then(res => {
+					if (this.selectedTags.length == 0) {
 						this.$refs.uToast.show({
 							type: 'success',
 							title: '',
-							message: "成功",
+							message: "请选择数据",
 							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
 						})
-						this.selectedTags=[];
-						this.Selected=false;
-						this.getRepast(); //获取商品列表
-					})
+
+					} else {
+
+
+						let postdata = this.selectedTags.map((item, index, arr) => {
+							let json = {};
+							json.id = item.id;
+							json.merchantId = uni.getStorageSync('merchantId');
+							json.status = item.status == 0 ? 1 : 0;
+							return json
+						})
+						// let namesArray = this.selectedTags.map(obj => obj.id);
+						// let postdata = {
+						// 	id: namesArray,
+						// 	status: this.fromData.status,
+						// };
+						this.$api.post('/scenic/goods/batchUpDownFrame', postdata).then(res => {
+							this.$refs.uToast.show({
+								type: 'success',
+								title: '',
+								message: "成功",
+								iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+							})
+							this.selectedTags = [];
+							this.Selected = false;
+							this.yujialedata(); //获取商品列表(渔家乐)
+						})
+					}
 				}
 			},
 
 			piliangshanchu() {
-				if (this.selectedTags.length == 0) {
+				if (uni.getStorageSync('merchantType') == 4) {
+
+					if (this.selectedTags.length == 0) {
+						this.$refs.uToast.show({
+							type: 'success',
+							title: '',
+							message: "请选择数据",
+							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+						})
+
+					} else {
+						let namesArray = this.selectedTags.map(obj => obj.id);
+
+						//status: this.fromData.status,
+						this.$api.del('/api/merchant/food/delProduct', namesArray).then(res => {
+							this.$refs.uToast.show({
+								type: 'success',
+								title: '',
+								message: "成功",
+								iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+							})
+							this.selectedTags = [];
+							this.Selected = false;
+							this.getRepast(); //获取商品列表
+						})
+					}
+
+				} else {
+if (this.selectedTags.length == 0) {
 					this.$refs.uToast.show({
 						type: 'success',
 						title: '',
@@ -301,20 +404,20 @@
 
 				} else {
 					let namesArray = this.selectedTags.map(obj => obj.id);
-					
-						//status: this.fromData.status,
-					this.$api.del('/api/merchant/food/delProduct', namesArray).then(res => {
+
+					//status: this.fromData.status,
+					this.$api.del('/scenic/goods', namesArray).then(res => {
 						this.$refs.uToast.show({
 							type: 'success',
 							title: '',
 							message: "成功",
 							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
 						})
-						this.selectedTags=[];
-						this.Selected=false;
-						this.getRepast(); //获取商品列表
-					})  
-					
+						this.selectedTags = [];
+						this.Selected = false;
+						this.yujialedata(); //获取商品列表(渔家乐)
+					})
+				}	
 				}
 			},
 			shanchu(e, i) {
@@ -323,19 +426,39 @@
 				this.shanchushow = true;
 			},
 			quedingshanchu() {
-				let postdata = [this.lsdata.id];
+				if (uni.getStorageSync('merchantType') == 4) {
+					//(餐饮美食)
+					let postdata = [this.lsdata.id];
 					//status: this.fromData.status,
-				console.log('postdata', postdata)
-				this.$api.del('/api/merchant/food/delProduct', postdata).then(res => {
-					this.$refs.uToast.show({
-						type: 'success',
-						title: '',
-						message: "成功",
-						iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+					console.log('postdata', postdata)
+					this.$api.del('/api/merchant/food/delProduct', postdata).then(res => {
+						this.$refs.uToast.show({
+							type: 'success',
+							title: '',
+							message: "成功",
+							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+						})
+						this.quxiaoshanchu();
+						this.getRepast(); //获取商品列表
+					})
+
+				} else {
+					//(渔家乐)
+					let postdata = [this.lsdata.id];
+					//status: this.fromData.status,
+					console.log('postdata', postdata)
+					this.$api.del('/scenic/goods', postdata).then(res => {
+						this.$refs.uToast.show({
+							type: 'success',
+							title: '',
+							message: "成功",
+							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+						})
+						this.quxiaoshanchu();
+						this.yujialedata(); //获取商品列表(渔家乐)
 					})
-					this.quxiaoshanchu();
-					this.getRepast(); //获取商品列表
-				})  
+
+				}
 			},
 			quxiaoshanchu() {
 				// console.log('quxiaoxiajia',this.lsdata)
@@ -355,53 +478,120 @@
 				this.lsdata = {};
 			},
 			quedingjiae() {
-				console.log('111111111111111111', this.newprice)
-				let postdata = {
-					discountPrice: this.newprice,
-					ids: [this.lsdata.id],
-					status: this.fromData.status,
-				};
-				console.log('postdata', postdata)
-				this.$api.post('/api/merchant/food/updateDiscountPrice', postdata).then(res => {
-					this.$refs.uToast.show({
-						type: 'success',
-						title: '',
-						message: "成功",
-						iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+				if (uni.getStorageSync('merchantType') == 4) {
+					//获取商品列表(餐饮美食)
+					//console.log('111111111111111111', this.newprice)
+					let postdata = {
+						discountPrice: this.newprice,
+						ids: [this.lsdata.id],
+						status: this.fromData.status,
+					};
+					//console.log('postdata', postdata)
+					this.$api.post('/api/merchant/food/updateDiscountPrice', postdata).then(res => {
+						this.$refs.uToast.show({
+							type: 'success',
+							title: '',
+							message: "成功",
+							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+						})
+						this.closegaijia();
+						this.getRepast(); //获取商品列表
 					})
-					this.closegaijia();
-					this.getRepast(); //获取商品列表
-				})
+
+				} else {
+					//获取商品列表(渔家乐)
+					if (this.lsdata.goodsType == 1) {
+						let postdata = {
+							discountPrice: this.newprice,
+							id: this.lsdata.id,
+							status: this.fromData.status,
+						};
+						console.log('postdata', postdata)
+						this.$api.put('/scenic/goods', postdata).then(res => {
+							this.$refs.uToast.show({
+								type: 'success',
+								title: '',
+								message: "成功",
+								iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+							})
+							this.closegaijia();
+							this.yujialedata(); //获取商品列表(渔家乐)
+						})
+					} else {
+						let postdata = {
+							normalPrice: this.newprice,
+							id: this.lsdata.id,
+							status: this.fromData.status,
+						};
+						console.log('postdata', postdata)
+						this.$api.put('/scenic/goods', postdata).then(res => {
+							this.$refs.uToast.show({
+								type: 'success',
+								title: '',
+								message: "成功",
+								iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+							})
+							this.closegaijia();
+							this.yujialedata(); //获取商品列表(渔家乐)
+						})
+					}
+
+				}
 			},
 			opengaijia() {},
 
+
+xiajia1(e, i) {
+				console.log('111111111111111111', e, i)
+				this.lsdata = e;
+				this.xiajiashow1 = true;
+			},
 			xiajia(e, i) {
 				console.log('111111111111111111', e, i)
 				this.lsdata = e;
 				this.xiajiashow = true;
 			},
 			quedingxiajia() {
-				let postdata = {
-					discountPrice: this.lsdata.discountPrice,
-					ids: [this.lsdata.id],
-					status: this.fromData.status,
-				};
-				this.$api.post('/api/merchant/food/updateStatus', postdata).then(res => {
-					this.$refs.uToast.show({
-						type: 'success',
-						title: '',
-						message: "下架成功",
-						iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+				if (uni.getStorageSync('merchantType') == 4) {
+					//获取商品列表(餐饮美食)
+					let postdata = {
+						discountPrice: this.lsdata.discountPrice,
+						ids: [this.lsdata.id],
+						status: this.fromData.status,
+					};
+					this.$api.post('/api/merchant/food/updateStatus', postdata).then(res => {
+						this.$refs.uToast.show({
+							type: 'success',
+							title: '',
+							message: "下架成功",
+							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+						})
+						this.quxiaoxiajia();
+						this.getRepast(); //获取商品列表
 					})
-					this.quxiaoxiajia();
-					this.getRepast(); //获取商品列表
-				})
-
+				} else {
+					//获取商品列表(渔家乐)
+					let postdata = {
+						id: this.lsdata.id,
+						status: this.fromData.status == 1 ? 0 : 1,
+					};
+					this.$api.put('/scenic/goods', postdata).then(res => {
+						this.$refs.uToast.show({
+							type: 'success',
+							title: '',
+							message: "下架成功",
+							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png'
+						})
+						this.quxiaoxiajia();
+						this.yujialedata();
+					})
+				}
 			},
 			quxiaoxiajia() {
 				// console.log('quxiaoxiajia',this.lsdata)
 				this.lsdata = {};
 				this.xiajiashow = false;
+				this.xiajiashow1 = false;
 			},
 
 			selectPerson(e, i) {
@@ -413,6 +603,13 @@
 				console.log(' this.selectedTags', this.selectedTags)
 
 			},
+			yujialedata() {
+				this.$api.get('/scenic/goods/page', this.fromData).then(res => {
+					console.log(res.data.data.list);
+					this.roomType = res.data.data.list;
+					this.mytotal = res.data.data.total;
+				})
+			},
 
 			getRepast() {
 				this.$api.get('/api/merchant/food/product/page', this.fromData).then(res => {
@@ -436,11 +633,20 @@
 				this.areaShow = !this.areaShow
 			},
 			changeTab1(e, i) {
+				this.roomType = [];
 				this.selectedTags = [];
 				this.current = i;
 				this.fromData.status = e.id;
 				this.fromData.page = 1;
-				this.getRepast();
+
+				if (uni.getStorageSync('merchantType') == 4) {
+
+					this.getRepast(); //获取商品列表(餐饮美食)
+
+				} else {
+
+					this.yujialedata(); //获取商品列表(渔家乐)
+				}
 			},
 			// 批量显示
 			showList() {