diff --git a/src/components/approval/detail.vue b/src/components/approval/detail.vue index c5532bd..ef8b107 100644 --- a/src/components/approval/detail.vue +++ b/src/components/approval/detail.vue @@ -16,78 +16,158 @@ - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - {{ itemInfo.remark }} - - - {{ itemInfo.late_delivery_explanation }} - - -
- 总预计订单金额(元):{{ sumData.total_amount || '0.00' }}, - 总预付款(元):{{ sumData.pre_pay_amount || '0.00' }}, - 总尾款(元):{{ sumData.balance_amount || '0.00' }} +
+
+
{{approvalType[item.type]}}   + +
+ + + +
- -
其余信息
- - {{ itemInfo.sold_start_time }} - - - {{ itemInfo.arrived_time }} - - - {{ itemInfo.warehouse_name }} - +
-

{{it.type == 1 ? '采购订单' : it.type == 2 ? '预付款打款' : '尾款打款'}}

+
{{it.type == 1 ? '采购订单' : it.type == 2 ? '预付款打款' : '尾款打款'}}
申请打款金额:{{it.amount}}元
@@ -123,6 +203,10 @@ export default { id: { type: Number, default: 0, + }, + type: { + type: Number, + default: 0, } }, setup(props, context) { @@ -135,39 +219,86 @@ export default { loading: false, goodsList: [], itemInfo: {}, - feesList: [], - sumData: {} + sumData: {}, + logsList: [], + approvalType: { + '1': '采购订单审批', + '2': '', + '3': '尾款打款审批' + }, + Type: 1 }) - function getDetail() { + async function getDetail() { data.loading = true - get(`/api/purchaseOrder/${props.id}`).then((res) => { + await get(`/api/purchaseOrder/${props.id}`).then((res) => { data.itemInfo = res.data - data.feesList = res.data.other_expenses - let num1 = 0, num2 = 0 - res.data.products.forEach((item) => { + data.goodsList = res.data.products + res.data.products.forEach((item, index) => { if(item.expect_unit_price && item.expect_quantity) { item.estimated_order_amount = (item.expect_unit_price * item.expect_quantity).toFixed(2) if(item.prepayment_ratio) { item.advance_payment = ((item.estimated_order_amount * item.prepayment_ratio) / 100).toFixed(2) item.balance_payment = (((item.estimated_order_amount * 100) - (item.advance_payment * 100)) / 100).toFixed(2) } - num1 += item.expect_unit_price * item.expect_quantity - if(item.prepayment_ratio) { - num2 += num1 * item.prepayment_ratio - } } }) - data.sumData.total_amount = num1.toFixed(2) - data.sumData.pre_pay_amount = (num2 / 100).toFixed(2) - data.sumData.balance_amount = (((data.sumData.total_amount * 100) - (data.sumData.pre_pay_amount * 100)) / 100).toFixed(2) - data.goodsList = res.data.products data.loading = false }).catch(() => { data.loading = false }) } + function getLogsList() { + get(`/api/purchaseOrder/orderInstanceList`, {purchase_order_id: props.id}).then((res) => { + res.data.forEach((itm) => { + if(itm.extend && itm.extend.purchaseOrder) { + let num1 = 0, num2 = 0, total_num = 0, total = 0 + itm.extend.purchaseOrder.products.forEach((item, index) => { + if(item.expect_unit_price && item.expect_quantity) { + item.estimated_order_amount = (item.expect_unit_price * item.expect_quantity).toFixed(2) + if(item.prepayment_ratio) { + item.advance_payment = ((item.estimated_order_amount * item.prepayment_ratio) / 100).toFixed(2) + item.balance_payment = (((item.estimated_order_amount * 100) - (item.advance_payment * 100)) / 100).toFixed(2) + } + num1 += item.expect_unit_price * item.expect_quantity * 100 + if(item.prepayment_ratio) { + num2 += num1 * item.prepayment_ratio + } + } + if(itm.type == 3) { + item.apply_amount = itm.extend.products[index].apply_amount + item.real_quantity = itm.extend.products[index].real_quantity + item.real_unit_price = itm.extend.products[index].real_unit_price + let real_amount = item.real_unit_price * item.real_quantity + total += real_amount * 100 + total_num += item.apply_amount * 100 + } + item.goods_title = data.goodsList[index] && data.goodsList[index].goods && data.goodsList[index].goods.title + item.sku_title = data.goodsList[index] && data.goodsList[index].sku && data.goodsList[index].sku.title + }) + itm.extend.purchaseOrder.other_expenses.forEach((item, index) => { + if(item.batch_number == itm.batch_number) { + total_num += item.amount * 100 + total += item.amount * 100 + + if(item.amount * 1 > 0) { + num1 += item.amount * 100 + num2 += item.amount * 10000 + } + } + }) + itm.apply_total_amount = (total_num / 100).toFixed(2) + itm.real_total_amount = (total / 100).toFixed(2) + itm.total_amount = (num1 / 100).toFixed(2) + itm.pre_pay_amount = (num2 / 10000).toFixed(2) + itm.balance_amount = (((itm.total_amount * 100) - (itm.pre_pay_amount * 100)) / 100).toFixed(2) + } + }) + data.logsList = res.data + }) + } + function getCompany() { get(`/api/company/all`, {page: 1, pageSize: 1000}).then((res) => { data.companyList = res.data @@ -192,9 +323,19 @@ export default { }) } - watch(() => props, (newProps) => { + function filteredData(list, row) { + if(list) { + return list.filter(item => item.batch_number == row.batch_number) + } else { + return [] + } + } + + watch(() => props, async (newProps) => { if (newProps.show) { - getDetail() + data.Type = newProps.type + await getDetail() + getLogsList() getCompany() getManagerList() getSupplier() @@ -208,7 +349,9 @@ export default { getManagerList, getSupplier, getDetail, - getAccount + getAccount, + getLogsList, + filteredData } } } @@ -221,6 +364,11 @@ export default { background-size: 80px; margin-bottom: 20px; } + .block{ + height: 1px; + border-top: 1px dashed #999; + margin-bottom: 10px; + } .icon-bohui{ color: #f00; margin-right: 5px; @@ -237,4 +385,19 @@ export default { margin-right: 10px; } } + .h1Tit{ + padding: 10px 12px; + border-left: 4px solid #409eff; + background-color: rgb(236, 245, 255); + margin-bottom: 10px; + } + .huibox{ + background-color: #f5f5f5; + padding: 15px; + line-height: 30px; + margin-bottom: 20px; + } + .blue{ + color: #1989fa; + } \ No newline at end of file diff --git a/src/components/approval/prepayment.vue b/src/components/approval/prepayment.vue index 2ed8628..dfa61bf 100644 --- a/src/components/approval/prepayment.vue +++ b/src/components/approval/prepayment.vue @@ -1,6 +1,6 @@