/** * Purpose: artistApi supports index.js by holding or executing the artist api page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const artistApi = require('../../api/nail-artist') /** * Purpose: userApi supports index.js by holding or executing the user api page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const userApi = require('../../api/user') /** * Purpose: tagApi supports index.js by holding or executing the tag api page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const tagApi = require('../../api/tag') /** * Purpose: productApi supports index.js by holding or executing the product api page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const productApi = require('../../api/product') /** * Purpose: shopApi supports index.js by holding or executing the shop api page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const shopApi = require('../../api/shop') /** * Purpose: navigation supports index.js by holding or executing the navigation page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const navigation = require('../../utils/navigation') /** * Purpose: format supports index.js by holding or executing the format page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const format = require('../../utils/format') const { getTempRecord, clearTempRecord } = require('../../utils/storage') /** * Purpose: normalizeId supports index.js by holding or executing the normalize id page or API role. * Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow. */ function normalizeId(value) { return value === undefined || value === null ? '' : String(value) } /** * Purpose: buildCheckableList supports index.js by holding or executing the build checkable list page or API role. * Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow. */ function buildCheckableList(list, selectedIds, labelKey) { return (Array.isArray(list) ? list : []).map(item => ({ ...item, valueId: normalizeId(item.id), labelText: item[labelKey], checked: selectedIds.includes(normalizeId(item.id)) })) } /** * Purpose: syncSelectedIds supports index.js by holding or executing the sync selected ids page or API role. * Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow. */ function syncSelectedIds(selectedIds, list) { const availableIds = new Set((Array.isArray(list) ? list : []).map(item => normalizeId(item.id))) return (Array.isArray(selectedIds) ? selectedIds : []).filter(id => availableIds.has(normalizeId(id))) } /** * Purpose: filterProductsByShop supports index.js by holding or executing the filter products by shop page or API role. * Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow. */ function filterProductsByShop(products, shopId) { const targetShopId = normalizeId(shopId) if (!targetShopId) { return [] } return (Array.isArray(products) ? products : []).filter(item => normalizeId(item.shopId) === targetShopId) } Page({ /** * Purpose: data supports index.js by holding or executing the data page or API role. * Usage: import, call, read, or update this page-data from the owning page/module while preserving the surrounding loading and permission flow. */ data: { /** * Purpose: mode supports index.js by holding or executing the mode page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ mode: 'create', /** * Purpose: userId supports index.js by holding or executing the user id page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ userId: '', /** * Purpose: shops supports index.js by holding or executing the shops page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ shops: [], /** * Purpose: shopIndex supports index.js by holding or executing the shop index page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ shopIndex: 0, /** * Purpose: shopLabel supports index.js by holding or executing the shop label page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ shopLabel: '', /** * Purpose: statusOptions supports index.js by holding or executing the status options page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ statusOptions: ['营业中', '休息中'], /** * Purpose: statusIndex supports index.js by holding or executing the status index page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ statusIndex: 0, /** * Purpose: userForm supports index.js by holding or executing the user form page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ userForm: { /** * Purpose: nickname supports index.js by holding or executing the nickname page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ nickname: '', /** * Purpose: account supports index.js by holding or executing the account page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ account: '', /** * Purpose: phone supports index.js by holding or executing the phone page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ phone: '', /** * Purpose: password supports index.js by holding or executing the password page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ password: '', /** * Purpose: signature supports index.js by holding or executing the signature page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ signature: '' }, /** * Purpose: artistForm supports index.js by holding or executing the artist form page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ artistForm: { /** * Purpose: identity supports index.js by holding or executing the identity page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ identity: '', /** * Purpose: experience supports index.js by holding or executing the experience page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ experience: '', /** * Purpose: rating supports index.js by holding or executing the rating page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ rating: '', /** * Purpose: portfolioText supports index.js by holding or executing the portfolio text page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ portfolioText: '' }, /** * Purpose: tags supports index.js by holding or executing the tags page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ tags: [], /** * Purpose: products supports index.js by holding or executing the products page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ products: [] }, /** * Purpose: onLoad supports index.js by holding or executing the on load page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ onLoad(options) { const mode = options && options.mode ? options.mode : 'create' const currentArtist = getTempRecord('currentArtist', null) this.setData({ mode, /** * Purpose: userId supports index.js by holding or executing the user id page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ userId: options && options.userId ? options.userId : '' }) this._selectedTagIds = [] this._selectedProductIds = [] this._allProducts = [] if (mode === 'edit' && currentArtist) { this._selectedTagIds = format.splitCsv(currentArtist.skills) this._selectedProductIds = format.splitCsv(currentArtist.portfolio) this._initialShopId = currentArtist.shopId this.setData({ /** * Purpose: artistForm supports index.js by holding or executing the artist form page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ artistForm: { /** * Purpose: identity supports index.js by holding or executing the identity page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ identity: currentArtist.identity || '', /** * Purpose: experience supports index.js by holding or executing the experience page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ experience: currentArtist.experience || '', /** * Purpose: rating supports index.js by holding or executing the rating page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ rating: currentArtist.rating || '', /** * Purpose: portfolioText supports index.js by holding or executing the portfolio text page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ portfolioText: '' }, /** * Purpose: userForm supports index.js by holding or executing the user form page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ userForm: { /** * Purpose: nickname supports index.js by holding or executing the nickname page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ nickname: currentArtist.nickname || '', /** * Purpose: account supports index.js by holding or executing the account page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ account: '', /** * Purpose: phone supports index.js by holding or executing the phone page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ phone: '', /** * Purpose: password supports index.js by holding or executing the password page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ password: '', /** * Purpose: signature supports index.js by holding or executing the signature page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ signature: currentArtist.signature || '' }, /** * Purpose: statusIndex supports index.js by holding or executing the status index page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ statusIndex: Number(currentArtist.status) === 0 ? 1 : 0 }) } this.loadDependencies() }, /** * Purpose: onUnload supports index.js by holding or executing the on unload page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ onUnload() { clearTempRecord('currentArtist') }, async loadDependencies() { const app = getApp() const currentShop = app.globalData.currentShop const operator = app.globalData.userInfo || {} try { const [shops, products, users] = await Promise.all([ shopApi.listAllShops(), productApi.listAllProducts(), userApi.listAllUsers() ]) let availableShops = Array.isArray(shops) ? shops : [] if (Number(operator.type) !== 4 && currentShop) { availableShops = availableShops.filter(item => normalizeId(item.id) === normalizeId(currentShop.id)) } let shopIndex = 0 if (this._initialShopId) { const index = availableShops.findIndex(item => normalizeId(item.id) === normalizeId(this._initialShopId)) if (index >= 0) { shopIndex = index } } const selectedShop = availableShops[shopIndex] this._allProducts = Array.isArray(products) ? products : [] if (this.data.mode === 'edit') { const userRecord = (Array.isArray(users) ? users : []).find(item => normalizeId(item.id) === normalizeId(this.data.userId)) if (userRecord) { this.setData({ /** * Purpose: userForm supports index.js by holding or executing the user form page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ userForm: { /** * Purpose: nickname supports index.js by holding or executing the nickname page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ nickname: userRecord.nickname || '', /** * Purpose: account supports index.js by holding or executing the account page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ account: userRecord.account || '', /** * Purpose: phone supports index.js by holding or executing the phone page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ phone: userRecord.phone || '', /** * Purpose: password supports index.js by holding or executing the password page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ password: '', /** * Purpose: signature supports index.js by holding or executing the signature page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ signature: userRecord.signature || '' } }) } } this.setData({ /** * Purpose: shops supports index.js by holding or executing the shops page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ shops: availableShops, shopIndex, /** * Purpose: shopLabel supports index.js by holding or executing the shop label page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ shopLabel: selectedShop ? selectedShop.shopName : '' }) await this.loadShopScopedOptions(selectedShop ? selectedShop.id : '') } catch (error) { wx.showToast({ /** * Purpose: title supports index.js by holding or executing the title page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ title: error.message || '初始化美甲师表单失败', /** * Purpose: icon supports index.js by holding or executing the icon page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ icon: 'none' }) } }, async loadShopScopedOptions(shopId) { if (!normalizeId(shopId)) { this._selectedTagIds = [] this._selectedProductIds = [] this.setData({ /** * Purpose: tags supports index.js by holding or executing the tags page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ tags: [], /** * Purpose: products supports index.js by holding or executing the products page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ products: [] }) return } try { const tagList = await tagApi.listTagsByShopId(shopId) const productList = filterProductsByShop(this._allProducts, shopId) this._selectedTagIds = syncSelectedIds(this._selectedTagIds, tagList) this._selectedProductIds = syncSelectedIds(this._selectedProductIds, productList) this.setData({ /** * Purpose: tags supports index.js by holding or executing the tags page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ tags: buildCheckableList(tagList, this._selectedTagIds, 'tagName'), /** * Purpose: products supports index.js by holding or executing the products page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ products: buildCheckableList(productList, this._selectedProductIds, 'title') }) } catch (error) { this.setData({ /** * Purpose: tags supports index.js by holding or executing the tags page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ tags: [], /** * Purpose: products supports index.js by holding or executing the products page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ products: [] }) wx.showToast({ /** * Purpose: title supports index.js by holding or executing the title page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ title: error.message || '店铺关联数据加载失败', /** * Purpose: icon supports index.js by holding or executing the icon page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ icon: 'none' }) } }, /** * Purpose: handleUserInput supports index.js by holding or executing the handle user input page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ handleUserInput(event) { const field = event.currentTarget.dataset.field let value = event.detail.value if (field === 'account') { value = String(value || '').replace(/[^A-Za-z0-9]/g, '') } if (field === 'phone') { value = String(value || '').replace(/[^\d]/g, '').slice(0, 11) } this.setData({ [`userForm.${field}`]: value }) }, /** * Purpose: handleArtistInput supports index.js by holding or executing the handle artist input page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ handleArtistInput(event) { const field = event.currentTarget.dataset.field this.setData({ [`artistForm.${field}`]: event.detail.value }) }, /** * Purpose: handleShopChange supports index.js by holding or executing the handle shop change page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ handleShopChange(event) { const shopIndex = Number(event.detail.value) const selectedShop = this.data.shops[shopIndex] this.setData({ shopIndex, /** * Purpose: shopLabel supports index.js by holding or executing the shop label page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ shopLabel: selectedShop ? selectedShop.shopName : '' }) this.loadShopScopedOptions(selectedShop ? selectedShop.id : '') }, /** * Purpose: handleStatusChange supports index.js by holding or executing the handle status change page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ handleStatusChange(event) { this.setData({ /** * Purpose: statusIndex supports index.js by holding or executing the status index page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ statusIndex: Number(event.detail.value) }) }, /** * Purpose: handleTagChange supports index.js by holding or executing the handle tag change page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ handleTagChange(event) { this._selectedTagIds = event.detail.value || [] this.setData({ /** * Purpose: tags supports index.js by holding or executing the tags page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ tags: this.data.tags.map(item => ({ ...item, /** * Purpose: checked supports index.js by holding or executing the checked page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ checked: this._selectedTagIds.includes(item.valueId) })) }) }, /** * Purpose: handleProductChange supports index.js by holding or executing the handle product change page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ handleProductChange(event) { this._selectedProductIds = event.detail.value || [] this.setData({ /** * Purpose: products supports index.js by holding or executing the products page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ products: this.data.products.map(item => ({ ...item, /** * Purpose: checked supports index.js by holding or executing the checked page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ checked: this._selectedProductIds.includes(item.valueId) })) }) }, /** * Purpose: validateForm supports index.js by holding or executing the validate form page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ validateForm() { if (!this.data.userForm.nickname) { return '请输入美甲师昵称' } if (!this.data.userForm.account) { return '请输入账号' } if (!this.data.userForm.phone || this.data.userForm.phone.length !== 11) { return '请输入 11 位手机号' } if (this.data.mode === 'create' && !this.data.userForm.password) { return '新增美甲师时必须设置密码' } if (!this.data.shops[this.data.shopIndex]) { return '请选择所属店铺' } return '' }, async handleSubmit() { const errorMessage = this.validateForm() if (errorMessage) { wx.showToast({ /** * Purpose: title supports index.js by holding or executing the title page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ title: errorMessage, /** * Purpose: icon supports index.js by holding or executing the icon page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ icon: 'none' }) return } const selectedShop = this.data.shops[this.data.shopIndex] const userPayload = { /** * Purpose: nickname supports index.js by holding or executing the nickname page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ nickname: this.data.userForm.nickname, /** * Purpose: account supports index.js by holding or executing the account page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ account: this.data.userForm.account, /** * Purpose: phone supports index.js by holding or executing the phone page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ phone: this.data.userForm.phone, /** * Purpose: signature supports index.js by holding or executing the signature page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ signature: this.data.userForm.signature || undefined, /** * Purpose: type supports index.js by holding or executing the type page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ type: 3, /** * Purpose: shopIds supports index.js by holding or executing the shop ids page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ shopIds: selectedShop ? [Number(selectedShop.id)] : [] } if (this.data.userForm.password) { userPayload.password = this.data.userForm.password } try { let targetUserId = this.data.userId if (this.data.mode === 'edit') { await userApi.updateUser(targetUserId, userPayload) } else { targetUserId = await userApi.createUser(userPayload) } await artistApi.saveNailArtistInfo({ /** * Purpose: userId supports index.js by holding or executing the user id page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ userId: Number(targetUserId), /** * Purpose: identity supports index.js by holding or executing the identity page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ identity: this.data.artistForm.identity || undefined, /** * Purpose: experience supports index.js by holding or executing the experience page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ experience: this.data.artistForm.experience ? Number(this.data.artistForm.experience) : 0, /** * Purpose: skills supports index.js by holding or executing the skills page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ skills: this._selectedTagIds.join(',') || undefined, /** * Purpose: rating supports index.js by holding or executing the rating page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ rating: this.data.artistForm.rating ? Number(this.data.artistForm.rating) : 0, /** * Purpose: status supports index.js by holding or executing the status page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ status: this.data.statusIndex === 1 ? 0 : 1, /** * Purpose: portfolio supports index.js by holding or executing the portfolio page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ portfolio: this._selectedProductIds.join(',') || undefined, /** * Purpose: nickname supports index.js by holding or executing the nickname page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ nickname: this.data.userForm.nickname, /** * Purpose: shopId supports index.js by holding or executing the shop id page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ shopId: selectedShop ? Number(selectedShop.id) : undefined, /** * Purpose: signature supports index.js by holding or executing the signature page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ signature: this.data.userForm.signature || undefined }) wx.showToast({ /** * Purpose: title supports index.js by holding or executing the title page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ title: this.data.mode === 'edit' ? '美甲师已更新' : '美甲师已创建', /** * Purpose: icon supports index.js by holding or executing the icon page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ icon: 'none' }) navigation.goBack('/pages/artists/index') } catch (error) { wx.showToast({ /** * Purpose: title supports index.js by holding or executing the title page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ title: error.message || '保存失败', /** * Purpose: icon supports index.js by holding or executing the icon page or API role. * Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow. */ icon: 'none' }) } } })