Przeglądaj źródła

对接团餐活动接口;

郭鹏飞 10 miesięcy temu
rodzic
commit
8a2c148380

+ 0 - 15
common/util/throttle.js

@@ -1,15 +0,0 @@
-export const throttle = {
-    inserted(el, binding) {
-        let timer = null;
-        const delay = binding.arg || 500; // 默认 500ms
-
-        el.addEventListener('click', () => {
-            if (timer) return;
-
-            timer = setTimeout(() => {
-                binding.value(); // 执行绑定的函数
-                timer = null;
-            }, delay);
-        });
-    }
-};

+ 134 - 96
components/index_nav.vue

@@ -10,113 +10,151 @@
 			<image :src="item.url" mode="aspectFill"></image>
 			{{item.name}}
 		</view>
+		<!-- 弹窗 -->
+		<Modal ref="myModal"
+			:title="modalText.title" 
+			:content="modalText.content" 
+			:showCancelButton="false"
+		/>
 	</view>
 </template>
 
 <script>
-	export default {
-		name: 'indexNav',
-		data() {
-			return {
-				dotStyle: true,
-				swiperList: [{
-						name: '店铺设置',
-						url: '/static/index/shop.png',
-						path: '/pages/store/settings'
-					},
-					{
-						name: '团餐活动',
-						url: '/static/index/groupMeal.png',
-						path: '/pages/groupMeal/goods/list'
-					},
-					{
-						name: '优惠券',
-						url: '/static/index/coupon.png',
-						path: '/pages/coupon/coupon'
-					},
-					{
-						name: '退款管理',
-						url: '/static/index/refund.png'
-					},
-					{
-						name: '订单管理',
-						url: '/static/index/indent.png'
-					},
-					// {
-					// 	name: '审核查询',
-					// 	url: '/static/index/audit.png',
-					// 	path: '/pages/store/examine'
-					// },
-					{
-						name: '商品管理',
-						url: '/static/index/product.png',
-						path: '/pages/product/index'
-					},
-					{
-						name: '提现管理',
-						url: '/static/index/withdraw.png'
-					},
-					{
-						name: '秒杀活动',
-						url: '/static/index/seckill.png'
-					},
-					{
-						name: '客户评价',
-						url: '/static/index/evaluate.png',
-						path: '/pages/evaluate/evaluate'
-					},
-					{
-						name: '全部服务',
-						url: '/static/index/all.png',
-						path: '/pages/index/full'
-					},
-				]
-			}
-		},
-		methods: {
-			jump(item) {
-				if (!item.path) return;
-				uni.navigateTo({
-					url: item.path
-				})
+import Modal from '@/components/modal/index.vue';
+export default {
+	name: 'indexNav',
+	components: {
+		Modal,
+	},
+	data() {
+		return {
+			dotStyle: true,
+			swiperList: [{
+					name: '店铺设置',
+					url: '/static/index/shop.png',
+					path: '/pages/store/settings'
+				},
+				{
+					name: '团餐活动',
+					url: '/static/index/groupMeal.png',
+					path: '/pages/groupMeal/goods/list'
+				},
+				{
+					name: '优惠券',
+					url: '/static/index/coupon.png',
+					path: '/pages/coupon/coupon'
+				},
+				{
+					name: '退款管理',
+					url: '/static/index/refund.png'
+				},
+				{
+					name: '订单管理',
+					url: '/static/index/indent.png'
+				},
+				// {
+				// 	name: '审核查询',
+				// 	url: '/static/index/audit.png',
+				// 	path: '/pages/store/examine'
+				// },
+				{
+					name: '商品管理',
+					url: '/static/index/product.png',
+					path: '/pages/product/index'
+				},
+				{
+					name: '提现管理',
+					url: '/static/index/withdraw.png'
+				},
+				{
+					name: '秒杀活动',
+					url: '/static/index/seckill.png'
+				},
+				{
+					name: '客户评价',
+					url: '/static/index/evaluate.png',
+					path: '/pages/evaluate/evaluate'
+				},
+				{
+					name: '全部服务',
+					url: '/static/index/all.png',
+					path: '/pages/index/full'
+				},
+			],
+			// 弹窗
+			modalText: {
+				title: '提示',
+				btntext: '好的',
+				// 很抱歉,您没有通过平台审核,如有疑问请联系平台客服。
+				content: '报名成功,请等待平台审核'
+			},
+		}
+	},
+	methods: {
+		jump(item) {
+			// 需要先报名
+			if (item.name === '团餐活动') {
+				this.$http.post('/groupmeal/gmMerchantApplicationRecord/isApply', {}).then(res => {
+					if (!res.data.result) {
+						uni.navigateTo({
+							url: '/pages/groupMeal/goods/index'
+						});
+					} else {
+						let status = res.data.result.status;
+						if (status == 1) {
+							uni.navigateTo({
+								url: item.path
+							});
+						} else {
+							this.modalText.content = status == 2 ? '很抱歉,您没有通过平台审核,如有疑问请联系平台客服。' : '团餐活动报名审核中,请耐心等待';
+							this.$refs.myModal.onOpen();
+						}
+					}
+				});
+				return;
 			}
+			if (!item.path) return;
+			uni.navigateTo({
+				url: item.path
+			});
 		}
 	}
+}
 </script>
 
 <style scoped lang="scss">
-	.item {
-		width: 100%;
-		display: flex;
-		flex-wrap: wrap;
-		justify-content: space-between;
-		
-	}
+.item {
+	width: 100%;
+	display: flex;
+	flex-wrap: wrap;
+	justify-content: space-between;
+	
+}
 
-	.card {
-		width: 20%;
-		height: 96rpx;
-		display: flex;
-		flex-direction: column;
-		flex-wrap: wrap;
-		justify-content: center;
-		align-items: center;
-		font-size: 24rpx;
-		image {
-			width: 56rpx;
-			height: 56rpx;
-			margin-bottom: 4rpx;
-		}
-	}
-	.card:nth-child(-n+5){
-		margin-bottom: 40rpx;
+.card {
+	width: 20%;
+	height: 96rpx;
+	display: flex;
+	flex-direction: column;
+	flex-wrap: wrap;
+	justify-content: center;
+	align-items: center;
+	font-size: 24rpx;
+	image {
+		width: 56rpx;
+		height: 56rpx;
+		margin-bottom: 4rpx;
 	}
+}
+.card:nth-child(-n+5){
+	margin-bottom: 40rpx;
+}
 
-	::v-deep .uni-swiper-wrapper {
-		-webkit-transform: translate3d(0px, 0, 0);
-		-moz-transform: translate3d(0px, 0, 0);
-		-o-transform: translate(0px, 0px);
-		-ms-transform: translate3d(0px, 0, 0);
-		transform: translate3d(0px, 0, 0);
-	}
+::v-deep .uni-swiper-wrapper {
+	-webkit-transform: translate3d(0px, 0, 0);
+	-moz-transform: translate3d(0px, 0, 0);
+	-o-transform: translate(0px, 0px);
+	-ms-transform: translate3d(0px, 0, 0);
+	transform: translate3d(0px, 0, 0);
+}
 </style>

+ 0 - 3
main.js

@@ -8,9 +8,6 @@ import configService from './common/service/config.service.js'
 // router实际被RouterMount文件使用
 import router from './common/router'
 import { RouterMount } from './plugin/uni-simple-router/index.js'
-// 节流组件
-import { throttle } from './common/util/throttle.js'
-Vue.directive('throttle', throttle);
 // 引入mescroll插件
 import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue"
 import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue"

+ 7 - 1
pages/groupMeal/goods/form-step2.vue

@@ -246,7 +246,13 @@ export default {
 		submit() {
 			this.$refs.formRef.validate().then(res => {
 				const activeCategories = this.form.dishCategories.filter(c => c.items.some(this.isDishEdited));
-				console.log('表单校验成功, 提交的数据:', activeCategories);
+				let params = {
+					gmMerchantPackageDetails: [...activeCategories]
+				};
+				console.log('表单校验成功, 提交的数据:', activeCategories, params);
+				this.$http.post('/groupmeal/gmMerchantPackage/submit', params).then(res => {
+					if (res.data.code === 200) {}
+				});
 			}).catch(errors => {
 				console.log('校验失败', errors);
 			});

+ 39 - 3
pages/groupMeal/goods/index.vue

@@ -16,16 +16,34 @@
 				@click="onSubmit"
 			>立即报名</u-button>
 		</view>
+		<!-- 弹窗 -->
+		<Modal ref="myModal"
+			:title="modalText.title" 
+			:content="modalText.content" 
+			:showCancelButton="false"
+			@confirm="onConfirm"
+		/>
 	</view>
 </template>
 
 <script>
+import Modal from '@/components/modal/index.vue';
 export default {
+	components: {
+		Modal,
+	},
 	data() {
 		return {
 			query: {
 				activityId: ''
 			},
+			status: 0,
+			// 弹窗
+			modalText: {
+				title: '提示',
+				btntext: '好的',
+				content: '报名成功,请等待平台审核'
+			},
 		};
 	},
 	onLoad(query) {
@@ -39,11 +57,29 @@ export default {
 	methods: {
 		// 按钮点击事件
 		onSubmit() {
-			let url = `/pages/groupMeal/goods/list`;
-			uni.navigateTo({
-				url
+			this.$http.post('/groupmeal/gmMerchantApplicationRecord/apply', {}).then(res => {
+				if (res.data.code === 200) {
+					let status = this.status = res.data.result.status, content = '';
+					if (status == 0) {
+						content = '报名成功,请等待平台审核';
+					} else if (status == 1) {
+						content = '审核通过,快去上传套餐商品开展活动吧';
+					} else if (status == 2) {
+						content = '很抱歉,您没有通过平台审核,如有疑问请联系平台客服。';
+					}
+					this.modalText.content = content;
+					this.$refs.myModal.onOpen();
+				}
 			});
 		},
+		// 弹窗确认事件
+		onConfirm() {
+			if (this.status == 1) {
+				uni.navigateTo({
+					url: `/pages/groupMeal/goods/list`
+				});
+			}
+		}
 	}
 };
 </script>

+ 43 - 10
pages/groupMeal/goods/list.vue

@@ -149,9 +149,8 @@ export default {
 			isScrolling: false, // 标记是否正在进行点击滚动
 			// 弹窗
 			modalText: {
-				title: '注册成功',
-				btntext: '去下载',
-				// 很抱歉,您没有通过平台审核,如有疑问请联系平台客服。
+				title: '提示',
+				btntext: '确定',
 				// 是否将所选商品上架?
 				// 所选商品有未通过审核商品无法批量操作上架
 				// 是否将所选商品删除?删除后需重新添加品牌标配
@@ -183,20 +182,39 @@ export default {
 			return grouped;
 		}
 	},
-	mounted() {
+	onLoad() {
+		// 获取商品数据
+		this.getData();
+		// 获取餐品分类
+		this.getClassData();
 		// this.$refs.myModal.onOpen();
 	},
 	methods: {
-		addGoods() {
-			uni.navigateTo({
-				url: '/pages/groupMeal/goods/form-step1'
+		// 商品数据
+		getData() {
+			let params = {
+				status: 0,
+				reviewStatus: 1,
+				pageNo: 1,
+				pageSize: 10
+			};
+			this.$http.post('/groupmeal/gmMerchantPackage/pageList', params).then(res => {
+				if (res.data.code === 200) {}
 			});
 		},
+		// 餐品分类
+		getClassData() {
+			this.$http.get('/groupmeal/gmMerchantPackage/getGroupMealCategory', {}).then(res => {
+				if (res.data.code === 200) {}
+			});
+		},
+		// 操作模式
 		toggleManageMode() {
 			this.isManaging = !this.isManaging;
 			this.selectedGoods = []; // 切换模式时清空选择
 			this.isAllSelected = false;
 		},
+		// 主分类事件
 		onTabChange(e) {
 			this.currentStatusTab = e;
 			this.selectedGoods = []; // 切换Tab时清空选择
@@ -208,16 +226,20 @@ export default {
 			// 	this.scrollIntoViewId = this.filteredGoods[0]?.scrollId || '';
 			// });
 		},
-		onCategoryTabChange(index) {
-			this.currentCategoryTab = index;
-			// 这里可以添加滚动到对应锚点的逻辑
+		// 添加商品
+		addGoods() {
+			uni.navigateTo({
+				url: '/pages/groupMeal/goods/form-step1'
+			});
 		},
+		// 编辑商品
 		editGoods(goods) {
 			console.log('编辑商品:', goods);
 			uni.navigateTo({
 				url: '/pages/groupMeal/goods/form-step1?id=' + goods.id
 			});
 		},
+		// 全选事件
 		selectAll(e) {
 			if (e.value) {
 				// 全选
@@ -230,11 +252,22 @@ export default {
 				item.checked = e.value;
 			}));
 		},
+		// 操作提交事件
 		handleBatchAction(action) {
 			if (this.selectedGoods.length === 0) {
 				uni.showToast({ title: '请先选择商品', icon: 'none' });
 				return;
 			}
+			if (action === 'delete') {
+
+			} else {
+				this.$http.post('/groupmeal/gmMerchantPackage/launch', {
+					id: '',
+					status: action === 'publish' ? 1 : 0 
+				}).then(res => {
+					if (res.data.code === 200) {}
+				});
+			}
 			console.log(`执行批量操作: ${action}`, this.selectedGoods);
 			uni.showToast({ title: '操作成功', icon: 'success' });
 		},

+ 191 - 152
pages/index/full.vue

@@ -40,185 +40,224 @@
 				</view>
 			</view>
 		</view>
+
+		<!-- 弹窗 -->
+		<Modal ref="myModal"
+			:title="modalText.title" 
+			:content="modalText.content" 
+			:showCancelButton="false"
+		/>
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				store: [{
-						name: '商品管理',
-						url: '/static/index/product.png',
-						path: '/pages/product/index'
-					},
-					{
-						name: '优惠券',
-						url: '/static/index/coupon.png'
-					},
-					{
-						name: '拼团活动',
-						url: '/static/index/group.png'
-					},
-					{
-						name: '客户评价',
-						url: '/static/index/evaluate.png',
-						path: '/pages/evaluate/evaluate'
-					},
-					{
-						name: '秒杀活动',
-						url: '/static/index/seckill.png'
-					},
-					{
-						name: '店铺设置',
-						url: '/static/index/shop.png'
-					},
-					{
-						name: '团餐活动',
-						url: '/static/index/groupMeal.png',
-						path: '/pages/groupMeal/goods/list'
-					},
-					{
-						name: '财务管理',
-						url: '/static/index/audit.png',
-						path: '/pages/financial/management'
-					},
-				],
-				order: [
-					// {
-					// 	name: '订单管理',
-					// 	url: '/static/index/indent.png'
-					// },
-					{
-						name: '核销记录',
-						url: '/static/index/history.png'
-					},
-					{
-						name: '退款管理',
-						url: '/static/index/refund.png'
-					},
-					{
-						name: '核销',
-						url: '/static/index/coupon.png'
-					},
-				],
-				finance: [{
-						name: '提现管理',
-						url: '/static/index/with.png'
-					},
-					{
-						name: '收款核销',
-						url: '/static/index/collection.png'
-					},
-				]
+import Modal from '@/components/modal/index.vue';
+export default {
+	components: {
+		Modal,
+	},
+	data() {
+		return {
+			store: [{
+					name: '商品管理',
+					url: '/static/index/product.png',
+					path: '/pages/product/index'
+				},
+				{
+					name: '优惠券',
+					url: '/static/index/coupon.png'
+				},
+				{
+					name: '拼团活动',
+					url: '/static/index/group.png'
+				},
+				{
+					name: '客户评价',
+					url: '/static/index/evaluate.png',
+					path: '/pages/evaluate/evaluate'
+				},
+				{
+					name: '秒杀活动',
+					url: '/static/index/seckill.png'
+				},
+				{
+					name: '店铺设置',
+					url: '/static/index/shop.png'
+				},
+				{
+					name: '团餐活动',
+					url: '/static/index/groupMeal.png',
+					path: '/pages/groupMeal/goods/list'
+				},
+				{
+					name: '财务管理',
+					url: '/static/index/audit.png',
+					path: '/pages/financial/management'
+				},
+			],
+			order: [
+				// {
+				// 	name: '订单管理',
+				// 	url: '/static/index/indent.png'
+				// },
+				{
+					name: '核销记录',
+					url: '/static/index/history.png'
+				},
+				{
+					name: '退款管理',
+					url: '/static/index/refund.png'
+				},
+				{
+					name: '核销',
+					url: '/static/index/coupon.png'
+				},
+			],
+			finance: [{
+					name: '提现管理',
+					url: '/static/index/with.png'
+				},
+				{
+					name: '收款核销',
+					url: '/static/index/collection.png'
+				},
+			],
+			// 弹窗
+			modalText: {
+				title: '提示',
+				btntext: '好的',
+				// 很抱歉,您没有通过平台审核,如有疑问请联系平台客服。
+				content: '报名成功,请等待平台审核'
+			},
+		}
+	},
+	methods: {
+		storeFunc(item) {
+			// 需要先报名
+			if (item.name === '团餐活动') {
+				this.$http.post('/groupmeal/gmMerchantApplicationRecord/isApply', {}).then(res => {
+					if (!res.data.result) {
+						uni.navigateTo({
+							url: '/pages/groupMeal/goods/index'
+						});
+					} else {
+						let status = res.data.result.status;
+						if (status == 1) {
+							uni.navigateTo({
+								url: item.path
+							});
+						} else {
+							this.modalText.content = status == 2 ? '很抱歉,您没有通过平台审核,如有疑问请联系平台客服。' : '团餐活动报名审核中,请耐心等待';
+							this.$refs.myModal.onOpen();
+						}
+					}
+				});
+				return;
 			}
+			if (!item.path) return;
+			uni.navigateTo({
+				url: item.path
+			});
 		},
-		methods: {
-			storeFunc(item) {
-				if (!item.path) return;
+		orderFunc(item) {
+			if (item.name == '核销') {
 				uni.navigateTo({
-					url: item.path
+					url:'/pages/scan/manual'
 				})
-			},
-			orderFunc(item) {
-				if (item.name == '核销') {
-					uni.navigateTo({
-						url:'/pages/scan/manual'
-					})
-				}
-			},
-			//返回
-			back() {
-				uni.navigateBack({
-					delta: 1
-				});
-			},
-		}
+			}
+		},
+		//返回
+		back() {
+			uni.navigateBack({
+				delta: 1
+			});
+		},
 	}
+}
 </script>
 
 <style lang="scss" scoped>
-	.service {
+.service {
+	width: 100%;
+	height: 100%;
+	background: #F7F8FC;
+
+	/*#ifdef APP-PLUS*/
+	.top {
 		width: 100%;
-		height: 100%;
-		background: #F7F8FC;
+		height: var(--status-bar-height);
+		background: linear-gradient(180deg, #D6E9FF 0%, #FFFFFF 100%);
+	}
 
-		/*#ifdef APP-PLUS*/
-		.top {
-			width: 100%;
-			height: var(--status-bar-height);
-			background: linear-gradient(180deg, #D6E9FF 0%, #FFFFFF 100%);
+	/*#endif*/
+	.head {
+		width: 100%;
+		height: 112rpx;
+		padding: 20rpx;
+		display: flex;
+		align-items: center;
+		background: linear-gradient(180deg, #D6E9FF 0%, #FFFFFF 100%);
+		position: relative;
+
+		.cuIcon-back {
+			font-size: 40rpx;
+			margin-right: 40rpx;
 		}
 
-		/*#endif*/
-		.head {
-			width: 100%;
-			height: 112rpx;
-			padding: 20rpx;
-			display: flex;
-			align-items: center;
-			background: linear-gradient(180deg, #D6E9FF 0%, #FFFFFF 100%);
-			position: relative;
+		.case {
+			position: absolute;
+			left: 50%;
+			transform: translateX(-50%);
+			font-size: 36rpx;
+			font-weight: 500;
+		}
+	}
 
-			.cuIcon-back {
-				font-size: 40rpx;
-				margin-right: 40rpx;
-			}
+	.function {
+		background-color: #fff;
+		padding-top: 12rpx;
+		margin-bottom: 20rpx;
 
-			.case {
-				position: absolute;
-				left: 50%;
-				transform: translateX(-50%);
-				font-size: 36rpx;
-				font-weight: 500;
-			}
+		.title {
+			padding: 0px 40rpx;
+			width: 100%;
+			height: 53rpx;
+			border-bottom: 1px solid #eee;
+			font-size: 28rpx;
+			font-weight: 600;
 		}
 
-		.function {
-			background-color: #fff;
-			padding-top: 12rpx;
-			margin-bottom: 20rpx;
-
-			.title {
-				padding: 0px 40rpx;
-				width: 100%;
-				height: 53rpx;
-				border-bottom: 1px solid #eee;
-				font-size: 28rpx;
-				font-weight: 600;
-			}
+		.fun_box {
+			display: flex;
+			// justify-content: space-between;
+			flex-wrap: wrap;
+			// gap: 40rpx; 
+			padding: 36rpx 40rpx;
 
-			.fun_box {
+			.item {
+				width: 20%;
 				display: flex;
-				// justify-content: space-between;
-				flex-wrap: wrap;
-				// gap: 40rpx; 
-				padding: 36rpx 40rpx;
+				align-items: center;
+				flex-direction: column;
+				// margin-bottom: 20rpx;
+				// margin-right: 40rpx;
+				font-size: 24rpx;
 
-				.item {
-					width: 20%;
-					display: flex;
-					align-items: center;
-					flex-direction: column;
-					// margin-bottom: 20rpx;
-					// margin-right: 40rpx;
-					font-size: 24rpx;
-
-					image {
-						width: 56rpx;
-						height: 56rpx;
-						margin-bottom: 10rpx;
-					}
+				image {
+					width: 56rpx;
+					height: 56rpx;
+					margin-bottom: 10rpx;
 				}
+			}
 
-				.nomargin {
-					margin-bottom: 0px;
-				}
+			.nomargin {
+				margin-bottom: 0px;
+			}
 
-				.item:nth-child(-n+5) {
-					margin-bottom: 36rpx;
-				}
+			.item:nth-child(-n+5) {
+				margin-bottom: 36rpx;
 			}
 		}
 	}
+}
 </style>

+ 1 - 1
plugin/uni-simple-router/vueRouter/init.js

@@ -39,7 +39,7 @@ const rewriteUniFun = function (Router) {
     };
     uni.navigateBack = function (delta) {
         let backLayer = delta;
-        if (delta.constructor === Object) { // 这种可能就只是uni-app自带的返回按钮,还有种可能就是开发者另类传递的
+        if (delta && delta.constructor === Object) { // 这种可能就只是uni-app自带的返回按钮,还有种可能就是开发者另类传递的
             backLayer = 1;
         }
         Router.back(backLayer, delta);