From 53f2ab450f00d2f1ddb9cedfc5823b34af0d5545 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期三, 30 八月 2023 16:18:09 +0800 Subject: [PATCH] 采购订单的 价格调整 ,折扣调整 接口对接 采购质检单 列表接口对接 --- src/components/makepager/TableCommonView.vue | 1 src/api/purchaseManage/purchase.js | 6 + vue.config.js | 2 src/views/purchaseManage/purchase/components/AddPurchase.vue | 104 +++++++++++++++----- src/views/purchaseManage/purchase/index.vue | 18 +++ src/components/makepager/CommonFormTableView.vue | 81 ++++++++++++--- src/views/other/commonDialog/SelectCommonDialog.vue | 10 + src/views/purchaseManage/quality/index.vue | 5 src/views/purchaseManage/purchase/DetailSupplier.vue | 44 ++++---- 9 files changed, 198 insertions(+), 73 deletions(-) diff --git a/src/api/purchaseManage/purchase.js b/src/api/purchaseManage/purchase.js index 446980d..fe2a48a 100644 --- a/src/api/purchaseManage/purchase.js +++ b/src/api/purchaseManage/purchase.js @@ -110,4 +110,10 @@ method: "get", data }) +} +// 璐ㄦ鍒楄〃 +export const qualityInspectList = async (data) => { + return await axios.get(`/api/purchase/qualityInspectList`, { + params: data + }) } \ No newline at end of file diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue index 91b6d2c..5220061 100644 --- a/src/components/makepager/CommonFormTableView.vue +++ b/src/components/makepager/CommonFormTableView.vue @@ -1,7 +1,11 @@ <template> <div class="page-view"> - <el-form ref="form" :model="tableList" :show-message="false" label-position="right"> - <el-table :data="tableList.tableData" style="width: 100%"> + <el-form ref="form" :model="tableList" :show-message="false" label-position="right" + > + <el-table :data="tableList.tableData" style="width: 100%" + :show-summary="showSummary.show" + :summary-method="getSummaries" + :span-method="arraySpanMethod"> <el-table-column type="index" label="缂栧彿" width="50" align="center"></el-table-column> <el-table-column v-for="(item, i) in tableList.tableColumn" @@ -50,11 +54,14 @@ } " ></el-autocomplete> - <div class="common-select-btn" @click="selClientClick(scope.row, item.prop)"> + <div class="common-select-btn" @click="selClientClick(scope.row, item.prop,scope)"> <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> </div> - <div class="common-select-btn" @click="clearupClient(scope.row)"> + <div class="common-select-btn" @click="clearupClient(scope.row,scope)"> <i class="el-icon-remove-outline" title="娓呴櫎"></i> + </div> + <div class="common-select-btn" @click="deleteClient(scope.row,scope)"> + <i class="el-icon-delete" title="鍒犻櫎"></i> </div> </div> </el-form-item> @@ -94,6 +101,24 @@ :prop="'tableData.' + scope.$index + '.' + item.prop" :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" > + <template v-if="item.multiply"> + <el-input-number + :value="scope.row[showSummary.multiply[0]]*scope.row[showSummary.multiply[1]]" + placeholder="" + :disabled="item.disabled" + :min="0" + :precision="2" + :controls="false" + size="mini" + style="width: 100%; margin-right: 5px" + @input=" + (val) => { + commonInputChange(val, item.prop, scope.row) + } + " + ></el-input-number> + </template> + <template v-else> <el-input-number v-model="scope.row[item.prop]" placeholder="" @@ -108,6 +133,7 @@ } " ></el-input-number> + </template> </el-form-item> <span v-else>{{ scope.row[item.prop] }}</span> <!-- </template> --> @@ -124,13 +150,14 @@ <SelectCommonDialog v-if="editSelCommonConfig.editVisible" :edit-common-config="editSelCommonConfig" + :sign="sign" @selClient="selClient" /> </div> </template> <script> -import { getProductListFromGrpc } from "@/api/productManage/product" +import { getProductListFromGrpc,getProductList } from "@/api/productManage/product" import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog" export default { name: "CommmonFormTableView", @@ -139,6 +166,10 @@ detailEnter: { type: Boolean, default: false + }, + sign:{ + type:String, + default:'' }, productTableList: { type: Object, @@ -160,6 +191,7 @@ total: false, refundable: false, sumProp: [], + multiply:[], titleProp: ["#", "浜у搧鍚嶇О"], mergeNumber: 1 } @@ -168,7 +200,7 @@ recalculateShow: { type: [Boolean], defalut: true - } + }, }, data() { return { @@ -188,10 +220,16 @@ this.tableList = this.productTableList }, computed: {}, + watch:{ + productTableList(){ + this.tableList = this.productTableList + } + }, methods: { // 浜у搧鍚嶇О async getProductList() { - await getProductListFromGrpc({ + let fn = this.sign == "purchase" ? getProductList : getProductListFromGrpc; + await fn({ page: 1, pageSize: 100 }).then((res) => { @@ -259,6 +297,7 @@ } if (column.property === "total") { this.total = sums[index] + this.$emit('getSummaries',this.total) } }) return sums @@ -354,9 +393,9 @@ } this.$emit("selCommonName", selRow) }, - selClientClick(row, prop) { + selClientClick(row, prop,scope) { console.log(row, prop) - this.productIndex = row.productId - 1 + this.productIndex = scope.$index this.editSelCommonConfig.title = "浜у搧鍚嶇О" this.editSelCommonConfig.editVisible = true }, @@ -379,22 +418,28 @@ this.tableList.tableData.map((ite, index) => { if (index === this.productIndex) { ite.name = item.name + ite.productId = item.ID ite.amount = item.amount || 1 ite.number = item.number ite.purchasePrice = item.purchasePrice ite.unit = item.unit ite.deliveryTime = item.deliveryTime ite.shippingDuration = item.shippingDuration + this.$set(this.tableList.tableData,index,ite) + this.$forceUpdate() } }) + + + console.log(this.tableList.tableData,'=====chanp') } }, // 娓呴櫎宸查�夋嫨鐢ㄦ埛 - clearupClient(row) { - this.productIndex = row.productId - 1 + clearupClient(row,scope) { + this.productIndex = scope.$index this.tableList.tableData.map((ite, index) => { - console.log(row.productId) - if (row.productId && row.productId >= 0) { + console.log(scope.$index) + if (scope.$index && scope.$index >= 0) { if (index === this.productIndex) { ite.name = "" ite.amount = 1 @@ -416,10 +461,10 @@ }) this.$emit("clearupProduct", this.tableList.tableData) }, - // 鍒犻櫎 - deleteClient(row) { - this.$emit("deleteProduct", row) - } + deleteClient(row,scope){ + this.tableList.tableData.splice(scope.$index,1) + }, + } } </script> @@ -445,7 +490,7 @@ } .el-table__footer-wrapper tbody td.el-table__cell { background-color: #fff; - text-align: right; + // text-align: right; font-weight: bold; } .el-input--suffix .el-input__inner { diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue index 7b97b49..ac0e306 100644 --- a/src/components/makepager/TableCommonView.vue +++ b/src/components/makepager/TableCommonView.vue @@ -314,6 +314,7 @@ .el-table__footer-wrapper { tbody td.el-table__cell{ background-color: #fff; + font-weight: bold; } // .cell{ // &:nth-last-child(3){ diff --git a/src/views/other/commonDialog/SelectCommonDialog.vue b/src/views/other/commonDialog/SelectCommonDialog.vue index 63c0a0d..cfe8f7b 100644 --- a/src/views/other/commonDialog/SelectCommonDialog.vue +++ b/src/views/other/commonDialog/SelectCommonDialog.vue @@ -39,7 +39,7 @@ </template> <script> -import { getProductListFromGrpc } from "@/api/productManage/product" +import { getProductListFromGrpc,getProductList } from "@/api/productManage/product" export default { name: "EditSelCommonDialog", props: { @@ -52,6 +52,10 @@ tableInfomation: [] } } + }, + sign:{ + type:String, + default:'' } }, components: {}, @@ -105,7 +109,9 @@ }, // 浜у搧鍚嶇О async getProductList() { - await getProductListFromGrpc({ + + let fn = this.sign == "purchase" ? getProductList : getProductListFromGrpc; + await fn({ page: 1, pageSize: 100 }).then((res) => { diff --git a/src/views/purchaseManage/purchase/DetailSupplier.vue b/src/views/purchaseManage/purchase/DetailSupplier.vue index 440d449..b13839c 100644 --- a/src/views/purchaseManage/purchase/DetailSupplier.vue +++ b/src/views/purchaseManage/purchase/DetailSupplier.vue @@ -12,10 +12,10 @@ <span class="header-title">{{ detailConfig.infomation.name }}</span> </div> <div class="btn" style="float: right; margin-right: 30px"> - <el-button type="primary" size="mini" style="margin-right: 5px" + <el-button type="primary" size="mini" disabled style="margin-right: 5px" >鎵撳嵃</el-button > - <el-button type="primary" size="mini" @click="emailClick" + <el-button type="primary" disabled size="mini" @click="emailClick" >Email閫氱煡涓嬪崟</el-button > @@ -74,7 +74,7 @@ </ul> <div class="business_scope"> <div class="content-title">{{ "澶囨敞淇℃伅锛�" }}</div> - <div class="content-data">{{ record ? record : "--" }}</div> + <div class="content-data">{{ remark ? remark : "--" }}</div> </div> </div> </div> @@ -126,21 +126,21 @@ <div class="table-bottom"> <div class="table-bottom-item"> <div class="table-bottom-l"> - 鏁村崟鎶樻墸锛氱洿鎺ラ檷浠� + 鏁村崟鎶樻墸锛歿{ detailConfig.infomation.wholeDiscountType==1?'鐧惧垎姣旈檷浠�':'鐩存帴闄嶄环' }} </div> - <div class="table-bottom-r">0.00</div> + <div class="table-bottom-r">{{detailConfig.infomation.wholeDiscount }}</div> </div> <div class="table-bottom-item"> <div class="table-bottom-l"> - 璋冩暣锛氬鍔� + 璋冩暣锛歿{ detailConfig.infomation.priceAdjustmentType==1?'澧炲姞':'鍑忓皯' }} </div> - <div class="table-bottom-r">0.00</div> + <div class="table-bottom-r">{{ detailConfig.infomation.priceAdjustment }}</div> </div> <div class="table-bottom-item"> <div class="table-bottom-l"> 鍚堣 </div> - <div class="table-bottom-r">26000.00</div> + <div class="table-bottom-r">{{detailConfig.infomation.realTotalPrice }}</div> </div> </div> </div> @@ -178,7 +178,7 @@ basicInfoList: [], isDynamicExpand: true, // 璐︽埛淇℃伅 dynamicInfoList: [], - record: "", // 鏈�鏂拌繘灞� + remark: "", // 鏈�鏂拌繘灞� noContactDays: 0, newContactDays: "", isExpandThree: true, //浜у搧淇℃伅 @@ -236,7 +236,7 @@ if (item.FollowRecord && item.FollowRecord.length > 0) { this.noContactDays = this.getDiffDay(Date.now(), this.newContactDays); } - this.record =item.record?item.record:'' + this.remark =item.remark?item.remark:'' this.formInfoList = [ { str: "渚涘簲鍟嗗悕绉�", @@ -244,15 +244,15 @@ }, { str: "鍚堣", - value: "", + value:item.realTotalPrice, }, { str: "宸叉敹绁ㄩ噾棰�", - value: "", + value: item.invoiceAmount, }, { str: "宸蹭粯閲戦", - value: "", + value: item.paidAmount, }, { str: "绛剧害鏃ユ湡", @@ -260,15 +260,15 @@ }, { str: "閲囪喘璐熻矗浜�", - value: "", + value: item.principal, }, { str: "鏈敹绁ㄩ噾棰�", - value: "", + value: item.unInvoiceAmount, }, { str: "搴斾粯閲戦", - value: "", + value: item.shouldPayAmount, }, ]; this.basicInfoList = [ @@ -282,7 +282,7 @@ leftStr: "閲囪喘鍗曠姸鎬�", leftValue: this.getpurchaseStatus(item.status), rightStr: "閲囪喘璐熻矗浜�", - rightValue: item.contact_position, + rightValue: item.principal, }, { leftStr: "閲囪喘鑱旂郴浜�", @@ -306,19 +306,19 @@ this.dynamicInfoList = [ { leftStr: "鍚堣", - leftValue: this.noContactDays, + leftValue: item.realTotalPrice, rightStr: "宸叉敹绁ㄩ噾棰�", - rightValue: this.newContactDays, + rightValue: item.invoiceAmount, }, { leftStr: "宸蹭粯鎬婚", - leftValue: "", + leftValue:item.paidAmount, rightStr: "鏈敹绁ㄩ噾棰�", - rightValue: "", + rightValue: item.unInvoiceAmount, }, { leftStr: "搴斾粯閲戦", - leftValue: "", + leftValue: item.shouldPayAmount, rightStr: "", rightValue: "", }, diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue index 7205625..28b4ccd 100644 --- a/src/views/purchaseManage/purchase/components/AddPurchase.vue +++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue @@ -166,7 +166,9 @@ :show-summary="showSummary" :recalculateShow="false" :product-table-list="productTableList" + sign="purchase" @inputContent="inputContent" + @getSummaries="getSummaries" @addProductClick="addProductClick" @emptyProductClick="emptyProductClick" @clearupProduct="clearupProduct" @@ -180,6 +182,7 @@ v-model="editConfig.infomation.wholeDiscountType" placeholder="璇烽�夋嫨" filterable + @change="getTotal" > <el-option label="鐧惧垎姣旈檷浠�" :value="1"></el-option> <el-option label="鐩存帴闄嶄环" :value="2"></el-option> @@ -191,6 +194,8 @@ <el-input v-model="editConfig.infomation.wholeDiscount" size="mini" + :disabled="editConfig.infomation.wholeDiscountType?false:true" + @change="getTotal" placeholder="璇峰~鍐�" ></el-input> </el-form-item> @@ -203,6 +208,7 @@ v-model="editConfig.infomation.priceAdjustmentType" placeholder="璇烽�夋嫨" filterable + @change="getTotal" > <el-option label="澧炲姞" :value="1"></el-option> <el-option label="鍑忓皯" :value="2"></el-option> @@ -214,6 +220,8 @@ <el-input v-model="editConfig.infomation.priceAdjustment" size="mini" + :disabled="editConfig.infomation.priceAdjustmentType?false:true" + @change="getTotal" placeholder="璇峰~鍐�" ></el-input> </el-form-item> @@ -221,7 +229,7 @@ </div> <div class="table-bottom-item"> <div class="table-bottom-l">鍚堣</div> - <div class="table-bottom-r">{{ editConfig.infomation.realTotalPrice }}</div> + <div class="table-bottom-r">{{ total }}</div> </div> </div> </div> @@ -297,7 +305,7 @@ wholeDiscount: [ { required: false, - message: "璇峰~鍐�", + message: "璇峰~鍐�0-100鐨勬暟瀛�", trigger: "change", }, { validator: this.validatorNum, trigger: "change" }, @@ -316,6 +324,7 @@ show: true, total: false, sumProp: ["price", "total"], + multiply:['amount','price'], titleProp: [ "缂栧彿", "浜у搧鍚嶇О", @@ -326,6 +335,7 @@ "鎻忚堪", ], mergeNumber: 4, + totalName:'灏忚' }, editSelectSupplierConfig: { editVisible: false, @@ -340,11 +350,13 @@ plcBrandList:[], editRow:{ isDefault:'pin' - } + }, + total:0, + totalTwo:0, }; }, created() { - this.setTableForm(); + this.handleGetBomKindDictList(); }, computed: { }, @@ -353,26 +365,30 @@ immediate:true, handler:function(){ - this.setTableForm(); + this.handleGetBomKindDictList(true); } } }, methods: { validatorNum(rule, value, callback) { - if (value) { - if (value == undefined || value == null) { + if(this.editConfig.infomation.wholeDiscountType==1){ + if(value==undefined||value==null||(!value&&value!=0)){ callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�")); - } else { - var reg = /^\+?[0-9]\d*$/; - if (!reg.test(value)) { - callback(new Error("璇峰~鍐欎笉灏忎簬0鐨勬暟瀛�")); - } else { - callback(); + }else{ + var reg=/^\+?[0-9]\d*$/ + if(!reg.test(value)){ + callback(new Error('璇峰~鍐�0-100鐨勬暟瀛�')) + }else{ + if(Number(value)>100){ + callback(new Error('璇峰~鍐�0-100鐨勬暟瀛�')) + }else{ + callback() + } } - } - } else { - callback(); - } + } + }else{ + this.validatorNumThree(rule, value, callback) + } }, validatorNumThree(rule, value, callback){ if(value){ @@ -397,9 +413,9 @@ }, // PLC閰嶇疆 handleGetBomKindDictList(val) { - console.log(val,'val') getPurchaseType().then((res) => { this.plcBrandList = res.data; + this.setTableForm() if (val) { for (let i in this.plcBrandList) { if (this.plcBrandList[i][this.editRow.isDefault]) { @@ -492,6 +508,13 @@ }, saveParams() { let data =JSON.parse(JSON.stringify(this.editConfig.infomation)); + + if(this.editConfig.infomation.wholeDiscountType==2&&this.editConfig.infomation.wholeDiscount){ + if(Number(this.editConfig.infomation.wholeDiscount)>Number(this.totalTwo)){ + this.$message.error('鐩存帴闄嶄环涓嶈兘瓒呰繃浠风◣鍚堣鐨勬�诲拰锛�') + return true; + } + } let params = { productList:this.tableData, purchase:{ @@ -504,11 +527,12 @@ name:data.name||'', deliveryDate:data.deliveryDate||'', contact:data.contact, - wholeDiscountType:data.wholeDiscountType, - wholeDiscount:Number(data.wholeDiscount), - priceAdjustmentType:data.priceAdjustmentType, - priceAdjustment:Number(data.priceAdjustment), - realTotalPrice:data.realTotalPrice||'', + wholeDiscountType:data.wholeDiscountType?data.wholeDiscountType:0, + wholeDiscount:data.wholeDiscount?Number(data.wholeDiscount):0, + priceAdjustmentType:data.priceAdjustmentType?data.priceAdjustmentType:0, + priceAdjustment:data.priceAdjustment?Number(data.priceAdjustment):0, + realTotalPrice:this.total?Number(this.total):0, + totalPrice:this.totalTwo?Number(this.totalTwo):0, } }; if(data.ID){ @@ -589,11 +613,11 @@ { label: "浜у搧鍚嶇О", prop: "name", - min: 170, + min: 180, productName: true, isRequird: true, }, - { label: "浜у搧缂栧彿", prop: "number" }, + { label: "浜у搧缂栧彿", prop: "number", min: 150,}, { label: "璁¢噺鍗曚綅", prop: "unit" }, { label: "瑙勬牸鍨嬪彿", prop: "specifications" }, { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true }, @@ -603,11 +627,12 @@ inputFloat: true, isRequird: true, }, - { label: "浠风◣鍚堣", prop: "total", inputFloat: true }, + { label: "浠风◣鍚堣", prop: "total", inputFloat: true,disabled:true,multiply:true, }, { label: "鎻忚堪", prop: "remark", input: true }, ], }; - this.handleGetBomKindDictList(true); + this.toal=this.editConfig.infomation.realTotalPrice + }, // 浜у搧鍒楄〃杈撳叆 inputContent(val, prop, row) { @@ -617,6 +642,31 @@ item[prop] = val; } }); + + }, + getSummaries(total){ + this.totalTwo= JSON.parse(JSON.stringify(total)); + this.total=total; + this.getTotal() + }, + getTotal(){ + let prie=0 + if(this.editConfig.infomation.priceAdjustmentType==1){ + prie=Number(this.editConfig.infomation.priceAdjustment) + }else if(this.editConfig.infomation.priceAdjustmentType==2){ + prie=(-1)*Number(this.editConfig.infomation.priceAdjustment) + }else{ + prie=0 + } + let t=0 + if(this.editConfig.infomation.wholeDiscountType==1){ + t=this.totalTwo*Number(this.editConfig.infomation.wholeDiscount)/100 + }else if(this.editConfig.infomation.wholeDiscountType==2){ + t=Number(this.editConfig.infomation.wholeDiscount) + }else{ + t=0 + } + this.total=this.totalTwo-t+Number(prie) }, // 浜у搧鏂板 addProductClick() { diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue index 2d3062f..7f4dfa0 100644 --- a/src/views/purchaseManage/purchase/index.vue +++ b/src/views/purchaseManage/purchase/index.vue @@ -1,6 +1,6 @@ <template> <div class="rightContent"> - <div class="content-box"> + <div class="content-box" v-loading="tableLoading"> <div class="supplier-search"> <SearchCommonView ref="searchCommonView" @@ -68,6 +68,7 @@ computed: {}, data() { return { + tableLoading:false, tableList: {}, // 鍒楄〃 selValueList: [], commonDetail: { @@ -162,13 +163,20 @@ signingDate:'', deliveryDate:'', remark:'', + wholeDiscountType:null, + wholeDiscount:0, + priceAdjustmentType:null, + priceAdjustment:0, + realTotalPrice:0, } }, // 缂栬緫 editClick(row){ + this.tableLoading=true getPurchaseInfo({id:row.ID}).then((res) => { if (res.code == 200) { + this.tableLoading=false this.editConfig.visible = true this.editConfig.title = "缂栬緫" this.editConfig.infomation = { @@ -180,6 +188,9 @@ this.$message.error(res.msg?res.msg+',':''+'鑾峰彇淇℃伅澶辫触锛�') } }) + setTimeout(()=>{ + this.tableLoading=false + },3000) // this.editRow = row; // this.$refs.add.islook = true; @@ -208,8 +219,10 @@ // 璇︽儏 selCommonClick(row) { console.log(row) + this.tableLoading=true getPurchaseInfo({id:row.ID}).then((res) => { if (res.code == 200) { + this.tableLoading=false this.commonDetail.visible = true this.commonDetail.infomation = { productList:res.data.productList, @@ -219,6 +232,9 @@ this.$message.error(res.msg?res.msg+',':''+'鑾峰彇淇℃伅澶辫触锛�') } }) + setTimeout(()=>{ + this.tableLoading=false + },3000) } } } diff --git a/src/views/purchaseManage/quality/index.vue b/src/views/purchaseManage/quality/index.vue index 68dc484..9aaffae 100644 --- a/src/views/purchaseManage/quality/index.vue +++ b/src/views/purchaseManage/quality/index.vue @@ -46,7 +46,7 @@ <script> import pageMixin from "@/components/makepager/pager/mixin/pageMixin" import { - getPurchaseList,getPurchaseInfo,submitPurchase, + qualityInspectList,getPurchaseInfo,submitPurchase, } from "@/api/purchaseManage/purchase"; import DetailSupplier from "@/views/purchaseManage/quality/DetailSupplier" import { getDataByType } from "@/api/data"; @@ -103,7 +103,8 @@ }, // 璇锋眰鏁版嵁 async getData() { - await getPurchaseList({ + + await qualityInspectList({ keyword: this.search, page: this.pagerOptions.currPage, pageSize: this.pagerOptions.pageSize diff --git a/vue.config.js b/vue.config.js index deb6efc..b48fa64 100644 --- a/vue.config.js +++ b/vue.config.js @@ -16,7 +16,7 @@ "/api": { // target: "http://192.168.20.118:8889", // http://192.168.20.119:8002 http://fai365.com:30150/ - // target: "http://192.168.20.120:8889", + // target: "http://192.168.20.120:8004", target: "http://192.168.20.119:8004", // http://192.168.20.119:8004 http://fai365.com:30150/ ws: true, -- Gitblit v1.8.0