From 9d4f45939870dde9b59d354616d87536d6274ef1 Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期三, 03 九月 2025 18:30:07 +0800 Subject: [PATCH] 修改交易员确认 --- src/views/tradeManage/confirm/index.vue | 101 ++++++++++++++++++++++++++++++++++---------------- 1 files changed, 69 insertions(+), 32 deletions(-) diff --git a/src/views/tradeManage/confirm/index.vue b/src/views/tradeManage/confirm/index.vue index 0a0506b..0392ee4 100644 --- a/src/views/tradeManage/confirm/index.vue +++ b/src/views/tradeManage/confirm/index.vue @@ -240,6 +240,8 @@ import pointsApi from '@/api/pointsApi' // 鏂板绉垎API瀵煎叆 import { useUserInfo } from '@/stores/modules/userInfo' import createAxios from '@/utils/axios' +import productApi from '@/api/productApi' +import sysUserService from '@/api/sysUser' const route = useRoute() const router = useRouter() @@ -300,6 +302,39 @@ const statusName: string = data.orderStatus || '' const uiStatus = statusServerToUi[statusName] || 'INFO' + // 鏍规嵁浜у搧id鑾峰彇浜у搧淇℃伅锛屾洿鏂板ご閮ㄥ睍绀� + try { + if (data.productId) { + const detailRes: any = await productApi.getProductById({ id: data.productId }) + if (detailRes?.code === 200 && detailRes.data) { + // 鐢ㄤ骇鍝佽鎯呰ˉ鍏ㄥご淇℃伅 + data.productName = detailRes.data.name || data.productName + data.providerName = detailRes.data.submissionUnit || data.providerName + data.industry = detailRes.data.industrialChainName || data.industry + data.productDesc = detailRes.data.describe || data.productDesc + data.projectUnit = detailRes.data.importantAreaName || data.productDesc + data.productType = detailRes.data.typeName || data.productDesc + } + } + } catch (e) { + // 蹇界暐浜у搧璇︽儏澶辫触锛屼笉闃诲璁㈠崟璇︽儏 + } + + // 鑾峰彇鐢ㄦ埛淇℃伅 + try { + const userRes: any = await sysUserService.getUserdetail({ userId: data.userId }) + if (userRes?.code === 200 && userRes.data) { + // 鐢ㄤ骇鍝佽鎯呰ˉ鍏ㄥご淇℃伅 + data.unitName = userRes.data.unitName || data.unitName + data.userName = userRes.data.name || data.userName + data.userDept = userRes.data.departmentName || data.userDept + data.userPhone = userRes.data.phone || data.userPhone + data.userAccount = userRes.data.username || data.userAccount + } + }catch (e){ + + } + // 鏄犲皠璁㈠崟璇︽儏澶撮儴淇℃伅 const head = { orderNo: data.orderId, @@ -318,6 +353,7 @@ projectUnit: data.projectUnit || '-', productType: data.productType || '-', productDesc: data.productDesc || '-', + providerId: data.providerId || '' } // 鏄庣粏椤规槧灏� @@ -405,37 +441,37 @@ // 妫�鏌ヨ鍗曟槸鍚︽秹鍙婄Н鍒嗘墸鍑� const hasPointsDeduction = detail.items && detail.items.some((item: any) => Number(item.pricePoint || 0) > 0) - if (hasPointsDeduction) { - // 璁$畻闇�瑕佹墸鍑忕殑绉垎鎬婚 - const totalPointsToDeduct = detail.items.reduce((sum: number, item: any) => { - return sum + (Number(item.pricePoint || 0) * Number(item.quantity || 0)) - }, 0) - - if (totalPointsToDeduct > 0) { - // 鑾峰彇褰撳墠鐢ㄦ埛绉垎浣欓 - try { - const userPointsRes = await pointsApi.getUserPoints(userId) - if (userPointsRes.code !== 200 || !userPointsRes.data) { - ElMessage.error('鑾峰彇绉垎浣欓澶辫触') - return - } - - const currentPoints = userPointsRes.data.balance || 0 - - if (currentPoints < totalPointsToDeduct) { - ElMessage.error(`绉垎浣欓涓嶈冻锛佸綋鍓嶇Н鍒嗭細${currentPoints.toLocaleString()}锛岄渶瑕佺Н鍒嗭細${totalPointsToDeduct.toLocaleString()}`) - return - } - - // 绉垎浣欓鍏呰冻锛岀户缁墽琛� - console.log(`绉垎浣欓妫�鏌ラ�氳繃锛氬綋鍓�${currentPoints}锛岄渶瑕�${totalPointsToDeduct}`) - } catch (error) { - console.error('鑾峰彇绉垎浣欓澶辫触:', error) - ElMessage.error('鑾峰彇绉垎浣欓澶辫触锛岃閲嶈瘯') - return - } - } - } + // if (hasPointsDeduction) { + // // 璁$畻闇�瑕佹墸鍑忕殑绉垎鎬婚 + // const totalPointsToDeduct = detail.items.reduce((sum: number, item: any) => { + // return sum + (Number(item.pricePoint || 0) * Number(item.quantity || 0)) + // }, 0) + // + // if (totalPointsToDeduct > 0) { + // // 鑾峰彇褰撳墠鐢ㄦ埛绉垎浣欓 + // try { + // const userPointsRes = await pointsApi.getUserPoints(userId) + // if (userPointsRes.code !== 200 || !userPointsRes.data) { + // ElMessage.error('鑾峰彇绉垎浣欓澶辫触') + // return + // } + // + // const currentPoints = userPointsRes.data.balance || 0 + // + // if (currentPoints < totalPointsToDeduct) { + // ElMessage.error(`绉垎浣欓涓嶈冻锛佸綋鍓嶇Н鍒嗭細${currentPoints.toLocaleString()}锛岄渶瑕佺Н鍒嗭細${totalPointsToDeduct.toLocaleString()}`) + // return + // } + // + // // 绉垎浣欓鍏呰冻锛岀户缁墽琛� + // console.log(`绉垎浣欓妫�鏌ラ�氳繃锛氬綋鍓�${currentPoints}锛岄渶瑕�${totalPointsToDeduct}`) + // } catch (error) { + // console.error('鑾峰彇绉垎浣欓澶辫触:', error) + // ElMessage.error('鑾峰彇绉垎浣欓澶辫触锛岃閲嶈瘯') + // return + // } + // } + // } // 纭鎿嶄綔 await ElMessageBox.confirm('纭畾瑕佺‘璁や氦鏄擄紵', '纭鎿嶄綔', { @@ -465,7 +501,8 @@ totalPointsToDeduct, orderId, productNames || '璁㈠崟浜ゆ槗鎵e噺绉垎', // 浣跨敤浜у搧鍚嶇О浣滀负澶囨敞 - '绉垎浜ゆ槗' // 鏁版嵁绫诲埆 + '绉垎浜ゆ槗', // 鏁版嵁绫诲埆 + detail.providerId ) if (!deductRes || deductRes.code !== 200) { ElMessage.error(deductRes?.msg || deductRes?.message || '绉垎鎵e噺澶辫触锛屼氦鏄撶‘璁ょ粓姝�') -- Gitblit v1.8.0