Commit 73484c65 by chenwq1

fix: 报价

1 parent d196f259
......@@ -129,15 +129,18 @@ Page({
key: "carLicense.previousOwnerAddress",
},
],
// 单次评估报价内展示的字段(评估价1、评估价2...)
priceItems: [
{ label: "评估价格", key: "evalPriceDisplay" },
{ label: "客户意向报价", key: "customerTargetPriceDisplay" },
{
label: "报价反馈",
key: "customerTargetPriceFeedback",
},
{ label: "评估意见", key: "evalOpinion" },
],
// 每一轮报价只会有一份的汇总字段
roundSummaryItems: [
{ label: "客户意向报价", key: "customerTargetPriceDisplay" },
{ label: "报价反馈", key: "customerTargetPriceFeedback" },
{ label: "评估核价", key: "evalPrice" },
{ label: "核价意见", key: "evalOpinion" },
],
editItems: [
{ label: "订单状态", key: "status" },
{ label: "编辑人员", key: "editor" },
......@@ -409,28 +412,118 @@ Page({
return image && (Array.isArray(image) ? image.length > 0 : true);
},
// 构建评估步骤数据(包含详细内容)
buildEvaluationSteps(priceHistory) {
// 从 priceHistoryByRound(按轮)扁平化为报价列表,用于步骤,只保留评估师报价(opType = 10)
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 (
!priceHistory ||
!Array.isArray(priceHistory) ||
priceHistory.length === 0
!flattenedPriceList ||
!Array.isArray(flattenedPriceList) ||
flattenedPriceList.length === 0
) {
return [];
}
return priceHistory.map((item, index) => {
// 构建步骤的描述内容
return flattenedPriceList.map((item, index) => {
const details = [];
if (item.evalPriceDisplay)
details.push(`评估价: ${item.evalPriceDisplay}`);
if (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 {
text: `第${index + 1}次评估`,
desc: item.evalTime || "-",
desc: item.quoteTime || item.evalTime || "-",
details: details.join(" | "),
data: item,
};
......@@ -1050,8 +1143,11 @@ Page({
const detailsInfo = res.data.data;
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;
}
if (detailsInfo.paymentList && detailsInfo.paymentList.length > 0) {
......@@ -1077,15 +1173,17 @@ Page({
tabs.find((i) => i.key === "delivery").hidden = false;
}
// 构建评估步骤数据
const evaluationSteps = that.buildEvaluationSteps(
detailsInfo.priceHistory
// 从按轮报价扁平化为报价列表,构建步骤数据
const flattenedPriceList = that.getFlattenedPriceHistory(
detailsInfo.priceHistoryByRound
);
const evaluationSteps = that.buildEvaluationSteps(flattenedPriceList);
// 构建时间轴数据
const evaluationTimelineItems = that.buildTimelineItems(
detailsInfo.priceHistory
);
// 构建评估时间轴数据:一轮一个卡片,卡片内展示当前轮的多次评估价
const evaluationTimelineItems =
that.buildEvaluationTimelineItemsByRound(
detailsInfo.priceHistoryByRound
);
const editLogTimelineItems = that.buildTimelineItems(
detailsInfo.editLogList
);
......
......@@ -580,14 +580,34 @@
<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="编辑记录">
<view class="timelineBox">
<block wx:for="{{priceItems}}" wx:key="itemIdx" wx:for-item="item" wx:for-index="itemIdx">
<view class="flex align-start mb-16 {{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) }}
<!-- 一轮报价下的多次评估价:仅展示评估师报价(opType = 10) -->
<block wx:for="{{history.priceHistoryList}}" wx:key="itemIdx" wx:for-item="price" wx:for-index="itemIdx">
<block wx:if="{{price.opType == 10}}">
<!-- 每一个 price 对应“评估价1 / 评估价2 ...” -->
<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>
</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>
</timeline>
</block>
......
......@@ -222,6 +222,7 @@ Page({
handleDetail(e) {
let { value } = e.currentTarget.dataset
if (value.reportUrl && value.status == 1) {
// 直接跳转 H5,由右上角菜单分享
wx.$router.jumpH5(value.reportUrl)
}
},
......
......@@ -74,6 +74,11 @@ Page({
url: decodeUrl
})
wx.hideLoading()
// 开启右上角分享能力
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
// 跳转到智能体后添加返回拦截
if (param.needIntercept) {
wx.enableAlertBeforeUnload &&
......@@ -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> -->
<block wx:if="{{flag}}">
<web-view src="{{url}}" bindmessage="handleMessage"></web-view>
<web-view src="{{url}}" bindmessage="handleMessage"></web-view>
</block>
\ No newline at end of file
{
"projectname": "%E7%B2%BE%E5%93%81%E5%8D%87%E7%BA%A7",
"compileType": "miniprogram",
"libVersion": "3.13.1",
"packOptions": {
"ignore": [
{
"value": ".vscode",
"type": "folder"
}
],
"include": []
},
"setting": {
"urlCheck": false,
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"ignoreUploadUnusedFiles": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useCompilerPlugins": [
"sass"
],
"ignoreDevUnusedFiles": false,
"minifyWXML": true,
"compileWorklet": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"packNpmManually": false,
"minifyWXSS": true,
"localPlugins": false,
"disableUseStrict": false,
"condition": false,
"swc": false,
"disableSWC": true
},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"appid": "wx570d9331f9ace0bd",
"simulatorPluginLibVersion": {}
{
"projectname": "%E7%B2%BE%E5%93%81%E5%8D%87%E7%BA%A7",
"compileType": "miniprogram",
"libVersion": "3.13.1",
"packOptions": {
"ignore": [
{
"value": ".vscode",
"type": "folder"
}
],
"include": []
},
"setting": {
"urlCheck": false,
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"ignoreUploadUnusedFiles": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useCompilerPlugins": [
"sass"
],
"ignoreDevUnusedFiles": false,
"minifyWXML": true,
"compileWorklet": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"packNpmManually": false,
"minifyWXSS": true,
"localPlugins": false,
"disableUseStrict": false,
"condition": false,
"swc": false,
"disableSWC": true
},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"appid": "wx570d9331f9ace0bd",
"simulatorPluginLibVersion": {}
}
\ 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!