Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop

This commit is contained in:
德仔
2021-02-22 19:49:36 +08:00
committed by Gitee
38 changed files with 3066 additions and 380 deletions

View File

@ -43,3 +43,12 @@ export function getCustomerBaseMessage(id) {
})
}
// 新增客户外食热量计算统计
export function addFoodHeatStatistics(data) {
return request({
url: '/investigate/addFoodHeatStatistics',
method: 'post',
data: data
})
}

View File

@ -0,0 +1,63 @@
import request from '@/utils/request'
// 查询外食热量统计列表
export function listFoodHeatStatistics(query) {
return request({
url: '/custom/foodHeatStatistics/list',
method: 'get',
params: query
})
}
// 查询外食热量统计详细
export function getFoodHeatStatistics(id) {
return request({
url: '/custom/foodHeatStatistics/' + id,
method: 'get'
})
}
// 新增外食热量统计
export function addFoodHeatStatistics(data) {
return request({
url: '/custom/foodHeatStatistics',
method: 'post',
data: data
})
}
// 修改外食热量统计
export function updateFoodHeatStatistics(data) {
return request({
url: '/custom/foodHeatStatistics',
method: 'put',
data: data
})
}
// 删除外食热量统计
export function delFoodHeatStatistics(id) {
return request({
url: '/custom/foodHeatStatistics/' + id,
method: 'delete'
})
}
// 导出外食热量统计
export function exportFoodHeatStatistics(query) {
return request({
url: '/custom/foodHeatStatistics/export',
method: 'get',
params: query
})
}
// 新增外食热量统计
export function addFoodHeatData(data) {
return request({
url: '/custom/foodHeatStatistics/addFoodHeatData',
method: 'post',
data: data
})
}

View File

@ -1,9 +1,9 @@
<template>
<div class="autohideinfo_wrapper">
<div>
{{ data.substring(0,maxLength) }}<span v-if="data.length > maxLength">...</span>
{{ data ? data.substring(0,maxLength) : ""}}<span v-if="data && data.length > maxLength">...</span>
</div>
<div v-if="data.length > maxLength">
<div v-if="data && data.length > maxLength">
<!--<div>...</div>-->
<el-popover placement="top-start" width="300" height="400px" popper-class="autohideinfo_detial" trigger="hover">
<div>{{ data }}</div>

View File

@ -0,0 +1,134 @@
<template>
<!-- 计算食材热量对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-form ref="form" :model="form" label-position="top" :rules="rules" label-width="100px">
<el-form-item v-for="(item,index) in foodHeatList" label="" class="margin-left">
<div>
<span>食材名称</span><el-input style="width:20%" placeholder="" :readonly="true" :value="item.ingredient"/>
<span style="margin-left: 10px">份量</span><el-input style="width:20%" placeholder="" :readonly="true" :value="getNumberString(item)"/>
<!--<span style="margin-left: 10px">热量</span><el-input style="width:15%" type="number" placeholder="" v-model="item.heatValue"/><span>千卡</span>-->
<span style="margin-left: 10px">蛋白质/脂肪/碳水</span>
<el-input style="width:10%" placeholder="" v-model="item.proteinQuality"/>
<el-input style="width:10%;margin-left: 5px" placeholder="" v-model="item.fatQuality"/>
<el-input style="width:10%;margin-left: 5px" placeholder="" v-model="item.carbonWaterQuality"/>
<span style="margin-left: 5px"></span>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getFoodHeatStatistics,addFoodHeatData } from "@/api/custom/foodHeatStatistics";
import {getOptions} from "@/api/custom/order";
export default {
name: "index",
components: {
},
props: {},
data() {
return {
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
callback: undefined,
// 表单参数
form: {},
// 表单校验
rules: {
projectId:[
{required: true, message: "请选择调理项目", trigger: "blur"}
]
},
heatData: null,
foodHeatList: []
};
},
created() {
},
methods: {
showDialog(data, callback) {
this.callback = callback;
this.reset(data);
this.title = "计算"+`${data.edibleDate}」食材热量`;
this.open = true;
this.getFoodHeatList(data.id);
},
getFoodHeatList(id){
getFoodHeatStatistics(id).then((response) => {
//let contractDetail = response.data;
this.heatData = response.data;
this.foodHeatList = response.data.foodHeatStatisticsList != null ? response.data.foodHeatStatisticsList : [];
});
},
getNumberString(foodData){
let numberString = "";
if(foodData.number){
numberString += foodData.number + foodData.unitName;
}
if(foodData.quantity){
numberString += (numberString != "" ? "/" : "" ) + foodData.quantity + "克";
}
return numberString;
},
// 表单重置
reset(obj) {
this.heatData = null;
this.foodHeatList = [];
this.resetForm("form");
},
// 取消按钮
cancel() {
this.open = false;
},
/** 提交按钮 */
submitForm() {
var reg = /^([1-9]\d*|[0]{1,1})$/;
if(this.foodHeatList.length == 0){
return;
}
let obj = {};
obj.id = this.heatData.id;
obj.customerId = this.heatData.customerId;
obj.maxHeatValue = this.heatData.maxHeatValue;
obj.foodHeatIdList = [];
obj.proteinQualityList = [];
obj.fatQualityList = [];
obj.carbonWaterQualityList = [];
let verifyFlag = true;
this.foodHeatList.forEach((item,index) => {
obj.foodHeatIdList.push(item.id);
if(!reg.test(item.proteinQuality) || !reg.test(item.fatQuality) || !reg.test(item.carbonWaterQuality)){
verifyFlag = false;
}else{
obj.proteinQualityList.push(item.proteinQuality);
obj.fatQualityList.push(item.fatQuality);
obj.carbonWaterQualityList.push(item.carbonWaterQuality);
}
});
if(!verifyFlag){
this.$message({message: "填写的数值格式错误", type: "warning"});
return;
}
//console.log(obj.foodHeatIdList.length);
addFoodHeatData(obj).then(response => {
if (response.code === 200) {
this.msgSuccess("提交成功");
this.open = false;
this.callback && this.callback();
}
});
}
}
};
</script>

