新增客户备注字段
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -66,6 +66,10 @@
|
||||
<text>手机号</text>
|
||||
<input value="{{createForm.phone}}" data-field="phone" bindinput="onCreateInput" type="number" placeholder="请输入手机号" />
|
||||
</view>
|
||||
<view class="modal-field modal-textarea-field">
|
||||
<text>备注</text>
|
||||
<textarea value="{{createForm.remark}}" data-field="remark" bindinput="onCreateInput" maxlength="200" placeholder="请输入客户备注"></textarea>
|
||||
</view>
|
||||
</view>
|
||||
<button class="primary-btn modal-submit" loading="{{creating}}" bindtap="submitCustomer">保存客户</button>
|
||||
</view>
|
||||
|
||||
@@ -280,6 +280,14 @@
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.modal-textarea-field textarea {
|
||||
width: 100%;
|
||||
min-height: 110rpx;
|
||||
color: #2c2722;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.modal-submit {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user