feat: 完善会员资金明细与退款转账逻辑,新增支付密码组件与资金流水界面

这个提交包含在:
2026-10-24 17:55:36 +08:00
父节点 6b86177b5f
当前提交 b6c53abb84
共有 30 个文件被更改,包括 1222 次插入 和 537 次删除

查看文件

@@ -376,6 +376,10 @@
</scroll-view>
</view>
</view>
<!-- 支付密码弹窗(余额支付验证) -->
<fc-pay-password :show="pwdPopup.show" :title="pwdPopup.title" :tip="pwdPopup.tip"
@close="pwdPopup.show = false" @confirm="onPwdConfirm" />
</view>
</template>
@@ -391,16 +395,18 @@
*/
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
import FcAreaPicker from '@/components/fc-area-picker/fc-area-picker.vue'
import FcPayPassword from '@/components/fc-pay-password/fc-pay-password.vue'
import homeApi from '@/common/api/home.js'
import postApi from '@/common/api/post.js'
import memberApi from '@/common/api/member.js'
import { useUserStore } from '@/common/store/index.js'
import { iconUrl, categoryIconUrl, loadUiConfig, requestSubscribe } from '@/common/store/ui.js'
import { iconUrl, categoryIconUrl, loadUiConfig, requestSubscribe, uiState } from '@/common/store/ui.js'
import { pay } from '@/common/utils/pay.js'
import { assetUrl } from '@/common/utils/format.js'
import config from '@/common/config/index.js'
export default {
components: { FcNavbar, FcAreaPicker },
components: { FcNavbar, FcAreaPicker, FcPayPassword },
data() {
return {
categories: [],
@@ -410,6 +416,7 @@ export default {
areaRows: [],
submitting: false,
uploading: false,
pwdPopup: { show: false, title: '', tip: '' },
draftTimer: null,
catDrawerVisible: false,
catDrawerAnim: false,
@@ -589,6 +596,13 @@ export default {
needPay() {
return this.publish.mode === 'paid' && this.form.plan !== 'quota'
},
/**
* 当前选中付费套餐的价格文本(仅用于支付密码弹窗提示)
*/
selectedPlanPrice() {
const plan = this.plans.find((p) => p.key === this.form.plan)
return plan ? String(plan.price).replace(/[¥元]/g, '') : ''
},
/**
* 当前分类对应的常用计价单位
*/
@@ -1116,6 +1130,24 @@ export default {
if (this.form.phone && !/^1\d{10}$/.test(this.form.phone)) return '请输入正确的11位手机号'
return ''
},
/**
* 拉取资产(仅取支付密码状态,失败不阻断流程)
*/
async fetchAssetsSafe() {
try {
return await memberApi.assets()
} catch (e) {
return {}
}
},
/**
* 支付密码弹窗确认(余额支付验证)
* @param {string} password
*/
async onPwdConfirm(password) {
this.pwdPopup.show = false
await this.doSubmit(password)
},
/**
* 提交发布信息
*/
@@ -1131,6 +1163,32 @@ export default {
return
}
// 后台开启支付密码:余额支付发布需先验证(未设置则引导去余额中心设置)
if (this.needPay && this.form.payType === 'balance' && uiState.payPasswordEnabled) {
const assets = await this.fetchAssetsSafe()
if (!assets.hasPayPassword) {
uni.showModal({
title: '需要支付密码',
content: '开启支付密码验证后才能使用余额支付,请先到「余额中心」设置。',
confirmText: '去设置',
success: (r) => {
if (r.confirm) uni.navigateTo({ url: '/pages/member/recharge' })
},
})
return
}
const priceText = this.selectedPlanPrice ? ` · ¥${this.selectedPlanPrice}` : ''
this.pwdPopup = { show: true, title: '请输入支付密码', tip: `发布付费信息${priceText}` }
return
}
await this.doSubmit()
},
/**
* 实际提交(submit 校验通过 / 支付密码验证后调用)
* @param {string} [payPassword] 余额支付密码(开关开启时必传)
*/
async doSubmit(payPassword) {
this.submitting = true
try {
// 订阅消息授权(审核结果);未配置模板时静默跳过
@@ -1141,6 +1199,7 @@ export default {
priceUnit: this.form.isNegotiable ? '面议' : (this.form.priceUnit || '元'),
tags: this.form.tags,
plan: this.form.plan === 'quota' ? 'free' : this.form.plan,
payPassword,
}
const res = await postApi.create(payload)