View File

@ -0,0 +1,163 @@
<template>
<div>
<el-drawer
:title="title"
:close-on-press-escape="false"
:visible.sync="visible"
@closed="handleOnClosed"
size="40%"
>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button icon="el-icon-share" size="small" title="点击复制链接" class="copyBtn" type="primary" :data-clipboard-text="copyValue" @click="handleCopy()">外食计算器</el-button>
</el-col>
</el-row>
<el-table :data="foodHeatStatisticsList" >
<el-table-column label="日期" align="center" prop="edibleDate" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.edibleDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="食材" align="center" prop="ingredient" />
<el-table-column label="通俗计量" align="center" prop="unitName">
<template slot-scope="scope">
{{ scope.row.number ? (scope.row.number + "" + (scope.row.unitName != null ? scope.row.unitName : "")) : "" }}
</template>
</el-table-column>
<el-table-column label="质量(克)" align="center" prop="quantity" />-->
<el-table-column label="可摄入量" align="center" prop="maxHeatValue" />
<el-table-column label="食材热量" align="center" prop="heatValue" />
<el-table-column label="热量缺口" align="center" prop="heatGap" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!--<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:foodHeatStatistics:edit']"
>修改</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleCalculate(scope.row)"
>计算</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleOnDeleteClick(scope.row)"
v-hasPermi="['custom:foodHeatStatistics:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="fetchHeatList"
/>
<heatStatisticsCalculate ref="heatStatisticsCalculateRef"></heatStatisticsCalculate>
</div>
</el-drawer>
</div>
</template>
<script>
import { listFoodHeatStatistics, getFoodHeatStatistics, delFoodHeatStatistics, addFoodHeatStatistics, updateFoodHeatStatistics, exportFoodHeatStatistics } from "@/api/custom/foodHeatStatistics";
import Clipboard from 'clipboard';
import HeatStatisticsCalculate from "@/components/HeatStatisticsCalculate";
export default {
name: "HeatStatisticsDrawer",
components: {
'heatStatisticsCalculate':HeatStatisticsCalculate
},
data() {
return {
visible: false,
title: "",
data: undefined,
foodHeatStatisticsList: [],
total: 0,
// 查询参数
queryParams: {
customerId: null,
pageNum: 1,
pageSize: 10,
},
copyValue: ""
};
},
methods: {
showDrawer(data) {
// console.log(data);
this.data = data;
if (!this.data) {
return;
}
this.title = `${this.data.name}」热量统计列表`;
this.queryParams.customerId = data.id;
this.fetchHeatList();
},
fetchHeatList() {
listFoodHeatStatistics(this.queryParams).then(response => {
this.foodHeatStatisticsList = response.rows;
this.total = response.total;
this.visible = true;
});
},
handleAdd() {
},
handleOnClosed() {
this.data = undefined;
this.copyValue = "";
},
handleOnDeleteClick(data) {
const ids = data.id || this.ids;
this.$confirm(
'是否确认删除该数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () {
return delFoodHeatStatistics(ids);
})
.then(() => {
this.fetchHeatList();
this.msgSuccess("删除成功");
})
.catch(function () {});
},
handleCopy() {
this.copyValue = window.location.origin.replace('manage', 'sign') + "/foodHeatCalculator/"+this.data.encId;
const btnCopy = new Clipboard('.copyBtn');
this.$message({
message: '拷贝成功',
type: 'success'
});
},
handleCalculate(data){
this.$refs.heatStatisticsCalculateRef.showDialog(data,() => {
this.fetchHeatList();
});
}
},
};
</script>
<style lang="scss" scoped>
/deep/ :focus {
outline: 0;
}
</style>

View File

