新增客户备注字段

This commit is contained in:
2026-07-25 19:12:37 +08:00
parent 453b451014
commit e1e6385b44
7 changed files with 36 additions and 3 deletions
+10 -3
View File
@@ -76,7 +76,8 @@ Page({
creating: false,
createForm: {
nickname: '',
phone: ''
phone: '',
remark: ''
}
},
@@ -141,7 +142,8 @@ Page({
this.setData({
createForm: {
nickname: '',
phone: ''
phone: '',
remark: ''
}
})
},
@@ -150,13 +152,18 @@ Page({
const form = this.data.createForm
const nickname = String(form.nickname || '').trim()
const phone = String(form.phone || '').trim()
const remark = String(form.remark || '').trim()
if (!nickname) {
wx.showToast({ title: '请填写客户姓名', icon: 'none' })
return
}
this.setData({ creating: true })
try {
const payload = phone ? { nickname, phone } : { nickname }
const payload = {
nickname,
...(phone ? { phone } : {}),
...(remark ? { remark } : {})
}
await customersApi.create(payload)
wx.showToast({ title: '客户已新增', icon: 'success' })
this.resetCreateForm()