Salon美甲师注册申请关联微信账号
自动发布开发环境 Nacos 配置 / publish (push) Successful in 26s

This commit is contained in:
2026-10-30 03:46:24 +08:00
parent 5a787a93f3
commit 7b40ee1650
27 changed files with 733 additions and 91 deletions
+74 -13
View File
@@ -1,7 +1,6 @@
const employeesApi = require('../../api/employees')
const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload')
const DEFAULT_EMPLOYEE_PASSWORD = 'Fingertip@123'
const EMPLOYEE_COLORS = ['#7BA7C7', '#8FB89A', '#A894C7', '#D7A86E', '#D98DA5', '#79A6A3', '#B9A16B', '#9BA9C8']
Page({
@@ -11,11 +10,15 @@ Page({
employeeColors: EMPLOYEE_COLORS,
onboardingVisible: false,
createdEmployee: null,
associationSheetVisible: false,
associationLoading: false,
associationApplications: [],
associationItems: [],
associationKeyword: '',
associationSelectedId: '',
form: {
nickname: '',
phone: '',
account: '',
password: DEFAULT_EMPLOYEE_PASSWORD,
wechatId: '',
color: '#8FB89A',
avatar: '',
@@ -39,10 +42,7 @@ Page({
onInput(event) {
const field = event.currentTarget.dataset.field
const value = event.detail.value
const updates = { [`form.${field}`]: value }
if (field === 'account') this._accountManuallyEdited = true
if (field === 'phone' && !this._accountManuallyEdited) updates['form.account'] = value
this.setData(updates)
this.setData({ [`form.${field}`]: value })
},
selectColor(event) {
@@ -79,10 +79,8 @@ Page({
const form = this.data.form
const nickname = String(form.nickname || '').trim()
const phone = String(form.phone || '').trim()
const account = String(form.account || '').trim()
const password = String(form.password || '').trim()
const wechatId = String(form.wechatId || '').trim()
if (!nickname || !phone || !account || !password) {
if (!nickname || !phone) {
wx.showToast({ title: '请补全美甲师信息', icon: 'none' })
return
}
@@ -96,8 +94,6 @@ Page({
nickname,
phone,
contactPhone: phone,
account,
password,
wechatId,
color: form.color,
avatar: form.avatar || undefined,
@@ -105,7 +101,8 @@ Page({
})
const id = result && typeof result === 'object' ? (result.id || result.userId) : result
const employee = { id, name: nickname, title: nickname, avatar: form.avatar || '' }
this.setData({ createdEmployee: employee, onboardingVisible: true })
this.setData({ createdEmployee: employee })
await this.offerPendingAssociation()
} catch (error) {
wx.showToast({ title: error.message || '新增失败', icon: 'none' })
} finally {
@@ -113,6 +110,70 @@ Page({
}
},
async offerPendingAssociation() {
try {
const data = await employeesApi.unassociatedApplications()
const applications = Array.isArray(data) ? data : []
if (!applications.length) {
this.setData({ onboardingVisible: true })
return
}
const associationItems = applications.map(item => ({
id: item.id,
title: item.applicantNickname || '待审核美甲师申请',
subtitle: [item.applicantMaskedPhone, item.createTime && String(item.createTime).replace('T', ' ').slice(0, 16)].filter(Boolean).join(' · ') || '申请资料尚未审核',
meta: item.applicationNo || ''
}))
this.setData({
associationApplications: applications,
associationItems,
associationKeyword: '',
associationSelectedId: '',
associationSheetVisible: true
})
} catch (error) {
wx.showToast({ title: '申请列表暂时不可用,已继续新增员工', icon: 'none' })
this.setData({ onboardingVisible: true })
}
},
onAssociationSearch(event) {
const associationKeyword = String(event.detail.value || '').trim().toLowerCase()
const applications = this.data.associationApplications
const associationItems = applications
.filter(item => !associationKeyword || [item.applicantNickname, item.applicantMaskedPhone, item.applicationNo]
.some(value => String(value || '').toLowerCase().includes(associationKeyword)))
.map(item => ({
id: item.id,
title: item.applicantNickname || '待审核美甲师申请',
subtitle: [item.applicantMaskedPhone, item.createTime && String(item.createTime).replace('T', ' ').slice(0, 16)].filter(Boolean).join(' · ') || '申请资料尚未审核',
meta: item.applicationNo || ''
}))
this.setData({ associationKeyword, associationItems })
},
async selectAssociation(event) {
const application = event.detail && event.detail.item
const employee = this.data.createdEmployee
if (!application || !employee || !employee.id || this.data.associationLoading) return
this.setData({ associationLoading: true, associationSelectedId: application.id })
try {
await employeesApi.preAssociateApplication(application.id, employee.id)
this.setData({ associationSheetVisible: false, onboardingVisible: true })
wx.showToast({ title: '已预关联申请', icon: 'success' })
} catch (error) {
wx.showToast({ title: error.message || '关联失败,请重新选择', icon: 'none' })
this.setData({ associationSelectedId: '' })
} finally {
this.setData({ associationLoading: false })
}
},
skipAssociation() {
if (this.data.associationLoading) return
this.setData({ associationSheetVisible: false, onboardingVisible: true })
},
setupFirstSchedule() {
const employee = this.data.createdEmployee
if (!employee || !employee.id) return
@@ -1,3 +1,6 @@
{
"navigationBarTitleText": "新增美甲师"
"navigationBarTitleText": "新增美甲师",
"usingComponents": {
"entity-selector-sheet": "/components/entity-selector-sheet/index"
}
}
@@ -33,25 +33,34 @@ const page = {
async function run() {
page.onInput({ currentTarget: { dataset: { field: 'phone' } }, detail: { value: '13800138000' } })
assert.strictEqual(page.data.form.account, '13800138000')
page.onInput({ currentTarget: { dataset: { field: 'account' } }, detail: { value: 'staff_zhou' } })
page.onInput({ currentTarget: { dataset: { field: 'phone' } }, detail: { value: '13900139000' } })
assert.strictEqual(page.data.form.account, 'staff_zhou')
assert.strictEqual(page.data.form.phone, '13800138000')
assert.strictEqual(page.data.form.account, undefined)
assert.strictEqual(page.data.form.password, undefined)
assert.strictEqual(page.data.form.color, '#8FB89A')
Object.assign(page.data.form, {
nickname: '小周',
phone: '13800138000',
account: '13800138000',
password: 'Fingertip@123',
wechatId: ''
})
let createPayload
employeesApi.createUser = async payload => {
createPayload = payload
assert.strictEqual(payload.wechatId, '')
assert.strictEqual(payload.color, '#8FB89A')
return 88
}
employeesApi.unassociatedApplications = async () => []
await page.submit()
assert.deepStrictEqual(createPayload, {
nickname: '小周',
phone: '13800138000',
contactPhone: '13800138000',
wechatId: '',
color: '#8FB89A',
avatar: undefined,
type: 3
})
assert.strictEqual(page.data.onboardingVisible, true)
assert.strictEqual(emitted, undefined)
@@ -69,6 +78,25 @@ async function run() {
assert.deepStrictEqual(emitted.value, { id: 88, name: '小周', title: '小周', avatar: '', autoSelect: true, scheduleSaved: true })
assert.strictEqual(navigatedBack, true)
let associatedApplication
employeesApi.unassociatedApplications = async () => [{
id: 42,
applicantNickname: '微信昵称',
applicantMaskedPhone: '138****8000',
applicationNo: 'SALON-042'
}]
employeesApi.preAssociateApplication = async (applicationId, employeeId) => {
associatedApplication = { applicationId, employeeId }
}
page.setData({ onboardingVisible: false, associationSheetVisible: false })
await page.offerPendingAssociation()
assert.strictEqual(page.data.associationSheetVisible, true)
assert.strictEqual(page.data.associationItems[0].title, '微信昵称')
await page.selectAssociation({ detail: { item: { id: 42 } } })
assert.deepStrictEqual(associatedApplication, { applicationId: 42, employeeId: 88 })
assert.strictEqual(page.data.associationSheetVisible, false)
assert.strictEqual(page.data.onboardingVisible, true)
page.data.onboardingVisible = true
page.data.createdEmployee = { id: 88, name: '小周' }
page.data.appointmentContext = { date: '2026-10-12', time: '14:00', durationMinutes: '60' }
@@ -1,6 +1,6 @@
<view class="page no-tab employee-create-page">
<view class="create-intro">
<text class="create-title">录入美甲师账号</text>
<text class="create-title">新增美甲师档案</text>
<text class="create-subtitle">{{pickerMode ? '保存后自动选择该美甲师' : '保存后即可用于预约指定和美甲师管理'}}</text>
</view>
@@ -24,13 +24,10 @@
<text class="field-label required">手机号</text>
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" type="number" maxlength="11" placeholder="请输入手机号" />
</view>
<view class="field">
<text class="field-label required">登录账号</text>
<input value="{{form.account}}" data-field="account" bindinput="onInput" placeholder="默认跟随手机号" />
</view>
<view class="field">
<text class="field-label required">初始密码</text>
<input value="{{form.password}}" data-field="password" bindinput="onInput" password placeholder="请输入初始密码" />
<view class="login-unlinked">
<text class="login-unlinked-label">微信登录</text>
<text class="login-unlinked-status">未关联</text>
<text class="login-unlinked-note">可在店长审核微信注册申请时快速关联</text>
</view>
<view class="field">
<text class="field-label">微信号</text>
@@ -58,4 +55,5 @@
<button class="onboarding-skip" loading="{{savingDefaultSchedule}}" disabled="{{savingDefaultSchedule}}" bindtap="skipFirstSchedule">{{pickerMode ? '暂不设置(默认全天可约)' : '不设置,使用默认全天排班'}}</button>
</view>
</view>
<entity-selector-sheet visible="{{associationSheetVisible}}" title="关联待审核申请" keyword="{{associationKeyword}}" placeholder="搜索申请昵称、手机号或编号" items="{{associationItems}}" selected-id="{{associationSelectedId}}" loading="{{associationLoading}}" empty-text="暂无可关联申请" action-text="暂不关联,继续" bind:search="onAssociationSearch" bind:select="selectAssociation" bind:action="skipAssociation" bind:close="skipAssociation" />
</view>
@@ -25,6 +25,20 @@
font-size: 23rpx;
}
.login-unlinked {
display: flex;
flex-wrap: wrap;
align-items: center;
margin: 24rpx 0 4rpx;
padding: 22rpx 24rpx;
border-radius: 14rpx;
background: #edf6ef;
}
.login-unlinked-label { color: #536b5d; font-size: 24rpx; font-weight: 700; }
.login-unlinked-status { margin-left: 18rpx; color: #247b63; font-size: 24rpx; font-weight: 700; }
.login-unlinked-note { flex-basis: 100%; margin-top: 10rpx; color: #829287; font-size: 21rpx; }
.avatar-card {
display: flex;
align-items: center;
+128 -6
View File
@@ -31,7 +31,15 @@ Page({
reviewPendingCount: 0,
reviewLoading: false,
reviewError: '',
reviewingId: ''
reviewingId: '',
associationSheetVisible: false,
associationLoading: false,
associationError: '',
associationApplicationId: '',
associationArtists: [],
associationItems: [],
associationKeyword: '',
associationSelectedId: ''
},
onLoad() {
@@ -73,7 +81,7 @@ Page({
const data = await employeesApi.reviewApplications()
const applications = (Array.isArray(data) ? data : []).map(item => ({
...item,
applicantNickname: item.applicantNickname || '待审核美甲师',
applicantDisplayName: item.applicantNickname || '待审核美甲师',
applicantAvatar: item.applicantAvatar || '',
applicantMaskedPhone: item.applicantMaskedPhone || '',
applicationTimeText: formatApplicationTime(item.createTime)
@@ -88,10 +96,124 @@ Page({
async approveApplication(event) {
const id = event.currentTarget.dataset.id
if (!id || this.data.reviewingId) return
const result = await confirmModal({ title: '通过美甲师申请', content: '确认允许该美甲师加入当前门店吗?' })
if (!result.confirm) return
await this.submitReview(id, () => employeesApi.approveApplication(id), '申请已通过')
if (!id || this.data.reviewingId || this.data.associationLoading) return
this.setData({
associationApplicationId: String(id),
associationKeyword: '',
associationSelectedId: '',
associationSheetVisible: true
})
await this.loadApprovalArtists()
},
async loadApprovalArtists() {
const applicationId = this.data.associationApplicationId
if (!applicationId || this.data.associationLoading) return
this.setData({ associationLoading: true, associationError: '' })
try {
const application = this.data.reviewApplications.find(item => String(item.id) === String(applicationId))
const data = await employeesApi.unboundArtists(applicationId)
const artists = (Array.isArray(data) ? data : []).map(item => ({
id: item.userId || item.id,
name: item.nickname || item.name || '未命名美甲师',
avatar: item.avatar || ''
}))
const selectedId = application && application.targetArtistUserId
? String(application.targetArtistUserId)
: ''
this.setData({
associationArtists: artists,
associationSelectedId: selectedId,
associationItems: this.filterApprovalArtists(artists, this.data.associationKeyword)
})
if (!artists.length) {
this.setData({ associationSheetVisible: false })
await confirmModal({
title: '暂时无法通过',
content: '当前门店没有未关联微信的美甲师档案,请先新增美甲师,再审核这条申请。',
confirmText: '知道了',
showCancel: false
})
}
} catch (error) {
this.setData({ associationError: error.message || '未关联美甲师加载失败' })
} finally {
this.setData({ associationLoading: false })
}
},
filterApprovalArtists(artists, keywordValue) {
const keyword = String(keywordValue || '').trim().toLowerCase()
return (artists || [])
.filter(item => !keyword || String(item.name || '').toLowerCase().includes(keyword))
.map(item => ({
id: item.id,
title: item.name,
subtitle: '当前门店 · 尚未关联微信登录',
avatar: item.avatar,
badge: '可关联'
}))
},
onApprovalSearch(event) {
const associationKeyword = event.detail.value || ''
this.setData({
associationKeyword,
associationItems: this.filterApprovalArtists(this.data.associationArtists, associationKeyword)
})
},
closeApprovalAssociation() {
if (this.data.associationLoading || this.data.reviewingId) return
this.setData({ associationSheetVisible: false })
},
async selectApprovalArtist(event) {
const artist = event.detail && event.detail.item
const applicationId = this.data.associationApplicationId
const application = this.data.reviewApplications.find(item => String(item.id) === String(applicationId))
if (!artist || !application || this.data.reviewingId) return
this.setData({ associationSelectedId: String(artist.id) })
},
async confirmApprovalAssociation() {
const applicationId = this.data.associationApplicationId
const application = this.data.reviewApplications.find(item => String(item.id) === String(applicationId))
const artist = this.data.associationArtists.find(item => String(item.id) === String(this.data.associationSelectedId))
if (!artist || !application || this.data.reviewingId) {
wx.showToast({ title: '请选择要关联的美甲师', icon: 'none' })
return
}
const useApplicantNickname = application.applicantNickname
? await this.askProfileAdoption('昵称', application.applicantNickname)
: false
const useApplicantAvatar = application.applicantAvatar
? await this.askProfileAdoption('头像', '已通过内容审核的申请头像')
: false
const summary = [
`关联到:${artist.name || '所选美甲师'}`,
useApplicantNickname ? '采用申请昵称' : '保留门店姓名',
useApplicantAvatar ? '采用申请头像' : '保留门店头像'
].join('\n')
const confirmed = await confirmModal({ title: '确认关联并通过', content: summary, confirmText: '确认通过' })
if (!confirmed.confirm) return
this.setData({ associationSheetVisible: false })
await this.submitReview(applicationId, () => employeesApi.approveApplication(applicationId, {
targetArtistUserId: artist.id,
useApplicantNickname,
useApplicantAvatar
}), '申请已通过')
},
askProfileAdoption(field, value) {
return confirmModal({
title: `采用申请${field}?`,
content: field === '昵称' ? `申请昵称为“${value}”,采用后会替换门店员工姓名。` : '采用后会替换门店员工当前头像。',
confirmText: `采用申请${field}`,
cancelText: `保留门店${field}`
}).then(result => Boolean(result.confirm))
},
async rejectApplication(event) {
+4 -1
View File
@@ -1,3 +1,6 @@
{
"navigationBarTitleText": "美甲师"
"navigationBarTitleText": "美甲师",
"usingComponents": {
"entity-selector-sheet": "/components/entity-selector-sheet/index"
}
}
+54 -21
View File
@@ -1,20 +1,18 @@
const assert = require('assert')
const modalChoices = []
const toasts = []
const modals = []
global.wx = {
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
getDeviceInfo: () => ({ platform: 'devtools' }),
getStorageSync: () => '',
setStorageSync: () => {},
removeStorageSync: () => {}
}
const appMock = {
globalData: {
userInfo: { type: 2 },
openEmployeeReview: true
showToast: options => toasts.push(options.title),
showModal: options => {
modals.push(options)
options.success({ confirm: modalChoices.shift() !== false })
}
}
global.getApp = () => appMock
global.getApp = () => ({ globalData: { userInfo: { type: 2 }, openEmployeeReview: false } })
let definition
global.Page = value => { definition = value }
@@ -24,26 +22,61 @@ function createPage() {
return {
...definition,
data: { ...definition.data, isManager: true },
setData(values) { Object.assign(this.data, values) }
setData(values) {
Object.entries(values).forEach(([key, value]) => {
const parts = key.split('.')
let target = this.data
for (let index = 0; index < parts.length - 1; index += 1) {
target[parts[index]] = target[parts[index]] || {}
target = target[parts[index]]
}
target[parts[parts.length - 1]] = value
})
}
}
}
async function run() {
const employeesApi = require('../../api/employees')
employeesApi.reviewApplications = async () => [{
const planningApi = require('../../api/planning')
const application = {
id: 12,
applicationNo: 'SALON-001',
applicantNickname: '小周',
createTime: '2026-10-12T10:30:00'
}]
applicantNickname: '微信昵称',
applicantAvatar: 'https://example.test/avatar.png',
targetArtistUserId: 22
}
employeesApi.reviewApplications = async () => [application]
employeesApi.unboundArtists = async () => [
{ userId: 22, nickname: '门店员工A', avatar: '/staff-a.png' },
{ userId: 23, nickname: '门店员工B' }
]
employeesApi.list = async () => []
planningApi.calendar = async () => ({ appointments: [], artists: [] })
let submitted
employeesApi.approveApplication = async (id, payload) => { submitted = { id, payload } }
const page = createPage()
await page.onShow()
page.data.reviewApplications = [application]
await page.approveApplication({ currentTarget: { dataset: { id: 12 } } })
assert.strictEqual(page.data.associationSheetVisible, true)
assert.strictEqual(page.data.associationSelectedId, '22')
assert.deepStrictEqual(page.data.associationItems.map(item => item.title), ['门店员工A', '门店员工B'])
assert.strictEqual(appMock.globalData.openEmployeeReview, false)
assert.strictEqual(page.data.reviewExpanded, true)
assert.strictEqual(page.data.reviewPendingCount, 1)
assert.strictEqual(page.data.reviewApplications[0].applicationTimeText, '2026-10-12 10:30')
modalChoices.push(true, false, true)
await page.confirmApprovalAssociation()
assert.deepStrictEqual(submitted, {
id: '12',
payload: { targetArtistUserId: 22, useApplicantNickname: true, useApplicantAvatar: false }
})
assert.strictEqual(page.data.associationSheetVisible, false)
assert.strictEqual(page.data.reviewingId, '')
assert(toasts.includes('申请已通过'))
employeesApi.unboundArtists = async () => []
page.data.reviewApplications = [application]
await page.approveApplication({ currentTarget: { dataset: { id: 12 } } })
assert.strictEqual(page.data.associationSheetVisible, false)
assert(modals.some(item => String(item.content || '').includes('当前门店没有未关联微信的美甲师档案')))
}
run().catch(error => {
+20 -1
View File
@@ -22,7 +22,8 @@
<view wx:for="{{reviewApplications}}" wx:key="id" class="review-item">
<image class="review-avatar" src="{{item.applicantAvatar || '/assets/images/default-user-avatar.png'}}" mode="aspectFill"></image>
<view class="review-info">
<text class="review-name">{{item.applicantNickname}}</text>
<text class="review-name">{{item.applicantDisplayName}}</text>
<text wx:if="{{item.targetArtistUserId}}" class="review-meta">已预关联美甲师</text>
<text wx:if="{{item.applicantMaskedPhone}}" class="review-meta">{{item.applicantMaskedPhone}}</text>
<text class="review-meta">{{item.shopName || '当前门店'}} · {{item.applicationTimeText}}</text>
<text class="review-number">申请编号 {{item.applicationNo}}</text>
@@ -57,4 +58,22 @@
</view>
</view>
<entity-selector-sheet
visible="{{associationSheetVisible}}"
title="选择要关联的美甲师"
keyword="{{associationKeyword}}"
placeholder="搜索美甲师姓名"
items="{{associationItems}}"
selected-id="{{associationSelectedId}}"
loading="{{associationLoading}}"
error-text="{{associationError}}"
empty-text="没有匹配的未关联美甲师"
action-text="确认关联并通过"
bind:search="onApprovalSearch"
bind:select="selectApprovalArtist"
bind:action="confirmApprovalAssociation"
bind:retry="loadApprovalArtists"
bind:close="closeApprovalAssociation"
/>
</view>
+18 -1
View File
@@ -4,7 +4,7 @@ Page({
data: {
step: 1,
role: 'manager',
form: { shopName: '', shopAddress: '', shopId: '' },
form: { shopName: '', shopAddress: '', shopId: '', applicantNickname: '', applicantAvatarFileId: '', applicantAvatarUrl: '' },
registrationTicket: '',
applicationId: '',
shopOptions: [],
@@ -15,6 +15,7 @@ Page({
shopError: '',
selectedShopName: '',
loading: false,
avatarUploading: false,
ticketInvalid: false
},
@@ -49,6 +50,20 @@ Page({
},
onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) },
async chooseApplicantAvatar(event) {
try {
const filePath = event && event.detail ? event.detail.avatarUrl : ''
if (!filePath) return
this.setData({ avatarUploading: true })
const result = await authApi.uploadRegistrationAvatar(this.data.registrationTicket, filePath)
this.setData({ 'form.applicantAvatarFileId': result.fileId || result.id, 'form.applicantAvatarUrl': filePath })
} catch (error) {
wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
} finally {
this.setData({ avatarUploading: false })
}
},
selectRole(event) { this.setData({ role: event.currentTarget.dataset.role }) },
continueFromRole() { if (!this.data.ticketInvalid) this.setData({ step: 2 }) },
@@ -101,6 +116,8 @@ Page({
shopAddress: String(form.shopAddress || '').trim(),
shopId: form.shopId || undefined,
roleType: this.data.role === 'manager' ? 'MANAGER' : 'STAFF',
applicantNickname: this.data.role === 'staff' ? String(form.applicantNickname || '').trim() || undefined : undefined,
applicantAvatarFileId: this.data.role === 'staff' ? form.applicantAvatarFileId || undefined : undefined,
agreementAccepted: true
})
this.setData({ step: 3, registrationTicket: '' })
+1 -1
View File
@@ -3,7 +3,7 @@
<view class="progress-row"><view class="progress-step {{step >= 1 ? 'active' : ''}}"><text>1</text><label>选择身份</label></view><view class="progress-line {{step >= 2 ? 'active' : ''}}"></view><view class="progress-step {{step >= 2 ? 'active' : ''}}"><text>2</text><label>门店资料</label></view><view class="progress-line {{step >= 3 ? 'active' : ''}}"></view><view class="progress-step {{step >= 3 ? 'active' : ''}}"><text>3</text><label>等待审核</label></view></view>
<view wx:if="{{ticketInvalid}}" class="card result-card"><view class="result-icon">!</view><view class="section-title">申请入口已失效</view><view class="section-desc">请返回登录页重新点击微信快捷登录,获取新的申请凭证。</view><button class="primary-btn" bindtap="back">返回登录</button></view>
<view wx:elif="{{step === 1}}" class="card form-card"><view class="section-title">选择工作身份</view><view class="section-desc">无需手机号和密码,审核人会根据你的身份处理申请</view><view class="role-list"><view class="role-option {{role === 'manager' ? 'selected' : ''}}" data-role="manager" bindtap="selectRole"><view class="role-icon">店</view><view class="role-copy"><text class="role-title">店长</text><text class="role-desc">创建并负责一家 Salon 门店</text></view><text class="role-mark">{{role === 'manager' ? '✓' : '○'}}</text></view><view class="role-option {{role === 'staff' ? 'selected' : ''}}" data-role="staff" bindtap="selectRole"><view class="role-icon">员</view><view class="role-copy"><text class="role-title">店员</text><text class="role-desc">加入已有门店协同工作</text></view><text class="role-mark">{{role === 'staff' ? '✓' : '○'}}</text></view></view><button class="primary-btn" bindtap="continueFromRole">继续</button></view>
<view wx:elif="{{step === 2}}" class="card form-card"><view class="section-title">{{role === 'manager' ? '完善店铺资料' : '选择要加入的店铺'}}</view><view class="section-desc">{{role === 'manager' ? '提交后由平台管理员审核' : '提交后由对应店长审核'}}</view><view wx:if="{{role === 'manager'}}" class="field"><text class="field-label">店铺名称</text><input value="{{form.shopName}}" data-field="shopName" bindinput="onInput" placeholder="请输入店铺名称" /></view><view wx:if="{{role === 'manager'}}" class="field"><text class="field-label">店铺地址</text><input value="{{form.shopAddress}}" data-field="shopAddress" bindinput="onInput" placeholder="请输入门店地址" /></view><view wx:if="{{role === 'staff'}}" class="field"><text class="field-label">选择店铺</text><view class="picker-value {{selectedShopName ? 'filled' : ''}}" bindtap="openShopSheet"><text>{{selectedShopName || '请选择要加入的店铺'}}</text><text class="picker-arrow">›</text></view></view><view wx:if="{{role === 'staff'}}" class="notice">审核通过前不会获得门店业务权限</view><button class="primary-btn" loading="{{loading}}" bindtap="submit">提交审核</button><view class="back-entry" bindtap="goBackStep">返回上一步</view></view>
<view wx:elif="{{step === 2}}" class="card form-card"><view class="section-title">{{role === 'manager' ? '完善店铺资料' : '选择要加入的店铺'}}</view><view class="section-desc">{{role === 'manager' ? '提交后由平台管理员审核' : '提交后由对应店长审核,昵称和头像均为可选资料'}}</view><view wx:if="{{role === 'manager'}}" class="field"><text class="field-label">店铺名称</text><input value="{{form.shopName}}" data-field="shopName" bindinput="onInput" placeholder="请输入店铺名称" /></view><view wx:if="{{role === 'manager'}}" class="field"><text class="field-label">店铺地址</text><input value="{{form.shopAddress}}" data-field="shopAddress" bindinput="onInput" placeholder="请输入门店地址" /></view><view wx:if="{{role === 'staff'}}" class="field"><text class="field-label">选择店铺</text><view class="picker-value {{selectedShopName ? 'filled' : ''}}" bindtap="openShopSheet"><text>{{selectedShopName || '请选择要加入的店铺'}}</text><text class="picker-arrow">›</text></view></view><view wx:if="{{role === 'staff'}}" class="field"><text class="field-label">申请昵称(选填)</text><input type="nickname" value="{{form.applicantNickname}}" data-field="applicantNickname" bindinput="onInput" placeholder="可填写希望展示的昵称" /></view><view wx:if="{{role === 'staff'}}" class="field avatar-pick-field"><text class="field-label">申请头像(选填)</text><button class="avatar-pick" open-type="chooseAvatar" bindchooseavatar="chooseApplicantAvatar"><image src="{{form.applicantAvatarUrl || '/assets/images/default-user-avatar.png'}}" mode="aspectFill"></image><text>{{avatarUploading ? '上传中...' : '主动选择头像'}}</text></button></view><view wx:if="{{role === 'staff'}}" class="notice">审核通过前不会获得门店业务权限</view><button class="primary-btn" loading="{{loading}}" disabled="{{avatarUploading}}" bindtap="submit">提交审核</button><view class="back-entry" bindtap="goBackStep">返回上一步</view></view>
<view wx:elif="{{step === 3}}" class="card result-card"><view class="result-icon">✓</view><view class="section-title">申请已提交</view><view class="section-desc">{{role === 'manager' ? '平台管理员审核通过后,即可使用快捷登录。' : '店长审核通过后,即可使用快捷登录。'}}</view><view class="result-status">当前状态:<text>等待审核</text></view><button class="primary-btn" bindtap="back">返回登录</button></view>
<entity-selector-sheet visible="{{shopSheetVisible}}" title="选择门店" keyword="{{shopKeyword}}" placeholder="搜索门店名称或地址" items="{{shopSelectorItems}}" selected-id="{{form.shopId}}" loading="{{shopLoading}}" error-text="{{shopError}}" empty-text="暂无匹配门店" bind:search="onShopSearch" bind:select="selectShop" bind:retry="loadShops" bind:close="closeShopSheet" />
<view class="safe-note">OpenID 仅用于识别你的微信身份,不会在页面中展示。</view>
+16
View File
@@ -256,3 +256,19 @@
.result-status { margin-top: 28rpx; padding: 18rpx 28rpx; border-radius: 12rpx; background: #e5f4ed; color: #75887b; font-size: 24rpx; }
.result-status text { color: #c28b47; font-weight: 700; }
.safe-note { margin-top: 28rpx; color: #9aa9a0; font-size: 21rpx; line-height: 1.5; text-align: center; }
.avatar-pick-field { margin-top: 26rpx; }
.avatar-pick {
display: flex;
align-items: center;
width: 100%;
height: 104rpx;
padding: 0 20rpx;
border: 1rpx solid #dfe9e1;
border-radius: 14rpx;
background: #f3f7f4;
color: #4d7660;
font-size: 25rpx;
text-align: left;
}
.avatar-pick::after { border: 0; }
.avatar-pick image { width: 72rpx; height: 72rpx; margin-right: 20rpx; border-radius: 50%; background: #e5f4ed; }