支持店务修改客户联系方式和备注
This commit is contained in:
@@ -14,7 +14,13 @@ Page({
|
||||
customer: {},
|
||||
stats: { orderCount: 0, amount: 0, lastTime: '-' },
|
||||
orders: [],
|
||||
loadError: ''
|
||||
loadError: '',
|
||||
editModalVisible: false,
|
||||
saving: false,
|
||||
editForm: {
|
||||
contactPhone: '',
|
||||
remark: ''
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
@@ -43,10 +49,16 @@ Page({
|
||||
const customer = {
|
||||
id: detail.id,
|
||||
name: detail.nickname || detail.name || detail.account || '客户',
|
||||
phone: detail.contactPhone || detail.phone || '未填写'
|
||||
phone: detail.contactPhone || detail.phone || '未填写',
|
||||
contactPhone: detail.contactPhone || '',
|
||||
remark: detail.signature || ''
|
||||
}
|
||||
this.setData({
|
||||
customer,
|
||||
editForm: {
|
||||
contactPhone: customer.contactPhone || detail.phone || '',
|
||||
remark: customer.remark
|
||||
},
|
||||
avatarText: String(customer.name || '客').slice(-1),
|
||||
stats: {
|
||||
orderCount: detail.orderCount || detail.totalOrderCount || 0,
|
||||
@@ -66,6 +78,51 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
openEditModal() {
|
||||
const customer = this.data.customer || {}
|
||||
this.setData({
|
||||
editModalVisible: true,
|
||||
editForm: {
|
||||
contactPhone: customer.contactPhone || customer.phone || '',
|
||||
remark: customer.remark || ''
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
closeEditModal() {
|
||||
if (this.data.saving) {
|
||||
return
|
||||
}
|
||||
this.setData({ editModalVisible: false })
|
||||
},
|
||||
|
||||
stopTap() {
|
||||
},
|
||||
|
||||
onEditInput(event) {
|
||||
this.setData({
|
||||
[`editForm.${event.currentTarget.dataset.field}`]: event.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
async saveCustomer() {
|
||||
const form = this.data.editForm || {}
|
||||
this.setData({ saving: true })
|
||||
try {
|
||||
await customersApi.update(this.data.id, {
|
||||
contactPhone: String(form.contactPhone || '').trim(),
|
||||
remark: String(form.remark || '').trim()
|
||||
})
|
||||
wx.showToast({ title: '客户信息已保存', icon: 'success' })
|
||||
this.setData({ editModalVisible: false })
|
||||
await this.loadCustomer()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '保存失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
},
|
||||
|
||||
createAppointment() {
|
||||
if (!this.data.canCreateAppointment) {
|
||||
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
|
||||
|
||||
Reference in New Issue
Block a user