Browse Source

no message

py 1 năm trước cách đây
mục cha
commit
d7fc60abe1

+ 3 - 1
api/order.js

@@ -14,4 +14,6 @@ export const orderPay = (data) => request(newsUrl + 'pay', 'post', { ...data },f
 // 获取预约送达时间
 export const orderTime = (data) => request(newsUrl + 'time', 'post', { ...data },false)
 // 外卖订单创建
-export const orderCreate = (data) => request(newsUrl + 'create', 'post', { ...data },false)
+export const orderCreate = (data) => request(newsUrl + 'create', 'post', { ...data },false)
+// 支付页详情
+export const orderPayInfo = (data) => request(newsUrl + 'pay_info', 'post', { ...data },false)

+ 5 - 1
api/seckill.js

@@ -4,4 +4,8 @@ const newsUrl = '/api/seckill/'
 // 秒杀商品
 export const getSeckillGoods = (data) => request(newsUrl + 'goods', 'post', { ...data },false)
 // 首页团购秒杀
-export const seckillGroupGoods = (data) => request(newsUrl + 'group_goods', 'post', { ...data },false)
+export const seckillGroupGoods = (data) => request(newsUrl + 'group_goods', 'post', { ...data },false)
+// 秒杀全部商品
+export const seckillAllGoods = (data) => request(newsUrl + 'all_goods', 'post', { ...data },false)
+// 团购全部商品
+export const seckillAllGroup = (data) => request(newsUrl + 'all_group', 'post', { ...data },false)

+ 11 - 1
api/shopping.js

@@ -7,8 +7,18 @@ export const setShopIngAdd = (data) => request(newsUrl + 'add', 'post', { ...dat
 // 更新  购物车数量
 export const setShopIngNumber = (data) => request(newsUrl + 'number', 'post', { ...data },false)
 
+
+
+
+
+
+
+
 // 清空 购物车
 export const setShopIngDel = (data) => request(newsUrl + 'del', 'post', { ...data },false)
 
 // 购物车列表
-export const getShopIngList = (data) => request(newsUrl + 'list', 'post', { ...data },false)
+export const getShopIngList = (data) => request(newsUrl + 'list', 'post', { ...data },false)
+
+// 添加&更新购物车数量
+export const shoppingSave = (data) => request(newsUrl + 'save', 'post', { ...data },false)

+ 40 - 2
common/css/common.css

@@ -267,6 +267,16 @@ image {
 	text-decoration: line-through
 }
 
+/* 斜体 */
+.fs-i {
+	font-style: italic;
+}
+
+/* 字间距 */
+.l-s-2 {
+	letter-spacing: 4rpx;
+}
+
 /* 字体粗细 */
 .fw-b {
 	font-weight: bold;
@@ -293,6 +303,10 @@ image {
 	color: #000;
 }
 
+.fc-213C45 {
+	color: #213C45;
+}
+
 .fc-3 {
 	color: #333;
 }
@@ -325,9 +339,11 @@ image {
 .fc-41ABF5 {
 	color: #41ABF5;
 }
+
 .fc-1089D1 {
 	color: #1089D1;
 }
+
 .fc-57CAFF {
 	color: #57CAFF;
 }
@@ -340,6 +356,10 @@ image {
 	color: #FD5D05;
 }
 
+.fc-FF6320 {
+	color: #FF6320;
+}
+
 .fc-FB3D03 {
 	color: #ff3422;
 }
@@ -421,9 +441,11 @@ image {
 .bgc-4FB3EF {
 	background-color: #4FB3EF;
 }
+
 .bgc-5CC2FF {
 	background-color: #5CC2FF;
 }
+
 .bgc-41ABF5 {
 	background-color: #41ABF5;
 }
@@ -487,14 +509,26 @@ image {
 .bgc-46D1C2 {
 	background-color: #46D1C2;
 }
-
+.bgc-FD492D {
+	background-color: #FD492D;
+}
 .bgc-FF3E5D {
 	background-color: #FF3E5D;
 }
+.bgc-EB5127 {
+	background-color: #EB5127;
+}
 
 .bgc-F5811E {
 	background-color: #F5811E;
 }
+.bgc-FFD977 {
+	background-color: #FFD977;
+}
+
+.bgc-FDF3EC {
+	background-color: #FDF3EC;
+}
 
 
 .bgc-F5F4F9 {
@@ -603,9 +637,11 @@ image {
 .pt-33 {
 	padding-top: 33rpx;
 }
+
 .pt-40 {
 	padding-top: 40rpx;
 }
+
 .p-t-80 {
 	padding-top: 80rpx;
 }
@@ -629,7 +665,9 @@ image {
 .plr-12 {
 	padding: 0 12rpx;
 }
-
+.plr-10 {
+	padding: 0 10rpx;
+}
 .plr-24 {
 	padding: 0 24rpx;
 }

+ 5 - 0
common/js/uniAnimation.js

@@ -0,0 +1,5 @@
+export default {
+  createAnimation(options) {
+    return uni.createAnimation(options);
+  }
+};

+ 11 - 0
package-lock.json

@@ -7,6 +7,7 @@
       "dependencies": {
         "js-base64": "3.7.2",
         "jweixin-module": "^1.6.0",
+        "matter-js": "^0.20.0",
         "uni-read-pages": "1.0.5",
         "uni-simple-router": "2.0.7",
         "uniapp-qrcode": "^1.0.2",
@@ -79,6 +80,11 @@
       "resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz",
       "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
     },
+    "node_modules/matter-js": {
+      "version": "0.20.0",
+      "resolved": "https://registry.npmmirror.com/matter-js/-/matter-js-0.20.0.tgz",
+      "integrity": "sha512-iC9fYR7zVT3HppNnsFsp9XOoQdQN2tUyfaKg4CHLH8bN+j6GT4Gw7IH2rP0tflAebrHFw730RR3DkVSZRX8hwA=="
+    },
     "node_modules/nanoid": {
       "version": "3.3.4",
       "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
@@ -255,6 +261,11 @@
       "resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz",
       "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
     },
+    "matter-js": {
+      "version": "0.20.0",
+      "resolved": "https://registry.npmmirror.com/matter-js/-/matter-js-0.20.0.tgz",
+      "integrity": "sha512-iC9fYR7zVT3HppNnsFsp9XOoQdQN2tUyfaKg4CHLH8bN+j6GT4Gw7IH2rP0tflAebrHFw730RR3DkVSZRX8hwA=="
+    },
     "nanoid": {
       "version": "3.3.4",
       "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",

+ 1 - 0
package.json

@@ -2,6 +2,7 @@
   "dependencies": {
     "js-base64": "3.7.2",
     "jweixin-module": "^1.6.0",
+    "matter-js": "^0.20.0",
     "uni-read-pages": "1.0.5",
     "uni-simple-router": "2.0.7",
     "uniapp-qrcode": "^1.0.2",

+ 206 - 85
pages-takeout/1212.vue

@@ -1,93 +1,214 @@
 <template>
-  <view class="container">
-    <view
-      v-for="(ball, index) in balls"
-      :key="index"
-      :class="['ball', ball.colorClass]"
-      :style="ball.style"
-      @animationend="handleAnimationEnd(index)"
-    >
-      <text>{{ ball.content }}</text>
+    <view class="flex-common-css iPhone-bottom box-border-box">
+        <Nav :title="school_name"></Nav>
+        <image class="bg-img" src="https://sjz-school.oss-cn-chengdu.aliyuncs.com/webImages/bg.png" mode=""></image>
+        <view class="q-box z-2" ref="qBox">
+            <view v-for="(ball,index) in shopData" :key="index" class="ball flex-direction"
+                :style="{ left: ball.x + 'rpx', top: ball.y + 'rpx' }">
+                <image class="qp-img" src="/pages-takeout/static/qp.png" mode=""></image>
+                <image class="shop-logo z-2 b-rad-20" :src="ball.shop_logo" mode=""></image>
+                <view class="fs-24 fc-f z-2 text-overflow-ellipsis-one max-w-118 text-align-center">
+                    {{ball.shop_name}}
+                </view>
+            </view>
+        </view>
+        <view class="but-box">
+            <image class="but-img" src="/pages-takeout/static/but-bg.png" mode=""></image>
+            <view class="fs-38 fc-f fw-b text-align-center z-2 pt-49">
+                君子帮你选,今日吃点啥?
+            </view>
+        </view>
+        <view class="fs-28 fc-1089D1 text-align-center">
+            全部商家随机抽取
+        </view>
     </view>
-  </view>
 </template>
+
 <script>
-export default {
-  data() {
-    return {
-      balls: [], // 存储小球信息的数组
-      animationFrames: [], // 存储每个小球的动画帧信息
-    };
-  },
-  mounted() {
-    this.initBalls();
-    this.startAnimations();
-  },
-  methods: {
-    initBalls() {
-      const numBalls = 10; // 小球数量
-      for (let i = 0; i < numBalls; i++) {
-        this.balls.push({
-          colorClass: this.getRandomColorClass(), // 随机颜色类
-          content: `Ball ${i + 1}`, // 自定义内容
-          style: {
-            position: 'absolute',
-            left: `${Math.random() * window.innerWidth}px`, // 随机初始位置X
-            top: `${Math.random() * window.innerHeight}px`, // 随机初始位置Y
-            transform: `translate(-50%, -50%)`, // 居中内容
-          },
-          direction: { x: Math.random() * 2 - 1, y: Math.random() * 2 - 1 }, // 随机方向
-          speed: Math.random() * 2 + 1, // 随机速度
-        });
-      }
-    },
-    getRandomColorClass() {
-      // 根据需要返回随机颜色类名,这里简化为几个预设类
-      const colors = ['red', 'blue', 'green', 'yellow', 'purple', 'orange'];
-      return colors[Math.floor(Math.random() * colors.length)];
-    },
-    startAnimations() {
-      // 为每个小球启动动画
-      this.balls.forEach((ball, index) => {
-        setTimeout(() => {
-          this.animateBall(index);
-        }, Math.random() * 2000); // 随机延迟开始动画
-      });
-    },
-    animateBall(index) {
-      const ball = this.balls[index];
-      let newLeft = parseFloat(ball.style.left) + ball.direction.x * ball.speed;
-      let newTop = parseFloat(ball.style.top) + ball.direction.y * ball.speed;
+    import {
+        shopAll
+    } from "@/api/shop.js";
+
+    export default {
+        components: {},
+        data() {
+            return {
+                school_name: '',
+                shopId: 0,
+                shopData: [],
+                animationFrameId: null,
+                animations: []
+            };
+        },
+        onLoad(data) {
+            this.school_name = uni.getStorageSync('school_name');
+            this.getQBoxSize();
+        },
+        mounted() {
+            this.shopAll();
+            this.startAnimation();
+        },
+        methods: {
+            scrolltolower() {
+                console.log('触底');
+            },
+            shopAll() {
+                shopAll().then((res) => {
+                    if (res.code === 1) {
+                        this.shopData = res.data;
+                        this.shopData.forEach((v, k) => {
+                            const radius = 59; // 小球半径相关大小(这里用宽度等体现,单位rpx)
+                            const x = Math.random() * (this.containerWidth - 2 * radius) + radius;
+                            const y = Math.random() * (this.containerHeight - 2 * radius) + radius;
+                            // 生成更大的速度,范围在 -5 到 5 之间,使小球移动更快
+                            const speedX = (Math.random() - 0.5) * 5; 
+                            const speedY = (Math.random() - 0.5) * 5; 
+                            v.x = x;
+                            v.y = y;
+                            v.speedX = speedX;
+                            v.speedY = speedY;
+                            // 为每个小球创建动画实例
+                            const animation = uni.createAnimation({
+                                duration: 0,
+                                timingFunction: 'linear'
+                            });
+                            this.animations.push(animation);
+                            v.animation = animation;
+                        });
+                        // console.log(this.shopData);
+                    }
+                });
+            },
+            startAnimation() {
+                const animate = () => {
+                    this.updateBalls();
+                    // 进一步减小调用间隔,例如 20 毫秒,提高更新频率
+                    this.animationFrameId = setTimeout(animate, 20); 
+                };
+                animate();
+            },
+            updateBalls() {
+                for (const ball of this.shopData) {
+                    // 更新小球位置
+                    ball.x += ball.speedX;
+                    ball.y += ball.speedY;
+                    // 处理左右边界碰撞
+                    if (ball.x < 0 || ball.x + 2 * 59 > this.containerWidth) {
+                        if (ball.x < 0) {
+                            ball.x = 0;
+                            ball.speedX = Math.abs(ball.speedX);
+                        } else {
+                            ball.x = this.containerWidth - 2 * 59;
+                            ball.speedX = -Math.abs(ball.speedX);
+                        }
+                    }
+                    // 处理上下边界碰撞
+                    if (ball.y < 0 || ball.y + 2 * 59 > this.containerHeight) {
+                        if (ball.y < 0) {
+                            ball.y = 0;
+                            ball.speedY = Math.abs(ball.speedY);
+                        } else {
+                            ball.y = this.containerHeight - 2 * 59;
+                            ball.speedY = -Math.abs(ball.speedY);
+                        }
+                    }
+                    // 使用动画更新小球位置
+                    ball.animation.translateX(ball.x).translateY(ball.y).step();
+                    ball.animation.export();
+                    // 直接使用 uni 的动画更新方法
+                    uni.createSelectorQuery().in(this).select(`.ball:nth-child(${ball.index + 1})`).boundingClientRect(
+                        rect => {
+                            if (rect) {
+                                ball.animation.export()
+                                  .translate(ball.x - rect.left, ball.y - rect.top)
+                                  .step()
+                                  .update();
+                            }
+                        }).exec();
+                }
+                // 利用 Vue 的响应式数据绑定自动更新视图,不再使用 $forceUpdate
+            },
+            getQBoxSize() {
+                uni.createSelectorQuery().in(this).select('.q-box').boundingClientRect((rect) => {
+                    if (rect) {
+                        this.containerWidth = (rect.width) * 2;
+                        this.containerHeight = (rect.height) * 2;
+                    }
+                }).exec();
+            }
+        },
+        beforeDestroy() {
+            // 清除定时器
+            clearTimeout(this.animationFrameId);
+        }
+    }
+</script>
+
+<style lang="scss" scoped>
+.max-w-118{
+        max-width: 118rpx;
+    }
+.qp-box-ccc {
+        background: #ccc;
+    }
+
+.z-2 {
+        position: relative;
+        z-index: 2;
+    }
+
+.q-box {
+        width: 100%;
+        height: 71%;
+        padding-bottom: constant(safe-area-inset-bottom);
+        padding-bottom: env(safe-area-inset-bottom);
+        position: relative;
+    }
+
+.ball {
+        width: 118rpx;
+        height: 154rpx;
+        position: absolute;
+        padding-top: 28rpx;
+    }
+
+.shop-logo {
+        width: 68.5rpx;
+        height: 68.5rpx;
+        margin: 0 0 34rpx 29rpx;
+    }
+
+.bg-img {
+        width: 100%;
+        height: 89%;
+        position: absolute;
+        left: 0;
+        top: 0;
+    }
 
-      // 碰撞检测(边界反弹)
-      if (newLeft < 0 || newLeft > window.innerWidth - 50) { // 50是假设的小球宽度
-        ball.direction.x = -ball.direction.x;
-        newLeft += ball.direction.x * ball.speed * 2; // 反弹后调整位置,避免抖动
-      }
-      if (newTop < 0 || newTop > window.innerHeight - 50) { // 50是假设的小球高度
-        ball.direction.y = -ball.direction.y;
-        newTop += ball.direction.y * ball.speed * 2; // 反弹后调整位置,避免抖动
-      }
+.but-box {
+        width: 100%;
+        height: 170rpx;
+        position: relative;
+    }
 
-      ball.style.left = `${newLeft}px`;
-      ball.style.top = `${newTop}px`;
+.but-img {
+        position: absolute;
+        left: 0;
+        top: 0;
+        width: 100%;
+        height: 100%;
+    }
 
-      // 使用requestAnimationFrame进行持续动画
-      this.animationFrames[index] = requestAnimationFrame(() => {
-        this.animateBall(index);
-      });
+.pt-49 {
+        padding-top: 49rpx;
+    }
 
-      // 可选:为动画添加结束处理(例如,当小球需要停止或改变方向时)
-      // 但在这个例子中,我们让小球持续运动,所以不需要特别处理动画结束
-    },
-    handleAnimationEnd(index) {
-      // 这个方法在这个例子中未使用,因为我们是用requestAnimationFrame控制的动画
-      // 如果你使用CSS动画,这个方法可以用来处理动画结束后的逻辑
-    },
-  },
-  beforeDestroy() {
-    // 组件销毁前取消所有动画帧请求
-    this.animationFrames.forEach(cancelAnimationFrame);
-  },
-};
-</script>
+.qp-img {
+        width: 118rpx;
+        height: 118rpx;
+        position: absolute;
+        left: 0;
+        top: 0;
+    }
+</style>

+ 53 - 50
pages-takeout/goods-order.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="confirm-order-box iPhone-bottom flex-common-css box-border-box">
 		<view class="bg-box"></view>
-		<Nav title='提交订单' bgckgroundBox='transparent'></Nav>
+		<Nav title='订单支付' bgckgroundBox='transparent'></Nav>
 		<view class="scroll-view-css box-border-box p-24">
 			<view class="box-card box-border-box mb-20 bgc-f">
 				<view class="box-input box-border-box p-b-20 mb-20" @click="selectFun(2)">
@@ -105,13 +105,13 @@
 
 
 
-			<view class="box-card box-border-box mb-20 bgc-f flex-justify-space">
+<!-- 			<view class="box-card box-border-box mb-20 bgc-f flex-justify-space">
 				<view class="fs-28 fw-600 w158">支付方式</view>
 				<view class="wx-box display-flex">
 					<image src="@/static/img/common/wx-zf.png" mode="scaleToFill"></image>
 					<view class="fs-28 fw-400 ml-10">微信支付</view>
 				</view>
-			</view>
+			</view> -->
 		</view>
 
 		<view class="bottom-box box-border-box p-24">
@@ -328,53 +328,56 @@
 				// this.fromData.site_id = uni.getStorageSync('site_id');
 				orderCreate(this.fromData).then((res) => {
 					if (res.code === 1) {
-						orderPay({
-							order_id: res.data.order_id,
-							pay_type: 1
-						}).then((ret) => {
-							if (ret.code === 1) {
-								uni.requestPayment({
-									provider: "wxpay", //支付类型-固定值
-									timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
-									nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
-									package: ret.data.wx_pay.package, // 固定值
-									signType: ret.data.wx_pay.signType, //固定值
-									paySign: ret.data.wx_pay.paySign, //签名
-									success: (ren) => {
-										uni.removeStorageSync('isConfirmAddressFlag')
-										tools.success("支付成功");
-										this.isAJAX = false;
-										setTimeout(() => {
-											uni.switchTab({
-												url: '/pages/order/index'
-											})
-											uni.setStorageSync('orderPayType', 1)
-										}, 1000)
-									},
-									fail: (err) => {
-										uni.removeStorageSync('isConfirmAddressFlag')
-										this.isAJAX = false;
-										tools.error("支付失败");
-										setTimeout(() => {
-											uni.switchTab({
-												url: '/pages/order/index'
-											})
-											uni.setStorageSync('orderPayType', 1)
-										}, 1000)
-									},
-								});
-							} else {
-								uni.removeStorageSync('isConfirmAddressFlag')
-								this.isAJAX = false;
-								tools.error("支付失败");
-								setTimeout(() => {
-									uni.switchTab({
-										url: '/pages/order/index'
-									})
-									uni.setStorageSync('orderPayType', 1)
-								}, 1000)
-							}
-						})
+						uni.redirectTo({
+							url: `/pages-takeout/pay-page?orderId=${res.data.order_id}`
+						});
+						// orderPay({
+						// 	order_id: res.data.order_id,
+						// 	pay_type: 1
+						// }).then((ret) => {
+						// 	if (ret.code === 1) {
+						// 		uni.requestPayment({
+						// 			provider: "wxpay", //支付类型-固定值
+						// 			timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
+						// 			nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
+						// 			package: ret.data.wx_pay.package, // 固定值
+						// 			signType: ret.data.wx_pay.signType, //固定值
+						// 			paySign: ret.data.wx_pay.paySign, //签名
+						// 			success: (ren) => {
+						// 				uni.removeStorageSync('isConfirmAddressFlag')
+						// 				tools.success("支付成功");
+						// 				this.isAJAX = false;
+						// 				setTimeout(() => {
+						// 					uni.switchTab({
+						// 						url: '/pages/order/index'
+						// 					})
+						// 					uni.setStorageSync('orderPayType', 1)
+						// 				}, 1000)
+						// 			},
+						// 			fail: (err) => {
+						// 				uni.removeStorageSync('isConfirmAddressFlag')
+						// 				this.isAJAX = false;
+						// 				tools.error("支付失败");
+						// 				setTimeout(() => {
+						// 					uni.switchTab({
+						// 						url: '/pages/order/index'
+						// 					})
+						// 					uni.setStorageSync('orderPayType', 1)
+						// 				}, 1000)
+						// 			},
+						// 		});
+						// 	} else {
+						// 		uni.removeStorageSync('isConfirmAddressFlag')
+						// 		this.isAJAX = false;
+						// 		tools.error("支付失败");
+						// 		setTimeout(() => {
+						// 			uni.switchTab({
+						// 				url: '/pages/order/index'
+						// 			})
+						// 			uni.setStorageSync('orderPayType', 1)
+						// 		}, 1000)
+						// 	}
+						// })
 					} else {
 						this.isAJAX = false;
 						tools.error(res.msg);

+ 117 - 0
pages-takeout/group-goods.vue

@@ -0,0 +1,117 @@
+<template>
+	<view class="flex-common-css iPhone-bottom  box-border-box seckill-box">
+		<Nav title="优质团购" bgckgroundBox='transparent' leftColor='#fff' titleColor='#fff'></Nav>
+		<scroll-view :scroll-y="true" class="scroll-view-css p-24 box-border-box" @scrolltolower="scrolltolower">
+			<view class="b-rad-20 bgc-f mb-10 p-24 box-border-box align-items-flex-start"
+				v-for="(item,index) in goodsData" :key="index" @click="goToUrl(item)">
+				<image class="goods-img flex-shrink0 mr-20 b-rad-12" :src="item.cover_img" mode="aspectFill"></image>
+				<view class="flex-1 right-h flex-direction flex-justify-space">
+					<view class="">
+						<view class="fs-30 fw-600 fc-0 mb-10 text-overflow-ellipsis">
+							{{item.title}}
+						</view>
+						<view class="align-items-center">
+							<uni-icons type="shop" size="15" color="#666" class="mr-4"></uni-icons>
+							<view class="fs-26 fc-6">
+								{{item.shop_name}}
+							</view>
+						</view>
+					</view>
+					<view class="item-but align-items-center flex-justify-space bgc-FDF3EC box-border-box">
+						<view class="align-items-center">
+							<view class="fs-28 fw-600 fc-F43D04 mr-14">
+								¥ <text class="fs-30 fw-600 fc-F43D04">{{Number(item.seckill_money).toFixed(2)}}</text>
+							</view>
+							<view class="fs-22 fc-F43D04">
+								已省{{(Number(item.line_price).toFixed(2) - Number(item.seckill_money).toFixed(2)).toFixed(2)}}
+							</view>
+						</view>
+						<view class="fs-28 fc-f msq-but plr-24 box-border-box bgc-F5811E b-rad-20">
+							马上抢
+						</view>
+					</view>
+				</view>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import {
+		seckillAllGroup
+	} from "@/api/seckill.js"
+	import {
+		shopInfo,
+	} from "@/api/shop.js"
+	export default {
+		components: {},
+		data() {
+			return {
+				goodsData: [],
+				page: 1,
+				total: 0
+			};
+		},
+		onLoad(data) {},
+		mounted() {
+			this.seckillAllGroup()
+		},
+		methods: {
+			goToUrl(item) {
+				shopInfo({
+					shop_id: item.shop_id
+				}).then((res) => {
+					if (res.code == 1) {
+						uni.navigateTo({
+							url: '/pages-takeout/shop?shop_id=' + item.shop_id + '&category_id=' + item
+								.category_id + '&goods_id=' + item.goods_id
+						})
+					} else {
+						tools.error(res.msg)
+					}
+				})
+			},
+			scrolltolower() {
+				if (this.total > this.goodsData.length) {
+					++this.page
+					this.scrolltolower()
+				}
+			},
+			seckillAllGroup() {
+				seckillAllGroup({
+					page: this.page
+				}).then((res) => {
+					if (res.code === 1) {
+						this.goodsData.push(...res.data.items)
+						this.total = res.data.total
+					}
+				})
+			}
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	.seckill-box {
+		background: linear-gradient(to bottom, #FF3D19, #F5F5F5, #F5F5F5);
+	}
+
+	.goods-img {
+		width: 200rpx;
+		height: 200rpx;
+	}
+
+	.right-h {
+		height: 200rpx;
+	}
+
+	.item-but {
+		width: 100%;
+		height: 70rpx;
+		line-height: 70rpx;
+		border-radius: 5rpx 20rpx 20rpx 5rpx;
+		padding: 0 0 0 24rpx;
+	}
+
+	.msq-but {}
+</style>

+ 115 - 63
pages-takeout/help-choose.vue

@@ -2,9 +2,14 @@
 	<view class="flex-common-css iPhone-bottom box-border-box">
 		<Nav :title="school_name"></Nav>
 		<image class="bg-img" src="/pages-takeout/static/bg.png" mode=""></image>
-		<view class="q-box z-2">
-			<view class="qp-box" v-for="(item,index) in shopData">
+		<view class="q-box z-2" ref="qBox">
+			<view v-for="(ball,index) in shopData" :key="index" class="ball flex-direction"
+				:style="{ left: ball.x + 'rpx', top: ball.y + 'rpx' }">
 				<image class="qp-img" src="/pages-takeout/static/qp.png" mode=""></image>
+				<image class="shop-logo z-2 b-rad-20" :src="ball.shop_logo" mode=""></image>
+				<view class="fs-24 fc-f z-2 text-overflow-ellipsis-one max-w-118 text-align-center">
+					{{ball.shop_name}}
+				</view>
 			</view>
 		</view>
 		<view class="but-box">
@@ -22,7 +27,8 @@
 <script>
 	import {
 		shopAll
-	} from "@/api/shop.js"
+	} from "@/api/shop.js";
+
 	export default {
 		components: {},
 		data() {
@@ -30,88 +36,118 @@
 				school_name: '',
 				shopId: 0,
 				shopData: [],
-				animationFrames: [], // 存储每个小球的动画帧信息
+				animationFrameId: null,
+				animations: []
 			};
 		},
 		onLoad(data) {
 			this.school_name = uni.getStorageSync('school_name');
-			this.shopAll()
+			this.getQBoxSize();
+		},
+		mounted() {
+			this.shopAll();
+			this.startAnimation();
 		},
-		mounted() {},
 		methods: {
 			scrolltolower() {
 				console.log('触底');
 			},
-			initBalls() {
-			  const numBalls = 10; // 小球数量
-			  for (let i = 0; i < numBalls; i++) {
-			    this.shopData.push({
-			      colorClass: this.getRandomColorClass(), // 随机颜色类
-			      content: `Ball ${i + 1}`, // 自定义内容
-			      style: {
-			        position: 'absolute',
-			        left: `${Math.random() * window.innerWidth}px`, // 随机初始位置X
-			        top: `${Math.random() * window.innerHeight}px`, // 随机初始位置Y
-			        transform: `translate(-50%, -50%)`, // 居中内容
-			      },
-			      direction: { x: Math.random() * 2 - 1, y: Math.random() * 2 - 1 }, // 随机方向
-			      speed: Math.random() * 2 + 1, // 随机速度
-			    });
-			  }
-			},
-			getRandomColorClass() {
-			  // 根据需要返回随机颜色类名,这里简化为几个预设类
-			  const colors = ['red', 'blue', 'green', 'yellow', 'purple', 'orange'];
-			  return colors[Math.floor(Math.random() * colors.length)];
+			shopAll() {
+				shopAll().then((res) => {
+					if (res.code === 1) {
+						this.shopData = res.data;
+						this.shopData.forEach((v, k) => {
+							const radius = 59; // 小球半径相关大小(这里用宽度等体现,单位rpx)
+							const x = Math.random() * (this.containerWidth - 2 * radius) + radius;
+							const y = Math.random() * (this.containerHeight - 2 * radius) + radius;
+							const speedX = (Math.random() - 0.5) * 5; // 随机生成x方向速度
+							const speedY = (Math.random() - 0.5) * 5; // 随机生成y方向速度
+							v.x = x;
+							v.y = y;
+							v.speedX = speedX;
+							v.speedY = speedY;
+							// 为每个小球创建动画实例
+							const animation = uni.createAnimation({
+								duration: 0,
+								timingFunction: 'linear'
+							});
+							this.animations.push(animation);
+							v.animation = animation;
+						});
+						// console.log(this.shopData);
+					}
+				});
 			},
-			startAnimations() {
-			  // 为每个小球启动动画
-			  this.shopData.forEach((ball, index) => {
-			    setTimeout(() => {
-			      this.animateBall(index);
-			    }, Math.random() * 2000); // 随机延迟开始动画
-			  });
+			startAnimation() {
+				const animate = () => {
+					this.updateBalls();
+					this.animationFrameId = setTimeout(animate, 16); // 确保正确调用 animate 函数
+				};
+				animate();
 			},
-			animateBall(index) {
-			  const ball = this.shopData[index];
-			  let newLeft = parseFloat(ball.style.left) + ball.direction.x * ball.speed;
-			  let newTop = parseFloat(ball.style.top) + ball.direction.y * ball.speed;
-			
-			  // 碰撞检测(边界反弹)
-			  if (newLeft < 0 || newLeft > window.innerWidth - 118) { // 50是假设的小球宽度
-			    ball.direction.x = -ball.direction.x;
-			    newLeft += ball.direction.x * ball.speed * 2; // 反弹后调整位置,避免抖动
-			  }
-			  if (newTop < 0 || newTop > window.innerHeight - 118) { // 50是假设的小球高度
-			    ball.direction.y = -ball.direction.y;
-			    newTop += ball.direction.y * ball.speed * 2; // 反弹后调整位置,避免抖动
-			  }
-			
-			  ball.style.left = `${newLeft}px`;
-			  ball.style.top = `${newTop}px`;
-			
-			  // 使用requestAnimationFrame进行持续动画
-			  this.animationFrames[index] = requestAnimationFrame(() => {
-			    this.animateBall(index);
-			  });
+			updateBalls() {
+				for (const ball of this.shopData) {
+					// 更新小球位置
+					ball.x += ball.speedX;
+					ball.y += ball.speedY;
+					// console.log(`Ball position: x=${ball.x}, y=${ball.y}`); // 打印小球位置信息
 
+					// 处理左右边界碰撞
+					if (ball.x < 0 || ball.x + 2 * 59 > this.containerWidth) {
+						if (ball.x < 0) {
+							ball.x = 0;
+							ball.speedX = Math.abs(ball.speedX);
+						} else {
+							ball.x = this.containerWidth - 2 * 59;
+							ball.speedX = -Math.abs(ball.speedX);
+						}
+					}
+					// 处理上下边界碰撞
+					if (ball.y < 0 || ball.y + 2 * 59 > this.containerHeight) {
+						if (ball.y < 0) {
+							ball.y = 0;
+							ball.speedY = Math.abs(ball.speedY);
+						} else {
+							ball.y = this.containerHeight - 2 * 59;
+							ball.speedY = -Math.abs(ball.speedY);
+						}
+					}
+					// 使用动画更新小球位置
+					ball.animation.translateX(ball.x).translateY(ball.y).step();
+					ball.animation.export();
+					// 直接使用 uni 的动画更新方法
+					uni.createSelectorQuery().in(this).select(`.ball:nth-child(${ball.index + 1})`).boundingClientRect(
+						rect => {
+							if (rect) {
+								ball.animation.export()
+									.translate(ball.x - rect.left, ball.y - rect.top)
+									.step()
+									.update();
+							}
+						}).exec();
+				}
+				// 利用 Vue 的响应式数据绑定自动更新视图,不再使用 $forceUpdate
 			},
-			shopAll() {
-				shopAll().then((res) => {
-					if (res.code === 1) {
-						this.shopData = res.data
+			getQBoxSize() {
+				uni.createSelectorQuery().in(this).select('.q-box').boundingClientRect((rect) => {
+					if (rect) {
+						this.containerWidth = (rect.width) * 2;
+						this.containerHeight = (rect.height) * 2;
 					}
-				})
+				}).exec();
 			}
 		},
 		beforeDestroy() {
-		  // 组件销毁前取消所有动画帧请求
-		  this.animationFrames.forEach(cancelAnimationFrame);
+			// 清除定时器
+			clearTimeout(this.animationFrameId);
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
+	.max-w-118{
+		max-width: 118rpx;
+	}
 	.qp-box-ccc {
 		background: #ccc;
 	}
@@ -129,6 +165,19 @@
 		position: relative;
 	}
 
+	.ball {
+		width: 118rpx;
+		height: 154rpx;
+		position: absolute;
+		padding-top: 28rpx;
+	}
+
+	.shop-logo {
+		width: 68.5rpx;
+		height: 68.5rpx;
+		margin: 0 0 34rpx 29rpx;
+	}
+
 	.bg-img {
 		width: 100%;
 		height: 89%;
@@ -158,5 +207,8 @@
 	.qp-img {
 		width: 118rpx;
 		height: 118rpx;
+		position: absolute;
+		left: 0;
+		top: 0;
 	}
 </style>

+ 262 - 0
pages-takeout/pay-page.vue

@@ -0,0 +1,262 @@
+<template>
+	<view class="flex-common-css iPhone-bottom flex-common-css box-border-box">
+		<Nav title="订单支付" bgckgroundBox='transparent'></Nav>
+		<scroll-view :scroll-y="true" class="box-sizing-border scroll-view-css plr-30 box-border-box">
+			<view class="fs-28 fc-121212 mb-20 p-t-40 text-align-center">
+				剩余时间 {{time.m}}:{{time.s}}
+			</view>
+			<view class="align-items-baseline flex-justify-center mb-40">
+				<view class="fs-40 fw-500 fc-FB3D03">
+					¥
+				</view>
+				<view class="fs-64 fw-500 fc-FB3D03">
+					{{Number(payData.pay_money).toFixed(2)}}
+				</view>
+			</view>
+			<view class="mb-40 text-align-center">
+				订单编号: {{payData.order_sn}}
+			</view>
+			<view class="fs-32 fw-500 fc-3 mb-22">
+				支付方式
+			</view>
+			<view class="plr-16 box-border-box b-rad-20 bgc-f">
+				<view class="align-items-center flex-justify-space p-26-0 b-t-F4" @click="setPayType(3)">
+					<view class="align-items-center">
+						<image class="icon-img mr-16" src="static/ye.png" mode=""></image>
+						<view class="fs-28 fc-333">
+							余额支付
+						</view>
+						<view class="fs-28 fc-707070">
+							(可用{{Number(payData.member_money).toFixed(2)}})
+						</view>
+					</view>
+					<image v-if="payType === 3" class="w-h-36 mr-10" src="@/static/img/common/y-select.png" mode="">
+					</image>
+					<image v-else class="w-h-36 mr-10" src="@/static/img/common/n-select.png" mode=""></image>
+				</view>
+				<view class="align-items-center flex-justify-space p-26-0 b-t-F4" @click="setPayType(1)">
+					<view class="align-items-center">
+						<image class="icon-img mr-16" src="@/static/img/common/wx-zf.png" mode="scaleToFill"></image>
+						<view class="fs-28 fc-333">
+							微信支付
+						</view>
+					</view>
+					<image v-if="payType === 1" class="w-h-36 mr-10" src="@/static/img/common/y-select.png" mode="">
+					</image>
+					<image v-else class="w-h-36 mr-10" src="@/static/img/common/n-select.png" mode=""></image>
+				</view>
+			</view>
+			<view class="fs-32 fw-500 fc-f text-align-center pay-but b-rad-200" @click="paySure"
+				:class="butType === 1?'bgc-4FB3EF':'bgc-9'">
+				立即支付¥{{Number(payData.pay_money).toFixed(2)}}
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import {
+		orderPay
+	} from '@/api/order.js'
+	import {
+		orderPayInfo
+	} from "@/api/order.js"
+	import tools from "@/service/tools.js"
+	export default {
+		data() {
+			return {
+				payType: 1,
+				order_id: 0,
+				isAJAX: false,
+				payData: {},
+				butType: 1,
+				time: {
+					day: '',
+					h: "",
+					m: '',
+					s: '',
+				},
+			}
+		},
+		onLoad(data) {
+			if (data) {
+				this.order_id = data.orderId
+				this.orderPayInfo()
+			}
+		},
+		mounted() {},
+		methods: {
+			orderPayInfo() {
+				orderPayInfo({
+					order_id: this.order_id
+				}).then((res) => {
+					if (res.code === 1) {
+						this.payData = res.data
+						let createDate = new Date(res.data.created_at); //格式化订单创建时候的时间
+						createDate.setMinutes(createDate.getMinutes() + 10)
+						this.setCountDown(createDate)
+					}
+				})
+			},
+			setCountDown(sTime) {
+				let end = new Date(sTime).getTime();
+				let now = new Date().getTime();
+				let msec = end - now;
+				this.time.day = parseInt(msec / 1000 / 60 / 60 / 24);
+				let h = parseInt(msec / 1000 / 60 / 60 % 24);
+				let m = parseInt(msec / 1000 / 60 % 60);
+				let s = parseInt(msec / 1000 % 60);
+				this.time.h = h > 9 ? h : '0' + h;
+				this.time.m = m > 9 ? m : '0' + m;
+				this.time.s = s > 9 ? s : '0' + s;
+				msec -= 1000;
+				if (this.time.day >= 1) {
+					this.showTime = true;
+				} else {
+					this.showTime = false;
+				};
+				if (msec >= 0) {
+					setTimeout(() => {
+						this.setCountDown(sTime);
+					}, 1000);
+				} else {
+					this.isTimeEnd = true;
+					this.bText = '活动结束';
+					this.time.h = '--';
+					this.time.m = '--';
+					this.time.s = '--';
+				};
+			},
+			setPayType(payType) {
+				this.payType = payType
+				if (payType === 3) {
+					if (Number(this.payData.member_money) < Number(this.payData.pay_money)) {
+						this.butType = 2
+					} else {
+						this.butType = 1
+					}
+				} else {
+					this.butType = 1
+				}
+			},
+			paySure() {
+				if (this.butType === 2) {
+					return
+				}
+				orderPay({
+					order_id: this.order_id,
+					pay_type: this.payType
+				}).then((ret) => {
+					if (ret.code === 1) {
+						if (this.payType === 1) {
+							uni.requestPayment({
+								provider: "wxpay", //支付类型-固定值
+								timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
+								nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
+								package: ret.data.wx_pay.package, // 固定值
+								signType: ret.data.wx_pay.signType, //固定值
+								paySign: ret.data.wx_pay.paySign, //签名
+								success: (ren) => {
+									uni.removeStorageSync('isConfirmAddressFlag')
+									tools.success("支付成功");
+									this.isAJAX = false;
+									setTimeout(() => {
+										uni.switchTab({
+											url: '/pages/order/index'
+										})
+										uni.setStorageSync('orderPayType', 1)
+									}, 1000)
+								},
+								fail: (err) => {
+									uni.removeStorageSync('isConfirmAddressFlag')
+									this.isAJAX = false;
+									tools.error("支付失败");
+									setTimeout(() => {
+										uni.switchTab({
+											url: '/pages/order/index'
+										})
+										uni.setStorageSync('orderPayType', 1)
+									}, 1000)
+								},
+							});
+						} else if (this.payType === 3) {
+							uni.removeStorageSync('isConfirmAddressFlag')
+							tools.success("支付成功");
+							this.isAJAX = false;
+							setTimeout(() => {
+								uni.switchTab({
+									url: '/pages/order/index'
+								})
+								uni.setStorageSync('orderPayType', 1)
+							}, 1000)
+						}
+					} else {
+						uni.removeStorageSync('isConfirmAddressFlag')
+						this.isAJAX = false;
+						tools.error("支付失败");
+						setTimeout(() => {
+							uni.switchTab({
+								url: '/pages/order/index'
+							})
+							uni.setStorageSync('orderPayType', 1)
+						}, 1000)
+					}
+				})
+			}
+		},
+	}
+</script>
+<style lang="scss" scoped>
+	.pop-box {
+		width: 80vw;
+		height: 30vh;
+	}
+
+	.p-t-40 {
+		padding: 40rpx 0 0;
+	}
+
+	.p-12-30 {
+		padding: 12rpx 30rpx;
+	}
+
+	.p-23-16 {
+		padding: 23rpx 16rpx;
+	}
+
+	.plr-16 {
+		padding: 0 16rpx;
+	}
+
+	.p-26-0 {
+		padding: 26rpx 0;
+	}
+
+	.icon-img {
+		width: 40rpx;
+		height: 40rpx;
+	}
+
+	.w-h-36 {
+		width: 36rpx;
+		height: 36rpx;
+	}
+
+	.pay-but {
+		width: 100%;
+		height: 80rpx;
+		line-height: 80rpx;
+		margin: 30rpx auto;
+	}
+
+	.pop-but {
+		width: 80%;
+		padding: 24rpx 0;
+		margin: auto;
+
+		.add-card {
+			width: 40rpx;
+			height: 40rpx;
+		}
+	}
+</style>

+ 131 - 0
pages-takeout/seckill.vue

@@ -0,0 +1,131 @@
+<template>
+	<view class="flex-common-css iPhone-bottom  box-border-box seckill-box">
+		<Nav title="限时秒杀" bgckgroundBox='transparent' leftColor='#fff' titleColor='#fff'></Nav>
+		<scroll-view :scroll-y="true" class="scroll-view-css p-24 box-border-box" @scrolltolower="scrolltolower">
+			<view class="head-box b-rad-20 bgc-f mb-18 align-items-center flex-justify-center">
+				<view class="fc-213C45 fs-40 fw-b mr-14 fs-i l-s-2">
+					限时秒杀
+				</view>
+				<view class="fc-213C45 fs-40 fw-b fs-i l-s-2">
+					疯狂<text class="fc-FF6320 fs-40 fw-b fs-i l-s-2">抢购</text>
+				</view>
+			</view>
+			<view class="b-rad-20 bgc-f mb-10 p-24 box-border-box align-items-flex-start"
+				v-for="(item,index) in goodsData" :key="index" @click="goToUrl(item)">
+				<image class="goods-img flex-shrink0 mr-20 b-rad-12" :src="item.goods_image" mode="aspectFill"></image>
+				<view class="flex-1 right-h flex-direction flex-justify-space">
+					<view class="">
+						<view class="fs-30 fw-600 fc-0 mb-10 text-overflow-ellipsis">
+							{{item.goods_name}}
+						</view>
+						<view class="align-items-center">
+							<uni-icons type="shop" size="15" color="#666" class="mr-4"></uni-icons>
+							<view class="fs-26 fc-6">
+								{{item.shop_name}}
+							</view>
+						</view>
+					</view>
+					<view class="item-but align-items-center flex-justify-space bgc-FDF3EC box-border-box">
+						<view class="align-items-center">
+							<view class="fs-28 fw-600 fc-F43D04 mr-14">
+								¥ <text class="fs-30 fw-600 fc-F43D04">{{Number(item.seckill_money).toFixed(2)}}</text>
+							</view>
+							<view class="fs-24 fc-a text-line-through">
+								¥{{Number(item.line_price).toFixed(2)}}
+							</view>
+						</view>
+						<view class="fs-28 fc-f msq-but plr-24 box-border-box bgc-EB5127 b-rad-20">
+							马上抢
+						</view>
+					</view>
+				</view>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import {
+		seckillAllGoods
+	} from "@/api/seckill.js"
+	import {
+		shopInfo,
+	} from "@/api/shop.js"
+	export default {
+		components: {},
+		data() {
+			return {
+				goodsData: [],
+				page: 1,
+				total: 0
+			};
+		},
+		onLoad(data) {},
+		mounted() {
+			this.seckillAllGoods()
+		},
+		methods: {
+			goToUrl(item) {
+				shopInfo({
+					shop_id: item.shop_id
+				}).then((res) => {
+					if (res.code == 1) {
+						uni.navigateTo({
+							url: '/pages-takeout/shop?shop_id=' + item.shop_id + '&category_id=' + item
+								.category_id + '&goods_id=' + item.goods_id
+						})
+					} else {
+						tools.error(res.msg)
+					}
+				})
+			},
+			scrolltolower() {
+				if (this.total > this.goodsData.length) {
+					++this.page
+					this.scrolltolower()
+				}
+			},
+			seckillAllGoods() {
+				seckillAllGoods({
+					page: this.page
+				}).then((res) => {
+					if (res.code === 1) {
+						this.goodsData.push(...res.data.items)
+						this.total = res.data.total
+					}
+				})
+			}
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	.seckill-box {
+		background: linear-gradient(to bottom, rgba(0, 170, 255, 0.6), #F5F5F5, #F5F5F5);
+	}
+
+	.head-box {
+		width: 100%;
+		height: 100rpx;
+		line-height: 100rpx;
+	}
+
+	.goods-img {
+		width: 200rpx;
+		height: 200rpx;
+	}
+
+	.right-h {
+		height: 200rpx;
+	}
+
+	.item-but {
+		width: 100%;
+		height: 70rpx;
+		line-height: 70rpx;
+		border-radius: 5rpx 20rpx 20rpx 5rpx;
+		padding: 0 0 0 24rpx;
+	}
+
+	.msq-but {}
+</style>

+ 121 - 82
pages-takeout/shop-mod/menu.vue

@@ -81,12 +81,14 @@
 				</view>
 				<scroll-view scroll-y="true" class="scroll-view-css box-border-box plr-32">
 					<view class="" v-for="(item,i) in popData.spec_attr" :key="i">
-						<view class="fs-32 fw-500 fc-0 mb-32">{{item.group_name}}</view>
-						<view class="flex-wrap-wrap">
+						<view class="fs-32 fw-500 fc-0 mb-32">{{item.sku_name}}</view>
+						<view class="flex-wrap-wrap w-m">
 							<view class="spec-item text-align-center fs-28"
-								:class="popData.spec_ids.indexOf(info.item_id)>=0?'s-item':'n-item'"
-								v-for="(info,k) in item.spec_items" :key="k" @click="selectSpec(info,i)">
-								{{info.spec_value}}
+								:class="popData.spec_ids.indexOf(info.spec_id)>=0?'s-item':'n-item'"
+								v-for="(info,k) in item.spec_list" :key="k" @click="selectSpec(info,i)">
+								{{info.spec_name}} <text class="fc-FB3D03 fs-26"
+									v-if="Number(info.spec_price) > 0"><text
+										class="plr-10">|</text>¥{{Number(info.spec_price).toFixed(2)}}</text>
 							</view>
 						</view>
 					</view>
@@ -108,7 +110,7 @@
 						<view class="pop-buttom-left">
 							<view class="">
 								<span class="fw-600 fs-32 fc-ED301D">¥</span>
-								<span class="fw-600 fs-48 fc-ED301D">{{popData.price}}</span>
+								<span class="fw-600 fs-48 fc-ED301D">{{Number(popData.price).toFixed(2)}}</span>
 							</view>
 							<view class="">
 								<span class="fw-400 fs-24 fc-9">已选规格:</span>
@@ -138,6 +140,7 @@
 		shopGoodsSpec
 	} from "@/api/shop";
 	import {
+		shoppingSave,
 		getShopIngList,
 		setShopIngAdd,
 		setShopIngDel,
@@ -204,7 +207,8 @@
 		},
 		methods: {
 			setSpecNum(type) {
-				if (!this.popData.goods_spec_id) {
+				// this.popData.spec_ids
+				if (!this.popData.spec_key) {
 					console.log('被阻挡');
 					tools.error('请选择规格')
 					return;
@@ -212,7 +216,7 @@
 				if (type === 1) {
 					// 减
 					console.log('减');
-					if (this.popData.num > 0) {
+					if (this.popData.num > 1) {
 						--this.popData.num;
 						this.$forceUpdate()
 					} else {
@@ -236,41 +240,47 @@
 
 			},
 			getShopGoodsSpec(item) {
+				console.log(item,'item');
 				shopGoodsSpec({
 					'goods_id': item.goods_id
 				}).then(res => {
+					console.log(item,'item');
 					this.popData.goodsItem = item
 					if (this.popData.goods_id !== item.goods_id) {
 						this.popData.goods_id = item.goods_id
 						this.popData.spec_name = []
-						this.popData.price = '0.00'
+						// this.popData.price = '0.00'
+						this.popData.price = item.price
 						this.popData.line_price = ''
 						this.popData.spec_key = ''
 						this.popData.num = 1
 						this.popData.spec_ids = []
 					} else {
+						console.log('无');
 						this.popData.num = 1;
+						// this.popData.price = item.price
 						if (this.cartData.goods_list.length > 0) {
 							this.cartData.goods_list.forEach(item => {
-								if (item.spec_sku_id === this.popData.spec_key) {
-									this.popData.num = item.goods_number
+								if (item.goods_spec_id === this.popData.spec_key) {
+									this.popData.num = this.selectedSpecification.goods_number
 								}
 							})
 						}
 					}
-					this.popData.spec_list = res.data.spec_list
-					this.popData.spec_attr = res.data.spec_attr
-					console.log(this.selectedSpecification, '+++++++++++++++++');
+					this.popData.spec_list = res.data
+					this.popData.spec_attr = res.data
+					console.log(this.selectedSpecification,'this.selectedSpecification');
 					this.selectedSpecification.forEach((v, k) => {
 						if (v.goods_id === item.goods_id) {
 							v.goodsItem = item
-							v.spec_list = res.data.spec_list
-							v.spec_attr = res.data.spec_attr
+							v.spec_list = res.data
+							v.spec_attr = res.data
+							v.num = v.goods_number
 							let data = JSON.parse(JSON.stringify(v))
 							this.popData = data
 						}
 					})
-					console.log(this.popData, '********************');
+					console.log(this.popData,'this.popData');
 					this.$refs.popupGG.open();
 					this.setGoodsSpecPrice()
 					this.isAjax = false
@@ -286,30 +296,31 @@
 					spec_ids.sort((a, b) => a - b);
 					let spec_key = spec_ids.join('_')
 					this.popData.spec_key = spec_key
-					console.log('this.popData.spec_list[spec_key]', this.popData.spec_list[spec_key])
-					if (this.popData.spec_list[spec_key] !== undefined) {
-						this.popData.price = this.popData.spec_list[spec_key].seckill_money > 0 ? this.popData.spec_list[
-							spec_key].seckill_money : this.popData.spec_list[spec_key].price
-						this.popData.line_price = this.popData.spec_list[spec_key].line_price
-						if (this.popData.goods_spec_id !== this.popData.spec_list[spec_key].goods_spec_id + '') {
-							this.popData.num = 1
-						}
-						this.popData.goods_spec_id = this.popData.spec_list[spec_key].goods_spec_id + ''
-						let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id * 1 === row
-							.goods_spec_id * 1)
-						if (cartKey >= 0) {
-							this.popData.num = this.cartData.goods_list[cartKey].goods_number
-						}
-					} else {
-						this.popData.line_price = '0.00'
-						this.popData.price = '0.00'
-						this.popData.num = 0
-						this.popData.goods_spec_id = ''
-					}
+					console.log(this.popData.spec_key, 'okokokokkoko');
+					console.log('this.popData.spec_attr[spec_key]', this.popData.spec_attr[spec_key])
+					// if (this.popData.spec_list[spec_key] !== undefined) {
+					// 	this.popData.price = this.popData.spec_list[spec_key].seckill_money > 0 ? this.popData.spec_list[
+					// 		spec_key].seckill_money : this.popData.spec_list[spec_key].price
+					// 	this.popData.line_price = this.popData.spec_list[spec_key].line_price
+					// 	if (this.popData.goods_spec_id !== this.popData.spec_list[spec_key].goods_spec_id + '') {
+					// 		this.popData.num = 1
+					// 	}
+					// 	this.popData.goods_spec_id = this.popData.spec_list[spec_key].goods_spec_id + ''
+					// 	let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id * 1 === row
+					// 		.goods_spec_id * 1)
+					// 	if (cartKey >= 0) {
+					// 		this.popData.num = this.cartData.goods_list[cartKey].goods_number
+					// 	}
+					// } else {
+					// 	this.popData.line_price = '0.00'
+					// 	this.popData.price = '0.00'
+					// 	this.popData.num = 0
+					// 	this.popData.goods_spec_id = ''
+					// }
 				} else {
-					this.popData.price = '0.00'
-					this.popData.line_price = '0.00'
-					this.popData.num = 0
+					// this.popData.price = '0.00'
+					// this.popData.line_price = '0.00'
+					this.popData.num = 1
 					this.popData.goods_spec_id = ''
 				}
 			},
@@ -327,7 +338,7 @@
 						let data = res.data
 						data.goods_list.forEach((v, k) => {
 							let ge = JSON.parse(JSON.stringify(v))
-							ge.spec_ids = ge.spec_sku_id.split('_').map(item => Number(item.trim()))
+							ge.spec_ids = ge.goods_spec_id.split('_').map(item => Number(item.trim()))
 							ge.spec_name = ge.goods_attr.split(',').map(item => item.trim())
 							this.selectedSpecification.push(ge)
 						})
@@ -472,7 +483,8 @@
 
 				} else if (type === 3) {
 					// 选规格
-					console.log(item)
+					console.log(item,'000000000')
+					console.log(this.selectedSpecification,'1111111111111');
 					this.selectedSpecification.forEach((v, k) => {
 						if (v.goods_id === item.goods_id) {
 							v.quota_num = item.quota_num
@@ -489,36 +501,31 @@
 				} else {
 					let data = JSON.parse(JSON.stringify(this.popData))
 					this.selectedSpecification.push(data)
-					this.$refs.popupGG.close();
-					console.log('this.popData.goods_spec_id')
-					console.log(this.popData)
-					console.log(this.selectedSpecification, 'this.___________________________');
-					if (this.popData.goods_spec_id) {
-						if (this.popData.is_infinite === 0 && this.popData.payNum > this.popData.stock) {
-							tools.error('商品库存' + this.popData.stock + '件')
-							this.popData.num = this.popData.stock
-						} else if (this.popData.is_quota > 0 && this.popData.payNum > this.popData.quota_num) {
-							tools.error('限购' + this.popData.quota_num + '件')
-							this.popData.num = this.popData.quota_num
-						} else {
-							let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id === row
-								.goods_spec_id)
-							console.log(cartKey)
-							let addType = this.popData.num > 0 ? 2 : 1
-							console.log('addType:' + addType)
-							if (addType === 2 && cartKey < 0) {
-								this.setShopIngAdd(this.popData.goods_id, this.popData.goodsItem.category_id, this.popData
-									.goods_spec_id, this.popData.num)
-							} else {
-								this.setShopIngNumber(this.popData.goods_id, this.popData.goodsItem.category_id, type, this
-									.popData
-									.goods_spec_id, this.popData.num)
-							}
-						}
-
-					} else {
-						console.log('无规格信息')
-					}
+					console.log(this.popData, "666666666666666666")
+					console.log('1', this.popData.goods_id, this.shop_id, this.popData.goodsItem.category_id, this.popData.spec_key, this.popData.num);
+					this.setShoppingSave()
+					// if (this.popData.goods_spec_id) {
+					// 	if (this.popData.is_infinite === 0 && this.popData.payNum > this.popData.stock) {
+					// 		tools.error('商品库存' + this.popData.stock + '件')
+					// 		this.popData.num = this.popData.stock
+					// 	} else if (this.popData.is_quota > 0 && this.popData.payNum > this.popData.quota_num) {
+					// 		tools.error('限购' + this.popData.quota_num + '件')
+					// 		this.popData.num = this.popData.quota_num
+					// 	} else {
+					// 		let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id === row.goods_spec_id)
+					// 		console.log(cartKey)
+					// 		let addType = this.popData.num > 0 ? 2 : 1
+					// 		console.log('addType:' + addType)
+					// 		if (addType === 2 && cartKey < 0) {
+					// 			this.setShopIngAdd(this.popData.goods_id, this.popData.goodsItem.category_id, this.popData
+					// 				.goods_spec_id, this.popData.num)
+					// 		} else {
+					// 			this.setShopIngNumber(this.popData.goods_id, this.popData.goodsItem.category_id, type, this.popData.goods_spec_id, this.popData.num)
+					// 		}
+					// 	}
+					// } else {
+					// 	console.log('无规格信息')
+					// }
 					this.isAjax = false
 				}
 			},
@@ -533,6 +540,24 @@
 					this.setShopIngNumber(item.goods_id, item.category_id, type, '', 1, item)
 				}
 			},
+			setShoppingSave() {
+				shoppingSave({
+					type: 1,
+					goods_id: this.popData.goods_id,
+					shop_id: this.shop_id,
+					category_id: this.popData.goodsItem.category_id,
+					goods_spec_id: this.popData.spec_key,
+					number: this.popData.num
+				}).then((res) => {
+					if(res.code === 1) {
+						tools.success(res.msg)
+						this.$refs.popupGG.close();
+						this.getShopIngList()
+					} else {
+						tools.error(res.msg)
+					}
+				})
+			},
 			setShopIngAdd(goodsId, categoryId, goodsSpecId, number, item) {
 				setShopIngAdd({
 					'type': 1,
@@ -604,20 +629,30 @@
 			setShopIngDel() {},
 			// -------弹窗选择规格-----------
 			selectSpec(info, groupKey) {
-				let specKey = this.popData.spec_ids.indexOf(info.item_id)
+				let specKey = this.popData.spec_ids.indexOf(info.spec_id)
 				if (specKey >= 0) {
 					this.popData.spec_ids.splice(specKey, 1)
 					this.popData.spec_name.splice(specKey, 1)
+					if (Number(info.spec_price) > 0) {
+						this.popData.price = Number(this.popData.price) - Number(info.spec_price)
+					}
 				} else {
-					this.popData.spec_ids.push(info.item_id)
-					this.popData.spec_name.push(info.spec_value)
-					for (const attrKey in this.popData.spec_attr[groupKey].spec_items) {
-						if (this.popData.spec_attr[groupKey].spec_items[attrKey].item_id !== info.item_id) {
-							let oldKey = this.popData.spec_ids.indexOf(this.popData.spec_attr[groupKey].spec_items[attrKey]
-								.item_id)
+					this.popData.spec_ids.push(info.spec_id)
+					this.popData.spec_name.push(info.spec_name)
+					if (Number(info.spec_price) > 0) {
+						this.popData.price = Number(this.popData.price) + Number(info.spec_price)
+					}
+					for (const attrKey in this.popData.spec_attr[groupKey].spec_list) {
+						if (this.popData.spec_attr[groupKey].spec_list[attrKey].spec_id !== info.spec_id) {
+							let oldKey = this.popData.spec_ids.indexOf(this.popData.spec_attr[groupKey].spec_list[attrKey]
+								.spec_id)
 							if (oldKey >= 0) {
 								this.popData.spec_ids.splice(oldKey, 1)
 								this.popData.spec_name.splice(oldKey, 1)
+								if (Number(info.spec_price) > 0) {
+									this.popData.price = Number(this.popData.price) - Number(this.popData.spec_attr[
+										groupKey].spec_list[attrKey].spec_price)
+								}
 							}
 						}
 					}
@@ -795,6 +830,10 @@
 				}
 			}
 
+			.w-m {
+				width: calc(100% + 30rpx);
+			}
+
 			.spec-item {
 				min-width: 210rpx;
 				height: 66rpx;
@@ -805,9 +844,9 @@
 				padding: 0 10rpx;
 			}
 
-			.spec-item:nth-child(3) {
-				margin-right: 0rpx !important;
-			}
+			// .spec-item:nth-child(3) {
+			// 	margin-right: 0rpx !important;
+			// }
 
 			.s-item {
 				background-color: #ECF7FE;

+ 28 - 22
pages-takeout/shop.vue

@@ -86,8 +86,7 @@
 				<view class="buy-card-top box-border-box plr-32 flex-justify-space align-items-center">
 					<view class="">
 						<span class="fs-32 fc-3 mr-12">已选商品</span>
-						<span class="fs-32 fc-9">(打包费<span
-								class="fs-32 fc-FB3D03">{{cartData.pack_price}}元</span>)</span>
+						<span class="fs-32 fc-9">(打包费<span class="fs-32 fc-FB3D03">{{cartData.pack_price}}元</span>)</span>
 					</view>
 					<view class="fs-28 fw-400 fc-9 align-items-center" @click.stop="setShopIngDel">
 						<view class="">
@@ -103,8 +102,7 @@
 							<view class="w-514 text-overflow-ellipsis-one fs-34 fw-600 mb-12">
 								{{goods.goods_name}}
 							</view>
-							<view class="w-514 text-overflow-ellipsis-one fs-24 fw-400 mb-18"
-								:class="goods.status_str?'fc-FD5C02':'fc-9'">
+							<view class="w-514 text-overflow-ellipsis-one fs-24 fw-400 mb-18" :class="goods.status_str?'fc-FD5C02':'fc-9'">
 								{{goods.status_str?goods.status_str:goods.goods_attr}}
 							</view>
 							<view class="flex-justify-space">
@@ -113,14 +111,14 @@
 									<span class="fs-40 fc-FB3D03 fw-b">{{goods.price}}</span>
 								</view>
 								<view class="display-flex align-items-center">
-									<image class="wh-44" @click.stop="setShopIngNumber(goods,2)"
+									<image class="wh-44" @click.stop="setShoppingSave(goods,2)"
 										src="@/static/img/takeout/j.png" mode="">
 									</image>
 									<view class="right-only-right-2 text-align-center fs-28 fw-400">
 										{{goods.goods_number}}
 									</view>
 									<image class="wh-44" src="@/static/img/takeout/add.png"
-										@click.stop="setShopIngNumber(goods,1)" mode=""></image>
+										@click.stop="setShoppingSave(goods,1)" mode=""></image>
 								</view>
 							</view>
 						</view>
@@ -213,7 +211,7 @@
 	import {
 		getShopIngList,
 		setShopIngDel,
-		setShopIngNumber
+		shoppingSave
 	} from "@/api/shopping";
 	export default {
 		components: {
@@ -268,7 +266,7 @@
 				const goodsId = {
 					goodsId: Number(e.goods_id)
 				}
-				console.log(item,goodsId, '00000000000');
+				console.log(item, goodsId, '00000000000');
 				uni.setStorageSync('category_id', item)
 				uni.setStorageSync('goods_id', goodsId)
 				this.shopInfo()
@@ -309,33 +307,41 @@
 					}
 				});
 			},
-			setShopIngNumber(item, type) {
+			setShoppingSave(item, type) {
+				if(type === 1) {
+					// 加
+					item.goods_number = item.goods_number + 1
+				}else{
+					// 减
+					item.goods_number = item.goods_number - 1
+				}
 				if (this.isAjax) {
 					return
 				}
 				this.isAjax = true
-				setShopIngNumber({
+				shoppingSave({
 					'type': 1,
 					'goods_id': item.goods_id,
 					'shop_id': this.shop_id,
 					'category_id': item.category_id,
 					'goods_spec_id': item.goods_spec_id,
-					'operation': type === 1 ? 1 : 2,
+					'number': item.goods_number,
 				}).then(res => {
 					if (res.code == 1) {
 						this.isAjax = false
 						this.getShopIngList()
-					} else if (res.code === 2) {
-						tools.error(res.msg)
-						this.isAjax = false
-						this.getShopIngList()
-					} else {
-						tools.error(res.msg)
-						this.isAjax = false
-						setTimeout(() => {
-							this.getShopIngList()
-						}, 1400)
-					}
+					} 
+					// else if (res.code === 2) {
+					// 	tools.error(res.msg)
+					// 	this.isAjax = false
+					// 	this.getShopIngList()
+					// } else {
+					// 	tools.error(res.msg)
+					// 	this.isAjax = false
+					// 	setTimeout(() => {
+					// 		this.getShopIngList()
+					// 	}, 1400)
+					// }
 				}).catch(() => {
 					this.isAjax = false
 				})

BIN
pages-takeout/static/bg.png


BIN
pages-takeout/static/ye.png


+ 11 - 6
pages-takeout/takeout.vue

@@ -66,10 +66,12 @@
 											<view class="fc-6 fs-24 mr-12">{{item.shop_sales}}人购买</view>
 										</view>
 										<view class="align-items-center flex-wrap-wrap">
-											<view class="quan-list display-flex mr-12 mb-12"
-												v-for="(itemCoupon,iCoupon) in item.coupon" :key="iCoupon">
-												<view class="quan-list-1 fs-24 fc-f">券</view>
-												<view class="quan-list-2 fs-24 fc-FB3D03">{{itemCoupon.money}}元</view>
+											<view
+												class="quan-list b-F5541E box-border-box bgc-f align-items-center b-rad-5 mr-10"
+												v-for="(info1,index1) in item.coupon" :key="index1">
+												<image class="quan-list-1" src="@/static/img/index/q.png" mode="">
+												</image>
+												<view class="quan-list-2 fs-24 fc-F5531E">{{info1.money}}元</view>
 											</view>
 										</view>
 									</view>
@@ -105,7 +107,8 @@
 						</template>
 					</EnBlank>
 					<view class="" v-else>
-						<view class="goos-list-box box-border-box" v-for="(item,i) in listData" :key='i' @click="toShop(item)">
+						<view class="goos-list-box box-border-box" v-for="(item,i) in listData" :key='i'
+							@click="toShop(item)">
 							<view class="display-flex p-b-20 mb-26 b-b-EFF2F5">
 								<view class="left-img-box mr-24">
 									<image class="left-img" :src="item.shop_logo" mode="aspectFill"></image>
@@ -128,7 +131,9 @@
 										<view class="fc-0 fs-24 mr-12">{{item.shop_sales}}人购买</view>
 									</view>
 									<view class="align-items-center flex-wrap-wrap">
-										<view class="quan-list b-F5541E box-border-box bgc-f align-items-center b-rad-5 mr-10" v-for="(info1,index1) in item.coupon" :key="index1">
+										<view
+											class="quan-list b-F5541E box-border-box bgc-f align-items-center b-rad-5 mr-10"
+											v-for="(info1,index1) in item.coupon" :key="index1">
 											<image class="quan-list-1" src="@/static/img/index/q.png" mode=""></image>
 											<view class="quan-list-2 fs-24 fc-F5531E">{{info1.money}}元</view>
 										</view>

+ 28 - 4
pages.json

@@ -224,11 +224,35 @@
 						"navigationBarTitleText": "商品提交订单"
 					}
 				},
+				{
+					"path": "pay-page",
+					"style": {
+						"navigationBarTitleText": "订单支付"
+					}
+				},
 				{
 					"path": "help-choose",
 					"style": {
 						"navigationBarTitleText": "君子帮选"
 					}
+				},
+				{
+					"path": "1212",
+					"style": {
+						"navigationBarTitleText": "君子帮选"
+					}
+				},
+				{
+					"path": "seckill",
+					"style": {
+						"navigationBarTitleText": "限时秒杀"
+					}
+				},
+				{
+					"path": "group-goods",
+					"style": {
+						"navigationBarTitleText": "优质团购"
+					}
 				}
 			]
 		},
@@ -442,13 +466,13 @@
 		"current": 0,
 		"list": [{
 				"name": "列表调试",
-				"path": "pages-takeout/help-choose",
-				"query": "shop_id=23"
+				"path": "pages-takeout/shop",
+				"query": "shop_id=2"
 			},
 			{
 				"name": "店铺详情",
-				"path": "pages-buy/ticket",
-				"query": "shop_id=1"
+				"path": "pages-takeout/pay-page",
+				"query": "orderId=4"
 			}
 		]
 	}

+ 13 - 3
pages/index/index.vue

@@ -84,7 +84,7 @@
 					<image class="tj-bg" src="@/static/img/index/tj-bg.png" mode=""></image>
 					<view class="align-items-center flex-justify-space z-2 mb-26 pr-24 box-border-box">
 						<image class="xsms-img" src="@/static/img/index/xsms.png" mode=""></image>
-						<view class="align-items-center">
+						<view class="align-items-center" @click="goAllSeckill">
 							<view class="fs-24 fc-9 mr-6">
 								更多
 							</view>
@@ -178,7 +178,7 @@
 							</view>
 						</view>
 					</view>
-					<view class="text-align-center fs-24 fc-9 z-2">
+					<view class="text-align-center fs-24 fc-9 z-2" @click="goTogrup">
 						查看更多
 					</view>
 				</view>
@@ -825,7 +825,7 @@
 				} else if (type === 4) {
 					// 君子帮选
 					uni.navigateTo({
-						url: '/pages-takeout/help-choose'
+						url: '/pages-takeout/1212'
 					})
 				} else if (type === 5) {
 					// 去团购
@@ -859,6 +859,16 @@
 					url: '/pages-address/select-school?type=1'
 				})
 			},
+			goTogrup() {
+				uni.navigateTo({
+					url: '/pages-takeout/group-goods'
+				})
+			},
+			goAllSeckill() {
+				uni.navigateTo({
+					url: '/pages-takeout/seckill'
+				})
+			},
 			toShop(item) {
 				const operate_id = uni.getStorageSync('operate_id')
 				shopInfo({

+ 4 - 0
pages/order/index.vue

@@ -804,6 +804,10 @@
 			},
 			takeawayPay(id) {
 				// 外卖支付
+				uni.redirectTo({
+					url: `/pages-takeout/pay-page?orderId=${id}`
+				});
+				return
 				if (this.isAJAX) {
 					return
 				}

+ 5 - 0
yarn.lock

@@ -53,6 +53,11 @@
   "resolved" "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz"
   "version" "1.6.0"
 
+"matter-js@^0.20.0":
+  "integrity" "sha512-iC9fYR7zVT3HppNnsFsp9XOoQdQN2tUyfaKg4CHLH8bN+j6GT4Gw7IH2rP0tflAebrHFw730RR3DkVSZRX8hwA=="
+  "resolved" "https://registry.npmmirror.com/matter-js/-/matter-js-0.20.0.tgz"
+  "version" "0.20.0"
+
 "nanoid@^3.3.4":
   "integrity" "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw=="
   "resolved" "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz"