Commit 4979ebbe by 前端

记录

1 parent b3d647d1
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
"configurations" : [ "configurations" : [
{ {
"app-plus" : { "app-plus" : {
"launchtype" : "remote" "launchtype" : "local"
}, },
"default" : { "default" : {
"launchtype" : "local" "launchtype" : "local"
}, },
"h5" : { "h5" : {
"launchtype" : "remote" "launchtype" : "local"
}, },
"mp-weixin" : { "mp-weixin" : {
"launchtype" : "local" "launchtype" : "local"
......
...@@ -34,6 +34,14 @@ module.exports = { ...@@ -34,6 +34,14 @@ module.exports = {
...data ...data
}) })
}, },
searchRecordingEndTime(data) {
return http.post({
method: 'dj.api.smartcarlife.recepiton.customer.searchRecordingEndTime',
projectName: 'boutique',
...data
})
},
getToken(data) { getToken(data) {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.recepiton.customer.oss.getToken', method: 'dj.api.smartcarlife.recepiton.customer.oss.getToken',
......
<template> <template>
<MessageBox <MessageBox ref="employeeBoxVisible" position="bottom" :isFooter="false" :title="`请选择${title}`" :maxHeight="1000" @close="$emit('close')">
ref="employeeBoxVisible"
position="bottom"
:isFooter="false"
:title="`请选择${title}`"
:maxHeight="1000"
@close="$emit('close')"
>
<view class="select-box"> <view class="select-box">
<view <view class="select-item" :class="{ checked: salesUuid == item.uuid }" @click="handleSelect(item)" v-for="(item, index) in employeeList" :key="index">
class="select-item"
:class="{ checked: salesUuid == item.uuid }"
@click="handleSelect(item)"
v-for="(item, index) in employeeList"
:key="index"
>
{{ item.staffName }} {{ item.staffName }}
</view> </view>
</view> </view>
</MessageBox> </MessageBox>
</template> </template>
<script type='text/ecmascript-6'> <script type="text/ecmascript-6">
export default { export default {
name: 'Employee', name: 'Employee',
props: { props: {
title: { title: {
type: String, type: String,
default: '销售' default: '销售'
},
salesPropsUuid: {
type: String,
default: ''
} }
}, },
data () { data () {
...@@ -47,7 +38,7 @@ export default { ...@@ -47,7 +38,7 @@ export default {
return this.$store.state.user.historyStatus return this.$store.state.user.historyStatus
}, },
salesUuid () { salesUuid () {
return this.$store.state.user.customerInfo.salesUuid return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
}, },
employeeList () { employeeList () {
return this.$store.state.user.employeeList return this.$store.state.user.employeeList
...@@ -81,7 +72,7 @@ export default { ...@@ -81,7 +72,7 @@ export default {
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
.select-box { .select-box {
margin: 40rpx 0; margin: 40rpx 0;
display: grid; display: grid;
......
...@@ -4,50 +4,36 @@ ...@@ -4,50 +4,36 @@
<view class="user-avatar sprite-icon icon-avatar"></view> <view class="user-avatar sprite-icon icon-avatar"></view>
<view class="user-name">{{ userInfo.name }}</view> <view class="user-name">{{ userInfo.name }}</view>
</view> </view>
<view :class="['left-tabs', {'three':tabs.length == 3}]"> <view :class="['left-tabs', { three: tabs.length == 3 }]">
<template v-for="(i, index) in tabs"> <template v-for="(i, index) in tabs">
<view <view :class="['tab-item', { tabActive: tabIndex == index }]" :key="index" @click="changeIndex(index)">
:class="['tab-item', { tabActive: tabIndex == index }]"
:key="index"
@click="changeIndex(index)"
>
<view class="icon-box"> <view class="icon-box">
<view :class="[ <view :class="['sprite-icon', `icon-${i.icon}${tabIndex == index ? '-active' : ''}`]"></view>
'sprite-icon',
`icon-${i.icon}${tabIndex == index ? '-active' : ''}`,
]"></view>
</view> </view>
{{ i.label }} {{ i.label }}
<view class="dot" v-if="i.icon == 'record' && perRecordNumber"></view>
</view> </view>
</template> </template>
</view> </view>
<view class="left-footer"> <view class="left-footer">
<view <view class="btn" @click="$refs.kfRef.open()">
class="btn"
@click="$refs.kfRef.open()"
>
<view class="sprite-icon icon-feedback"></view> <view class="sprite-icon icon-feedback"></view>
</view> </view>
<view <view class="btn" @click="$refs.settingRef.open()">
class="btn"
@click="$refs.settingRef.open()"
>
<view class="sprite-icon icon-setting"></view> <view class="sprite-icon icon-setting"></view>
</view> </view>
</view> </view>
<!-- 客服弹框 --> <!-- 客服弹框 -->
<kf-box ref="kfRef" /> <kf-box ref="kfRef" />
<!-- 设置弹框 --> <!-- 设置弹框 -->
<setting-box <setting-box ref="settingRef" @stopAudio="$emit('stopAudio')" />
ref="settingRef"
@stopAudio="$emit('stopAudio')"
/>
</view> </view>
</template> </template>
<script type='text/ecmascript-6'> <script type="text/ecmascript-6">
import KfBox from "./KfBox"; import KfBox from "./KfBox";
import SettingBox from "./SettingBox"; import SettingBox from "./SettingBox";
import { STORAGE_OBJECTkEY } from '@/utils/cache/constantData'
export default { export default {
components: { KfBox, SettingBox }, components: { KfBox, SettingBox },
props:{ props:{
...@@ -74,6 +60,11 @@ export default { ...@@ -74,6 +60,11 @@ export default {
if(n.shopMerchantId) this.haveCustomerAccess(n.shopMerchantId) if(n.shopMerchantId) this.haveCustomerAccess(n.shopMerchantId)
} }
}, },
computed: {
perRecordNumber() {
return this.$store.state.audio.perRecordNumber
}
},
mounted () { mounted () {
}, },
methods: { methods: {
...@@ -96,7 +87,7 @@ export default { ...@@ -96,7 +87,7 @@ export default {
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
.left-side { .left-side {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -134,6 +125,16 @@ export default { ...@@ -134,6 +125,16 @@ export default {
color: #8a98b5; color: #8a98b5;
text-align: center; text-align: center;
padding-bottom: 96rpx; padding-bottom: 96rpx;
position: relative;
.dot {
width: 16rpx;
height: 16rpx;
background: #f24724;
border-radius: 50%;
position: absolute;
right: 20rpx;
top: 20rpx;
}
.icon-box { .icon-box {
width: 112rpx; width: 112rpx;
height: 112rpx; height: 112rpx;
...@@ -213,5 +214,4 @@ export default { ...@@ -213,5 +214,4 @@ export default {
padding-left: 60rpx; padding-left: 60rpx;
} }
} }
</style> </style>
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
{{ i.tabName }} {{ i.tabName }}
<template v-if="index == 1 && i.num && recordFailList.length > 0">({{ recordFailList.length }})</template> <template v-if="index == 1 && i.num && recordFailList.length > 0">({{ recordFailList.length }})</template>
<template v-if="index == 2 && i.num && preRecordFailList.length > 0">({{ preRecordFailList.length }})</template> <template v-if="index == 2 && i.num && preRecordFailList.length > 0">({{ preRecordFailList.length }})</template>
<div class="dot" :style="{ right: '86rpx' }" v-if="index == 2 && i.num && preRecordFailList.length > 0"></div>
</view> </view>
</view> </view>
</view> </view>
...@@ -69,7 +70,7 @@ ...@@ -69,7 +70,7 @@
<template v-for="(k, ind) in itemObject"> <template v-for="(k, ind) in itemObject">
<view class="info flex" :key="ind"> <view class="info flex" :key="ind">
<view class="label">{{ k.label }}</view> <view class="label">{{ k.label }}</view>
<view class="value">{{ item[k.key] || '-' }}</view> <view class="value">{{ formatValue(item[k.key], k.key) || '-' }}</view>
</view> </view>
</template> </template>
</view> </view>
...@@ -98,7 +99,7 @@ import dayjs from 'dayjs' ...@@ -98,7 +99,7 @@ import dayjs from 'dayjs'
const dayImgUrl = require('@/assets/images/common/day.webp') const dayImgUrl = require('@/assets/images/common/day.webp')
const weekImgUrl = require('@/assets/images/common/week.webp') const weekImgUrl = require('@/assets/images/common/week.webp')
const monthImgUrl = require('@/assets/images/common/month.webp') const monthImgUrl = require('@/assets/images/common/month.webp')
import { STORAGE_OBJECTkEY ,DEFAULT_GET_STORAGEKEY} from '@/utils/cache/constantData' import { STORAGE_OBJECTkEY } from '@/utils/cache/constantData'
import interruptRecord from '@/utils/recordManager/interruptRecord' import interruptRecord from '@/utils/recordManager/interruptRecord'
import saveRecord from './saveRecord.vue' import saveRecord from './saveRecord.vue'
export default { export default {
...@@ -141,7 +142,7 @@ export default { ...@@ -141,7 +142,7 @@ export default {
{ text: '本月' }, { text: '本月' },
], ],
itemObject: [ itemObject: [
{ label: '客户电话', key: 'phoneNumberSplit' }, { label: '客户电话', key: 'phoneNumber' },
{ label: '销售姓名', key: 'salesName' }, { label: '销售姓名', key: 'salesName' },
{ label: '接待时长', key: 'duration' }, { label: '接待时长', key: 'duration' },
{ label: '开始接待', key: 'startTime' }, { label: '开始接待', key: 'startTime' },
...@@ -167,6 +168,13 @@ export default { ...@@ -167,6 +168,13 @@ export default {
this.getPreRecordNum() this.getPreRecordNum()
}, },
methods: { methods: {
formatValue(val,k) {
if(!val) return
if(k == 'phoneNumber') {
return val.slice(0, 3) + " " + val.slice(3, 7) + " " + val.slice(7)
}
return val
},
handleCancel() { handleCancel() {
this.showRecord = true; this.showRecord = true;
}, },
...@@ -227,13 +235,15 @@ export default { ...@@ -227,13 +235,15 @@ export default {
this.list[0] = this.preRecordFailList.map(i => { this.list[0] = this.preRecordFailList.map(i => {
return Object.assign(i,{ return Object.assign(i,{
duration: 0, duration: 0,
startTime: i.receptionStartTime.replace(/\//g, '.') startTime:i.receptionStartTime && i.receptionStartTime.replace(/\//g, '.')
}) })
}) })
this.nothing = this.preRecordFailList.length ? true : false this.nothing = this.preRecordFailList.length ? true : false
}, },
getPreRecordNum() { getPreRecordNum() {
const preRecordList = uni.$storage.get(STORAGE_OBJECTkEY.preRecordList)||[] const preRecordList = uni.$storage.get(STORAGE_OBJECTkEY.preRecordList)||[]
console.log(preRecordList)
this.preRecordFailList = preRecordList this.preRecordFailList = preRecordList
}, },
getRecordFail () { getRecordFail () {
...@@ -316,11 +326,9 @@ export default { ...@@ -316,11 +326,9 @@ export default {
}) })
uni.hideLoading() uni.hideLoading()
list?.length && list.map(e => { list?.length && list.map(e => {
let phoneNumber = e.phoneNumber
e.duration = this.formatSeconds(e.receptionEndTime - e.receptionStartTime) e.duration = this.formatSeconds(e.receptionEndTime - e.receptionStartTime)
e.startTime = dayjs(e.receptionStartTime).format("YYYY.MM.DD HH:mm:ss") e.startTime = dayjs(e.receptionStartTime).format("YYYY.MM.DD HH:mm:ss")
e.endTime = dayjs(e.receptionEndTime).format("YYYY.MM.DD HH:mm:ss") e.endTime = dayjs(e.receptionEndTime).format("YYYY.MM.DD HH:mm:ss")
e.phoneNumberSplit = phoneNumber.slice(0, 3) + " " + phoneNumber.slice(3, 7) + " " + phoneNumber.slice(7)
}) })
if (pageNum == 1) { if (pageNum == 1) {
const record = { const record = {
...@@ -446,6 +454,14 @@ export default { ...@@ -446,6 +454,14 @@ export default {
position: relative; position: relative;
text-align: center; text-align: center;
width: 400rpx; width: 400rpx;
.dot {
width: 16rpx;
height: 16rpx;
background: #f24724;
position: absolute;
top: 40rpx;
border-radius: 50%;
}
} }
.active { .active {
position: absolute; position: absolute;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<view class="submit-btn" @click="handleSave">提交</view> <view class="submit-btn" @click="handleSave">提交</view>
</view> </view>
<car-brands ref="carBrandListVisible" @select="handleSelect($event, 'carBrandListVisible')" /> <car-brands ref="carBrandListVisible" @select="handleSelect($event, 'carBrandListVisible')" />
<employee ref="employeeBoxVisible" @select="handleSelect($event, 'employeeBoxVisible')" /> <employee ref="employeeBoxVisible" :salesPropsUuid="customerInfo.salesUuid" @select="handleSelect($event, 'employeeBoxVisible')" />
<MessageBox ref="receptionStatusVisible" position="bottom" :isFooter="false" title="请选择接待结果" :maxHeight="1000"> <MessageBox ref="receptionStatusVisible" position="bottom" :isFooter="false" title="请选择接待结果" :maxHeight="1000">
<view class="select-box"> <view class="select-box">
<view class="select-item" :class="{ checked: customerInfo.receptionStatus == item.label }" @click="selectReception(item.label)" v-for="(item, index) in receptionList" :key="index"> <view class="select-item" :class="{ checked: customerInfo.receptionStatus == item.label }" @click="selectReception(item.label)" v-for="(item, index) in receptionList" :key="index">
...@@ -110,6 +110,7 @@ export default { ...@@ -110,6 +110,7 @@ export default {
} }
}, },
mounted() { mounted() {
console.log(this.customerInfo)
const i = this.receptionList.findIndex(e => e.value == this.customerInfo.receptionStatus) const i = this.receptionList.findIndex(e => e.value == this.customerInfo.receptionStatus)
this.customerInfo.receptionStatus = this.receptionList[i].label this.customerInfo.receptionStatus = this.receptionList[i].label
}, },
...@@ -136,7 +137,7 @@ export default { ...@@ -136,7 +137,7 @@ export default {
try { try {
this.formObject.map(e => { this.formObject.map(e => {
if (!this.customerInfo[e.key]) throw false if (!this.customerInfo[e.key]) throw false
if (!all && e.key == 'phoneNumber' && !phoneRex.test(this.formData[e.key])) { if (!all && e.key == 'phoneNumber' && !phoneRex.test(this.customerInfo[e.key])) {
uni.showToast({ uni.showToast({
title: "请输入正确的车主电话", title: "请输入正确的车主电话",
icon: "none", icon: "none",
...@@ -151,9 +152,10 @@ export default { ...@@ -151,9 +152,10 @@ export default {
}, },
handleSelect(item, popkey) { handleSelect(item, popkey) {
this.$refs[popkey].close() this.$refs[popkey].close()
console.log(item, popkey)
if (popkey == 'employeeBoxVisible') { if (popkey == 'employeeBoxVisible') {
this.customerInfo.salesUuid = item.uuid this.customerInfo.salesUuid = item.uuid
this.customerInfo.staffName = item.staffName this.customerInfo.salesName = item.staffName
} else { } else {
this.$refs.carBrandListVisible.close() this.$refs.carBrandListVisible.close()
this.customerInfo.carModel = item.name this.customerInfo.carModel = item.name
......
const target = ["ip", "dev", "uat", "prod", "beta"]; const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1; const index = 1
/** /**
* *
0本地 0本地
...@@ -12,110 +12,110 @@ const secretKey = { ...@@ -12,110 +12,110 @@ const secretKey = {
ip: {}, ip: {},
dev: { dev: {
sso: { sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89", appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b", secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}, }
}, },
uat: { uat: {
sso: { sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89", appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b", secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}, }
}, },
prod: { prod: {
sso: { sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89", appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b", secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}, }
}, },
beta: { beta: {
sso: { sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89", appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b", secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}, }
}, }
}[target[index]]; }[target[index]]
const domain = { const domain = {
// ip: 'http://192.168.2.94:8558', // ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315', // ip: 'http://192.168.2.3:8315',
ip: "http://192.168.1.170:8315", ip: 'http://192.168.1.170:8315',
/**登录: 192.168.2.3:8315 /**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */ 商城: 192.168.2.3:8558 */
dev: "https://scrm.dev.glsx.com.cn", dev: 'https://scrm.dev.glsx.com.cn',
uat: "https://scrm.test.glsx.com.cn", uat: 'https://scrm.test.glsx.com.cn',
beta: "https://scrm.beta.glsx.com.cn", beta: 'https://scrm.beta.glsx.com.cn',
prod: "https://scrm.glsx.com.cn", prod: 'https://scrm.glsx.com.cn'
}[target[index]]; }[target[index]]
const djDomain = { const djDomain = {
ip: "http://192.168.2.59:8292", ip: 'http://192.168.2.59:8292',
// ip: 'http://192.168.2.80:8558', // ip: 'http://192.168.2.80:8558',
dev: "http://dj.dev.glsx.com.cn", dev: 'http://dj.dev.glsx.com.cn',
beta: "https://dj.beta.glsx.com.cn", //预发布 appid: wx9f91c1ec493eb425 beta: 'https://dj.beta.glsx.com.cn', //预发布 appid: wx9f91c1ec493eb425
uat: "https://dj.test.glsx.com.cn", //测试 appid: wxe10067a63c1856ac uat: 'https://dj.test.glsx.com.cn', //测试 appid: wxe10067a63c1856ac
prod: "https://dj.glsx.com.cn", prod: 'https://dj.glsx.com.cn',
pet: "https://cdptest.glsx.com.cn", //压测 appid: wx7ce755e425603084 pet: 'https://cdptest.glsx.com.cn' //压测 appid: wx7ce755e425603084
}[target[index]]; }[target[index]]
const merchantDomain = { const merchantDomain = {
ip: "http://rop-merchant.dev.glsx.com.cn", ip: 'http://rop-merchant.dev.glsx.com.cn',
dev: "http://rop-merchant.dev.glsx.com.cn", dev: 'http://rop-merchant.dev.glsx.com.cn',
beta: "https://rop-merchant.beta.glsx.com.cn", beta: 'https://rop-merchant.beta.glsx.com.cn',
uat: "https://rop-merchant.test.glsx.com.cn", uat: 'https://rop-merchant.test.glsx.com.cn',
prod: "https://commodity.glsx.com.cn", prod: 'https://commodity.glsx.com.cn',
pet: "", pet: ''
}[target[index]]; }[target[index]]
const djSecretKey = { const djSecretKey = {
ip: {}, ip: {},
dev: { dev: {
appKey: "48e5e13229b82c1b4e6e8c96151f0637", appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b", secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
}, },
uat: { uat: {
appKey: "48e5e13229b82c1b4e6e8c96151f0637", appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b", secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
}, },
beta: { beta: {
appKey: "48e5e13229b82c1b4e6e8c96151f0637", appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b", secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
}, },
prod: { prod: {
appKey: "d7ffc3346fc9a45bccaaa35300d59022", appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: "4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353", secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
}, },
pet: { pet: {
appKey: "d7ffc3346fc9a45bccaaa35300d59022", appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: "4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353", secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
}, }
}[target[index]]; }[target[index]]
const pathEnum = { const pathEnum = {
sso: "/rop-scrm-sso/", sso: '/rop-scrm-sso/',
shopmall: "/rop-scrm-shopmall/", shopmall: '/rop-scrm-shopmall/',
coupon: "/rop-scrm-coupon/", coupon: '/rop-scrm-coupon/',
carlife: "/rop-scrm-carlife/", carlife: '/rop-scrm-carlife/',
live: "/rop-scrm-live/", live: '/rop-scrm-live/',
equity: "/rop-scrm-equity/", equity: '/rop-scrm-equity/',
entmicro: "/rop-scrm-entmicro/", entmicro: '/rop-scrm-entmicro/',
wechat: "/rop-scrm-wechat/", wechat: '/rop-scrm-wechat/',
boutiquecoupon: "/rop-scrm-boutiquecoupon/", boutiquecoupon: '/rop-scrm-boutiquecoupon/',
material: "/rop-scrm-marketing/", //素材 material: '/rop-scrm-marketing/', //素材
sop: "/rop-scrm-sop/", sop: '/rop-scrm-sop/',
customercollect: "/rop-scrm-bigdatautil/", customercollect: '/rop-scrm-bigdatautil/',
mindworkplate: "/rop-dj-smartcarlife/", mindworkplate: '/rop-dj-smartcarlife/',
drac: "/rop-scrm-entmicro/", drac: '/rop-scrm-entmicro/',
busassistant: "/rop-scrm-busassistant/", busassistant: '/rop-scrm-busassistant/',
boutique: "/rop-dj-car-boutique/", boutique: '/rop-dj-car-boutique/',
merchants: "/rop-merchants/", merchants: '/rop-merchants/'
}; }
const CONFIG_ENV_MAP = { const CONFIG_ENV_MAP = {
1: "develop", 1: 'develop',
2: "test", 2: 'test',
3: "production", 3: 'production',
4: "beta", 4: 'beta'
}; }
module.exports = { module.exports = {
index, index,
domain, domain,
...@@ -124,5 +124,5 @@ module.exports = { ...@@ -124,5 +124,5 @@ module.exports = {
env: CONFIG_ENV_MAP[index], env: CONFIG_ENV_MAP[index],
djDomain, djDomain,
merchantDomain, merchantDomain,
djSecretKey, djSecretKey
}; }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48 * @Date: 2024-04-08 11:28:48
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-10-17 11:02:23 * @LastEditTime: 2024-10-18 16:26:28
* @FilePath: \gl_tape\mixin\click.js * @FilePath: \gl_tape\mixin\click.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
*/ */
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
reaction: 1 reaction: 1
} }
}, },
mounted() { async mounted() {
this.handleSave(false) this.handleSave(false)
// 获取当前页面栈数组 // 获取当前页面栈数组
const pages = getCurrentPages() const pages = getCurrentPages()
...@@ -37,17 +37,26 @@ export default { ...@@ -37,17 +37,26 @@ export default {
this.initTime() this.initTime()
}, },
watch: { watch: {
'$store.state.user.customerInfo'(val) { changeData: {
const params = this.getParams(val) handler(val) {
console.log(val, 'val', this.audioInfo.audioStatus)
if (this.audioInfo.audioStatus != 'start') return
const { customerInfo, booksList, receptionStatus } = val
const params = this.getParams(customerInfo, booksList, receptionStatus)
interruptRecord.updatePreRecords(params) interruptRecord.updatePreRecords(params)
},
deep: true
} }
}, },
computed: { computed: {
...mapState('audio', ['receptionStatus', 'booksList', 'audioInfo']), ...mapState('audio', ['receptionStatus', 'booksList', 'audioInfo']),
...mapState(['user.customerInfo']) ...mapState(['user.customerInfo']),
}, changeData() {
created() { const customerInfo = this.$store.state.user.customerInfo
console.log('created') const booksList = this.booksList
const receptionStatus = this.receptionStatus
return { customerInfo, booksList, receptionStatus }
}
}, },
methods: { methods: {
...mapMutations('audio', ['setReceptionStatus', 'setBooks', 'setAudioInfo']), ...mapMutations('audio', ['setReceptionStatus', 'setBooks', 'setAudioInfo']),
...@@ -77,10 +86,10 @@ export default { ...@@ -77,10 +86,10 @@ export default {
this.setReceptionStatus(0) this.setReceptionStatus(0)
this.setAudioInfo({ endReasonType: 1 }) this.setAudioInfo({ endReasonType: 1 })
}, },
getParams(val) { getParams(customerInfo, booksList, receptionStatus) {
const { shopMerchantId, phone, sceneType, uuid, name, merchantId, channelType, merchantName } = uni.$storage.get('userInfo'), const { shopMerchantId, phone, sceneType, uuid, name, merchantId, channelType, merchantName } = uni.$storage.get('userInfo'),
{ customerName, phoneNumber, salesUuid, carModel, staffName } = val || {}, { customerName, phoneNumber, salesUuid, carModel, staffName } = customerInfo || {},
receptionCustomerPaySourceList = this.booksList.map(item => { receptionCustomerPaySourceList = booksList.map(item => {
return { return {
id: item.id, id: item.id,
sourceType: item.id, sourceType: item.id,
...@@ -112,7 +121,7 @@ export default { ...@@ -112,7 +121,7 @@ export default {
loginPhone: phone, loginPhone: phone,
salesName: staffName, salesName: staffName,
salesUuid, salesUuid,
receptionStatus: this.receptionStatus, //接待结果 1.成交 0.战败 receptionStatus, //接待结果 1.成交 0.战败
receptionStartTime, receptionStartTime,
receptionEndTime, receptionEndTime,
receptionCustomerPaySourceList, //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径 receptionCustomerPaySourceList, //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
...@@ -142,23 +151,25 @@ export default { ...@@ -142,23 +151,25 @@ export default {
//开始录音 //开始录音
startAudio: utils.throttle(async function () { startAudio: utils.throttle(async function () {
if (this.audioInfo.audioStatus == 'start') return if (this.audioInfo.audioStatus == 'start') return
this.setAudioInfo({ audioList: [], audioStatus: 'start' })
this.setBooks([]) this.setBooks([])
this.$store.dispatch('clearCustomerInfo') this.$store.dispatch('clearCustomerInfo')
this.setReceptionStatus(1) this.setReceptionStatus(1)
this.initTime() this.initTime()
this.setAudioInfo({ audioList: [], audioStatus: 'start' })
recorderManager.onStart(() => { recorderManager.onStart(() => {
setTimeout(() => {
interruptRecord.addPreRecords() interruptRecord.addPreRecords()
}, 1000)
}) })
recorderManager.start({ recorderManager.start({
duration: 600000, duration: 60000,
sampleRate: 16000, sampleRate: 16000,
numberOfChannels: 1 numberOfChannels: 1
}) })
recorderManager.onStop(async res => { recorderManager.onStop(async res => {
if (this.audioInfo.audioStatus == 'start') { if (this.audioInfo.audioStatus == 'start') {
uni.getRecorderManager().start({ uni.getRecorderManager().start({
duration: 600000, duration: 60000,
sampleRate: 16000, sampleRate: 16000,
numberOfChannels: 1 numberOfChannels: 1
}) })
...@@ -170,11 +181,12 @@ export default { ...@@ -170,11 +181,12 @@ export default {
console.log(records, 'records') console.log(records, 'records')
if (!records) return if (!records) return
if (isNormal) { if (isNormal) {
Object.assign(records, this.getParams(this.$store.state.user.customerInfo)) Object.assign(records, this.getParams(this.$store.state.user.customerInfo, this.booksList, this.receptionStatus))
} }
const audioPath = records.audioPath const audioPath = records.audioPath
const recordUrlList = [] const recordUrlList = []
for (let i = 0; i < audioPath.length; i++) { for (let i = 0; i < audioPath.length; i++) {
console.log(audioPath[i], 'audioPath[i]')
const saveResult = await uni.saveFile({ const saveResult = await uni.saveFile({
tempFilePath: audioPath[i] tempFilePath: audioPath[i]
}) })
...@@ -198,7 +210,7 @@ export default { ...@@ -198,7 +210,7 @@ export default {
}, },
removeRecords() { removeRecords() {
const records = interruptRecord.getPreRecord() const records = interruptRecord.getPreRecord()
interruptRecord.removePreRecord(record.id) interruptRecord.removePreRecord(records.id)
}, },
/**保存记录*/ /**保存记录*/
async saveRecord(record) { async saveRecord(record) {
......
...@@ -209,6 +209,11 @@ export default { ...@@ -209,6 +209,11 @@ export default {
if (record.recordUrlList?.every(i => i.status == undefined)) { if (record.recordUrlList?.every(i => i.status == undefined)) {
const pathArr = record.recordUrlList.map(i => i.file) const pathArr = record.recordUrlList.map(i => i.file)
const params = { ...record, recordUrlList: pathArr } const params = { ...record, recordUrlList: pathArr }
if (!params.receptionEndTime) {
const endTime = await uni.$api.commonApi.searchRecordingEndTime({ recordUrlList: pathArr, receptionStartTime: params.receptionStartTime.replace(/\//g, '-') })
params.receptionEndTime = endTime.replace(/\-/g, '/')
}
console.log(params, 'params')
const res = await uni.$api.commonApi.saveRecCustomer(params) const res = await uni.$api.commonApi.saveRecCustomer(params)
if (res) { if (res) {
uni.$recordManager.removeRecord(record.id) uni.$recordManager.removeRecord(record.id)
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-04-07 18:15:11 * @Date: 2024-04-07 18:15:11
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-04-11 21:22:55 * @LastEditTime: 2024-10-18 11:40:02
*/ */
// import { setToken, getToken, removeToken } from '@/utils/token';; // import { setToken, getToken, removeToken } from '@/utils/token';;
import utils from "@/utils/utils"; import utils from '@/utils/utils'
// const recorderManager = uni.getRecorderManager(); // const recorderManager = uni.getRecorderManager();
import upload from "@/utils/ossUploadFile/uploadFile.js"; import upload from '@/utils/ossUploadFile/uploadFile.js'
import store from "../index"; import store from '../index'
export default { export default {
namespaced: true, namespaced: true,
state() { state() {
...@@ -18,35 +18,43 @@ export default { ...@@ -18,35 +18,43 @@ export default {
audioList: [], audioList: [],
receptionStatus: 1, receptionStatus: 1,
endReasonType: 0, endReasonType: 0,
perRecordNumber: 0,
audioInfo: { audioInfo: {
audioStatus: "", audioStatus: '',
endReasonType: 0, endReasonType: 0,
receptionStartTime: "", receptionStartTime: '',
receptionEndTime: "", receptionEndTime: ''
}, }
}; }
}, },
mutations: { mutations: {
setAudioInfo(state, data) { setAudioInfo(state, data) {
if (data.audioStatus == "start") { if (data.audioStatus == 'start') {
data.receptionStartTime = utils.convertDateTimeFormat(new Date(), "/"); data.receptionStartTime = utils.convertDateTimeFormat(new Date(), '/')
} }
if (data.audioStatus == "end") { if (data.audioStatus == 'end') {
data.receptionEndTime = utils.convertDateTimeFormat(new Date(), "/"); data.receptionEndTime = utils.convertDateTimeFormat(new Date(), '/')
} }
state.audioInfo = Object.assign(state.audioInfo, data); state.audioInfo = Object.assign(state.audioInfo, data)
}, },
setReceptionStatus(state, data) { setReceptionStatus(state, data) {
state.receptionStatus = data; state.receptionStatus = data
}, },
setAudioList(state, data) { setAudioList(state, data) {
state.audioList = data; state.audioList = data
}, },
setBooks(state, data) { setBooks(state, data) {
state.booksList = data; state.booksList = data
}, },
setPerRecordNumber(state, data) {
state.perRecordNumber = data
}
}, },
actions: { actions: {
setPerRecordNumber({ commit }, value) {
console.log(value)
commit('setPerRecordNumber', value)
}
// startAudio({ commit, state, dispatch }) { // startAudio({ commit, state, dispatch }) {
// if (state.isStart) return; // if (state.isStart) return;
// commit("setAudioStart", true); // commit("setAudioStart", true);
...@@ -115,5 +123,5 @@ export default { ...@@ -115,5 +123,5 @@ export default {
// commit("setReceptionStatus", 0); // commit("setReceptionStatus", 0);
// uni.$storage.set("storageFile", ""); // uni.$storage.set("storageFile", "");
// }, // },
}, }
}; }
...@@ -2,18 +2,21 @@ ...@@ -2,18 +2,21 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-10-14 17:38:35 * @Date: 2024-10-14 17:38:35
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-10-17 10:47:17 * @LastEditTime: 2024-10-18 16:29:34
* @FilePath: \gl-tape\utils\recordManager\interruptRecord.js * @FilePath: \gl-tape\utils\recordManager\interruptRecord.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
*/ */
import RecordManager from '../RecordManager.js' import RecordManager from '../RecordManager.js'
import utils from '@/utils/utils.js' import utils from '@/utils/utils.js'
import { storageApi } from '../cache' import { storageApi } from '../cache'
// import store from '@/store'
class InterruptRecord extends RecordManager { class InterruptRecord extends RecordManager {
constructor() { constructor() {
super() super()
// console.log(store)
// storageApi.removeRecords('preRecordList') // storageApi.removeRecords('preRecordList')
// storageApi.removeRecords('preRecordId') // storageApi.removeRecords('preRecordId')
// storageApi.removeRecords('recordList')
} }
records = {} records = {}
pathName = null pathName = null
...@@ -32,6 +35,9 @@ class InterruptRecord extends RecordManager { ...@@ -32,6 +35,9 @@ class InterruptRecord extends RecordManager {
*/ */
getPreRecord() { getPreRecord() {
const id = storageApi.getRecords('preRecordId') const id = storageApi.getRecords('preRecordId')
if (!id) {
return
}
return this.getRecordById(id) return this.getRecordById(id)
} }
/** /**
...@@ -49,12 +55,16 @@ class InterruptRecord extends RecordManager { ...@@ -49,12 +55,16 @@ class InterruptRecord extends RecordManager {
* @returns {void} - 此函数不返回任何值 * @returns {void} - 此函数不返回任何值
*/ */
async addPreRecords() { async addPreRecords() {
console.log(storageApi.getRecords('preRecordId'), 6666)
if (storageApi.getRecords('preRecordId')) { if (storageApi.getRecords('preRecordId')) {
console.log(888)
this.addPreAudio() this.addPreAudio()
return return
} }
this.pathName = await this.getAudioPathName() console.log('pathName')
const audioPath = await this.getAudioPath(this.pathName) const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName)
const id = utils.uuid() const id = utils.uuid()
storageApi.setRecords(id, 'preRecordId') storageApi.setRecords(id, 'preRecordId')
const ids = storageApi.getRecords('preRecordId') const ids = storageApi.getRecords('preRecordId')
...@@ -73,9 +83,12 @@ class InterruptRecord extends RecordManager { ...@@ -73,9 +83,12 @@ class InterruptRecord extends RecordManager {
* @returns {void} - 此函数不返回任何值 * @returns {void} - 此函数不返回任何值
*/ */
async addPreAudio() { async addPreAudio() {
const audioPath = await this.getAudioPath(this.pathName) const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName)
this.records.audioPath.push(audioPath) this.records.audioPath.push(audioPath)
this.updateRecord(this.records) const records = this.getPreRecord()
const params = { ...records, ...this.records }
this.updateRecord(params)
} }
updatePreAudio(params) { updatePreAudio(params) {
this.updateRecord(params) this.updateRecord(params)
...@@ -90,6 +103,7 @@ class InterruptRecord extends RecordManager { ...@@ -90,6 +103,7 @@ class InterruptRecord extends RecordManager {
storageApi.setRecords('', 'preRecordId') storageApi.setRecords('', 'preRecordId')
} }
const updateParams = { ...this.records, ...params } const updateParams = { ...this.records, ...params }
console.log(updateParams, 'updateParams')
this.updateRecord(updateParams) this.updateRecord(updateParams)
} }
/** /**
...@@ -99,8 +113,10 @@ class InterruptRecord extends RecordManager { ...@@ -99,8 +113,10 @@ class InterruptRecord extends RecordManager {
* @returns {void} - 此函数不返回任何值 * @returns {void} - 此函数不返回任何值
*/ */
async getAudioPath(name) { async getAudioPath(name) {
console.log(name, 'name')
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const path = await utils.getAudioFilePath(name + '/recorder') const path = await utils.getAudioFilePath(name + '/recorder')
console.log(path, 'path')
plus.io.resolveLocalFileSystemURL( plus.io.resolveLocalFileSystemURL(
path, path,
e => { e => {
...@@ -120,6 +136,7 @@ class InterruptRecord extends RecordManager { ...@@ -120,6 +136,7 @@ class InterruptRecord extends RecordManager {
}) })
}) })
).then(results => { ).then(results => {
console.log(results, 'results')
// 找到修改时间最晚的文件 // 找到修改时间最晚的文件
const latest = results.reduce( const latest = results.reduce(
(acc, current) => { (acc, current) => {
...@@ -184,7 +201,8 @@ class InterruptRecord extends RecordManager { ...@@ -184,7 +201,8 @@ class InterruptRecord extends RecordManager {
*/ */
setRecords(records) { setRecords(records) {
storageApi.setRecords(records, 'preRecordList') storageApi.setRecords(records, 'preRecordList')
console.log(storageApi.getRecords('preRecordList')) console.log(records, 'records')
store.dispatch('audio/setPerRecordNumber', records.length)
} }
} }
export default new InterruptRecord() export default new InterruptRecord()
...@@ -170,6 +170,10 @@ async function getFileSaveFolderOnClient() { ...@@ -170,6 +170,10 @@ async function getFileSaveFolderOnClient() {
const rootPath = await getFilePath() const rootPath = await getFilePath()
return `file://${rootPath}uniapp_save/` return `file://${rootPath}uniapp_save/`
} }
async function getAudioFilePath(path = '') {
const rootPath = await getFilePath()
return `file://${rootPath}${path}`
}
export default { export default {
compareVersions, compareVersions,
convertDateTimeFormat, convertDateTimeFormat,
...@@ -180,5 +184,6 @@ export default { ...@@ -180,5 +184,6 @@ export default {
isNetWork, isNetWork,
uuid, uuid,
getFilePath, getFilePath,
getFileSaveFolderOnClient getFileSaveFolderOnClient,
getAudioFilePath
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!