回溯点:保存注册预约客户流程修复进度
This commit is contained in:
@@ -14,17 +14,22 @@ Page({
|
||||
timer: null,
|
||||
smsExpanded: false,
|
||||
unbindMode: false,
|
||||
closureRequest: null
|
||||
closureRequest: null,
|
||||
closureLoading: true,
|
||||
closureError: ''
|
||||
},
|
||||
|
||||
onShow() { this.loadProfile(); this.loadClosureRequest() },
|
||||
|
||||
async loadClosureRequest() {
|
||||
this.setData({ closureLoading: true, closureError: '' })
|
||||
try {
|
||||
const closureRequest = await userApi.getAccountClosure()
|
||||
this.setData({ closureRequest: closureRequest || null })
|
||||
} catch (error) {
|
||||
this.setData({ closureRequest: null })
|
||||
this.setData({ closureError: error.message || '注销状态加载失败' })
|
||||
} finally {
|
||||
this.setData({ closureLoading: false })
|
||||
}
|
||||
},
|
||||
|
||||
@@ -62,7 +67,7 @@ Page({
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
const profile = await profileCache.getProfile(options)
|
||||
this.setData({ profile, 'smsForm.phone': profile.phone || '' })
|
||||
this.setData({ profile, 'smsForm.phone': '' })
|
||||
const app = getApp()
|
||||
const session = auth.getSession()
|
||||
app.setSession({ ...session, userInfo: { ...(session.userInfo || {}), ...profile } })
|
||||
|
||||
@@ -13,6 +13,7 @@ global.getApp = () => ({ setSession: () => {} })
|
||||
|
||||
const profileCache = require('../../utils/profile-cache')
|
||||
profileCache.getProfile = async () => currentProfile
|
||||
const userApi = require('../../api/user')
|
||||
require('./index')
|
||||
|
||||
async function loadProfile(profile) {
|
||||
@@ -47,6 +48,18 @@ async function run() {
|
||||
shopBusinessRemainingDays: 66
|
||||
})
|
||||
assert.strictEqual(active.profile.shopBusinessExpireTime, '2026-12-31T23:59:59')
|
||||
|
||||
userApi.getAccountClosure = async () => { throw new Error('注销状态暂时无法读取') }
|
||||
const closurePage = {
|
||||
data: { ...pageDefinition.data },
|
||||
setData(values) { Object.assign(this.data, values) }
|
||||
}
|
||||
await pageDefinition.loadClosureRequest.call(closurePage)
|
||||
assert.strictEqual(closurePage.data.closureError, '注销状态暂时无法读取')
|
||||
assert.strictEqual(closurePage.data.closureLoading, false)
|
||||
const accountWxml = require('fs').readFileSync(require('path').join(__dirname, 'index.wxml'), 'utf8')
|
||||
assert(accountWxml.includes('closureError'))
|
||||
assert(accountWxml.includes('bindtap="loadClosureRequest"'))
|
||||
}
|
||||
|
||||
run().catch(error => {
|
||||
|
||||
@@ -19,12 +19,16 @@
|
||||
<view class="account-note">微信身份是账号登录标识,手机号是可选资料,不作为主账号 ID。</view>
|
||||
<view class="card closure-card">
|
||||
<view class="section-title">账号注销</view>
|
||||
<view wx:if="{{closureRequest && (closureRequest.status === 'PENDING' || closureRequest.status === 'PROCESSING')}}" class="privacy-note">申请处理中,{{closureRequest.processingTargetText || '以管理人员审核和门店交接进度为准'}}</view>
|
||||
<view wx:elif="{{closureRequest && closureRequest.status === 'APPROVED'}}" class="privacy-note">账号资料已完成清理。</view>
|
||||
<view wx:elif="{{closureRequest && closureRequest.status === 'REJECTED'}}" class="privacy-note">上次申请未通过:{{closureRequest.reviewerNote || '请联系管理人员'}}</view>
|
||||
<view wx:else class="privacy-note">可申请注销工作台账号。提交后可在管理人员处理前撤回。</view>
|
||||
<button wx:if="{{closureRequest && closureRequest.status === 'PENDING'}}" class="closure-btn secondary" bindtap="withdrawClosure">撤回注销申请</button>
|
||||
<button wx:elif="{{!closureRequest || closureRequest.status !== 'APPROVED'}}" class="closure-btn" bindtap="requestClosure">申请注销账号</button>
|
||||
<view wx:if="{{closureLoading}}" class="privacy-note">正在读取注销申请状态…</view>
|
||||
<view wx:elif="{{closureError}}" class="privacy-note closure-error">{{closureError}}<button class="closure-retry" bindtap="loadClosureRequest">重试</button></view>
|
||||
<block wx:else>
|
||||
<view wx:if="{{closureRequest && (closureRequest.status === 'PENDING' || closureRequest.status === 'PROCESSING')}}" class="privacy-note">申请处理中,{{closureRequest.processingTargetText || '以管理人员审核和门店交接进度为准'}}</view>
|
||||
<view wx:elif="{{closureRequest && closureRequest.status === 'APPROVED'}}" class="privacy-note">账号资料已完成清理。</view>
|
||||
<view wx:elif="{{closureRequest && closureRequest.status === 'REJECTED'}}" class="privacy-note">上次申请未通过:{{closureRequest.reviewerNote || '请联系管理人员'}}</view>
|
||||
<view wx:elif="{{!closureRequest}}" class="privacy-note">可申请注销工作台账号。提交后可在管理人员处理前撤回。</view>
|
||||
<button wx:if="{{closureRequest && closureRequest.status === 'PENDING'}}" class="closure-btn secondary" bindtap="withdrawClosure">撤回注销申请</button>
|
||||
<button wx:elif="{{!closureRequest || closureRequest.status === 'REJECTED'}}" class="closure-btn" bindtap="requestClosure">申请注销账号</button>
|
||||
</block>
|
||||
</view>
|
||||
<button class="logout-btn" bindtap="logout">退出登录</button>
|
||||
</view>
|
||||
|
||||
@@ -14,3 +14,5 @@
|
||||
.closure-card { margin-top: 20rpx; padding: 28rpx; }
|
||||
.closure-btn { height: 76rpx; margin-top: 18rpx; border-radius: 12rpx; background: #fff1ef; color: #9a5147; font-size: 24rpx; line-height: 76rpx; }
|
||||
.closure-btn.secondary { background: #eef4f0; color: #426c57; }
|
||||
.closure-error { color: #a24f42; }
|
||||
.closure-retry { display: inline-block; margin: 0 0 0 12rpx; padding: 0; background: transparent; color: #397055; font-size: 22rpx; line-height: 1.6; }
|
||||
|
||||
Reference in New Issue
Block a user