master
271556543@qq.com 4 years ago
parent dd874abd10
commit 34985bb95b

@ -16,11 +16,11 @@ export function customerDetail(params){
})
}
export function scheduleSave(params){
export function scheduleSave(data){
return request({
method:'post',
url:'/api/admin/schedule/schedule-save',
params
data
})
}

@ -1,29 +1,117 @@
<template>
<div>
<div>
<div class="statistics">
<div>
<el-card>
<div>营业统计</div>
<div>
</div>
</el-card>
</div>
<div>
<el-card>
<div>人效统计</div>
</el-card>
</div>
<div>
<el-card>
<div>客户统计</div>
</el-card>
</div>
<div>
<el-card>
<div>订单统计</div>
</el-card>
</div>
</div>
<div class="chart">
<div id="col-chart"></div>
<div id="line-chart"></div>
</div>
</div>
</template>
<script>
export default {
components: {
},
data() {
return {
}
},
created: function() {
},
methods: {
import echarts from "echarts"
export default {
components: {},
data() {
return {}
},
methods: {
init() {
let col = echarts.init(document.getElementById('col-chart'))
col.setOption({
title: {
text: '营业与收入'
},
tooltip: {},
xAxis: {
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
})
let line = echarts.init(document.getElementById('line-chart'))
line.setOption({
title: {
text: '客户与订单'
},
tooltip: {},
xAxis: {
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
})
}
},
mounted() {
this.init()
}
}
</script>
<style lang="scss" scoped>
.statistics{
display: flex;
&>div{
height: 100px;
flex: 1;
margin-right: 20px;
&:last-child{
margin-right: 0;
}
}
}
.chart{
display: flex;
#col-chart {
background: #fff;
border-radius: 10px;
flex: 1;
height: 300px;
margin-right: 30px;
}
#line-chart {
background: #fff;
border-radius: 10px;
flex: 1;
height: 300px;
}
}
</style>

@ -108,6 +108,23 @@
</div>
</template>
<template v-slot:account_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>结算对象
</div>
<div class="xy-table-item-content">
<el-select
v-model="form.account_id"
v-load-more="productLoad"
placeholder="请选择结算对象"
style="width: 300px">
<el-option v-for="item in accounts" :key="item.id" :label="item.value" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:status>
<div class="xy-table-item">
<div class="xy-table-item-label">
@ -131,6 +148,12 @@ import {getList as customList} from '@/api/customer'
import {getList as productList} from '@/api/product'
import {save,getForm} from '@/api/order'
export default {
props:{
accounts:{
type:Array,
default:()=>[]
}
},
data() {
return {
id: '',
@ -191,6 +214,7 @@ export default {
unit_price: '',
total_time: '',
total_money: '',
account_id:'',
status: '',
},
rules: {
@ -217,6 +241,9 @@ export default {
],
status:[
{required: true, message: '请选择状态'}
],
account_id:[
{required: true, message: '请选择结算对象'}
]
}
}
@ -231,6 +258,7 @@ export default {
unit_price: '',
total_time: '',
total_money: '',
account_id: '',
status: '',
}
},

@ -25,12 +25,13 @@
@pageSizeChange="e => select.page_size = e"
@pageIndexChange="e => {select.page = e;getOrder()}"></xy-table>
<add-order ref="addOrder" @refresh="getOrder"></add-order>
<add-order ref="addOrder" :accounts="accounts" @refresh="getOrder"></add-order>
</div>
</template>
<script>
import {getList,destroy} from '@/api/order'
import {getparameter} from '@/api/system/dictionary'
import addOrder from "@/views/order/component/addOrder";
export default {
@ -45,6 +46,7 @@ export default {
keyword:''
},
accounts:[],
total:0,
list:[
@ -125,6 +127,11 @@ export default {
}
},
methods: {
async getAccounts(){
const res = await getparameter({number:'accounts'})
this.accounts = res.detail
},
async getOrder(){
const res = await getList(this.select)
this.total = res.total
@ -145,6 +152,7 @@ export default {
}
},
mounted() {
this.getAccounts()
this.getOrder()
}
}

@ -55,7 +55,7 @@ export default {
{
prop:'name',
label:'名称',
width:200,
minWidth:200,
fixed:'left',
align:'left'
},

@ -2,165 +2,140 @@
<div v-if="detail">
<xy-dialog
ref="dialog"
:form="form"
:rules="rules"
:is-show.sync="isShow"
:width='84'
:width='72'
title="排班"
type="form"
@submit="submit"
type="normal"
@reset="pickType = 1,dateStartPick = '',dateEndPick = ''">
<template v-slot:extraFormTop>
<div :style="{
'display':'flex',
'align-items':'center',
'flex-wrap':'wrap',
'min-width':'380px'
}">
<el-form-item>
<div class="xy-table-item">
<div class="xy-table-item-label">
性别
</div>
<div class="xy-table-item-content">
<el-input v-model="detail.sex" readonly style="width: 300px;"></el-input>
</div>
</div>
</el-form-item>
<template>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
姓名
</el-col>
<el-col :span="18">
<el-input v-model="detail.name" readonly style="width: 300px;">
</el-input>
</el-col>
</el-row>
<el-form-item>
<div class="xy-table-item">
<div class="xy-table-item-label">
年龄
</div>
<div class="xy-table-item-content">
<el-input :value="ageComputed" readonly style="width: 300px;"></el-input>
</div>
</div>
</el-form-item>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
性别
</el-col>
<el-col :span="18">
<el-input v-model="detail.sex" readonly style="width: 300px;">
</el-input>
</el-col>
</el-row>
<el-form-item>
<div class="xy-table-item">
<div class="xy-table-item-label">
身份证号
</div>
<div class="xy-table-item-content">
<el-input :value="detail.idcard" readonly style="width: 300px;"></el-input>
</div>
</div>
</el-form-item>
<el-form-item>
<div class="xy-table-item">
<div class="xy-table-item-label">
失能等级
</div>
<div class="xy-table-item-content">
<el-select v-model="detail.level_id" disabled placeholder="请选择失能等级" style="width: 300px">
<el-option v-for="item in levels" :key="item.id" :label="item.value" :value="item.id"></el-option>
</el-select>
</div>
</div>
</el-form-item>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
身份证号
</el-col>
<el-col :span="18">
<el-input v-model="detail.idcard" readonly style="width: 300px;">
</el-input>
</el-col>
</el-row>
<el-form-item>
<div class="xy-table-item">
<div class="xy-table-item-label">
备注
</div>
<div class="xy-table-item-content">
<el-input v-model="detail.remark" :autosize="{minRows:2}" placeholder="请输入备注" readonly
style="width: 300px;"
type="textarea"></el-input>
</div>
</div>
</el-form-item>
</div>
</template>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
年龄
</el-col>
<el-col :span="18">
<el-input :value="ageComputed" readonly style="width: 300px;">
</el-input>
</el-col>
</el-row>
<template v-slot:customer_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
客户
</div>
<div class="xy-table-item-content">
<el-select v-model="form.customer_id" disabled placeholder="请选择客户" style="width: 300px">
<el-option v-for="item in customers" :key="item.id" :label="item.name" :value="item.id"></el-option>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
评估等级
</el-col>
<el-col :span="18">
<el-select v-model="detail.level_id" disabled placeholder="请选择失能等级" style="width: 300px">
<el-option v-for="item in levels" :key="item.id" :label="item.value" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
</el-col>
</el-row>
<template v-slot:product_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
产品
</div>
<div class="xy-table-item-content">
<el-select v-model="form.product_id" placeholder="请选择产品" style="width: 300px">
<el-option v-for="item in products" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
上门地址
</el-col>
<el-col :span="18">
<el-input style="width: 300px;" readonly :value="defaultAddress(detail.customer_address)"></el-input>
</el-col>
</el-row>
<template v-slot:account_id >
<div class="xy-table-item">
<div class="xy-table-item-label">
结算对象
</div>
<div class="xy-table-item-content">
<el-select v-model="form.account_id " placeholder="请选择结算对象" style="width: 300px">
<el-option v-for="item in accounts" :key="item.id" :label="item.value" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
备注
</el-col>
<el-col :span="18">
<el-input style="width: 300px;" v-model="detail.remark" readonly></el-input>
</el-col>
</el-row>
<template v-slot:order_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
订单
</div>
<div class="xy-table-item-content">
<el-select v-model="form.order_id" placeholder="请选择订单" style="width: 300px">
<el-option v-for="item in orders" :key="item.id" :label="item.no" :value="item.id"></el-option>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>产品
</el-col>
<el-col :span="18">
<el-select style="width: 300px;" v-model="productId">
<el-option v-for="item in products" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
</el-col>
</el-row>
<template v-slot:schedule_list_skus>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>关联服务
</div>
<div class="xy-table-item-content">
<el-select v-model="form.schedule_list_skus" style="width: 300px;" placeholder="请选择关联服务" multiple value-key="sku_id">
<el-option v-for="(item,index) in skus" :value="{sku_id:item.id}" :label="item.name" :key="item.id"></el-option>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>订单
</el-col>
<el-col :span="18">
<el-select style="width: 300px;" v-model="orderId">
<el-option v-for="item in orders" :label="item.no" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
</el-col>
</el-row>
<template v-slot:extraFormBottom>
<el-calendar>
<template v-slot:dateCell="{date, data}">
<div style="display:flex;flex-direction: column;justify-content: center;align-items: center;width: 100%;height: 100%">
<div>{{data.day}}</div>
<i class="el-icon-plus" style="font-size: 22px;padding:10px;"></i>
<div @click="datePick(date,data)" style="display:flex;flex-direction: column;justify-content: center;align-items: center;width: 100%;height: 100%">
<div>{{timeFormat(date)}}</div>
<template v-if="data.type === 'current-month'">
<i class="el-icon-plus" style="padding:10px;"></i>
</template>
</div>
</template>
</el-calendar>
</template>
<template v-slot:footerContent>
<Button type="primary" @click="isShow = false">确认</Button>
</template>
</xy-dialog>
<timeSelect
:is-show.sync="isShowTime"
:nurses="nurses"
:skus="skus"
:date="date"
:order-id="orderId"
:product-id="productId"
:customer-id="detail.id"></timeSelect>
</div>
</template>
<script>
import {customerDetail,scheduleSave} from '@/api/schedule'
import {parseTime} from '@/utils'
import {customerDetail} from '@/api/schedule'
import timeSelect from "@/views/schedule/component/timeSelect";
export default {
components:{
timeSelect
},
props: {
customers: {
type: Array,
@ -186,48 +161,37 @@ export default {
type: Array,
default: () => []
},
accounts:{
type: Array,
default: () => []
}
},
data() {
return {
productId: '',
customerId: '',
orderId:'',
isShow: false,
isShowTime:false,
date:'',
detail: {},
detail: '',
dateStartPick:'',
dateEndPick:'',
pickType:1,
form: {
customer_id: '',
product_id: '',
account_id:'',
order_id: '',
start_time: '',
end_time: '',
nurse_id: '',
schedule_list_skus:[],
},
rules:{
product_id:[
{required:true,message:'请选择产品'}
],
order_id:[
{required:true,message:'请选择订单'}
],
start_time:[
{required:true,message:'请选择开始时间'}
],
end_time:[
{required:true,message:'请选择结束时间'}
]
}
}
},
methods: {
datePick(date,data){
console.log(date,data)
if(data.type === 'current-month'){
this.date = data.day
if(this.orderId && this.productId){
this.isShowTime = true
}else{
this.$message({
type:'warning',
message:'请先选择订单与产品'
})
}
}
},
async getCustomer() {
const res = await customerDetail({
product_id: this.form.product_id,
@ -237,13 +201,6 @@ export default {
this.detail = res.detail
},
dateConfirm(data){
if(this.pickType === 1){
this.pickType = 2
return
}
this.$refs[`popover-${data.day}`].doClose()
},
datePicked(data,date){
if(this.pickType === 1){
this.dateStartPick = data.day
@ -252,20 +209,22 @@ export default {
this.dateEndPick = data.day
}
},
submit() {
this.form.start_time = `${this.dateStartPick} ${this.form.start_time}`
this.form.end_time = `${this.dateEndPick || this.dateStartPick} ${this.form.end_time}`
scheduleSave(this.form).then(res => {
this.$successMessage('排班','')
this.isShow = false
})
}
},
computed: {
ageComputed() {
return new Date().getFullYear() - new Date(this.detail.birthday).getFullYear()
},
defaultAddress(){
return function (adds){
if(!adds instanceof Array){
return '无地址'
}
return adds.filter(item => {
return item.default === 1
})[0]?.address || adds[0]?.address || '无地址'
}
},
isInDate(){
return function (day){
let startTimer = new Date(this.dateStartPick).getTime()
@ -273,17 +232,21 @@ export default {
let dayTimer = new Date(day).getTime()
return dayTimer >= startTimer && dayTimer <= endTimer
}
}
},
timeFormat(){
return function (data){
return parseTime(data,'{dd}')
}
},
},
watch: {
isShow(val) {
if (val) {
//this.getCustomer()
} else {
this.pickType = 1
this.dateEndPick = ''
this.dateStartPick = ''
this.$refs['dialog'].reset()
this.orderId = ''
this.productId = ''
this.date = ''
}
}
}
@ -299,4 +262,10 @@ export default {
::v-deep .el-calendar-day{
padding: 0 !important;
}
::v-deep .el-row {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
}
</style>

@ -0,0 +1,144 @@
<template>
<div>
<Modal :value="isShow" title="排班" width="48" @on-visible-change="e => $emit('update:isShow',e)">
<template v-slot:default>
<el-form ref="elForm" :model="form" :rules="rules" label-width="80px">
<el-form-item label="时间选择" prop="end_time">
<div style="font-weight: 600">{{ date }}</div>
<el-time-picker
v-model="time"
arrow-control
end-placeholder="结束时间"
is-range
placeholder="选择时间范围"
range-separator="-"
start-placeholder="开始时间"
style="width: 300px;"
value-format="hh:mm:ss"
@change="timePick">
</el-time-picker>
</el-form-item>
<el-form-item label="护工选择" prop="nurse_id">
<el-select v-model="form.nurse_id" placeholder="请选择护工" style="width: 300px;">
<el-option v-for="(item,index) in nurses" :key="item.index" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="服务项目" prop="schedule_list_skus">
<el-checkbox-group v-model="form.schedule_list_skus">
<template v-for="(item) in skus">
<el-checkbox :label="item.id">{{ item.name }}</el-checkbox>
</template>
</el-checkbox-group>
</el-form-item>
</el-form>
</template>
<template v-slot:footer>
<Button @click="$emit('update:isShow',false)"></Button>
<Button type="primary" @click="submit"></Button>
</template>
</Modal>
</div>
</template>
<script>
import {parseTime} from '@/utils'
import {scheduleSave} from '@/api/schedule'
export default {
props: {
customerId: [Number, String],
orderId: [Number, String],
productId: [Number, String],
date: {
type: String,
default: ''
},
isShow: {
type: Boolean,
default: false
},
skus: {
type: Array,
default: () => []
},
nurses: {
type: Array,
default: () => []
}
},
data() {
return {
form: {
customer_id: '',
product_id: '',
order_id: '',
nurse_id: '',
start_time:'',
end_time: '',
schedule_list_skus: []
},
time: [new Date(),new Date()],
rules: {
nurse_id: [
{required: true, message: '请选择护工'}
],
start_time: [
{required: true, message: '请选择开始时间'}
],
end_time: [
{required: true, message: '请选择结束时间'}
],
schedule_list_skus: [
{required: true, message: '请选择护理项目'}
]
}
}
},
methods: {
timePick(e) {
this.form.start_time = `${this.date} ${e[0]}`
this.form.end_time = `${this.date} ${e[1]}`
},
submit() {
this.form.customer_id = this.customerId
this.form.product_id = this.productId
this.form.order_id = this.orderId
let temp = this.form.schedule_list_skus.map(item => {
return {sku_id: item}
})
this.form.schedule_list_skus = temp
this.$refs['elForm'].validate().then(valid => {
console.log(valid)
if (valid) {
scheduleSave(this.form).then(res => {
this.$successMessage('add', '排班')
this.$emit('update:isShow', false)
}).catch(err => {
this.$emit('update:isShow', false)
})
}
})
}
},
watch: {
isShow(val) {
if(val){
this.form.start_time = `${this.date} ${parseTime(new Date(),'{h}:{i}:{s}')}`
this.form.end_time = `${this.date} ${parseTime(new Date(),'{h}:{i}:{s}')}`
}else{
this.$refs['elForm'].resetFields()
}
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-form-item__error {
transform: none !important;
left: 0 !important;
}
</style>

@ -7,7 +7,7 @@
<div style="display: flex">
<el-tag effect="dark" style="margin-right: 10px;" type="warning">应排客户</el-tag>
<el-tag effect="dark" style="margin-right: 10px;" type="success">已排客户</el-tag>
<Input placeholder="关键字搜索" style="width: 200px; margin-right: 10px"/>
<Input v-model="select.keyword" placeholder="关键字搜索" style="width: 200px; margin-right: 10px"/>
<Button style="margin-right: 10px" type="primary" @click="select.page = 1,getCustomers">查询</Button>
<xy-selectors>
@ -38,7 +38,7 @@
:nurses="nurses"
:levels="levels"
:orders="orders"
:skus="skus" :accounts="accounts"></add-schedule>
:skus="skus"></add-schedule>
</div>
</template>
@ -61,6 +61,7 @@ export default {
select: {
page: 1,
page_size: 10,
keyword:''
},
customers:[],
products:[],
@ -139,11 +140,6 @@ export default {
}
},
methods: {
async getAccounts(){
const res = await getparameter({number:'account'})
this.accounts = res.detail
},
async getSkus(){
const res = await skuIndex({page_size:9999,page:1})
this.skus = res.data
@ -174,7 +170,6 @@ export default {
schedule(row){
this.$refs['addSchedule'].detail = row
this.$refs['addSchedule'].form.customer_id = row.id
this.orders = row.orders
this.$refs['addSchedule'].isShow = true
}
@ -186,7 +181,6 @@ export default {
this.getLevels()
this.getCustomerList()
this.getSkus()
this.getAccounts()
}
}
</script>

Loading…
Cancel
Save