Commit 70aa58ea by liimin

feat: 新增接待记录功能并优化客户信息管理

- 新增reception.js模块处理接待记录保存
- 在DBManager和RecordDto中添加result字段
- 优化客户信息表单,增加客户类型单选和手机号验证
- 新增material模块管理素材信息
- 实现AES解密功能用于OSS配置
- 重构上传逻辑,支持加密配置解密
- 修复时间格式和接待状态同步问题
- 移除废弃的record模块,功能合并到commonApi
1 parent 4f13ce6f
...@@ -466,5 +466,8 @@ module.exports = { ...@@ -466,5 +466,8 @@ module.exports = {
// Pad业务类型列表 // Pad业务类型列表
getPadBusinessTypeList(data = {}) { getPadBusinessTypeList(data = {}) {
return http.shukeRequest('linkwe-gateway/reception/pad/materials/biz-types/list', data, 'POST', true) return http.shukeRequest('linkwe-gateway/reception/pad/materials/biz-types/list', data, 'POST', true)
} },
getOSSToken (data) {
return http.shukeRequest('linkwe-gateway/file/get/config', data, 'GET')
},
} }
...@@ -5,7 +5,7 @@ import boutiqueApi from './boutique' ...@@ -5,7 +5,7 @@ import boutiqueApi from './boutique'
import customerApi from './customerApi' import customerApi from './customerApi'
import sceneMarketApi from './sceneMarketApi' import sceneMarketApi from './sceneMarketApi'
import loginApi from './loginApi' import loginApi from './loginApi'
import record from './record' import reception from './reception'
module.exports = { module.exports = {
commonApi, commonApi,
...@@ -15,5 +15,5 @@ module.exports = { ...@@ -15,5 +15,5 @@ module.exports = {
customerApi, customerApi,
sceneMarketApi, sceneMarketApi,
loginApi, loginApi,
record reception
} }
import http from '../request/http' import http from '../request/http'
import { env } from '../../env'
module.exports = { module.exports = {
getOSSToken (data) { save (data) {
return http.shukeRequest('linkwe-gateway/file/get/config', data, 'GET', true) return http.shukeRequest('linkwe-gateway/reception/reception/save', data, 'POST',true)
}, },
} }
\ No newline at end of file \ No newline at end of file
...@@ -179,7 +179,7 @@ class Request { ...@@ -179,7 +179,7 @@ class Request {
return new Promise(resolve => { return new Promise(resolve => {
uni.getNetworkType({ uni.getNetworkType({
success (res) { success (res) {
if (res.networkType == 'none') { if (res.networkType == 'none') {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: '网络异常', title: '网络异常',
...@@ -196,7 +196,6 @@ class Request { ...@@ -196,7 +196,6 @@ class Request {
dataType: 'json', dataType: 'json',
responseType: 'text', responseType: 'text',
success (response) { success (response) {
console.log(response)
let { data, statusCode } = response let { data, statusCode } = response
if (returnAll) { if (returnAll) {
resolve(data) resolve(data)
......
<template> <template>
<view class="step"> <view class="step">
<MessageBox <MessageBox ref="formRef" @cancel="cancel" @confirm="submit" :cancelBtnText="`${step == 1 ? '取消' : '上一步'}`" :confirmBtnText="`${sceneType == 0 ? (step == 1 ? '下一步' : '完成接待') : '完成接待'}`" :title="`${step == 1 ? '客户信息完善' : '结果反馈'}`" :popupW="820" :maxHeight="820" :isAutoClose="false">
ref="formRef" <view name="content" :key="updateViewKey">
@cancel="cancel"
@confirm="submit"
:cancelBtnText="`${step == 1 ? '取消' : '上一步'}`"
:confirmBtnText="`${sceneType == 0 ? (step == 1 ? '下一步' : '完成接待') : '完成接待'}`"
:title="`${step == 1 ? '客户信息完善' : '结果反馈'}`"
:popupW="820"
:maxHeight="820"
:isAutoClose="false"
>
<view
name="content"
:key="updateViewKey"
>
<template v-if="step == 1"> <template v-if="step == 1">
<template v-if="!check(true)"> <template v-if="!check(true)">
<view <view class="error-tip" v-if="errorTip">以下信息不能为空,请完善信息后保存</view>
class="error-tip" <view class="pop-tips" v-else>{{ tips }}</view>
v-if="errorTip"
>以下信息不能为空,请完善信息后保存</view>
<view
class="pop-tips"
v-else
>{{ tips }}</view>
</template> </template>
<view class="form"> <view class="form">
<template v-for="(i, index) in formObject"> <template v-for="(i, index) in formObject">
<view <view class="form-item" :key="index">
class="form-item"
:key="index"
>
<view :class="['label', { required: i.required }]">{{ i.label }}</view> <view :class="['label', { required: i.required }]">{{ i.label }}</view>
<view :class="['value', { error: showError(i.key) && i.required }, { disabled: customerType == 0 || i.disabled }]"> <view :class="['value', { error: showError(i.key) && i.required }, { disabled: customerType == 0 || i.disabled }, { 'is-radio': i.type == 'radio' }]">
<template v-if="i.type == 'input'"> <template v-if="i.type == 'input'">
<input <input :type="i.inputType" :maxlength="i.maxlength" v-model="formData[i.key]" class="input" :placeholder="i.placeholder" :disabled="customerType == 0" @input="inputCustomer" placeholder-style="color:#c9c9c9;" />
:type="i.inputType"
:maxlength="i.maxlength"
v-model="formData[i.key]"
class="input"
:placeholder="i.placeholder"
:disabled="customerType == 0"
@input="inputCustomer"
placeholder-style="color:#c9c9c9;"
/>
</template> </template>
<template v-else> <template v-else-if="i.type == 'radio'">
<radio-group @change="radioChange">
<template v-for="(item, index) in i.items">
<label class="radio" :key="index">
<radio :value="item.value" :checked="formData[i.key] == item.value" />
{{ item.label }}
</label>
</template>
</radio-group>
</template>
<!-- <template v-else>
<view <view
:class="['select', `${formData[i.key] ? '' : 'placeholder'}`]" :class="['select', `${formData[i.key] ? '' : 'placeholder'}`]"
@click="showPopup(i)" @click="showPopup(i)"
...@@ -59,7 +38,7 @@ ...@@ -59,7 +38,7 @@
:size="16" :size="16"
></uni-icons> ></uni-icons>
</view> </view>
</template> </template> -->
</view> </view>
</view> </view>
</template> </template>
...@@ -69,11 +48,7 @@ ...@@ -69,11 +48,7 @@
<view class="pop-tips">请完善本次接待结果</view> <view class="pop-tips">请完善本次接待结果</view>
<view class="choose-box"> <view class="choose-box">
<template v-for="(i, index) in resultList"> <template v-for="(i, index) in resultList">
<view <view :class="['choose-item', `${i.status == receptionStatus ? (i.status == 1 ? 'success' : 'error') : ''}`]" :key="index" @click="chooseResult(i.status)">
:class="['choose-item', `${i.status == receptionStatus ? (i.status == 1 ? 'success' : 'error') : ''}`]"
:key="index"
@click="chooseResult(i.status)"
>
<view :class="['sprite-icon', `icon-face-${i.status == receptionStatus ? `${i.icon}-active` : i.icon}`]"></view> <view :class="['sprite-icon', `icon-face-${i.status == receptionStatus ? `${i.icon}-active` : i.icon}`]"></view>
{{ i.text }} {{ i.text }}
</view> </view>
...@@ -82,22 +57,15 @@ ...@@ -82,22 +57,15 @@
</template> </template>
</view> </view>
</MessageBox> </MessageBox>
<uni-popup <uni-popup ref="successRef" type="message">
ref="successRef" <uni-popup-message type="success" message="数据保存成功" :duration="1500"></uni-popup-message>
type="message"
>
<uni-popup-message
type="success"
message="数据保存成功"
:duration="1500"
></uni-popup-message>
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
const phoneRex = /^[1]([3-9])[0-9]{9}$/; const phoneRex = /^[1]([2-9])[0-9]{9}$/;
const formObject_boutique = [{ const formObject_boutique = [{
label: "客户姓名", label: "客户姓名",
key: "customerName", key: "customerName",
...@@ -158,6 +126,27 @@ export default { ...@@ -158,6 +126,27 @@ export default {
placeholder: '请输入车主电话', placeholder: '请输入车主电话',
required: true required: true
}, },
{
label: "客户类型",
key: "customerType",
type: "radio",
items: [
{
label: "VIP",
value: 'VIP'
},
{
label: "潜客",
value: '潜客'
},
{
label: "普通",
value: '普通'
}
],
placeholder: '请输入客户类型',
required: true
},
{ {
label: "品牌车型", label: "品牌车型",
key: "carType", key: "carType",
...@@ -171,19 +160,19 @@ export default { ...@@ -171,19 +160,19 @@ export default {
customerName: "", customerName: "",
carType: "", carType: "",
customerPhone: "", customerPhone: "",
salesUuid: "", customerType: ''
}, },
resultList: [ resultList: [
{ {
icon: 'success', icon: 'success',
text: '结果完美,成交了', text: '结果完美,成交了',
status: 1 status: "完成"
}, },
{ {
icon: 'error', icon: 'error',
text: '仍需努力,战败了', text: '仍需努力,战败了',
status: 0 status: "未完成"
} }
], ],
errorTip: false, errorTip: false,
...@@ -296,7 +285,7 @@ export default { ...@@ -296,7 +285,7 @@ export default {
}, },
open () { open () {
this.$store.dispatch('getCustomerInfo').then((customerInfo) => { this.$store.dispatch('getCustomerInfo').then((customerInfo) => {
this.formData = customerInfo this.formData = { ...this.formData, ...customerInfo }
let { sceneType, customerType } = this, let { sceneType, customerType } = this,
step = Object.values(customerInfo).every((value) => !!value) ? 2 : 1 step = Object.values(customerInfo).every((value) => !!value) ? 2 : 1
this.errorTip = false this.errorTip = false
...@@ -320,6 +309,10 @@ export default { ...@@ -320,6 +309,10 @@ export default {
chooseResult (val) { chooseResult (val) {
this.receptionStatus = val this.receptionStatus = val
this.setReceptionStatus(val); this.setReceptionStatus(val);
},
radioChange (e) {
this.formData.customerType = e.detail.value
this.$store.dispatch('setCustomerInfo', this.formData)
} }
} }
} }
...@@ -384,6 +377,27 @@ export default { ...@@ -384,6 +377,27 @@ export default {
border: toRpx(2) solid #f24724; border: toRpx(2) solid #f24724;
border-radius: toRpx(8); border-radius: toRpx(8);
} }
&.is-radio {
border: none;
background: none;
padding-left: 0;
&.error {
border: toRpx(2) solid #f24724;
}
radio-group {
display: flex;
align-items: center;
height: 100%;
.radio {
display: flex;
align-items: center;
margin-right: toRpx(30);
}
}
}
.input, .input,
.select { .select {
width: 100%; width: 100%;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</movable-area> </movable-area>
<!-- 标题:与当前中心卡片 materialName 联动 --> <!-- 标题:与当前中心卡片 materialName 联动 -->
<view class="module-title flex"> <view class="module-title flex">
{{ moduleTitle }} {{ moduleTitle +'1'}}
</view> </view>
<!-- 指示点:与 currentIndex 同步高亮 --> <!-- 指示点:与 currentIndex 同步高亮 -->
<view class="module-dots flex"> <view class="module-dots flex">
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<body> <body>
<div class="loading"></div> <div class="loading"></div>
<script src="js/uni.webview.1.5.5.js"></script> <script src="js/uni.webview.1.5.5.js"></script>
<script src="js/aliyun-oss-sdk-6.18.1.min.js"></script> <script src="js/aliyun-oss-sdk-6.20.0.min.js"></script>
<script src="js/OSSUpLoader.js"></script> <script src="js/OSSUpLoader.js"></script>
<script> <script>
// document.addEventListener('UniAppJSBridgeReady', function(){ // document.addEventListener('UniAppJSBridgeReady', function(){
......
...@@ -91,7 +91,7 @@ class OSSUpLoader { ...@@ -91,7 +91,7 @@ class OSSUpLoader {
bucket, bucket,
accessKeyId, accessKeyId,
accessKeySecret, accessKeySecret,
// stsToken // stsToken,
}) })
} }
_normalizeFileName(fileName) { _normalizeFileName(fileName) {
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
import CryptoJS from '@/utils/ossUploadFile/crypto.js'
// 注意:keyAES 需要确保与后端加密时使用的密钥一致
// 如果用户没有提供具体的 keyAES,这里先定义一个占位符或者需要用户补充
// 假设用户提到的 keyAES 是一个全局变量或者需要在这里定义
const keyAES = 'qykj@20221101_te'
export function decryptAES(str) {
if (!str) return str
try {
var key = CryptoJS.enc.Utf8.parse(keyAES)
var decrypt = CryptoJS.AES.decrypt(str, key, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
})
return CryptoJS.enc.Utf8.stringify(decrypt).toString()
} catch (e) {
console.error('AES decryption failed:', e)
return str
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-12-26 10:03:54 * @Date: 2024-12-26 10:03:54
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-23 16:48:13 * @LastEditTime: 2025-12-24 15:09:02
* @FilePath: \simgle_app\mixin\record\recorder.js * @FilePath: \simgle_app\mixin\record\recorder.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -44,11 +44,11 @@ export default { ...@@ -44,11 +44,11 @@ export default {
// this.handler(val, this.updateBookList) // this.handler(val, this.updateBookList)
// } // }
// }, // },
// receptionStatus: { receptionStatus: {
// handler(val) { handler(val) {
// this.handler(val, this.updateReceptionStatus) this.handler(val, this.updateReceptionStatus)
// } }
// }, },
// receptionKey: { // receptionKey: {
// handler(val) { // handler(val) {
// this.handler(this.receptionTrack, this.updateMaterialPointList) // this.handler(this.receptionTrack, this.updateMaterialPointList)
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
}, },
computed: { computed: {
...mapState(['user.customerInfo']), ...mapState(['user.customerInfo']),
...mapGetters(['customerInfo', 'receptionStatus', 'receptionTrack', 'receptionKey', 'customerKey']) ...mapGetters(['customerInfo', 'receptionStatus', 'receptionTrack', 'receptionKey', 'customerKey', 'typeCode', 'materialId'])
}, },
methods: { methods: {
...mapMutations('audio', ['setReceptionStatus', 'setPerRecordNumber']), ...mapMutations('audio', ['setReceptionStatus', 'setPerRecordNumber']),
...@@ -127,6 +127,7 @@ export default { ...@@ -127,6 +127,7 @@ export default {
return return
} }
this.record.setReceptionEndTime() //设置接待结束时间 this.record.setReceptionEndTime() //设置接待结束时间
//如果不需要保存记录 //如果不需要保存记录
await this.record.save() await this.record.save()
}, },
...@@ -147,8 +148,10 @@ export default { ...@@ -147,8 +148,10 @@ export default {
}, },
initDto() { initDto() {
const userInfo = storageApi.getUserInfo() || {} const userInfo = storageApi.getUserInfo() || {}
console.log("🚀 ~ userInfo:", userInfo) const {
const { user:{userId,userName,deptId},sceneType='' } = userInfo user: { userId, userName, deptId },
sceneType = ''
} = userInfo
const { deviceId: machineCode } = uni.getDeviceInfo() const { deviceId: machineCode } = uni.getDeviceInfo()
const dto = new RecordDto({ const dto = new RecordDto({
userId, userId,
...@@ -160,13 +163,21 @@ export default { ...@@ -160,13 +163,21 @@ export default {
this.tempRecord = dto this.tempRecord = dto
}, },
updateCustomerInfo(customerInfo = {}) { updateCustomerInfo(customerInfo = {}) {
const { customerName, customerPhone, customerType, carType} = customerInfo const { customerName, customerPhone, customerType, carType } = customerInfo
this.record.updatePreRecords({ const params = {
customerName, customerName,
customerPhone, customerPhone,
customerType, customerType,
carType carType
}) }
if (!this.record.currentRecord?.typeCode) {
const typeItem = uni.$storage.get('typeItem') || {}
params.typeCode = typeItem.typeCode || ''
}
if (!this.record.currentRecord?.materialId) {
params.materialId = this.materialId || ''
}
this.record.updatePreRecords(params)
}, },
// updateBookList(booksList) { // updateBookList(booksList) {
// const receptionCustomerPaySourceList = booksList.map(item => { // const receptionCustomerPaySourceList = booksList.map(item => {
...@@ -192,9 +203,9 @@ export default { ...@@ -192,9 +203,9 @@ export default {
// }) // })
// this.record.updatePreRecords({ receptionCustomerMaterialPointList }) // this.record.updatePreRecords({ receptionCustomerMaterialPointList })
// }, // },
// updateReceptionStatus(status) { updateReceptionStatus(status) {
// this.record.updatePreRecords({ receptionStatus: status }) this.record.updatePreRecords({ result: status })
// }, },
getRecorder() { getRecorder() {
return this.record return this.record
}, },
......
...@@ -6,6 +6,7 @@ import { FileStatus } from '../../utils/common' ...@@ -6,6 +6,7 @@ import { FileStatus } from '../../utils/common'
import { serializeIfObject } from '../../utils/utils' import { serializeIfObject } from '../../utils/utils'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import TimeoutManager from '@/utils/TimeoutManager.js' import TimeoutManager from '@/utils/TimeoutManager.js'
import { decryptAES } from '@/lib/aes.js'
const UPLOAD_INTERVAL = 0.5 * 60 * 1000 const UPLOAD_INTERVAL = 0.5 * 60 * 1000
const TIME_OUT_TIME = 15 * 60 * 1000 const TIME_OUT_TIME = 15 * 60 * 1000
export default { export default {
...@@ -45,6 +46,20 @@ export default { ...@@ -45,6 +46,20 @@ export default {
}, },
/** /**
* 格式化日志数据,移除 Buffer 数据
* @param {Object} data - 要格式化的数据
* @returns {string} - 格式化后的 JSON 字符串
*/
_formatLog(data) {
return JSON.stringify(data, (key, value) => {
if (value && value.type === 'Buffer' && Array.isArray(value.data)) {
return '[Buffer Data Omitted]'
}
return value
})
},
/**
* webview文件上传完成后执行的函数 * webview文件上传完成后执行的函数
* @param {*} data * @param {*} data
*/ */
...@@ -108,7 +123,7 @@ export default { ...@@ -108,7 +123,7 @@ export default {
parseFileInfo(data) { parseFileInfo(data) {
try { try {
const input = serializeIfObject(data) const input = serializeIfObject(data)
uni.$logger.local.info(`【上传管理Uploader】 == 开始文件信息解析-> ${input}`) uni.$logger.local.info(`【上传管理Uploader】 == OSS返回文件信息解析-> ${input}`)
if (!data) return null if (!data) return null
const { status } = data const { status } = data
...@@ -245,18 +260,17 @@ export default { ...@@ -245,18 +260,17 @@ export default {
async reportError(message, res, recordId, filePath) { async reportError(message, res, recordId, filePath) {
try { try {
const record = recordId ? await uni.$dbManager.getRecordById(recordId) : {} const record = recordId ? await uni.$dbManager.getRecordById(recordId) : {}
const userInfo = this.userInfo //uni.$storage.get('userInfo') // const userInfo = this.userInfo //uni.$storage.get('userInfo')
const { customerName, phoneNumber, carModel, salesName } = record || {} const { customerName, customerPhone, carType } = record || {}
const { name } = userInfo || {} const { user: { userName } = {} } = this.userInfo || {}
const now = dayjs().format('YYYY-MM-DD HH:mm:ss') const now = dayjs().format('YYYY-MM-DD HH:mm:ss')
uni.$logger.error({ uni.$logger.error({
msg: `${now}-${message},员工: ${name}, 客户: ${customerName}`, msg: `${now}-${message},员工: ${userName}, 客户: ${customerName}`,
extra: { extra: {
'手机号: ': phoneNumber, '员工: ': userName,
'员工: ': name, '客户姓名: ': customerName,
'姓名: ': customerName, '客户手机号: ': customerPhone,
'销售: ': salesName, '车型: ': carType,
'车型: ': carModel,
'原因: ': serializeIfObject(res), '原因: ': serializeIfObject(res),
'文件路径: ': filePath '文件路径: ': filePath
} }
...@@ -339,10 +353,13 @@ export default { ...@@ -339,10 +353,13 @@ export default {
this.save(record) this.save(record)
} else { } else {
try { try {
const token = await uni.$api.record.getOSSToken({}) const token = await uni.$api.commonApi.getOSSToken({})
const { secretKey:lsaccessKeySecret, securityToken='', secretId:lsaccessKeyId,bucketName,region } = token.data let { secretKey: lsaccessKeySecret, securityToken = '', secretId: lsaccessKeyId, bucketName, region } = token || {}
console.log("🚀 ~ token:", token) bucketName = this._tryDecrypt(bucketName, 'Bucket')
this._safeEvalUpload(lsaccessKeyId, lsaccessKeySecret, securityToken, record.fileName, record.filePath, record.recordId,bucketName,region) region = this._tryDecrypt(region, 'Region')
lsaccessKeySecret = this._tryDecrypt(lsaccessKeySecret, 'AccessKeySecret')
lsaccessKeyId = this._tryDecrypt(lsaccessKeyId, 'AccessKeyId')
this._safeEvalUpload(lsaccessKeyId, lsaccessKeySecret, securityToken, record.fileName, record.filePath, record.recordId, bucketName, region)
} catch (error) { } catch (error) {
this.reportError(`上传文件时发生异常(uploadRecord): ${error.message}`) this.reportError(`上传文件时发生异常(uploadRecord): ${error.message}`)
this.endTask() this.endTask()
...@@ -350,11 +367,29 @@ export default { ...@@ -350,11 +367,29 @@ export default {
} }
} }
}, },
_safeEvalUpload(lsaccessKeyId, lsaccessKeySecret, securityToken, fileName, filePath, recordId,bucketName,region) {
/**
* 尝试解密字符串
* @param {string} str - 待解密字符串
* @param {string} label - 日志标识
*/
_tryDecrypt(str, label) {
try {
if (str && (str.includes('=') || str.length > 50)) {
const decrypted = decryptAES(str)
if (decrypted) return decrypted
}
} catch (e) {
console.error(`${label} decryption error`, e)
}
return str
},
_safeEvalUpload(lsaccessKeyId, lsaccessKeySecret, securityToken, fileName, filePath, recordId, bucketName, region) {
if (!this.wv) { if (!this.wv) {
throw new Error('WebView is not initialized') throw new Error('WebView is not initialized')
} }
const args = [lsaccessKeyId, lsaccessKeySecret, securityToken, fileName, filePath, recordId,bucketName,region].map(v => JSON.stringify(String(v || ''))) const args = [lsaccessKeyId, lsaccessKeySecret, securityToken, fileName, filePath, recordId, bucketName, region].map(v => JSON.stringify(String(v || '')))
const script = `msgFromUniapp(${args.join(',')})` const script = `msgFromUniapp(${args.join(',')})`
this.wv.evalJS(script) this.wv.evalJS(script)
}, },
...@@ -427,11 +462,10 @@ export default { ...@@ -427,11 +462,10 @@ export default {
// 3. 提交到服务器 // 3. 提交到服务器
uni.$logger.local.info(`【上传管理Uploader】 == 开始向服务器保存接待记录!!参数: ${JSON.stringify(params)}`) uni.$logger.local.info(`【上传管理Uploader】 == 开始向服务器保存接待记录!!参数: ${JSON.stringify(params)}`)
const res = await uni.$api.commonApi.saveRecCustomer(params) const res = await uni.$api.reception.save(params)
uni.$logger.local.info(`【上传管理Uploader】 == 服务器返回结果: ${JSON.stringify(res)}`) uni.$logger.local.info(`【上传管理Uploader】 == 服务器返回结果: ${JSON.stringify(res)}`)
// 4. 清理本地数据 // 4. 清理本地数据
if (res) { if (res?.code == 200) {
await this._removeRecordFiles(localPaths) await this._removeRecordFiles(localPaths)
await this._removeRecordById(record.id) await this._removeRecordById(record.id)
} }
...@@ -462,7 +496,7 @@ export default { ...@@ -462,7 +496,7 @@ export default {
// 记录日志,显示服务器返回的接待结束时间 // 记录日志,显示服务器返回的接待结束时间
uni.$logger.local.info(`【上传管理Uploader】 == 服务器返回结束接待时间: endTime ->${endTime}`) uni.$logger.local.info(`【上传管理Uploader】 == 服务器返回结束接待时间: endTime ->${endTime}`)
// 返回接待结束时间,将日期格式中的连字符替换为斜杠,以保持一致性 // 返回接待结束时间,将日期格式中的连字符替换为斜杠,以保持一致性
return endTime.replace(/\-/g, '/') return endTime.replace(/\//g, '-')
} catch (error) { } catch (error) {
// 如果请求失败,记录错误信息并抛出错误 // 如果请求失败,记录错误信息并抛出错误
this.reportError(`【上传管理Uploader】 == 向服务器获取结束接待时间异常: error ->${error.message}`, error.message) this.reportError(`【上传管理Uploader】 == 向服务器获取结束接待时间异常: error ->${error.message}`, error.message)
...@@ -607,7 +641,7 @@ export default { ...@@ -607,7 +641,7 @@ export default {
*/ */
async beginTask(record) { async beginTask(record) {
// 将任务函数加入到操作队列中,并在任务完成后调用 polling 函数进行下一轮轮询 // 将任务函数加入到操作队列中,并在任务完成后调用 polling 函数进行下一轮轮询
const label = 'TaskKey: '+this._getTaskKey(record?.recordId, record?.fileName) const label = 'TaskKey: ' + this._getTaskKey(record?.recordId, record?.fileName)
this.operationQueue.enqueue(() => this.task(record), label).finally(() => this._scheduleNext(0)) this.operationQueue.enqueue(() => this.task(record), label).finally(() => this._scheduleNext(0))
}, },
...@@ -760,7 +794,7 @@ export default { ...@@ -760,7 +794,7 @@ export default {
return false return false
}, },
_scheduleNext(ms = 0) { _scheduleNext(ms = 0) {
if(this.snapshot === null) return if (this.snapshot === null) return
if (this._pumpTimer) { if (this._pumpTimer) {
clearTimeout(this._pumpTimer) clearTimeout(this._pumpTimer)
this._pumpTimer = null this._pumpTimer = null
......
...@@ -98,7 +98,6 @@ export default { ...@@ -98,7 +98,6 @@ export default {
// this.$refs.home.updateApp(true) // this.$refs.home.updateApp(true)
this.getHomeSource(mockdata?.typeCode) this.getHomeSource(mockdata?.typeCode)
this.getSoure(mockdata?.typeCode) this.getSoure(mockdata?.typeCode)
// setTimeout(() => { // setTimeout(() => {
// this.start() // this.start()
// }, 1e3) // }, 1e3)
...@@ -108,6 +107,7 @@ export default { ...@@ -108,6 +107,7 @@ export default {
}, },
methods: { methods: {
...mapMutations('audio', ['setReceptionStatus']), ...mapMutations('audio', ['setReceptionStatus']),
...mapMutations('material', ['setTypeCode', 'setMaterial']),
init () { init () {
// this.findPayInfo() // this.findPayInfo()
if (this.requested && !this.id) this.$refs.home.updateApp() if (this.requested && !this.id) this.$refs.home.updateApp()
...@@ -180,6 +180,7 @@ export default { ...@@ -180,6 +180,7 @@ export default {
const typeItem = uni.$storage.get('typeItem') const typeItem = uni.$storage.get('typeItem')
this.getHomeSource(typeItem?.typeCode) this.getHomeSource(typeItem?.typeCode)
this.getSoure(typeItem?.typeCode) this.getSoure(typeItem?.typeCode)
this.setTypeCode(typeItem?.typeCode || '')
}, },
async start (item) { async start (item) {
if (!this.moduleList.length) return uni.showToast({ if (!this.moduleList.length) return uni.showToast({
...@@ -188,13 +189,14 @@ export default { ...@@ -188,13 +189,14 @@ export default {
}) })
const isPermision = await this.$refs.home.isPermission() const isPermision = await this.$refs.home.isPermission()
if (this.recording || !isPermision) return if (this.recording || !isPermision) return
const material = this.moduleList[0]
this.setMaterial(material)
// uni.showLoading({ // uni.showLoading({
// mask: true // mask: true
// }) // })
this.$refs.home.startAudio() await this.$refs.home.startAudio()
this.clearHistory() this.clearHistory()
this.id = +material.id
this.id = +this.moduleList[0].id
// this.id = 6 // this.id = 6
this.type = 'edit' this.type = 'edit'
this.recording = true this.recording = true
......
...@@ -9,5 +9,8 @@ export default { ...@@ -9,5 +9,8 @@ export default {
receptionStatus: (state) => state.audio.receptionStatus, receptionStatus: (state) => state.audio.receptionStatus,
booksList: (state) => state.audio.booksList, booksList: (state) => state.audio.booksList,
receptionKey: (state) => state.user.receptionKey, receptionKey: (state) => state.user.receptionKey,
customerKey: (state) => state.user.customerKey customerKey: (state) => state.user.customerKey,
material: (state) => state.material.material,
typeCode: (state) => state.material.typeCode,
materialId: (state) => state.material.materialId
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-07 17:09:50 * @Date: 2024-04-07 17:09:50
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-23 16:41:45 * @LastEditTime: 2025-12-24 14:27:04
* @FilePath: \simgle_app\store\index.js * @FilePath: \simgle_app\store\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -14,6 +14,7 @@ import audio from './modules/audio' ...@@ -14,6 +14,7 @@ import audio from './modules/audio'
import update from './modules/update' import update from './modules/update'
import sys from './modules/sys' import sys from './modules/sys'
import point from './modules/point' import point from './modules/point'
import material from './modules/material'
// import boutique from './modules/boutique' // import boutique from './modules/boutique'
Vue.use(Vuex) Vue.use(Vuex)
...@@ -22,6 +23,7 @@ const store = new Vuex.Store({ ...@@ -22,6 +23,7 @@ const store = new Vuex.Store({
user, user,
audio, audio,
update, update,
material,
sys, sys,
point, point,
// boutique // boutique
......
export default {
namespaced: true,
state() {
return {
material: {},
//类型编码
typeCode: '',
materialId: ''
}
},
mutations: {
setMaterial(state, data) {
state.material = data
state.materialId = data.id
},
setTypeCode(state, data) {
state.typeCode = data
}
},
actions: {
setMaterial({ commit }, data) {
commit('setMaterial', data)
},
setTypeCode({ commit }, data) {
commit('setTypeCode', data)
}
}
}
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
state () { state () {
return { return {
customerInfo: { customerInfo: {
customerName: "", customerName: "",
customerPhone: "", customerPhone: "",
carType: "" carType: ""
}, },
......
...@@ -24,6 +24,7 @@ class DBManager { ...@@ -24,6 +24,7 @@ class DBManager {
'typeCode TEXT', 'typeCode TEXT',
'carType TEXT', 'carType TEXT',
'customerType TEXT', 'customerType TEXT',
'result TEXT',
'merchantId INTEGER', 'merchantId INTEGER',
'machineCode TEXT', 'machineCode TEXT',
'customerName TEXT', 'customerName TEXT',
......
...@@ -11,6 +11,7 @@ export default class RecordDto { ...@@ -11,6 +11,7 @@ export default class RecordDto {
typeCode = '' typeCode = ''
carType = '' carType = ''
customerType = '' customerType = ''
result = ''
merchantId = '' merchantId = ''
machineCode = '' machineCode = ''
customerName = '' customerName = ''
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: limin * @Author: limin
* @Date: 2025-01-02 18:49:17 * @Date: 2025-01-02 18:49:17
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-23 11:45:35 * @LastEditTime: 2025-12-24 15:48:41
* @FilePath: \simgle_app\utils\recordManager\TempRecord.js * @FilePath: \simgle_app\utils\recordManager\TempRecord.js
*/ */
import utils from '../utils' import utils from '../utils'
...@@ -449,7 +449,16 @@ class TempRecord { ...@@ -449,7 +449,16 @@ class TempRecord {
async destroy() { async destroy() {
this._isDestroyed = true this._isDestroyed = true
this.clearLoopTimer() this.clearLoopTimer()
await this.clearLocalRecord() // 等待所有正在进行的保存操作完成
if (this._savingPromise) {
uni.$logger.local.info('〖接待记录Record〗 == 等待最后的保存操作完成...')
try {
await this._savingPromise
} catch (e) {
uni.$logger.local.error('〖接待记录Record〗 == 等待保存操作异常: ' + e.message)
}
}
// await this.clearLocalRecord()
uni.$logger.local.info('〖接待记录Record〗 == TempRecord 实例已销毁') uni.$logger.local.info('〖接待记录Record〗 == TempRecord 实例已销毁')
} }
...@@ -486,7 +495,7 @@ class TempRecord { ...@@ -486,7 +495,7 @@ class TempRecord {
* @returns {string} 形如 `YYYY/MM/DD HH:mm:ss` * @returns {string} 形如 `YYYY/MM/DD HH:mm:ss`
*/ */
getTimeNow() { getTimeNow() {
return utils.convertDateTimeFormat(new Date(), '/') return utils.convertDateTimeFormat(new Date(), '-')
} }
/** /**
* 标记记录为错误结束原因 * 标记记录为错误结束原因
......
...@@ -14,6 +14,7 @@ class DBRecord { ...@@ -14,6 +14,7 @@ class DBRecord {
'typeCode TEXT', 'typeCode TEXT',
'carType TEXT', 'carType TEXT',
'customerType TEXT', 'customerType TEXT',
'result TEXT',
'merchantId INTEGER', 'merchantId INTEGER',
'machineCode TEXT', 'machineCode TEXT',
'customerName TEXT', 'customerName TEXT',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!