| | |
| | | style="width: 150px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="原价" prop="counterPrice"> |
| | | <el-form-item label="原价" prop="pics"> |
| | | <el-input |
| | | v-model="form.counterPrice" |
| | | v-model="pics" |
| | | placeholder="请输入原价" |
| | | style="width: 150px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="折扣"> |
| | | <el-input-number |
| | | ref="inputNumber" |
| | | style="width: 150px" |
| | | v-model="youhui" |
| | | :precision="2" |
| | | :step="0.1" |
| | | :max="10" |
| | | :min="1" |
| | | @change="numberChange" |
| | | ></el-input-number> |
| | | </el-form-item> |
| | | <el-form-item label="优惠价"> |
| | | <el-input |
| | | ref="inputName" |
| | | v-model="form.xianprice" |
| | | placeholder="优惠价" |
| | | clearable |
| | | style="width: 140px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="体检类别" prop="tjCategory"> |
| | |
| | | </el-tree> |
| | | </div> |
| | | </el-col> |
| | | <!-- <el-col :span="6"> |
| | | <!-- <el-col :span="6"> |
| | | <div |
| | | style="text-align: center; margin-bottom: 10px; margin-top: 10px" |
| | | > |
| | |
| | | <el-col :span="11"> |
| | | <div class="grid-content bg-purple"> |
| | | <div |
| | | style="text-align: center; margin-bottom: 10px; margin-top: 10px; margin-left: 16%;" |
| | | style=" |
| | | text-align: center; |
| | | margin-bottom: 10px; |
| | | margin-top: 10px; |
| | | margin-left: 16%; |
| | | " |
| | | > |
| | | 已选项目列表 |
| | | </div> |
| | | <el-table |
| | | :data="DataList" |
| | | border |
| | | style="width: 80%; margin-left: 18%;" |
| | | style="width: 80%; margin-left: 18%" |
| | | height="400" |
| | | :span-method="objectSpanMethod" |
| | | > |
| | | <el-table-column prop="propinName" label="检查项目" > |
| | | <el-table-column prop="proName" label="检查项目"> |
| | | </el-table-column> |
| | | <el-table-column prop="proPrice" label="原价" align="center" > |
| | | |
| | | <el-table-column prop="proPrice" label="原价" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="折扣"> |
| | | <template slot-scope="scope"> |
| | | <!-- 只输入纯数字折扣 --> |
| | | <el-input |
| | | v-model.number="scope.row.limits" |
| | | @input="calculateDiscount(scope.row)" |
| | | placeholder="输入折扣" |
| | | size="small" |
| | | type="number" |
| | | min="0" |
| | | step="0.1" |
| | | max="10" |
| | | > |
| | | </el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="priceNow" label="优惠价" align="center"> |
| | | </el-table-column> |
| | | <!-- <el-table-column prop="proName" label="明细项目" width="260px"> |
| | | </el-table-column> --> |
| | |
| | | </template> |
| | | </el-table-column>--> |
| | | </el-table> |
| | | <h3 style="font-weight: 600">合计:{{ pics }}元</h3> |
| | | <!-- <h3 style="font-weight: 600">合计:{{ pics }}元</h3> --> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | getAllList, |
| | | updateProject, |
| | | getPacTjProjectList, |
| | | saveOreditTjPacNew, |
| | | } from "@/api/system/package"; |
| | | import { Message } from "element-ui"; |
| | | import Big from "big.js"; |
| | | export default { |
| | | name: "Package", |
| | | dicts: ["sys_normal_disable", "sys_yes_no", "dict_tjtype"], |
| | |
| | | DataList: [], |
| | | list1: true, |
| | | activeName: "1", |
| | | num: 1, |
| | | checkedObj: {}, |
| | | dataObj: {}, |
| | | Treedata: [], |
| | |
| | | pacRemark: null, |
| | | }, |
| | | // 表单参数 |
| | | form: {}, |
| | | form: { |
| | | xianprice: null, // 优惠价 |
| | | counterPrice: null, //原价 |
| | | limits: 10, |
| | | }, |
| | | forms: {}, |
| | | youhui: 10, |
| | | // 表单校验 |
| | | rules: { |
| | | deleted: [ |
| | |
| | | this.$refs.tree.filter(val); |
| | | }, |
| | | }, |
| | | |
| | | created() { |
| | | this.getList(); |
| | | this.getKeyword(); |
| | |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | | // return data.proName.indexOf(value) !== -1; |
| | | if(data.proName.indexOf(value) !== -1){ |
| | | if (data.proName.indexOf(value) !== -1) { |
| | | return data.proName.indexOf(value) !== -1; |
| | | }else{ |
| | | } else { |
| | | return data.proEngName.indexOf(value) !== -1; |
| | | } |
| | | }, |
| | |
| | | |
| | | return this.form.tjProjectList; |
| | | }, |
| | | // // 默认接受四个值 { 当前行的值, 当前列的值, 行的下标, 列的下标 } |
| | | |
| | | numberChange(currentValue, oldValue) { |
| | | this.$confirm("确定修改所有子项的折扣吗?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | this.youhui = currentValue; |
| | | /* if (this.youhui < 10) { |
| | | this.youhui = 10; |
| | | // this.$modal.msgError(`该人员最高优惠权限为${this.getInfodis}折`); |
| | | } */ |
| | | this.DataList.forEach((item) => { |
| | | item.limits = this.youhui; |
| | | const proPrice = new Big(item.proPrice); |
| | | const limits = new Big(item.limits); |
| | | const result = proPrice.times(limits.div(10)); |
| | | item.priceNow = result.toNumber(); |
| | | this.form.xianprice = this.DataList.reduce((sum, item) => { |
| | | return sum.plus(new Big(item.priceNow || "0")); |
| | | }, new Big(0)); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | this.youhui = oldValue; |
| | | }); |
| | | }, |
| | | |
| | | updateProPrice(row) { |
| | | const proPrice = new Big(row.proPrice); |
| | | const limits = new Big(row.limits); |
| | | const result = proPrice.times(limits.div(10)); // ordPrice * (discount / 10) |
| | | row.priceNow = result.toNumber(); |
| | | this.form.xianprice = this.DataList.reduce((sum, item) => { |
| | | return sum.plus(new Big(item.priceNow || "0")); |
| | | }, new Big(0)).toNumber(); |
| | | this.youhui = |
| | | (Math.floor((this.form.xianprice / this.pics) * 100) / 100) * 10; |
| | | }, |
| | | calculateDiscount(row) { |
| | | if (row.limits > 10) { |
| | | row.limits = 10; // 强制将值设置为最大值 |
| | | } else if (row.limits < 0) { |
| | | row.limits = 0; // 强制将值设置为最小值 |
| | | } |
| | | this.updateProPrice(row); // 更新价格或其他逻辑 |
| | | }, |
| | | // 默认接受四个值 { 当前行的值, 当前列的值, 行的下标, 列的下标 } |
| | | objectSpanMethod({ row, column, rowIndex, columnIndex }) { |
| | | let fields = ["propinName"]; |
| | | let cellValue = row[column.property]; |
| | |
| | | this.Treedata.forEach((item1) => { |
| | | if (item.proId == item1.proId) { |
| | | this.checkedkey.push(item1.proId); |
| | | let proId = item1.proId; |
| | | |
| | | this.DataList.push(item1); |
| | | this.DataList.forEach((item1) => { |
| | | item1.limits = 10; |
| | | if (item1.limits > 10) { |
| | | item1.limits = 10; // 强制将值设置为最大值 |
| | | } else if (item1.limits < 0) { |
| | | item1.limits = 0; // 强制将值设置为最小值 |
| | | } |
| | | this.updateProPrice(item1); // 更新价格或其他逻辑 |
| | | }); |
| | | |
| | | /* let proId = item1.proId; |
| | | getProSonDxList(proId).then((res) => { |
| | | this.TreedataList = res.data.list; |
| | | this.TreedataList.forEach((item2) => { |
| | |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | }); */ |
| | | } |
| | | }); |
| | | }); |
| | | } else { |
| | | this.checkedkey.push(this.Treedata[0].proId); |
| | | let proId = this.Treedata[0].proId; |
| | | getProSonDxList(proId).then((res) => { |
| | | this.TreedataList = this.Treedata.filter( |
| | | (item) => item.proId == proId |
| | | ); |
| | | |
| | | // 将第一个项目添加到 DataList |
| | | this.TreedataList.forEach((item) => { |
| | | this.checkedListkey.push(item.proId); |
| | | this.DataList.push(item); |
| | | }); |
| | | /* getProSonDxList(proId).then((res) => { |
| | | this.TreedataList = res.data.list; |
| | | this.TreedataList.forEach((item) => { |
| | | item.disabled = true; |
| | |
| | | this.pics += item.proPrice; |
| | | }); |
| | | }); |
| | | }); |
| | | }); */ |
| | | } |
| | | this.pics = this.DataList.reduce( |
| | | (total, item) => total + item.proPrice, |
| | | 0 |
| | | ); |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | |
| | | handleCurrentChecked(data, checked, checkedNodes) { |
| | | this.dataObj = data; |
| | | this.checkedObj = checked; |
| | | |
| | | if (checked == true) { |
| | | // 将选中的项目添加到 DataList |
| | | this.checkedListkey.push(data.proId); |
| | | this.DataList.push({ |
| | | proId: data.proId, |
| | | proName: data.proName, |
| | | proPrice: data.proPrice, // 原价 |
| | | limits: 10, // 默认折扣(100%) |
| | | priceNow: data.proPrice, // 默认优惠价与原价相同 |
| | | }); |
| | | |
| | | // 重新计算总价 |
| | | this.pics = 0; |
| | | this.TotalPrice1 = 0; |
| | | this.DataList.forEach((item) => { |
| | | this.pics += item.proPrice; |
| | | this.form.counterPrice += item.proPrice; |
| | | this.TotalPrice1 += item.proPrice; // 可以根据需要改成优惠价 `priceNow` |
| | | }); |
| | | } else if (checked == false) { |
| | | // 从 DataList 中移除取消选中的项目 |
| | | let index = this.DataList.findIndex( |
| | | (item) => item.proId === data.proId |
| | | ); |
| | | if (index !== -1) { |
| | | this.DataList.splice(index, 1); |
| | | } |
| | | |
| | | // 重新计算总价 |
| | | this.pics = 0; |
| | | this.TotalPrice1 = 0; |
| | | this.DataList.forEach((item) => { |
| | | this.pics += item.proPrice; |
| | | this.form.counterPrice += item.proPrice; |
| | | this.TotalPrice1 += item.proPrice; // 可以根据需要改成优惠价 `priceNow` |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | /* handleCurrentChecked(data, checked, checkedNodes) { |
| | | this.dataObj = data; |
| | | this.checkedObj = checked; |
| | | if (checked == true) { |
| | |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | }, */ |
| | | |
| | | spliceData() { |
| | | for (var i = 0; i < this.DataList.length; i++) { |
| | |
| | | |
| | | /** 提交按钮 */ |
| | | submitForm() { |
| | | console.log(this.form, 999); |
| | | this.form.limits = this.youhui; |
| | | this.form.price = this.pics; |
| | | this.form.priceNow = this.queryParams.xianprice; |
| | | |
| | | if (this.keys) { |
| | | this.form.keywords = this.keys; // 如果有 this.keys,则直接赋值 |
| | | } else { |
| | | this.form.keywords = this.form.keywords.toString(); // 如果没有,则将 this.form.keywords 转成字符串 |
| | | } |
| | | |
| | | let packageProjects = []; // 定义一个空数组 |
| | | |
| | | this.DataList.forEach((item) => { |
| | | packageProjects.push({ |
| | | proName: item.proName, |
| | | proId: item.proId, |
| | | priceNow: item.priceNow, |
| | | limits: item.limits, |
| | | priceOrd: item.proPrice, |
| | | }); |
| | | }); |
| | | let data = { |
| | | pacName: this.form.pacName, |
| | | limits: this.form.limits, |
| | | pacStatus: this.form.pacStatus, |
| | | packageProjects: packageProjects, |
| | | newPrice: this.form.xianprice, |
| | | price: this.pics, |
| | | pacId: this.form.pacId || null, |
| | | isOnSale: this.form.isOnSale, |
| | | keywords: this.form.keywords, |
| | | sort: this.form.sort, |
| | | retailPrice: this.form.retailPrice, |
| | | tjCategory: this.form.tjCategory, |
| | | pacRemark: this.form.pacRemark, |
| | | detail: this.form.detail, |
| | | }; |
| | | |
| | | saveOreditTjPacNew(data).then((res) => { |
| | | console.log(res, 555); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | }, |
| | | /* submitForm() { |
| | | if (this.form.pacName) { |
| | | this.form.tjProjectList = []; |
| | | if (this.DataList.length != 0) { |
| | |
| | | } else { |
| | | Message.warning("请先填写套餐名称"); |
| | | } |
| | | }, |
| | | }, */ |
| | | /** 删除按钮操作 */ |
| | | handleDelete(row) { |
| | | const pacIds = row.pacId || this.ids; |