Commit acbda2df by wangzhihui

Merge branch 'SAAS+V5.7.1' of http://192.168.3.233:8090/saas_plus/dj-car-boutiqu…

…e-work-wechat into SAAS+V5.7.1
2 parents b2b02dbd f007ef98
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import newApi from '~/packageUsedCar/api' import newApi from '~/packageUsedCar/api'
import { setConfigInfo } from '~/store/index' import { setConfigInfo } from '~/store/index'
const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/" const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/"
import { checkDailyReport } from "~/packageUsedCar/ModalToQueueUsedCarControl";
function throttle(func, delay) { function throttle(func, delay) {
let timeoutId; let timeoutId;
let lastExecTime = 0; let lastExecTime = 0;
...@@ -86,6 +87,11 @@ Component({ ...@@ -86,6 +87,11 @@ Component({
}, { }, {
menuText: "检测管理", menuText: "检测管理",
icon: "crowdFunding/report" icon: "crowdFunding/report"
}, {
menuText: "车况信息",
icon: "usedCar/vehicle-message",
checkReport: true,
getOpenId: true
}], }],
current: 0, current: 0,
itemDataList: [{ itemDataList: [{
...@@ -115,6 +121,7 @@ Component({ ...@@ -115,6 +121,7 @@ Component({
try { try {
const config = await setConfigInfo(app.globalData) const config = await setConfigInfo(app.globalData)
const reportWebview = config?.report_webview const reportWebview = config?.report_webview
const vehicleWebView = config?.vehicle_webview
if (reportWebview) { if (reportWebview) {
const raw = String(reportWebview).trim().replace(/\/+$/, '') const raw = String(reportWebview).trim().replace(/\/+$/, '')
const hasHomePath = /\/home(?:[?#]|$)/.test(raw) const hasHomePath = /\/home(?:[?#]|$)/.test(raw)
...@@ -130,7 +137,7 @@ Component({ ...@@ -130,7 +137,7 @@ Component({
} }
console.log('[report_webview] raw:', reportWebview, '=> final:', webviewUrl) console.log('[report_webview] raw:', reportWebview, '=> final:', webviewUrl)
menuList = menuList.map(item => menuList = menuList.map(item =>
item.menuText === '检测管理' ? { ...item, webviewUrl } : item item.menuText === '检测管理' ? { ...item, webviewUrl } : item.menuText === '车况信息' ? { ...item, webviewUrl: `${vehicleWebView}/vehicle-list` } : item
) )
} }
} catch (e) { } catch (e) {
...@@ -179,6 +186,14 @@ Component({ ...@@ -179,6 +186,14 @@ Component({
this.getStatic() this.getStatic()
}) })
}, },
buildQuery(params) {
if (!params) return ''
return Object.keys(params)
.map(key => {
return `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`;
})
.join('&')
},
navGo: throttle(async function (e) { navGo: throttle(async function (e) {
let { item, h5Url } = e.currentTarget.dataset let { item, h5Url } = e.currentTarget.dataset
const webviewUrl = (h5Url && String(h5Url).trim()) || item.webviewUrl const webviewUrl = (h5Url && String(h5Url).trim()) || item.webviewUrl
...@@ -188,12 +203,58 @@ Component({ ...@@ -188,12 +203,58 @@ Component({
wx.$util.hideLoading() wx.$util.hideLoading()
if (!res.data.data) return wx.$util.showToast('功能暂未开放') if (!res.data.data) return wx.$util.showToast('功能暂未开放')
} }
if (item.checkReport) {
// 校验是否填写日报
wx.$util.showLoading()
let staffCheck = await checkDailyReport(7)
wx.$util.hideLoading()
if (staffCheck) return
}
if (item.webviewUrl) { if (item.webviewUrl) {
if (item.getOpenId) {
let openId = wx.$util.getOpenId()
let sessionId = wx.$util.getSessionId()
let userInfo = wx.$util.getUserInfo()
const queryObj = {
source: 2,
openId: openId,
sessionId: sessionId,
phone: userInfo.phone,
operator: userInfo.name,
operatorId: userInfo.uuid,
conversionUserId: userInfo.uuid,
conversionName: userInfo.name,
conversionMerchantId: userInfo.merchantId,
conversionMerchantName: userInfo.merchantName,
merchantId: userInfo.shopMerchantId,
merchantName: userInfo.shopMerchantName
};
const queryString = this.buildQuery(queryObj)
const finalPath = `${item.webviewUrl}?${queryString}`
return wx.requestSubscribeMessage({
tmplIds: ["MgjDgIpo1Xm8keYIUUtVbMbMj-Ms4q-xfbk7kM-L8EE"],
success(res) {
// wx.showToast({
// title: "订阅成功",
// icon: "none",
// });
return wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(finalPath)}`,
})
},
fail(res) {
return wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(finalPath)}`,
})
}
})
} else {
const targetUrl = `/pages/webView/h5Full?url=${encodeURIComponent(item.webviewUrl)}` const targetUrl = `/pages/webView/h5Full?url=${encodeURIComponent(item.webviewUrl)}`
console.log('[navGo] webviewUrl:', item.webviewUrl, '=> navigateTo:', targetUrl) console.log('[navGo] webviewUrl:', item.webviewUrl, '=> navigateTo:', targetUrl)
wx.navigateTo({ url: targetUrl }) wx.navigateTo({ url: targetUrl })
return return
} }
}
if (!item.path) { if (!item.path) {
return wx.$util.showToast('功能暂不可用') return wx.$util.showToast('功能暂不可用')
} }
......
...@@ -9,7 +9,8 @@ export function createWebViewPage(sharePagePath) { ...@@ -9,7 +9,8 @@ export function createWebViewPage(sharePagePath) {
return { return {
data: { data: {
flag: true, flag: true,
isH5Bind: false isH5Bind: false,
shareTitle: '报告详情'
}, },
getBaseUrl(url) { getBaseUrl(url) {
...@@ -84,6 +85,13 @@ export function createWebViewPage(sharePagePath) { ...@@ -84,6 +85,13 @@ export function createWebViewPage(sharePagePath) {
}) })
this.setTime(param) this.setTime(param)
} }
// AI收车报告,特殊处理跳转,将登录人名称带入
if (decodeUrl.includes('/ai-purchase') && options?.push) {
let userInfo = wx.$util.getUserInfo()
this.setData({
url: `${decodeUrl}?pushed=${options.pushed}&source=${options.source}&carConditionCode=${options.carConditionCode}&operator=${userInfo.name}`
})
}
}, },
setTime(param) { setTime(param) {
...@@ -175,20 +183,22 @@ export function createWebViewPage(sharePagePath) { ...@@ -175,20 +183,22 @@ export function createWebViewPage(sharePagePath) {
onReachBottom: function () {}, onReachBottom: function () {},
onShareAppMessage() { onShareAppMessage(options) {
const { url } = this.data const { url, shareTitle } = this.data
if (options.webviewUrl.includes('/vehicle-detail')) shareTitle = '车况信息'
const encoded = encodeURIComponent(url || '') const encoded = encodeURIComponent(url || '')
return { return {
title: '报告详情', title: shareTitle,
path: `${sharePagePath}?url=${encoded}` path: `${sharePagePath}?url=${encoded}`
} }
}, },
onShareTimeline() { onShareTimeline() {
const { url } = this.data const { url, shareTitle } = this.data
if (options.webviewUrl.includes('/vehicle-detail')) shareTitle = '车况信息'
const encoded = encodeURIComponent(url || '') const encoded = encodeURIComponent(url || '')
return { return {
title: '报告详情', title: shareTitle,
query: `url=${encoded}` query: `url=${encoded}`
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!