From e4eb2e184ca2b1d84f19a4c5cbbc24d1c45ce610 Mon Sep 17 00:00:00 2001
From: wangfukang <15630117759@163.com>
Date: Sun, 29 Mar 2026 15:51:20 +0800
Subject: [PATCH] 1
---
package1/buyFood/buyFood.vue | 33 +++--
package1/group/groupBuySingle.vue | 220 ++++++++++++++++++++++++------
2 files changed, 194 insertions(+), 59 deletions(-)
diff --git a/package1/buyFood/buyFood.vue b/package1/buyFood/buyFood.vue
index 276674d..15263ca 100644
--- a/package1/buyFood/buyFood.vue
+++ b/package1/buyFood/buyFood.vue
@@ -179,7 +179,7 @@
- X2
+ X1
{
- that.handlePaymentSuccess();
- }, 1500);
+ uni.showToast({ title: '支付成功', icon: 'success' });
+ that.tui.request("/api/wechat/pay/paySuccess", "POST", {
+ outTradeNo: that.currentOrderId
+ }, false, false).then((res3) => {
+ if(res3.code == 200){
+ that.handlePaymentSuccess();
+ }else{
+ that.tui.toast("订单创建失败,请联系客服处理");
+ }
+ })
+
},
fail: function(err) {
that.tui.toast("支付失败或取消");
@@ -717,19 +720,15 @@
this.$refs.pintuanPopup.open('center');
} else if (isJoining) {
uni.redirectTo({
- url: '/package1/order/pendGroup?groupId=' + this.groupItem.groupId
+ url: '/package1/order/orderDetail?id=' + this.currentOrderId
});
}
}
},
onPintuanPopupChange(e) {
- if (!e.show && this.isPaymentSuccessGroupInitiate) {
- // 跳转到 pendGroup
- let groupId = this.createdOrderInfo?.groupId || this.createdOrderInfo?.groupDeliveryOrderId || this.createdOrderInfo?.id || this.currentOrderId;
- uni.redirectTo({
- url: `/package1/order/pendGroup?groupId=${groupId}`
- });
- }
+ uni.redirectTo({
+ url: '/package1/order/orderDetail?id=' + this.currentOrderId
+ });
},
getMustFinishTime() {
if (!this.formData.deliveryTime || this.formData.deliveryTime === '自动送达' || this.formData.deliveryTime ===
diff --git a/package1/group/groupBuySingle.vue b/package1/group/groupBuySingle.vue
index 6b3da06..21ad1fd 100644
--- a/package1/group/groupBuySingle.vue
+++ b/package1/group/groupBuySingle.vue
@@ -56,36 +56,37 @@
公告:{{shopItem.remark}}
-
+
-
-
-
+
+
+
+
+
+
+
+ {{item.productName}}
+
+
+ 拼团¥{{item.groupPrice}}
+
+
-
-
- {{item.productName}}
+
+
+
+ +
-
- 拼团¥{{item.groupPrice}}
+
+ 差{{item.targetMembers - item.currentMembers}}人拼成
-
-
-
-
- +
-
-
- 差{{item.targetMembers - item.currentMembers}}人拼成
-
-
@@ -117,14 +118,14 @@
月售 100+
-
+
+
- 差12人拼成
+ 差{{item.minGroupCount}}人拼成
@@ -268,10 +269,6 @@
¥{{currentItem.attributeListPrice | sliceMsg}}
-
- 拼团¥{{currentItem.productGroupBuyPrices | slicePrice}}
-
@@ -337,20 +334,20 @@
+ @tap.stop="submitPintuan(true)">
面对面团
- 发起拼团¥{{selectedGroupRule && selectedGroupRule.groupPrice ? parseFloat(selectedGroupRule.groupPrice).toFixed(2) : '0.00'}}
+ @tap.stop="submitPintuan(false)">
+ 发起拼团¥{{selectedGroupRule && selectedGroupRule.groupPrice ? parseFloat(selectedGroupRule.groupPriceAndMore).toFixed(2) : '0.00'}}
- 参与拼团¥{{selectedGroupRule && selectedGroupRule.groupPrice ? parseFloat(selectedGroupRule.groupPrice).toFixed(2) : '0.00'}}
+ @tap.stop="submitPintuan(false)">
+ 参与拼团¥{{selectedGroupRule && selectedGroupRule.groupPriceAndMore ? parseFloat(selectedGroupRule.groupPriceAndMore).toFixed(2) : '0.00'}}
@@ -369,6 +366,9 @@
快来加入一起成团吧!
+
+ 可以选取任意拼团商品下单!
+
@@ -389,7 +389,7 @@
-
+
去拼单
@@ -417,7 +417,10 @@
若拼团失败,将会为您自动退款
- 包含打包费 {{currentItem.lunchBox}} 元 配送费(均摊) {{tuanzhangOrder.deliveryFee}} 元
+ 配送费(均摊) {{tuanzhangOrder.deliveryFee}} 元
+
+
+ 包含打包费 {{currentItem.lunchBox}} 元
@@ -491,6 +494,7 @@
selectedGroupRule: {},
pageNum: 1,
total: 1,
+ chooseWaitType:false,
// 导航栏高度(用于sticky top偏移)
navBarHeight: 0,
orderListWait:[],
@@ -507,6 +511,7 @@
categoryId: ''
},
menuButtonInfo: {},
+ groupdeliveryType:'',
isPintuan: true,
groupId: '',
isFaceToFaceGroup: false,
@@ -628,7 +633,6 @@
}
this.getCategory(this.shopItem.id);
this.getProduct('');
- this.getOrderWait();
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect();
@@ -663,6 +667,8 @@
}
}
+ //获取当前店铺待成团列表
+ that.getOrderWait();
that.total = res.result.pages; // pages = 总页数
that.pageNum = that.searchForm.pageNum;
@@ -733,7 +739,65 @@
duration: 200
});
},
- openOrderWait(){
+ openOrderWait(item){
+ this.chooseWaitType = false
+ if(item != ''){
+ this.chooseWaitType = true
+ this.orderListWait = item.orderListWait
+
+ this.currentItem = item;
+ // Parse specifications
+ this.parsedSpecs = [];
+ if (item.attributeList && item.attributeList !== '{}') {
+ try {
+ let attrs = typeof item.attributeList === 'string' ? JSON.parse(item.attributeList) : item
+ .attributeList;
+ for (let key in attrs) {
+ if (attrs[key] && attrs[key].title && attrs[key].title.length > 0) {
+ this.parsedSpecs.push({
+ name: key,
+ options: attrs[key].title,
+ selected: attrs[key].title[0] // Default select first
+ });
+ }
+ }
+ } catch (e) {
+ console.error("Failed to parse specifications", e);
+ }
+ }
+ this.isPintuan = true;
+
+ if (this.groupId) {
+ // Determine best price match given targetMembers
+ let prices = item.productGroupBuyPrices || [];
+ let validPrices = prices.filter(p => p.groupCount <= this.targetMembers);
+ if (validPrices.length > 0) {
+ this.selectedGroupRule = validPrices.reduce((max, obj) => (obj.groupCount > max.groupCount ? obj : max));
+ this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice
+ } else if (prices.length > 0) {
+ this.selectedGroupRule = prices.reduce((prev, curr) => (prev.groupCount < curr.groupCount ? prev : curr));
+ this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice
+ } else {
+ this.selectedGroupRule = {};
+ }
+ } else {
+ // Normal init
+ if (item.productGroupBuyPrices && item.productGroupBuyPrices.length > 0) {
+ this.selectedGroupRule = item.productGroupBuyPrices[0];
+ this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice
+ } else {
+ this.selectedGroupRule = {};
+ }
+ }
+
+ let moreBuyPrice = 0
+ for(let i = 0;i 0){
+ moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this.moreBuyList[i].attributeListPrice))).toFixed(2))
+ }
+ }
+ this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice
+ }
this.$refs.pintuanGroupPopup.open('bottom')
},
getOrderWait(){
@@ -747,6 +811,21 @@
that.loadStatus = 'nomore';
if (res.code == 200) {
that.orderListWait = res.result;
+ for(let i = 0;i (that.orderListWait[y].targetMembers - that.orderListWait[y].currentMembers)){
+ that.productItem[i].minGroupCount = that.orderListWait[y].targetMembers - that.orderListWait[y].currentMembers
+ }
+ that.productItem[i].orderListWait.push(that.orderListWait[y])
+ }
+ }
+ }
+ }
+
that.$forceUpdate();
} else {
that.tui.toast(res.message);
@@ -755,6 +834,14 @@
uni.hideLoading();
}).catch((res) => {});
},
+ chooseOrderWait(item){
+ this.$refs.pintuanGroupPopup.close();
+ this.groupId = item.id;
+ this.targetMembers = parseInt(item.targetMembers);
+ if(this.chooseWaitType){
+ this.$refs.pintuanPopup.open('bottom');
+ }
+ },
openPopup(type, index, item) {
if (type == 'car') {
this.$refs.carPopup.open('bottom')
@@ -789,8 +876,10 @@
let validPrices = prices.filter(p => p.groupCount <= this.targetMembers);
if (validPrices.length > 0) {
this.selectedGroupRule = validPrices.reduce((max, obj) => (obj.groupCount > max.groupCount ? obj : max));
+ this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice
} else if (prices.length > 0) {
this.selectedGroupRule = prices.reduce((prev, curr) => (prev.groupCount < curr.groupCount ? prev : curr));
+ this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice
} else {
this.selectedGroupRule = {};
}
@@ -806,11 +895,20 @@
// Normal init
if (item.productGroupBuyPrices && item.productGroupBuyPrices.length > 0) {
this.selectedGroupRule = item.productGroupBuyPrices[0];
+ this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice
} else {
this.selectedGroupRule = {};
}
}
+ let moreBuyPrice = 0
+ for(let i = 0;i 0){
+ moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this.moreBuyList[i].attributeListPrice))).toFixed(2))
+ }
+ }
+ this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice
+
this.$refs.pintuanPopup.open('bottom');
} else {
this.isPintuan = false;
@@ -834,6 +932,7 @@
},
selectGroupRule(rule) {
this.selectedGroupRule = rule;
+ this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice
},
submitAddToCart() {
let specChoices = {};
@@ -892,6 +991,16 @@
price: parseFloat(this.selectedGroupRule && this.selectedGroupRule.groupPrice ? this.selectedGroupRule.groupPrice : 0),
quantity: 1
}];
+ if(this.currentItem.moreBuyData){
+ for(let a = 0;a 0){
+ moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this.moreBuyList[i].attributeListPrice))).toFixed(2))
+ }
}
+ this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice
for(let i = 0;i { that.$refs.joinSuccessPopup.open('bottom'); }, 1500);
+ uni.showToast({ title: '支付成功', icon: 'success' });
+ that.tui.request("/api/wechat/pay/paySuccess", "POST", {
+ outTradeNo: that.currentOrderId
+ }, false, false).then((res3) => {
+ if(res3.code == 200){
+ uni.redirectTo({
+ url: '/package1/order/orderDetail?id=' + that.currentOrderId + '&groupId=' + that.groupId
+ });
+ }else{
+ that.tui.toast("订单创建失败,请联系客服处理");
+ }
+ })
+
},
fail: function(err) {
that.tui.toast("支付失败或取消");
@@ -1648,11 +1784,11 @@
}
.zaixian-swiper{
flex: 1;
- height: 76rpx;
+ height: 126rpx;
}
.zaixian-item{
- height: 76rpx;
- line-height: 76rpx;
+ height: 126rpx;
+ line-height: 126rpx;
font-size: 24rpx;
overflow: hidden;
text-overflow: ellipsis;