完善店员申请关联与预约页面
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
global.wx = {
|
||||
showToast: () => {},
|
||||
showModal: options => options.success({ confirm: false }),
|
||||
navigateTo: () => {},
|
||||
navigateBack: () => {}
|
||||
}
|
||||
|
||||
let definition
|
||||
global.Page = value => { definition = value }
|
||||
require('./index')
|
||||
|
||||
function createPage() {
|
||||
return {
|
||||
...definition,
|
||||
data: { ...definition.data },
|
||||
setData(values) { Object.assign(this.data, values) }
|
||||
}
|
||||
}
|
||||
|
||||
const page = createPage()
|
||||
page.applyAppointment({
|
||||
orderId: 1,
|
||||
orderNo: 'SALON-001',
|
||||
customerName: '到店客户',
|
||||
customerPhone: null,
|
||||
productTitle: null,
|
||||
artistName: null,
|
||||
artistId: null,
|
||||
assignmentStatus: 'UNASSIGNED',
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
durationMinutes: null,
|
||||
amount: null,
|
||||
remark: null,
|
||||
status: 0,
|
||||
statusText: '待确认',
|
||||
canEdit: true,
|
||||
canCancel: true
|
||||
})
|
||||
assert.strictEqual(page.data.appointment.customerPhoneText, '未留手机号')
|
||||
assert.strictEqual(page.data.appointment.productTitleText, '未记录')
|
||||
assert.strictEqual(page.data.appointment.artistNameText, '待分配')
|
||||
assert.strictEqual(page.data.appointment.amountText, '未记录')
|
||||
assert.strictEqual(page.data.appointment.remarkText, '暂无备注')
|
||||
assert.strictEqual(page.data.appointment.orderNoText, 'SALON-001')
|
||||
assert.strictEqual(page.data.showTransfer, true)
|
||||
assert.strictEqual(page.data.showConfirm, false)
|
||||
assert.strictEqual(page.data.showComplete, false)
|
||||
assert.strictEqual(page.data.showCancel, true)
|
||||
assert.strictEqual([
|
||||
page.data.appointment.customerNameText,
|
||||
page.data.appointment.customerPhoneText,
|
||||
page.data.appointment.orderNoText,
|
||||
page.data.appointment.productTitleText,
|
||||
page.data.appointment.artistNameText,
|
||||
page.data.appointment.durationText,
|
||||
page.data.appointment.amountText,
|
||||
page.data.appointment.remarkText
|
||||
].some(value => String(value).includes('null')), false)
|
||||
|
||||
page.applyAppointment({
|
||||
artistId: 9,
|
||||
assignmentStatus: 'ASSIGNED',
|
||||
status: 3,
|
||||
statusText: '已取消',
|
||||
canEdit: false,
|
||||
canCancel: false,
|
||||
cancelReason: '客户临时调整时间'
|
||||
})
|
||||
assert.strictEqual(page.data.appointment.cancelReasonText, '客户临时调整时间')
|
||||
assert.strictEqual(page.data.showTransfer, false)
|
||||
assert.strictEqual(page.data.showConfirm, false)
|
||||
assert.strictEqual(page.data.showComplete, false)
|
||||
assert.strictEqual(page.data.showCancel, false)
|
||||
|
||||
page.applyAppointment({
|
||||
artistId: 9,
|
||||
assignmentStatus: 'ASSIGNED',
|
||||
status: 4,
|
||||
statusText: '服务中',
|
||||
historicalBackfill: true,
|
||||
canEdit: false,
|
||||
canCancel: true
|
||||
})
|
||||
assert.strictEqual(page.data.showTransfer, false)
|
||||
assert.strictEqual(page.data.showComplete, true)
|
||||
assert.strictEqual(page.data.showCancel, true)
|
||||
|
||||
const markup = fs.readFileSync(path.join(__dirname, 'index.wxml'), 'utf8')
|
||||
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(styles, /\.transfer-action\s*\{[^}]*box-shadow/)
|
||||
Reference in New Issue
Block a user