优化团购 - 商品详情页面代码
This commit is contained in:
parent
36b69c31b1
commit
da61b6ca53
@ -417,7 +417,7 @@
|
||||
</view>
|
||||
<view class="pay-button" @click="submitPayment">立即支付</view>
|
||||
</u-popup>
|
||||
|
||||
|
||||
<!-- 弹窗 - 支付成功 -->
|
||||
<view class="pay-success-shadow" @click="changeShadow2" v-if="boxshadow5">
|
||||
<view class="pay-success-container">
|
||||
@ -430,76 +430,77 @@
|
||||
<view class="verify-code-section">
|
||||
<view v-if="verifyCode">核销码:{{ verifyCode }}</view>
|
||||
</view>
|
||||
<view class="welfare-container">
|
||||
<view class="welfare-header">
|
||||
<view class="welfare-title">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/groupPurchase/welfare.png"></image>
|
||||
下单福利
|
||||
</view>
|
||||
<view class="welfare-action">已获得</view>
|
||||
</view>
|
||||
<view class="welfare-box">
|
||||
<view class="welfare-item welfare-item-points">
|
||||
<view class="welfare-item-top">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_fen.png" mode="aspectFit">
|
||||
<view class="welfare-container">
|
||||
<view class="welfare-header">
|
||||
<view class="welfare-title">
|
||||
<image
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/groupPurchase/welfare.png">
|
||||
</image>
|
||||
<view>石榴分</view>
|
||||
下单福利
|
||||
</view>
|
||||
<view>
|
||||
{{ slFen }}
|
||||
<view class="welfare-action">已获得</view>
|
||||
</view>
|
||||
<view class="welfare-box">
|
||||
<view class="welfare-item welfare-item-points">
|
||||
<view class="welfare-item-top">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_fen.png" mode="aspectFit">
|
||||
</image>
|
||||
<view>石榴分</view>
|
||||
</view>
|
||||
<view>
|
||||
{{ slFen }}
|
||||
</view>
|
||||
<view class="welfare-item-bottom">
|
||||
可抵扣 ¥{{ slFen }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="welfare-item-bottom">
|
||||
可抵扣 ¥{{ slFen }}
|
||||
<view class="welfare-item welfare-item-coupon">
|
||||
<view class="welfare-item-top">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_zi.png" mode="aspectFit">
|
||||
</image>
|
||||
<view>石榴籽</view>
|
||||
</view>
|
||||
<view>
|
||||
{{ slZi }}
|
||||
</view>
|
||||
<view class="welfare-item-bottom">
|
||||
可抵扣 ¥{{ slZi }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="welfare-item welfare-item-beans">
|
||||
<view class="welfare-item-top">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_jin.png" mode="aspectFit" />
|
||||
<view>石榴金</view>
|
||||
</view>
|
||||
<view>
|
||||
{{ slJin }}
|
||||
</view>
|
||||
<view class="welfare-item-bottom">
|
||||
可抵扣 ¥{{ slJin }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="welfare-item welfare-item-coupon">
|
||||
<view class="welfare-item-top">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_zi.png" mode="aspectFit">
|
||||
</image>
|
||||
<view>石榴籽</view>
|
||||
</view>
|
||||
<view>
|
||||
{{ slZi }}
|
||||
</view>
|
||||
<view class="welfare-item-bottom">
|
||||
可抵扣 ¥{{ slZi }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="welfare-item welfare-item-beans">
|
||||
<view class="welfare-item-top">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_jin.png" mode="aspectFit"/>
|
||||
<view>石榴金</view>
|
||||
</view>
|
||||
<view>
|
||||
{{ slJin }}
|
||||
</view>
|
||||
<view class="welfare-item-bottom">
|
||||
可抵扣 ¥{{ slJin }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom2">
|
||||
<view class="invite-section">
|
||||
<view class="invite-text">
|
||||
<view class="invite-line1"></view>
|
||||
赶快邀请好友来下单吧
|
||||
<view class="invite-line2"></view>
|
||||
</view>
|
||||
<view @click.stop="changeShadow2">
|
||||
<view class="share-buttons">
|
||||
<button class="share-btn-wechat" open-type="share" bindtap="onShareButtonClick" />
|
||||
<view class="share-item">
|
||||
<image
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_WX.png"
|
||||
mode="aspectFill"></image>
|
||||
微信好友
|
||||
</view>
|
||||
<button class="share-btn-miniprogram" open-type="share" bindtap="onShareButtonClick" />
|
||||
<view class="share-item" @click="shareFriend">
|
||||
<image
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_WX.png"
|
||||
mode="aspectFill"></image>
|
||||
小程序链接
|
||||
<view class="bottom2">
|
||||
<view class="invite-section">
|
||||
<view class="invite-text">
|
||||
<view class="invite-line1"></view>
|
||||
赶快邀请好友来下单吧
|
||||
<view class="invite-line2"></view>
|
||||
</view>
|
||||
<view @click.stop="changeShadow2">
|
||||
<view class="share-buttons">
|
||||
<button class="share-btn-wechat" open-type="share" bindtap="onShareButtonClick" />
|
||||
<view class="share-item">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_WX.png"
|
||||
mode="aspectFill"></image>
|
||||
微信好友
|
||||
</view>
|
||||
<button class="share-btn-miniprogram" open-type="share" bindtap="onShareButtonClick" />
|
||||
<view class="share-item" @click="shareFriend">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_WX.png"
|
||||
mode="aspectFill"></image>
|
||||
小程序链接
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -601,7 +602,7 @@ export default {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// 检查商品数量
|
||||
if (this.changeCount <= 0) {
|
||||
uni.showToast({
|
||||
@ -610,18 +611,18 @@ export default {
|
||||
})
|
||||
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();
|
||||
@ -640,7 +641,7 @@ export default {
|
||||
// #ifdef APP-PLUS
|
||||
trans_type = 51; // App平台
|
||||
// #endif
|
||||
|
||||
|
||||
// 创建订单参数
|
||||
const params = {
|
||||
user_id: uni.getStorageSync('userId'),
|
||||
@ -661,7 +662,7 @@ export default {
|
||||
}]
|
||||
}]
|
||||
}
|
||||
|
||||
|
||||
// 调用创建订单接口
|
||||
request(apiArr.createOrder, "POST", params).then(resVal => {
|
||||
// 调用预下单接口
|
||||
@ -670,7 +671,7 @@ export default {
|
||||
user_id: uni.getStorageSync('userId'),
|
||||
trans_type: trans_type
|
||||
}
|
||||
|
||||
|
||||
request(apiArr.mergePreorder, "POST", preOrderParam).then(res => {
|
||||
// 处理预下单响应
|
||||
this.handleMergePreorderResponse(res, resVal.order_id);
|
||||
@ -683,7 +684,7 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 处理mergePreorder接口的响应
|
||||
handleMergePreorderResponse(res, orderId) {
|
||||
if (res && res.timeStamp && res.nonceStr && res.package && res.signType && res.paySign) {
|
||||
@ -708,10 +709,10 @@ export default {
|
||||
this.slFen = res.shiliu_fen || 0;
|
||||
this.slZi = res.shiliu_zi || 0;
|
||||
this.slJin = res.shiliu_money || 0;
|
||||
|
||||
|
||||
// 显示支付成功弹窗
|
||||
this.boxshadow5 = true;
|
||||
|
||||
|
||||
// 关闭支付弹窗
|
||||
this.closeSeckill();
|
||||
})
|
||||
@ -754,42 +755,42 @@ export default {
|
||||
},
|
||||
|
||||
// 关闭团购记录
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user