@ -0,0 +1,679 @@
<template>
<el-dialog
:title="title"
:visible.sync="visible"
width="820px"
append-to-body
:close-on-click-modal="false"
@closed="handleOnClosed"
>
<el-row :gutter="15">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-col :span="12">
<el-form-item label="订单类型" prop="orderType">
<el-cascader
v-model="form.orderType"
:options="orderTypeOptions"
style="width: 100%">
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="自动创建售后提成订单" prop="secondAfterSaleFlag" label-width="200px">
<el-select v-model="form.secondAfterSaleFlag" :disabled="secondAfterSaleFlagShow" style="width: 100px" placeholder="请选择">
<el-option :key="0" label="否" :value="0"/>
<el-option :key="1" label="是" :value="1"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="成交金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入金额" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="收款方式" prop="payTypeId">
<el-select v-model="form.payTypeId" placeholder="请选择">
<el-option
v-for="dict in payTypeIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="收款账号" prop="accountId">
<el-select v-model="form.accountId" placeholder="请选择">
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="服务时长" prop="serveTime">
<el-select v-model="form.serveTimeId" placeholder="请选服">
<el-option
v-for="dict in serveTimeIdOption"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="赠送时长" prop="serveTime">
<el-select v-model="form.giveServeDay" placeholder="请选择">
<el-option
v-for="dict in giveTimeIdOption"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="调理项目" prop="conditioningProjectId">
<el-select
v-model="form.conditioningProjectId"
placeholder="请选择"
>
<el-option
v-for="dict in conditioningProjectIdOption"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="售前" prop="preSaleId">
<el-select v-model="form.preSaleId" placeholder="请选择">
<el-option
v-for="dict in preSaleIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="售后" prop="afterSaleId">
<el-select v-model="form.afterSaleId" placeholder="请选择">
<el-option
v-for="dict in afterSaleIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="主营养师" prop="nutritionistIdList">
<el-select v-model="form.nutritionistIdList" multiple placeholder="请选择">
<el-option
v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="拆分比例" prop="nutritionistRate">
<el-select v-model="form.nutritionistRate" :disabled="orderRateOptionsShow" placeholder="请选择" >
<el-option
v-for="dict in orderRateOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="助理营养师" prop="nutriAssisId">
<el-select v-model="form.nutriAssisId" placeholder="请选择">
<el-option
v-for="dict in nutriAssisIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="策划" prop="plannerId">
<el-select v-model="form.plannerId" placeholder="请选择">
<el-option
v-for="dict in plannerIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="策划助理" prop="plannerAssisId">
<el-select v-model="form.plannerAssisId" placeholder="请选择">
<el-option
v-for="dict in plannerAssisIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="运营" prop="operatorId">
<el-select v-model="form.operatorId" placeholder="请选择">
<el-option
v-for="dict in operatorIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="运营助理" prop="operatorAssisId">
<el-select v-model="form.operatorAssisId" placeholder="请选择">
<el-option
v-for="dict in operatorAssisIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="推荐人" prop="recommender">
<el-input v-model="form.recommender" placeholder="请输入推荐人" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="成交时间" prop="orderTime">
<el-date-picker
style="width: 182.5px"
v-model="form.orderTime"
type="datetime"
placeholder="选择成交时间"
format="yyyy-MM-dd HH:mm"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="orderPickerOptions"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="服务开始时间" prop="startTime" label-width="120">
<el-date-picker
style="width: 182.5px"
v-model="form.startTime"
type="date"
placeholder="选择开始日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="10" v-hasPermi="['custom:order:review']">
<el-form-item label="审核状态" prop="reviewStatus">
<el-select v-model="form.reviewStatus" placeholder="请选择审核状态">
<el-option
v-for="dict in reviewStatusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { addOrder, getOptions, updateOrder } from "@/api/custom/order";
import dayjs from "dayjs";
import * as orderTypeData from "@/utils/orderType";
export default {
name: "OrderEdit",
props: {
id: {
type: String,
},
},
data() {
const checkStartTime = (rule, value, callback) => {
if (!value) {
return callback(new Error("开始时间不能为空"));
}
if (!this.form.orderTime) {
return callback(new Error("请先选择成交时间"));
}
if (
dayjs(this.form.startTime).diff(dayjs(this.form.orderTime), "day") < 0
) {
return callback(new Error("开始时间不能先于成交时间"));
}
callback();
};
const checkOrderTime = (rule, value, callback) => {
if (!value) {
return callback(new Error("成交时间不能为空"));
}
callback();
};
return {
title: "",
data: undefined,
callback: undefined,
form: {},
visible: false,
// 表单校验
rules: {
customer: [
{ required: true, message: "客户姓名不能为空", trigger: "blur" },
],
amount: [{ required: true, message: "金额不能为空", trigger: "blur" }],
phone: [
{ required: true, message: "手机号不能为空", trigger: "blur" },
{
required: true,
trigger: "blur",
pattern: /^[0-9]{5,11}$/,
message: "手机号格式不正确",
},
],
orderTime: [
{ required: true, message: "成交时间不能为空", trigger: "blur" },
{ required: true, trigger: "blur", validator: checkOrderTime },
],
startTime: [
{ required: true, message: "开始时间不能为空", trigger: "blur" },
{ required: true, trigger: "blur", validator: checkStartTime },
],
// payTypeId: [
// {required: true, message: "收款方式不能为空", trigger: "blur"}
// ],
// accountId: [
// {required: true, message: "账号不能为空", trigger: "blur"}
// ],
// serveTimeId: [
// {required: true, message: "服务时长不能为空", trigger: "blur"}
// ],
},
pickerOptions: {
shortcuts: [
{
text: "最近一周",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近一个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近三个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit("pick", [start, end]);
},
},
],
},
orderPickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
},
fanPickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
},
startPickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now();
},
},
// 收款方式字典
payTypeIdOptions: [],
// 售前字典
preSaleIdOptions: [],
// 售后字典
afterSaleIdOptions: [],
// 主营养师字典
nutritionistIdOptions: [],
// 助理营养师字典
nutriAssisIdOptions: [],
// 策划字典
plannerIdOptions: [],
// 账号
accountIdOptions: [],
// 服务时长
serveTimeIdOption: [],
// 赠送时长
giveTimeIdOption: [],
//调理项目
conditioningProjectIdOption: [],
// 策划助理字典
plannerAssisIdOptions: [],
// 运营字典
operatorIdOptions: [],
// 审核状态
reviewStatusOptions: [],
//
operatorAssisIdOptions: [],
//下拉列表对应关系(用于选择收款账号自动选择策划、策划助理、运营、运营助理)
orderDropdownCorrespondingOptions: [],
//订单类型
orderTypeOptions: orderTypeData['orderTypeArray'],
secondAfterSaleFlagShow: true,
//分成比例
orderRateOptions: orderTypeData['orderRateArray'],
orderRateOptionsShow: true
};
},
created() {
getOptions().then((res) => {
const options = res.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [
{ dictValue: 0, dictLabel: "无", remark: null },
];
}
opts[cur.postCode].push({
dictValue: cur.userId,
dictLabel: cur.userName,
remark: cur.remark,
});
return opts;
}, {});
this.preSaleIdOptions = options["pre_sale"] || [];
this.afterSaleIdOptions = options["after_sale"] || [];
this.nutritionistIdOptions = options["nutri"] || [];
this.nutriAssisIdOptions = options["nutri_assis"] || [];
this.plannerIdOptions = options["planner"] || [];
this.plannerAssisIdOptions = options["planner_assis"] || [];
this.operatorIdOptions = options["operator"] || [];
this.operatorAssisIdOptions = options["operator_assis"] || [];
});
this.getDicts("cus_pay_type").then((response) => {
this.payTypeIdOptions = response.data;
});
this.getDicts("cus_account").then((response) => {
this.accountIdOptions = response.data;
console.log(response.data);
this.accountIdOptions.splice(0, 0, {
dictLabel: "无",
dictValue: "0",
});
});
this.getDicts("cus_serve_time").then((response) => {
this.serveTimeIdOption = response.data;
});
this.getDicts("give_serve_daye_type").then((response) => {
this.giveTimeIdOption = response.data;
});
this.getDicts("conditioning_project").then((response) => {
this.conditioningProjectIdOption = response.data;
});
this.getDicts("cus_review_status").then((response) => {
this.reviewStatusOptions = response.data;
});
this.getDicts("order_dropdown_corresponding").then((response) => {
this.orderDropdownCorrespondingOptions = response.data;
});
//订单类型
/*this.getDicts("order_type").then((response) => {
//去除二开售后提成单,不需要选择
let removeIndex = null;
response.data.forEach((item, index) => {
if(item.dictValue == "2"){
removeIndex = index;
}
});
if(removeIndex != null){
response.data.splice(removeIndex,1);
}
this.orderTypeOptions = response.data;
});*/
},
methods: {
showDialog(data, callback) {
// this.data = data;
this.callback = callback;
this.reset(data);
this.title = `${data.orderId ? "修改" : "创建"}${
data.customer
}」客户订单`;
this.visible = true;
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.orderId != null) {
updateOrder(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.visible = false;
this.callback && this.callback();
}
});
} else {
addOrder(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.visible = false;
this.callback && this.callback();
}
});
}
}
});
},
reset(obj = {}) {
const defaultPayType = this.payTypeIdOptions.find(
(opt) => opt.remark === "default"
);
const defaultServeTime = this.serveTimeIdOption.find(
(opt) => opt.remark === "default"
);
const defaultGiveServeTime = this.giveTimeIdOption.find(
(opt) => opt.remark === "default"
);
const defaultConditioningProjectIdOption = this.conditioningProjectIdOption.find(
(opt) => opt.remark === "default"
);
const defaultAccount = this.accountIdOptions.find(
(opt) => opt.remark === "default"
);
const defaultPresale = this.preSaleIdOptions.find(
(opt) => opt.remark === "default"
);
const defaultAftersale = this.afterSaleIdOptions.find(
(opt) => opt.remark === "default"
);
const defaultNutritionist = this.nutritionistIdOptions.find(
(opt) => opt.remark === "default"
);
const defaultNutriAssis = this.nutriAssisIdOptions.find(
(opt) => opt.remark === "default"
);
const accountId = defaultAccount ? parseInt(defaultAccount.dictValue) : 0;
const planningAndOperationValue = this.orderDropdownCorrespondingOptions.find(
(opt) => parseInt(opt.dictValue) === accountId
);
const defaultOrderRate = this.orderRateOptions.find((opt) => opt.remark === "default");
const [
plannerId,
plannerAssisId,
operatorId,
operatorAssisId,
] = planningAndOperationValue
? planningAndOperationValue.dictLabel
.split("|")
.map((str) => parseInt(str))
: [0, 0, 0, 0];
this.form = {
orderId: null,
orderType: [0, 0, 0],
secondAfterSaleFlag: 0,
customer: null,
phone: null,
amount: null,
weight: null,
plannerId,
plannerAssisId,
operatorId,
operatorAssisId,
startTime: dayjs().add(3, "day").format("YYYY-MM-DD"),
pauseTime: null,
payTypeId: defaultPayType ? parseInt(defaultPayType.dictValue) : null,
preSaleId: defaultPresale ? parseInt(defaultPresale.dictValue) : null,
createBy: null,
createTime: null,
afterSaleId: defaultAftersale
? parseInt(defaultAftersale.dictValue)
: null,
updateBy: null,
updateTime: null,
nutritionistId: null,
nutritionistIdList: defaultNutritionist ? [parseInt(defaultNutritionist.dictValue)] : null,
nutritionistRate: defaultOrderRate ? defaultOrderRate.dictValue : null,
remark: null,
nutriAssisId: defaultNutriAssis
? parseInt(defaultNutriAssis.dictValue)
: null,
recommender: null,
orderTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
serveTimeId: defaultServeTime
? parseInt(defaultServeTime.dictValue)
: null,
reviewStatus: "no",
giveServeDay: defaultGiveServeTime
? parseInt(defaultGiveServeTime.dictValue)
: null,
conditioningProjectId: defaultConditioningProjectIdOption
? parseInt(defaultConditioningProjectIdOption.dictValue)
: null,
accountId,
...obj,
};
this.resetForm("form");
},
handleOnClosed() {
this.reset();
},
// 取消按钮
cancel() {
this.visible = false;
// this.reset();
},
//根据收款账号ID初始化策划、策划助理、运营、运营助理
initPlanningAndOperation() {
if (this.form.accountId != null && this.form.accountId != undefined) {
const planningAndOperationValue = this.orderDropdownCorrespondingOptions.find(
(opt) => parseInt(opt.dictValue) === this.form.accountId
);
const [
plannerId,
plannerAssisId,
operatorId,
operatorAssisId,
] = planningAndOperationValue
? planningAndOperationValue.dictLabel
.split("|")
.map((str) => parseInt(str))
: [0, 0, 0, 0];
this.form = {
...this.form,
plannerId,
plannerAssisId,
operatorId,
operatorAssisId,
};
}
},
handleOrderTypeChange(){
console.log(this.form.orderType);
}
},
watch: {
// 监听收款账号的变化
"form.accountId": function (newVal, oldVal) {
this.initPlanningAndOperation();
},
"form.orderType": function (newVal, oldVal) {
//判断订单类型是否选择了二开
if(newVal[1] == 1){
this.form.secondAfterSaleFlag = 1;
this.secondAfterSaleFlagShow = false;
}else{
this.form.secondAfterSaleFlag = 0;
this.secondAfterSaleFlagShow = true;
}
//判断是否选择了比例拆分单
if(newVal[0] == 1){
this.orderRateOptionsShow = false;
this.form.nutritionistRate = "2,8";
}else{
this.orderRateOptionsShow = true;
this.form.nutritionistRate = "0,10";
}
},
},
};
</script>

