保存客户与美甲师表单改造检查点

This commit is contained in:
2026-10-29 17:02:57 +08:00
parent bb3d00c51e
commit b3a8c7e01c
24 changed files with 425 additions and 60 deletions
+7 -4
View File
@@ -9,6 +9,7 @@ Page({
creating: false,
createForm: {
nickname: '',
wechatId: '',
phone: ''
}
},
@@ -72,6 +73,7 @@ Page({
this.setData({
createForm: {
nickname: '',
wechatId: '',
phone: ''
}
})
@@ -80,18 +82,19 @@ Page({
async submitCustomer() {
const form = this.data.createForm
const nickname = String(form.nickname || '').trim()
const wechatId = String(form.wechatId || '').trim()
const phone = String(form.phone || '').trim()
if (!nickname || !phone) {
wx.showToast({ title: '请填写客户姓名和手机号', icon: 'none' })
if (!nickname) {
wx.showToast({ title: '请填写客户姓名', icon: 'none' })
return
}
if (!/^1[3-9]\d{9}$/.test(phone)) {
if (phone && !/^1[3-9]\d{9}$/.test(phone)) {
wx.showToast({ title: '请输入正确手机号', icon: 'none' })
return
}
this.setData({ creating: true })
try {
await customersApi.create({ nickname, phone })
await customersApi.create({ nickname, wechatId: wechatId || undefined, phone: phone || undefined })
wx.showToast({ title: '客户已新增', icon: 'success' })
this.resetCreateForm()
this.setData({ createModalVisible: false })