Commit ab7e6182 by Denglingling

完善转单模块

(cherry picked from commit e3d63135)
parent a266f6aa
Showing with 61 additions and 50 deletions
......@@ -11,7 +11,8 @@ import {
Alert,
Linking,
NativeModules,
Platform
Platform,
Modal
} from 'react-native';
import {
home_background_color,
......@@ -60,6 +61,7 @@ import {
import ImagePicker from 'react-native-image-picker';
import { exitLoginStatus } from '../../action/LoginAction';
import moment from 'moment';
import ImageViewer from 'react-native-image-zoom-viewer';
class TransOrderPage extends Component {
constructor(props) {
......@@ -212,7 +214,6 @@ class TransOrderPage extends Component {
getSellerName() {
let { state, props } = this
let { listOptionData } = this.state
// console.log('---userInfo',props.userInfo)
this.setState({
subInitListOption: cloneObject(listOptionData) // 存储初始化数据,提交成功后赋此值
})
......@@ -289,7 +290,6 @@ class TransOrderPage extends Component {
// 开始录音
_record = async () => {
console.log('-----this.state.hasPermission---', this.state.hasPermission)
// 【有问题】
// let {hasPermission} = this.state
// if(!hasPermission) {
......@@ -388,7 +388,6 @@ class TransOrderPage extends Component {
// 停止录音
_stop = async () => {
console.log('----stop---', this.state.hasPermission)
if(!this.state.hasPermission) {
return
// return alert('没有授权')
......@@ -404,14 +403,15 @@ class TransOrderPage extends Component {
// 播放录音
_play = async () => {
let self = this
let that = this
show('正在播放')
self.whoosh = new Sound(this.state.audioPath, '', (err) => {
that.whoosh = new Sound(this.state.audioPath, '', (err) => {
if(err) {
show('加载音频失败')
return console.log('加载音频失败-->',err)
show('加载音频失败,请联系管理员')
console.log('加载音频失败-->',err)
return
}
self.whoosh.play(success => {
that.whoosh.play(success => {
if(success) {
show('播放完毕')
}else {
......@@ -437,18 +437,18 @@ class TransOrderPage extends Component {
componentWillReceiveProps(nextProps) {
let { trans_list_status, loginState, navigation, submit_trans_order_status, subTransDetOption} = this.props
let self = this
let that = this
if(trans_list_status != nextProps.trans_list_status) {
switch (nextProps.trans_list_status) {
case TRANS_ORDER_LIST_DOING:
this.changeSubLoding(true)
break;
case TRANS_ORDER_LIST_SUCCESS:
self.setState({
that.setState({
isSubLoding: false,
lodingTitle: '加载中'
},() => {
self.changeCurrentOption()
that.changeCurrentOption()
})
break;
case TRANS_ORDER_LIST_FAILURE:
......@@ -473,7 +473,7 @@ class TransOrderPage extends Component {
this.setState({
listOptionData
}, () => {
self.changeCanSub()
that.changeCanSub()
})
}
if(submit_trans_order_status != nextProps.submit_trans_order_status) {
......@@ -482,11 +482,11 @@ class TransOrderPage extends Component {
this.changeSubLoding(true, '提交中')
break;
case TRANS_SUBMIT_SUCCESS:
self.setState({
that.setState({
isSubLoding: false,
lodingTitle: '提交中'
},() => {
self.processReturnData()
that.processReturnData()
})
break;
case TRANS_SUBMIT_FAILURE:
......@@ -548,10 +548,8 @@ class TransOrderPage extends Component {
// 选择器弹窗回调函数
handleCallBack(item, itemTitle) {
console.warn(item, 'item--选择器弹窗回调函数----')
console.warn('item-itemTitle-----',itemTitle)
let { listOptionData} = this.state
let self = this
let that = this
this.setState({
currentItem: item,
})
......@@ -561,16 +559,16 @@ class TransOrderPage extends Component {
chItem.name = item.name
chItem.value = item.value
if(itemTitle === '组织') {
self.clearInitNameAndValue(1)
that.clearInitNameAndValue(1)
}
if(itemTitle === '客户名称') {
self.clearInitNameAndValue(2)
that.clearInitNameAndValue(2)
}
}
return chItem
})
}, () => {
self.changeCanSub()
that.changeCanSub()
})
}
......@@ -651,7 +649,6 @@ class TransOrderPage extends Component {
// 组织 点击
handleOrganizationCheck() {
console.warn('组织------check')
let { state, props } = this
this.setState({
currentTitle: '组织',
......@@ -669,11 +666,10 @@ class TransOrderPage extends Component {
// 客户名称 点击
handleCustomerCheck() {
console.warn('客户名称------check')
let { state, props } = this
let self = this
let that = this
if(this.judgeOrgIsNull()) {
self.setState({
that.setState({
currentTitle: '客户名称',
currentItem: {
name: state.listOptionData[2].name,
......@@ -693,11 +689,10 @@ class TransOrderPage extends Component {
// 目标订单信息 点击
handleTargetOrderCheck() {
console.warn('目标订单信息------check')
let { state, props } = this
let self = this
let that = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({
that.setState({
currentTitle: '目标订单信息',
currentItem: {
name: state.listOptionData[3].name,
......@@ -720,7 +715,6 @@ class TransOrderPage extends Component {
// 备注 输入
handleRemarkInput(text) {
// console.warn('备注---',text)
let { listOptionData } = this.state
this.setState({
listOptionData: listOptionData.map((item, index) => {
......@@ -764,34 +758,27 @@ class TransOrderPage extends Component {
// 耗材明细 点击
handleConsumDetailCheck() {
console.warn('耗材明细------check')
let { listOptionData } = this.state
let subTransObj = {
seller_name: listOptionData[0].name,
org_code: listOptionData[1].value,
org_name: listOptionData[1].name,
customer_code: listOptionData[2].value,
collect_number: listOptionData[3].value
}
if(!listOptionData[6].subOption.length) {
this.props.setTransDetailOption([], {})
}
// 测试
this.props.navigation.navigate('TransSearchPage', {
title: '耗材明细 - 转单查询',
subTransObj
})
// if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()
// && this.judgeOrderInfoIsNull()) {
// this.props.navigation.navigate('TransSearchPage', {
// title: '耗材明细 - 转单查询',
// subTransObj
// })
// }
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()
&& this.judgeOrderInfoIsNull()) {
this.props.navigation.navigate('TransSearchPage', {
title: '耗材明细 - 转单查询',
subTransObj
})
}
}
// 添加图片 点击
handleAddPicCheck() {
console.warn('添加图片------check')
let { localPhoOption, listOptionData } = this.state
let { props } = this
let that = this
......@@ -874,7 +861,7 @@ class TransOrderPage extends Component {
let {url} = imgResult.data
localPhoOption.push(source); // 本地图片地址
listOptionData[13].uploadImgArr.push(url) // 服务器图片地址
listOptionData[7].uploadImgArr.push(url) // 服务器图片地址
that.setState({
localPhoOption,
listOptionData
......@@ -908,12 +895,10 @@ class TransOrderPage extends Component {
// 生成订单 点击
async handleSubmit() {
console.warn('生成订单------check')
this.changeCanSub(true)
let { state, props } = this
let that = this
// 对接接口
// 可提交 并且 不处于正在提交中
if(state.canSubFlag && !state.isSubLoding) {
// 先提交录音,再提交接口
......@@ -1005,7 +990,6 @@ class TransOrderPage extends Component {
processReturnData() {
// 打开下单成功页面
let { transOrderOption } = this.props
console.log('transOrderOption-----------', transOrderOption)
if(transOrderOption.error_code == 0) {
this.clearAllData() // 清空数据
let { state: { params: { title } } } = this.props.navigation
......@@ -1114,7 +1098,6 @@ class TransOrderPage extends Component {
currentTitle,
showTypePop,
} = this.state
// console.warn('弹窗-----,', listCurrentOption)
return (
<SafeAreaView style={styles.item_container}>
<DialogModel
......@@ -1284,7 +1267,7 @@ class TransOrderPage extends Component {
{index+1}{ item.item_name }
</Text>
<Text style={list_common_item.de_tip}>
{ item.serial_number }
{item.surgery_collect_number}{ item.serial_number }
</Text>
</View>
)
......@@ -1338,6 +1321,31 @@ class TransOrderPage extends Component {
)
}
// 放大图片
renderBigImage() {
let images = [{
url: 'https://avatars2.githubusercontent.com/u/7970947?v=3&s=460',
props: {
// headers: ...
}
},{
url: 'https://avatars2.githubusercontent.com/u/7970947?v=3&s=460',
props: {
// headers: ...
}
},{
url: 'https://avatars2.githubusercontent.com/u/7970947?v=3&s=460',
props: {
// headers: ...
}
}]
return (
<Modal visible={true} transparent={true}>
<ImageViewer imageUrls={images}/>
</Modal>
)
}
// 返回正在加载中
renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state
......@@ -1374,6 +1382,9 @@ class TransOrderPage extends Component {
{this.renderConsumablesDetailsItem()}
{this.renderAddPicturesItem()}
{/* 测试 */}
{/* {this.renderBigImage()} */}
<FooterBtnStyle
style={canSubFlag ? styles.sub_btn_pro : ''}
......
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