diff --git a/packages/shop/groupPurchaseDetail/index.css b/packages/shop/groupPurchaseDetail/index.css
index e7f2b8c5..5d6d4f73 100644
--- a/packages/shop/groupPurchaseDetail/index.css
+++ b/packages/shop/groupPurchaseDetail/index.css
@@ -434,10 +434,9 @@ image {
}
.GoodsMsg {
- /* font-size: 30rpx; */
+ font-size: 30rpx;
color: #222222;
- margin: 0 20rpx;
- margin-top: 55rpx;
+ margin: 20rpx;
font-weight: 700;
}
@@ -543,8 +542,9 @@ image {
height: 40rpx;
}
-.car_right_box{
+.car_right_box {
display: flex;
+ font-size: 30rpx;
}
.car_right {
@@ -553,7 +553,6 @@ image {
/* background: linear-gradient(91deg, #FF7658 0%, #FF370B 100%); */
background: #ff712c;
border-radius: 20rpx 0 0 20rpx;
- font-size: 36rpx;
color: #FFFFFF;
display: flex;
align-items: center;
@@ -566,7 +565,6 @@ image {
height: 70rpx;
background: #ff3b31;
border-radius: 0 20rpx 20rpx 0;
- font-size: 36rpx;
color: #FFFFFF;
display: flex;
align-items: center;
@@ -931,12 +929,12 @@ image {
height: 100rpx;
margin-right: 30rpx;
border-radius: 20rpx;
- border: 1rpx solid red;
}
.itemSize_top {
display: flex;
margin-left: 30rpx;
+ position: relative;
}
.itemSize_info {
@@ -1107,4 +1105,347 @@ image {
display: inline-block;
vertical-align: middle;
margin-right: 20rpx;
+}
+
+/* 立即秒杀 */
+.address-section {
+ background-color: #fff;
+}
+
+.address-info {
+ padding: 20rpx 30rpx;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ border-bottom: 1rpx solid #eee;
+ margin-bottom: 20rpx;
+ font-size: 26rpx;
+ font-weight: bold;
+}
+
+.address-main {
+ flex: 1;
+}
+
+.address-name-phone {
+ display: flex;
+ align-items: center;
+ margin-bottom: 10rpx;
+}
+
+.name {
+ margin-right: 20rpx;
+}
+
+.phone {
+ color: #666;
+}
+
+.address-detail {
+ color: #666;
+ line-height: 40rpx;
+ display: flex;
+ align-items: center;
+}
+
+.address-arrow {
+ color: #333;
+}
+
+.quantity-control {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ position: absolute;
+ bottom: 10rpx;
+ right: 40rpx;
+}
+
+.decrease-btn {
+ width: 40rpx;
+ height: 40rpx;
+ background-color: #f5f5f5;
+ border: 1rpx solid #ccc;
+ border-radius: 50%;
+ line-height: 33rpx;
+ text-align: center;
+ font-size: 28rpx;
+ color: #333;
+}
+
+.increase-btn {
+ width: 40rpx;
+ height: 40rpx;
+ background-color: #ff502a;
+ border-radius: 50%;
+ line-height: 33rpx;
+ text-align: center;
+ font-size: 28rpx;
+ color: #ffffff;
+}
+
+.quantity {
+ margin: 0 15rpx;
+ font-size: 24rpx;
+ width: 40rpx;
+ text-align: center;
+}
+
+/* 支付方式区域 */
+.payment-section {
+ background-color: #fff;
+ margin-bottom: 20rpx;
+ margin-top: 15rpx;
+}
+
+.payment-item {
+ padding: 30rpx;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ border-bottom: 1rpx solid #eee;
+}
+
+.payment-icon {
+ width: 40rpx;
+ height: 40rpx;
+ margin-right: 20rpx;
+}
+
+.payment-icon image {
+ width: 100%;
+ height: 100%;
+}
+
+.payment-content {
+ flex: 1;
+}
+
+.payment-name {
+ font-size: 28rpx;
+ margin-bottom: 5rpx;
+}
+
+.payment-desc {
+ font-size: 26rpx;
+ color: #333;
+}
+
+.payment-select {
+ color: #FF7658;
+}
+
+/* 立即支付按钮 */
+.pay-button {
+ width: 50%;
+ height: 70rpx;
+ margin: 0 auto;
+ line-height: 70rpx;
+ text-align: center;
+ background: linear-gradient(91deg, #FF7658 0%, #FF370B 100%);
+ color: #fff;
+ font-size: 34rpx;
+ font-weight: bold;
+ border-radius: 50rpx;
+}
+
+/* 弹窗 - 支付成功 */
+.pay-success-shadow {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ z-index: 9999;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.pay-success-container {
+ width: 85%;
+ background-color: #ffffff;
+ border-radius: 15px;
+ padding: 20rpx 0;
+ overflow: hidden;
+}
+
+.pay-success-content {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 30rpx 0;
+}
+
+.pay-success-title {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 36rpx;
+ font-weight: bold;
+ color: #333333;
+ margin-bottom: 30rpx;
+}
+
+.success-icon {
+ width: 50rpx;
+ height: 50rpx;
+ margin-right: 10rpx;
+}
+
+.verify-code-section {
+ font-size: 32rpx;
+ color: #666666;
+ margin: 20rpx 0;
+}
+
+/* 下单福利样式 */
+.welfare-container {
+ width: 95%;
+ padding: 20rpx;
+ margin-top: 20rpx;
+}
+
+.welfare-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+}
+
+.welfare-title {
+ display: flex;
+ align-items: center;
+ font-size: 28rpx;
+ font-weight: bold;
+ color: #333333;
+}
+
+.welfare-title image {
+ width: 40rpx;
+ height: 40rpx;
+ margin-right: 10rpx;
+}
+
+.welfare-action {
+ font-size: 24rpx;
+ color: #999999;
+}
+
+.welfare-box {
+ display: flex;
+ justify-content: space-around;
+ margin-top: 20rpx;
+}
+
+.welfare-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 15rpx;
+ background-color: #ffffff;
+ border-radius: 10rpx;
+ box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
+ flex: 1;
+ margin: 0 10rpx;
+}
+
+.welfare-item-top {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ margin-bottom: 10rpx;
+}
+
+.welfare-item-top image {
+ width: 60rpx;
+ height: 60rpx;
+ margin-bottom: 8rpx;
+}
+
+.welfare-item-top view {
+ font-size: 24rpx;
+ color: #666666;
+}
+
+.welfare-item>view:nth-child(2) {
+ font-size: 32rpx;
+ font-weight: bold;
+ color: #ff6b6b;
+ margin: 10rpx 0;
+}
+
+.welfare-item-bottom {
+ font-size: 20rpx;
+ color: #999999;
+ margin-top: 5rpx;
+}
+
+/* 底部邀请区域样式 */
+.bottom2 {
+ margin-top: 30rpx;
+ padding: 0 30rpx;
+}
+
+.invite-section {
+ width: 100%;
+}
+
+.invite-text {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-bottom: 20rpx;
+ font-size: 24rpx;
+ color: #666666;
+}
+
+.invite-line1,
+.invite-line2 {
+ flex: 1;
+ height: 1rpx;
+ background-color: #e5e5e5;
+ margin: 0 15rpx;
+}
+
+.share-buttons {
+ display: flex;
+ justify-content: space-around;
+ margin-top: 20rpx;
+}
+
+.share-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 15rpx;
+}
+
+.share-item image {
+ width: 80rpx;
+ height: 80rpx;
+ margin-bottom: 10rpx;
+ border-radius: 16rpx;
+}
+
+.share-item view {
+ font-size: 24rpx;
+ color: #666666;
+}
+
+.share-btn-wechat {
+ width: 120rpx;
+ height: 120rpx;
+ opacity: 0;
+ position: absolute;
+ left: 160rpx;
+}
+
+.share-btn-miniprogram {
+ width: 120rpx;
+ height: 120rpx;
+ opacity: 0;
+ position: absolute;
+ right: 180rpx;
}
\ No newline at end of file
diff --git a/packages/shop/groupPurchaseDetail/index.vue b/packages/shop/groupPurchaseDetail/index.vue
index 3c6e9902..912d225c 100644
--- a/packages/shop/groupPurchaseDetail/index.vue
+++ b/packages/shop/groupPurchaseDetail/index.vue
@@ -200,7 +200,8 @@
加入购物车
-
+
立即秒杀
@@ -331,6 +332,182 @@
{{ item.goods_name }} {{ item.goods_spec }} / {{ item.goods_unit }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ adItem.name }}
+ {{ adItem.phone }}
+
+
+ {{ adItem.address }}
+
+
+
+
+
+
+
+
+
+
+ 请选择自提点
+
+
+
+
+
+
+
+
+
+ 请选择自提点
+
+
+
+
+
+
+
+
+
+ {{ changeName }}
+ ¥{{ changePrice }}/袋
+
+
+ -
+ {{ changeCount }}
+ +
+
+
+
+ {{ item.goods_name }} {{ item.goods_spec }} / {{ item.goods_unit }}
+
+
+
+
+
+
+
+
+
+ 微信支付
+
+
+
+
+
+
+
+
+
+ 立即支付
+
+
+
+
+
+
+
+
+
+ 已支付成功
+
+
+ 核销码:{{ verifyCode }}
+
+
+
+
+
+
+
+
+ 石榴分
+
+
+ {{ slFen }}
+
+
+ 可抵扣 ¥{{ slFen }}
+
+
+
+
+
+
+ 石榴籽
+
+
+ {{ slZi }}
+
+
+ 可抵扣 ¥{{ slZi }}
+
+
+
+
+
+ 石榴金
+
+
+ {{ slJin }}
+
+
+ 可抵扣 ¥{{ slJin }}
+
+
+
+
+
+
+
+ 赶快邀请好友来下单吧
+
+
+
+
+
+
+
+ 微信好友
+
+
+
+
+ 小程序链接
+
+
+
+
+
+
+
+
@@ -352,6 +529,11 @@ export default {
type: "error",
boxshadow1: false,
boxshadow2: false,
+ boxshadow5: false,
+ verifyCode: '',
+ slFen: 0,
+ slZi: 0,
+ slJin: 0,
id: "",
groupById: "",
info: "",
@@ -367,6 +549,7 @@ export default {
show: false,
showSize: false,
+ showSeckill: false,
showPurchase: false,
purchaseRecords: [],
totalCount: 0,
@@ -380,9 +563,183 @@ export default {
endTheCountdownMinute: '',
endTheCountdownSecond: '',
timer: null, // 定时器ID
+ defZTAddress: [],
+ selectedPayment: 'wechat', // 默认选择微信支付
+ changeCount: 0,
};
},
methods: {
+ //获取自提点
+ getZTAddress() {
+ setTimeout(() => {
+ let changeAddress = uni.getStorageSync('changeZTAddress')
+ if (changeAddress) {
+ this.defZTAddress = changeAddress
+ }
+ }, 100)
+ },
+ selectPayment(payment) {
+ this.selectedPayment = payment;
+ },
+ // 增加数量
+ increaseQuantity() {
+ this.changeCount++;
+ },
+ // 减少数量
+ decreaseQuantity() {
+ if (this.changeCount > 0) {
+ this.changeCount--;
+ }
+ },
+ // 提交支付
+ submitPayment() {
+ // 检查是否选择了自提点
+ if (this.defZTAddress.length == 0) {
+ uni.showToast({
+ title: '请选择自提点',
+ icon: 'none'
+ })
+ return
+ }
+
+ // 检查商品数量
+ if (this.changeCount <= 0) {
+ uni.showToast({
+ title: '请选择购买数量',
+ icon: 'none'
+ })
+ return
+ }
+
+ // 获取当前时间和活动时间,检查是否在团购活动时间内
+ const currentTime = new Date().getTime();
+ const activityInfo = this.currentGG.group_buy_activity_info;
+ let isGroupBuyValid = false;
+
+ if (activityInfo) {
+ const startTime = new Date(activityInfo.start_time).getTime();
+ const endTime = new Date(activityInfo.end_time).getTime();
+ isGroupBuyValid = currentTime >= startTime && currentTime <= endTime;
+ }
+
+ // 根据平台设置不同的trans_type值
+ // 小程序: 71, App: 51
+ const systemInfo = uni.getSystemInfoSync();
+ let trans_type = 51; // 默认App环境
+
+ // 运行时判断是否为小程序环境
+ if (systemInfo.platform === 'devtools' || systemInfo.platform === 'unknown') {
+ trans_type = 71; // 开发工具或未知环境默认为小程序
+ }
+
+ // 条件编译:针对不同平台设置不同值
+ // #ifdef MP
+ trans_type = 71; // 所有小程序平台
+ // #endif
+
+ // #ifdef APP-PLUS
+ trans_type = 51; // App平台
+ // #endif
+
+ // 创建订单参数
+ const params = {
+ user_id: uni.getStorageSync('userId'),
+ order_cate: isGroupBuyValid ? 2 : 1, // 2表示团购订单
+ goods_list: [{
+ supplier_id: this.info.supplier_id,
+ supplier_name: this.info.merchant_info.merchant_name || '',
+ is_same_day: this.currentGG.is_same_day || false,
+ receiving_name: this.defZTAddress[0].name || '',
+ receiving_phone: this.defZTAddress[0].phone || '',
+ receiving_address: this.defZTAddress[0].address || '',
+ merchant_id: this.defZTAddress[0].address_id,
+ group_buy_activity_id: this.currentGG.group_buy_activity_id,
+ goods_and_count: [{
+ goods_id: this.currentGG.id,
+ count: this.changeCount,
+ price: isGroupBuyValid ? this.currentGG.group_buy_price : this.currentGG.sales_price
+ }]
+ }]
+ }
+
+ // 调用创建订单接口
+ request(apiArr.createOrder, "POST", params).then(resVal => {
+ // 调用预下单接口
+ const preOrderParam = {
+ order_id: resVal.order_id,
+ user_id: uni.getStorageSync('userId'),
+ trans_type: trans_type
+ }
+
+ request(apiArr.mergePreorder, "POST", preOrderParam).then(res => {
+ // 处理预下单响应
+ this.handleMergePreorderResponse(res, resVal.order_id);
+ })
+ }).catch(err => {
+ console.error('创建订单失败:', err);
+ uni.showToast({
+ title: '创建订单失败,请重试',
+ icon: 'none'
+ })
+ })
+ },
+
+ // 处理mergePreorder接口的响应
+ handleMergePreorderResponse(res, orderId) {
+ if (res && res.timeStamp && res.nonceStr && res.package && res.signType && res.paySign) {
+ // 调用微信支付
+ uni.requestPayment({
+ timeStamp: res.timeStamp,
+ nonceStr: res.nonceStr,
+ package: res.package,
+ signType: res.signType,
+ paySign: res.paySign,
+ success: (payRes) => {
+ // 支付成功后查询订单
+ const params = {
+ order_id: orderId,
+ from: 2, // 2表示团购订单
+ group_buy_activity_id: this.currentGG.group_buy_activity_id,
+ adver_id: ''
+ }
+ request(apiArr.queryOrder, "POST", params).then(res => {
+ // 设置核销码和福利数据
+ this.verifyCode = res.verification_code;
+ this.slFen = res.shiliu_fen || 0;
+ this.slZi = res.shiliu_zi || 0;
+ this.slJin = res.shiliu_money || 0;
+
+ // 显示支付成功弹窗
+ this.boxshadow5 = true;
+
+ // 关闭支付弹窗
+ this.closeSeckill();
+ })
+ },
+ fail: (payErr) => {
+ uni.showToast({
+ title: payErr.errMsg == 'requestPayment:fail cancel' ? '已取消支付' : '支付失败',
+ icon: 'none'
+ })
+ const params = {
+ order_ids: orderId,
+ }
+ request(apiArr.cancelPay, "POST", params).then(res => {
+ // 取消支付后的处理
+ })
+ },
+ complete: () => {
+ // 支付完成后的回调,无论成功失败都会执行
+ }
+ })
+ } else {
+ console.error("获取支付参数失败,缺少必要参数")
+ uni.showToast({
+ title: '获取支付信息失败',
+ icon: 'none'
+ })
+ }
+ },
// 显示团购记录
showPurchaseRecords() {
if (this.purchaseRecords.length > 0) {
@@ -397,9 +754,42 @@ export default {
},
// 关闭团购记录
- closePurchase() {
- this.showPurchase = false;
- },
+ closePurchase() {
+ this.showPurchase = false;
+ },
+
+ // 关闭支付成功弹窗
+ changeShadow2() {
+ this.boxshadow5 = false;
+ },
+
+ // 分享给微信好友
+ shareFriend() {
+ this.boxshadow5 = false; // 关闭分享弹窗
+
+ // 调用分享API
+ if (typeof uni.share !== 'undefined') {
+ uni.share({
+ provider: 'weixin',
+ scene: 'WXSceneSession',
+ type: 0,
+ title: this.currentGG.goods_name || '商品分享',
+ summary: this.currentGG.commodity_brief || '快来看看这款商品吧',
+ href: `${window.location.origin}/pages/goodsDetail/index?id=${this.id}`,
+ imageUrl: this.picUrl + (this.currentGG.goods_carousel && this.currentGG.goods_carousel[0] || ''),
+ success: () => {
+ uni.showToast({
+ title: '分享成功',
+ icon: 'success',
+ duration: 2000
+ });
+ },
+ fail: (err) => {
+ console.error('分享失败', err);
+ }
+ });
+ }
+ },
//去下单
goSubmit() {
@@ -792,11 +1182,31 @@ export default {
this.showSize = false;
},
+ // 立即秒杀
+ showSeckillPopup() {
+ this.showSeckill = true;
+ },
+
+ closeSeckill() {
+ this.showSeckill = false;
+ uni.removeStorageSync('changeZTAddress')
+ this.defZTAddress = {}
+ },
+
+ editAddress() {
+ const item = {
+ goods_id: this.info.commodity_goods_info_list[this.currentGGIndex].id,
+ supplier_id: this.itemObj.supplier_id,
+ }
+ NavgateTo('../ztLocation/index?item=' + JSON.stringify(item));
+ },
+
// 购买记录
getBuyRecord() {
const params = {
activity_id: this.groupById,
goods_id: this.itemObj.id,
+ adver_id: this.itemObj.adver_id,
}
request(apiArr2.groupBuyRecord, 'POST', params).then(res => {
const record = res.group_buy_record.map(item => {
@@ -870,6 +1280,7 @@ export default {
this.getGoodsInfo();
});
this.getShopCar();
+ this.getZTAddress()
},
//离开页面的时候直接更新购物车数量(目前接口是 传入商品id 数量。如果有当前商品就更新数量。如果没有就增加商品。如果删除某个商品 count 为0 就删除)