master
271556543@qq.com 4 years ago
parent 29a0f3bbe5
commit e197b22273

@ -237,7 +237,7 @@ export default {
return (
<el-table-column
align={item.align ?? 'center'}
sortable={item.sortable ?? true}
sortable={item.sortable ?? false}
width={item.width ?? 'auto'}
min-width={item.minWidth ?? item.width}
header-align={item.headerAlign ?? 'center'}
@ -265,7 +265,7 @@ export default {
label={item1.label}
width={item1.width ?? 'auto'}
min-width={item1.minWidth ?? item1.width}
sortable={item1.sortable ?? true}
sortable={item1.sortable ?? false}
scopedSlots={{
default(scope) {
return item1.customFn(scope.row)
@ -283,7 +283,7 @@ export default {
label={item1.label}
width={item1.width ?? 'auto'}
min-width={item1.minWidth ?? item1.width}
sortable={item1.sortable ?? true}
sortable={item1.sortable ?? false}
type={item1.type ?? ''}
formatter={item1.formatter}>
</el-table-column>
@ -304,7 +304,7 @@ export default {
align={item.align ?? 'center'}
label={item.label}
prop={item.prop}
sortable={item.sortable ?? true}
sortable={item.sortable ?? false}
type={item.type}
selectable={item.selectable}
scopedSlots={item.type === 'expand' ? {

@ -215,6 +215,23 @@
</div>
</template>
<template v-slot:product_type_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
disabled
v-model="form1.product_type_id"
placeholder="请选择业务板块"
style="width: 300px">
<el-option v-for="item in types" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:date>
<div class="xy-table-item">
<div class="xy-table-item-label">
@ -229,7 +246,8 @@
style="width: 300px;"
type="daterange"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd"></el-date-picker>
value-format="yyyy-MM-dd"
@change="productPick"></el-date-picker>
</div>
</div>
</template>
@ -264,7 +282,7 @@
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>总计时长
</div>
<div class="xy-table-item-content xy-table-item-min">
<el-input v-model="form1.total_time"
<el-input-number :controls="false" v-model="form1.total_time"
placeholder="请输入总计时长" style="width: 300px;"/>
</div>
</div>
@ -321,6 +339,7 @@ import {getparameter} from '@/api/system/dictionary'
import {save, getInfo} from '@/api/customer'
import {save as orderSave} from '@/api/order'
import {getList as productList} from "@/api/product";
import moment from "moment";
export default {
props: {
@ -335,6 +354,10 @@ export default {
accounts:{
type: Array,
default: () => []
},
types:{
type:Array,
default:()=>[]
}
},
data() {
@ -559,6 +582,7 @@ export default {
},
form1: {
product_id: '',
product_type_id:'',
date: '',
service_times: '',
unit_price: '',
@ -567,7 +591,6 @@ export default {
account_id:'',
status: 0,
customer_id: '',
product_type_id:'',
},
rules1: {
customer_id:[
@ -619,6 +642,7 @@ export default {
}
this.form1 = {
product_id: '',
product_type_id:'',
date: '',
service_times: '',
unit_price: '',
@ -627,7 +651,6 @@ export default {
account_id:'',
status: 0,
customer_id: '',
product_type_id:'',
}
},
areaPick(e){
@ -727,6 +750,32 @@ export default {
this.form1.product_id = e.id
this.form1.product_type_id = e.product_type_id
console.log(e)
if(this.form1.product_id && this.form1.date.length>0){
let times;
let t1= moment(this.form1.date[0])
let t2 = moment(this.form1.date[1])
let unit;
switch (this.pickedProduct.cycle){
case 1:
unit = 'year'
break;
case 2:
unit = 'month'
break;
case 3:
unit = 'week'
break;
}
this.pickedProduct.cycle === 4 ? times = 1 : times = t2.diff(t1,unit) //
this.form1.service_times = this.pickedProduct.frequency * times
this.form1.total_money = Number(this.pickedProduct.purchase_price) * this.form1.service_times
this.form1.unit_price = Number(this.pickedProduct.purchase_price)
if(this.pickedProduct.type === 1){
this.form1.total_time = Number(this.pickedProduct.time_lenth) * this.form1.service_times
}else{
this.form1.total_time = this.pickedProduct.total
}
}
},
productLoad() {

@ -31,6 +31,23 @@
</div>
</template>
<template v-slot:product_type_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
disabled
v-model="form.product_type_id"
placeholder="请选择业务板块"
style="width: 300px">
<el-option v-for="item in types" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:date>
<div class="xy-table-item">
<div class="xy-table-item-label">
@ -81,7 +98,7 @@
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>总计时长
</div>
<div class="xy-table-item-content xy-table-item-min">
<el-input v-model="form.total_time"
<el-input-number :controls="false" v-model="form.total_time"
placeholder="请输入总计时长" style="width: 300px;"/>
</div>
</div>
@ -143,6 +160,10 @@ export default {
accounts:{
type:Array,
default:()=>[]
},
types:{
type:Array,
default:()=>[]
}
},
data() {
@ -194,6 +215,7 @@ export default {
pickedProduct:{},
form: {
product_id: '',
product_type_id:'',
date: '',
service_times: '',
unit_price: '',
@ -202,7 +224,6 @@ export default {
account_id:'',
status: 0,
customer_id: '',
product_type_id:'',
},
rules: {
customer_id:[
@ -239,6 +260,7 @@ export default {
initForm(){
this.form = {
product_id: '',
product_type_id:'',
date: '',
service_times: '',
unit_price: '',
@ -247,7 +269,6 @@ export default {
account_id: '',
status: 0,
customer_id: '',
product_type_id:'',
}
},

@ -25,6 +25,7 @@
:total="total"
:list="list"
:table-item="tableItem"
:default-expand-all="false"
@pageSizeChange="e => select.page_size = e"
@pageIndexChange="e => {select.page = e;getCustomers()}">
<template v-slot:btns>
@ -38,14 +39,14 @@
<Button size="small" type="error" ghost style="margin-right: 6px">删除</Button>
</Poptip>
<Button size="small" ghost type="primary" @click="editor(scope.row)" style="margin-right: 6px">编辑</Button>
<Button size="small" ghost type="primary" @click="$refs['addOrder'].isShow = true,$refs['addOrder'].form.customer_id = scope.row.id">录入</Button>
<Button size="small" type="primary" @click="$refs['addOrder'].isShow = true,$refs['addOrder'].form.customer_id = scope.row.id">录入</Button>
</template>
</el-table-column>
</template>
</xy-table>
<addOrder ref="addOrder" :accounts="accounts"></addOrder>
<add-customer ref="addCustomer" :accounts="accounts" :cities="cities" :disability-level="disabilityLevel" @refresh="getCustomers"></add-customer>
<addOrder ref="addOrder" :types="types" :accounts="accounts"></addOrder>
<add-customer ref="addCustomer" :types="types" :accounts="accounts" :cities="cities" :disability-level="disabilityLevel" @refresh="getCustomers"></add-customer>
</div>
</template>
@ -53,7 +54,7 @@
import {getList,destroy} from '@/api/customer'
import {getparameter} from '@/api/system/dictionary'
import {getList as getUnit} from "@/api/payUnit";
import {getList as getTypes} from '@/api/productType'
import addCustomer from "@/views/customer/component/addCustomer";
import addOrder from './component/addOrder'
@ -72,10 +73,94 @@ export default {
disabilityLevel: [],
cities:[],
accounts:[],
types:[],
total: 0,
list: [],
tableItem: [
{
type:'expand',
expandFn:(props) => {
return (
<Table style={{'margin':'0 166px 0 40px'}}
width={1370}
stripe={true}
border={true}
size="small"
columns={
[
{
title:'订单编号',
key:'no',
width:220,
align:'center'
},
{
title:'订单产品',
width: 200,
align:'center',
render:(h,params)=>{
return h('div',params.row.product.name)
}
},
{
title:'时间',
width: 270,
align:'center',
render:(h,params)=>{
return h('div',[
h('span',params.row.start_date),
h('span',' ~ '),
h('span',params.row.end_date)
])
}
},
{
title:'单次价格',
width: 180,
align:'right',
key:'unit_price'
},
{
title:'总计时长',
width: 160,
align: 'center',
key:'total_time'
},
{
title:'总计金额',
width: 190,
align:'right',
key:'total_money'
},
{
title:'执行状态',
align:'center',
render:(h,params)=>{
let statusName = new Map([
[0,'未开始'],
[1,'进行中'],
[2,'已完成'],
])
let statusColor = new Map([
[0,'blue'],
[1,'red'],
[2,'green'],
])
return h('div',{
style:{
color:statusColor.get(params.row.status)
}
},statusName.get(params.row.status))
}
}
]
}
data={props?.row.orders}>
</Table>
)
}
},
{
width: 40,
type:'index',
@ -85,7 +170,6 @@ export default {
prop: "name",
label: "姓名",
width: "180",
fixed:'left'
},
{
label:'订单产品',
@ -154,21 +238,26 @@ export default {
},
methods: {
async getDisabilityLevel() {
const res = await getparameter({number: 'disabilityLevel'})
const res = await getparameter({number: 'disabilityLevel'},false)
this.disabilityLevel = res.detail
},
async getCustomers() {
const res = await getList(this.select)
const res = await getList(this.select,false)
this.list = res.data.data
this.total = res.data.total
},
async getAccounts(){
const res = await getUnit({page:1,page_size:9999})
const res = await getUnit({page:1,page_size:9999},false)
this.accounts = res.data
},
async getTypes(){
const res = await getTypes({page:1,page_size:9999},false)
this.types = res.data
},
async getCity(){
let city = await getparameter({number: 'city'},false)
for(let i = 0;i < city.detail.length;i ++){
@ -201,11 +290,14 @@ export default {
this.getCustomers()
this.getCity()
this.getAccounts()
this.getTypes()
}
}
</script>
<style lang="scss" scoped>
::v-deep .ivu-table-header thead tr th{
text-align: center !important;
}
</style>

@ -32,11 +32,17 @@
</div>
<div class="xy-table-item-content">
<el-select
v-model="form.product_id"
:value="pickedProduct.name"
v-load-more="productLoad"
placeholder="请选择客户"
style="width: 300px">
<el-option v-for="item in products" :key="item.id" :label="item.name" :value="item.id"></el-option>
placeholder="请选择产品"
style="width: 300px"
@change="productPick">
<el-option
v-for="item in products"
value-key="id"
:key="item.id"
:label="item.name"
:value="item"></el-option>
</el-select>
</div>
</div>
@ -49,6 +55,7 @@
</div>
<div class="xy-table-item-content">
<el-select
disabled
v-model="form.product_type_id"
placeholder="请选择业务板块"
style="width: 300px">
@ -70,8 +77,10 @@
start-placeholder="开始时间"
style="width: 300px;"
type="daterange"
range-separator="~"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd"></el-date-picker>
value-format="yyyy-MM-dd"
@change="productPick"></el-date-picker>
</div>
</div>
</template>
@ -83,7 +92,7 @@
</div>
<div class="xy-table-item-content">
<el-input-number v-model="form.service_times" :controls="false" :precision="0"
placeholder="请输入服务次数" style="width: 300px;" @blur="totalComputed"/>
placeholder="请输入服务次数" style="width: 300px;"/>
</div>
</div>
</template>
@ -95,7 +104,7 @@
</div>
<div class="xy-table-item-content xy-table-item-price">
<el-input-number v-model="form.unit_price" :controls="false" :precision="2"
placeholder="请输入单次单价" style="width: 300px;" @blur="totalComputed"/>
placeholder="请输入单次单价" style="width: 300px;" />
</div>
</div>
</template>
@ -163,6 +172,7 @@
import {getList as customList} from '@/api/customer'
import {getList as productList} from '@/api/product'
import {save,getForm} from '@/api/order'
import moment from "moment";
export default {
props:{
accounts:{
@ -176,6 +186,7 @@ export default {
},
data() {
return {
pickedProduct:{},
id: '',
type: '',
isShow: false,
@ -290,9 +301,39 @@ export default {
this.getCustomers()
},
totalComputed(){
if(this.form.service_times && this.form.unit_price){
this.form.total_money = this.form.service_times * this.form.unit_price
productPick(e){
this.pickedProduct = e
this.form.product_id = e.id
this.form.product_type_id = e.product_type_id
console.log(e)
if(this.form.service_times || this.form.form.total_money || this.form.unit_price || this.form.total_time){
return
}
if(this.form.product_id && this.form.date.length>0){
let times;
let t1= moment(this.form.date[0])
let t2 = moment(this.form.date[1])
let unit;
switch (this.pickedProduct.cycle){
case 1:
unit = 'year'
break;
case 2:
unit = 'month'
break;
case 3:
unit = 'week'
break;
}
this.pickedProduct.cycle === 4 ? times = 1 : times = t2.diff(t1,unit) //
this.form.service_times = this.pickedProduct.frequency * times
this.form.total_money = Number(this.pickedProduct.purchase_price) * this.form.service_times
this.form.unit_price = Number(this.pickedProduct.purchase_price)
if(this.pickedProduct.type === 1){
this.form.total_time = Number(this.pickedProduct.time_lenth) * this.form.service_times
}else{
this.form.total_time = this.pickedProduct.total
}
}
},
@ -302,7 +343,7 @@ export default {
this.customSelect.page--
this.$message({
type: 'warning',
message: '没有多客户了'
message: '没有多客户了'
})
return
}
@ -330,6 +371,7 @@ export default {
const res = await getForm(this.id)
this.$integrateData(this.form,res)
this.form.date = [res.start_date,res.end_date]
this.pickedProduct = res.product
},
submit() {
@ -378,6 +420,7 @@ export default {
this.type = ''
this.$refs['dialog'].reset()
this.initForm()
this.pickedProduct = {}
}
}
},

@ -102,7 +102,6 @@
ref="timeSelect"
@refresh="getCustomer"
:is-show.sync="isShowTime"
:nurses="nurses"
:skus="detail.product_type.product_skus"
:addresses="addresses"
:date="date"
@ -131,10 +130,6 @@ export default {
type: Array,
default: () => []
},
nurses: {
type: Array,
default: () => []
},
levels: {
type: Array,
default: () => []
@ -175,10 +170,10 @@ export default {
methods: {
datePick(date,data,type,schedule){
console.log(date,data)
this.date = data.day
if(data.type === 'current-month'){
if(type === 1){
this.$refs['timeSelect'].form.id = ''
this.isShowTime = true
}
if(type === 2){
@ -186,7 +181,7 @@ export default {
this.$refs['timeSelect'].form.nurse_id = schedule.nurse_id
this.$refs['timeSelect'].form.start_time = schedule.start_time
this.$refs['timeSelect'].form.end_time = schedule.end_time
this.$refs['timeSelect'].form.schedule_list_skus = schedule.sku.map(item => item.sku_info?.id)
this.$refs['timeSelect'].form.schedule_list_skus = schedule.sku.map(item => item.sku_id)
this.isShowTime = true
}
}

@ -27,8 +27,14 @@
</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-select v-model="form.nurse_id"
placeholder="请选择护工"
style="width: 300px;"
filterable remote
:remote-method="remoteNurse"
v-load-more="nurseLoad"
:loading="loading">
<el-option v-for="(item,index) in nurses" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
@ -39,12 +45,22 @@
</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.sku.id">{{ item.sku.name }}</el-checkbox>
</template>
<el-checkbox v-model="checkAll" :indeterminate="indeterminate" @change="handleCheckAllChange"></el-checkbox>
</el-checkbox-group>
<xy-table
ref="table"
:height="200"
:is-page="false"
:list="skus"
:table-item="skuTable"
@select="skuSelect"
@select-all="skuSelect">
<template v-slot:btns><div></div></template>
</xy-table>
<!-- <el-checkbox-group v-model="form.schedule_list_skus">-->
<!-- <template v-for="(item) in skus">-->
<!-- <el-checkbox :label="item.sku.id">{{ item.sku.name }}</el-checkbox>-->
<!-- </template>-->
<!-- <el-checkbox v-model="checkAll" :indeterminate="indeterminate" @change="handleCheckAllChange"></el-checkbox>-->
<!-- </el-checkbox-group>-->
</el-form-item>
</el-form>
</template>
@ -65,6 +81,7 @@
</template>
<script>
import {getList as getWorker} from '@/api/worker'
import {parseTime} from '@/utils'
import {scheduleDelete, scheduleSave} from '@/api/schedule'
@ -85,10 +102,6 @@ export default {
type: Array,
default: () => []
},
nurses: {
type: Array,
default: () => []
},
addresses:{
type:Array,
default:()=>[]
@ -96,6 +109,13 @@ export default {
},
data() {
return {
nurses:[],
nurseSelect:{
page:1,
page_size:10,
keyword:''
},
loading:false,
checkAll:true,
indeterminate:false,
form: {
@ -125,10 +145,60 @@ export default {
schedule_list_skus: [
{required: true, message: '请选择护理项目'}
]
}
},
skuTable:[
{
type:'selection',
width:43
},
{
prop:'sku.name',
width: 100,
label:'姓名',
sortable:false
},
{
label:'服务时长(分)',
prop:'sku.time_lenth',
width: 124,
sortable: false
},
{
label:'内容',
prop:'sku.service',
minWidth:140,
sortable: false,
align:'left'
}
]
}
},
methods: {
nurseLoad(){
this.nurseSelect.page ++
this.getNurses()
},
async getNurses(){
let res = await getWorker(this.nurseSelect,false)
if(res.data.length === 0){
this.nurseSelect.page --
this.$message({
type: 'warning',
message: '没有更多护工了'
})
return
}
this.nurses.push(...res.data)
},
async remoteNurse(e){
this.nurses = []
this.nurseSelect.keyword = e
this.nurseSelect.page = 1
await this.getNurses()
},
startTimePick(e){
this.form.start_time = `${this.date} ${e}`
console.log(this.form)
@ -138,12 +208,25 @@ export default {
console.log(this.form)
},
handleCheckAllChange(val){
this.form.schedule_list_skus = val ? this.skus.map(item => {
// handleCheckAllChange(val){
// this.form.schedule_list_skus = val ? this.skus.map(item => {
// return item.sku.id
// }) : []
// this.indeterminate =! this.indeterminate
// },
skuSelect(selection){
this.form.schedule_list_skus = selection.map(item => {
return item.sku.id
}) : []
this.indeterminate =! this.indeterminate
})
},
toggleRow(ids=[]){
this.skus.forEach(item => {
if(ids.indexOf(item.sku_id) !== -1){
this.$refs['table'].toggleRowSelection(item)
}
})
},
submit() {
this.form.customer_id = this.customerId
this.form.product_id = this.productId
@ -179,11 +262,18 @@ export default {
this.form.address_id = this.addresses.filter(item => {
return item.default === 1
})[0]?.id || ''
this.toggleRow(this.form.schedule_list_skus)
} else {
this.$emit('update:date','')
this.$refs['elForm'].resetFields()
this.$refs['table'].clearSelection()
console.log(this.form)
}
}
},
mounted() {
this.getNurses()
}
}
</script>

@ -67,7 +67,6 @@
ref="addSchedule"
:products="products"
:customers="customers"
:nurses="nurses"
:levels="levels"
:orders="orders"></add-schedule>
</div>
@ -103,7 +102,6 @@ export default {
},
customers:[],
products:[],
nurses:[],
levels:[],
orders:[],
accounts:[],
@ -182,10 +180,6 @@ export default {
const res = await productIndex({page_size:9999,page:1},false)
this.products = res.data
},
async getNurses(){
const res = await nurseIndex({page_size:9999,page:1},false)
this.nurses = res.data
},
async getLevels(){
const res = await getparameter({number:'disabilityLevel'})
this.levels = res.detail
@ -220,7 +214,6 @@ export default {
mounted() {
this.getTypes()
this.getProducts()
this.getNurses()
this.getLevels()
this.getCustomerList()
this.getAreas()

Loading…
Cancel
Save