This commit is contained in:
Alex-larget
2026-03-24 15:44:08 +08:00
parent 346e8ab057
commit 28ad08da84
62 changed files with 814 additions and 840 deletions

View File

@@ -9,6 +9,12 @@ const { formatStatNum } = require('../../utils/util.js')
const { trackClick } = require('../../utils/trackClick')
const { cleanSingleLineField } = require('../../utils/contentParser.js')
/** 与 referral 一致:提现需已绑定微信号(便于到账核对) */
function hasWechatIdBound() {
const ui = app.globalData.userInfo
return !!(ui && (ui.wechat || ui.wechatId || wx.getStorageSync('user_wechat')))
}
/** 是否视为「单章解锁」类订单(排除全书/VIP 等聚合商品名) */
function isSectionUnlockOrder(o) {
const name = String(o.product_name || o.title || '').trim()
@@ -35,7 +41,7 @@ Page({
userInfo: null,
// 统计数据
totalSections: 62,
totalSections: 0, // 来自 app.getTotalSections() 或 dashboard-stats
readCount: 0,
referralCount: 0,
earnings: '-',
@@ -961,7 +967,19 @@ Page({
wx.showToast({ title: '暂无可提现金额', icon: 'none' })
return
}
await this.ensureContactInfo(() => this.doWithdraw(amount))
if (!hasWechatIdBound()) {
wx.showModal({
title: '请先绑定微信号',
content: '提现需先绑定微信号,便于到账核对。请到「设置」中绑定后再提现。',
confirmText: '去绑定',
cancelText: '取消',
success: (res) => {
if (res.confirm) wx.navigateTo({ url: '/pages/settings/settings' })
}
})
return
}
this.doWithdraw(amount)
},
async doWithdraw(amount) {
@@ -980,6 +998,16 @@ Page({
this.loadWalletBalance()
} catch (e) {
wx.hideLoading()
const r = e.response || {}
if (r.needBind || r.needBindWechat) {
wx.showModal({
title: r.needBindWechat ? '请先绑定微信号' : '需要绑定微信',
content: r.needBindWechat ? '请到「设置」中绑定微信号后再提现,便于到账核对。' : '请先在设置中绑定微信账号后再提现',
confirmText: '去绑定',
success: (mr) => { if (mr.confirm) wx.navigateTo({ url: '/pages/settings/settings' }) }
})
return
}
wx.showToast({ title: e.message || '提现失败', icon: 'none' })
}
}