lyy@qq.com 1 anno fa
parent
commit
7d34fea381

+ 37 - 28
components/cartPopup.vue

@@ -1,55 +1,64 @@
 <template>
-	<u-popup :show="show" mode="bottom"  @close="close" @open="open" :round="10">
+	<u-popup :show="show" mode="bottom" @close="close" @open="open" :round="10">
 		<view class="my-popup padding">
-			<view class="w-full padding-bottom-lg" v-for="index in 3" :key="index">
-				<my-goods :data="data">
+			<view class="w-full padding-bottom-lg" v-for="(item, index) in carList" :key="index">
+				<my-goods :item="item" ref="my-goods">
 					<view class="num-step">
-						<uni-number-box v-model="value" :min="1" @change="changeValue" />
+						<u-number-box v-model="item.goods_num" :min="1" @change="changeValue($event, item.id)" />
 					</view>
 				</my-goods>
 			</view>
-			
 		</view>
 	</u-popup>
 </template>
 
 <script>
 	export default {
-		name:"cartPopup",
+		name: "cartPopup",
+		props: {
+			carList: {
+				type: Array,
+				required: true
+			}
+		},
 		data() {
 			return {
-				show:false,
-				value:1,
-				data:{
-					src:'../../static/x0.jpg',
-					title:'标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题',
-					spec:'180cm',
-					price:'53.30'
-				}
+				show: false,
+				value: 1,
+				// data: {
+				// 	src: '../../static/x0.jpg',
+				// 	title: '标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题',
+				// 	spec: '180cm',
+				// 	price: '53.30'
+				// }
 			};
 		},
-		methods:{
-			open(){},
-			setShow(v){
+		methods: {
+			open() {},
+			setShow(v) {
 				this.show = v;
 			},
-			close(){
+			close() {
 				this.show = false;
 			},
-			changeValue(){}
+			changeValue(value, index) {
+				this.$emit('numChanged',value.value, index)
+				console.log('更新后的数量=======:', value, '索引=========:', index)
+			}
 		}
 	}
 </script>
 
 <style scoped lang="scss">
-.my-popup{
-	width: 100%;
-	max-height: 800rpx;
-	overflow: auto;
-	padding-bottom: 130rpx;
-	.num-step{
-		width: 200rpx;
-		padding-top: 40rpx;
+	.my-popup {
+		width: 100%;
+		max-height: 800rpx;
+		overflow: auto;
+		padding-bottom: 130rpx;
+
+		.num-step {
+			width: 200rpx;
+			padding-top: 40rpx;
+		}
 	}
-}
 </style>

+ 79 - 55
components/my-goods/my-goods.vue

@@ -1,78 +1,102 @@
 <template>
-	<view class="goods">
-		<view class="goods-img">
-			<image mode="aspectFit" class="wh-full" :src="data.src"></image>
-		</view>
-		<view class="right-info">
-			<view class="good-title">{{data.title}}</view>
-			<view class="w-full flex-a">
-				<view class="g-left">
-					<view class="spec">{{data.spec}}</view>
-					<view class="price">{{data.price}}</view>
-				</view>
-				<view class="g-right">
-					<slot></slot>
+	<view>
+		<view class="goods">
+			<view class="goods-img">
+				<image mode="aspectFit" class="wh-full" :src="item.src"></image>
+			</view>
+			<view class="right-info">
+				<view class="good-title">{{item.goods_name}}</view>
+				<view class="w-full flex-a">
+					<view class="g-left">
+						<view class="spec" @click="popShow">{{item.goods_type}}</view>
+						<view class="price">{{item.goods_price}}</view>
+					</view>
+					<view class="g-right">
+						<slot></slot>
+					</view>
 				</view>
 			</view>
-			
 		</view>
-		
 	</view>
 </template>
 
 <script>
 	export default {
-		name:"my-goods",
+		name: "my-goods",
 		data() {
 			return {
-				
+				show: false
 			};
 		},
-		props:{
-			data:{}
+		props: {
+			item: {
+				type: Object,
+				required: true
+			}
+		},
+		methods: {
+			popShow() {
+				this.show = true;
+			},
+			close() {
+				this.show = false;
+			}
 		}
 	}
 </script>
 
 <style scoped lang="scss">
-.goods{
-	width: 100%;
-	display: flex;
-	align-items: center;
-	.goods-img{
-		height: 200rpx;
-		width: 200rpx;
-		flex-shrink: 0;
-	}
-	.right-info{
-		width: calc(100% - 200rpx);
-		box-sizing: border-box;
-		padding-left: 10rpx;
-		.good-title{
-			width: 100%;
-			text-overflow: ellipsis;
-			white-space: nowrap;
-			font-size: $uni-font-size-base;
-			overflow: hidden;
-			padding-bottom: 10rpx;
-		}
-		.spec{
-			height: 50rpx;
-			display: flex;
-			align-items: center;
+	.goods {
+		width: 100%;
+		display: flex;
+		align-items: center;
+
+		.goods-img {
+			height: 200rpx;
 			width: 200rpx;
-			border-radius: 25px;
-			background-color: #EFEFEF;
-			font-size: $uni-font-size-sm;
-			margin-bottom: 20rpx;
+			flex-shrink: 0;
+		}
+
+		.right-info {
+			width: calc(100% - 200rpx);
 			box-sizing: border-box;
-			padding: 0 20rpx;
+			padding-left: 10rpx;
+
+			.good-title {
+				width: 100%;
+				text-overflow: ellipsis;
+				white-space: nowrap;
+				font-size: $uni-font-size-base;
+				overflow: hidden;
+				padding-bottom: 10rpx;
+			}
+
+			.spec {
+				height: 50rpx;
+				display: flex;
+				align-items: center;
+				width: 200rpx;
+				border-radius: 25px;
+				background-color: #EFEFEF;
+				font-size: $uni-font-size-sm;
+				margin-bottom: 20rpx;
+				box-sizing: border-box;
+				padding: 0 20rpx;
+			}
+
 		}
-		
 	}
-}
-.flex-a{
-	display: flex;
-	justify-content: space-between;
-}
+
+	.flex-a {
+		display: flex;
+		justify-content: space-between;
+	}
+
+
+	.my-popup {
+		width: 100%;
+		max-height: 800rpx;
+		overflow: auto;
+		padding-bottom: 130rpx;
+	}
 </style>

+ 167 - 36
components/specPopup.vue

@@ -1,79 +1,201 @@
 <template>
-	<uni-popup ref="popup" background-color="#fff" @change="change">
+	<uni-popup ref="popup" background-color="#fff" mode="bottom" @change="change">
 		<view class="s-box padding-sm">
-			<view class="s-img"></view>
+			<view class="s-img">
+				<image mode="aspectFit" class="wh-full" :src="cardMsg.src"></image>
+			</view>
 			<view class="g-info">
-				<view class="s-name">商品名称01</view>
-				<view class="s-price">¥12.36</view>
+				<view class="s-name">{{cardMsg.goods_name}}</view>
+				<view class="s-price">{{cardMsg.goods_price}}</view>
 			</view>
 		</view>
 		<uni-section title="规格">
 			<view class="spec-box padding-lr-sm">
-				<view class="spec-item padding-lr-sm" :class="{'on-spec':item % 3 == 0}" v-for="item in 5">规格{{item + 1}}</view>
+				<view class="spec-item padding-lr-sm" :class="{'on-spec': spec.selected}" :key="spec.id" @click="selectSpec1(spec)"
+					v-for="spec in specs1">{{ spec.name }}</view>
+			</view>
+		</uni-section>
+		<uni-section title="口味">
+			<view class="spec-box padding-lr-sm">
+				<view class="spec-item padding-lr-sm" :class="{'on-spec': spec.selected}" :key="spec.id" @click="selectSpec2(spec)"
+					v-for="spec in specs2">{{ spec.name }}</view>
 			</view>
 		</uni-section>
 		<uni-section title="购买数量">
 			<view class="purchase-num padding-lr-sm">
 				<view class="num">剩余562件</view>
-				<uni-number-box v-model="vModelValue" @change="changeValue" />
+				<uni-number-box v-model="vModelValue" @change="changeValue(value)" />
 			</view>
 		</uni-section>
 		<view class="btn-box">
-			<view class="btn reset">重置</view>
-			<view class="btn confirm">确定</view>
+			<view class="btn reset" @click="toShop">加入购物车</view>
+			<view class="btn confirm" @click="toBuy">立即购买</view>
 		</view>
 	</uni-popup>
 </template>
 
 <script>
 	export default {
-		name:"specPopup",
-		data(){
-			return{
-				vModelValue:1
+		name: "specPopup",
+		props: {
+			cardMsg: {
+				type: Object,
+				required: true
 			}
 		},
-		methods:{
-			changeValue(){},
-			change(){},
-			open(){
+		data() {
+			return {
+				vModelValue: 1,
+				shopMsg: {
+					id: '',
+					spec: '',
+					specs: '',
+					num: ''
+				},
+				specs1: [{
+						id: 1,
+						name: '规格1',
+						selected: false
+					},
+					{
+						id: 2,
+						name: '规格2',
+						selected: false
+					},
+					{
+						id: 3,
+						name: '规格3',
+						selected: false
+					},
+					{
+						id: 4,
+						name: '规格4',
+						selected: false
+					},
+					{
+						id: 5,
+						name: '规格5',
+						selected: false
+					}
+				],
+				specs2: [{
+						id: 1,
+						name: '大份1',
+						selected: false
+					},
+					{
+						id: 2,
+						name: '大份2',
+						selected: false
+					},
+					{
+						id: 3,
+						name: '大份3',
+						selected: false
+					},
+					{
+						id: 4,
+						name: '大份4',
+						selected: false
+					},
+					{
+						id: 5,
+						name: '大份5',
+						selected: false
+					}
+				]
+			}
+		},
+		methods: {
+			changeValue(e) {
+				console.log('vModelValue', e)
+
+			},
+			change(e) {
+				if (!e.show) { // 当弹出层关闭时
+					// 重置规格选择
+					this.specs1.forEach(spec => {
+						spec.selected = false;
+					});
+					this.specs2.forEach(spec => {
+						spec.selected = false;
+					});
+
+					// 重置购买数量
+					this.vModelValue = 1;
+				}
+			},
+			selectSpec1(item) {
+				console.log('点击了规格:', item);
+				item.selected = !item.selected;
+				this.shopMsg.spec = item.name
+				// 在这里添加您的点击处理逻辑
+			},
+			selectSpec2(item) {
+				console.log('点击了大份:', item);
+				item.selected = !item.selected;
+				this.shopMsg.specs = item.name
+				// 在这里添加您的点击处理逻辑
+			},
+			open() {
+				console.log('cardMsg', this.cardMsg)
 				this.$refs.popup.open('bottom');
+			},
+			toShop() {
+				this.shopMsg.id = this.cardMsg.id
+				this.shopMsg.num = this.vModelValue
+				console.log('this.shopMsg', this.shopMsg)
+				this.$emit('update-shopmsg', this.shopMsg);
+				// 关闭弹出层
+				this.$refs.popup.close();
+			},
+			toBuy() {
+
 			}
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
-	.btn-box{
+	.btn-box {
 		width: 100%;
 		display: flex;
 		justify-content: space-around;
 		align-items: center;
 		padding-top: 80upx;
-		.btn{
+
+		.btn {
 			width: 45%;
-			height: 60upx;
+			height: 80upx;
 			text-align: center;
-			line-height: 60upx;
-			border-radius: 30upx;
+			line-height: 80upx;
+			border-radius: 40upx;
 		}
-		.reset{
-			border:solid 1px #EEE;
+
+		.reset {
+			border: solid 1px #EEE;
 			box-sizing: border-box;
+			box-sizing: border-box;
+			border: solid 1px #FF0000;
+			font-size: 14px;
+			color: #FF0000;
 		}
-		.confirm{
+
+		.confirm {
 			background-image: $base-bg-gradient-color;
 			color: #FFF;
 		}
 	}
-	.spec-box{
+
+	.spec-box {
 		width: 100%;
 		display: flex;
 		flex-wrap: wrap;
-		.spec-item{
+
+		.spec-item {
 			height: 60upx;
 			line-height: 60upx;
-			border:solid 1px #EEE;
+			border: solid 1px #EEE;
 			box-sizing: border-box;
 			text-align: center;
 			margin-left: 20upx;
@@ -81,43 +203,52 @@
 			margin-bottom: 20upx;
 			font-size: 12px;
 		}
-		.spec-item:first-child{
+
+		.spec-item:first-child {
 			margin-left: 0;
 		}
-		.on-spec{
+
+		.on-spec {
 			background-image: $base-bg-gradient-color;
 			color: #FFF;
 		}
 	}
-	.s-box{
+
+	.s-box {
 		width: 100%;
 		display: flex;
 		border-bottom: solid 1px #EEE;
-		.s-img{
+
+		.s-img {
 			width: 140upx;
 			height: 140upx;
 			background-color: #EEE;
 			border-radius: 4px;
 		}
-		.g-info{
+
+		.g-info {
 			padding-left: 20upx;
-			.s-name{
+
+			.s-name {
 				padding-bottom: 4px;
 			}
-			.s-price{
+
+			.s-price {
 				color: #F00;
 				font-size: 14px;
 			}
 		}
 	}
-	.purchase-num{
+
+	.purchase-num {
 		width: 100%;
 		display: flex;
 		justify-content: space-between;
 		align-items: center;
 		border-bottom: solid 1px #EEE;
 		padding-bottom: 30upx;
-		.num{
+
+		.num {
 			font-size: 12px;
 		}
 	}

+ 1 - 1
env/dev.js

@@ -1,5 +1,5 @@
 const ENV_PATH = {
-  serverPath: 'http://36.137.224.81:8030', // 请求前缀地址
+  serverPath: 'http://192.168.5.3:8080', // 请求前缀地址
   //serverFilePath: 'https://lsfdev.benyuntech.com/data/access', // 文件前缀地址
   appId: 'wxfc1ae62fd810717d', // 小程序 appid
   appName: '销售小程序', // 小程序名称(登录页面显示的名称)

+ 3 - 3
main.js

@@ -63,11 +63,11 @@ Vue.prototype.$request = function(method, url, data, isJSON, hideLoading, showEr
 			method,
 			data,
 			header: {
-				"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
-				// 'Content-Type': isJSON ? '' : 'application/x-www-form-urlencoded',
+				//"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
+				'Content-Type': isJSON ? '' : 'application/x-www-form-urlencoded',
 				// 'Authorization': `Bearer ${token}`,
 				'Authorization': 'Bearer ' + token,
-				clientId: '8871d05eacc4406083d3bb0a085b6999',
+				'clientId': '8871d05eacc4406083d3bb0a085b6999',
 				// 'tenantId': Vue.prototype.tenantId
 				// 'tenantId': `${tenantId}`
 			},

+ 9 - 0
pages.json

@@ -15,6 +15,15 @@
 				"enablePullDownRefresh" : false
 			}
 		},
+		
+		{
+			"path" : "pages/login/qrCode",
+			"style" : 
+			{
+				"navigationBarTitleText" : "登录"
+			}
+		},
+		
 		{
 			"path" : "pages/diningList/diningList",
 			"style" : 

+ 111 - 28
pages/classify/classify.vue

@@ -5,7 +5,7 @@
 				<u-col span="3">
 					<view class="icon-container-l">
 						<uni-badge size="normal" :text="txts" absolute="rightTop">
-							<u-icon :name="iconCooking" label="自提" labelPos="bottom" size="32" ></u-icon>
+							<u-icon :name="iconCooking" label="自提" labelPos="bottom" size="32"></u-icon>
 						</uni-badge>
 					</view>
 				</u-col>
@@ -39,10 +39,10 @@
 				<view class="padding-tb-sm" v-for="index in 8">分类{{index+1}}</view>
 			</view>
 		</u-popup> -->
-		<view class="w-full dflex-b padding-sm box-sizing-b dflex-wrap-w">
-			<view class="goods-item margin-bottom-sm" v-for="(item, index)  in goods" :key="index">
+		<view class="w-full dflex-b padding-xs box-sizing-b dflex-wrap-w">
+			<view class="goods-item margin-bottom-sm" v-for="(item, gindex)  in goods" :key="gindex">
 				<view class="img dflex-c" @click="toDetial">
-					<image mode="aspectFit" :src="'../../static/x'+ index%2 +'.jpg'"></image>
+					<image mode="aspectFit" :src="'../../static/x'+ gindex%2 +'.jpg'"></image>
 				</view>
 				<view class="title">{{item.goods_name}}</view>
 				<view class="dflex padding-bottom-xs">
@@ -51,76 +51,104 @@
 				<view class="w-full dflex-b">
 					<view class="price">{{item.goods_price}}</view>
 					<view>
-						<u-button type="primary" shape="circle" size='small' icon="shopping-cart-fill"
-							color="linear-gradient(to right, #F54319, #FF6D20)" @click="goCart"></u-button>
+						<u-button type="primary" shape="circle" size="small"
+							color="linear-gradient(to right, #F54319, #FF6D20)" @click="goCart(item)">
+							<u-icon name="shopping-cart-fill" size="28" color="#fff"></u-icon>
+						</u-button>
 					</view>
 				</view>
 			</view>
 		</view>
 		<my-gap :height="130" />
-
+		<specPopup class='spec-box' ref="specPopup" :cardMsg="cardMsg" @update-shopmsg="handleUpdateShopMsg">
+		</specPopup>
 		<view class="cart-bottom padding-sm dflex-b">
 			<view class="cart padding-lr">
 				<uni-badge size="small" :text="100" absolute="rightTop">
 					<u-icon name="shopping-cart-fill" size="28" color="#FF873D" @click="showCart"></u-icon>
 				</uni-badge>
-				<text class="cart-total">¥35.60</text>
+				<text class="cart-total">总计:¥{{total}}</text>
 			</view>
 			<view class="balance dflex-c background-gradient">去结算</view>
 		</view>
-		<cartPopupVue ref="cartPopup" />
+		<cartPopupVue ref="cartPopup" :carList="carList" @numChanged="numChanged" />
+
 	</view>
 </template>
 
 <script>
 	import cartPopupVue from '../../components/cartPopup.vue'
+	import specPopup from '@/components/specPopup.vue'
 	import iconCooking from '../../static/cooking.png'
 	import iconPeople from '../../static/people.png'
+	import shoppingCart from '../../static/shoppingCart.png'
 	export default {
 		components: {
 			cartPopupVue,
+			specPopup
 		},
 		data() {
 			return {
 				onIndex: 0,
 				show: false,
-				iconCooking: iconCooking, 
+				iconCooking: iconCooking,
 				iconPeople: iconPeople,
+				shoppingCart: shoppingCart,
 				tags: 1,
 				txts: 1,
 				goods: [ // 购物车数据列表
 					{
 						id: 1,
-						goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
-						goods_price: "520.00",
-
+						goods_name: "小乳酸菌牛奶酸奶",
+						goods_price: "5.20",
+						goods_type: '大份',
+						goods_num: 1,
+						src: '../../static/x0.jpg',
 					},
 					{
 						id: 2,
-						goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
-						goods_price: "520.00",
-					}, 
+						goods_name: "饮料整箱饮品",
+						goods_price: "5.20",
+						goods_type: '大份',
+						goods_num: 1,
+						src: '../../static/x1.jpg',
+					},
 					{
 						id: 3,
-						goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
-						goods_price: "520.00",
+						goods_name: "饮品早餐酸乳益生菌",
+						goods_price: "5.20",
+						goods_type: '小份',
+						goods_num: 1,
+						src: '../../static/x0.jpg',
 					},
 					{
 						id: 4,
-						goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
-						goods_price: "520.00",
+						goods_name: "酸奶饮料",
+						goods_price: "5.20",
+						goods_type: '小份',
+						goods_num: 1,
+						src: '../../static/x1.jpg',
 					},
 					{
 						id: 5,
-						goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
-						goods_price: "520.00",
+						goods_name: "小乳酸菌",
+						goods_price: "5.20",
+						goods_type: '小份',
+						goods_num: 1,
+						src: '../../static/x0.jpg',
 					},
 					{
 						id: 6,
-						goods_name: "小乳酸菌牛奶酸奶饮料整箱饮品早餐酸乳益生菌",
-						goods_price: "520.00",
+						goods_name: "酸乳益生菌",
+						goods_price: "5.20",
+						goods_type: '大份',
+						goods_num: 1,
+						src: '../../static/x1.jpg',
 					}
-				]
+				],
+				total: 0,
+				carList: [],
+				cardMsg: {}
 			}
 		},
 		created() {
@@ -128,8 +156,58 @@
 		},
 		methods: {
 			// 加购
-			goCart() {
-
+			goCart(e) {
+				console.log('================', e)
+				this.cardMsg = e
+				this.$refs.specPopup.open();
+				//this.$refs.specPopup.change(true);
+			},
+			handleUpdateShopMsg(shopMsg) {
+			  console.log('接收到的购物信息:', shopMsg);
+			  const specString = shopMsg.spec + ',' + shopMsg.specs;
+			  const item = this.goods.find(item => item.id === shopMsg.id);
+			
+			  if (item) {
+			    // 检查购物车列表中是否已存在相同id和规格的商品
+			    const existingCartItem = this.carList.find(cartItem => cartItem.id === item.id && cartItem.goods_type === specString);
+			
+			    if (existingCartItem) {
+			      // 如果已存在,则增加商品数量
+			      existingCartItem.goods_num += shopMsg.num;
+			    } else {
+			      // 如果不存在,则复制item并添加到购物车列表,同时设置商品数量和规格
+			      const newItem = { ...item };
+			      newItem.goods_num = shopMsg.num;
+			      newItem.goods_type = specString;
+			      this.carList.push(newItem);
+			    }
+			
+			    // 您可以在这里执行其他逻辑,比如保存到本地存储或发送到服务器
+			  }
+			
+			  console.log('购物车列表更新:', this.carList);
+			  this.totalPrice();
+			},
+			numChanged(value, index) {
+				console.log('更新后的数量????????????:', value, '索引:', index);
+				// 假设 carList 是一个 Map,其中 id 是键
+				const item = this.carList.find(item => item.id === index)
+				if (item) {
+					// 更新对应商品的 goods_num
+					item.goods_num = value;
+					// 您可以在这里执行其他逻辑,比如保存到本地存储或发送到服务器
+					console.log('更新后的数量:', value, '索引:', index);
+				}
+				this.totalPrice()
+			},
+			totalPrice() {
+				let total = 0;
+				for (let i = 0; i < this.carList.length; i++) {
+					total += this.carList[i].goods_price * this.carList[i].goods_num;
+					//goods_num += this.carList[i].goods_num
+				}
+				this.total = total
+				console.log('total', this.total);
 			},
 			showCart() {
 				this.$refs.cartPopup.setShow(true);
@@ -191,7 +269,7 @@
 
 		.img {
 			width: 100%;
-			height: 350rpx;
+			height: 180rpx;
 			overflow: hidden;
 			background: #EEE;
 		}
@@ -241,6 +319,11 @@
 		}
 	}
 
+	.spec-box {
+		position: relative;
+		z-index: 99999;
+	}
+
 	.classify-popup {
 		width: 400rpx;
 	}

+ 6 - 3
pages/diningCar/diningCar.vue

@@ -32,11 +32,10 @@
 					name: '23333',
 					openState: 1,
 				},
-				
 			}
 		},
 		onLoad(e) {
-		  this.fatchDate(e.id);
+		  this.fatchDate(e);
 		},
 		// created() {
 		// 	this.fatchDate(e.id)
@@ -56,7 +55,11 @@
 			},
 			fatchDate(e) {
 				console.log('e===========================e', e)
-				const result = this.$request('get', '/sale/diningCar/queryDiningCarById', {id: e})
+				var queryParmas = {
+					id : e.id
+				}
+				console.log('idididididid', queryParmas)
+				const result = this.$request('post', '/sale/diningCar/queryDiningCarById', queryParmas)
 				if (result) {
 					this.dinList = result.data
 				}

+ 16 - 11
pages/diningList/diningList.vue

@@ -2,7 +2,7 @@
 	<view>
 		<view class="btnS">
 			<view style="width: 90%;">
-				<u-search :clearabled="true" shape="round" :showAction="false" v-model="seaName"></u-search>
+				<u-search :clearabled="true" shape="round" :showAction="false" v-model="seaName" @search= "searchClick"></u-search>
 			</view>
 		</view>
 		
@@ -10,7 +10,7 @@
 			<view class="box" :class="{ 'boxed-border': item.isAsc }" >
 				<view class="container" @click="carList">
 					<view class="text-container">
-						<view class="flex-item">{{item.name}}</view>
+						<view class="flex-item">{{item.name ? item.name : '无' }}</view>
 						<u-tag plain :text="item.openState ? '营业中' : '离线'" :type="item.openState ? 'success' : 'error'" size="mini"></u-tag>
 					</view>
 				</view>
@@ -35,17 +35,17 @@
 				orderinfo: {},
 				tableData: [
 					{
-						dingName: '23333',
+						name: '23333',
 						tags: 1,
 						showBorder: true,
 					},
 					{
-						dingName: '门店',
+						name: '门店',
 						tags: 1,
 						showBorder: false,
 					},
 					{
-						dingName: '店家',
+						name: '店家',
 						tags: 1,
 						showBorder: false,
 					}
@@ -63,11 +63,15 @@
 			this.fatchDate()
 		},
 		methods: {
-			searchClick() {
-				
+			searchClick(e) {
+				this.seaName = e
+				console.log('==============================', e)
 			},
 			async call() {
-				const response = await this.$request('get', '/sale/customer/queryCustomer', this.tableData.customerId);
+				const query= {
+					id: this.tableData.customerId
+				}
+				const response = await this.$request('post', '/sale/customer/queryCustomerById', query);
 				
 				if (this.orderinfo.shopCall) {
 					uni.makePhoneCall({
@@ -94,10 +98,11 @@
 			async fatchDate() {
 				var queryParams = {
 					"pageSize": this.page.pageSize,
-					"pageNum": this.page.pageNum
+					"pageNum": this.page.pageNum,
+					"name": this.seaName
 				}
 				try {
-					const response = await this.$request('get', '/sale/diningCar/queryDiningCar', queryParams);
+					const response = await this.$request('post', '/sale/diningCar/queryDiningCar', queryParams);
 					console.log('response', response)
 				
 					const data = response.rows; // 假设 res.rows 是一个数组
@@ -114,7 +119,7 @@
 						this.status = this.page.totalPage === 0 || this.page.totalPage === this.page.pageNum ?
 							'noMore' : 'more';
 					} else {
-						this.$toast(data.msg);
+						//this.$toast(data.msg);
 					}
 				} catch (err) {
 					console.error('请求异常', err);

+ 29 - 9
pages/goodDetail/goodDetail.vue

@@ -15,7 +15,7 @@
 					<view>
 						<text class="price fwb fs-big">{{ goods.price / 100 || '100' }}</text>
 					</view>
-					<view class="dflex fs-sm ft-dark">
+					<!-- <view class="dflex fs-sm ft-dark">
 						<view class="margin-right-sm dflex" @click="">
 							<uni-icons type="headphones" size="24" color="#999"></uni-icons>
 						</view>
@@ -25,7 +25,11 @@
 						<view class="margin-right-sm dflex" @click="">
 							<uni-icons type="redo" size="24" color="#999"></uni-icons>
 						</view>
-					</view>
+					</view> -->
+				</view>
+				<view class="container">
+					<u-tag type="error" icon="coupon"></u-tag>
+					<u-tag text="平台活动" type="error" plain plainFill></u-tag>
 				</view>
 				<!-- <view class="coupon">
 					<view class="mj-tag">
@@ -63,8 +67,14 @@
 		<my-gap :height="130" bg="#f5f5f5" />
 		<!-- 07. 操作区 -->
 		<view class="cart-bottom padding-sm dflex-b">
+			<view style="width: 60px;">
+				<u-icon :name="service" label="客服" labelPos="bottom" size="32"></u-icon>
+			</view>
+			<view style="width: 60px;">
+				<u-icon :name="shoppingCart" label="购物车" labelPos="bottom" size="32"></u-icon>
+			</view>
 			<view class="go-cart dflex-c">加入购物车</view>
-			<view class="go-buy dflex-c">立即购买</view>
+			<view class="go-buy dflex-c background-gradient">立即购买</view>
 		</view>
 		
 		<!-- 置顶 -->
@@ -75,10 +85,14 @@
 
 <script>
 	import specPopup from '@/components/specPopup.vue'
+	import shoppingCart from '../../static/shoppingCart.png'
+	import service from '../../static/service.png'
 	export default {
 		components:{specPopup},
 		data() {
 			return {
+				shoppingCart: shoppingCart,
+				service: service,
 				specValue:'1包,番茄味',
 				// 商品ID
 				id: 0,
@@ -249,21 +263,27 @@
 	z-index: 10;
 	box-shadow: 0px -4px 16px 0px rgba(0,0,0,0.15);
 	.go-cart{
-		height: 100%;
+		height: 80%;
 		box-sizing: border-box;
 		border: solid 1px #FF0000;
 		font-size: 14px;
 		color: #FF0000;
-		border-radius: 5px;
-		width: 48%;
+		border-radius: 50upx;
+		margin: 0 10px;
+		width: 45%;
 	}
 	.go-buy{
-		height: 100%;
-		width: 48%;
+		height: 80%;
+		width: 45%;
 		background-color: #FF0000;
 		color: #FFF;
-		border-radius: 5px;
+		border-radius: 50upx;
 		font-size: 14px;
 	}
 }
+.container {
+    display: flex;
+    // justify-content: space-between;
+    margin: 10px 0; /* 添加一些外边距以便查看 */
+  }
 </style>

+ 120 - 5
pages/login/login.vue

@@ -1,10 +1,10 @@
-<template>
+<!-- <template>
 	<view>
 		<image :src="src" class="img"></image>
 		<view class="btn">
 			<view style="width: 80%;">
-				<u-button shape="circle" color="linear-gradient(to right, #F54319, #FF6D20)"
-					@click="loginUse">点击登录</u-button>
+				<u-button v-if="canIUseGetUserProfile" shape="circle" color="linear-gradient(to right, #F54319, #FF6D20)"
+					@click="getUserProfile">选择餐车</u-button>
 			</view>
 		</view>
 	</view>
@@ -16,11 +16,14 @@
 		data() {
 			return {
 				infoData: {},
-				src: '../../static/first.png'
+				src: '../../static/first.png',
+				userInfo: {},
+				hasUserInfo: false,
+				canIUseGetUserProfile: wx.getUserProfile ? true : false,
 			}
 		},
 		methods: {
-			loginUse() {
+			getUserProfile() {
 				wx.login({
 					success: async (e) => {
 						console.log('数据:', e)
@@ -36,6 +39,16 @@
 								var haveOpenid = result.data.openId;
 								var tenantId = result.data.tenantId
 								uni.setStorageSync("token", token);
+								wx.getUserProfile({
+									desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+									success: (res) => {
+										this.setData({
+											userInfo: res.userInfo,
+											hasUserInfo: true
+										})
+									}
+								})
+								console.log('userInfo', this.userInfo)
 								uni.navigateTo({
 									url: `/pages/diningList/diningList`
 								});
@@ -87,6 +100,108 @@
 	}
 </script>
 
+<style lang="scss" scoped>
+	.img {
+		height: 375px;
+		width: 100%;
+	}
+
+	.btn {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		margin-top: 20px;
+	}
+</style> -->
+<template>
+	<view>
+		<image :src="src" class="img"></image>
+
+		<view class="btn">
+			<view style="width: 80%;">
+				<u-button v-if="canIUseGetUserProfile" shape="circle"
+					color="linear-gradient(to right, #F54319, #FF6D20)" @click="getUserProfile">选择餐车</u-button>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		name: 'MyLogin',
+		data() {
+			return {
+				src: '../../static/first.png',
+				canIUseGetUserProfile: false,
+			}
+		},
+		onLoad() {
+			// 检查微信版本是否支持 getUserProfile
+			if (wx.getUserProfile) {
+				this.canIUseGetUserProfile = true;
+			}
+		},
+		methods: {
+			getUserProfile() {
+				wx.showModal({
+					title: '温馨提示',
+					content: '亲,授权微信登录后才能正常使用小程序功能',
+				})
+				wx.getUserProfile({
+					desc: '获取用户信息',
+					success: (res) => {
+						console.log('res', res);
+						// 调用微信登录接口
+						wx.login({
+							success: async (loginRes) => {
+								console.log('数据:', loginRes)
+								try {
+									// 发送code到开发者服务器换取用户信息
+									const result = await this.$request('post',
+										'/auth/miniLogin', {
+											tenantId: '000000',
+											clientId: '8871d05eacc4406083d3bb0a085b6999',
+											code: loginRes.code
+										})
+									console.log('登录成功:', result);
+									if (result && result.data !== false) {
+										// 保存token
+										uni.setStorageSync("token", result.data.accessToken);
+										uni.setStorageSync("openId", result.data.openId);
+										uni.setStorageSync("tenantId", result.data.tenantId);
+										uni.setStorageSync("appUserId", result.data.appUserId);
+										// 跳转到下一个页面
+										uni.navigateTo({
+											url: `/pages/diningList/diningList`
+										});
+									} else {
+										// 处理错误情况
+									}
+								} catch (error) {
+									// 处理请求失败的情况
+									console.error('登录失败:', error);
+								}
+							}
+						})
+						//更新用户信息
+						const openId = uni.getStorageSync('openId');
+						const id = uni.getStorageSync('appUserId');
+
+						const userInfo = {
+							"id": id,
+							"nickName": res.userInfo.nickName,
+							"profilePhoto": res.userInfo.avatarUrl,
+							"openId": openId
+						}
+						const result = this.$request('post',
+							'/system/appUser/editAppUser', userInfo)
+					},
+				})
+			}
+		}
+	}
+</script>
+
 <style lang="scss" scoped>
 	.img {
 		height: 375px;

+ 52 - 0
pages/login/qrCode.vue

@@ -0,0 +1,52 @@
+<template>
+  <view>
+    <button @click="createQRCode">生成二维码</button>
+    <image :src="qrCodeImage" @click="scanQRCode"></image>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      qrCodeImage: '../../static/nice.jpg', // 二维码图片路径
+    };
+  },
+  methods: {
+    async createQRCode() {
+      // 生成二维码
+      const qrcode = await this.generateQRCode('pages/classify/classify');
+      this.qrCodeImage = qrcode;
+    },
+    async generateQRCode(sceneStr) {
+      // 创建二维码
+      const qrcode = await new Promise((resolve, reject) => {
+        wx.createQRCode({
+          scene: {
+            scene_str: sceneStr
+          },
+          success: (res) => {
+            resolve(res.path);
+          },
+          fail: (err) => {
+            reject(err);
+          }
+        });
+      });
+      return qrcode;
+    },
+    async scanQRCode() {
+      // 扫描二维码
+      wx.scanCode({
+        scanType: ['qrcode'], // 指定扫描类型为二维码
+        success: (res) => {
+          console.log(res.result); // 输出二维码的内容
+        },
+        fail: (err) => {
+          console.log(err);
+        }
+      });
+    }
+  }
+};
+</script>

BIN
static/nice.jpg


BIN
static/shoppingCart.png