From b7e9807061998a4b250ceaca7e6320e89cc6767f Mon Sep 17 00:00:00 2001 From: qx <1084500556@qq.com> Date: 星期六, 08 二月 2025 18:09:19 +0800 Subject: [PATCH] qx --- src/views/reservation/reservations/index.vue | 493 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 474 insertions(+), 19 deletions(-) diff --git a/src/views/reservation/reservations/index.vue b/src/views/reservation/reservations/index.vue index e644f5e..8b72ef7 100644 --- a/src/views/reservation/reservations/index.vue +++ b/src/views/reservation/reservations/index.vue @@ -197,6 +197,16 @@ > <!-- v-hasPermi="['reservation:reservation:remove']" --> </el-col> + <el-col :span="1.5"> + <el-button + type="primary" + size="mini" + :disabled="multiple" + @click="Groupsignin" + >鍥綋绛惧埌</el-button + > + <!-- v-hasPermi="['reservation:reservation:remove']" --> + </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" @@ -811,18 +821,114 @@ </el-form> </template> - <div style="text-align: center; margin-bottom: 10px"> + <div + style=" + display: flex; + align-items: center; + justify-content: flex-start; + width: 100%; + " + > + <div + style=" + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + margin-left: 46px; + font-size: 16px; + margin-right: 20px; + " + > + 宸查�夐」鐩潯鏁帮細<span + style="font-weight: 700; color: red; margin-right: 5px" + >{{ this.tableData1.length || 0 }}</span + >鏉� + </div> 宸查�夐」鐩垪琛� </div> <div style=" padding: 0px 6px; border: 1px solid #e6ebf5; + max-height: 650%; + overflow: auto; + width: 916px; + margin-left: 35px; + " + > + <el-table :data="tableData1" border style="width: 100%"> + <el-table-column prop="proName" label="椤圭洰" width="180" align="center"> + </el-table-column> + <el-table-column prop="proType" label="鎬у埆" width="50" align="center"> + <template slot-scope="scope"> + <template v-if="isAll(scope.row.proType)"> + 鍏ㄩ儴 + </template> + <template v-else> + <dict-tag + :options="dict.type.sys_user_sex" + :value="scope.row.proType" + /> + </template> + </template> + </el-table-column> + + <el-table-column prop="ordPrice" label="搴旀敹閲戦" align="center"> + </el-table-column> + <el-table-column label="鎶樻墸" width="160px" align="center"> + <template slot-scope="scope"> + <el-input-number + v-model.number="scope.row.discount" + @input="validateDiscount(scope.row)" + placeholder="杈撳叆鎶樻墸" + size="small" + type="number" + :precision="1" + :step="0.1" + :max="10" + :min="0" + :disabled="true" + > + </el-input-number> + </template> + </el-table-column> + <el-table-column prop="nowPrice" label="瀹炴敹閲戦" align="center"> + </el-table-column> + <el-table-column prop="proCheckMethod" label="鏄惁绌鸿吂" align="center"> + <template slot-scope="scope"> + <dict-tag + :options="dict.type.sys_yes_no" + :value="scope.row.proCheckMethod" + /> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" width="80px"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete1(scope.row)" + title="鍒犻櫎" + > + </el-button> + </template> + </el-table-column> + </el-table> + </div> + + <!-- <div style="text-align: center; margin-bottom: 10px"> + 宸查�夐」鐩垪琛� + </div> --> + <!-- <div + style=" + padding: 0px 6px; + border: 1px solid #e6ebf5; max-height: 420px; overflow: auto; " - > - <el-collapse v-model="index" accordion v-if="list3"> + > --> + <!-- <el-collapse v-model="index" accordion v-if="list3"> <div class="info1" v-for="(item, index) in tableData1" @@ -840,6 +946,16 @@ item.nowPrice + "鍏�)" }} + <div style="font-size: 16px; margin-left: 20px"> + 宸查�夐」鐩潯鏁帮細<span + style=" + font-weight: 700 !important; + color: red; + margin-right: 5px; + " + >{{ item.list.length || 0 }}</span + >鏉� + </div> </template> <el-table :data="item.list" @@ -855,7 +971,39 @@ </el-table-column> <el-table-column prop="ordPrice" label="搴旀敹閲戦"> </el-table-column> + <el-table-column label="鎶樻墸"> + <template slot-scope="scope"> + <el-input-number + v-model.number="scope.row.discount" + @input="validateDiscount(scope.row)" + placeholder="杈撳叆鎶樻墸" + size="small" + type="number" + :precision="1" + :step="0.1" + :max="10" + :min="0" + > + </el-input-number> + </template> + </el-table-column> <el-table-column prop="nowPrice" label="瀹炴敹閲戦"> + </el-table-column> + <el-table-column + label="鎿嶄綔" + align="center" + width="80px" + > + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete1(scope.row)" + title="鍒犻櫎" + > + </el-button> + </template> </el-table-column> </el-table> </el-collapse-item> @@ -926,12 +1074,12 @@ </el-table> </el-collapse-item> </div> - </el-collapse> - </div> + </el-collapse> --> + <!-- </div> --> </div> </el-col> </el-row> - + <el-dialog title="瀵兼鍗曢瑙�" :visible.sync="dialogVisibles" @@ -949,6 +1097,50 @@ </div> </template> </el-drawer> + + + <el-dialog + title="PDF 棰勮" + :visible.sync="dialogVisible" + :close-on-click-modal="false" + > + <div class="main"> + <iframe + id="printIframe" + :src="url" + frameborder="0" + style="width: 100%; height: 100%" + ></iframe> + </div> + </el-dialog> + + <el-dialog + :title="title" + :visible.sync="open2" + width="800px" + append-to-body + > + <el-form ref="form" :model="forms" label-width="100px" :inline="true"> + <el-form-item label="浣撴绫诲埆"> + <el-select + style="width: 150px" + v-model="forms.tjCategory" + placeholder="璇烽�夋嫨浣撴绫诲埆" + > + <el-option + v-for="dict in dict.type.dict_tjtype" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> + </el-select> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer2"> + <el-button type="primary" @click="submitType">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> <div style=" @@ -1361,9 +1553,6 @@ ></el-option> </el-select> </el-form-item> - - <!-- <div class="tab1"> --> - <!-- <el-form :inline="true" class="tab1"> --> <el-form-item label="搴旀敹閲戦"> <el-input placeholder="搴旀敹閲戦" @@ -1373,7 +1562,6 @@ ></el-input> </el-form-item> <el-form-item label="浼樻儬鎶樻墸"> - <!-- <el-input style="width: 100px" type="number" v-model="discount" :value="discount"></el-input> --> <el-input-number ref="inputNumber" style="width: 130px" @@ -1411,7 +1599,79 @@ <div style="text-align: center; margin-bottom: 10px"> 宸查�夐」鐩垪琛� </div> + <div + style=" + padding: 0px 6px; + border: 1px solid #e6ebf5; + max-height: 650%; + overflow: auto; + width: 916px; + margin-left: 35px; + " + > + <el-table :data="tableData1" border style="width: 100%"> + <el-table-column prop="proName" label="椤圭洰" width="180" align="center"> + </el-table-column> + <el-table-column prop="proType" label="鎬у埆" width="50" align="center"> + <template slot-scope="scope"> + <template v-if="isAll(scope.row.proType)"> + 鍏ㄩ儴 + </template> + <template v-else> + <dict-tag + :options="dict.type.sys_user_sex" + :value="scope.row.proType" + /> + </template> + </template> + </el-table-column> + + <el-table-column prop="ordPrice" label="搴旀敹閲戦" align="center"> + </el-table-column> + <el-table-column label="鎶樻墸" width="160px" align="center"> + <template slot-scope="scope"> + <el-input-number + v-model.number="scope.row.discount" + @input="validateDiscount(scope.row)" + placeholder="杈撳叆鎶樻墸" + size="small" + type="number" + :precision="1" + :step="0.1" + :max="10" + :min="0" + :disabled="true" + > + </el-input-number> + </template> + </el-table-column> + <el-table-column prop="nowPrice" label="瀹炴敹閲戦" align="center"> + </el-table-column> + <el-table-column prop="proCheckMethod" label="鏄惁绌鸿吂" align="center"> + <template slot-scope="scope"> + <dict-tag + :options="dict.type.sys_yes_no" + :value="scope.row.proCheckMethod" + /> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" width="80px"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete1(scope.row)" + title="鍒犻櫎" + > + </el-button> + </template> + </el-table-column> + </el-table> + </div> + + <!-- <div style=" padding: 0px 6px; border: 1px solid #e6ebf5; @@ -1419,6 +1679,14 @@ overflow: auto; " > + <div + style=" + padding: 0px 6px; + border: 1px solid #e6ebf5; + max-height: 420px; + overflow: auto; + " + ></div> <el-collapse v-model="index" accordion v-if="list3"> <div class="info1" @@ -1437,7 +1705,18 @@ item.nowPrice + ".00鍏�)" }} + <div style="font-size: 16px; margin-left: 20px"> + 宸查�夐」鐩潯鏁帮細<span + style=" + font-weight: 700 !important; + color: red; + margin-right: 5px; + " + >{{ item.list.length || 0 }}</span + >鏉� + </div> </template> + <el-table :data="item.list" border @@ -1457,6 +1736,22 @@ > </el-table-column> <el-table-column prop="ordPrice" label="搴旀敹閲戦"> + </el-table-column> + <el-table-column label="鎶樻墸"> + <template slot-scope="scope"> + <el-input-number + v-model.number="scope.row.discount" + @input="validateDiscount(scope.row)" + placeholder="杈撳叆鎶樻墸" + size="small" + type="number" + :precision="1" + :step="0.1" + :max="10" + :min="0" + > + </el-input-number> + </template> </el-table-column> <el-table-column prop="nowPrice" label="瀹炴敹閲戦"> </el-table-column> @@ -1532,7 +1827,7 @@ </el-collapse-item> </div> </el-collapse> - </div> + </div> --> </div> </el-col> </el-row> @@ -1558,7 +1853,9 @@ </template> <script> -import { addComp } from "@/api/system/comp"; +import { addComp, + addPlOrderAndDetail } from "@/api/system/comp"; +import Big from "big.js"; import { listReservation, @@ -1575,6 +1872,8 @@ getaddtTransition, getTransitionList, getconfigKey, + delTbBycusCardIdAndProId, + getTransitionList1, } from "@/api/system/tijian"; import { getCompany, queryCompany } from "@/api/team/tuanti"; import user from "@/store/modules/user"; @@ -1599,7 +1898,6 @@ ], data() { let checkPhoneNum = (rule, value, callback) => { - console.log(value); let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/); if (value == "" && value == undefined && !value) { return callback(""); @@ -1621,6 +1919,7 @@ return time.getTime() < Date.now() - 8.64e7; // 涓嶅彲閫夊巻鍙插ぉ銆佷笉鍙�夊綋鍓嶅ぉ銆佸彲閫夋湭鏉ュぉ }, }, + discount: 10, taocan: false, defaultKeys: [], value1: "", @@ -1632,6 +1931,10 @@ dialogVisibles: false, src: "", url: "", + open2: false, + forms: { + tjCategory:null + }, dialogVisible: false, /** 鐓х浉鏈哄脊绐楁ā鍧�-start */ videoWidth: 200, @@ -1689,6 +1992,7 @@ // 鏄惁鏄剧ず寮瑰嚭灞� pacId: "", + cusIds:[], // 缁撴灉 result: "", proIds: [], @@ -1732,7 +2036,29 @@ cusNumber: null, cusIsvip: null, }, - formIn: {}, + formIn: { + name: "", + age: "", + idCard: "", + remark: null, + pacName: "", + cusaddr: null, + idType: null, + ageUnit: null, + sex: null, + phoe: "", + nation: null, + email: "", + marriage: null, + address: "", + tjCategory: null, + company: "", + career: null, + reservationTime: null, + timeRegion: null, + indexCard: "", + department: "", + }, fmobj: {}, // 琛ㄥ崟鏍¢獙 form1: {}, @@ -1857,6 +2183,65 @@ this.getList(); }, methods: { + isAll(value) { + return value === "" || value === null; + }, + validateDiscount(row) { + if (row.discount == null || isNaN(row.discount)) { + row.discount = 10; + } + if (row.discount > 10) { + row.discount = 10; // 寮哄埗灏嗗�艰缃负鏈�澶у�� + } else if (row.discount < 0) { + row.discount = 0; // 寮哄埗灏嗗�艰缃负鏈�灏忓�� + } + this.updateProPrice(row); // 鏇存柊浠锋牸鎴栧叾浠栭�昏緫 + }, + updateProPrice(row) { + const ordPrice = new Big(row.ordPrice || 0); + const discount = new Big(row.discount || 0); + const result = ordPrice.times(discount.div(10)); // ordPrice * (discount / 10) + row.nowPrice = result.toNumber(); + this.TotalPrice = this.tableData1.reduce((sum, item) => { + return sum.plus(new Big(item.nowPrice || "0")); + }, new Big(0)); + + this.discount = + (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10; + }, + + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete1(row) { + // console.log(row); + let data = { + cusCardId: row.cusId, + proId: row.parentProId, + }; + this.$modal + .confirm("鏄惁纭鍒犻櫎锛�") + .then(() => { + return delTbBycusCardIdAndProId(data); + }) + .then(() => { + this.TotalPrice1 = 0; + getTransitionList1(row.cusId).then((response) => { + this.tableData1 = response.data; + + this.tableData1.forEach((item) => { + this.TotalPrice1 += item.ordPrice; + this.TotalPrice += item.nowPrice; + }); + this.TotalPrice = this.tableData1.reduce((sum, item) => { + return sum.plus(new Big(item.nowPrice || "0")); + }, new Big(0)); + this.discount = + (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * + 10; + }); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }) + .catch(() => {}); + }, getCompanyList() { this.loading = true; getconfigKey("team_reservation_default_day").then((res) => { @@ -1928,6 +2313,7 @@ // 鍙栨秷鎸夐挳 cancel() { this.open = false; + this.open2 = false; this.reset(); }, @@ -1991,10 +2377,10 @@ }, // 澶氶�夋閫変腑鏁版嵁 handleSelectionChange(selection) { + this.cusIds = selection.map((item) => item.idCard); selection.forEach((item) => { this.fmobj = item; }); - console.log(this.fmobj); this.ids = selection.map((item) => item.id); this.single = selection.length !== 1; this.multiple = !selection.length; @@ -2009,7 +2395,6 @@ /** 淇敼鎸夐挳鎿嶄綔 */ handleUpdate(row) { - console.log(row); this.title = "淇敼浣撴棰勭害"; this.formIn = row; this.form.tjType = this.formIn.tjType; @@ -2073,14 +2458,13 @@ getReservation(id).then((response) => { if (response.data) { let cusId = response.data.idCard; - getTransitionList(cusId).then((response) => { + getTransitionList1(cusId).then((response) => { if (response.data) { this.tableData1 = response.data; if (this.tableData1.length != 0) { this.TotalPrice1 = 0; this.tableData1.forEach((item) => { this.TotalPrice1 += item.nowPrice; - console.log(this.discount); this.TotalPrice = ( this.TotalPrice1 * (this.discount / 10) @@ -2184,9 +2568,10 @@ getReservation(id).then((response) => { if (response.data) { let cusId = response.data.idCard; - getTransitionList(cusId).then((response) => { + getTransitionList1(cusId).then((response) => { if (response.data) { this.tableData1 = response.data; + if (this.tableData1.length != 0) { this.TotalPrice1 = 0; this.tableData1.forEach((item) => { @@ -2289,6 +2674,74 @@ this.treedataList = JSON.parse(JSON.stringify(this.dXData)); return; } + }, + + Groupsignin() { + this.open2 = true; + }, + + + submitType() { + // let cusIds = []; + // this.selectList.forEach((item) => { + // cusIds.push(item.idCard); + // }); + let data = { + cusIds: this.cusIds, + tjCategory: this.forms.tjCategory, + }; + addPlOrderAndDetail(data).then((res) => { + this.open2 = false; + this.$modal.msgSuccess("绛惧埌鎴愬姛"); + if (res.file) { + + let base64 = res.file; + this.base64ToBlob({ + b64data: base64, + contentType: "application/pdf", + }).then((res) => { + this.dialogVisible = true; + // 杞悗鍚庣殑blob瀵硅薄 + try { + this.url = res.preview; + } catch (error) { + this.url = window.webkitURL.createObjectURL(res.preview); + } + }); + } + }); + }, + + + base64ToBlob({ b64data = "", contentType = "", sliceSize = 512 } = {}) { + return new Promise((resolve, reject) => { + // 浣跨敤 atob() 鏂规硶灏嗘暟鎹В鐮� + let byteCharacters = atob(b64data); + let byteArrays = []; + for ( + let offset = 0; + offset < byteCharacters.length; + offset += sliceSize + ) { + let slice = byteCharacters.slice(offset, offset + sliceSize); + let byteNumbers = []; + for (let i = 0; i < slice.length; i++) { + byteNumbers.push(slice.charCodeAt(i)); + } + // 8 浣嶆棤绗﹀彿鏁存暟鍊肩殑绫诲瀷鍖栨暟缁勩�傚唴瀹瑰皢鍒濆鍖栦负 0銆� + // 濡傛灉鏃犳硶鍒嗛厤璇锋眰鏁扮洰鐨勫瓧鑺傦紝鍒欏皢寮曞彂寮傚父銆� + byteArrays.push(new Uint8Array(byteNumbers)); + } + let result = new Blob(byteArrays, { + type: contentType, + }); + result = Object.assign(result, { + // jartto: 杩欓噷涓�瀹氳澶勭悊涓�涓� URL.createObjectURL + preview: URL.createObjectURL(result), + // name: `鍥剧墖绀轰緥.png`, + }); + resolve(result); + }); }, // 鐐瑰嚮鑾峰彇姣忎釜鏍戣妭鐐� @@ -2686,6 +3139,8 @@ overflow: hidden; } + + #printIframe::-webkit-scrollbar { width: 6px; } -- Gitblit v1.8.0