优化代码
This commit is contained in:
		| @@ -1,607 +0,0 @@ | ||||
| <template> | ||||
|   <el-dialog | ||||
|     :title="title" | ||||
|     :visible.sync="visible" | ||||
|     width="720px" | ||||
|     append-to-body | ||||
|     :close-on-click-modal="false" | ||||
|     @closed="handleOnClosed" | ||||
|   > | ||||
|     <el-row :gutter="15"> | ||||
|       <el-form ref="form" :model="form" :rules="rules" label-width="90px"> | ||||
|         <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="nutritionistId"> | ||||
|             <el-select v-model="form.nutritionistId" 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="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="12"> | ||||
|           <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 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"; | ||||
|  | ||||
| export default { | ||||
|   name: "OrderDialog", | ||||
|   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: [], | ||||
|     }; | ||||
|   }, | ||||
|   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; | ||||
|     }); | ||||
|   }, | ||||
|   methods: { | ||||
|     showDialog(data, callback) { | ||||
|       this.data = data; | ||||
|       this.callback = callback; | ||||
|       this.reset(data); | ||||
|  | ||||
|       this.title = `创建「${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 { | ||||
|             this.form.status = "0"; | ||||
|             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 [ | ||||
|         plannerId, | ||||
|         plannerAssisId, | ||||
|         operatorId, | ||||
|         operatorAssisId, | ||||
|       ] = planningAndOperationValue | ||||
|         ? planningAndOperationValue.dictLabel | ||||
|             .split("|") | ||||
|             .map((str) => parseInt(str)) | ||||
|         : [0, 0, 0, 0]; | ||||
|  | ||||
|       this.form = { | ||||
|         orderId: null, | ||||
|         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: defaultNutritionist | ||||
|           ? parseInt(defaultNutritionist.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, | ||||
|       }; | ||||
|       console.log(this.form); | ||||
|       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, | ||||
|         }; | ||||
|       } | ||||
|     }, | ||||
|   }, | ||||
|   watch: { | ||||
|     // 监听收款账号的变化 | ||||
|     "form.accountId": function (newVal, oldVal) { | ||||
|       console.log("updte"); | ||||
|       this.initPlanningAndOperation(); | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| @@ -113,7 +113,17 @@ | ||||
|         prop="createTime" | ||||
|         width="160" | ||||
|       /> | ||||
|       <el-table-column label="名字" align="center" prop="name" /> | ||||
|       <el-table-column | ||||
|         label="进粉时间" | ||||
|         align="center" | ||||
|         prop="fansTime" | ||||
|         width="120" | ||||
|       > | ||||
|         <template slot-scope="scope"> | ||||
|           <span>{{ parseTime(scope.row.fansTime, "{y}-{m}-{d}") }}</span> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="客户姓名" align="center" prop="name" /> | ||||
|       <el-table-column label="手机号" align="center" prop="phone" /> | ||||
|       <el-table-column | ||||
|         label="主营养师" | ||||
| @@ -159,16 +169,6 @@ | ||||
|           </el-button> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="体征" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           <el-button | ||||
|             size="mini" | ||||
|             type="text" | ||||
|             @click="handleOnBodySignClick(scope.row)" | ||||
|             >详情 | ||||
|           </el-button> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="健康评估" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           <el-button | ||||
| @@ -226,9 +226,9 @@ | ||||
|     <!-- 添加或修改客户档案对话框 --> | ||||
|     <el-dialog :title="title" :visible.sync="open" width="520px" append-to-body> | ||||
|       <el-row :gutter="15"> | ||||
|         <el-form ref="form" :model="form" :rules="rules" label-width="90px"> | ||||
|         <el-form ref="form" :model="form" :rules="rules" label-width="100px"> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="名字" prop="name"> | ||||
|             <el-form-item label="客户名字" prop="customer"> | ||||
|               <el-input v-model="form.name" placeholder="请输入名字" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
| @@ -237,6 +237,30 @@ | ||||
|               <el-input v-model="form.phone" placeholder="请输入手机号" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="售前" prop="salesman"> | ||||
|               <el-select v-model="form.salesman" 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="12"> | ||||
|             <el-form-item label="售后" prop="afterDietitian"> | ||||
|               <el-select v-model="form.afterDietitian" 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="12"> | ||||
|             <el-form-item label="主营养师" prop="mainDietitian"> | ||||
|               <el-select v-model="form.mainDietitian" placeholder="请选择"> | ||||
| @@ -262,27 +286,16 @@ | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="售后" prop="afterDietitian"> | ||||
|               <el-select v-model="form.afterDietitian" 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="12"> | ||||
|             <el-form-item label="售前" prop="salesman"> | ||||
|               <el-select v-model="form.salesman" placeholder="请选择"> | ||||
|                 <el-option | ||||
|                   v-for="dict in preSaleIdOptions" | ||||
|                   :key="dict.dictValue" | ||||
|                   :label="dict.dictLabel" | ||||
|                   :value="parseInt(dict.dictValue)" | ||||
|                 /> | ||||
|               </el-select> | ||||
|             <el-form-item label="进粉时间" prop="fansTime"> | ||||
|               <el-date-picker | ||||
|                 v-model="form.fansTime" | ||||
|                 type="date" | ||||
|                 placeholder="选择进粉时间" | ||||
|                 format="yyyy-MM-dd" | ||||
|                 value-format="yyyy-MM-dd" | ||||
|                 :picker-options="fanPickerOptions" | ||||
|               > | ||||
|               </el-date-picker> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|         </el-form> | ||||
| @@ -293,7 +306,11 @@ | ||||
|       </div> | ||||
|     </el-dialog> | ||||
|  | ||||
|     <!-- 订单抽屉 --> | ||||
|     <order-drawer ref="cusOrderDrawerRef" /> | ||||
|     <!-- 合同抽屉 --> | ||||
|     <!-- 健康评估弹窗 --> | ||||
|     <!-- 食谱计划抽屉 --> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| @@ -306,10 +323,11 @@ import { | ||||
|   listCustomer, | ||||
|   updateCustomer, | ||||
| } from "@/api/custom/customer"; | ||||
| import store from "@/store"; | ||||
|  | ||||
| import { getOptions } from "@/api/custom/order"; | ||||
|  | ||||
| import OrderDrawer from "./orderDrawer"; | ||||
| import OrderDrawer from "@/components/OrderDrawer"; | ||||
|  | ||||
| export default { | ||||
|   name: "Customer", | ||||
| @@ -317,7 +335,9 @@ export default { | ||||
|     "order-drawer": OrderDrawer, | ||||
|   }, | ||||
|   data() { | ||||
|     const userId = store.getters && store.getters.userId; | ||||
|     return { | ||||
|       userId, | ||||
|       // 遮罩层 | ||||
|       loading: true, | ||||
|       // 选中数组 | ||||
| @@ -358,7 +378,40 @@ export default { | ||||
|       // 表单参数 | ||||
|       form: {}, | ||||
|       // 表单校验 | ||||
|       rules: {}, | ||||
|       rules: { | ||||
|         customer: [ | ||||
|           { required: true, message: "客户姓名不能为空", trigger: "blur" }, | ||||
|         ], | ||||
|         phone: [ | ||||
|           { required: true, message: "手机号不能为空", trigger: "blur" }, | ||||
|           { | ||||
|             required: true, | ||||
|             trigger: "blur", | ||||
|             pattern: /^[0-9]{5,11}$/, | ||||
|             message: "手机号格式不正确", | ||||
|           }, | ||||
|         ], | ||||
|         salesman: [ | ||||
|           { required: true, message: "售前不能为空", trigger: "blur" }, | ||||
|         ], | ||||
|         afterDietitian: [ | ||||
|           { required: true, message: "售后不能为空", trigger: "blur" }, | ||||
|         ], | ||||
|         mainDietitian: [ | ||||
|           { required: true, message: "主营养师不能为空", trigger: "blur" }, | ||||
|         ], | ||||
|         assistantDietitian: [ | ||||
|           { required: true, message: "营养师助理不能为空", trigger: "blur" }, | ||||
|         ], | ||||
|         fansTime: [ | ||||
|           { required: true, message: "进粉时间不能为空", trigger: "blur" }, | ||||
|         ], | ||||
|       }, | ||||
|       fanPickerOptions: { | ||||
|         disabledDate(time) { | ||||
|           return time.getTime() > Date.now(); | ||||
|         }, | ||||
|       }, | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
| @@ -482,6 +535,12 @@ export default { | ||||
|       this.reset(); | ||||
|       this.open = true; | ||||
|       this.title = "添加客户档案"; | ||||
|  | ||||
|       // 选择默认销售 | ||||
|       const tarSale = this.preSaleIdOptions.find( | ||||
|         (obj) => parseInt(obj.dictValue) === this.userId | ||||
|       ); | ||||
|       this.form.salesman = tarSale ? tarSale.dictValue : null; | ||||
|     }, | ||||
|     /** 修改按钮操作 */ | ||||
|     handleUpdate(row) { | ||||
|   | ||||
| @@ -1,155 +0,0 @@ | ||||
| <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 | ||||
|               type="primary" | ||||
|               icon="el-icon-plus" | ||||
|               size="mini" | ||||
|               @click="handleAdd" | ||||
|               >创建订单 | ||||
|             </el-button> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|  | ||||
|         <el-table | ||||
|           :data="orderList" | ||||
|           row-key="orderId" | ||||
|           default-expand-all | ||||
|           :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" | ||||
|         > | ||||
|           <el-table-column | ||||
|             label="审核状态" | ||||
|             prop="reviewStatus" | ||||
|             align="center" | ||||
|             width="120" | ||||
|           > | ||||
|             <template slot-scope="scope"> | ||||
|               <el-tag | ||||
|                 v-if="scope.row.orderType === 'main'" | ||||
|                 :type="scope.row.reviewStatus === 'yes' ? 'success' : 'danger'" | ||||
|                 disable-transitions | ||||
|               > | ||||
|                 {{ scope.row.reviewStatus === "yes" ? "已审核" : "未审核" }} | ||||
|               </el-tag> | ||||
|               <el-tag | ||||
|                 v-if="scope.row.orderType === 'virtual'" | ||||
|                 disable-transitions | ||||
|               > | ||||
|                 分单 | ||||
|               </el-tag> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|           <el-table-column | ||||
|             label="成交时间" | ||||
|             prop="orderTime" | ||||
|             align="center" | ||||
|           ></el-table-column> | ||||
|           <el-table-column | ||||
|             label="成交金额" | ||||
|             prop="amount" | ||||
|             align="center" | ||||
|           ></el-table-column> | ||||
|           <el-table-column label="服务时长" prop="serveTime" align="center" /> | ||||
|           <el-table-column label="操作" align="center" width="120px"> | ||||
|             <template slot-scope="scope"> | ||||
|               <el-button | ||||
|                 v-if="scope.row.orderType === 'main'" | ||||
|                 size="mini" | ||||
|                 type="text" | ||||
|                 @click="handleOnMenuClick(scope.row)" | ||||
|                 >详情</el-button | ||||
|               > | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </el-table> | ||||
|       </div> | ||||
|     </el-drawer> | ||||
|  | ||||
|     <create-order-dialog ref="cusCreateOrderDialogRef" /> | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| import { listOrder } from "@/api/custom/order"; | ||||
| import CreateOrderDialog from "./createOrderDialog"; | ||||
|  | ||||
| export default { | ||||
|   name: "CustomerOrderDrawer", | ||||
|   components: { | ||||
|     "create-order-dialog": CreateOrderDialog, | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       visible: false, | ||||
|       title: "", | ||||
|       data: undefined, | ||||
|       orderList: [], | ||||
|     }; | ||||
|   }, | ||||
|   methods: { | ||||
|     showDrawer(data) { | ||||
|       // console.log(data); | ||||
|       this.data = data; | ||||
|       if (!this.data) { | ||||
|         return; | ||||
|       } | ||||
|       this.title = `「${this.data.name}」订单列表`; | ||||
|       this.fetchOrderList(data.id); | ||||
|     }, | ||||
|     fetchOrderList(cusId) { | ||||
|       listOrder({ cusId }).then((res) => { | ||||
|         this.orderList = res.rows.reduce((arr, cur) => { | ||||
|           const tarOrder = arr.find((ord) => ord.startTime === cur.startTime); | ||||
|           if (tarOrder) { | ||||
|             const firstObj = JSON.parse(JSON.stringify(tarOrder)); | ||||
|             tarOrder.children = [ | ||||
|               { ...firstObj, orderType: "main" }, | ||||
|               { ...cur, orderType: "main" }, | ||||
|             ]; | ||||
|             tarOrder.amount += cur.amount; | ||||
|             tarOrder.orderId += cur.orderId; | ||||
|             tarOrder.orderType = "virtual"; | ||||
|           } else { | ||||
|             cur.orderType = "main"; | ||||
|             arr.push(cur); | ||||
|           } | ||||
|           return arr; | ||||
|         }, []); | ||||
|  | ||||
|         this.visible = true; | ||||
|       }); | ||||
|     }, | ||||
|     handleAdd() { | ||||
|       this.$refs.cusCreateOrderDialogRef.showDialog( | ||||
|         { | ||||
|           customer: this.data.name, | ||||
|           cusId: this.data.id, | ||||
|           preSaleId: this.data.salesman, | ||||
|           afterSaleId: this.data.afterDietitian, | ||||
|           nutritionistId: this.data.mainDietitian, | ||||
|           nutriAssisId: this.data.assistantDietitian, | ||||
|         }, | ||||
|         () => { | ||||
|           this.fetchOrderList(this.data.id); | ||||
|         } | ||||
|       ); | ||||
|     }, | ||||
|     handleOnClosed() { | ||||
|       this.data = undefined; | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| <style  lang="scss" scoped> | ||||
| /deep/ :focus { | ||||
|   outline: 0; | ||||
| } | ||||
| </style> | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,126 +0,0 @@ | ||||
| <template> | ||||
|   <el-dialog title="客户体征" :visible.sync="visible" width="1000px" append-to-body @closed="onClosed"> | ||||
|     <el-table :show-header="false" :data="customerSignList" border :cell-style="columnStyle" style="width: 100%;"> | ||||
|       <el-table-column width="140" prop="attr_name_one"> | ||||
|       </el-table-column> | ||||
|       <el-table-column prop="value_one"> | ||||
|         <template slot-scope="scope"> | ||||
|           <auto-hide-message :data="scope.row.value_one == null ? '' : (scope.row.value_one+'')" :maxLength="20"/> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column width="140" prop="attr_name_two"></el-table-column> | ||||
|       <el-table-column prop="value_two"> | ||||
|         <template slot-scope="scope"> | ||||
|           <auto-hide-message :data="scope.row.value_two == null ? '' : (scope.row.value_two+'')" :maxLength="20"/> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column width="140" prop="attr_name_three"></el-table-column> | ||||
|       <el-table-column prop="value_three"> | ||||
|         <template slot-scope="scope"> | ||||
|           <auto-hide-message :data="scope.row.value_three == null ? '' : (scope.row.value_three+'')" :maxLength="20"/> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
|   </el-dialog> | ||||
| </template> | ||||
| <script> | ||||
|   import {getCustomerAndSignByPhone} from "@/api/custom/customer"; | ||||
|   import AutoHideMessage from "@/components/AutoHideMessage"; | ||||
|  | ||||
|   export default { | ||||
|     name: 'BodySignDialog', | ||||
|     components: { | ||||
|       "auto-hide-message": AutoHideMessage | ||||
|     }, | ||||
|     data() { | ||||
|       return { | ||||
|         visible: false, | ||||
|         //用户体征数据 | ||||
|         customerSignList: [], | ||||
|         message: "未找到该客户,请检查订单手机号与客户体征手机号是否一致", | ||||
|         signTitleData: [["姓名", "手机号", "性别"], | ||||
|           ["年龄(岁)", "身高(厘米)", "体重(斤)"], | ||||
|           ["南、北方", "病史", "忌口或过敏源"], | ||||
|           ["是否便秘", "是否熬夜失眠", "是否经常运动"], | ||||
|           ["饮食方式", "饮食备注", "饮食特点"], | ||||
|           ["工作职业", "是否上夜班", "久坐多还是运动多"], | ||||
|           ["是否浑身乏力", "是否减脂反弹", "意识到生活习惯是减脂的关键"], | ||||
|           ["睡觉时间", "起床时间", "方便沟通时间"], | ||||
|           ["湿气数据", "气血数据", "减脂经历"], | ||||
|           ["减脂遇到的困难", "备注", "创建时间"]], | ||||
|         signValueData: [["name", "phone", "sex"], | ||||
|           ["age", "tall", "weight"], | ||||
|           ["position", "signString", "dishesIngredientId"], | ||||
|           ["constipation", "staylate", "motion"], | ||||
|           ["makeFoodType", "remarks", "makeFoodTaste"], | ||||
|           ["vocation", "night", "walk"], | ||||
|           ["weakness", "rebound", "crux"], | ||||
|           ["sleepTime", "getupTime", "connectTime"], | ||||
|           ["bloodData", "moistureDate", "experience"], | ||||
|           ["difficulty", "comments", "createTime"]] | ||||
|       } | ||||
|     }, | ||||
|     methods: { | ||||
|       showDialog(phone) { | ||||
|         if (!phone) { | ||||
|           this.alert(this.message); | ||||
|           return; | ||||
|         } | ||||
|         getCustomerAndSignByPhone({phone}).then(response => { | ||||
|           if (response.data == null) { | ||||
|             this.alert(this.message); | ||||
|             return; | ||||
|           } | ||||
|  | ||||
|           let sign = response.data; | ||||
|           // sign.name = response.data.name; | ||||
|           // sign.phone = response.data.phone; | ||||
|           // sign.createTime = response.data.createTime; | ||||
|           sign.sex = sign.sex === 0 ? `男` : '女'; | ||||
|           sign.position = sign.position === 0 ? `南方` : '北方'; | ||||
|           sign.signString = sign.signList.join(','); | ||||
|           sign.constipation = sign.constipation === 0 ? "是" : "否"; | ||||
|           sign.staylate = sign.staylate === 0 ? "是" : "否"; | ||||
|           sign.motion = sign.motion === 0 ? "是" : "否"; | ||||
|           sign.makeFoodType = sign.makeFoodType === 0 ? `自己做` : '外面吃'; | ||||
|           sign.makeFoodTaste = sign.makeFoodTaste === 0 ? "清淡" : '重口味'; | ||||
|           sign.night = sign.night === 0 ? `是` : '否'; | ||||
|           sign.walk = sign.walk === 0 ? `久坐多` : '走动多'; | ||||
|           sign.weakness = sign.weakness === 0 ? `是` : '否'; | ||||
|           sign.rebound = sign.rebound === 0 ? `是` : '否'; | ||||
|           sign.crux = sign.crux === 0 ? `是` : '否'; | ||||
|           sign.sleepTime = sign.sleepTime + "点"; | ||||
|           sign.getupTime = sign.getupTime + "点"; | ||||
|           sign.connectTime = sign.connectTime + "点"; | ||||
|           for (let i = 0; i < this.signTitleData.length; i++) { | ||||
|             this.customerSignList.push({ | ||||
|               "attr_name_one": this.signTitleData[i][0], | ||||
|               "value_one": sign[this.signValueData[i][0]], | ||||
|               "attr_name_two": this.signTitleData[i][1], | ||||
|               "value_two": sign[this.signValueData[i][1]], | ||||
|               "attr_name_three": this.signTitleData[i][2], | ||||
|               "value_three": sign[this.signValueData[i][2]] | ||||
|             }); | ||||
|           } | ||||
|           this.visible = true; | ||||
|         }); | ||||
|       }, | ||||
|       alert(value) { | ||||
|         this.$alert(value, '提示', {confirmButtonText: '关闭'}); | ||||
|       }, | ||||
|       // 自定义列背景色 | ||||
|       columnStyle({row, column, rowIndex, columnIndex}) { | ||||
|         if (columnIndex == 0 || columnIndex == 2 || columnIndex == 4 || columnIndex == 6) { | ||||
|           //第三第四列的背景色就改变了2和3都是列数的下标 | ||||
|           return "background:#f3f6fc;font-weight:bold"; | ||||
|         } else { | ||||
|           return "background:#ffffff;"; | ||||
|         } | ||||
|       }, | ||||
|       onClosed() { | ||||
|         this.customerSignList = []; | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|   } | ||||
| </script> | ||||
| @@ -227,8 +227,8 @@ | ||||
| <script> | ||||
|   import {exportRecipesPlan, getRecipesPlan, listRecipesPlan, updateRecipesPlan} from "@/api/custom/recipesPlan"; | ||||
|   import {getOptions} from "@/api/custom/order"; | ||||
|   import OrderDialog from './orderDialog'; | ||||
|   import BodySignDialog from './bodySignDialog'; | ||||
|   import OrderDetail from '@/components/OrderDetail'; | ||||
|   import BodySignDetail from '@/components/BodySignDetail'; | ||||
|   import dayjs from 'dayjs'; | ||||
|   import store from "@/store"; | ||||
|  | ||||
| @@ -295,8 +295,8 @@ | ||||
|  | ||||
|     }, | ||||
|     components: { | ||||
|       "order-dialog": OrderDialog, | ||||
|       "body_sign_dialog": BodySignDialog | ||||
|       "order-dialog": OrderDetail, | ||||
|       "body_sign_dialog": BodySignDetail | ||||
|     }, | ||||
|     created() { | ||||
|       getOptions().then(response => { | ||||
|   | ||||
| @@ -1,110 +0,0 @@ | ||||
| <template> | ||||
|   <el-dialog title="订单详情" :visible.sync="visible" width="1000px" append-to-body @closed="onClosed"> | ||||
|     <el-table :show-header="false" :data="orderDetailList" border :cell-style="columnStyle" style="width: 100%;"> | ||||
|       <el-table-column width="120" prop="attr_name_one"> | ||||
|       </el-table-column> | ||||
|       <el-table-column prop="value_one"> | ||||
|         <template slot-scope="scope"> | ||||
|           <el-tag v-if="scope.row.attr_name_one === '订单状态'" | ||||
|                   :type="scope.row.value_two === '2' ? 'success' : scope.row.value_one === '0'? '': 'danger'" | ||||
|                   disable-transitions> | ||||
|             {{scope.row.value_two === '2' ? '已完成': scope.row.value_one ==='0'? '进行中': '已暂停'}} | ||||
|           </el-tag> | ||||
|           <auto-hide-message v-else :data="scope.row.value_one == null ? '' : (scope.row.value_one+'')" | ||||
|                              :maxLength="20"/> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column width="120" prop="attr_name_two"></el-table-column> | ||||
|       <el-table-column prop="value_two"> | ||||
|         <template slot-scope="scope"> | ||||
|           <el-tag v-if="scope.row.attr_name_two === '审核状态'" | ||||
|                   :type="scope.row.value_two === 'yes' ? 'success' : 'danger'"> | ||||
|             {{scope.row.value_two === 'yes' ? '已审核' : '未审核'}} | ||||
|           </el-tag> | ||||
|           <auto-hide-message v-else :data="scope.row.value_two == null ? '' : (scope.row.value_two+'')" | ||||
|                              :maxLength="20"/> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column width="120" prop="attr_name_three"></el-table-column> | ||||
|       <el-table-column prop="value_three"> | ||||
|         <template slot-scope="scope"> | ||||
|           <auto-hide-message :data="scope.row.value_three == null ? '' : (scope.row.value_three+'')" :maxLength="20"/> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
|   </el-dialog> | ||||
| </template> | ||||
| <script> | ||||
|   import AutoHideMessage from "@/components/AutoHideMessage"; | ||||
|   import {getInfoDetail} from "@/api/custom/order"; | ||||
|  | ||||
|   export default { | ||||
|     name: 'OrderDialog', | ||||
|     components: { | ||||
|       "auto-hide-message": AutoHideMessage | ||||
|     }, | ||||
|     props: {}, | ||||
|     data() { | ||||
|       return { | ||||
|         orderDetailList: [], | ||||
|         visible: false, | ||||
|         //订单详情的标题,按竖显示 | ||||
|         orderTitleData: [["订单状态", "审核状态", "成交时间"], | ||||
|           ["姓名", "金额", "体重"], | ||||
|           ["手机号", "服务时长", "赠送时长"], | ||||
|           ["调理项目", "收款方式", "售前"], | ||||
|           ["售后", "营养师", "助理营养师"], | ||||
|           ["账号", "策划", "策划助理"], | ||||
|           ["运营", "运营助理", "进粉时间"], | ||||
|           ["开始时间", "结束时间", "备注"]], | ||||
|         //订单详情的属性名称,与标题对应,按竖显示 | ||||
|         orderValueData: [["status", "reviewStatus", "orderTime"], | ||||
|           ["customer", "amount", "weight"], | ||||
|           ["phone", "serveTime", "giveServeDay"], | ||||
|           ["conditioningProject", "payType", "preSale"], | ||||
|           ["afterSale", "nutritionist", "nutriAssis"], | ||||
|           ["account", "planner", "plannerAssis"], | ||||
|           ["operator", "operatorAssis", "becomeFanTime"], | ||||
|           ["startTime", "serverEndTime", "serverEndTime"]], | ||||
|       } | ||||
|     }, | ||||
|     created() { | ||||
|     }, | ||||
|     methods: { | ||||
|       // 自定义列背景色 | ||||
|       columnStyle({row, column, rowIndex, columnIndex}) { | ||||
|         if (columnIndex == 0 || columnIndex == 2 || columnIndex == 4 || columnIndex == 6) { | ||||
|           //第三第四列的背景色就改变了2和3都是列数的下标 | ||||
|           return "background:#f3f6fc;font-weight:bold"; | ||||
|         } else { | ||||
|           return "background:#ffffff;"; | ||||
|         } | ||||
|       }, | ||||
|       showDialog(orderId) { | ||||
|         getInfoDetail({orderId}).then(response => { | ||||
|           response.data.weight = response.data.weight != null ? (response.data.weight + "斤") : ""; | ||||
|           response.data.giveServeDay = response.data.giveServeDay != null ? (response.data.giveServeDay + "天") : ""; | ||||
|           for (let i = 0; i < this.orderTitleData.length; i++) { | ||||
|             this.orderDetailList.push({ | ||||
|               "attr_name_one": this.orderTitleData[i][0], | ||||
|               "value_one": response.data[this.orderValueData[i][0]], | ||||
|               "attr_name_two": this.orderTitleData[i][1], | ||||
|               "value_two": response.data[this.orderValueData[i][1]], | ||||
|               "attr_name_three": this.orderTitleData[i][2], | ||||
|               "value_three": response.data[this.orderValueData[i][2]] | ||||
|             }); | ||||
|           } | ||||
|           this.visible = true; | ||||
|         }); | ||||
|       }, | ||||
|       onClosed() { | ||||
|         this.orderDetailList = []; | ||||
|       } | ||||
|     }, | ||||
|     watch: { | ||||
|       // visible: function (val, oldVal) { | ||||
|       //   console.log({val, oldVal}) | ||||
|       // } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
		Reference in New Issue
	
	Block a user