diff --git a/api/Salemain.js b/api/Salemain.js index 45965b8..170d37d 100644 --- a/api/Salemain.js +++ b/api/Salemain.js @@ -82,4 +82,22 @@ export const orderReviewBack = (saleIds) => { id: saleIds } }) +} + +// 商务经理额度 +export const getManagerCreditLine = (query) => { + return request({ + method: 'post', + url: '/bussiness/salemain/getManagerCreditLine', + params: query, + }) +} + +// 大区额度 +export const getAreaCreditLine = (query) => { + return request({ + method: 'post', + url: '/bussiness/salemain/getAreaCreditLine', + params: query, + }) } \ No newline at end of file diff --git a/pages/work/BusinessApproval/OrderDetail.vue b/pages/work/BusinessApproval/OrderDetail.vue index 18cc4fe..043043a 100644 --- a/pages/work/BusinessApproval/OrderDetail.vue +++ b/pages/work/BusinessApproval/OrderDetail.vue @@ -135,6 +135,7 @@ import UniTag from "../../../uni_modules/uni-tag/components/uni-tag/uni-tag.vue" import {formatPrice} from "../../../utils/utils"; import DictSelect from "../../../components/DictSelect/DictSelect.vue"; import MBCard from "../../../components/MB/MBCard.vue"; +import {getAreaCreditLine, getManagerCreditLine} from "../../../api/Salemain"; const id = ref('') const queryParams = ref({}) @@ -147,6 +148,7 @@ onLoad((options) => { onMounted(async () => { const actionType = new Date().getDate() < 25 ? '1' : '0' + const {data} = await salemainDetailSWJL({ id: id.value, isThisMonth: actionType @@ -159,8 +161,44 @@ onMounted(async () => { actionType: actionType, goods: goods } + + // 商务经理额度 + const {data: mangerCreditLine} = await getManagerCreditLine({ + isThisMonth: actionType + }) + const manger = parseCompanyData(mangerCreditLine) + queryParams.value = { + ...queryParams.value, + budgetmoney1: manger.budgetmoney1, + CAN: manger.CAN, + } + + // 大区额度 + const {data: areaCreditLine} = await getAreaCreditLine({ + isThisMonth: actionType + }) + const area = parseCompanyData(areaCreditLine) + queryParams.value = { + ...queryParams.value, + budgetmoney_area: area.budgetmoney1, + CAN_area: area.CAN + } }) +const parseCompanyData = (data) => { + const result = {} + + Object.entries(data).forEach(([key, value]) => { + const match = key.match(/\{(\d+)=/) + if (!match) return + + const id = Number(match[1]) + result[id] = value?.[0] ?? {} + }) + + return result[queryParams.value.dept_id] +} + const handleCallBack = () => { managerRefuse({ diff --git a/utils/utils.js b/utils/utils.js index 9ad52d3..acb2144 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -1,3 +1,6 @@ export const formatPrice = (value) => { - return Number(value).toFixed(2) + return Number(value).toLocaleString('en-US', { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) } \ No newline at end of file