finish order filter

master
lynn 10 months ago
parent e7ad44aba7
commit 3c8933e9be

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

@ -204,11 +204,16 @@ export default {
submitAddForm() { submitAddForm() {
this.$refs.addFormRef.validate(async valid => { this.$refs.addFormRef.validate(async valid => {
if (valid) { if (valid) {
let submitData = { ...this.addForm } const submitData = { ...this.addForm }
if (submitData.id) { if (submitData.id) {
// newPasswordpassword // password
if (!submitData.newPassword) delete submitData.newPassword if (submitData.newPassword) {
delete submitData.password submitData.password = submitData.newPassword
}
delete submitData.newPassword
if (!submitData.password) {
delete submitData.password
}
} else { } else {
// passwordnewPassword // passwordnewPassword
delete submitData.newPassword delete submitData.newPassword

Loading…
Cancel
Save