新增global,缓存职位信息
This commit is contained in:
		| @@ -14,15 +14,25 @@ | ||||
|             <el-cascader | ||||
|               v-model="form.orderType" | ||||
|               :options="orderTypeOptions" | ||||
|                style="width: 100%"> | ||||
|               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-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> | ||||
| @@ -120,7 +130,11 @@ | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="主营养师" prop="nutritionistIdList"> | ||||
|             <el-select v-model="form.nutritionistIdList" multiple placeholder="请选择"> | ||||
|             <el-select | ||||
|               v-model="form.nutritionistIdList" | ||||
|               multiple | ||||
|               placeholder="请选择" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="dict in nutritionistIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
| @@ -132,7 +146,11 @@ | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="拆分比例" prop="nutritionistRate"> | ||||
|             <el-select v-model="form.nutritionistRate" :disabled="orderRateOptionsShow" placeholder="请选择" > | ||||
|             <el-select | ||||
|               v-model="form.nutritionistRate" | ||||
|               :disabled="orderRateOptionsShow" | ||||
|               placeholder="请选择" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="dict in orderRateOptions" | ||||
|                 :key="dict.dictValue" | ||||
| @@ -264,9 +282,11 @@ | ||||
|   </el-dialog> | ||||
| </template> | ||||
| <script> | ||||
| import { addOrder, getOptions, updateOrder } from "@/api/custom/order"; | ||||
| import { addOrder, updateOrder } from "@/api/custom/order"; | ||||
| import dayjs from "dayjs"; | ||||
| import * as orderTypeData from "@/utils/orderType"; | ||||
| import { mapGetters } from "vuex"; | ||||
|  | ||||
| export default { | ||||
|   name: "OrderEdit", | ||||
|   props: { | ||||
| @@ -383,16 +403,6 @@ export default { | ||||
|       }, | ||||
|       // 收款方式字典 | ||||
|       payTypeIdOptions: [], | ||||
|       // 售前字典 | ||||
|       preSaleIdOptions: [], | ||||
|       // 售后字典 | ||||
|       afterSaleIdOptions: [], | ||||
|       // 主营养师字典 | ||||
|       nutritionistIdOptions: [], | ||||
|       // 助理营养师字典 | ||||
|       nutriAssisIdOptions: [], | ||||
|       // 策划字典 | ||||
|       plannerIdOptions: [], | ||||
|       // 账号 | ||||
|       accountIdOptions: [], | ||||
|       // 服务时长 | ||||
| @@ -401,54 +411,25 @@ export default { | ||||
|       giveTimeIdOption: [], | ||||
|       //调理项目 | ||||
|       conditioningProjectIdOption: [], | ||||
|       // 策划助理字典 | ||||
|       plannerAssisIdOptions: [], | ||||
|       // 运营字典 | ||||
|       operatorIdOptions: [], | ||||
|       // 审核状态 | ||||
|       reviewStatusOptions: [], | ||||
|       // | ||||
|       operatorAssisIdOptions: [], | ||||
|       //下拉列表对应关系(用于选择收款账号自动选择策划、策划助理、运营、运营助理) | ||||
|       orderDropdownCorrespondingOptions: [], | ||||
|       //订单类型 | ||||
|       orderTypeOptions: orderTypeData['orderTypeArray'], | ||||
|       orderTypeOptions: orderTypeData["orderTypeArray"], | ||||
|       secondAfterSaleFlagShow: true, | ||||
|       //分成比例 | ||||
|       orderRateOptions: orderTypeData['orderRateArray'], | ||||
|       orderRateOptionsShow: 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); | ||||
|       // console.log(response.data); | ||||
|       this.accountIdOptions.splice(0, 0, { | ||||
|         dictLabel: "无", | ||||
|         dictValue: "0", | ||||
| @@ -484,6 +465,26 @@ export default { | ||||
|       this.orderTypeOptions = response.data; | ||||
|     });*/ | ||||
|   }, | ||||
|   computed: { | ||||
|     ...mapGetters([ | ||||
|       // 售前字典 | ||||
|       "preSaleIdOptions", | ||||
|       // 售后字典 | ||||
|       "afterSaleIdOptions", | ||||
|       // 主营养师字典 | ||||
|       "nutritionistIdOptions", | ||||
|       // 助理营养师字典 | ||||
|       "nutriAssisIdOptions", | ||||
|       // 策划字典 | ||||
|       "plannerIdOptions", | ||||
|       // 策划助理字典 | ||||
|       "plannerAssisIdOptions", | ||||
|       // 运营字典 | ||||
|       "operatorIdOptions", | ||||
|       // 运营助理字典 | ||||
|       "operatorAssisIdOptions", | ||||
|     ]), | ||||
|   }, | ||||
|   methods: { | ||||
|     showDialog(data, callback) { | ||||
|       // this.data = data; | ||||
| @@ -554,7 +555,9 @@ export default { | ||||
|         (opt) => parseInt(opt.dictValue) === accountId | ||||
|       ); | ||||
|  | ||||
|       const defaultOrderRate = this.orderRateOptions.find((opt) => opt.remark === "default"); | ||||
|       const defaultOrderRate = this.orderRateOptions.find( | ||||
|         (opt) => opt.remark === "default" | ||||
|       ); | ||||
|  | ||||
|       const [ | ||||
|         plannerId, | ||||
| @@ -590,7 +593,9 @@ export default { | ||||
|         updateBy: null, | ||||
|         updateTime: null, | ||||
|         nutritionistId: null, | ||||
|         nutritionistIdList: defaultNutritionist ? [parseInt(defaultNutritionist.dictValue)] : null, | ||||
|         nutritionistIdList: defaultNutritionist | ||||
|           ? [parseInt(defaultNutritionist.dictValue)] | ||||
|           : null, | ||||
|         nutritionistRate: defaultOrderRate ? defaultOrderRate.dictValue : null, | ||||
|         remark: null, | ||||
|         nutriAssisId: defaultNutriAssis | ||||
| @@ -647,9 +652,9 @@ export default { | ||||
|         }; | ||||
|       } | ||||
|     }, | ||||
|     handleOrderTypeChange(){ | ||||
|         console.log(this.form.orderType); | ||||
|     } | ||||
|     handleOrderTypeChange() { | ||||
|       console.log(this.form.orderType); | ||||
|     }, | ||||
|   }, | ||||
|   watch: { | ||||
|     // 监听收款账号的变化 | ||||
| @@ -657,22 +662,22 @@ export default { | ||||
|       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"; | ||||
|         } | ||||
|       //判断订单类型是否选择了二开 | ||||
|       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"; | ||||
|       } | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user