完善小程序登录排班与个人资料流程

This commit is contained in:
2026-11-03 15:33:03 +08:00
parent 6aafbd4eac
commit 19e2cd2594
37 changed files with 779 additions and 195 deletions
+29 -2
View File
@@ -4,7 +4,7 @@ Page({
data: {
step: 1,
role: 'manager',
form: { shopName: '', shopAddress: '', shopId: '', applicantNickname: '', applicantAvatarFileId: '', applicantAvatarUrl: '' },
form: { shopName: '', shopAddress: '', shopId: '', shopLongitude: '', shopLatitude: '', applicantNickname: '', applicantAvatarFileId: '', applicantAvatarUrl: '' },
registrationTicket: '',
applicationId: '',
shopOptions: [],
@@ -53,7 +53,32 @@ Page({
}
},
onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) },
onInput(event) {
const field = event.currentTarget.dataset.field
const value = event.detail.value
const next = { [`form.${field}`]: value }
if (field === 'shopAddress') {
next['form.shopLongitude'] = ''
next['form.shopLatitude'] = ''
}
this.setData(next)
},
chooseShopLocation() {
wx.chooseLocation({
success: result => {
if (!result || (!result.address && !result.name)) return
this.setData({
'form.shopAddress': result.address || result.name || '',
'form.shopLongitude': result.longitude || '',
'form.shopLatitude': result.latitude || ''
})
},
fail: error => {
if (!String(error && error.errMsg || '').includes('cancel')) wx.showToast({ title: '地图选点失败,可继续手动填写地址', icon: 'none' })
}
})
},
async chooseApplicantAvatar(event) {
try {
@@ -141,6 +166,8 @@ Page({
applicationId: this.data.applicationId || undefined,
shopName: String(form.shopName || '').trim(),
shopAddress: String(form.shopAddress || '').trim(),
shopLongitude: form.shopLongitude ? Number(form.shopLongitude) : undefined,
shopLatitude: form.shopLatitude ? Number(form.shopLatitude) : undefined,
shopId: form.shopId || undefined,
roleType: this.data.role === 'manager' ? 'MANAGER' : 'STAFF',
applicantNickname: this.data.role === 'staff' ? String(form.applicantNickname || '').trim() || undefined : undefined,