From d0457278c4f79f6acf8b0b39cee47ab56e9fd038 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期二, 17 六月 2025 08:39:36 +0800 Subject: [PATCH] 1 --- src/views/reservation/reservations/index.vue | 520 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 428 insertions(+), 92 deletions(-) diff --git a/src/views/reservation/reservations/index.vue b/src/views/reservation/reservations/index.vue index 7a21217..c887aac 100644 --- a/src/views/reservation/reservations/index.vue +++ b/src/views/reservation/reservations/index.vue @@ -99,81 +99,105 @@ v-show="showSearch" label-width="68px" > - <el-form-item label="濮撳悕" prop="name"> - <el-input - style="width: 120px" - v-model="queryParams.name" - placeholder="璇疯緭鍏ュ鍚�" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="韬唤璇佸彿" prop="idCard"> - <el-input - v-model="queryParams.idCard" - placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鑱旂郴鐢佃瘽" prop="phoe"> - <el-input - v-model="queryParams.phoe" - placeholder="璇疯緭鍏ヨ仈绯荤數璇�" - clearable - @keyup.enter.native="handleQuery" - style="width: 140px" - /> - </el-form-item> - <el-form-item label="鍗曚綅鍚嶇О" prop="company"> - <el-select - :remote-method="getRemoteData" - v-model="queryParams.company" - remote - default-first-option - allow-create - filterable - style="width: 200px" - placeholder="璇烽�夋嫨鍗曚綅鍚嶇О" - clearable - @change="idFn1" - > - <el-option - v-for="dict in CompanyList" - :key="dict.cnName" - :label="dict.cnName" - :value="dict.drugManufacturerId" - /> - </el-select> - <i class="el-icon-circle-plus-outline" @click="handleAdd1"></i> - </el-form-item> - <el-form-item label="棰勭害瓒呮湡" prop="isExpire"> - <el-select - v-model="queryParams.isExpire" - placeholder="璇烽�夋嫨鏄惁瓒呮湡" - clearable - style="width: 140px" - > - <el-option - v-for="dict in options" - :key="dict.value" - :label="dict.label" - :value="dict.value" - /> - </el-select> - </el-form-item> - <el-form-item> - <el-button - type="primary" - icon="el-icon-search" - size="mini" - @click="handleQuery" - >鎼滅储</el-button - > - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" - >閲嶇疆</el-button - > - </el-form-item> + <el-row> + <el-col> + <el-form-item label="濮撳悕" prop="name"> + <el-input + style="width: 120px" + v-model="queryParams.name" + placeholder="璇疯緭鍏ュ鍚�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="韬唤璇佸彿" prop="idCard"> + <el-input + v-model="queryParams.idCard" + placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + + <el-form-item label="鍗曚綅鍚嶇О" prop="company"> + <el-select + :remote-method="getRemoteData" + v-model="queryParams.company" + remote + default-first-option + allow-create + filterable + style="width: 200px" + placeholder="璇烽�夋嫨鍗曚綅鍚嶇О" + clearable + @change="idFn1" + > + <el-option + v-for="dict in CompanyList" + :key="dict.cnName" + :label="dict.cnName" + :value="dict.drugManufacturerId" + /> + </el-select> + <i class="el-icon-circle-plus-outline" @click="handleAdd1"></i> + </el-form-item> + + <el-form-item label="棰勭害鏃堕棿"> + <el-date-picker + clearable + v-model="createTimeList" + @change="dateChangebirthday2" + type="daterange" + range-separator="-" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + :picker-options="pickerOptions" + value-format="yyyy-MM-dd" + placeholder="璇烽�夋嫨鍑洪绾︽椂闂�" + style="width: 300px" + > + </el-date-picker> + </el-form-item> + </el-col> + <el-col> + <el-form-item label="鑱旂郴鐢佃瘽" prop="phoe"> + <el-input + v-model="queryParams.phoe" + placeholder="璇疯緭鍏ヨ仈绯荤數璇�" + clearable + @keyup.enter.native="handleQuery" + style="width: 140px" + /> + </el-form-item> + <el-form-item label="棰勭害瓒呮湡" prop="isExpire"> + <el-select + v-model="queryParams.isExpire" + placeholder="璇烽�夋嫨鏄惁瓒呮湡" + clearable + style="width: 140px" + > + <el-option + v-for="dict in options" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button + type="primary" + icon="el-icon-search" + size="mini" + @click="handleQuery" + >鎼滅储</el-button + > + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" + >閲嶇疆</el-button + > + </el-form-item> + </el-col> + </el-row> </el-form> <el-row :gutter="10" style="margin: 10px 15px"> <el-col :span="1.5"> @@ -194,6 +218,16 @@ :disabled="single" @click="receipt" >琛ユ墦灏忕エ</el-button + > + <!-- 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> @@ -847,9 +881,19 @@ " > <el-table :data="tableData1" border style="width: 100%"> - <el-table-column prop="proName" label="椤圭洰" width="180" align="center"> + <el-table-column + prop="proName" + label="椤圭洰" + width="180" + align="center" + > </el-table-column> - <el-table-column prop="proType" label="鎬у埆" width="50" align="center"> + <el-table-column + prop="proType" + label="鎬у埆" + width="50" + align="center" + > <template slot-scope="scope"> <template v-if="isAll(scope.row.proType)"> 鍏ㄩ儴 @@ -863,7 +907,11 @@ </template> </el-table-column> - <el-table-column prop="ordPrice" label="搴旀敹閲戦" align="center"> + <el-table-column + prop="ordPrice" + label="搴旀敹閲戦" + align="center" + > </el-table-column> <el-table-column label="鎶樻墸" width="160px" align="center"> <template slot-scope="scope"> @@ -877,14 +925,22 @@ :step="0.1" :max="10" :min="0" - :disabled="true" + :disabled="true" > </el-input-number> </template> </el-table-column> - <el-table-column prop="nowPrice" label="瀹炴敹閲戦" align="center"> + <el-table-column + prop="nowPrice" + label="瀹炴敹閲戦" + align="center" + > </el-table-column> - <el-table-column prop="proCheckMethod" label="鏄惁绌鸿吂" align="center"> + <el-table-column + prop="proCheckMethod" + label="鏄惁绌鸿吂" + align="center" + > <template slot-scope="scope"> <dict-tag :options="dict.type.sys_yes_no" @@ -1087,6 +1143,49 @@ </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=" @@ -1557,9 +1656,19 @@ " > <el-table :data="tableData1" border style="width: 100%"> - <el-table-column prop="proName" label="椤圭洰" width="180" align="center"> + <el-table-column + prop="proName" + label="椤圭洰" + width="180" + align="center" + > </el-table-column> - <el-table-column prop="proType" label="鎬у埆" width="50" align="center"> + <el-table-column + prop="proType" + label="鎬у埆" + width="50" + align="center" + > <template slot-scope="scope"> <template v-if="isAll(scope.row.proType)"> 鍏ㄩ儴 @@ -1573,7 +1682,11 @@ </template> </el-table-column> - <el-table-column prop="ordPrice" label="搴旀敹閲戦" align="center"> + <el-table-column + prop="ordPrice" + label="搴旀敹閲戦" + align="center" + > </el-table-column> <el-table-column label="鎶樻墸" width="160px" align="center"> <template slot-scope="scope"> @@ -1587,14 +1700,22 @@ :step="0.1" :max="10" :min="0" - :disabled="true" + :disabled="true" > </el-input-number> </template> </el-table-column> - <el-table-column prop="nowPrice" label="瀹炴敹閲戦" align="center"> + <el-table-column + prop="nowPrice" + label="瀹炴敹閲戦" + align="center" + > </el-table-column> - <el-table-column prop="proCheckMethod" label="鏄惁绌鸿吂" align="center"> + <el-table-column + prop="proCheckMethod" + label="鏄惁绌鸿吂" + align="center" + > <template slot-scope="scope"> <dict-tag :options="dict.type.sys_yes_no" @@ -1799,8 +1920,9 @@ </template> <script> -import { addComp } from "@/api/system/comp"; +import { addComp, addPlOrderAndDetail } from "@/api/system/comp"; import Big from "big.js"; +import { Loading } from "element-ui"; import { listReservation, gettjCancel, @@ -1842,7 +1964,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(""); @@ -1866,6 +1987,7 @@ }, discount: 10, taocan: false, + webSocket: null, defaultKeys: [], value1: "", pacName: "", @@ -1876,6 +1998,10 @@ dialogVisibles: false, src: "", url: "", + open2: false, + forms: { + tjCategory: "12", + }, dialogVisible: false, /** 鐓х浉鏈哄脊绐楁ā鍧�-start */ videoWidth: 200, @@ -1933,8 +2059,11 @@ // 鏄惁鏄剧ず寮瑰嚭灞� pacId: "", + cusIds: [], // 缁撴灉 result: "", + createTimeList: "", + startTime: "", proIds: [], // 鏄剧ず鎼滅储鏉′欢 showSearch: true, @@ -1966,6 +2095,8 @@ cusBrithday: null, cusAddr: null, cusPhone: null, + yykssj: "", // 棰勭害寮�濮嬫椂闂� + yyjssj: "", // 棰勭害缁撴潫鏃堕棿 cusPostcode: null, cusEmail: null, indexCard: null, @@ -2067,6 +2198,7 @@ reservationList: [], // 寮瑰嚭灞傛爣棰� title: "", + valueUrls: "ws://127.0.0.1:6789/websocket", drawer: false, drawer1: false, // 鏌ヨ鍙傛暟 @@ -2076,6 +2208,7 @@ orderByColumn: "reservationTime", isAsc: "desc", name: null, + reservationTime: null, idCard: null, phoe: null, email: null, @@ -2117,6 +2250,37 @@ // }, // ], }, + pickerOptions: { + shortcuts: [ + { + text: "鏈�杩戜竴鍛�", + onClick(picker) { + const end = new Date(); + const start = new Date(new Date().setHours(0, 0, 0, 0)); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); + picker.$emit("pick", [start, end]); + }, + }, + { + text: "鏈�杩戜竴涓湀", + onClick(picker) { + const end = new Date(); + const start = new Date(new Date().setHours(0, 0, 0, 0)); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); + picker.$emit("pick", [start, end]); + }, + }, + { + text: "鏈�杩戜笁涓湀", + onClick(picker) { + const end = new Date(); + const start = new Date(new Date().setHours(0, 0, 0, 0)); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); + picker.$emit("pick", [start, end]); + }, + }, + ], + }, }; }, created() { @@ -2148,6 +2312,10 @@ this.discount = (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10; + }, + + dateChangebirthday2(val) { + this.startTime = val; }, /** 鍒犻櫎鎸夐挳鎿嶄綔 */ @@ -2237,6 +2405,16 @@ /** 鏌ヨ浣撴棰勭害鍒楄〃 */ getList() { this.loading = true; + if (this.startTime) { + this.queryParams.yykssj = this.startTime[0]; + this.queryParams.yyjssj = this.startTime[1]; + } else if (this.createTimeList) { + this.queryParams.yykssj = this.createTimeList[0]; + this.queryParams.yyjssj = this.createTimeList[1]; + } else if (this.createTimeList == null) { + this.queryParams.yykssj = null; + this.queryParams.yyjssj = null; + } listReservation(this.queryParams).then((response) => { this.reservationList = response.rows; // response.rows.forEach((item, index) => @@ -2253,6 +2431,7 @@ // 鍙栨秷鎸夐挳 cancel() { this.open = false; + this.open2 = false; this.reset(); }, @@ -2311,15 +2490,37 @@ }, /** 閲嶇疆鎸夐挳鎿嶄綔 */ resetQuery() { + this.startTime = []; + this.createTimeList = []; this.resetForm("queryForm"); + this.queryParams = { + pageNum: 1, + pageSize: 10, + cusName: null, + cusSex: null, + cusBrithday: null, + cusAddr: null, + cusPhone: null, + yykssj: "", // 棰勭害寮�濮嬫椂闂� + yyjssj: "", // 棰勭害缁撴潫鏃堕棿 + cusPostcode: null, + cusEmail: null, + indexCard: null, + cusNational: null, + cusMarryStatus: null, + cusIdcard: null, + cusIntroduce: null, + cusNumber: null, + cusIsvip: null, + }; this.handleQuery(); }, // 澶氶�夋閫変腑鏁版嵁 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; @@ -2334,7 +2535,6 @@ /** 淇敼鎸夐挳鎿嶄綔 */ handleUpdate(row) { - console.log(row); this.title = "淇敼浣撴棰勭害"; this.formIn = row; this.form.tjType = this.formIn.tjType; @@ -2405,7 +2605,6 @@ this.TotalPrice1 = 0; this.tableData1.forEach((item) => { this.TotalPrice1 += item.nowPrice; - console.log(this.discount); this.TotalPrice = ( this.TotalPrice1 * (this.discount / 10) @@ -2617,6 +2816,143 @@ } }, + Groupsignin() { + this.open2 = true; + }, + + submitType() { + // let cusIds = []; + // this.selectList.forEach((item) => { + // cusIds.push(item.idCard); + // }); + let loadingInstance1 = Loading.service({ + fullscreen: true, + text: "绛惧埌涓�", + }); + let data = { + cusIds: this.cusIds, + tjCategory: this.forms.tjCategory, + }; + this.open2 = false; + addPlOrderAndDetail(data).then((res) => { + if (res.code == 200) { + 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); + } + }); + } else { + let _this = this; + this.$nextTick(() => { + // 浠ユ湇鍔$殑鏂瑰紡璋冪敤鐨� Loading 闇�瑕佸紓姝ュ叧闂� + loadingInstance1.close(); + }); + var websocket = null; + var url = _this.valueUrls; + if ("WebSocket" in window) { + websocket = new WebSocket(url); + } else if ("MozWebSocket" in window) { + websocket = new MozWebSocket(url); + } else { + } + if (websocket == null) { + alert("11111"); + } + websocket.onopen = function () { + console.log("res", res); + + try { + // 杩炴帴璁惧 + var jsonObjs = { + type: 4, + data: res, + }; + var jStrs = JSON.stringify(jsonObjs); + websocket.send(jStrs); + } catch (err) { + var tryTime = 0; + // 閲嶈瘯10娆★紝姣忔涔嬮棿闂撮殧3绉� + if (tryTime < 1) { + var t1 = setTimeout(function () { + tryTime++; + var jsonObjs = { + type: 4, + data: res, + }; + var jStrs = JSON.stringify(jsonObjs); + websocket.send(jStrs); + }, 1 * 1000); + } else { + console.error("閲嶈繛澶辫触."); + } + } + }; + websocket.onclose = function () { + alert("杩炴帴鍏抽棴"); + }; + websocket.onmessage = function (event) { + var resultObj = JSON.parse(event.data); + _this.cardreader = false; + }; + + //杩炴帴鍙戠敓閿欒鐨勫洖璋冩柟娉� + websocket.onerror = function () { + alert("璇锋鏌ヨ繛鎺ユ槸鍚︽甯�"); + }; + + this.getList(); + } + } else { + this.$nextTick(() => { + // 浠ユ湇鍔$殑鏂瑰紡璋冪敤鐨� Loading 闇�瑕佸紓姝ュ叧闂� + loadingInstance1.close(); + }); + } + }); + }, + + 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); + }); + }, + // 鐐瑰嚮鑾峰彇姣忎釜鏍戣妭鐐� handleCurrentChecked(data, checked, checkedNodes) { if (checked === true) { -- Gitblit v1.8.0