Commit a0621ab2 by Denglingling

【快速下单】手术医院获取重复、重复提交问题、语音上传类型修改(后端需要增加“aac”类型,接口改好再测试)

parent d262957a
......@@ -96,7 +96,8 @@ class NotEnoughModel extends Component {
return (
<TouchableOpacity
activeOpacity={1}
style={styles.cont_list}>
style={styles.cont_list}
key={index}>
<Text style={[styles.co_li, styles.co_str]}>{item.item_name}({item.item_code})</Text>
<Text style={styles.co_li}>{item.general_name}</Text>
<Text style={styles.co_li}>{item.specification}</Text>
......
......@@ -213,7 +213,7 @@ class EquipConsuPage extends Component {
dateModelPop: false, // 日期选择器
hasPermission: undefined, //录音 授权状态
// audioPath: AudioUtils.DocumentDirectoryPath + `/quickAudio${Math.floor(Math.random() * (1000))+1}.aac`, // 文件路径
audioPath: AudioUtils.DocumentDirectoryPath + `/quick_audio_${new Date().getTime()}.ogg`, // 文件路径
audioPath: AudioUtils.DocumentDirectoryPath + `/quick_audio_${new Date().getTime()}.aac`, // 文件路径
recording: false, //是否录音
pause: false, //录音是否暂停
stop: false, //录音是否停止
......@@ -404,7 +404,7 @@ class EquipConsuPage extends Component {
SampleRate: 44100.0, //采样率
Channels: 2, //通道
AudioQuality: 'High', //音质
AudioEncoding: 'ogg', //音频编码 aac
AudioEncoding: 'aac', //音频编码 aac
OutputFormat: 'mpeg_4', //输出格式
MeteringEnabled: false, //是否计量
MeasurementMode: false, //测量模式
......@@ -483,6 +483,7 @@ class EquipConsuPage extends Component {
// 播放录音
_play = async () => {
let self = this
show('正在播放')
self.whoosh = new Sound(this.state.audioPath, '', (err) => {
if(err) {
show('加载音频失败')
......@@ -491,6 +492,7 @@ class EquipConsuPage extends Component {
self.whoosh.play(success => {
if(success) {
console.warn('success - 播放成功')
show('播放完毕')
}else {
console.warn('fail - 播放失败')
show('播放失败')
......@@ -512,9 +514,12 @@ class EquipConsuPage extends Component {
_del = async () => {
// 初始化录音
this.prepareRecordingPath(this.state.audioPath)
let {listOptionData} = this.state
listOptionData[11].value = ''
this.setState({
currentTime: 0,
stop: false
stop: false,
listOptionData
})
}
......@@ -529,10 +534,12 @@ class EquipConsuPage extends Component {
this.changeSubLoding(true)
break;
case QUICK_ORDER_LIST_SUCCESS:
self.changeSubLoding(false)
setTimeout(() => {
self.setState({
isSubLoding: false,
lodingTitle: '加载中'
},() => {
self.changeCurrentOption()
}, 500)
})
break;
case QUICK_ORDER_LIST_FAILURE:
this.changeSubLoding(false)
......@@ -559,10 +566,12 @@ class EquipConsuPage extends Component {
this.changeSubLoding(true, '提交中')
break;
case QUICK_SUBMIT_SUCCESS:
self.changeSubLoding(false, '提交中')
setTimeout(() => {
self.setState({
isSubLoding: false,
lodingTitle: '提交中'
},() => {
self.processReturnData()
}, 500)
})
break;
case QUICK_SUBMIT_FAILURE:
this.changeSubLoding(false, '提交中')
......@@ -690,22 +699,37 @@ class EquipConsuPage extends Component {
this.setState({
localCustomersOption: quickOrderOption
})
// console.log('----quickOrderOption----', quickOrderOption)
// 去重医院数据
let filterOpt = dedupQuoteArray(quickOrderOption, 'customer_code')
let currentArr = []
if( quickOrderOption.length ) {
let obj = {}
quickOrderOption.forEach((item, index) => {
if(!obj.customer_code) {
obj.customer_code = item.customer_code
obj.customer_name = item.customer_name
currentArr.push(obj)
} else if(obj.customer_code && item.customer_code !== obj.customer_code) {
obj.customer_code = item.customer_code
obj.customer_name = item.customer_name
currentArr.push(obj)
}
if(filterOpt.length) {
filterOpt.forEach(item => {
let obj = {}
obj.customer_code = item.customer_code
obj.customer_name = item.customer_name
currentArr.push(obj)
})
}
// if( quickOrderOption.length ) {
// let obj = {}
// quickOrderOption.forEach((item, index) => {
// if(!obj.customer_code) {
// obj.customer_code = item.customer_code
// obj.customer_name = item.customer_name
// currentArr.push(obj)
// } else if(obj.customer_code && item.customer_code !== obj.customer_code) {
// obj.customer_code = item.customer_code
// obj.customer_name = item.customer_name
// currentArr.push({
// customer_code: item.customer_code,
// customer_name: item.customer_name
// })
// }
// })
// }
// console.log('---currentArr----', currentArr)
tempOption = this.changeNameAndValue(currentArr, 'customer_name', 'customer_code')
......@@ -1104,8 +1128,10 @@ class EquipConsuPage extends Component {
// // // 测试 -- 图片上传
// // this.addPhotoAction()
console.log('提交======》', state.canSubFlag, state.stop)
if(state.canSubFlag) {
// console.log('提交======》', state.canSubFlag, state.stop, state.isSubLoding)
// 可提交 并且 不处于正在提交中
if(state.canSubFlag && !state.isSubLoding) {
// console.warn('进入提交内容----------')
// console.warn(state.listOptionData)
// 先提交录音,再提交接口
......@@ -1115,9 +1141,9 @@ class EquipConsuPage extends Component {
access_token: props.token,
path: state.audioPath
}
console.log('---handleSubmit--',params)
// console.log('---handleSubmit--',params)
let audioResult = await requestQuickAudio(params);
console.log('返回---audioResult======',audioResult)
// console.log('返回---audioResult======',audioResult)
that.changeSubLoding(true, '上传中')
if(audioResult.error_code == 0) {
// 提交订单
......@@ -1145,30 +1171,6 @@ class EquipConsuPage extends Component {
} else {
that.submitQuickOrder()
}
// let tempSubOption = state.submitOption
// tempSubOption.seller_code = state.listOptionData[0].value
// tempSubOption.org_code = state.listOptionData[1].value
// tempSubOption.customer_code = state.listOptionData[2].value
// tempSubOption.bill_to_site_code = state.listOptionData[3].value
// tempSubOption.ship_to_site_code = state.listOptionData[4].value
// if(state.listOptionData[5].name === '其他') {
// tempSubOption.doctor_name = state.listOptionData[5].inputValue
// } else {
// tempSubOption.doctor_name = state.listOptionData[5].value
// }
// tempSubOption.template_collect_number = state.listOptionData[7].value
// tempSubOption.surgery_date = state.listOptionData[8].value
// tempSubOption.order_type_code = state.listOptionData[9].value
// tempSubOption.surgery_desc = state.listOptionData[10].value
// tempSubOption.voice_url = state.listOptionData[11].value
// console.log('tempSubOption-----', tempSubOption)
// // let params = {
// // access_token: props.token,
// // data: { ...tempSubOption }
// // }
// // props.requestQuickSumbit(params)
}
}
......@@ -1192,8 +1194,8 @@ class EquipConsuPage extends Component {
tempSubOption.surgery_desc = state.listOptionData[10].value
tempSubOption.voice_url = state.listOptionData[11].value
console.log('tempSubOption-----', tempSubOption)
let params = {
// console.log('tempSubOption-----', tempSubOption)
let params = {
access_token: props.token,
data: { ...tempSubOption }
}
......@@ -1601,14 +1603,6 @@ class EquipConsuPage extends Component {
/>
</ScrollView>
{/* <FooterBtnStyle
style={canSubFlag ? styles.sub_btn_pro : ''}
activeOpacity={canSubFlag ? .8 : 1}
title={'生成订单'}
textStyle= {styles.sub_btn}
onPress={() => this.handleSubmit()}
/> */}
{ this.renderLodingItem() }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment