Commit ab7e6182 by Denglingling

完善转单模块

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