Commit 17974848 by 前端

Merge branch 'saas+v5.8.0' into 'master'

上线合并

See merge request !86
2 parents 20a30d28 c6132eb9
Showing 57 changed files with 1344 additions and 273 deletions
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-07 17:09:53
* @LastEditors: limin
* @LastEditTime: 2026-02-05 17:52:25
* @FilePath: \gl_tape\App.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<script>
const PATH = ['/pages/common/caseDetail']
const keepAlive = uni.requireNativePlugin('Ba-KeepAliveSuit')
import { mapState } from 'vuex'
import { Ws } from '@/ws/Ws.js'
import { RecordSaveService, UploadService } from '@/utils/recordManager/index.js'
export default {
computed: {
...mapState('audio', ['isEnd', 'isStart'])
},
globalData: {
userInfo: uni.getStorageSync('release_userInfo')
},
onLaunch: async function () {
this.onKeep()
this.setAPPVersion()
setTimeout(() => {
plus.screen.unlockOrientation() //解除锁定屏幕方向
plus.screen.lockOrientation('landscape-primary')
}, 300)
uni.setKeepScreenOn({
keepScreenOn: true
})
new Ws().connect()
},
methods: {
onKeep() {
keepAlive &&
keepAlive.onKeep(
{
title: '接待',
content: '接待通知'
},
res => {
console.log(res)
}
)
const PATH = ['/pages/common/caseDetail']
const keepAlive = uni.requireNativePlugin('Ba-KeepAliveSuit')
import { mapState } from 'vuex'
import { Ws } from '@/ws/Ws.js'
import { RecordSaveService, UploadService } from '@/utils/recordManager/index.js'
export default {
computed: {
...mapState('audio', ['isEnd', 'isStart'])
},
setAPPVersion() {
let version = plus.runtime.version
let storageVersion = uni.$storage.get('storageVersion')
uni.$logger.local.info(`storageVersion ->${storageVersion}, version ->${version}`)
if (storageVersion != version) {
uni.$storage.rm('userInfo')
uni.$storage.rm('noSignInUuid')
}
uni.$storage.set('storageVersion', version)
}
},
onShow: async function () {
this.$store.dispatch('setBackgroundState', false)
this.$store.dispatch('setActivityWindowPopCount', 1) //冷启动重置活动弹框次数
// 触发轮询开始事件,通知上传管理重新开始轮询
// UploadService.startPolling()
RecordSaveService.startPolling()
uni.onMemoryWarning(function () {
console.log('onMemoryWarningReceive')
})
// const systemInfo = await uni.$api.systemApi.getMockData();
// if (systemInfo.isCheckedUpdate) {
// checkUpdate();
// }
// let version = plus.runtime.version;
// uni.$api.commonApi.getAPPVersion().then((res) => {
// if (res != version && !systemInfo.isCheckedUpdate)
// this.$store.dispatch("openUpdateModal");
// });
},
onHide: function () {
this.$store.dispatch('setBackgroundState', true)
},
onError: function (e) {
try {
const msg = typeof e === 'string' ? e : e.message || '捕获全局异常'
const stack = typeof e === 'object' ? e.stack || JSON.stringify(e) : ''
uni.$logger?.error({
msg: `[全局异常] ${msg}`,
extra: {
stack,
raw: e,
url: this.$route?.path || 'unknown'
}
globalData: {
userInfo: uni.getStorageSync('release_userInfo')
},
onLaunch: async function () {
this.onKeep()
this.setAPPVersion()
setTimeout(() => {
plus.screen.unlockOrientation() //解除锁定屏幕方向
plus.screen.lockOrientation('landscape-primary')
}, 300)
uni.setKeepScreenOn({
keepScreenOn: true
})
} catch (error) {
console.error('日志上报失败:', error)
}
},
onUnhandledRejection: function (res) {
try {
const reason = res.reason
const msg = reason instanceof Error ? reason.message : typeof reason === 'string' ? reason : '未处理的 Promise 拒绝'
const stack = reason instanceof Error ? reason.stack : JSON.stringify(reason)
uni.$logger?.error({
msg: `[UnhandledRejection] ${msg}`,
extra: {
stack,
reason: reason,
url: this.$route?.path || 'unknown'
new Ws().connect()
},
methods: {
onKeep() {
keepAlive &&
keepAlive.onKeep(
{
title: '接待',
content: '接待通知'
},
res => {
console.log(res)
}
)
},
setAPPVersion() {
let version = plus.runtime.version
let storageVersion = uni.$storage.get('storageVersion')
uni.$logger.local.info(`storageVersion ->${storageVersion}, version ->${version}`)
if (storageVersion != version) {
uni.$storage.rm('userInfo')
uni.$storage.rm('noSignInUuid')
}
uni.$storage.set('storageVersion', version)
}
},
onShow: async function () {
this.$store.dispatch('setBackgroundState', false)
this.$store.dispatch('setActivityWindowPopCount', 1) //冷启动重置活动弹框次数
// 触发轮询开始事件,通知上传管理重新开始轮询
// UploadService.startPolling()
RecordSaveService.startPolling()
uni.onMemoryWarning(function () {
console.log('onMemoryWarningReceive')
})
} catch (error) {
console.error('Promise 异常上报失败:', error)
// const systemInfo = await uni.$api.systemApi.getMockData();
// if (systemInfo.isCheckedUpdate) {
// checkUpdate();
// }
// let version = plus.runtime.version;
// uni.$api.commonApi.getAPPVersion().then((res) => {
// if (res != version && !systemInfo.isCheckedUpdate)
// this.$store.dispatch("openUpdateModal");
// });
},
onHide: function () {
this.$store.dispatch('setBackgroundState', true)
},
onError: function (e) {
try {
const msg = typeof e === 'string' ? e : e.message || '捕获全局异常'
const stack = typeof e === 'object' ? e.stack || JSON.stringify(e) : ''
uni.$logger?.error({
msg: `[全局异常] ${msg}`,
extra: {
stack,
raw: e,
url: this.$route?.path || 'unknown'
}
})
} catch (error) {
console.error('日志上报失败:', error)
}
},
onUnhandledRejection: function (res) {
try {
const reason = res.reason
const msg = reason instanceof Error ? reason.message : typeof reason === 'string' ? reason : '未处理的 Promise 拒绝'
const stack = reason instanceof Error ? reason.stack : JSON.stringify(reason)
uni.$logger?.error({
msg: `[UnhandledRejection] ${msg}`,
extra: {
stack,
reason: reason,
url: this.$route?.path || 'unknown'
}
})
} catch (error) {
console.error('Promise 异常上报失败:', error)
}
}
}
}
</script>
<style lang="scss">
page {
font-size: 28rpx;
height: 100%;
min-height: 100%;
}
view,
navigator,
image,
text,
scroll-view,
swiper,
swiper-item,
input,
textarea,
button {
box-sizing: border-box;
}
/* 文字避头尾法则 */
.btw {
table-layout: fixed;
word-wrap: break-word;
word-break: normal;
text-align: justify;
text-justify: inter-ideograph;
}
.bg-white {
background: #fff;
}
.font-weight {
font-weight: bold;
}
.u-flex-center {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
button {
margin: 0;
padding: 0;
line-height: 1.5;
font-size: 28rpx;
background-color: transparent;
border-radius: 0;
position: relative;
}
button::after {
border: none;
}
// 指定按钮按下去的样式类
.button-hover {
transform: translate(1rpx, 1rpx);
}
.webview-container {
position: absolute;
width: 100rpx;
height: 100rpx;
top: 0rpx;
left: 0rpx;
}
</style>
</script>
<style lang="scss">
page {
font-size: 28rpx;
height: 100%;
min-height: 100%;
}
view,
navigator,
image,
text,
scroll-view,
swiper,
swiper-item,
input,
textarea,
button {
box-sizing: border-box;
}
/* 文字避头尾法则 */
.btw {
table-layout: fixed;
word-wrap: break-word;
word-break: normal;
text-align: justify;
text-justify: inter-ideograph;
}
.bg-white {
background: #fff;
}
.font-weight {
font-weight: bold;
}
.u-flex-center {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
button {
margin: 0;
padding: 0;
line-height: 1.5;
font-size: 28rpx;
background-color: transparent;
border-radius: 0;
position: relative;
}
button::after {
border: none;
}
// 指定按钮按下去的样式类
.button-hover {
transform: translate(1rpx, 1rpx);
}
.webview-container {
position: absolute;
width: 100rpx;
height: 100rpx;
top: 0rpx;
left: 0rpx;
}
</style>
\ No newline at end of file
......@@ -451,6 +451,28 @@ module.exports = {
...data
})
},
// 学习中心-轻改短课程详情
getLightShortCourseDetail(data) {
return http.post({
method: 'dj.pad.api.staff.light.short.course.task.detail',
projectName: 'pad',
...data
})
},
// 学习中心-轻改短课程改进明细
getImprovementDetails(data) {
return http.get({
method: 'http://192.168.1.173:8422/data?recording_id=100002',
})
},
// 学习中心-轻改短课程任务明细完成复盘
finishLightShortCourseReview(data) {
return http.post({
method: 'dj.pad.api.staff.light.short.course.detail.finishReview',
projectName: 'pad',
...data
})
},
// 学习中心-长课程详情
getLongCourseDetail(data) {
return http.post({
......
import http from '../request/http'
// 轻量去重:同参数短时间内复用同一个 Promise,避免页面/弹窗多次触发
const __sceneListPromiseCache = new Map()
module.exports = {
/**查询存在订单数据的场景列表 */
getSceneListWithOrder(data) {
const key = `getSceneListWithOrder:${JSON.stringify(data || {})}`
if (__sceneListPromiseCache.has(key)) return __sceneListPromiseCache.get(key)
const p = http.post({
method: 'dj.api.smartcarlife.scene.config.getUserScene',
projectName: 'boutique',
...data
}).finally(() => {
// 释放缓存,避免长期持有
__sceneListPromiseCache.delete(key)
})
__sceneListPromiseCache.set(key, p)
return p
},
/**保存用户最近选中的场景值 */
saveUserRecentScene(data) {
return http.post({
method: 'dj.api.smartcarlife.scene.recent.saveUserScene',
projectName: 'boutique',
...data
})
},
/**查询用户最近选中的场景值 */
getUserRecentScene(data) {
return http.post({
method: 'dj.api.smartcarlife.scene.recent.getUserScene',
projectName: 'boutique',
...data
})
},
/**新建车损报价单 */
quotationAdd(data) {
return http.post({
......
......@@ -7,6 +7,24 @@ const HOST = {
merchant: merchantDomain,
ip: 'http://192.168.1.125:8080'
}
/** 接口 message 转可展示的 Toast 文案(非字符串、过长在部分端上会导致不弹提示) */
function normalizeApiToastMessage(message) {
if (message == null || message === '') return '系统异常'
let text
if (typeof message === 'string') {
text = message
} else {
try {
text = JSON.stringify(message)
} catch (e) {
return '系统异常'
}
}
const max = 42
return text.length > max ? text.slice(0, max) + '…' : text
}
class Request {
get(params, returnAll = false, hostType) {
return this.request('GET', params, returnAll, hostType)
......@@ -105,7 +123,8 @@ class Request {
uni.$logger.error(`${params.method}接口异常:${errMsg}`)
return reject(errMsg)
}
let { code, message } = data
let { code, message, msg, errId } = data
if (message == null || message === '') message = msg
if (returnAll) {
resolve(data)
return
......@@ -121,15 +140,35 @@ class Request {
})
} else {
if (code == '0') {
const errIdStr = errId != null && errId !== '' ? String(errId) : ''
if (errIdStr && errIdStr !== '0') {
uni.hideLoading()
const toastTitle = normalizeApiToastMessage(message)
setTimeout(() => {
uni.showToast({
title: toastTitle,
icon: 'none',
duration: 3000
})
}, 0)
uni.$logger.error(`${params.method}接口异常(errId):${toastTitle}`)
reject(toastTitle)
return
}
resolve(data.data)
} else {
uni.hideLoading()
uni.$logger.error(`${params.method}接口异常:${message || '系统异常'}`)
uni.showToast({
title: message || '系统异常',
icon: 'none'
})
reject(message || '系统异常')
const toastTitle = normalizeApiToastMessage(message)
// 先提示再记日志:避免 RemoteLog/Sentry 同步异常时用户看不到 Toast
setTimeout(() => {
uni.showToast({
title: toastTitle,
icon: 'none',
duration: 3000
})
}, 0)
uni.$logger.error(`${params.method}接口异常:${toastTitle}`)
reject(toastTitle)
}
}
} catch (error) {
......@@ -139,12 +178,23 @@ class Request {
},
fail(error) {
uni.hideLoading()
// console.error(`${params.method}接口异常:`, error)
uni.$logger.error(`${params.method}接口异常:${error.errMsg || error.message || JSON.stringify(error)}`)
uni.showToast({
title: typeof error == 'string' ? error : error.errMsg ? error.errMsg : JSON.stringify(error) || '系统异常',
icon: 'error'
})
const raw =
typeof error == 'string'
? error
: error.errMsg
? error.errMsg
: error.message
? error.message
: JSON.stringify(error) || '系统异常'
const toastTitle = normalizeApiToastMessage(raw)
setTimeout(() => {
uni.showToast({
title: toastTitle,
icon: 'none',
duration: 3000
})
}, 0)
uni.$logger.error(`${params.method}接口异常:${toastTitle}`)
reject(error)
},
complete() {
......

3.04 MB | W: | H:

3.17 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -7,7 +7,7 @@
>
<view
class="cell-box"
v-if="items.length"
v-if="items.some(i => !i.hidden)"
:style="cellBoxStyle"
>
<template v-if="titleList.length">
......
......@@ -399,6 +399,10 @@ export default {
},
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
if (this.lockReason == '2') {
uni.navigateTo({ url: '/pages/common/serviceDetail/index?moduleType=9' })
return
}
// 切换到学习中心 tab
const tabs = this.$refs.leftBox?.tabs
if (tabs) {
......
......@@ -85,7 +85,11 @@ export default {
apiParams = {
merchantId: shopMerchantId
}
isDefeatOrder ? apiParams.upradeFlag = 'N' : apiParams.sceneType = sceneType
apiParams.sceneType = sceneType
apiParams.baseSceneCode = this.data.baseSceneCodeValue || this.data.baseSceneCode
if (isDefeatOrder) {
apiParams.upradeFlag = 'N'
}
const data = await uni.$api.popupApi[apiName](apiParams)
this.updateParams(params, data || [])
},
......
......@@ -28,6 +28,7 @@ export default {
// 默认支持所有订单类型
let data = [
{ name: '正常订单', value: '1' },
{ name: '内部结算', value: '6' },
{ name: '打折策略', value: '2' },
{ name: '买赠策略', value: '3' },
{ name: '冲量活动', value: '4' },
......@@ -82,7 +83,8 @@ export default {
// 3)有 flag 且不为 1 时,只允许“正常订单”
if (flag !== null && flag !== '1') {
data = [{ name: '正常订单', value: '1' }]
// 内部结算与正常订单同逻辑,也一并允许
data = [{ name: '正常订单', value: '1' }, { name: '内部结算', value: '6' }]
}
} catch (e) {
// 读取失败时不影响默认行为
......
<template>
<view class="scene-list">
<view
v-for="(i, index) in listData"
:key="index"
@click="choose(i)"
:class="['item flex', { active: checkActive(i) }]"
>
<view
class="scene-type-tag"
:style="{ background: sceneTag.bg, color: sceneTag.color }"
>{{ sceneTag.label }}</view>
<view class="sprite-icon icon-tag-checked"></view>
{{ i.name || i.staffName }}
</view>
</view>
</template>
<script type="text/ecmascript-6">
import popupmixin from './popupmixin'
const SCENE_TYPE_TAG_MAP = {
1: { label: '轻改', bg: '#5575f51a', color: '#5575f5' },
0: { label: '权益', bg: '#4bc8fe1a', color: '#4bc8fe' },
2: { label: '保险', bg: '#00baad1a', color: '#00baad' },
7: { label: '二手车', bg: '#fe624b1a', color: '#fe624b' },
4: { label: '其他', bg: '#ff9d2e1a', color: '#ff9d2e' }
}
export default {
mixins: [popupmixin],
name: 'SceneList',
inject: ['userInfo'],
data () {
return {
}
},
computed: {
idKey () {
let { params: { idKey }, sceneType } = this
return Array.isArray(idKey) ? idKey[sceneType] : idKey
},
sceneTag () {
const n = Number(this.sceneType)
const key = n >= 0 && n <= 4 ? n : 4
return SCENE_TYPE_TAG_MAP[key] || SCENE_TYPE_TAG_MAP[4]
}
},
mounted () {
},
methods: {
getSceneId (item = {}) {
return item.baseSceneCode || item.uuid
},
async getList (searchValue, search) {
const { userInfo, params } = this,
{ cacheData } = params
this.currentId = ''
if (!search && cacheData && cacheData.length) {
this.initData(cacheData)
if (searchValue) this.handleSearch(searchValue)
return
}
this.componentLoading(params)
// 和 OrderScreen 的 SceneList 保持一致:走 getSceneListWithOrder
const data = await uni.$api.equityApi.getSceneListWithOrder({
sceneType: String(userInfo.sceneType),
phone: userInfo.phone
})
const list = (data && data.length) ? data : []
this.updateParams(params, list)
},
initData (list) {
const { idKey, data } = this
if (data[idKey]) {
this.currentId = data[idKey]
let item = list.find(i => this.getSceneId(i) == this.currentId)
console.log(item)
this.$emit('choose', item)
}
this.list = list
this.$emit('onComplete')
},
handleSearch (searchValue) {
const { sceneType } = this
if (sceneType == 1) {
this.list = []
this.getList(searchValue, true)
} else this.originalDataSearch(searchValue)
},
originalDataSearch (searchValue) {
console.log(searchValue, '===')
if (!searchValue) this.searchStatus = false
else {
searchValue = searchValue.toUpperCase()
let { list } = this,
employeeList = JSON.parse(JSON.stringify(list)),
arr = []
employeeList.map(e => {
const sceneName = e.name || e.staffName
if (sceneName && sceneName.toUpperCase().indexOf(searchValue) != -1) arr.push(e)
})
this.searchList = arr
this.searchStatus = true
}
},
choose (i) {
let { idKey, data } = this,
userId = data.deliveryUserId,
referrerId = data.deliveryId,
deliveryUserId = data.userId,
deliveryId = data.referrerId,
value = {
userId,
deliveryUserId,
referrerId,
deliveryId
}[idKey]
if (['referrerId', 'userId', 'deliveryId', 'deliveryUserId'].includes(idKey) && value == i.uuid) return uni.showToast({
title: '销售顾问/录单员与交付专员不能选取同一人',
icon: 'none',
mask: true
})
this.currentId = this.getSceneId(i)
this.$emit('choose', i)
},
checkActive (i) {
let { currentId, idKey, data } = this
const id = this.getSceneId(i)
return currentId ? id == currentId : id == data[idKey]
}
}
}
</script>
<style scoped lang="scss">
.scene-list {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: toRpx(32);
margin: 0 toRpx(48);
.item {
align-items: center;
justify-content: start;
height: toRpx(144);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
padding: 0 toRpx(32);
box-sizing: border-box;
.scene-type-tag {
flex-shrink: 0;
margin-right: toRpx(16);
height: toRpx(48);
line-height: toRpx(48);
padding: 0 toRpx(12);
border-radius: toRpx(12);
font-size: toRpx(24);
font-weight: 500;
box-sizing: border-box;
}
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
......@@ -197,7 +197,11 @@ export default {
let apiParams = {
merchantId: shopMerchantId
}
isDefeatOrder ? apiParams.upradeFlag = 'N' : apiParams.sceneType = sceneType
apiParams.sceneType = sceneType
apiParams.baseSceneCode = this.data.baseSceneCodeValue || this.data.baseSceneCode
if (isDefeatOrder) {
apiParams.upradeFlag = 'N'
}
const data = await uni.$api.popupApi[apiName](apiParams)
if (isDefeatOrder) {
let newArray = []
......
......@@ -390,6 +390,17 @@ const componentConfig = {
loadComplete: false,
searchValue: '',
noData: false
}
},
29: {
name: 'SceneList',
title: '场景名称',
hideSearch: true,
// 选择场景后存 code 字段,用于回显选中
idKey: 'baseSceneCodeValue',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
}
export default { componentConfig }
......@@ -52,6 +52,7 @@ import Options from './components/Options.vue'
import CarBrand from './components/CarBrand.vue'
import Gearbox from './components/Gearbox.vue'
import OrderTypePopup from './components/OrderTypePopup.vue'
import SceneList from './components/SceneList.vue'
export default {
components: {
......@@ -75,7 +76,8 @@ export default {
Options,
CarBrand,
Gearbox,
OrderTypePopup
OrderTypePopup,
SceneList
},
name: '',
props: {
......@@ -167,9 +169,20 @@ export default {
componentRef () {
return this.$refs.componentRef
},
// 场景切换后清空依赖 sceneType 的弹窗缓存,下次打开时强制重新请求
clearCacheByTypes (types) {
(types || []).forEach(type => {
if (this.componentObject[type]) {
this.componentObject[type].cacheData = []
}
})
},
open () {
this.$refs.popup.open()
this.initPopupData()
// 等待当前 tick 的响应式 watcher(如 externalData → cacheData)执行完再初始化
this.$nextTick(() => {
this.initPopupData()
})
},
cancel () {
this.$refs.popup.close()
......
<template>
<view class="employee-list">
<view @click="currentId = ''" :class="['item flex', { active: !currentId }]">
<view class="sprite-icon icon-tag-checked"></view>
全部
</view>
<view v-for="(i, index) in list" :key="index" @click="choose(i)" :class="['item flex', { active: checkActive(i) }]">
<view class="sprite-icon icon-tag-checked"></view>
{{ i.name || i.staffName }}
</view>
</view>
</template>
<script type="text/ecmascript-6">
export default {
name: 'SceneList',
inject: ['userInfo'],
data () {
return {
list: [],
currentId: ''
}
},
props: {
params: Object,
data: [Array, Object],
},
watch: {
currentId: {
handler (val) {
let { params: { idKey } } = this
this.$emit('choose', {
key: idKey,
// 兼容历史筛选参数:baseSceneCode 始终用 string(空字符串表示“全部”)
value: val ? String(val) : ''
})
},
}
},
mounted () {
this.getList()
},
methods: {
getSceneId (item = {}) {
return item.baseSceneCode
},
async getList () {
const { userInfo, params } = this,
{ cacheData } = params
if (cacheData && cacheData.length) {
this.initList(cacheData)
return
}
const data = await uni.$api.equityApi.getSceneListWithOrder({
sceneType: String(userInfo.sceneType),
phone: userInfo.phone
})
const list = (data && data.length)
? data
: [
// 接口暂无数据时的临时模拟返回(来自 scene 表)
{ uuid: '100101', name: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', name: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', name: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', name: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', name: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', name: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', name: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', name: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
this.initList(list)
params.cacheData = list
this.$emit('update:params', params)
},
initList (list) {
let { data, params: {idKey} } = this
this.list = list
let paramsData = idKey ? data[idKey] : data
this.currentId = paramsData || ''
this.$emit('onComplete')
},
choose (i) {
if (!i) return
const sceneId = this.getSceneId(i)
if (!sceneId) return
// 场景名称在列表筛选里为单选:点击已选项不取消
if (this.currentId === sceneId) return
this.currentId = sceneId
},
checkActive (i) {
let { currentId } = this
return currentId ? currentId === this.getSceneId(i) : false
// return this.currentId === i.uuid
},
}
}
</script>
<style scoped lang="scss">
.employee-list {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: toRpx(32);
margin: 0 toRpx(48);
.item {
justify-content: center;
height: toRpx(72);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
\ No newline at end of file
const screenList = [
{
title: '场景名称',
componentName: 'SceneList',
params: {
cacheData: [],
idKey: 'baseSceneCode'
},
hasToggle: true,
toggle: false
},
{
title: '转化人员',
suffix: 'merchantName',
componentName: 'EmployeeList',
......
......@@ -74,6 +74,7 @@ import OrderStatusList from './components/OrderStatusList.vue'
import PayList from './components/PayList.vue'
import CourseOptionList from './components/CourseOptionList.vue'
import ErrorOrderList from './components/ErrorOrderList.vue'
import SceneList from './components/SceneList.vue'
export default {
components: {
Popup,
......@@ -82,7 +83,8 @@ export default {
OrderStatusList,
PayList,
CourseOptionList,
ErrorOrderList
ErrorOrderList,
SceneList
},
name: 'OrderScreen',
props: {
......
<template>
<view class="employee-list">
<view @click="currentId = ''" :class="['item flex', { active: !currentId }]">
<view class="sprite-icon icon-tag-checked"></view>
全部
</view>
<view v-for="(i, index) in list" :key="index" @click="choose(i)" :class="['item flex', { active: checkActive(i) }]">
<view class="sprite-icon icon-tag-checked"></view>
{{ i.name || i.staffName }}
</view>
</view>
</template>
<script type="text/ecmascript-6">
export default {
name: 'SceneList',
inject: ['userInfo'],
data () {
return {
list: [],
currentId: ''
}
},
props: {
params: Object,
data: [Array, Object],
},
watch: {
currentId: {
handler (val) {
let { params: { idKey } } = this
this.$emit('choose', {
key: idKey,
// 场景名称单选:baseSceneCode 始终为 string(空字符串表示“全部”)
value: val ? String(val) : ''
})
},
}
},
mounted () {
this.getList()
},
methods: {
getSceneId (item = {}) {
return item.baseSceneCode
},
async getList () {
const { userInfo, params } = this,
{ cacheData } = params
if (cacheData && cacheData.length) {
this.initList(cacheData)
return
}
const data = await uni.$api.equityApi.getSceneListWithOrder({
sceneType: String(userInfo.sceneType),
phone: userInfo.phone
})
const list = (data && data.length)
? data
: [
{ uuid: '100101', name: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', name: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', name: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', name: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', name: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', name: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', name: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', name: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
this.initList(list)
params.cacheData = list
this.$emit('update:params', params)
},
initList (list) {
let { data, params: {idKey} } = this
this.list = list
const paramsData = idKey ? data?.[idKey] : data
// 兼容历史值:如果传进来是数组,取第一个;否则按 string 处理
if (Array.isArray(paramsData)) this.currentId = paramsData[0] ? String(paramsData[0]) : ''
else this.currentId = paramsData ? String(paramsData) : ''
this.$emit('onComplete')
},
choose (i) {
if (!i) return
const sceneId = this.getSceneId(i)
if (!sceneId) return
// 单选:点击已选项不取消
if (String(this.currentId) === String(sceneId)) return
this.currentId = String(sceneId)
},
checkActive (i) {
const id = this.getSceneId(i)
if (!id) return false
return this.currentId ? String(this.currentId) === String(id) : false
},
}
}
</script>
<style scoped lang="scss">
.employee-list {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: toRpx(32);
margin: 0 toRpx(48);
.item {
justify-content: center;
height: toRpx(72);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
\ No newline at end of file
const screenList = [
{
title: '场景名称',
componentName: 'SceneList',
params: {
cacheData: [],
idKey: 'baseSceneCode'
},
hasToggle: true,
toggle: false
},
{
title: '转化人员',
suffix: 'merchantName',
componentName: 'EmployeeList',
......
......@@ -32,6 +32,7 @@
import Popup from '@/components/Popup.vue'
import config from './config'
import EmployeeList from './components/EmployeeList.vue'
import SceneList from './components/SceneList.vue'
import TimeList from './components/TimeList.vue'
import OrderStatusList from './components/OrderStatusList.vue'
import PayList from './components/PayList.vue'
......@@ -47,7 +48,8 @@ export default {
PayList,
CourseOptionList,
ContractList,
ErrorOrderList
ErrorOrderList,
SceneList
},
name: 'OrderScreen',
props: {
......
......@@ -16,6 +16,9 @@
<template v-if="lockReason == '1'">
到学习中心-我的任务,完成长课程学习任务后,即可解锁开单权限。
</template>
<template v-if="lockReason == '2'">
到服务中心-短课程,完成短课程学习任务后,即可解锁开单权限。
</template>
</view>
<!-- 第三段描述 -->
......@@ -25,7 +28,7 @@
<!-- 按钮 -->
<view class="goto-button" @click="handleGoToStudy">
去往学习中心
{{ lockReason == '2' ? '去往服务中心' : '去往学习中心' }}
</view>
</view>
</template>
......
......@@ -39,7 +39,7 @@ const secretKey = {
const domain = {
// ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315',
ip: 'http://192.168.1.76:8292',
ip: 'http://192.168.1.104:8292',
/**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */
dev: 'https://scrm.dev.glsx.com.cn',
......@@ -50,7 +50,7 @@ const domain = {
const djDomain = {
// ip: 'http://dj.dev.glsx.com.cn',
ip: 'http://192.168.1.76:8292',
ip: 'http://192.168.1.104:8292',
dev: 'http://dj.dev.glsx.com.cn',
beta: 'https://dj.beta.glsx.com.cn', //预发布 appid: wx9f91c1ec493eb425
uat: 'https://dj.test.glsx.com.cn', //测试 appid: wxe10067a63c1856ac
......
......@@ -2,8 +2,8 @@
"name" : "展业助手",
"appid" : "__UNI__D3BD3DF",
"description" : "",
"versionName" : "2.24.1",
"versionCode" : 2241,
"versionName" : "2.25.0",
"versionCode" : 2250,
"transformPx" : false,
"sassImplementationName" : "node-sass",
/* 5+App特有相关 */
......
......@@ -209,6 +209,12 @@
}
},
{
"path": "pages/common/studyDetail/shortCourseLearnRoom",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/common/studyDetail/detail",
"style": {
"navigationStyle": "custom"
......
......@@ -54,7 +54,7 @@
<view class="payType flex align-center">
<view class="payType-label">订单类型</view>
<view class="payType-value flex align-center">
{{ orderType[orderCardDetail['orderType']] }}
{{ orderType[orderCardDetail['djOrderType']] }}
<view class="flex align-center errorTips" v-if="orderCardDetail.abnormalFlag == 'Y'">
<view class="sprite-icon icon-errortips"></view>
异常
......@@ -62,6 +62,7 @@
</view>
</view>
<view class="payType flex align-center">
<view class="payType-label">审批状态</view>
<view class="payType-value flex align-center">
......@@ -196,6 +197,10 @@ export default {
selectType: 1,
pointsMultiObj: [
{
label: '场景名称',
key: 'baseSceneName'
},
{
label: '销售顾问 /录单员',
arr: ['merchantName', 'employeeName']
},
......@@ -218,6 +223,10 @@ export default {
],
orderObj: [
{
label: '场景名称',
key: 'baseSceneName'
},
{
label: '销售顾问',
arr: ['merchantName', 'employeeName']
},
......@@ -374,6 +383,10 @@ export default {
// 跳转学习中心
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
if (this.lockReason == '2') {
uni.navigateTo({ url: '/pages/common/serviceDetail/index?moduleType=9' })
return
}
uni.navigateBack({
success: () => {
setTimeout(() => {
......
......@@ -201,7 +201,8 @@ module.exports = {
2: '打折策略',
3: '买赠策略',
4: '冲量活动',
5: '组合付款'
5: '组合付款',
6:'内部结算'
}
}
}
......@@ -623,7 +623,7 @@ export default {
this.$emit('jump', 'OrderDetail', data)
}
} else {
uni.showToast({ title: message, icon: null })
uni.showToast({ title: '未获取到支付结果,请重试', icon: 'none' })
}
})
}
......
......@@ -111,6 +111,7 @@
</GlCell>
</view>
<view
v-if="orderObj.baseSceneCodeValue"
@click.stop="submit"
class="btn"
>战败下单</view>
......@@ -173,6 +174,20 @@ export default {
const baseFields = ['id', 'orderCode', 'userId', 'employeeName', 'deliveryEmployeeName', 'deliveryUserId', 'subShopMerchantName', 'subShopMerchantId', 'sellerName', 'sellerUserId', 'sellerMerchantName', 'sellerMerchantId', 'merchantId', 'merchantName', 'customerCouponId']
Object.assign(this.orderObj, Object.fromEntries(baseFields.map(field => [field, rest[field]])))
// 场景回显:列表进入会带 baseSceneName/baseSceneCode
const sceneName = rest.baseSceneName || rest.sceneName || ''
const sceneCode = rest.baseSceneCode || rest.baseSceneId || ''
if (sceneName || sceneCode) {
this.$set(this.orderObj, 'baseSceneCode', sceneName)
this.$set(this.orderObj, 'baseSceneCodeValue', sceneCode)
const sceneCell = this.formList?.[0]?.find(item => item.value === 'baseSceneCode')
if (sceneCell) sceneCell.current = sceneName
}
// 二级流量方回显(列表进入会直接带 subShopMerchantName/subShopMerchantId)
const subShopCell = this.formList?.[0]?.find(item => item.value === 'subShopMerchantName')
if (subShopCell && this.orderObj.subShopMerchantName) subShopCell.current = this.orderObj.subShopMerchantName
// 客户信息映射
const customerFields = ['customerName', 'customerSex', 'customerPhone', 'standNo', 'plateNumber', 'experienceFlag']
Object.assign(this.orderObj, Object.fromEntries(customerFields.map(field => [field, customer[field]])))
......@@ -290,7 +305,71 @@ export default {
this.initData()
},
methods: {
initData () {
async tryEchoSubShopMerchantFromDetail (orderCode) {
try {
if (!orderCode) return
// 订单列表接口可能不返回二级流量方,详情接口通常会返回
const detail = await uni.$api.boutiqueApi.getPackageGoodsDetail({ orderCode })
const name = detail?.subShopMerchantName
const id = detail?.subShopMerchantId
if (name || id) {
this.$set(this.orderObj, 'subShopMerchantId', id)
this.$set(this.orderObj, 'subShopMerchantName', name)
const subShopCell = this.formList?.[0]?.find(item => item.value === 'subShopMerchantName')
if (subShopCell) subShopCell.current = name
}
} catch (e) {}
},
updateSceneGate () {
const selected = Boolean(this.orderObj && (this.orderObj.baseSceneCodeValue || this.orderObj.baseSceneCode))
const list = this.formList || []
list.forEach(group => {
;(group || []).forEach(item => {
if (!item) return
if (item._originHidden === undefined) item._originHidden = Boolean(item.hidden)
if (!selected) {
item.hidden = item.value !== 'baseSceneCode'
} else {
item.hidden = item._originHidden
}
})
})
this.formList = list
return selected
},
async initRecentSceneEcho () {
try {
const userInfo = this.userInfo || (uni.$storage.get('userInfo') || {})
const phone = userInfo.phone
const userSceneType = userInfo.sceneType
if (!phone || userSceneType === undefined || userSceneType === null) return
const recent = await uni.$api.equityApi.getUserRecentScene({
phone,
sceneType: userSceneType
})
// HTTP 层已将 data.data 解包,recent 直接是 { baseSceneCode: '...' }
const recentBaseSceneCode = recent?.baseSceneCode || recent?.uuid
if (!recentBaseSceneCode) return
// getSceneListWithOrder 有 Promise 缓存,不会重复发请求
const rawList = await uni.$api.equityApi.getSceneListWithOrder({
phone,
sceneType: String(userSceneType)
})
const listData = Array.isArray(rawList) ? rawList : []
const item = listData.find(i => String(i.baseSceneCode || i.uuid) === String(recentBaseSceneCode))
if (!item) return
this.$set(this.orderObj, 'baseSceneCode', item.name || item.staffName)
this.$set(this.orderObj, 'baseSceneCodeValue', item.baseSceneCode || item.uuid)
this.$set(this.orderObj, 'sceneType', item.sceneType)
// 同步表单展示(GlCell 某些字段依赖 current)
const sceneCell = this.formList?.[0]?.find(v => v && v.value === 'baseSceneCode')
if (sceneCell) sceneCell.current = item.name || item.staffName || ''
} catch (e) {}
},
async initData () {
const { userInfo } = this
if (!this.orderObj.id) {
const weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
......@@ -311,6 +390,16 @@ export default {
this.getSubShopMerchantList(userInfo.shopMerchantId)
this.getSetting()
// 列表进入(带 id/orderCode)但未返回二级流量方时,走详情兜底回显
if (this.orderObj.id && this.orderObj.orderCode && !this.orderObj.subShopMerchantName && !this.orderObj.subShopMerchantId) {
await this.tryEchoSubShopMerchantFromDetail(this.orderObj.orderCode)
}
// 进页面先回显最近场景;未选场景时不展示/不请求下方表单与接口
if (!this.orderObj.id) await this.initRecentSceneEcho()
const hasScene = this.updateSceneGate()
if (!hasScene) return
this.getConfig()
this.getConfigList()
// this.getEmployeeList()
......@@ -403,6 +492,34 @@ export default {
const weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
this.$set(this.orderObj, 'todayShow', dayjs(chooseContent).format('YYYY-MM-DD') + ' ' + weeks[dayjs(chooseContent).day()])
this.$set(this.orderObj, 'createDate', dayjs(chooseContent).format('YYYY-MM-DD'))
} else if (_typeValue.key === 'baseSceneCode') {
// 场景名称:页面显示名称;接口参数使用 code
this.$set(this.orderObj, 'baseSceneCode', chooseContent.name || chooseContent.staffName)
this.$set(this.orderObj, 'baseSceneCodeValue', chooseContent.baseSceneCode || chooseContent.uuid)
this.$set(this.orderObj, 'sceneType', chooseContent.sceneType)
// 选择后保存最近选中场景(sceneType 用登录场景)
const userInfo = this.userInfo || (uni.$storage.get('userInfo') || {})
if (userInfo.phone) {
uni.$api.equityApi.saveUserRecentScene({
phone: userInfo.phone,
sceneType: userInfo.sceneType,
baseSceneCode: chooseContent.baseSceneCode || chooseContent.uuid
})
}
// 场景名称切换时,清除已选商品(与新建工单一致)
productFields.forEach(field => {
this.$set(this.orderObj, field, null)
})
this.goodsList = []
this.otherProduct = []
this.changeTotalPrice()
// 选中场景后,放开下方表单并触发依赖接口
this.$refs.orderPopup && this.$refs.orderPopup.clearCacheByTypes([0, 1, 3, 6, 7, 8, 9, 10, 11, 12])
this.updateSceneGate()
this.getConfig()
this.getConfigList()
// 场景变化后重新拉取商品列表
this.getSelectOrderGoodsList()
} else if (_typeValue.key) {
this.orderObj[_typeValue.targetIdKey] = chooseContent[_typeValue.sourceIdKey]
this.$set(this.orderObj, _typeValue.targetNameKey, chooseContent[_typeValue.sourceNameKey])
......@@ -531,6 +648,9 @@ export default {
if (!this.checkRequired()) return
const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj)
// 场景名称:界面展示用 name;提交入参需要 code
if (obj.baseSceneCodeValue) obj.baseSceneCode = obj.baseSceneCodeValue
delete obj.baseSceneCodeValue
const otherCustomer = ['customerSex', 'experienceFlag']
obj.customer = {
...obj.customer,
......@@ -699,7 +819,19 @@ export default {
this.subShopMerchantList = res
const cell = this.formList[0].find(item => item.label === '二级流量方')
if (cell) {
cell.hidden = false
cell._originHidden = false
const hasScene = Boolean(this.orderObj && (this.orderObj.baseSceneCodeValue || this.orderObj.baseSceneCode))
cell.hidden = !hasScene
}
// 列表进入时后端可能不返回 subShopMerchantName/subShopMerchantId;
// 若仅有一个可选项且当前未选择,则默认回填,避免“空白不可操作”的体验
if (!this.orderObj.subShopMerchantId && !this.orderObj.subShopMerchantName && res.length === 1) {
const only = res[0] || {}
this.$set(this.orderObj, 'subShopMerchantId', only.subMerchantId)
this.$set(this.orderObj, 'subShopMerchantName', only.subMerchantName)
const subShopCell = this.formList?.[0]?.find(item => item.value === 'subShopMerchantName')
if (subShopCell) subShopCell.current = only.subMerchantName
}
}
},
......@@ -801,7 +933,9 @@ export default {
const { shopMerchantId, sceneType, merchantId } = userInfo,
data = await uni.$api.popupApi.getEmployeeList({
merchantId: orderObj.idKey == 'sellerUserId' ? merchantId : shopMerchantId,
sceneList: orderObj.idKey == 'sellerUserId' ? '' : [sceneType]
sceneList: orderObj.idKey == 'sellerUserId'
? ''
: [this.orderObj.sceneType != null ? this.orderObj.sceneType : sceneType]
})
if (data && data.length) {
this.employeeList = data
......@@ -818,7 +952,9 @@ export default {
const { userInfo } = this
const res = await uni.$api.boutiqueApi.getOrderBaseGoodsList({
merchantId: userInfo.shopMerchantId,
upradeFlag: 'N'
upradeFlag: 'N',
sceneType: this.orderObj.sceneType != null ? this.orderObj.sceneType : userInfo.sceneType,
baseSceneCode: this.orderObj.baseSceneCodeValue
})
// 分类映射
......
......@@ -588,8 +588,8 @@ export default {
.clear {
position: absolute;
right: toRpx(18);
top: toRpx(10);
height: 100%;
top: toRpx(40);
height: toRpx(72);
padding: 0 48rpx;
}
......
const FORM_LIST = [
[
{
label: '场景名称',
value: 'baseSceneCode',
type: 'select',
key: 'baseSceneCode',
required: true
},
{
label: '销售顾问',
value: 'employeeName',
type: 'select',
......@@ -50,11 +57,15 @@ const FORM_LIST = [
radioList: [
{
value: '0',
name: '售前'
name: '门店引流-售前'
},
{
value: '1',
name: '售后'
name: '门店引流-售后'
},
{
value: '2',
name: '自然到店'
}
],
required: true
......@@ -255,6 +266,13 @@ const FORM_LIST = [
const DEFEAT_FORM_LIST = [
[
{
label: '场景名称',
value: 'baseSceneCode',
type: 'select',
key: 'baseSceneCode',
required: true
},
{
label: '战败日期',
value: 'todayShow',
type: 'select',
......@@ -311,11 +329,15 @@ const DEFEAT_FORM_LIST = [
radioList: [
{
value: '0',
name: '售前'
name: '门店引流-售前'
},
{
value: '1',
name: '售后'
name: '门店引流-售后'
},
{
value: '2',
name: '自然到店'
}
],
required: true,
......@@ -547,6 +569,11 @@ const payTypeList = [
]
const popupTypeEnum = {
29: {
// 场景名称弹窗(SceneList)
key: 'baseSceneCode',
list: ''
},
0: {
key: 'employeeName',
list: 'employeeList',
......
......@@ -197,13 +197,20 @@ export default {
// 跳转学习中心
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
uni.navigateBack({
console.log(this.lockReason,'lockReason')
if (this.lockReason == '2') {
uni.navigateTo({ url: '/pages/common/serviceDetail/index?moduleType=9' })
return
}else{
uni.navigateBack({
success: () => {
setTimeout(() => {
uni.$emit('studyCenter')
}, 100)
}
})
}
},
// 确认选择的月份
confirmMonth(month) {
......
......@@ -5,7 +5,8 @@ const moduleTypeEnum = {
3: '短课程学习',
4: '长课程学习',
5: '活动中心',
7: '优秀案例学习'
7: '优秀案例学习',
9: '轻改短课程学习'
}
const moduleIconEnum = {
......@@ -15,7 +16,8 @@ const moduleIconEnum = {
3: 'notice-study',
4: 'notice-study',
5: 'active-msg',
7: 'notice-recording'
7: 'notice-recording',
9: 'short-course-learn-room'
}
const moduleContentEnum = {
......
......@@ -73,6 +73,7 @@ export default {
earlyWarnList: [],
systemList: [],
shortCourseList: [],
lightShortCourseList: [],
longCourseList: [],
activityList: [],
caseList: [],
......@@ -98,7 +99,7 @@ export default {
let contentRow = ''
// 标题逻辑
if (moduleType === 3 || moduleType === 4) {
if (moduleType === 3 || moduleType === 4 || moduleType === 9) {
displayTitle = item.title
} else if (moduleType === 7) {
displayTitle = this.reminderTypeEnum[item.reminderType]
......@@ -110,7 +111,7 @@ export default {
const fmt = (t) => this.formatTime(t, 'YYYY-MM-DD HH:mm:ss')
// 任务和内容逻辑
if (moduleType === 3 || moduleType === 4) {
if (moduleType === 3 || moduleType === 4 || moduleType === 9) {
if (item.taskType == 1) {
taskNameRow = `学习任务名称:${item.taskName}`
finishTimeRow = `任务完成时间:小伙伴,请于${fmt(item.finishTime)}完成哦~`
......@@ -160,6 +161,8 @@ export default {
return this.earlyWarnList
case 3:
return this.shortCourseList
case 9:
return this.lightShortCourseList
case 4:
return this.longCourseList
case 5:
......@@ -201,7 +204,7 @@ export default {
if (moduleType === 0) {
return !item.readFlag
}
if ([1, 2, 3, 4, 5, 6, 7].includes(moduleType)) {
if ([1, 2, 3, 4, 5, 6, 7, 9].includes(moduleType)) {
return item.status == 0
}
return false
......@@ -226,6 +229,9 @@ export default {
case 3:
this.getCourseList(3)
break
case 9:
this.getCourseList(9)
break
case 4:
this.getCourseList(4)
break
......@@ -415,6 +421,13 @@ export default {
console.error('调用 getCourseList 方法时出错:', error)
}
break
case 9:
try {
this.getCourseList(9)
} catch (error) {
console.error('调用 getCourseList 方法时出错:', error)
}
break
case 4:
try {
this.getCourseList(4)
......@@ -545,6 +558,20 @@ export default {
}
})
break
case 9:
console.log('轻改短课程学习跳转')
uni.$track.add({ eventCode: 'app_short_course', businessId: item.detailId, pagePath: '/pages/common/serviceDetail/index' })
// const row = {
// ...item,
// }
// row.id = item.detailId
uni.navigateTo({
url: `/pages/common/studyDetail/shortCourseLearnRoom?row=${encodeURIComponent(JSON.stringify(item))}&completeStatus=${item.completeStatus}&from=service`,
fail: err => {
console.error('页面跳转失败:', err)
}
})
break
default:
break
}
......@@ -566,9 +593,13 @@ export default {
e.time = e.actualSendTimeStr
})
if (pageNum == 1) {
moduleType == 3 ? (this.shortCourseList = res.list) : (this.longCourseList = res.list)
if (moduleType == 3) this.shortCourseList = res.list
else if (moduleType == 4) this.longCourseList = res.list
else if (moduleType == 9) this.lightShortCourseList = res.list
} else {
moduleType == 3 ? (this.shortCourseList = this.shortCourseList.concat(res.list)) : (this.longCourseList = this.longCourseList.concat(res.list))
if (moduleType == 3) this.shortCourseList = this.shortCourseList.concat(res.list)
else if (moduleType == 4) this.longCourseList = this.longCourseList.concat(res.list)
else if (moduleType == 9) this.lightShortCourseList = this.lightShortCourseList.concat(res.list)
}
uni.hideLoading()
this.total = res.total
......
<template>
<view >
<template v-if="labelColors && labelColors.length > 0">
<template v-if="hasData">
<qiun-data-charts type="radar" :opts="opts" :tooltipShow="false" :chartData="chartData" :class="['charts-box', heightClass]" />
</template>
<template v-else>
......@@ -17,7 +17,7 @@ export default {
props: {
chartData: {
type: Object,
default: () => {}
default: () => ({})
},
heightClass: {
type: String
......@@ -27,11 +27,24 @@ export default {
default: () => ['#666666', '#666666', '#666666', '#666666', '#666666', '#666666', '#666666', '#666666', '#666666']
}
},
computed: {
hasData () {
const c = this.chartData && Array.isArray(this.chartData.categories) ? this.chartData.categories : []
const s0 = this.chartData && Array.isArray(this.chartData.series) ? this.chartData.series[0] : null
const d = s0 && Array.isArray(s0.data) ? s0.data : []
return c.length > 0 && d.length > 0
}
},
watch: {
labelColors: {
handler(newVal) {
console.log(newVal, 'newVal')
this.opts.labelColors = newVal
if (Array.isArray(newVal) && newVal.length) {
this.opts.labelColors = newVal
} else {
const len = (this.chartData && Array.isArray(this.chartData.categories)) ? this.chartData.categories.length : 0
this.opts.labelColors = len ? Array.from({ length: len }, () => '#666666') : []
}
},
}
},
......@@ -68,6 +81,11 @@ export default {
},
mounted() {
console.log(this.chartData, ' 详情')
// 首次进入时父组件可能还没算出 labelColors,这里做一次兜底
if (!Array.isArray(this.opts.labelColors) || !this.opts.labelColors.length) {
const len = (this.chartData && Array.isArray(this.chartData.categories)) ? this.chartData.categories.length : 0
if (len) this.opts.labelColors = Array.from({ length: len }, () => '#666666')
}
}
}
</script>
......
......@@ -227,7 +227,8 @@ module.exports = {
2: '打折策略',
3: '买赠策略',
4: '冲量活动',
5: '组合付款'
5: '组合付款',
6:'内部结算'
}
}
}
......@@ -38,7 +38,7 @@
</template>
</GlCell>
</view>
<view class="btns flex">
<view class="btns flex" v-if="orderObj.baseSceneCodeValue">
<view class="btn save" @click="handleEditSave">存草稿</view>
<view @click="submit" class="btn">{{ confirmText }}</view>
</view>
......@@ -184,6 +184,55 @@ export default {
this.initData()
},
methods: {
updateSceneGate () {
const selected = Boolean(this.orderObj && (this.orderObj.baseSceneCodeValue || this.orderObj.baseSceneCode))
const list = this.formList || []
list.forEach(group => {
;(group || []).forEach(item => {
if (!item) return
if (item._originHidden === undefined) item._originHidden = Boolean(item.hidden)
if (!selected) {
item.hidden = item.value !== 'baseSceneCode'
} else {
item.hidden = item._originHidden
}
})
})
this.formList = list
return selected
},
async initRecentSceneEcho () {
try {
const userInfo = this.userInfo || (uni.$storage.get('userInfo') || {})
const phone = userInfo.phone
const userSceneType = userInfo.sceneType
if (!phone || userSceneType === undefined || userSceneType === null) return
const recent = await uni.$api.equityApi.getUserRecentScene({
phone,
sceneType: userSceneType
})
// HTTP 层已将 data.data 解包,recent 直接是 { baseSceneCode: '...' }
const recentBaseSceneCode = recent?.baseSceneCode || recent?.uuid
if (!recentBaseSceneCode) return
// getSceneListWithOrder 有 Promise 缓存,不会重复发请求
const rawList = await uni.$api.equityApi.getSceneListWithOrder({
phone,
sceneType: String(userSceneType)
})
const listData = Array.isArray(rawList) ? rawList : []
const item = listData.find(i => String(i.baseSceneCode || i.uuid) === String(recentBaseSceneCode))
if (!item) return
this.$set(this.orderObj, 'baseSceneCode', item.name || item.staffName)
this.$set(this.orderObj, 'baseSceneCodeValue', item.baseSceneCode || item.uuid)
this.$set(this.orderObj, 'sceneType', item.sceneType)
// 同步表单展示(GlCell 部分字段依赖 current)
const sceneCell = this.formList?.[0]?.find(v => v && v.value === 'baseSceneCode')
if (sceneCell) sceneCell.current = item.name || item.staffName || ''
} catch (e) {}
},
async getQuotationInfoById(id) {
try {
let { goodsList: quotationGoodsList } = this,
......@@ -415,6 +464,18 @@ export default {
// 埋点
// uni.$track.add({ eventCode: 'app_create_order' })
const { paramsData } = this
// 去报价/编辑进入(带 id)时,优先用入参回显业务场景名称
// 这里不走 recent 覆盖,避免把用户正在编辑的单子场景冲掉
if (paramsData && paramsData.id) {
const sceneName = paramsData.baseSceneName || paramsData.sceneName || ''
const sceneCode = paramsData.baseSceneCode || paramsData.baseSceneId || ''
if (sceneName || sceneCode) {
this.$set(this.orderObj, 'baseSceneCode', sceneName)
this.$set(this.orderObj, 'baseSceneCodeValue', sceneCode)
const sceneCell = this.formList?.[0]?.find(v => v && v.value === 'baseSceneCode')
if (sceneCell) sceneCell.current = sceneName
}
}
// 设置订单类型表单显示(新建订单时)
if (!paramsData.id && this.orderObj.djOrderType) {
const orderTypeCell = this.formList[3]?.find(item => item.value === 'djOrderType')
......@@ -422,7 +483,19 @@ export default {
orderTypeCell.current = this.orderObj.djOrderType
}
}
this.getSelectOrderGoodsList()
// 新增页:先回显最近场景;未选场景时不展示/不请求下方表单与接口
const p = this.paramsData || {}
if (!p.id) {
this.initRecentSceneEcho().finally(() => {
const hasScene = this.updateSceneGate()
if (!hasScene) return
this.getSelectOrderGoodsList()
})
} else {
// 编辑页不做 recent 覆盖
this.updateSceneGate()
this.getSelectOrderGoodsList()
}
if (!paramsData.id) this.getConfig()
this.getShopMerchantPointConfig()
......@@ -510,7 +583,8 @@ export default {
this.popupTitle = {
0: pointsMultiRole == 'Y' ? '销售顾问/录单员' : '推荐人',
4: '车型',
13: payType == 2 ? '4S店收款时间' : '嘀加收款时间'
13: payType == 2 ? '4S店收款时间' : '嘀加收款时间',
29:'确认业务场景名称'
}[this.popupType]
// 确保 orderPopup 引用存在后再调用 open 方法
if (this.$refs.orderPopup && this.$refs.orderPopup.open) {
......@@ -576,6 +650,28 @@ export default {
this.$set(this.orderObj, 'provinceText', chooseContent.province)
this.$set(this.orderObj, 'cityText', chooseContent.city)
this.$set(this.orderObj, 'city', chooseContent.city == chooseContent.province ? chooseContent.city : `${chooseContent.province}-${chooseContent.city}`)
} else if (_typeValue.key === 'baseSceneCode') {
// 场景名称:界面显示名称;提交时使用 code
this.$set(this.orderObj, 'baseSceneCode', chooseContent.name || chooseContent.staffName)
this.$set(this.orderObj, 'baseSceneCodeValue', chooseContent.baseSceneCode || chooseContent.uuid)
this.$set(this.orderObj, 'sceneType', chooseContent.sceneType)
// 选择后保存最近选中场景(sceneType 用登录场景)
const userInfo = this.userInfo || (uni.$storage.get('userInfo') || {})
if (userInfo.phone) {
uni.$api.equityApi.saveUserRecentScene({
phone: userInfo.phone,
sceneType: userInfo.sceneType,
baseSceneCode: chooseContent.baseSceneCode || chooseContent.uuid
})
}
// 选中场景后,放开下方表单并触发依赖接口
// 立即清空 goodsList,确保弹窗打开时 externalData 为空,迫使 SkuGoodsList 重新调接口
this.goodsList = []
this.$set(this.orderObj, 'skuGoods', [])
this.changeTotalPrice()
this.$refs.orderPopup && this.$refs.orderPopup.clearCacheByTypes([0, 1, 3, 6, 7, 8, 9, 10, 11, 12])
this.updateSceneGate()
this.getSelectOrderGoodsList()
} else if (_typeValue.key == 'todayShow') {
this.$set(this.orderObj, 'pay2Time', chooseContent)
} else if (_typeValue.list == 'employeeList') {
......@@ -842,8 +938,14 @@ export default {
console.log(error)
this.saveStatus = false
uni.hideLoading()
let title = '提交失败'
if (typeof error === 'string' && error) title = error
else if (error instanceof Error && error.message) title = error.message
else if (error && typeof error === 'object' && typeof error.message === 'string' && error.message) {
title = error.message
}
uni.showToast({
title: '提交失败',
title,
icon: 'none'
})
}
......@@ -984,6 +1086,9 @@ export default {
}
}
if (orderInfo.id) params.id = orderInfo.id
// 场景 code(用于后端入参)
if (orderInfo.baseSceneCodeValue) params.baseSceneCode = orderInfo.baseSceneCodeValue
else if (orderInfo.baseSceneCode) params.baseSceneCode = orderInfo.baseSceneCode
params.merchantId4s = default4SStoreInfo?.merchantId
params.merchantName4s = default4SStoreInfo?.merchantName
orderInfo.price = this.multipliedByHundred(orderInfo.price)
......@@ -1219,7 +1324,8 @@ export default {
})
const res = await uni.$api.boutiqueApi.getSelectOrderGoodsList({
merchantId: userInfo.shopMerchantId,
sceneType: userInfo.sceneType
sceneType: userInfo.sceneType,
baseSceneCode: this.orderObj.baseSceneCodeValue
})
this.goodsList = res
this.changeTotalPrice()
......
......@@ -31,7 +31,7 @@
</GlCell>
</view>
</scroll-view>
<view class="btns flex">
<view class="btns flex" v-if="orderObj.baseSceneCodeValue">
<view @click.stop="submit('reload')" class="btn save">提交后继续添加</view>
<view @click.stop="submit" class="btn">战败下单</view>
</view>
......@@ -80,6 +80,16 @@ export default {
const baseFields = ['id', 'orderCode', 'userId', 'employeeName', 'defeatEmployeeName', 'deliveryUserId', 'subShopMerchantName', 'subShopMerchantId', 'sellerName', 'sellerUserId', 'sellerMerchantName', 'sellerMerchantId', 'merchantId', 'merchantName', 'customerCouponId']
Object.assign(this.orderObj, Object.fromEntries(baseFields.map(field => [field, rest[field]])))
// 场景回显:列表进入会带 baseSceneName/baseSceneCode
const sceneName = rest.baseSceneName || rest.sceneName || ''
const sceneCode = rest.baseSceneCode || rest.baseSceneId || ''
if (sceneName || sceneCode) {
this.$set(this.orderObj, 'baseSceneCode', sceneName)
this.$set(this.orderObj, 'baseSceneCodeValue', sceneCode)
const sceneCell = this.formList?.[0]?.find(item => item.value === 'baseSceneCode')
if (sceneCell) sceneCell.current = sceneName
}
this.orderObj.carBrand = `${customer.carBrand}-${customer.carChildsBrandName}-${customer.carSeriesName}`
const weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
this.$set(this.orderObj, 'todayShow', dayjs(this.orderObj.createDate).format('YYYY-MM-DD') + ' ' + weeks[dayjs(this.orderObj.createDate).day()])
......@@ -176,6 +186,55 @@ export default {
this.initData()
},
methods: {
updateSceneGate () {
const selected = Boolean(this.orderObj && (this.orderObj.baseSceneCodeValue || this.orderObj.baseSceneCode))
const list = this.formList || []
list.forEach(group => {
;(group || []).forEach(item => {
if (!item) return
if (item._originHidden === undefined) item._originHidden = Boolean(item.hidden)
if (!selected) {
item.hidden = item.value !== 'baseSceneCode'
} else {
item.hidden = item._originHidden
}
})
})
this.formList = list
return selected
},
async initRecentSceneEcho () {
try {
const userInfo = this.userInfo || (uni.$storage.get('userInfo') || {})
const phone = userInfo.phone
const userSceneType = userInfo.sceneType
if (!phone || userSceneType === undefined || userSceneType === null) return
const recent = await uni.$api.equityApi.getUserRecentScene({
phone,
sceneType: userSceneType
})
// HTTP 层已将 data.data 解包,recent 直接是 { baseSceneCode: '...' }
const recentBaseSceneCode = recent?.baseSceneCode || recent?.uuid
if (!recentBaseSceneCode) return
// getSceneListWithOrder 有 Promise 缓存,不会重复发请求
const rawList = await uni.$api.equityApi.getSceneListWithOrder({
phone,
sceneType: String(userSceneType)
})
const listData = Array.isArray(rawList) ? rawList : []
const item = listData.find(i => String(i.baseSceneCode || i.uuid) === String(recentBaseSceneCode))
if (!item) return
this.$set(this.orderObj, 'baseSceneCode', item.name || item.staffName)
this.$set(this.orderObj, 'baseSceneCodeValue', item.baseSceneCode || item.uuid)
this.$set(this.orderObj, 'sceneType', item.sceneType)
// 同步表单展示(GlCell 某些字段依赖 current)
const sceneCell = this.formList?.[0]?.find(v => v && v.value === 'baseSceneCode')
if (sceneCell) sceneCell.current = item.name || item.staffName || ''
} catch (e) {}
},
resetParams() {
// 重置表单数据
this.orderObj = {
......@@ -206,6 +265,10 @@ export default {
merchantName: userInfo.shopMerchantName
})
}
// 进页面回显最近一次选中的场景
if (!this.orderObj.id) await this.initRecentSceneEcho()
const hasScene = this.updateSceneGate()
if (!hasScene) return
await this.getEmployeeList()
this.getLastUserOrderInfo()
this.getGoodsProduct()
......@@ -248,7 +311,9 @@ export default {
const { shopMerchantId, sceneType, merchantId } = userInfo,
data = await uni.$api.popupApi.getEmployeeList({
merchantId: orderObj.idKey == 'sellerUserId' ? merchantId : shopMerchantId,
sceneList: orderObj.idKey == 'sellerUserId' ? '' : [sceneType]
sceneList: orderObj.idKey == 'sellerUserId'
? ''
: [this.orderObj.sceneType != null ? this.orderObj.sceneType : sceneType]
})
if (data && data.length) {
this.employeeList = data
......@@ -305,6 +370,32 @@ export default {
const weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
this.$set(this.orderObj, 'todayShow', dayjs(chooseContent).format('YYYY-MM-DD') + ' ' + weeks[dayjs(chooseContent).day()])
this.$set(this.orderObj, 'createDate', dayjs(chooseContent).format('YYYY-MM-DD'))
} else if (_typeValue.key === 'baseSceneCode') {
// 场景名称:页面显示名称;后续接口参数使用 sceneType/code
this.$set(this.orderObj, 'baseSceneCode', chooseContent.name || chooseContent.staffName)
this.$set(this.orderObj, 'baseSceneCodeValue', chooseContent.baseSceneCode || chooseContent.uuid)
this.$set(this.orderObj, 'sceneType', chooseContent.sceneType)
// 选择后保存最近选中场景(sceneType 用登录场景)
const userInfo = this.userInfo || (uni.$storage.get('userInfo') || {})
if (userInfo.phone) {
uni.$api.equityApi.saveUserRecentScene({
phone: userInfo.phone,
sceneType: userInfo.sceneType,
baseSceneCode: chooseContent.baseSceneCode || chooseContent.uuid
})
}
// 场景名称切换时,清除已选/带入的商品(与新建工单一致)
const productFields = ['frontGear', 'frontWindow', 'rearGear', 'rearWindow', 'sunRoof', 'package', 'skuGoods']
productFields.forEach(field => {
this.$set(this.orderObj, field, null)
})
this.goodsList = []
// 按新场景重拉报价商品列表,更新 defaultMsg.vdQuotationGoodsList(取列表首条)
this.getGoodsProduct()
// 选中场景后,放开下方表单并触发依赖接口
this.$refs.orderPopup && this.$refs.orderPopup.clearCacheByTypes([0, 1, 3, 6, 7, 8, 9, 10, 11, 12])
this.updateSceneGate()
this.getEmployeeList()
}
// 定义产品相关字段数组
if (val.popupType == 20) {
......@@ -407,6 +498,11 @@ export default {
let { default4SStoreInfo } = this.userInfo
console.log(default4SStoreInfo, '4s店信息')
let params = this.defaultMsg
// 业务场景(与新建工单一致:提交使用 code;页面展示用 name)
params.baseSceneCode = this.orderObj.baseSceneCodeValue || this.orderObj.baseSceneCode
if (this.orderObj.sceneType !== undefined && this.orderObj.sceneType !== null) {
params.sceneType = this.orderObj.sceneType
}
params.owner.owner = this.orderObj.customerName
params.owner.phone = this.orderObj.customerPhone
params.owner.salesType = this.orderObj.salesType
......@@ -436,14 +532,22 @@ export default {
}
}, 300),
// 获取商品列表数据
// 获取商品列表数据(与权益新建工单 getSelectOrderGoodsList 一致带上场景,便于切换场景名称后刷新 vdQuotationGoodsList 数据源)
getGoodsProduct() {
let { default4SStoreInfo } = this.userInfo
const userInfo = this.userInfo || {}
const { default4SStoreInfo } = userInfo
if (!default4SStoreInfo?.merchantId) return
const params = {
merchantId: default4SStoreInfo.merchantId,
suitCarPrice: ''
}
const baseSceneCode = this.orderObj.baseSceneCodeValue || this.orderObj.baseSceneCode
if (baseSceneCode) params.baseSceneCode = baseSceneCode
if (userInfo.sceneType !== undefined && userInfo.sceneType !== null) {
params.sceneType = userInfo.sceneType
}
uni.$api.equityApi
.quotationGoodsList({
merchantId: default4SStoreInfo.merchantId,
suitCarPrice: ''
})
.quotationGoodsList(params)
.then(data => {
data = data.map(ele => {
if (ele.goods) {
......
......@@ -397,6 +397,10 @@ export default {
selectType: 1,
pointsMultiObj: [
{
label: '场景名称',
key: 'baseSceneName'
},
{
label: '销售顾问 /录单员',
arr: ['merchantName', 'referrerName']
},
......@@ -453,6 +457,10 @@ export default {
],
orderObj: [
{
label: '场景名称',
key: 'baseSceneName'
},
{
label: '销售顾问',
arr: ['merchantName', 'referrerName']
},
......
......@@ -200,6 +200,8 @@ export default {
merchantIds: [localUserInfo.shopMerchantId],
...this.searchObj
}
// 兼容筛选入参:baseSceneCode 为空字符串表示“全部”,请求时不下发该字段
if (params.baseSceneCode === '') delete params.baseSceneCode
uni.$api.equityApi
.orderStatistics(params)
.then(result => {
......@@ -265,6 +267,8 @@ export default {
merchantIds: [localUserInfo.shopMerchantId],
...this.searchObj
}
// 兼容筛选入参:baseSceneCode 为空字符串表示“全部”,请求时不下发该字段
if (params.baseSceneCode === '') delete params.baseSceneCode
if (params?.zyPayStatus == '1') params.orderStatus = 7
// if (staffUuid) {
// params.transferIds = [staffUuid]
......
const FORM_LIST = [
[
{
label: '场景名称',
value: 'baseSceneCode',
type: 'select',
key: 'baseSceneCode',
required: true
},
{
label: '销售顾问/录单员',
value: 'referrer',
type: 'select',
......@@ -39,11 +46,15 @@ const FORM_LIST = [
radioList: [
{
value: '0',
name: '售前'
name: '门店引流-售前'
},
{
value: '1',
name: '售后'
name: '门店引流-售后'
},
{
value: '2',
name: '自然到店'
}
],
required: true
......@@ -215,6 +226,13 @@ const FORM_LIST = [
const DEFEAT_FORM_LIST = [
[
{
label: '场景名称',
value: 'baseSceneCode',
type: 'select',
key: 'baseSceneCode',
required: true
},
{
label: '战败日期',
value: 'todayShow',
type: 'select',
......@@ -254,11 +272,15 @@ const DEFEAT_FORM_LIST = [
radioList: [
{
value: '0',
name: '售前'
name: '门店引流-售前'
},
{
value: '1',
name: '售后'
name: '门店引流-售后'
},
{
value: '2',
name: '自然到店'
}
],
required: true
......@@ -407,6 +429,11 @@ const popupTypeEnum = {
// 订单类型弹窗(OrderTypePopup)
key: 'djOrderType',
list: ''
},
29: {
// 场景名称弹窗(SceneList)
key: 'baseSceneCode',
list: ''
}
}
const titleList = [null, { addHtml: 'customer' }, { name: '车辆信息' }, { name: '增值车损险' }, { name: '其他信息' }]
......@@ -435,11 +462,15 @@ const UpdateOrderInfo = [
radioList: [
{
value: '0',
name: '售前'
name: '门店引流-售前'
},
{
value: '1',
name: '售后'
name: '门店引流-售后'
},
{
value: '2',
name: '自然到店'
}
]
},
......
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2024-09-03 13:48:51
* @LastEditors: cenchengwei@foreverht.com
* @LastEditTime: 2026-04-08 15:31:03
* @FilePath: /gl_tape/utils/logger/LogCat.js
*/
import { getTime } from './util'
import { serializeIfObject } from '../utils'
import TaskQueue from '../TaskQueue'
class LogCat {
main = plus.android.runtimeMainActivity()
File = plus.android.importClass('java.io.File')
......@@ -33,14 +23,12 @@ class LogCat {
currentFos = null // 当前 FileOutputStream
currentLogFile = '' // 当前打开的日志文件路径
closeTimer = null // 自动关闭流的定时器
constructor(folderName = '_zyzs_log') {
try {
let file = null
if (this.Environment.MEDIA_MOUNTED || !this.Environment.isExternalStorageRemovable()) {
file = this.main.getExternalFilesDir(null)
}
if (file) {
this.LogPath = file.getPath() + folderName
} else {
......@@ -69,12 +57,10 @@ class LogCat {
})
})
}
// 真正的写入逻辑(私有方法)
_doWriteLog(tag, messages) {
// 如果路径初始化失败,直接放弃写入,避免报错
if (!this.LogPath) return
let msg = ''
try {
if (messages instanceof Error) {
......@@ -93,7 +79,6 @@ class LogCat {
if (this.lastCleanDate && date !== this.lastCleanDate) {
this.lastCleanDate = date
}
let datetime = getTime()
//文件名
let fileName = this.LogPath + '/' + date + '.txt'
......@@ -114,7 +99,6 @@ class LogCat {
if (this.logDirFile && !this.logDirFile.exists()) {
this.logDirFile.mkdirs()
}
try {
// 1. 如果当前没有流,或者文件名变了(跨天),则重新打开
if (!this.currentWriter || this.currentLogFile !== fileName) {
......@@ -131,7 +115,6 @@ class LogCat {
// 3. 刷新缓冲区,确保内容真正写入磁盘(虽然有性能损耗,但防止崩溃丢日志)
// 也可以选择积累一定量再 flush,这里为了安全选择每次 flush
this.currentWriter.flush()
// 4. 重置自动关闭定时器 (5秒后无操作自动关闭)
if (this.closeTimer) {
clearTimeout(this.closeTimer)
......@@ -139,14 +122,12 @@ class LogCat {
this.closeTimer = setTimeout(() => {
this._closeStream()
}, 5000)
} catch (e) {
console.log('日志写入失败:', e)
// 发生异常时尝试关闭流,以便下次重试
this._closeStream()
}
}
// 关闭当前流
_closeStream() {
try {
......@@ -171,7 +152,6 @@ class LogCat {
console.log('关闭日志流失败:', e)
}
}
// 自动清理旧日志
_cleanOldLogs(daysToKeep) {
// 放入队列异步执行,不影响启动速度
......@@ -203,7 +183,6 @@ class LogCat {
})
})
}
// 删除日志
removeLogFile(fileName) {
try {
......@@ -222,7 +201,6 @@ class LogCat {
if (!this.LogPath) return []
let file = new this.File(this.LogPath)
if (!file.exists()) return []
let tempList = file.listFiles()
if (!tempList || tempList.length === 0) return []
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!