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 | 157 +++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 135 insertions(+), 22 deletions(-)
diff --git a/src/views/sales/salesDetails/index.vue b/src/views/sales/salesDetails/index.vue
index 719169e..84a0db4 100644
--- a/src/views/sales/salesDetails/index.vue
+++ b/src/views/sales/salesDetails/index.vue
@@ -50,6 +50,9 @@
<template v-if="scope.row.status === 3||scope.row.status === 4">
<el-button @click.stop="shipmentsClick(scope.row)" type="text" size="small">鍙戣揣</el-button>
</template>
+ <template v-if="scope.row.status === 3||scope.row.status === 4">
+ <el-button @click.stop="confirmClick(scope.row)" type="text" size="small">纭瀹屾垚</el-button>
+ </template>
</template>
</el-table-column>
</template>
@@ -176,7 +179,8 @@
getProductOrderInfo,
updateStatus,
getProjectList,
- sendSalesDetailsToOtherSystem
+ sendSalesDetailsToOtherSystem,
+ confirmOutputOver
} from "@/api/sales/salesDetails"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import DetailSpecification from "@/views/sales/salesDetails/DetailSpecification"
@@ -217,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" },
@@ -241,7 +260,7 @@
{ label: "鎵胯繍鍟�", prop: "carrier" },
{ label: "杩愬崟鍙�", prop: "waybill" },
{ label: "鍒涘缓鏃堕棿", prop: "warehouse" },
- { label: "鐘舵��", prop: "status" },
+ { label: "鐘舵��", prop: "status",isCallMethod: true,getCallMethod: this.getStatusFive },
]
// 鍒堕�犱俊鎭�
const makeColumn = [
@@ -318,57 +337,47 @@
{
label: "濮斿璁㈠崟",
prop: "outsourcingId",
- default: true
},
{
label: "浜у搧缂栧彿",
prop: "productId",
- default: true
},
{
label: "浜у搧鍚嶇О",
prop: "productName",
- default: true
},
{
label: "浜у搧瑙勬牸",
prop: "specs",
- default: true
},
{
label: "浜у搧鍗曚綅",
prop: "unit",
- default: true
},
{
label: "濮斿鏁伴噺",
prop: "amount",
- default: true
},
{
label: "瀹屾垚鏁伴噺",
prop: "finishAmount",
- default: true
},
{
label: "璁㈠崟鐘舵��",
prop: "status",
- default: true
+ default: true, isCallMethod: true, getCallMethod: this.getStatus
},
{
label: "濮斿渚涘簲鍟�",
prop: "supplierName",
- default: true
},
{
label: "绛剧害鏃ユ湡",
prop: "startTime",
- default: true
},
{
label: "浜や粯鏃ユ湡",
prop: "endTime",
- default: true
},
]
return {
@@ -439,7 +448,7 @@
TabsIndex: "0",
productTableList: {},
productColumn: productColumn,
- showProductCol: ["浜у搧缂栧彿", "浜у搧鍚嶇О","浜у搧瑙勬牸", "鍗曚綅", "璁㈠崟鏁伴噺", "宸插畬鎴愭暟閲�", "宸插彂璐ф暟閲�", "閲囪喘鏁伴噺", "鐢熶骇鏁伴噺", "濮斿鏁伴噺","閿�鍞崟浠�","鎴愭湰鍗曚环","姣涘埄","姣涘埄鐜�","浠风◣鍚堣"],
+ showProductCol: ["浜у搧缂栧彿", "浜у搧鍚嶇О","浜у搧瑙勬牸", "鍗曚綅", "璁㈠崟鏁伴噺", "宸插畬鎴愭暟閲�", "宸插彂璐ф暟閲�", "閲囪喘鏁伴噺", "鐢熶骇鏁伴噺", "濮斿鏁伴噺","閿�鍞崟浠�","鎴愭湰鍗曚环","姣涘埄","姣涘埄鐜�(%)","浠风◣鍚堣"],
inventoryColumn: inventoryColumn,
showInventoryCol: [
"鍑哄簱鍗�",
@@ -456,7 +465,7 @@
"鐘舵��"
],
makeColumn: makeColumn,
- showMakeCol: ["鐢熶骇璁㈠崟", "浜у搧鍚嶇О", "璁㈠崟鐘舵��", "宸ュ崟缂栧彿", "宸ュ崟鐘舵��", "璁″垝寮�濮嬫椂闂�", "璁″垝缁撴潫鏃堕棿"],
+ showMakeCol: ["鐢熶骇璁㈠崟", "浜у搧缂栧彿", "浜у搧鍚嶇О", "浜у搧瑙勬牸", "浜у搧鍗曚綅", "璁㈠崟鏁伴噺", "瀹屾垚鏁伴噺","宸ュ崟缂栧彿","宸ュ崟鐘舵��","璁″垝寮�濮嬫椂闂�","璁″垝缁撴潫鏃堕棿"],
// 閲囪喘
purchaseColumn: purchaseColumn,
outsourceColumn:outsourceColumn,
@@ -489,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) {
@@ -633,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
})
@@ -736,6 +769,75 @@
this.editShipmentsConfig.infomation.saleDetailNumber=row.number
this.editShipmentsConfig.infomation.projectId=row.projectId
},
+ // 纭鍙戣揣瀹屾垚
+ async confirmClick(row){
+ 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) {
console.log(row, "鍏抽棴")
@@ -826,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) {
@@ -850,7 +953,7 @@
},
// 鐘舵��
getStatus(val) {
- return val === 1 ? "寰呯‘璁�" : val === 2 ? "寰呭嚭搴�" : val === 3 ? "澶囪揣涓�" : val === 4 ? "寰呭嚭搴�" : val === 5 ? "鍑哄簱瀹屾垚" : val=== 6 ? "宸插叧闂�": "--"
+ return val === 1 ? "寰呯‘璁�" : val === 2 ? "寰呭垎瑙�" : val === 3 ? "澶囪揣涓�" : val === 4 ? "寰呭嚭搴�" : val === 5 ? "鍑哄簱瀹屾垚" : val=== 6 ? "宸插叧闂�": "--"
},
// top 琛岀偣鍑�
tableRowClick(row) {
@@ -867,6 +970,9 @@
this.getProductOrderInfo(this.selectRow.number)
} else if (this.TabsIndex == 3) {
// 閲囪喘淇℃伅
+ this.getProductOrderInfo(this.selectRow.number)
+ }else if(this.TabsIndex == 4){
+ // 濮斿淇℃伅
this.getProductOrderInfo(this.selectRow.number)
}
},
@@ -927,7 +1033,14 @@
})
}
})
- }
+ },
+ getStatusFive(val) {
+ if (val) {
+ return val==0?'灏辩华':'瀹屾垚'
+ } else {
+ return "--";
+ }
+ },
}
}
</script>
--
Gitblit v1.8.0