订单类型改版

This commit is contained in:
xiezhijun 2021-02-06 18:34:57 +08:00
parent 87735820d9
commit 9a2e9bde62
7 changed files with 802 additions and 174 deletions
stdiet-custom/src/main
java/com/stdiet/custom/domain
resources/mapper/custom
stdiet-ui/src
components
AutoHideMessage
OrderAdd
OrderDrawer
utils

@ -93,6 +93,9 @@ public class SysOrder extends BaseEntity {
*/
private Long nutritionistId;
//营养师数组比例拆分单时需要两个营养师非持久化字段
private Long[] nutritionistIdList;
/**
* 营养师
*/
@ -227,11 +230,37 @@ public class SysOrder extends BaseEntity {
* 订单暂停记录 非持久化字段
* */
private List<SysOrderPause> orderPauseList;
//查询参数
private Integer amountFlag;
@JsonFormat(pattern = "yyyy-MM-dd")
public Date getStartTime() {
return startTime;
}
/**
* 订单类型 0普通单 1比例拆分单 2售后二开提成单
*/
private String orderType;
/**
* 订单次数类型 0一开单 1二开单
*/
private String orderCountType;
/**
* 订单金额类型 0全款单 1定金单 2尾款单
*/
private String orderMoneyType;
/**
* 拆分订单中的主订单id非拆分订单时该id都为0
*/
private Long mainOrderId;
//订单类型数组用于接收订单类型订单次数类型订单金额类型非持久化字段
private Long[] orderTypeList;
//是否自动创建售后二开提成单非持久化字段
private Integer secondAfterSaleFlag;
//拆分比例1,9就是按照比例10%90%拆分非持久化字段
private Integer[] nutritionistRate;
}

@ -2,6 +2,7 @@ package com.stdiet.custom.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.stdiet.common.annotation.Excel;
@ -13,6 +14,7 @@ import com.stdiet.common.core.domain.BaseEntity;
* @author xzj
* @date 2021-01-15
*/
@Data
public class SysRecipesPlan extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -24,6 +26,9 @@ public class SysRecipesPlan extends BaseEntity
//@Excel(name = "订单ID")
private Long orderId;
//客户ID
private Long customerId;
//非持久化字段客户姓名
@Excel(name = "客户姓名")
private String customer;
@ -82,167 +87,4 @@ public class SysRecipesPlan extends BaseEntity
/** 删除标识 0未删除 1已删除 默认0 */
private Integer delFlag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setOrderId(Long orderId)
{
this.orderId = orderId;
}
public Long getOrderId()
{
return orderId;
}
public void setStartDate(Date startDate)
{
this.startDate = startDate;
}
public Date getStartDate()
{
return startDate;
}
public void setEndDate(Date endDate)
{
this.endDate = endDate;
}
public Date getEndDate()
{
return endDate;
}
public void setRecipesId(Long recipesId)
{
this.recipesId = recipesId;
}
public Long getRecipesId()
{
return recipesId;
}
public void setSendFlag(Integer sendFlag)
{
this.sendFlag = sendFlag;
}
public Integer getSendFlag()
{
return sendFlag;
}
public void setSendTime(Date sendTime)
{
this.sendTime = sendTime;
}
public Date getSendTime()
{
return sendTime;
}
public void setDelFlag(Integer delFlag)
{
this.delFlag = delFlag;
}
public Integer getDelFlag()
{
return delFlag;
}
public String getCustomer() {
return customer;
}
public void setCustomer(String customer) {
this.customer = customer;
}
public Long getNutritionistId() {
return nutritionistId;
}
public void setNutritionistId(Long nutritionistId) {
this.nutritionistId = nutritionistId;
}
public String getNutritionist() {
return nutritionist;
}
public void setNutritionist(String nutritionist) {
this.nutritionist = nutritionist;
}
public Long getNutritionistAssisId() {
return nutritionistAssisId;
}
public void setNutritionistAssisId(Long nutritionistAssisId) {
this.nutritionistAssisId = nutritionistAssisId;
}
public String getNutritionistAssis() {
return nutritionistAssis;
}
public void setNutritionistAssis(String nutritionistAssis) {
this.nutritionistAssis = nutritionistAssis;
}
public Date getOrderStartDate() {
return orderStartDate;
}
public void setOrderStartDate(Date orderStartDate) {
this.orderStartDate = orderStartDate;
}
public Date getOrderEndDate() {
return orderEndDate;
}
public void setOrderEndDate(Date orderEndDate) {
this.orderEndDate = orderEndDate;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getHidePhone() {
return hidePhone;
}
public void setHidePhone(String hidePhone) {
this.hidePhone = hidePhone;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("orderId", getOrderId())
.append("startDate", getStartDate())
.append("endDate", getEndDate())
.append("recipesId", getRecipesId())
.append("sendFlag", getSendFlag())
.append("sendTime", getSendTime())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -18,7 +18,8 @@
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
<!-- 非持久化字段 -->
<result property="customer" column="customer" />
<result property="customerId" column="cus_id"></result><!-- 客户ID -->
<result property="customer" column="customer" /><!-- 客户姓名 -->
<result property="phone" column="phone" />
<result property="orderStartDate" column="order_start_date" />
<result property="orderEndDate" column="order_end_date" />
@ -126,7 +127,7 @@
<!-- 食谱计划、订单表联查 -->
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
SELECT srp.id,srp.order_id,sr.customer,sr.phone,su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,sr.start_time,sr.server_end_time, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
SELECT srp.id,srp.order_id,sr.customer,sr.cus_id,sr.phone,su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,sr.start_time,sr.server_end_time, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
FROM sys_recipes_plan srp
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0

@ -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>

@ -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>

@ -91,7 +91,10 @@
</div>
</el-drawer>
<!-- 新增订单 -->
<create-order-dialog ref="cusCreateOrderDialogRef" />
<!-- 订单编辑 -->
<edit-order-dialog ref="cusEditOrderDialogRef" />
<order-detail ref="orderDetailRef" />
</div>
@ -99,13 +102,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 {
@ -155,7 +160,7 @@ export default {
cusId: this.data.id,
preSaleId: this.data.salesman,
afterSaleId: this.data.afterDietitian,
nutritionistId: this.data.mainDietitian,
nutritionistId: [this.data.mainDietitian],
nutriAssisId: this.data.assistantDietitian,
},
() => {
@ -170,7 +175,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);
});
},

@ -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: ""
}
]