| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-dialog title="选择套餐" :visible.sync="taocan" width="70%" height="700px" :close-on-click-modal="false"> |
| | | <!-- <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" label-width="auto"> |
| | | <el-form-item label="套餐名称" prop="pacName"> |
| | | <el-input |
| | | v-model="queryParam.pacName" |
| | | placeholder="请输入套餐名称" |
| | | clearable |
| | | @keyup.enter.native="handle" |
| | | style="width: 200px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-search" |
| | | size="mini" |
| | | @click="handle" |
| | | >搜索</el-button> |
| | | </el-form-item> |
| | | </el-form> --> |
| | | <el-table |
| | | v-loading="loading" |
| | | element-loading-text="正在加载中..." |
| | | element-loading-spinner="el-icon-loading" |
| | | border |
| | | :data="newpacName1" |
| | | @selection-change="handleSelectionChange1" |
| | | height="450px" |
| | | ref="tb" |
| | | > |
| | | <el-table-column type="selection" width="40px" align="center" label="选择" /> |
| | | <el-table-column label="套餐名称" align="center" prop="pacName" width="120px" /> |
| | | <el-table-column label="套餐价格" align="center" prop="price" width="120px" /> |
| | | <el-table-column label="套餐明细" align="center" prop="allProName" :show-overflow-tooltip="true" /> |
| | | </el-table> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="cancel1">取 消</el-button> |
| | | <el-button type="primary" @click="submit">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <!-- <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" label-width="auto"> |
| | | <el-form-item label="套餐名称" prop="pacName"> |
| | | <el-input v-model="queryParam.pacName" placeholder="请输入套餐名称" clearable @keyup.enter.native="handle" |
| | | style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handle">搜索</el-button> |
| | | </el-form-item> |
| | | </el-form> --> |
| | | <el-table v-loading="loading" element-loading-text="正在加载中..." element-loading-spinner="el-icon-loading" border |
| | | :data="newpacName1" @selection-change="handleSelectionChange1" height="450px" ref="tb"> |
| | | <el-table-column type="selection" width="40px" align="center" label="选择" /> |
| | | <el-table-column label="套餐名称" align="center" prop="pacName" width="120px" /> |
| | | <el-table-column label="套餐价格" align="center" prop="price" width="120px" /> |
| | | <el-table-column label="套餐明细" align="center" prop="allProName" :show-overflow-tooltip="true" /> |
| | | </el-table> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="cancel1">取 消</el-button> |
| | | <el-button type="primary" @click="submit">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" |
| | | @submit.native.prevent> |
| | | <el-form-item label="单位名称" prop="cnName"> |
| | |
| | | </el-table> |
| | | <div style="font-size: 16px;margin-top: 10px;">当前项目条数:<span style="font-weight: 700;">{{ |
| | | OnenewpacName.length |
| | | }}</span>条</div> |
| | | }}</span>条</div> |
| | | |
| | | </el-col> |
| | | <el-col :span="2" :xs="24"> |
| | |
| | | </el-table> |
| | | <div style="font-size: 16px;margin-top: 10px;">当前项目条数:<span style="font-weight: 700;">{{ |
| | | OnenewpacName.length |
| | | }}</span>条</div> |
| | | }}</span>条</div> |
| | | |
| | | </el-col> |
| | | <el-col :span="2" :xs="24"> |
| | |
| | | </el-table> |
| | | <div style="font-size: 16px;margin-top: 10px;">当前项目条数:<span style="font-weight: 700;">{{ |
| | | OnenewpacName.length |
| | | }}</span>条</div> |
| | | }}</span>条</div> |
| | | |
| | | </el-col> |
| | | <el-col :span="2" :xs="24"> |
| | |
| | | getDetails, |
| | | |
| | | } from "@/api/system/comp"; |
| | | import { deptTreeSelect, projectGetList, getconfigKey,} from "@/api/system/tijian"; |
| | | import { deptTreeSelect, projectGetList, getconfigKey, } from "@/api/system/tijian"; |
| | | import { getInfo } from "@/api/login"; |
| | | export default { |
| | | name: "Comp", |
| | |
| | | } |
| | | }; |
| | | return { |
| | | |
| | | |
| | | newpacName1: [], |
| | | taocan: false, |
| | | queryParam: { |
| | |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | handle() { |
| | | this.loading = true; |
| | | deptTreeSelect(this.forms.sex, this.queryParam).then((res) => { |
| | | if (res.rows) { |
| | | this.newpacName1 = res.rows; // 更新套餐列表 |
| | | } else { |
| | | this.newpacName1 = []; |
| | | } |
| | | this.loading = false; |
| | | }).catch(() => { |
| | | this.loading = false; |
| | | this.$modal.msgError("搜索失败,请稍后重试"); |
| | | }); |
| | | }, |
| | | |
| | | |
| | | handleSelectionChange1(selection) { |
| | | // 实现单选逻辑 |
| | | if (selection.length > 1) { |
| | | const lastSelected = selection[selection.length - 1]; |
| | | this.$refs.tb.clearSelection(); |
| | | this.$refs.tb.toggleRowSelection(lastSelected, true); |
| | | this.selectedPackage = lastSelected; |
| | | } else if (selection.length === 1) { |
| | | this.selectedPackage = selection[0]; |
| | | } else { |
| | | this.selectedPackage = null; |
| | | } |
| | | }, |
| | | // 实现单选逻辑 |
| | | if (selection.length > 1) { |
| | | const lastSelected = selection[selection.length - 1]; |
| | | this.$refs.tb.clearSelection(); |
| | | this.$refs.tb.toggleRowSelection(lastSelected, true); |
| | | this.selectedPackage = lastSelected; |
| | | } else if (selection.length === 1) { |
| | | this.selectedPackage = selection[0]; |
| | | } else { |
| | | this.selectedPackage = null; |
| | | } |
| | | }, |
| | | |
| | | submit() { |
| | | if (!this.selectedPackage) { |
| | | this.$modal.msgError("请先选择一个套餐"); |
| | | return; |
| | | } |
| | | submit() { |
| | | if (!this.selectedPackage) { |
| | | this.$modal.msgError("请先选择一个套餐"); |
| | | return; |
| | | } |
| | | |
| | | // 清空左侧表格 |
| | | this.OnenewpacName = []; |
| | | // 清空左侧表格 |
| | | this.OnenewpacName = []; |
| | | |
| | | // 获取选中的套餐项目列表 |
| | | const newProjects = this.selectedPackage.tjProjectList || []; |
| | | // 获取选中的套餐项目列表 |
| | | const newProjects = this.selectedPackage.tjProjectList || []; |
| | | |
| | | // 将选中的套餐项目添加到左侧表格 |
| | | this.loading = true; |
| | | newProjects.forEach(project => { |
| | | // 为每个项目设置默认折扣和现价 |
| | | this.$set(project, 'limits', 10); // 默认折扣 10(即原价) |
| | | this.$set(project, 'ysPrice', project.proPrice); // 现价初始化为原价 |
| | | this.OnenewpacName.push(project); |
| | | }); |
| | | // 将选中的套餐项目添加到左侧表格 |
| | | this.loading = true; |
| | | newProjects.forEach(project => { |
| | | // 为每个项目设置默认折扣和现价 |
| | | this.$set(project, 'limits', 10); // 默认折扣 10(即原价) |
| | | this.$set(project, 'ysPrice', project.proPrice); // 现价初始化为原价 |
| | | this.OnenewpacName.push(project); |
| | | }); |
| | | |
| | | // 更新总价和现价 |
| | | this.queryParams.price = this.OnenewpacName.reduce((sum, item) => { |
| | | return sum + (item.proPrice || 0); |
| | | }, 0); |
| | | // 更新总价和现价 |
| | | this.queryParams.price = this.OnenewpacName.reduce((sum, item) => { |
| | | return sum + (item.proPrice || 0); |
| | | }, 0); |
| | | |
| | | this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => { |
| | | return sum + (item.ysPrice || 0); |
| | | }, 0); |
| | | this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => { |
| | | return sum + (item.ysPrice || 0); |
| | | }, 0); |
| | | |
| | | // 更新优惠值 |
| | | this.youhui = this.queryParams.price > 0 |
| | | ? (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10 |
| | | : 0; |
| | | // 更新优惠值 |
| | | this.youhui = this.queryParams.price > 0 |
| | | ? (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10 |
| | | : 0; |
| | | |
| | | // 关闭对话框 |
| | | this.taocan = false; |
| | | this.loading = false; |
| | | this.$modal.msgSuccess("添加成功"); |
| | | }, |
| | | // 关闭对话框 |
| | | this.taocan = false; |
| | | this.loading = false; |
| | | this.$modal.msgSuccess("添加成功"); |
| | | }, |
| | | cancel1() { |
| | | this.taocan = false; |
| | | }, |