|
|
|
|
@ -1,4 +1,3 @@
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<el-card shadow="never" style="margin-top: 20px;">
|
|
|
|
|
@ -6,14 +5,37 @@
|
|
|
|
|
<slot name="header">
|
|
|
|
|
<vxe-toolbar ref="toolbar" :export="isHasAuth('export')" :print="isHasAuth('print')" custom>
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<el-form :inline="true" :model="searchForm" class="demo-form-inline">
|
|
|
|
|
<el-form-item label="订单状态">
|
|
|
|
|
<el-select v-model="searchForm.pay_status" placeholder="请选择订单状态" clearable @clear="handleSearch">
|
|
|
|
|
<el-option v-for="[key, value] in pay_status" :key="key" :label="value" :value="key" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="服务状态">
|
|
|
|
|
<el-select v-model="searchForm.status" placeholder="请选择服务状态" clearable @clear="handleSearch">
|
|
|
|
|
<el-option v-for="[key, value] in status" :key="key" :label="value" :value="key" />
|
|
|
|
|
<el-option label="已分配" value="assigned" />
|
|
|
|
|
<el-option label="未分配" value="unassigned" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="isHasAuth('search')"
|
|
|
|
|
icon="el-icon-search"
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
size="small"
|
|
|
|
|
@click="order_id='',getList()"
|
|
|
|
|
@click="handleSearch"
|
|
|
|
|
>搜索</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
icon="el-icon-refresh"
|
|
|
|
|
type="info"
|
|
|
|
|
plain
|
|
|
|
|
size="small"
|
|
|
|
|
@click="resetSearch"
|
|
|
|
|
>重置</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-toolbar>
|
|
|
|
|
</slot>
|
|
|
|
|
@ -61,6 +83,15 @@
|
|
|
|
|
field="pay_status"
|
|
|
|
|
width="120"
|
|
|
|
|
title="订单状态"
|
|
|
|
|
:formatter="({ cellValue }) => (pay_status.get(cellValue))"
|
|
|
|
|
:edit-render="{ name: 'VxeTreeSelect', options: Array.from(pay_status), props: { multiple: false }, optionProps: { value: '0', label: '1' } }"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<vxe-column
|
|
|
|
|
align="center"
|
|
|
|
|
field="status"
|
|
|
|
|
width="120"
|
|
|
|
|
title="服务状态"
|
|
|
|
|
:formatter="({ cellValue }) => (status.get(cellValue))"
|
|
|
|
|
:edit-render="{ name: 'VxeTreeSelect', options: Array.from(status), props: { multiple: false }, optionProps: { value: '0', label: '1' } }"
|
|
|
|
|
/>
|
|
|
|
|
@ -163,20 +194,34 @@
|
|
|
|
|
>取消</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<!-- 待审核状态:显示通过和拒绝按钮 -->
|
|
|
|
|
<template v-if="row.pay_status === 3">
|
|
|
|
|
<el-button
|
|
|
|
|
size="small"
|
|
|
|
|
type="success"
|
|
|
|
|
@click="approveOrder(row)"
|
|
|
|
|
>通过</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="small"
|
|
|
|
|
type="danger"
|
|
|
|
|
@click="rejectOrder(row)"
|
|
|
|
|
>拒绝</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<!-- 已支付状态:显示分配按钮 -->
|
|
|
|
|
<template v-else-if="row.pay_status === 1">
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="isHasAuth('assign')"
|
|
|
|
|
size="small"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="isShowAssign = true,$refs['Assign'].row = row"
|
|
|
|
|
>分配</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<!-- 编辑和删除按钮在所有状态下都显示 -->
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="isHasAuth('edit')"
|
|
|
|
|
size="small"
|
|
|
|
|
type="warning"
|
|
|
|
|
@click="editRowEvent(row)"
|
|
|
|
|
>编辑</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="isHasAuth('delete')"
|
|
|
|
|
size="small"
|
|
|
|
|
type="danger"
|
|
|
|
|
@click="destroyRowEvent(row)"
|
|
|
|
|
@ -264,11 +309,24 @@ export default {
|
|
|
|
|
validRules: {
|
|
|
|
|
pay_status: [{ 'required': true, 'message': '标题必填' }]
|
|
|
|
|
},
|
|
|
|
|
status: new Map([
|
|
|
|
|
pay_status: new Map([
|
|
|
|
|
[0, '待支付'],
|
|
|
|
|
[1, '已支付'],
|
|
|
|
|
[2, '已退款']
|
|
|
|
|
])
|
|
|
|
|
[2, '已退款'],
|
|
|
|
|
[3, '待审核'],
|
|
|
|
|
[4, '已拒绝']
|
|
|
|
|
]),
|
|
|
|
|
status: new Map([
|
|
|
|
|
[0, '待处理'],
|
|
|
|
|
[1, '已到客户家'],
|
|
|
|
|
[2, '已接到客户'],
|
|
|
|
|
[3, '已到医院'],
|
|
|
|
|
[4, '已完成诊疗']
|
|
|
|
|
]),
|
|
|
|
|
searchForm: {
|
|
|
|
|
pay_status: '',
|
|
|
|
|
status: ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
@ -374,14 +432,62 @@ export default {
|
|
|
|
|
async getList() {
|
|
|
|
|
this.loading = true
|
|
|
|
|
try {
|
|
|
|
|
const filter = [
|
|
|
|
|
{
|
|
|
|
|
key: 'id',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: this.order_id ? this.order_id : ''
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'pay_status',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: this.searchForm.pay_status || ''
|
|
|
|
|
}
|
|
|
|
|
].filter(item => item.value !== '')
|
|
|
|
|
|
|
|
|
|
// 处理服务状态筛选
|
|
|
|
|
if (this.searchForm.status === 'assigned') {
|
|
|
|
|
// 已分配:nurse_id 不为空且 status=0,且必须是已支付状态
|
|
|
|
|
filter.push({
|
|
|
|
|
key: 'pay_status',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: 1
|
|
|
|
|
})
|
|
|
|
|
filter.push({
|
|
|
|
|
key: 'nurse_id',
|
|
|
|
|
op: 'notnull',
|
|
|
|
|
value: ''
|
|
|
|
|
})
|
|
|
|
|
filter.push({
|
|
|
|
|
key: 'status',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: 0
|
|
|
|
|
})
|
|
|
|
|
} else if (this.searchForm.status === 'unassigned') {
|
|
|
|
|
// 未分配:nurse_id 为空,且必须是已支付状态
|
|
|
|
|
filter.push({
|
|
|
|
|
key: 'pay_status',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: 1
|
|
|
|
|
})
|
|
|
|
|
filter.push({
|
|
|
|
|
key: 'nurse_id',
|
|
|
|
|
op: 'isnull',
|
|
|
|
|
value: ''
|
|
|
|
|
})
|
|
|
|
|
} else if (this.searchForm.status !== '') {
|
|
|
|
|
// 普通状态筛选
|
|
|
|
|
filter.push({
|
|
|
|
|
key: 'status',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: this.searchForm.status
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const res = await index({
|
|
|
|
|
...this.select,
|
|
|
|
|
show_relation:['accompanyProduct','userArchive'],
|
|
|
|
|
filter:[{
|
|
|
|
|
key:'id',
|
|
|
|
|
op:'eq',
|
|
|
|
|
value:this.order_id?this.order_id:''
|
|
|
|
|
}]
|
|
|
|
|
show_relation: ['accompanyProduct', 'userArchive'],
|
|
|
|
|
filter: filter
|
|
|
|
|
}, false)
|
|
|
|
|
this.tableData = res.data
|
|
|
|
|
this.total = res.total
|
|
|
|
|
@ -454,8 +560,58 @@ export default {
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleSearch() {
|
|
|
|
|
this.select.page = 1
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
resetSearch() {
|
|
|
|
|
this.searchForm = {
|
|
|
|
|
pay_status: '',
|
|
|
|
|
status: ''
|
|
|
|
|
}
|
|
|
|
|
this.select.page = 1
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
approveOrder(row) {
|
|
|
|
|
// 通过订单逻辑
|
|
|
|
|
this.$confirm('确认通过该订单?', '提示', {
|
|
|
|
|
confirmButtonText: '确认',
|
|
|
|
|
cancelButtonText: '取消'
|
|
|
|
|
}).then(async() => {
|
|
|
|
|
try {
|
|
|
|
|
// 调用save接口,将pay_status改为1(待支付)
|
|
|
|
|
await save({
|
|
|
|
|
id: row.id,
|
|
|
|
|
pay_status: 0
|
|
|
|
|
}, false)
|
|
|
|
|
this.$message.success('订单已通过')
|
|
|
|
|
this.getList()
|
|
|
|
|
} catch (err) {
|
|
|
|
|
this.$message.error('操作失败')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
rejectOrder(row) {
|
|
|
|
|
// 拒绝订单逻辑
|
|
|
|
|
this.$confirm('确认拒绝该订单?', '提示', {
|
|
|
|
|
confirmButtonText: '确认',
|
|
|
|
|
cancelButtonText: '取消'
|
|
|
|
|
}).then(async() => {
|
|
|
|
|
try {
|
|
|
|
|
// 调用save接口,将pay_status改为4(已拒绝)
|
|
|
|
|
await save({
|
|
|
|
|
id: row.id,
|
|
|
|
|
pay_status: 4
|
|
|
|
|
}, false)
|
|
|
|
|
this.$message.success('订单已拒绝')
|
|
|
|
|
this.getList()
|
|
|
|
|
} catch (err) {
|
|
|
|
|
this.$message.error('操作失败')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|