From 7fbfeddedebd05e2d23ce411be887106d31e8eff Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 27 三月 2024 15:02:18 +0800
Subject: [PATCH] 销售明细单产品列表添加动态表头,产品信息列表根据完成数量展示字体色
---
src/views/sales/salesDetails/index.vue | 126 +++++++++++++++++++++++++++++++++++++----
1 files changed, 113 insertions(+), 13 deletions(-)
diff --git a/src/views/sales/salesDetails/index.vue b/src/views/sales/salesDetails/index.vue
index 82b47e0..84a0db4 100644
--- a/src/views/sales/salesDetails/index.vue
+++ b/src/views/sales/salesDetails/index.vue
@@ -221,11 +221,26 @@
{ label: "浜у搧瑙勬牸", prop: "specs" },
{ label: "鍗曚綅", prop: "unit" },
{ label: "璁㈠崟鏁伴噺", prop: "amount" },
- { label: "宸插畬鎴愭暟閲�", prop: "finishAmount" },
- { label: "宸插彂璐ф暟閲�", prop: "deliveryAmount" },
- { label: "閲囪喘鏁伴噺", prop: "purchaseAmount" },
- { label: "鐢熶骇鏁伴噺", prop: "makeAmount" },
- { label: "濮斿鏁伴噺", prop: "outsourcingAmount" },
+ {
+ label: "宸插畬鎴愭暟閲�",
+ prop: "finishAmount",
+ isClass: true,
+ getClassName: this.getAmountClassName,
+ },
+ { label: "宸插彂璐ф暟閲�", prop: "deliveryAmount",
+ isClass: true,
+ getClassName: this.getAmountClassName, },
+ { label: "閲囪喘鏁伴噺",
+ isClass: true,
+ getClassName: this.getFinishAmountClassName,
+ prop: "purchaseAmount",
+ },
+ { label: "鐢熶骇鏁伴噺", prop: "makeAmount" ,
+ isClass: true,
+ getClassName: this.getFinishAmountClassName, },
+ { label: "濮斿鏁伴噺", prop: "outsourcingAmount",
+ isClass: true,
+ getClassName: this.getFinishAmountClassName, },
{ label: "閿�鍞崟浠�", prop: "price", price: true },
{ label: "鎴愭湰鍗曚环", prop: "cost" },
{ label: "姣涘埄", prop: "profit" },
@@ -433,7 +448,7 @@
TabsIndex: "0",
productTableList: {},
productColumn: productColumn,
- showProductCol: ["浜у搧缂栧彿", "浜у搧鍚嶇О","浜у搧瑙勬牸", "鍗曚綅", "璁㈠崟鏁伴噺", "宸插畬鎴愭暟閲�", "宸插彂璐ф暟閲�", "閲囪喘鏁伴噺", "鐢熶骇鏁伴噺", "濮斿鏁伴噺","閿�鍞崟浠�","鎴愭湰鍗曚环","姣涘埄","姣涘埄鐜�","浠风◣鍚堣"],
+ showProductCol: ["浜у搧缂栧彿", "浜у搧鍚嶇О","浜у搧瑙勬牸", "鍗曚綅", "璁㈠崟鏁伴噺", "宸插畬鎴愭暟閲�", "宸插彂璐ф暟閲�", "閲囪喘鏁伴噺", "鐢熶骇鏁伴噺", "濮斿鏁伴噺","閿�鍞崟浠�","鎴愭湰鍗曚环","姣涘埄","姣涘埄鐜�(%)","浠风◣鍚堣"],
inventoryColumn: inventoryColumn,
showInventoryCol: [
"鍑哄簱鍗�",
@@ -450,7 +465,7 @@
"鐘舵��"
],
makeColumn: makeColumn,
- showMakeCol: ["鐢熶骇璁㈠崟", "浜у搧鍚嶇О", "璁㈠崟鐘舵��", "宸ュ崟缂栧彿", "宸ュ崟鐘舵��", "璁″垝寮�濮嬫椂闂�", "璁″垝缁撴潫鏃堕棿"],
+ showMakeCol: ["鐢熶骇璁㈠崟", "浜у搧缂栧彿", "浜у搧鍚嶇О", "浜у搧瑙勬牸", "浜у搧鍗曚綅", "璁㈠崟鏁伴噺", "瀹屾垚鏁伴噺","宸ュ崟缂栧彿","宸ュ崟鐘舵��","璁″垝寮�濮嬫椂闂�","璁″垝缁撴潫鏃堕棿"],
// 閲囪喘
purchaseColumn: purchaseColumn,
outsourceColumn:outsourceColumn,
@@ -483,6 +498,29 @@
this.getProjectList()
},
methods: {
+ getFinishAmountClassName(val, row) {
+ let parts = val.split("/");
+ let numerator = parseInt(parts[0], 10); // 鍒嗗瓙
+ let denominator = parseInt(parts[1], 10); // 鍒嗘瘝
+ let classname = "";
+ if (numerator / denominator === 0||numerator===0) {
+ classname = "error";
+ }else if(numerator / denominator === 1){
+ classname = "success";
+ }else if((numerator / denominator) > 0&&(numerator / denominator) <1){
+ classname = "warning-radio";
+ }
+ console.log(classname, numerator,denominator,"鐪嬩笅")
+ return classname;
+ },
+ getAmountClassName(val){
+ console.log(val,"val11")
+ let classname = "";
+ if(val===0){
+ classname = "error";
+ }
+ return classname;
+ },
getpurchaseStatus(val) {
if (val) {
for (let i in this.purchaseStatusList) {
@@ -627,6 +665,7 @@
this.loading = true
await getProductInventoryInfo(row.number)
.then((res) => {
+ console.log(res,"resss")
this.productTableList.tableInfomation = res.data?.length > 0 ? res.data : []
this.loading = false
})
@@ -732,12 +771,72 @@
},
// 纭鍙戣揣瀹屾垚
async confirmClick(row){
- await confirmOutputOver({saleDetailNumber:row.number}).then((res)=>{
- if(res&&res.code===200){
- this.$message.success("纭鍙戣揣瀹屾垚")
- this.getData()
- }
- })
+ this.selectRow = row
+ await getProductInventoryInfo(this.selectRow.number)
+ .then((res) => {
+ console.log(res,"resss")
+ if(res.data){
+ this.productTableList.tableInfomation = res.data?.length > 0 ? res.data : []
+ // let accumulator=res.data
+ // const reducedArray = array.reduce((accumulator, currentItem) => {
+ // // 鏌ユ壘褰撳墠number鏄惁宸插瓨鍦ㄤ簬accumulator涓�
+ // const existingItem = accumulator.find(item => item.number === currentItem.number);
+ // if (existingItem) {
+ // // 濡傛灉瀛樺湪锛岀疮鍔爊um
+ // existingItem.amount += currentItem.amount;
+ // } else {
+ // // 濡傛灉涓嶅瓨鍦紝灏嗗綋鍓嶉」娣诲姞鍒癮ccumulator涓�
+ // accumulator.push(currentItem);
+ // }
+ // return accumulator;
+ // }, []); // 鍒濆鍖朼ccumulator涓轰竴涓┖鏁扮粍
+
+ // console.log(reducedArray,"鏂版暟缁�");
+ }
+ this.loading = false
+ })
+ // let obj=[
+ // {
+ // name:"灏忔槑",
+ // id:1,
+ // num:10
+ // },
+ // {
+ // name:"灏忔槑",
+ // id:1,
+ // num:20
+ // },
+ // {
+ // name:"灏忔槑",
+ // id:1,
+ // num:5
+ // },
+ // {
+ // name:"灏忕孩",
+ // id:1,
+ // num:5
+ // },
+ // {
+ // name:"灏忕孩",
+ // id:1,
+ // num:10
+ // },
+ // {
+ // name:"灏忔埧",
+ // id:5,
+ // num:3
+ // },
+ // ]
+ .catch(() => {
+ this.productTableList.tableInfomation = []
+ this.loading = false
+ })
+ // await confirmOutputOver({saleDetailNumber:row.number}).then((res)=>{
+ // if(res&&res.code===200){
+ // this.$message.success("纭鍙戣揣瀹屾垚")
+ // this.getData()
+ // }
+ // })
},
// 鍏抽棴
closeClick(row) {
@@ -829,6 +928,7 @@
if (this.selectRow.status == 1) {
this.productTableList.tableInfomation = []
} else {
+ console.log(this.selectRow,"鐪嬬湅")
this.getProductInventoryInfo(this.selectRow)
}
} else if (this.TabsIndex == 2) {
--
Gitblit v1.8.0