View File

@ -92,7 +92,10 @@
</div>
</el-drawer>
<create-order-dialog ref="cusCreateOrderDialogRef" />
<!-- 新增订单 -->
<!--<create-order-dialog ref="cusCreateOrderDialogRef" />-->
<!-- 订单编辑 -->
<edit-order-dialog ref="cusEditOrderDialogRef" />
<order-detail ref="orderDetailRef" />
</div>
@ -100,13 +103,15 @@
<script>
import { listOrder, delOrder } from "@/api/custom/order";
import OrderEdit from "@/components/OrderEdit";
import OrderAdd from "@/components/OrderAdd";
import OrderDetail from "@/components/OrderDetail";
export default {
name: "CustomerOrderDrawer",
components: {
"create-order-dialog": OrderEdit,
"edit-order-dialog": OrderEdit,
"order-detail": OrderDetail,
//"create-order-dialog": OrderAdd
},
data() {
return {
@ -150,7 +155,7 @@ export default {
});
},
handleAdd() {
this.$refs.cusCreateOrderDialogRef.showDialog(
this.$refs.cusEditOrderDialogRef.showDialog(
{
customer: this.data.name,
cusId: this.data.id,
@ -171,7 +176,7 @@ export default {
this.$refs.orderDetailRef.showDialog(data.orderId);
},
handleOnEditClick(data) {
this.$refs.cusCreateOrderDialogRef.showDialog(data, () => {
this.$refs.cusEditOrderDialogRef.showDialog(data, () => {
this.fetchOrderList(this.data.id);
});
},

View File

@ -203,8 +203,7 @@ export default {
["medicalReport_one","medicalReport_two","medicalReport_three"]
]
],
copyValue: "",
enc_id: ""
copyValue: ""
};
},
methods: {
@ -245,7 +244,7 @@ export default {
this.getDataListBySignMessage(res.data.customerHealthy)
}
}
this.enc_id = res.data.enc_id;
//this.enc_id = res.data.enc_id;
this.showFlag = true;
this.visible = true;
});
@ -253,7 +252,7 @@ export default {
onClosed() {
this.dataList = [];
this.data = null;
this.enc_id = "";
//this.enc_id = "";
this.copyValue = "";
},
//对体征信息进行处理
@ -437,7 +436,7 @@ export default {
return str;
},
handleCopy() {
this.copyValue = window.location.origin.replace('manage', 'sign') + "/subhealthyInvestigation/"+this.enc_id;
this.copyValue = window.location.origin.replace('manage', 'sign') + "/subhealthyInvestigation/"+this.data.encId;
const btnCopy = new Clipboard('.copyBtn');
this.$message({
message: '拷贝成功',

View File

@ -49,7 +49,8 @@ router.beforeEach((to, from, next) => {
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/') || to.path.startsWith('/subhealthyInvestigation/')) {
if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/') || to.path.startsWith('/subhealthyInvestigation/')
|| to.path.startsWith('/foodHeatCalculator/')) {
// 在免登录白名单,直接进入
next()
} else {

View File

@ -173,7 +173,15 @@ export const constantRoutes = [
require(["@/views/custom/subhealthy/investigation"], resolve),
hidden: true,
meta: { title: "胜唐体控健康评估表" }
}
},
{
path: "/foodHeatCalculator/:id",
component: resolve =>
require(["@/views/custom/foodHeatStatistics/investigate"], resolve),
hidden: true,
meta: { title: "外食计算器" }
},
];
export default new Router({

View File

@ -0,0 +1,72 @@
export const orderMoneyTypeArray = [
{
value: 0,
label: "全款单"
},{
value: 1,
label: "定金单"
},
{
value: 2,
label: "尾款单"
}
]
//订单次数类型
export const orderCountTypeArray = [
{
value: 0,
label: "一开单",
children: orderMoneyTypeArray
},{
value: 1,
label: "二开单",
children: orderMoneyTypeArray
}
]
//订单类型
export const orderTypeArray = [
{
value: 0,
label: "普通单",
children: orderCountTypeArray
},{
value: 1,
label: "比例拆分单",
children: orderCountTypeArray
}
]
//订单拆分比例类型
export const orderRateArray = [
{
dictValue: "0,10",
dictLabel: "不拆分",
remark: ""
},
{
dictValue: "1,9",
dictLabel: "1-9开",
remark: ""
},{
dictValue: "2,8",
dictLabel: "2-8开",
remark: "default"
},
{
dictValue: "3,7",
dictLabel: "3-7开",
remark: ""
},
{
dictValue: "4,6",
dictLabel: "4-6开",
remark: ""
},
{
dictValue: "5,5",
dictLabel: "5-5开",
remark: ""
}
]

View File

@ -179,6 +179,16 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="外食热量统计" align="center" v-hasPermi="['custom:foodHeatStatistics:list']">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleClickHeatStatistics(scope.row)"
>详情
</el-button>
</template>
</el-table-column>
<el-table-column label="食谱计划" align="center" v-hasPermi="['recipes:recipesPlan:list']">
<template slot-scope="scope">
<el-button
@ -312,6 +322,8 @@
<contract-drawer ref="cusContractDrawerRef"></contract-drawer>
<!-- 健康评估弹窗 -->
<physical-signs-dialog ref="physicalSignsDialogRef" />
<!-- 外食热量统计 -->
<heatStatisticsDrawer ref="heatStatisticsRef"></heatStatisticsDrawer>
<!-- 食谱计划抽屉 -->
</div>
</template>
@ -333,13 +345,15 @@ import { getOptions } from "@/api/custom/order";
import OrderDrawer from "@/components/OrderDrawer";
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
import ContractDrawer from "@/components/ContractDrawer";
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
export default {
name: "Customer",
components: {
"order-drawer": OrderDrawer,
"physical-signs-dialog": PhysicalSignsDialog,
"contract-drawer": ContractDrawer
"contract-drawer": ContractDrawer,
"heatStatisticsDrawer": HeatStatisticsDrawer
},
data() {
const userId = store.getters && store.getters.userId;
@ -490,6 +504,9 @@ export default {
handleOnMenuClick(row) {
// console.log(row);
},
handleClickHeatStatistics(row){
this.$refs["heatStatisticsRef"].showDrawer(row);
},
// 取消按钮
cancel() {
this.open = false;

View File

@ -9,7 +9,7 @@
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="销售" prop="userId">
<el-form-item label="销售" prop="userId" label-width="68px">
<el-select v-model="queryParams.userId" placeholder="请选择销售" filterable clearable>
<el-option
v-for="dict in preSaleIdOptions"
@ -19,7 +19,17 @@
/>
</el-select>
</el-form-item>
<el-form-item>
<el-form-item label="进粉渠道" prop="accountId" label-width="88px">
<el-select v-model="queryParams.accountId" filterable placeholder="请选择渠道" clearable>
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item style="margin-left: 20px">
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
@ -128,7 +138,7 @@
</el-date-picker>
</el-form-item>
<el-form-item label="销售" prop="userId">
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small" @change="getWxByUserId">
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small">
<el-option
v-for="dict in preSaleIdOptions"
:key="dict.dictValue"
@ -218,7 +228,8 @@
pageNum: 1,
pageSize: 10,
fanTime: nowDate,
userId: null
userId: null,
accountId: null
},
// 表单参数
form: {},
@ -232,6 +243,8 @@
wxList:[],
//销售列表
preSaleIdOptions:[],
//进粉渠道列表
accountIdOptions:[],
editOpen: false,
editForm:{},
// 表单校验
@ -244,6 +257,9 @@
created() {
this.getList();
this.getSaleUserList();
this.getDicts("fan_channel").then((response) => {
this.accountIdOptions = response.data;
});
},
methods: {
/** 查询进粉统计列表 */
@ -354,6 +370,7 @@
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.reset();
this.getList();
}
});
@ -444,6 +461,12 @@
}
});
},
},
watch: {
// 监听用户ID变化
"form.userId": function (newVal, oldVal) {
this.getWxByUserId(newVal);
},
}
};
</script>

View File

@ -0,0 +1,21 @@
<template>
<div>
</div>
</template>
<script>
export default {
name: "index",
data() {
},
methods: {
},
watch: {
}
};
</script>

View File

@ -0,0 +1,322 @@
<template>
<section>
<div style="padding: 5px; text-align: center">
<img :src="logo" style="width: 150px; height: 35px" alt="logo" />
</div>
<!--<div style="margin: 10px 15px 10px 15px;" >
<el-steps :active="stepActive" finish-status="success">
<el-step v-for="(item,index) in stepArray" title=""></el-step>
</el-steps>
</div>-->
<el-form ref="form" label-position="top" :model="form" :rules="rules" label-width="100px" style="padding: 16px">
<div>
<h3>个人信息</h3>
<!--<div><span>{{form.name}}</span></div>-->
</div>
<el-form-item :label="'姓名:'+customer.name" prop="name">
<!--<el-input v-model="customer.name" :readonly="true" placeholder="请输入真实姓名" maxlength="20"/>-->
</el-form-item>
<el-form-item :label="'手机号:'+customer.phone" prop="phone" style="margin-top: -15px">
<!--<el-input v-model="customer.name" :readonly="true" placeholder="请输入真实姓名" maxlength="20"/>-->
</el-form-item>
<div>
<h3>外食计算</h3>
</div>
<el-row>
<el-button v-for="(item,index) in modular" type="primary" plain @click="modularChange(index)">{{item}}</el-button>
</el-row>
<div style="margin-top: 40px">
<h3>{{currentTitle}}</h3>
</div>
<div v-show="currentShow == 0">
<el-form-item label="已添加的食材" prop="name">
<el-tag style="margin-left: 5px" v-for="tag in ingredientTagArray" :key="tag" closable :disable-transitions="false" @close="handleClose(tag)">
{{tag}}
</el-tag>
</el-form-item>
<div>
<el-form-item label="日期" prop="edibleDate">
<el-date-picker
v-model="form.edibleDate"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="食材名称" prop="ingredient">
<el-input v-model="form.ingredient" placeholder="请输入食材名称" maxlength="20"/>
</el-form-item>
<el-form-item label="通俗计量" prop="numberUnit">
<el-input v-model="form.number" style="width: 48%" placeholder="请输入食材数量" maxlength="10"/>
<el-select v-model="form.unit" placeholder="请选择单位" style="margin-left:5px;width: 50%" filterable clearable>
<el-option
v-for="dict in cusUnitOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item label="重量(克)" prop="quantity">
<el-input v-model="form.quantity" placeholder="请输入食材重量(整数)" maxlength="10"/>
</el-form-item>
</div>
<el-form-item style="text-align: center; margin: 40px auto" >
<el-button type="primary" @click="continueAdd()" >继续添加</el-button>
<el-button type="success" @click="submit()" >提交数据</el-button>
</el-form-item>
</div>
</el-form>
</section>
</template>
<script>
import { getDictData,getCustomerBaseMessage,addFoodHeatStatistics } from "@/api/custom/customerInvestigation";
import dayjs from "dayjs";
const nowDate = dayjs().format("YYYY-MM-DD");
const logo = require("@/assets/logo/st_logo.png");
export default {
name: "index",
data() {
const checkNumberUnit = (rule, value, callback) => {
if (this.form.number) {
if(!/^[1-9]\d*$/.test(value)){
return callback(new Error("通俗计量的数量格式错误"));
}
if(!this.form.unit){
return callback(new Error("请选择通俗计量单位"));
}
}
callback();
};
return {
modular:["食材提交"],
currentShow: -1,
currentTitle: "",
logo,
timer: null,
customerExistFlag: false,
submitFlag: false,
customer:{
customerEncId: null,
name: null,
phone: null
},
form: {
edibleDate: nowDate,
ingredient: null,
number: null,
unit: null,
quantity: null,
},
rules: {
ingredient: [{ required: true, trigger: "blur", message: "请输入食材名称" }],
edibleDate: [{ required: true, trigger: "blur", message: "请选择日期" }]
},
ingredientTagArray:[
],
ingredientArray: [
],
//通俗计量单位
cusUnitOptions:[],
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
},
};
},
components: {
},
methods: {
modularChange(index){
if(index != this.currentShow){
this.currentShow = index;
this.currentTitle = this.modular[index];
}else{
this.currentShow = -1;
this.currentTitle = "";
}
},
//根据用户ID获取用户基本信息手机号、姓名
getCustomerBase(id){
if(id == null || id == undefined){
return;
}
getCustomerBaseMessage(id).then((response) => {
if (response.code === 200) {
if(response.data){
this.customerExistFlag = true;
this.customer.name = response.data.name;
this.customer.phone = response.data.phone;
}
}
}).catch(function() {
console.log("error");
});
},
continueAdd(){
this.$refs.form.validate((valid) => {
if (valid) {
if(this.verify() && this.ingredientTagArray.indexOf(this.form.ingredient.trim()) == -1){
this.ingredientArray.push(this.form);
this.ingredientTagArray.push(this.form.ingredient);
this.reset();
}
} else {
this.$message({message: "食材数据未填写完整", type: "warning"});
}
});
},
verify(){
var reg = /^([1-9]\d*|[0]{1,1})$/;
if(this.form.number != null && this.form.number != ""){
if(!reg.test(this.form.number+"")){
this.$message({message: "通俗计量的数量格式错误", type: "warning"});
return false;
}
if(this.form.unit == null || this.form.unit == ""){
this.$message({message: "请选择通俗计量单位", type: "warning"});
return false;
}
}
if(this.form.quantity != null && this.form.quantity != "" && !reg.test(this.form.quantity)){
this.$message({message: "重量格式错误", type: "warning"});
return false;
}
if((this.form.number == null || this.form.number == "") && (this.form.quantity == null || this.form.quantity == "")){
this.$message({message: "通俗计量和重量不能都为空", type: "warning"});
return false;
}
return true;
},
reset(){
this.form = {
edibleDate: nowDate,
ingredient: null,
number: null,
unit: null,
quantity: null
}
},
againSumbit(){
this.submitFlag = false;
},
submit(){
if (this.submitFlag) {
this.$message({
message: "请勿频繁提交,一分钟后重试",
type: "warning",
});
return;
}
if(this.form.ingredient && this.ingredientTagArray.indexOf(this.form.ingredient.trim()) == -1){
if(!this.verify()){
return;
}
this.ingredientArray.push(this.form);
this.ingredientTagArray.push(this.form.ingredient);
this.reset();
}
if(this.ingredientArray.length == 0){
this.$message({message: "还未添加食材数据,无法提交", type: "warning"});
return;
}
this.timer = setTimeout(this.againSumbit,1000*60);
let submitObject = {};
submitObject.ingredientArray = JSON.stringify(this.ingredientArray);
submitObject.customerEncId = this.customer.customerEncId;
this.submitFlag = true;
addFoodHeatStatistics(submitObject).then((response) => {
this.$notify({title: "提交成功", message: "", type: "success"});
}).catch(function() {
console.log("error");
});
},
handleClose(tag) {
this.ingredientTagArray.splice(this.ingredientTagArray.indexOf(tag), 1);
let tagIndex = -1;
this.ingredientArray.forEach((item, index) => {
if(tag == item.ingredient){
tagIndex = index;
}
});
this.ingredientArray.splice(tagIndex, 1);
console.log( JSON.stringify(this.ingredientArray))
}
},
created() {
this.customer.customerEncId = this.$route.params.id;
this.getCustomerBase(this.customer.customerEncId);
getDictData("cus_cus_unit").then(response => {
this.cusUnitOptions = response.data;
});
},
beforeCreate() {
document.title = this.$route.meta.title;
},
};
</script>
<style scoped>
.el-form-item {
margin-bottom: 8px;
}
.p_title_1{
font-size: 18px;
font-weight: bold;
margin-top: 30px;
}
.p_title_2{
font-size: 16px;
font-weight: bold;
margin-top: 30px;
}
.p_title_3{
font-size: 14px;
font-weight: bold;
margin-top: 30px;
}
.margin-left{
margin-left: 14px;
}
.el-input__inner{
width: 30%;
}
.margin-top-10{
margin-top: 10px;
}
.width-50-left-8-right-5{
width:50%;
margin-left: 8px;
margin-right: 5px;
}
.width-70-left-8-right-5{
width:70%;
margin-left: 8px;
margin-right: 5px;
}
.el-tag + .el-tag {
margin-left: 10px;
}
.button-new-tag {
margin-left: 10px;
height: 32px;
line-height: 30px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
</style>