Commit ee822917 by 前端

Merge branch 'SAAS+V4.50' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V4.50

2 parents 3e8e49dc 7da1e581
......@@ -115,7 +115,7 @@
<view class="redeem-code">
<view class="redeem-item">
<view class="redeem-name">卡券URL:</view>
<view class="redeem-value">{{couponDetailInfo.coupon_url || ''}}</view>
<view class="redeem-value">{{couponDetailInfo.couponCardUrl || ''}}</view>
</view>
</view>
</template>
......
......@@ -12,12 +12,12 @@ import utils from '@/utils/utils.js'
import { storageApi } from '@/utils/cache'
import permision from '@/js_sdk/wa-permission/permission.js'
export default {
provide() {
provide () {
return {
getRecorder: () => this.record
}
},
async mounted() {
async mounted () {
this.audioManager = new AudioManager(this.onAudioStart, this.onAudioStop, this.onError)
this.initDto()
this.record = new TempRecord(this.tempRecord, this.triggleTempNumber)
......@@ -29,30 +29,30 @@ export default {
* @param {object} val 监听客户信息
*/
customerInfo: {
handler(val) {
handler (val) {
this.handler(val, this.updateCustomerInfo)
},
deep: true
},
booksList: {
handler(val) {
handler (val) {
this.handler(val, this.updateBookList)
}
},
receptionStatus: {
handler(val) {
handler (val) {
this.handler(val, this.updateReceptionStatus)
}
},
receptionTrack: {
handler(val) {
this.handler(val, this.updateMaterialPointList)
receptionKey: {
handler (val) {
this.handler(this.receptionTrack, this.updateMaterialPointList)
}
}
},
computed: {
...mapState(['user.customerInfo']),
...mapGetters(['customerInfo', 'receptionStatus', 'booksList', 'receptionTrack'])
...mapGetters(['customerInfo', 'receptionStatus', 'booksList', 'receptionTrack', 'receptionKey'])
},
methods: {
...mapMutations('audio', ['setReceptionStatus', 'setBooks', 'setPerRecordNumber']),
......@@ -66,20 +66,20 @@ export default {
this.audioManager.start()
}, 300),
initReception() {
initReception () {
this.setBooks([])
this.clearCustomerInfo()
this.setReceptionStatus('')
this.initTime()
},
async onAudioStart() {
async onAudioStart () {
if (this.audioManager.counter === 0) {
await this.record.add()
} else {
this.record.addAudio()
}
},
async onAudioStop() {
async onAudioStop () {
if (this.audioManager.isRecording) {
uni.$logger.local.info('〖接待管理Recorder〗 == 接待中,再次开启录音! ')
this.audioManager.start()
......@@ -87,7 +87,7 @@ export default {
uni.$logger.local.info('〖接待管理Recorder〗 == 断开录音! ')
}
},
onAudioError(error) {
onAudioError (error) {
const message = error.message
this.reportError(`录音异常: error: ${message}`, message)
},
......@@ -96,12 +96,12 @@ export default {
* @params {boolean} status true 不保存记录/AUDIO_STATUS.ABNORMAL 只要断开录音
* @returns {void}
*/
async stopAudio(isNotSave = false) {
async stopAudio (isNotSave = false) {
uni.$logger.local.info('〖接待管理Recorder〗 == 结束接待! ')
this.stop()
await this.saveAndClearRecord(isNotSave)
},
async saveAndClearRecord(isNotSave = false) {
async saveAndClearRecord (isNotSave = false) {
if (isNotSave) {
return this.record.clearLocalRecord()
}
......@@ -109,23 +109,23 @@ export default {
//如果不需要保存记录
await this.record.save()
},
stop() {
stop () {
this.endWatchClick()
this.record.clearLoopTimer()
if(this.audioManager.isRecording){
if (this.audioManager.isRecording) {
this.audioManager.stop()
}
},
handler(params, fn) {
handler (params, fn) {
if (!this.audioManager.isRecording) return
fn.call(this, params)
},
reset() {
reset () {
this.audioManager = null
this.record = null
this.tempRecord = null
},
initDto() {
initDto () {
const { shopMerchantId, phone, sceneType, uuid, name, merchantId, channelType, merchantName } = storageApi.getUserInfo()
const { deviceId: appCode } = uni.getDeviceInfo()
const dto = new RecordDto({
......@@ -143,7 +143,7 @@ export default {
this.sceneType = sceneType
this.tempRecord = dto
},
updateCustomerInfo(customerInfo = {}) {
updateCustomerInfo (customerInfo = {}) {
const { customerName, phoneNumber, salesUuid, carModel, staffName: salesName } = customerInfo
this.record.updatePreRecords({
customerName,
......@@ -153,7 +153,7 @@ export default {
salesName
})
},
updateBookList(booksList) {
updateBookList (booksList) {
const receptionCustomerPaySourceList = booksList.map(item => {
return {
id: item.id,
......@@ -163,7 +163,7 @@ export default {
})
this.record.updatePreRecords({ receptionCustomerPaySourceList })
},
updateMaterialPointList(receptionTrack) {
updateMaterialPointList (receptionTrack) {
const { merchantId, staffUuid, staffName } = this.tempRecord
let receptionCustomerMaterialPointList = []
Object.keys(receptionTrack).map(key => {
......@@ -177,17 +177,17 @@ export default {
})
this.record.updatePreRecords({ receptionCustomerMaterialPointList })
},
updateReceptionStatus(status) {
updateReceptionStatus (status) {
this.record.updatePreRecords({ receptionStatus: status })
},
getRecorder() {
getRecorder () {
return this.record
},
async triggleTempNumber() {
async triggleTempNumber () {
const _records = await this.record.getRecords()
this.setPerRecordNumber(_records.length)
},
async isPermission() {
async isPermission () {
const result = await permision.requestAndroidPermission('android.permission.RECORD_AUDIO')
if (result !== 1) {
uni.showToast({
......@@ -197,13 +197,13 @@ export default {
}
return result === 1
},
async checkBeforeStart() {
async checkBeforeStart () {
const isPermission = await this.isPermission()
const isRecording = this.audioManager.isRecording
return isPermission && !isRecording
}
},
beforeDestroy() {
beforeDestroy () {
this.stop()
this.reset()
}
......
......@@ -8,4 +8,5 @@ export default {
receptionTrack: (state) => state.user.receptionTrack,
receptionStatus: (state) => state.audio.receptionStatus,
booksList: (state) => state.audio.booksList,
receptionKey: (state) => state.user.receptionKey,
};
......@@ -30,7 +30,8 @@ export default {
receptionTrack: {}, //接待记录埋点
boutiqueDefaultCarBrandId: '',
viewKey: Date.now(),
boutiqueCarList:[]
boutiqueCarList:[],
receptionKey:Date.now(), //接待记录埋点KEY
};
},
mutations: {
......@@ -81,9 +82,11 @@ export default {
},
setReceptionTrack ({ state }, { key, value }) {
state.receptionTrack[key] = value
state.receptionKey = Date.now()
},
clearReceptionTrack ({ state }) {
state.receptionTrack = {}
state.receptionKey = Date.now()
},
updateViewKey({ state }){
state.viewKey = Date.now();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!