实现手机号登录自动进入注册审核流程
This commit is contained in:
@@ -9,6 +9,9 @@ Page({
|
||||
passwordMode: false,
|
||||
form: { phone: '', code: '', password: '', confirmPassword: '', shopName: '', shopAddress: '', shopId: '' },
|
||||
wxCode: '',
|
||||
registrationTicket: '',
|
||||
applicationId: '',
|
||||
phoneVerified: false,
|
||||
shopOptions: [],
|
||||
shopIndex: 0,
|
||||
selectedShopName: '',
|
||||
@@ -19,7 +22,15 @@ Page({
|
||||
},
|
||||
|
||||
async onLoad(options) {
|
||||
this.setData({ wxCode: options && options.wxCode ? options.wxCode : '' })
|
||||
const registrationTicket = options && options.registrationTicket ? options.registrationTicket : ''
|
||||
this.setData({
|
||||
wxCode: options && options.wxCode ? options.wxCode : '',
|
||||
registrationTicket,
|
||||
applicationId: options && options.applicationId ? options.applicationId : '',
|
||||
phoneVerified: Boolean(registrationTicket),
|
||||
'form.phone': options && options.phone ? options.phone : '',
|
||||
step: registrationTicket ? 2 : 1
|
||||
})
|
||||
try {
|
||||
const shopOptions = await authApi.getAvailableRegistrationShops()
|
||||
this.setData({ shopOptions: Array.isArray(shopOptions) ? shopOptions : [] })
|
||||
@@ -64,10 +75,9 @@ Page({
|
||||
const form = this.data.form
|
||||
if (this.data.role === 'manager' && !String(form.shopName || '').trim()) { wx.showToast({ title: '请输入店铺名称', icon: 'none' }); return }
|
||||
if (this.data.role === 'staff' && !form.shopId) { wx.showToast({ title: '请选择要加入的店铺', icon: 'none' }); return }
|
||||
if (this.data.role === 'staff') { wx.showToast({ title: '店员申请功能即将开放', icon: 'none' }); return }
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
await authApi.register({ phone: form.phone, verificationCode: form.code, password: form.password, confirmPassword: form.confirmPassword, shopName: form.shopName, shopAddress: form.shopAddress, shopId: form.shopId, roleType: this.data.role === 'manager' ? 'MANAGER' : 'STAFF', agreementAccepted: true, wxCode: this.data.wxCode })
|
||||
await authApi.register({ phone: form.phone, verificationCode: this.data.registrationTicket ? undefined : form.code, registrationTicket: this.data.registrationTicket || undefined, applicationId: this.data.applicationId || undefined, password: form.password, confirmPassword: form.confirmPassword, shopName: form.shopName, shopAddress: form.shopAddress, shopId: form.shopId, roleType: this.data.role === 'manager' ? 'MANAGER' : 'STAFF', agreementAccepted: true, wxCode: this.data.wxCode })
|
||||
this.setData({ step: 4 })
|
||||
} catch (error) { wx.showToast({ title: error.message || '提交失败', icon: 'none' }) } finally { this.setData({ loading: false }) }
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user