feat: 代付做完了
This commit is contained in:
@@ -66,6 +66,8 @@ Page({
|
||||
|
||||
// 弹窗
|
||||
showShareModal: false,
|
||||
showGiftModal: false,
|
||||
giftQuantity: 1,
|
||||
showLoginModal: false,
|
||||
agreeProtocol: false,
|
||||
showPosterModal: false,
|
||||
@@ -666,39 +668,18 @@ Page({
|
||||
this.setData({ showShareModal: false })
|
||||
},
|
||||
|
||||
// 找好友代付:创建代付请求后跳转代付页(美团式,在代付页分享)
|
||||
async showGiftShareModal() {
|
||||
// 代付分享:直接跳转代付页,在代付页输入数量并支付(简化流程)
|
||||
showGiftShareModal() {
|
||||
if (!app.globalData.userInfo?.id) {
|
||||
wx.showToast({ title: '请先登录', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const { sectionId, sectionMid } = this.data
|
||||
const productId = sectionId || ''
|
||||
if (!productId) {
|
||||
const { sectionId } = this.data
|
||||
if (!sectionId) {
|
||||
wx.showToast({ title: '章节信息异常', icon: 'none' })
|
||||
return
|
||||
}
|
||||
wx.showLoading({ title: '创建代付请求...', mask: true })
|
||||
try {
|
||||
const res = await app.request({
|
||||
url: '/api/miniprogram/gift-pay/create',
|
||||
method: 'POST',
|
||||
data: {
|
||||
userId: app.globalData.userInfo.id,
|
||||
productType: 'section',
|
||||
productId
|
||||
}
|
||||
})
|
||||
wx.hideLoading()
|
||||
if (res && res.success && res.requestSn) {
|
||||
wx.navigateTo({ url: `/pages/gift-pay/detail?requestSn=${res.requestSn}` })
|
||||
} else {
|
||||
wx.showToast({ title: res?.error || '创建失败', icon: 'none' })
|
||||
}
|
||||
} catch (e) {
|
||||
wx.hideLoading()
|
||||
wx.showToast({ title: '创建失败', icon: 'none' })
|
||||
}
|
||||
wx.navigateTo({ url: `/pages/gift-pay/detail?sectionId=${encodeURIComponent(sectionId)}` })
|
||||
},
|
||||
|
||||
// 复制链接
|
||||
|
||||
@@ -195,10 +195,10 @@
|
||||
<view class="paywall-audit-tip" wx:if="{{auditMode}}">审核中,暂不支持购买</view>
|
||||
|
||||
<text class="paywall-tip" wx:if="{{!auditMode}}">分享给好友一起学习,还能赚取佣金</text>
|
||||
<!-- 代付分享:让好友帮我买(审核模式隐藏) -->
|
||||
<!-- 代付分享:帮好友购买(审核模式隐藏) -->
|
||||
<view class="gift-share-row" bindtap="showGiftShareModal" wx:if="{{isLoggedIn && !auditMode}}">
|
||||
<text class="gift-share-icon">🎁</text>
|
||||
<text class="gift-share-text">找好友代付</text>
|
||||
<text class="gift-share-text">代付分享</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -314,5 +314,4 @@
|
||||
<view class="fab-share" bindtap="shareToMoments">
|
||||
<text class="fab-moments-icon">🌐</text>
|
||||
</view>
|
||||
<env-switch />
|
||||
</view>
|
||||
|
||||
@@ -618,6 +618,55 @@
|
||||
}
|
||||
.gift-share-icon { font-size: 32rpx; }
|
||||
.gift-share-text { font-size: 28rpx; color: #FFD700; }
|
||||
|
||||
/* 代付分享弹窗 */
|
||||
.gift-modal { padding: 32rpx; }
|
||||
.gift-desc {
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
line-height: 1.5;
|
||||
display: block;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
.gift-form { margin-bottom: 32rpx; }
|
||||
.gift-label {
|
||||
font-size: 26rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
display: block;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.form-input-wrap {
|
||||
padding: 16rpx 24rpx;
|
||||
background: #1F2937;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.form-input-inner {
|
||||
width: 100%;
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
}
|
||||
.gift-actions {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
}
|
||||
.gift-btn {
|
||||
flex: 1;
|
||||
padding: 24rpx;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
.gift-cancel {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
.gift-confirm {
|
||||
background: #00CED1;
|
||||
color: #000;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.share-modal-desc {
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
|
||||
Reference in New Issue
Block a user