diff --git a/fuintAdmin/src/api/convenienceStore/purchase.js b/fuintAdmin/src/api/convenienceStore/purchase.js index b8421e9fb..d28fdc039 100644 --- a/fuintAdmin/src/api/convenienceStore/purchase.js +++ b/fuintAdmin/src/api/convenienceStore/purchase.js @@ -4,6 +4,14 @@ import request from '@/utils/request' /** * 订单 */ + +export function getPurchasePageApi(query) { + return request({ + url: '/business/convenience/mtPurchase/getListByPage', + method: 'get', + params: query + }) +} // 新增 export function addPurchaseApi(data) { return request({ diff --git a/fuintAdmin/src/router/index.js b/fuintAdmin/src/router/index.js index c50060370..b0c071dee 100644 --- a/fuintAdmin/src/router/index.js +++ b/fuintAdmin/src/router/index.js @@ -119,6 +119,14 @@ export const constantRoutes = [ ] }, + // { + // path: '/purchase/details/:PpurchaseId/:PorderDate/:PapprovalStatus', + // component: () => import('@/views/convenienceStore/purchase/details'), + // name: 'purchase-details', + // props: true, // 启用路由参数作为组件的props + // meta: { title: '', icon: 'user' } + // } + { path: '/purchase', component: Layout, @@ -126,10 +134,27 @@ export const constantRoutes = [ redirect: 'noredirect', children: [ { - path: 'details', + path: '/purchase/details/:PpurchaseId/:PorderDate/:PapprovalStatus/:orderNumber', component: () => import('@/views/convenienceStore/purchase/details'), - name: 'Profile', - meta: { title: '盘点详情', icon: 'user' } + name: 'purchase-details', + props: true, // 启用路由参数作为组件的props + meta: { title: '进货详情', icon: 'user' } + }, + ] + }, + + { + path: '/returns', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: '/returns/details/:PreturnsId/:PorderDate/:PapprovalStatus/:orderNumber', + component: () => import('@/views/convenienceStore/returns/details'), + name: 'returns-details', + props: true, // 启用路由参数作为组件的props + meta: { title: '退货详情', icon: 'user' } }, ] }, diff --git a/fuintAdmin/src/views/convenienceStore/purchase/details.vue b/fuintAdmin/src/views/convenienceStore/purchase/details.vue index e76e63a59..443bf9be2 100644 --- a/fuintAdmin/src/views/convenienceStore/purchase/details.vue +++ b/fuintAdmin/src/views/convenienceStore/purchase/details.vue @@ -89,17 +89,17 @@ @@ -228,7 +228,12 @@ import { export default { name: "details", - + props:[ + 'PpurchaseId', + 'PorderNumber', + 'PorderDate', + 'PapprovalStatus' + ], data() { return { detailsList: [], @@ -245,9 +250,9 @@ export default { isRecovery:0, }, purchaseForm: { - orderNumber: "", + orderNumber: null, approvalStatus: "", - orderDate: "", + orderDate: null, totalAmount: 0, //总金额 productQuantity: 0, //商品数量 quantityPurchased: 0 //进货数量 @@ -299,9 +304,32 @@ export default { async created() { + this.purchaseForm.purchaseId = this.$props.PpurchaseId + this.purchaseId = this.$props.PpurchaseId + this.purchaseForm.orderNumber = this.$props.PorderNumber + this.purchaseForm.orderDate = this.$props.PorderDate + this.purchaseForm.approvalStatus = this.$props.PapprovalStatus + this.state = this.$props.PapprovalStatus + + console.log("this.purchaseForm",this.purchaseForm) + + if ( this.state == null) { + this.state = 'await' + } + + if (this.state=='await') { + this.numberInput = false + }else { + this.numberInput = true + } + + if (this.purchaseForm.orderNumber == null) { this.refresh(); } + if (this.purchaseForm.orderDate == null) { + this.purchaseForm.orderDate =new Date() + } this.getDetailsList(); this.getQueryList(); @@ -312,13 +340,14 @@ export default { getPurchaseDetailsPageApi().then(res=>{ this_.detailsList = res.data.records; this.total = res.data.total; - + this.sumMethod(res.data.records); }) }, getCommodityList() { let this_ = this listLJGoods(this_.commodityForm).then(res=>{ this_.commodityList = res.data.records; + this_.sumMethod(res.data.records); // this.total = response.data.total; }) }, @@ -355,12 +384,10 @@ export default { if (flag == 3) { data.unitPrice = subtotalAmount.dividedBy(quantityPurchased); - } - // this.sumMethod(this.detailsList); - - // this.sumMethod(this.orderList) + this.sumMethod(this.detailsList); + console.log("this.detailsList",this.detailsList) // 进行保存 // this.detailsList = data // this.edit() @@ -368,27 +395,26 @@ export default { // 计算header数据 sumMethod(data) { - console.log("sumMethod",data) let this_ = this this_.purchaseForm.totalAmount = data.length - this_.purchaseForm.productQuantity = new BigNumber(0), + this_.purchaseForm.productQuantity = data.length, + this_.purchaseForm.totalAmount = new BigNumber(0), this_.purchaseForm.quantityPurchased = new BigNumber(0), + data.forEach(da => { if (da.unitPrice != null) { - this_.purchaseForm.productQuantity= this_.purchaseForm.productQuantity.plus(da.unitPrice) + this_.purchaseForm.quantityPurchased= this_.purchaseForm.quantityPurchased.plus(da.quantityPurchased) } if (da.subtotalAmount != null) { - this_.purchaseForm.quantityPurchased= this_.purchaseForm.quantityPurchased.plus(da.subtotalAmount) + this_.purchaseForm.totalAmount= this_.purchaseForm.totalAmount.plus(da.subtotalAmount) } }) }, addCommodity () { let this_ = this - - console.log("this.multipleSelection",this.multipleSelection) this.multipleSelection.forEach(mul=>{ let now = { goodsId: mul.id, @@ -404,10 +430,8 @@ export default { this_.detailsList.push(now) }) this_.open = false - console.log("this.multipleSelection",this.multipleSelection) this_.sumMethod(this_.detailsList); - }, // 查询搜索列表信息 @@ -470,12 +494,24 @@ export default { async save(){ let this_ = this + // 保存之前进行判断 + if (this_.purchaseForm.orderNumber == null) { + this.$modal.msgError("进货单号不能为空"); + return -1; + }else if (this_.purchaseForm.orderDate == null) { + this.$modal.msgError("进货时间不能为空"); + return -1; + }else if(this_.detailsList.length<=0) { + this.$modal.msgError("进货单不能为空"); + return -1; + } if (this_.purchaseId == null) { // 新增 await addPurchaseApi(this_.purchaseForm).then(res=>{ this_.purchaseId = res.data.id }).catch(res=>{ + this.$modal.msgError("保存失败"); return; }) }else { @@ -483,23 +519,28 @@ export default { this_.purchaseForm.id = this_.purchaseId await editPurchaseApi(this_.purchaseForm).then(res=> { }).catch(res=>{ + this.$modal.msgError("保存失败"); return; }) } // 批量保存订单 - console.log("::::::::::",this_.detailsList) - this_.detailsList.fill(this_.purchaseId) - console.log("**********",this_.detailsList) + + this_.detailsList.forEach(data=>{ + data.purchaseId = this_.purchaseId + }) await batchProcessingApi(this_.detailsList).then(res=>{ this.$modal.msgSuccess("保存成功"); - }).catch() + this.goToAbout(); + }).catch(res=>{ + this.$modal.msgError("保存失败"); + }) }, // 保存并审核 audit(){ // 保存 - let number = this.saveInventory(); + let number = this.save(); if (number != -1) { // 审核 let fil ={ diff --git a/fuintAdmin/src/views/convenienceStore/purchase/index.vue b/fuintAdmin/src/views/convenienceStore/purchase/index.vue index 8dd802d72..04f574e74 100644 --- a/fuintAdmin/src/views/convenienceStore/purchase/index.vue +++ b/fuintAdmin/src/views/convenienceStore/purchase/index.vue @@ -5,27 +5,27 @@ - - - - - - - - + + + - - - - - - - + + - + 搜索 @@ -58,22 +58,22 @@ v-loading="loading" :data="purchaseList" :default-sort="defaultSort"> - - - - + + + + - +