This commit is contained in:
@@ -47,14 +47,19 @@ module.exports = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 后台按预约/订单上下文单次取号,号码不入库、不缓存。
|
||||
* 后台按预约/订单上下文单次取号,号码不入库、不缓存;散客可不传 customerId。
|
||||
*/
|
||||
dialCustomer(customerId, orderId) {
|
||||
dialCustomer(params) {
|
||||
const source = params || {}
|
||||
const query = {}
|
||||
if (source.customerId) query.customerId = source.customerId
|
||||
if (source.appointmentId) query.appointmentId = source.appointmentId
|
||||
if (source.orderId) query.orderId = source.orderId
|
||||
return request({
|
||||
url: `/manager/customers/${customerId}/dial`,
|
||||
url: '/manager/customers/dial',
|
||||
method: 'POST',
|
||||
data: {},
|
||||
params: { orderId }
|
||||
params: query
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -135,13 +135,17 @@ Page({
|
||||
async dialCustomer() {
|
||||
const appointment = this.data.appointment || {}
|
||||
if (this.data.dialing) return
|
||||
if (!appointment.customerPhoneAvailable || !appointment.customerId || !appointment.orderId) {
|
||||
if (!appointment.customerPhoneAvailable || !appointment.orderId) {
|
||||
wx.showToast({ title: '该客户暂无可拨打的手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ dialing: true })
|
||||
try {
|
||||
const result = await customersApi.dialCustomer(appointment.customerId, appointment.orderId)
|
||||
const result = await customersApi.dialCustomer({
|
||||
customerId: appointment.customerId,
|
||||
appointmentId: appointment.orderItemId,
|
||||
orderId: appointment.orderId
|
||||
})
|
||||
if (!result || !result.dialNumber) {
|
||||
throw new Error('未获取到可拨打号码')
|
||||
}
|
||||
|
||||
@@ -95,4 +95,7 @@ const styles = fs.readFileSync(path.join(__dirname, 'index.wxss'), 'utf8')
|
||||
;['订单编号', '服务项目', '美甲师', '时长', '成交金额', '取消原因', 'remarkText', 'customerPhoneText'].forEach(text => assert(markup.includes(text)))
|
||||
assert.match(markup, /class="primary-btn transfer-action"/)
|
||||
assert.match(markup, /class="danger-btn"/)
|
||||
assert.match(markup, /appointment\.customerPhoneAvailable && appointment\.orderId/)
|
||||
assert.strictEqual(markup.includes('appointment.customerId && appointment.orderId'), false)
|
||||
assert.match(styles, /\.transfer-action\s*\{[^}]*box-shadow/)
|
||||
assert.match(styles, /\.call-btn\s*\{/)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<view class="phone-row">
|
||||
<text class="phone">{{appointment.customerPhoneText}}</text>
|
||||
<button
|
||||
wx:if="{{appointment.customerPhoneAvailable && appointment.customerId && appointment.orderId}}"
|
||||
wx:if="{{appointment.customerPhoneAvailable && appointment.orderId}}"
|
||||
class="call-btn"
|
||||
size="mini"
|
||||
loading="{{dialing}}"
|
||||
|
||||
Reference in New Issue
Block a user