From d23ab1d66456d5dd8aa8645bb262deef4e70a9eb Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期五, 17 一月 2025 19:02:01 +0800 Subject: [PATCH] 2 --- src/views/system/tijian/index.vue | 462 +++++++++++++++++++++++++++------------------------------ 1 files changed, 217 insertions(+), 245 deletions(-) diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue index f164347..5fac4af 100644 --- a/src/views/system/tijian/index.vue +++ b/src/views/system/tijian/index.vue @@ -353,10 +353,6 @@ ></el-option> </el-select> </el-form-item> - - <!-- <el-form-item prop="ageUnit"> - - </el-form-item> --> </el-form> <el-form :inline="true" @@ -590,14 +586,6 @@ prop="allProName" :show-overflow-tooltip="true" /> - <!-- :selectable="checkSelectable" --> - <!-- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button size="mini" type="text" icon="el-icon-circle-check" @click="handleSeach(scope.row)" - v-hasPermi="['system:package:Seach']">濂楅璇︽儏 - </el-button> - </template> -</el-table-column> --> </el-table> </div> </div> @@ -685,6 +673,7 @@ width="260px" > </el-table-column> + <el-table-column prop="proPrice" label="鍘熶环" width="56px"> </el-table-column> @@ -715,18 +704,6 @@ </el-tab-pane> <el-tab-pane label="鍗曢」" name="second"> <div class="tab8"> - <!-- <div class="tab7"> - <v-tree-transfer - :treeData="treedataList" - :defaultProps="{ children: 'tjProjectList', label: 'proName' }" - :defaultKeys="defaultKeys" - @changeKeys="changeCategoryKeys" - :key="datekey" - ></v-tree-transfer> --> - <!-- <el-tree :data="data" show-checkbox node-key="proId" :props="defaultProps" :default-checked-keys="treeList" - @check-change="handleCurrentChecked"> - </el-tree> --> - <!-- </div> --> <el-row :gutter="20"> <el-col :span="6"> <div @@ -803,6 +780,8 @@ :span-method="objectSpanMethod" > <el-table-column prop="propinName" label="妫�鏌ラ」鐩�"> + </el-table-column> + <el-table-column prop="sl" label="鏁伴噺" width="56px"> </el-table-column> <el-table-column prop="proPrice" @@ -953,17 +932,17 @@ style="width: 150px" ></el-input> </el-form-item> - <el-form-item label="浼樻儬"> + <el-form-item label="鎶樻墸"> <!-- {{ discount }} --> <el-input-number ref="inputNumber" style="width: 150px" v-model="discount" - :precision="2" + :precision="1" :step="0.1" :max="10" :min="0" - @change="numberChange" + @change="debounceNumberChange" :disabled="isfalse" ></el-input-number> </el-form-item> @@ -972,7 +951,9 @@ placeholder="瀹炴敹閲戦" v-model="TotalPrice" style="width: 206px" - ></el-input> + @input="changeXianjia" + @blur="numberChangeXianPrice(discount, discount)" + /> </el-form-item> <br /> @@ -1108,17 +1089,18 @@ <el-table-column label="鎶樻墸"> <template slot-scope="scope"> <!-- 鍙緭鍏ョ函鏁板瓧鎶樻墸 --> - <el-input + <el-input-number v-model.number="scope.row.discount" @input="validateDiscount(scope.row)" placeholder="杈撳叆鎶樻墸" size="small" type="number" - min="0" - step="1" - max="10" + :precision="1" + :step="0.1" + :max="10" + :min="0" > - </el-input> + </el-input-number> </template> </el-table-column> <el-table-column prop="nowPrice" label="瀹炴敹閲戦"> @@ -1275,11 +1257,11 @@ <el-input-number style="width: 140px" v-model="discount" - :precision="2" + :precision="1" :step="0.1" :max="10" :min="0" - @change="numberChange" + @change="debounceNumberChange" :disabled="isfalse" ></el-input-number> </el-form-item> @@ -1462,6 +1444,7 @@ }, data() { return { + isSubmitting: false, open1: false, filterage: "", checkedkeys: [], @@ -1523,7 +1506,6 @@ taocan: false, top: true, value: "2", - getInfodis: "", srcUrl: "", hides: false, hide: true, @@ -1663,7 +1645,7 @@ cusIsvip: null, }, // 娣诲姞 - + lastXianPrice: 0, // 琛ㄥ崟鍙傛暟 // 琛ㄥ崟鍙傛暟 obj: {}, @@ -1679,7 +1661,27 @@ firmId: "", firmDeptName: "", }, - form1: {}, + form1: { + cnName: "", + contactPerson: "", + contactPhone: "", + taxNumber: "", + legalPerson: "", + registerAddress: "", + mailingAddress: "", + bankAccount: "", + mailingAddress: "", + countNum: "", + bankAccount: "", + email: "", + principal: "", + url: "", + faxNumber: "", + areaName: "", + orderNum: "", + remark: "", + validTime: "", + }, title: "", // 琛ㄥ崟鏍¢獙 rules: { @@ -1730,6 +1732,19 @@ mounted() {}, methods: { + debounceNumberChange(currentValue, oldValue) { + clearTimeout(this.debounceTimer); + this.debounceTimer = setTimeout(() => { + this.numberChange(currentValue, oldValue); + }, 300); + }, + changeXianjia() { + // 鍘熷鎶樻墸鐜囪绠� + if (this.TotalPrice1 !== 0) { + this.discount = + (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10; + } + }, clear() { this.form.firmId = ""; }, @@ -1765,13 +1780,17 @@ }) .catch(() => {}); }, + handleManualChange(row) { + console.log("杩欐槸涓诲姩鍑哄彂鐨�"); + this.updateProPrice(row); + }, validateDiscount(row) { - if (row.discount > 10) { - row.discount = 10; // 寮哄埗灏嗗�艰缃负鏈�澶у�� - } else if (row.discount < 0) { - row.discount = 0; // 寮哄埗灏嗗�艰缃负鏈�灏忓�� + console.log("杞簡") + if (this.TotalPrice !== undefined && !isNaN(this.TotalPrice) && this.TotalPrice !== this.lastXianPrice) { + console.log("杩涘叆浜�") + this.updateProPrice1(row); + this.lastXianPrice = this.TotalPrice; } - this.updateProPrice(row); // 鏇存柊浠锋牸鎴栧叾浠栭�昏緫 }, isAll(value) { return value === "" || value === null; @@ -1789,7 +1808,33 @@ this.discount = (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10; }, + updateProPrice1(row) { + console.log("杩涘叆浜�1") + const ordPrice = new Big(row.ordPrice); + const discount = new Big(row.discount); + const result = ordPrice.times(discount.div(10)); + row.nowPrice = result.toNumber(); + const totalYsPrice = this.tableData1.reduce((sum, item) => { + return sum.plus(new Big(item.nowPrice || '0')); + }, new Big(0)); + const totalYsPriceNum = totalYsPrice.toNumber(); + if (this.TotalPrice !== undefined && !isNaN(this.TotalPrice)) { + const xianPrice = new Big(this.TotalPrice); + const diff = xianPrice.minus(totalYsPriceNum); + if (!diff.eq(0) && this.tableData1.length > 0) { + const lastItem = this.tableData1[this.tableData1.length - 1]; + const newYsPrice = new Big(lastItem.nowPrice).plus(diff).toNumber(); + this.$set(this.tableData1[this.tableData1.length - 1], 'nowPrice', newYsPrice); + } + } + // Update youhui calculation + if (this.TotalPrice1 !== 0 && this.TotalPrice !== 0) { + this.discount = (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10; + } else { + this.discount = 0; + } + }, openname() { this.$refs.bbb.open = true; this.$refs.bbb.title = "鎼滅储濮撳悕"; @@ -1913,11 +1958,9 @@ }, getList1() { getInfo().then((response) => { - this.getInfodis = response.user.discount; + this.hospName = response.hospName; - if (this.getInfodis === null) { - this.isfalse = true; - } + }); getIsRequired().then((response) => { this.showHidden = response.data; @@ -2130,25 +2173,6 @@ this.srcUrl = response.url; }); }, - // base64杞枃浠� - // dataURLtoFile(image, filename) { - // var arr = image.split(","); - // var mime = arr[0].match(/:(.*?);/)[1]; - // var bstr = atob(arr[1]); - // var n = bstr.length; - // var u8arr = new Uint8Array(n); - // while (n--) { - // u8arr[n] = bstr.charCodeAt(n); - // } - // return new File([u8arr], filename, { type: mime }); - // }, - - // 鍏抽棴鎽勫儚澶� - - // stopNavigator() { - // this.thisVideo.srcObject.getTracks()[0].stop(); - // this.beat = false; - // }, handleClose(done) { this.$confirm("纭鍏抽棴锛�") @@ -2160,16 +2184,9 @@ /** 鏌ヨ淇℃伅鍒楄〃 */ getList() { - // listCustomer(this.queryParams).then((response) => { - // this.customerList = response.rows; - // this.total = response.total; - // this.loading = false; - // }); getInfo().then((response) => { - this.getInfodis = response.user.discount; - if (this.getInfodis === null) { - this.isfalse = true; - } + + }); let cusSex = this.form.cusSex; //鍏ㄩ儴濂楅 @@ -2221,8 +2238,6 @@ }, /** 閲嶇疆鎸夐挳鎿嶄綔 */ resetQuery() { - // this.resetForm("form"); - // this.form = {}; if (this.confirm === true) { this.$tab.refreshPage(); } else { @@ -2255,27 +2270,66 @@ }) .then(() => { this.discount = currentValue; - if (this.discount < this.getInfodis) { - this.discount = this.getInfodis; - // this.$modal.msgError(`璇ヤ汉鍛樻渶楂樹紭鎯犳潈闄愪负${this.getInfodis}鎶榒); - } + this.tableData1.forEach((item) => { item.discount = this.discount; const ordPrice = new Big(item.ordPrice); const discount = new Big(item.discount); - const result = ordPrice.times(discount.div(10)); // ordPrice * (discount / 10) + const result = ordPrice.times(discount.div(10)); item.nowPrice = result.toNumber(); this.TotalPrice = this.tableData1.reduce((sum, item) => { return sum.plus(new Big(item.nowPrice || "0")); }, new Big(0)); }); - // ---------------------------------------------------------- }) .catch(() => { this.discount = oldValue; }); }, - + numberChangeXianPrice(currentValue, oldValue) { + this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + this.discount = currentValue; + if (this.discount < this.getInfodis) { + this.discount = this.getInfodis; + } + let totalYsprice = new Big(0); + this.tableData1.forEach((item) => { + item.discount = this.discount; + const ordPrice = new Big(item.ordPrice); + const discount = new Big(item.discount); + const result = ordPrice.times(discount.div(10)); + item.nowPrice = result.toNumber(); + totalYsprice = totalYsprice.plus(new Big(item.nowPrice)); + }); + if (!totalYsprice.eq(this.TotalPrice)) { + const diff = new Big(this.TotalPrice).minus(totalYsprice); + if (this.tableData1.length > 0) { + const lastItem = this.tableData1[this.tableData1.length - 1]; + const newYsPrice = new Big(lastItem.nowPrice) + .plus(diff) + .toNumber(); + console.log( + "hhh", + this.tableData1[this.tableData1.length - 1].nowPrice, + newYsPrice + ); + this.$set( + this.tableData1[this.tableData1.length - 1], + "nowPrice", + newYsPrice + ); + } + } + }) + .catch(() => { + this.discount = oldValue; + }); + }, /** 鐧昏鎻愪氦鎸夐挳 */ submitForm() { let _this = this; @@ -2324,6 +2378,7 @@ let cusIdcard = this.form.cusIdcard; if (cusIdcard) { getCusIdcard(cusIdcard).then((response) => { + _this.top = false; if (response.data) { this.form = response.data; if (this.form.discount === null) { @@ -2364,11 +2419,11 @@ this.list1 = false; this.list2 = true; this.list3 = false; - this.top = false; + _this.top = false; } else { this.list1 = true; this.TotalPrice = 0; - this.top = false; + _this.top = false; } }); } else { @@ -2524,15 +2579,7 @@ } } else { this.$message.warning("璇锋斁缃韩浠借瘉鍚庡啀鐐瑰嚮璇诲彇"); - } /* if (resultObj.resultFlag == "-1") { - if (resultObj.errorMsg == "绔彛鎵撳紑澶辫触") { - //alert("璇诲崱鍣ㄦ湭杩炴帴"); - } else { - //alert(resultObj.errorMsg); - } - } else if (resultObj.resultFlag == "-2") { - //alert(resultObj.errorMsg); - } */ + } }, // TODO 浠ヤ笅浠g爜鍙兘鏄尘宸濅娇鐢ㄧ殑 jingChuanHandlerWebSocketResult(resultObj) { @@ -2684,23 +2731,9 @@ alert("璇锋鏌ヨ鍗″櫒杩炴帴鏄惁姝e父"); }; } else { - // if (_this.inputSSS.indexOf(":1") != -1) { - - // var str1 = _this.inputSSS.indexOf(":1"); - // var result1 = _this.inputSSS.substring(0, str1); - - // var str2 = _this.inputSSS.indexOf(":1"); - // var result2 = _this.inputSSS.substring( - // str2 + 2, - // _this.inputSSS.length - // ); - - // _this.inputSSS = result1 + result2; - // } _this.inputSSS = _this.inputSSS.replace(":1", ""); var websocket = null; var url = this.valueUrls; - // var url = 'ws://'+ getIp() +':6789/websocket' if ("WebSocket" in window) { websocket = new WebSocket(url); } else if ("MozWebSocket" in window) { @@ -2873,53 +2906,6 @@ } }, - // 鐐瑰嚮澶氶�夋鑾峰彇閫変腑鏁版嵁 - // handleSelectionChange(selection, row) { - // this.tableData = selection; - // if (selection.length > 1) { - // let del_row = selection.shift(); - // this.$refs.tb.toggleRowSelection(del_row, false); //璁剧疆杩欎竴琛屽彇娑堥�変腑 - // } - // this.single = selection.length !== 1; - // this.multiple = !selection.length; - // this.tableData.forEach((item) => { - // this.fData = item.tjProjectList; - // }); - // if (selection[0]) { - // this.DataList = []; - // this.data = JSON.parse(JSON.stringify(this.dXData)); - // if (selection[0].tjProjectList) { - // selection[0].tjProjectList.forEach((selectionitem) => { - // this.treedataList.forEach((item) => { - // if (selectionitem.proName == item.proName) { - // item.disabled = true; - // item.tjProjectList = []; - // } - // if (item.tjProjectList) { - // item.tjProjectList.forEach((item1) => { - // if (selectionitem.proName == item1.proName) { - // item1.disabled = true; - // item1.tjProjectList = []; - // } - // if (item1.tjProjectList) { - // item1.tjProjectList.forEach((item2) => { - // if (selectionitem.proName == item2.proName) { - // item2.disabled = true; - // item2.tjProjectList = []; - // } - // }); - // } - // }); - // } - // }); - // }); - // } - // } else { - // this.treedataList = JSON.parse(JSON.stringify(this.dXData)); - // return; - // } - // }, - resetpackage() { this.discount = 10; if (this.form.cusIdcard) { @@ -2931,6 +2917,13 @@ _this.pacId = ""; this.proIds = []; this.tjCategory = "12"; + + this.DataList = []; // 娓呯┖宸查�夐」鐩垪琛� + this.checkedkey = []; // 娓呯┖鏍戠殑閫変腑鐘舵�� + this.checkedListkey = []; + this.TreedataList = []; + this.$refs.tree.setCheckedKeys([]); // 閲嶇疆鏍戦�変腑鐘舵�� + let data = { cusId, pacId: _this.pacId, @@ -3270,7 +3263,7 @@ if (this.DataList.length != 0) { this.list1 = false; this.DataList.forEach((item) => { - this.marryall += item.proPrice; + this.marryall = item.proPrice * item.sl; }); } }); @@ -3388,116 +3381,99 @@ var cusId = this.form.cusIdcard; } else { this.$message.warning("璇峰厛濉啓淇℃伅锛屽啀閫変綋妫�鍐呭"); + return; // 濡傛灉娌℃湁韬唤璇佸彿鐮侊紝鍋滄鎵ц } + let _this = this; + + // 鍒濆鍖栧彉閲� + this.isSubmitting = true; // 寮�濮嬫彁浜ゆ椂璁剧疆鏍囧織 + this.TotalPrice1 = 0; // 鍒濆鍖栧簲鏀堕噾棰� + this.TotalPrice = 0; // 鍒濆鍖栧疄鏀堕噾棰� + this.discount = 10; // 鍒濆鍖栨姌鎵d负10锛�100%锛� + + // 鍒ゆ柇鏄惁鏈夐�変腑鐨勫椁� if (this.tableData.length != 0) { - this.tableData.forEach((item) => { - _this.pacId = item.pacId; - }); + _this.pacId = this.tableData[0].pacId; } else { _this.pacId = ""; } + this.proIds = []; - if (this.DataList.length != 0) { - this.DataList.forEach((item) => { + + // 澶勭悊閫変腑鐨勯」鐩� + const newItemsToAdd = []; + const allItems = [...this.DataList, ...this.DataLists]; // 鍚堝苟鎵�鏈夐」鐩� + + allItems.forEach((item) => { + if (!this.proIds.includes(item.proId)) { + newItemsToAdd.push(item); this.proIds.push(item.proId); - }); - } - if (this.DataLists.length != 0) { - this.DataLists.forEach((item) => { - this.proIds.push(item.proId); - }); - } + } + }); + + // 鍑嗗鏁版嵁 let data = { cusId, pacId: _this.pacId, proIds: this.proIds, }; + + // 鏍规嵁浣撴绫诲瀷閫夋嫨涓嶅悓鐨勫鐞嗘柟娉� if (this.form.tjType == 1) { tuantiqueren(data).then((response) => { if (response.code == 200) { - let cusId = this.form.cusIdcard; - this.proIds = []; - getTransitionList1(cusId).then((response) => { - this.tableData1 = response.data; - this.TotalPrice1 = 0; - if (this.tableData1) { - this.tableData1.forEach((item) => { - if (item.tjCategory != null) { - this.tjCategory = item.tjCategory; - } - if (item.pacName == "鍗曢」") { - item.list.forEach((item9) => { - this.treeList.push(item9.proId); - }); - } - this.TotalPrice1 += item.ordPrice; - this.TotalPrice += item.nowPrice; - - this.pacName = item.pacName; - }); - - 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.list1 = false; - this.list3 = true; - this.list2 = false; - } else { - this.list1 = true; - this.TotalPrice = 0; - } - }); - } else { + this.processOrderItems(cusId); } + this.isSubmitting = false; // 鎻愪氦瀹屾垚鍚庨噸缃爣蹇� + }).catch(() => { + this.isSubmitting = false; // 纭繚鍦ㄩ敊璇儏鍐典笅涔熼噸缃爣蹇� }); } else { getaddtTransition(data).then((response) => { if (response.code == 200) { - let cusId = this.form.cusIdcard; - this.proIds = []; - getTransitionList1(cusId).then((response) => { - this.tableData1 = response.data; - this.TotalPrice1 = 0; - if (this.tableData1) { - this.tableData1.forEach((item) => { - if (item.tjCategory != null) { - this.tjCategory = item.tjCategory; - } - if (item.pacName == "鍗曢」") { - item.list.forEach((item9) => { - this.treeList.push(item9.proId); - }); - } - this.TotalPrice1 += item.ordPrice; - this.TotalPrice += item.nowPrice; - - this.pacName = item.pacName; - }); - this.discount = - (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / - 100) * - 10; - - this.list1 = false; - this.list3 = true; - this.list2 = false; - } else { - this.list1 = true; - this.TotalPrice = 0; - } - }); - } else { + this.processOrderItems(cusId); } + this.isSubmitting = false; // 鎻愪氦瀹屾垚鍚庨噸缃爣蹇� + }).catch(() => { + this.isSubmitting = false; // 纭繚鍦ㄩ敊璇儏鍐典笅涔熼噸缃爣蹇� }); } + this.taocan = false; this.defaultKeys = []; this.DataLists = []; + }, + + // 澶勭悊璁㈠崟椤圭洰 + processOrderItems(cusId) { + getTransitionList1(cusId).then((response) => { + this.tableData1 = response.data; + if (this.tableData1) { + this.tableData1.forEach((item) => { + if (item.tjCategory != null) { + this.tjCategory = item.tjCategory; + } + if (item.pacName == "鍗曢」") { + item.list.forEach((item9) => { + this.treeList.push(item9.proId); + }); + } + this.TotalPrice1 += item.ordPrice || 0; // 绱姞搴旀敹閲戦 + this.TotalPrice += item.nowPrice || 0; // 绱姞瀹炴敹閲戦 + }); + // 璁$畻鎶樻墸 + this.discount = this.TotalPrice1 > 0 ? + (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10 : 0; + + this.list1 = false; + this.list3 = true; + this.list2 = false; + } else { + this.list1 = true; + this.TotalPrice = 0; + } + }); }, submitCheckinfee() { let _this = this; @@ -3663,9 +3639,7 @@ } this.discount = (this.formInline.paidIn / this.formInline.price) * 10; - if (this.discount <= this.getInfodis) { - this.discount = this.getInfodis; - } + } else { this.discount = 10; this.formInline.paidIn = "0.00"; @@ -3746,8 +3720,6 @@ listgetOrder(data) { getOrder(data).then((res) => { this.$modal.msgSuccess("鎻愪氦鎴愬姛"); - // this.dialogVisibles = true; - // this.url = window.webkitURL.createObjectURL(res); //灏嗗悗绔繑鍥炵殑blob鏂囦欢璇诲彇鍑簎rl //璋冩帴鍙f樉绀哄妫�鍗� const tjNumber = res.msg; const viewNum = "792931586196398080"; -- Gitblit v1.8.0