From e197b2227382d22b0cd9c55cc22da7a5d5bc487b Mon Sep 17 00:00:00 2001
From: "271556543@qq.com" <271556543@qq.com>
Date: Mon, 10 Oct 2022 17:27:36 +0800
Subject: [PATCH] 2022.10.10
---
src/components/XyTable/index.vue | 8 +-
src/views/customer/component/addCustomer.vue | 57 ++++++++-
src/views/customer/component/addOrder.vue | 27 +++-
src/views/customer/customer.vue | 110 ++++++++++++++--
src/views/order/component/addOrder.vue | 65 ++++++++--
src/views/schedule/component/addSchedule.vue | 9 +-
src/views/schedule/component/timeSelect.vue | 124 ++++++++++++++++---
src/views/schedule/schedule.vue | 7 --
8 files changed, 345 insertions(+), 62 deletions(-)
diff --git a/src/components/XyTable/index.vue b/src/components/XyTable/index.vue
index 1a7e03b..b8a7f5d 100644
--- a/src/components/XyTable/index.vue
+++ b/src/components/XyTable/index.vue
@@ -237,7 +237,7 @@ export default {
return (
@@ -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' ? {
diff --git a/src/views/customer/component/addCustomer.vue b/src/views/customer/component/addCustomer.vue
index 675df01..06f8461 100644
--- a/src/views/customer/component/addCustomer.vue
+++ b/src/views/customer/component/addCustomer.vue
@@ -215,6 +215,23 @@
+
+
+
+
@@ -229,7 +246,8 @@
style="width: 300px;"
type="daterange"
:picker-options="pickerOptions"
- value-format="yyyy-MM-dd">
+ value-format="yyyy-MM-dd"
+ @change="productPick">
@@ -264,7 +282,7 @@
*总计时长:
-
@@ -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() {
diff --git a/src/views/customer/component/addOrder.vue b/src/views/customer/component/addOrder.vue
index 05465a2..e217f9c 100644
--- a/src/views/customer/component/addOrder.vue
+++ b/src/views/customer/component/addOrder.vue
@@ -31,6 +31,23 @@
+
+
+
+
@@ -81,7 +98,7 @@
*总计时长:
-
@@ -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:'',
}
},
diff --git a/src/views/customer/customer.vue b/src/views/customer/customer.vue
index cbc51b5..b5b3abd 100644
--- a/src/views/customer/customer.vue
+++ b/src/views/customer/customer.vue
@@ -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()}">
@@ -38,14 +39,14 @@
-
+
-
-
+
+
@@ -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 (
+ {
+ 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}>
+
+ )
+ }
+ },
{
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()
}
}
diff --git a/src/views/order/component/addOrder.vue b/src/views/order/component/addOrder.vue
index f3d20cd..bb18e88 100644
--- a/src/views/order/component/addOrder.vue
+++ b/src/views/order/component/addOrder.vue
@@ -32,11 +32,17 @@
-
+ placeholder="请选择产品"
+ style="width: 300px"
+ @change="productPick">
+
@@ -49,6 +55,7 @@
@@ -70,8 +77,10 @@
start-placeholder="开始时间"
style="width: 300px;"
type="daterange"
+ range-separator="~"
:picker-options="pickerOptions"
- value-format="yyyy-MM-dd">
+ value-format="yyyy-MM-dd"
+ @change="productPick">
@@ -83,7 +92,7 @@
+ placeholder="请输入服务次数" style="width: 300px;"/>
@@ -95,7 +104,7 @@
+ placeholder="请输入单次单价" style="width: 300px;" />
@@ -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 = {}
}
}
},
diff --git a/src/views/schedule/component/addSchedule.vue b/src/views/schedule/component/addSchedule.vue
index 9442bf9..a1a1701 100644
--- a/src/views/schedule/component/addSchedule.vue
+++ b/src/views/schedule/component/addSchedule.vue
@@ -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
}
}
diff --git a/src/views/schedule/component/timeSelect.vue b/src/views/schedule/component/timeSelect.vue
index 3ce1557..23462d0 100644
--- a/src/views/schedule/component/timeSelect.vue
+++ b/src/views/schedule/component/timeSelect.vue
@@ -27,8 +27,14 @@
-
-
+
+
@@ -39,12 +45,22 @@
-
-
- {{ item.sku.name }}
-
- 全选
-
+
+
+
+
+
+
+
+
+
@@ -65,6 +81,7 @@
diff --git a/src/views/schedule/schedule.vue b/src/views/schedule/schedule.vue
index 497b25a..c2b11f4 100644
--- a/src/views/schedule/schedule.vue
+++ b/src/views/schedule/schedule.vue
@@ -67,7 +67,6 @@
ref="addSchedule"
:products="products"
:customers="customers"
- :nurses="nurses"
:levels="levels"
:orders="orders">
@@ -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()