Commit 73484c65 by chenwq1

fix: 报价

1 parent d196f259
...@@ -129,15 +129,18 @@ Page({ ...@@ -129,15 +129,18 @@ Page({
key: "carLicense.previousOwnerAddress", key: "carLicense.previousOwnerAddress",
}, },
], ],
// 单次评估报价内展示的字段(评估价1、评估价2...)
priceItems: [ priceItems: [
{ label: "评估价格", key: "evalPriceDisplay" }, { label: "评估价格", key: "evalPriceDisplay" },
{ label: "客户意向报价", key: "customerTargetPriceDisplay" },
{
label: "报价反馈",
key: "customerTargetPriceFeedback",
},
{ label: "评估意见", key: "evalOpinion" }, { label: "评估意见", key: "evalOpinion" },
], ],
// 每一轮报价只会有一份的汇总字段
roundSummaryItems: [
{ label: "客户意向报价", key: "customerTargetPriceDisplay" },
{ label: "报价反馈", key: "customerTargetPriceFeedback" },
{ label: "评估核价", key: "evalPrice" },
{ label: "核价意见", key: "evalOpinion" },
],
editItems: [ editItems: [
{ label: "订单状态", key: "status" }, { label: "订单状态", key: "status" },
{ label: "编辑人员", key: "editor" }, { label: "编辑人员", key: "editor" },
...@@ -409,28 +412,118 @@ Page({ ...@@ -409,28 +412,118 @@ Page({
return image && (Array.isArray(image) ? image.length > 0 : true); return image && (Array.isArray(image) ? image.length > 0 : true);
}, },
// 构建评估步骤数据(包含详细内容) // 从 priceHistoryByRound(按轮)扁平化为报价列表,用于步骤,只保留评估师报价(opType = 10)
buildEvaluationSteps(priceHistory) { getFlattenedPriceHistory(priceHistoryByRound) {
if (
!priceHistoryByRound ||
!Array.isArray(priceHistoryByRound) ||
priceHistoryByRound.length === 0
) {
return [];
}
const list = [];
priceHistoryByRound.forEach((round) => {
const arr = round.priceHistoryList;
if (Array.isArray(arr)) {
arr.forEach((item) => {
// 只保留评估师报价
if (item.opType === 10) {
list.push({ ...item, roundNo: round.roundNo });
}
});
}
});
return list;
},
// 构建按轮的时间轴数据:一条 timelineItem = 一轮报价,内部再展示该轮的多次评估价(priceHistoryList)
buildEvaluationTimelineItemsByRound(priceHistoryByRound) {
if (
!priceHistoryByRound ||
!Array.isArray(priceHistoryByRound) ||
priceHistoryByRound.length === 0
) {
return [];
}
return priceHistoryByRound.map((round) => {
const priceList = Array.isArray(round.priceHistoryList)
? round.priceHistoryList
: [];
// 设计稿右上角时间:取当前轮最后一次报价时间
let time = "-";
// 一轮内只有一份的客户意向报价 / 报价反馈 / 核价信息(根据 opType 汇总)
let customerTargetPriceDisplay = "";
let customerTargetPriceFeedback = "";
let auditEvalPrice = "";
let auditEvalOpinion = "";
if (priceList.length > 0) {
priceList.forEach((item, idx) => {
const currentTime = item.quoteTime || item.evalTime || "-";
if (idx === priceList.length - 1) {
time = currentTime;
}
// 20 客户报价:汇总客户意向报价与反馈
if (item.opType === 20) {
if (item.customerTargetPriceDisplay) {
customerTargetPriceDisplay = item.customerTargetPriceDisplay;
}
if (item.customerTargetPriceFeedback) {
customerTargetPriceFeedback = item.customerTargetPriceFeedback;
}
}
// 40 核价 / 50 核价驳回:汇总核价金额与意见(以最后一次为准)
if (item.opType === 40 || item.opType === 50) {
if (item.evalPriceDisplay) {
auditEvalPrice = item.evalPriceDisplay;
}
if (item.evalOpinion) {
auditEvalOpinion = item.evalOpinion;
}
}
});
}
return {
...round,
priceHistoryList: priceList,
time,
// 一轮只展示一份的字段
customerTargetPriceDisplay,
customerTargetPriceFeedback,
evalPrice: auditEvalPrice,
evalOpinion: auditEvalOpinion,
};
});
},
// 构建评估步骤数据(包含详细内容),入参为扁平报价列表
buildEvaluationSteps(flattenedPriceList) {
if ( if (
!priceHistory || !flattenedPriceList ||
!Array.isArray(priceHistory) || !Array.isArray(flattenedPriceList) ||
priceHistory.length === 0 flattenedPriceList.length === 0
) { ) {
return []; return [];
} }
return priceHistory.map((item, index) => { return flattenedPriceList.map((item, index) => {
// 构建步骤的描述内容
const details = []; const details = [];
if (item.evalPriceDisplay) if (item.evalPriceDisplay)
details.push(`评估价: ${item.evalPriceDisplay}`); details.push(`评估价: ${item.evalPriceDisplay}`);
if (item.customerTargetPriceDisplay) if (item.customerTargetPriceDisplay)
details.push(`意向报价: ${item.customerTargetPriceDisplay}`); details.push(`意向报价: ${item.customerTargetPriceDisplay}`);
if (item.evaluator) details.push(`评估人: ${item.evaluator}`); if (item.evaluator || item.createdBy)
details.push(`评估人: ${item.evaluator || item.createdBy}`);
return { return {
text: `第${index + 1}次评估`, text: `第${index + 1}次评估`,
desc: item.evalTime || "-", desc: item.quoteTime || item.evalTime || "-",
details: details.join(" | "), details: details.join(" | "),
data: item, data: item,
}; };
...@@ -1050,8 +1143,11 @@ Page({ ...@@ -1050,8 +1143,11 @@ Page({
const detailsInfo = res.data.data; const detailsInfo = res.data.data;
const tabs = [...that.data.tabs]; const tabs = [...that.data.tabs];
// 判断评估信息 // 判断评估信息(按轮报价)
if (detailsInfo.priceHistory && detailsInfo.priceHistory.length > 0) { if (
detailsInfo.priceHistoryByRound &&
detailsInfo.priceHistoryByRound.length > 0
) {
tabs.find((i) => i.key === "evaluation").hidden = false; tabs.find((i) => i.key === "evaluation").hidden = false;
} }
if (detailsInfo.paymentList && detailsInfo.paymentList.length > 0) { if (detailsInfo.paymentList && detailsInfo.paymentList.length > 0) {
...@@ -1077,15 +1173,17 @@ Page({ ...@@ -1077,15 +1173,17 @@ Page({
tabs.find((i) => i.key === "delivery").hidden = false; tabs.find((i) => i.key === "delivery").hidden = false;
} }
// 构建评估步骤数据 // 从按轮报价扁平化为报价列表,构建步骤数据
const evaluationSteps = that.buildEvaluationSteps( const flattenedPriceList = that.getFlattenedPriceHistory(
detailsInfo.priceHistory detailsInfo.priceHistoryByRound
); );
const evaluationSteps = that.buildEvaluationSteps(flattenedPriceList);
// 构建时间轴数据 // 构建评估时间轴数据:一轮一个卡片,卡片内展示当前轮的多次评估价
const evaluationTimelineItems = that.buildTimelineItems( const evaluationTimelineItems =
detailsInfo.priceHistory that.buildEvaluationTimelineItemsByRound(
); detailsInfo.priceHistoryByRound
);
const editLogTimelineItems = that.buildTimelineItems( const editLogTimelineItems = that.buildTimelineItems(
detailsInfo.editLogList detailsInfo.editLogList
); );
......
...@@ -580,14 +580,34 @@ ...@@ -580,14 +580,34 @@
<block wx:for="{{evaluationTimelineItems}}" wx:key="index" wx:for-item="history" wx:for-index="idx"> <block wx:for="{{evaluationTimelineItems}}" wx:key="index" wx:for-item="history" wx:for-index="idx">
<timeline item="{{history}}" index="{{idx}}" isLast="{{idx === evaluationTimelineItems.length - 1}}" lastItemTitle="首次提交" defaultTitle="编辑记录"> <timeline item="{{history}}" index="{{idx}}" isLast="{{idx === evaluationTimelineItems.length - 1}}" lastItemTitle="首次提交" defaultTitle="编辑记录">
<view class="timelineBox"> <view class="timelineBox">
<block wx:for="{{priceItems}}" wx:key="itemIdx" wx:for-item="item" wx:for-index="itemIdx"> <!-- 一轮报价下的多次评估价:仅展示评估师报价(opType = 10) -->
<view class="flex align-start mb-16 {{item.fullWidth ? 'full-width' : ''}}"> <block wx:for="{{history.priceHistoryList}}" wx:key="itemIdx" wx:for-item="price" wx:for-index="itemIdx">
<view class="title-label-see mr-16">{{ item.label }}</view> <block wx:if="{{price.opType == 10}}">
<view class="flex-1 break-word text-content"> <!-- 每一个 price 对应“评估价1 / 评估价2 ...” -->
{{ utils.getValueByPath(history, item.key) }} <view class="mb-16">
<view class="title-label-see mb-8">评估价{{itemIdx + 1}}</view>
<block wx:for="{{priceItems}}" wx:key="fieldIdx" wx:for-item="item" wx:for-index="fieldIdx">
<view class="flex align-start mb-8 {{item.fullWidth ? 'full-width' : ''}}">
<view class="title-label-see mr-16">{{ item.label }}</view>
<view class="flex-1 break-word text-content">
{{ utils.getValueByPath(price, item.key) }}
</view>
</view>
</block>
</view> </view>
</view> </block>
</block> </block>
<!-- 一轮只展示一次的字段:客户意向报价 / 报价反馈 / 评估核价 / 核价意见 -->
<view class="mt-16">
<block wx:for="{{roundSummaryItems}}" wx:key="roundIdx" wx:for-item="item" wx:for-index="roundIdx">
<view class="flex align-start mb-8 {{item.fullWidth ? 'full-width' : ''}}">
<view class="title-label-see mr-16">{{ item.label }}</view>
<view class="flex-1 break-word text-content">
{{ utils.getValueByPath(history, item.key) }}
</view>
</view>
</block>
</view>
</view> </view>
</timeline> </timeline>
</block> </block>
......
...@@ -222,6 +222,7 @@ Page({ ...@@ -222,6 +222,7 @@ Page({
handleDetail(e) { handleDetail(e) {
let { value } = e.currentTarget.dataset let { value } = e.currentTarget.dataset
if (value.reportUrl && value.status == 1) { if (value.reportUrl && value.status == 1) {
// 直接跳转 H5,由右上角菜单分享
wx.$router.jumpH5(value.reportUrl) wx.$router.jumpH5(value.reportUrl)
} }
}, },
......
...@@ -74,6 +74,11 @@ Page({ ...@@ -74,6 +74,11 @@ Page({
url: decodeUrl url: decodeUrl
}) })
wx.hideLoading() wx.hideLoading()
// 开启右上角分享能力
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
// 跳转到智能体后添加返回拦截 // 跳转到智能体后添加返回拦截
if (param.needIntercept) { if (param.needIntercept) {
wx.enableAlertBeforeUnload && wx.enableAlertBeforeUnload &&
...@@ -198,5 +203,25 @@ Page({ ...@@ -198,5 +203,25 @@ Page({
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () {} onReachBottom: function () {},
// 右上角“转发”分享
onShareAppMessage() {
const { url } = this.data
const encoded = encodeURIComponent(url || '')
return {
title: '报告详情',
path: `/pages/webView/webView?url=${encoded}`
}
},
// 右上角“朋友圈”分享
onShareTimeline() {
const { url } = this.data
const encoded = encodeURIComponent(url || '')
return {
title: '报告详情',
query: `url=${encoded}`
}
}
}) })
<!-- <web-view src="{{url}}"></web-view> --> <!-- <web-view src="{{url}}"></web-view> -->
<block wx:if="{{flag}}"> <block wx:if="{{flag}}">
<web-view src="{{url}}" bindmessage="handleMessage"></web-view> <web-view src="{{url}}" bindmessage="handleMessage"></web-view>
</block> </block>
\ No newline at end of file \ No newline at end of file
{ {
"projectname": "%E7%B2%BE%E5%93%81%E5%8D%87%E7%BA%A7", "projectname": "%E7%B2%BE%E5%93%81%E5%8D%87%E7%BA%A7",
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "3.13.1", "libVersion": "3.13.1",
"packOptions": { "packOptions": {
"ignore": [ "ignore": [
{ {
"value": ".vscode", "value": ".vscode",
"type": "folder" "type": "folder"
} }
], ],
"include": [] "include": []
}, },
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"coverView": true, "coverView": true,
"es6": true, "es6": true,
"postcss": true, "postcss": true,
"minified": true, "minified": true,
"enhance": true, "enhance": true,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"packNpmRelationList": [], "packNpmRelationList": [],
"ignoreUploadUnusedFiles": true, "ignoreUploadUnusedFiles": true,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"useCompilerPlugins": [ "useCompilerPlugins": [
"sass" "sass"
], ],
"ignoreDevUnusedFiles": false, "ignoreDevUnusedFiles": false,
"minifyWXML": true, "minifyWXML": true,
"compileWorklet": false, "compileWorklet": false,
"uglifyFileName": false, "uglifyFileName": false,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"packNpmManually": false, "packNpmManually": false,
"minifyWXSS": true, "minifyWXSS": true,
"localPlugins": false, "localPlugins": false,
"disableUseStrict": false, "disableUseStrict": false,
"condition": false, "condition": false,
"swc": false, "swc": false,
"disableSWC": true "disableSWC": true
}, },
"editorSetting": { "editorSetting": {
"tabIndent": "insertSpaces", "tabIndent": "insertSpaces",
"tabSize": 2 "tabSize": 2
}, },
"appid": "wx570d9331f9ace0bd", "appid": "wx570d9331f9ace0bd",
"simulatorPluginLibVersion": {} "simulatorPluginLibVersion": {}
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!