From 720381cfb95f06c87c0b11fe92531d06c2b02e12 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期三, 15 一月 2025 17:58:05 +0800 Subject: [PATCH] 11 --- src/views/system/tijian/index.vue | 222 +++++++++++++++++++++---------------------------------- 1 files changed, 85 insertions(+), 137 deletions(-) diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue index f164347..5dfd40a 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> @@ -715,18 +703,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 @@ -959,11 +935,11 @@ 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 +948,9 @@ placeholder="瀹炴敹閲戦" v-model="TotalPrice" style="width: 206px" - ></el-input> + @input="changeXianjia" + @blur="numberChangeXianPrice(discount, discount)" + /> </el-form-item> <br /> @@ -1108,17 +1086,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 +1254,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> @@ -1730,6 +1709,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 = ""; }, @@ -2130,25 +2122,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,11 +2133,6 @@ /** 鏌ヨ淇℃伅鍒楄〃 */ 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) { @@ -2221,8 +2189,6 @@ }, /** 閲嶇疆鎸夐挳鎿嶄綔 */ resetQuery() { - // this.resetForm("form"); - // this.form = {}; if (this.confirm === true) { this.$tab.refreshPage(); } else { @@ -2263,19 +2229,61 @@ 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; @@ -2323,7 +2331,9 @@ let _this = this; 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 +2374,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 +2534,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 +2686,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 +2861,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 +2872,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, @@ -3431,6 +3379,7 @@ this.treeList.push(item9.proId); }); } + this.TotalPrice = 0; this.TotalPrice1 += item.ordPrice; this.TotalPrice += item.nowPrice; @@ -3473,6 +3422,7 @@ this.treeList.push(item9.proId); }); } + this.TotalPrice = 0; this.TotalPrice1 += item.ordPrice; this.TotalPrice += item.nowPrice; @@ -3746,8 +3696,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