diff --git a/stdiet-ui/src/components/OrderDrawer/index.vue b/stdiet-ui/src/components/OrderDrawer/index.vue index 6ed487979..3ba615c2b 100644 --- a/stdiet-ui/src/components/OrderDrawer/index.vue +++ b/stdiet-ui/src/components/OrderDrawer/index.vue @@ -180,16 +180,20 @@ export default { cur.type = "main"; arr.push(cur); } - if (idx === res.rows.length - 1 && arr.children) { + if (idx === res.rows.length - 1) { arr.forEach((obj) => { - obj.amount = arr.children.reduce((a, c) => { - return a + c.afterSaleCommissOrder === 0 ? c.amount : 0; - }, 0); + console.log({ obj }); + if (obj.children) { + obj.amount = obj.children.reduce( + (a, c) => a + (c.afterSaleCommissOrder === 0 ? c.amount : 0), + 0 + ); + } }); } return arr; }, []); - // console.log(this.orderList); + console.log(this.orderList); this.loading = false; }); }, diff --git a/stdiet-ui/src/components/PhysicalSignsEdit/index.vue b/stdiet-ui/src/components/PhysicalSignsEdit/index.vue index 9750fe118..e0e2d7073 100644 --- a/stdiet-ui/src/components/PhysicalSignsEdit/index.vue +++ b/stdiet-ui/src/components/PhysicalSignsEdit/index.vue @@ -1,35 +1,77 @@ <template> - <el-dialog v-if="visible" :visible.sync="visible" :title="title" width="500px" append-to-body @closed="onClosed"> + <el-dialog + v-if="visible" + :visible.sync="visible" + :title="title" + width="500px" + append-to-body + @closed="onClosed" + > <div style="margin-top: -10px"> <el-form ref="form" label-position="top" label-width="100px"> <el-form-item :label="'请勾选需要修改的模块'" prop="showModuleArray"> - <el-checkbox-group v-model="showModuleArray" @change="changeShowModule()"> - <el-checkbox v-for="(item, index) in healthyData['titleArray']" :label="index" :key="index">{{item}}</el-checkbox> + <el-checkbox-group + v-model="showModuleArray" + @change="changeShowModule()" + > + <el-checkbox + v-for="(item, index) in healthyData['titleArray']" + :label="index" + :key="index" + >{{ item }}</el-checkbox + > </el-checkbox-group> </el-form-item> </el-form> </div> - <div style="height:400px;overflow: auto"> - <el-form ref="form" label-position="top" :model="form" :rules="rules" label-width="100px" style="padding: 16px"> - <healthy-form1 v-show="stepArray[0]" :flag="1" :form.sync="form"></healthy-form1> + <div style="height: 400px; overflow: auto"> + <el-form + ref="form" + label-position="top" + :model="form" + :rules="rules" + label-width="100px" + style="padding: 16px" + > + <healthy-form1 + v-show="stepArray[0]" + :flag="1" + :form.sync="form" + ></healthy-form1> <healthy-form2 v-show="stepArray[1]" :form.sync="form"></healthy-form2> <healthy-form3 v-show="stepArray[2]" :form.sync="form"></healthy-form3> <healthy-form4 v-show="stepArray[3]" :form.sync="form"></healthy-form4> <healthy-form5 v-show="stepArray[4]" :form.sync="form"></healthy-form5> <healthy-form6 v-show="stepArray[5]" :form.sync="form"></healthy-form6> <healthy-form7 v-show="stepArray[6]" :form.sync="form"></healthy-form7> - <healthy-form8 v-show="stepArray[7]" :flag="1" :form.sync="form"></healthy-form8> - <edit-file v-show="stepArray[8]" ref="editFile" :form.sync="form"></edit-file> - <el-form-item style="text-align: center; margin: 30px auto" v-show="submitShow"> - <el-button type="primary" @click="submit()" style="width: 40%" >提交</el-button> - <el-button @click="onClosed()" style="width: 40%" >取消</el-button> + <healthy-form8 + v-show="stepArray[7]" + :flag="1" + :form.sync="form" + ></healthy-form8> + <edit-file + v-show="stepArray[8]" + ref="editFile" + :form.sync="form" + ></edit-file> + <el-form-item + style="text-align: center; margin: 30px auto" + v-show="submitShow" + > + <el-button type="primary" @click="submit()" style="width: 40%" + >提交</el-button + > + <el-button @click="onClosed()" style="width: 40%">取消</el-button> </el-form-item> </el-form> </div> </el-dialog> </template> <script> -import { getCustomerPhysicalSignsByCusId,delCustomerHealthy } from "@/api/custom/customer"; +import { + getCustomerPhysicalSignsByCusId, + delCustomerHealthy, +} from "@/api/custom/customer"; import { updateHealthy } from "@/api/custom/healthy"; import * as healthyData from "@/utils/healthyData"; import Form1 from "@/components/HealthyForm/Form1"; @@ -45,22 +87,22 @@ import EditHealthyFile from "@/components/HealthyForm/EditHealthyFile"; export default { name: "PhysicalSignsEdit", components: { - 'healthy-form1': Form1, - 'healthy-form2': Form2, - 'healthy-form3': Form3, - 'healthy-form4': Form4, - 'healthy-form5': Form5, - 'healthy-form6': Form6, - 'healthy-form7': Form7, - 'healthy-form8': Form8, - 'healthy-form9': Form9, - 'edit-file':EditHealthyFile + "healthy-form1": Form1, + "healthy-form2": Form2, + "healthy-form3": Form3, + "healthy-form4": Form4, + "healthy-form5": Form5, + "healthy-form6": Form6, + "healthy-form7": Form7, + "healthy-form8": Form8, + "healthy-form9": Form9, + "edit-file": EditHealthyFile, }, data() { return { - healthyData:healthyData, - showModuleArray:[0], - stepArray: [true,false,false,false,false,false,false,false,false], + healthyData: healthyData, + showModuleArray: [0], + stepArray: [true, false, false, false, false, false, false, false, false], submitShow: true, visible: false, title: "", @@ -95,28 +137,34 @@ export default { message: "体重格式不正确", }, ], - conditioningProjectId:[ - { required: true, trigger: "blur", message: "请选择调理项目" } + conditioningProjectId: [ + { required: true, trigger: "blur", message: "请选择调理项目" }, ], - position:[ - { required: true, trigger: "blur", message: "请选择地理位置" } - ] - } + position: [ + { required: true, trigger: "blur", message: "请选择地理位置" }, + ], + }, }; }, methods: { showDialog(data, customerHealthyData) { this.data = data; - this.title = "修改"+`「${data.name}」`+"健康评估信息"; + this.title = "修改" + `「${data.name}」` + "健康评估信息"; let healthy = Object.assign({}, customerHealthyData); - if(data && customerHealthyData){ - this.healthyData['arrayName'].forEach(function (item, index) { - healthy[item] = healthy[item] ? healthy[item].split(",") : []; + if (data && customerHealthyData) { + this.healthyData["arrayName"].forEach((item) => { + if (item === "bloodData" || item === "moistureDate") { + healthy[item] = healthy[item].map((str) => + str.substring(0, str.indexOf(".")) + ); + } else { + healthy[item] = (healthy[item] || "").split(","); + } }); this.form = healthy; this.visible = true; - }else{ - this.$message.error('健康评估信息获取失败'); + } else { + this.$message.error("健康评估信息获取失败"); } /*getCustomerPhysicalSignsByCusId(data.id).then((res) => { if (res.data.customerHealthy && res.data.type == 0) { @@ -136,53 +184,56 @@ export default { this.data = null; //this.form = null; }, - submit(){ + submit() { this.$refs.form.validate((valid) => { if (valid) { this.editCustomerHealthy(); } else { - this.$message({message: "数据未填写完整", type: "warning"}); + this.$message({ message: "数据未填写完整", type: "warning" }); } }); }, - editCustomerHealthy(){ + editCustomerHealthy() { this.$refs.editFile.addUploadNewFile(); //数据处理 let cusMessage = Object.assign({}, this.form); - this.healthyData['arrayName'].forEach(function (item, index) { - cusMessage[item] = cusMessage[item] != null ? cusMessage[item].join(",") : null; - }); - updateHealthy(cusMessage).then((response) => { - if (response.code === 200) { - this.msgSuccess("修改成功"); - this.onClosed(); - this.$emit('refreshHealthyData'); - } - }).catch(function() { - console.log("error"); + this.healthyData["arrayName"].forEach(function (item, index) { + cusMessage[item] = + cusMessage[item] != null ? cusMessage[item].join(",") : null; }); + updateHealthy(cusMessage) + .then((response) => { + if (response.code === 200) { + this.msgSuccess("修改成功"); + this.onClosed(); + this.$emit("refreshHealthyData"); + } + }) + .catch(function () { + console.log("error"); + }); }, - changeShowModule(){ - let allShow = false; - for(var i = 0; i < this.stepArray.length; i++){ - let flag = this.showModuleArray.find((opt) => opt === i); - let showFlag = flag != null && flag != undefined - this.$set(this.stepArray, i, showFlag); - allShow = showFlag ? showFlag : allShow; - } - this.submitShow = allShow; - } - } + changeShowModule() { + let allShow = false; + for (var i = 0; i < this.stepArray.length; i++) { + let flag = this.showModuleArray.find((opt) => opt === i); + let showFlag = flag != null && flag != undefined; + this.$set(this.stepArray, i, showFlag); + allShow = showFlag ? showFlag : allShow; + } + this.submitShow = allShow; + }, + }, }; </script> <style scoped> - .margin-top-20{ - margin-top:20px; - } - .p_title_1{ - font-size: 18px; - font-weight: bold; - margin-top: 20px; - } +.margin-top-20 { + margin-top: 20px; +} +.p_title_1 { + font-size: 18px; + font-weight: bold; + margin-top: 20px; +} </style>