Commit 046384c3 by Denglingling

完善【转单申请】模块,转单提交以及转单查询基本功能;

(cherry picked from commit 6a12e04a)
parent 93628fd7
......@@ -9,7 +9,7 @@ import {
TRANS_SUBMIT_SUCCESS,
TRANS_SUBMIT_FAILURE,
TRANS_INIT_DATA,
GET_TRANS_DETAIL_OPTION
SET_TRANS_DETAIL_OPTION
} from '../base/ActionTypes';
// 获取组织 params={access_token:''}
......@@ -113,11 +113,12 @@ function requestListDataFail() {
}
}
// 获取当前临时存储的明细
export function getTransDetailOption(data) {
// 获取当前临时存储的明细、以及搜索条件
export function setTransDetailOption(data, searchData) {
return {
type: GET_TRANS_DETAIL_OPTION,
rawData: data
type: SET_TRANS_DETAIL_OPTION,
rawData: data,
searchForm: searchData
}
}
......@@ -132,11 +133,21 @@ export const requestTransAudio = async (global_domain_config, params) => {
return await UploadRequest(global_domain_config, getUrlParams('/dingding/upload_media', { access_token }), formData)
}
// 获取消耗明细 params={access_token:'', org_code: '', surgery_collect_number: '', item_name: '', serial_number: '', seller_name: '', surgery_name: ''}
// 子页-获取消耗明细 params={access_token:'', org_code: '', surgery_collect_number: '', item_name: '', serial_number: '', seller_name: '', surgery_name: ''}
export const requestTransDetails = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/transferSurOrder/sur_order_transfer_line_search', params))
}
// 子页-获取组织 params={access_token:''}
export const requestSubTransOrganizations = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/authorized_inventory/search', params))
}
// 子页-获取来源借货订单号 parmas={access_token: '', org_code: '', seller_code: '', customer_code: '', collect_header_status: 'RETURNED,COLLECTED' / 'COLLECTING_WAITING_CONFIRM,CONFIRM_COLLECT,COLLECTED_WAITING_CONFIRMED,APPROVED,COLLECTED'}
export const requestSubSourBorOrdNum = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/surgery/collect_order/search', params))
}
// 图片上传
export const uploadTransImg = async (global_domain_config, params) => {
let { access_token, formData } = params
......@@ -148,8 +159,10 @@ export function requestTransSumbit({access_token, ...params}) {
return (dispatch, getState) => {
dispatch(requestSubmiting());
let { global_domain_config } = getState().login
console.log('params--------', params)
PostRequest(global_domain_config, getUrlParams('/transferSurOrder/sur_order_transfer/create', {access_token: access_token}), params)
.then(res => {
console.log('requestTransSumbit === res--------', res)
if(res.error_code == 0) {
dispatch(requestSubmitSuccess(res));
} else if(res.error_code === 41006) {
......
......@@ -53,4 +53,5 @@ export const TRANS_SUBMIT_DOING = "TRANS_SUBMIT_DOING"
export const TRANS_SUBMIT_SUCCESS = "TRANS_SUBMIT_SUCCESS"
export const TRANS_SUBMIT_FAILURE = "TRANS_SUBMIT_FAILURE"
export const TRANS_INIT_DATA = "TRANS_INIT_DATA"
export const GET_TRANS_DETAIL_OPTION = "GET_TRANS_DETAIL_OPTION"
\ No newline at end of file
export const SET_TRANS_DETAIL_OPTION = "SET_TRANS_DETAIL_OPTION"
export const SET_TRANS_SEARCH_FORM = "SET_TRANS_SEARCH_FORM"
\ No newline at end of file
......@@ -251,14 +251,14 @@ class EquipConsuPage extends Component {
isSubLoding: false, // 加载中弹窗
lodingTitle: '加载中',
listCurrentOption: [ // 当前选择器数据
{
name: '测试1',
value: '测试1'
},
{
name: '测试2',
value: '测试2'
}
// {
// name: '测试1',
// value: '测试1'
// },
// {
// name: '测试2',
// value: '测试2'
// }
],
dateModelPop: false, // 日期选择器
sexTypeOption: [ // 性别
......@@ -809,7 +809,7 @@ class EquipConsuPage extends Component {
// 耗材明细 点击
handleConsumDetailCheck() {
// console.warn('耗材明细------check')
let {listOptionData} = this.state
let { listOptionData } = this.state
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()
&& this.judgeOrderInfoIsNull()) {
this.props.navigation.navigate('ConsumDetailsPage', {
......@@ -1444,9 +1444,9 @@ class EquipConsuPage extends Component {
}
render() {
let {canSubFlag} = this.state
let {navigation} = this.props
let {title} = navigation.state.params
let { canSubFlag } = this.state
let { navigation } = this.props
let { title } = navigation.state.params
return (
<View style={styles.equip_container}>
<StatusBarView
......
......@@ -30,6 +30,7 @@ import {
import { connect } from 'react-redux';
import { show} from '../../../utils/Utils';
import LodingModel from '../../common/LodingModel';
import { exitLoginStatus } from '../../../action/LoginAction';
class ConsumDetailsPage extends Component {
constructor(props) {
......@@ -120,23 +121,28 @@ class ConsumDetailsPage extends Component {
surgery_collect_number: orderId
}
let detailResult = await requestEquipDetails(global_domain_config, params)
console.log('detailResult-----',detailResult)
if(detailResult.error_code === 0) {
let {lines} = detailResult.data
// 需要过滤已提过消耗的数据 raised_consume="Y"
lines = lines.filter((fiItem) => {
return fiItem.raised_consume != 'Y'
})
let {subDetOption} = this.props // 【器械消耗】已存在的明细
// console.log('subDetOption-----', subDetOption)
subDetOption.length && subDetOption.forEach((item, index) => {
lines.length && lines.forEach((chItem, chInd) => {
if(chItem.serial_number == item.serial_number) {
// chItem.sale_price = item.sale_price
chItem.local_add_price = item.local_add_price
chItem.select = true
}
if(lines.length == 0) {
show('当前明细数据为空,请重现选择订单')
} else {
let {subDetOption} = this.props // 【器械消耗】已存在的明细
// console.log('subDetOption-----', subDetOption)
subDetOption.length && subDetOption.forEach((item, index) => {
lines.length && lines.forEach((chItem, chInd) => {
if(chItem.serial_number == item.serial_number) {
// chItem.sale_price = item.sale_price
chItem.local_add_price = item.local_add_price
chItem.select = true
}
})
})
})
}
this.setState({
isSubLoding: false,
conDetaOption: lines,
......@@ -475,9 +481,9 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
// requestEquipOrganizations: (params) => {
// dispatch(requestEquipOrganizations(params))
// }
exitLoginStatus: () => {
dispatch(exitLoginStatus())
}
}
}
......
......@@ -225,8 +225,8 @@ class EquipConsuPage extends Component {
// 赋值销售员 初始化数据
getSellerName() {
let {state, props} = this
let {listOptionData} = this.state
let { state, props } = this
let { listOptionData } = this.state
this.setState({
subInitListOption: cloneObject(listOptionData) // 存储初始化数据,提交成功后赋此值
})
......
......@@ -7,7 +7,11 @@ import {
ScrollView,
TouchableOpacity,
Image,
TextInput
TextInput,
Alert,
Linking,
NativeModules,
Platform
} from 'react-native';
import {
home_background_color,
......@@ -32,19 +36,32 @@ import { connect } from 'react-redux';
import { AudioRecorder, AudioUtils } from 'react-native-audio';
import Sound from 'react-native-sound';
import DialogModel from '../common/DialogModel';
import LodingModel from '../common/LodingModel';
import {
requestTransOrganizations,
requestTransSurgeryHospital,
requestTransTargetOrderInfo,
getTransDetailOption,
requestTransAudio,
requestTransDetails,
uploadTransImg,
requestTransSumbit,
setTransInitData
setTransInitData,
setTransDetailOption
} from '../../action/TransAction';
import { show, isEmpty, dedupQuoteArray, formatStrForDate, cloneObject } from '../../utils/Utils';
import {
TRANS_ORDER_LIST_DOING,
TRANS_ORDER_LIST_SUCCESS,
TRANS_ORDER_LIST_FAILURE,
LOGIN_NO,
TRANS_SUBMIT_DOING,
TRANS_SUBMIT_SUCCESS,
TRANS_SUBMIT_FAILURE
} from '../../base/ActionTypes';
import ImagePicker from 'react-native-image-picker';
import { exitLoginStatus } from '../../action/LoginAction';
import moment from 'moment';
class EquipConsuPage extends Component {
class TransOrderPage extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -64,7 +81,7 @@ class EquipConsuPage extends Component {
},
{
"id": "2",
title: '手术医院',
title: '客户名称',
name: '请选择',
value: ''
},
......@@ -93,35 +110,44 @@ class EquipConsuPage extends Component {
value: '',
isJumpSubPage: true, // 跳转子页
isShowSub: true, // 是否展示子项
subOption: [{
item_name: '人工髋关节假体-JS-HB ||| 人工髋关节假体-JS-HB',
serial_number: 'SC20200506000006, SC20200506000006'
},{
item_name: '人工髋关节假体-JS-22 ||| 人工髋关节假体-JS-HB',
serial_number: 'SC20200506000006, SC20200506000006'
},{
item_name: '人工髋关节假体-JS-33 ||| 人工髋关节假体-JS-HB',
serial_number: 'SC20200506000006, SC20200506000006'
},{
item_name: '人工髋关节假体-JS-44 ||| 人工髋关节假体-JS-HB',
serial_number: 'SC20200506000006, SC20200506000006'
},{
item_name: '人工髋关节假体-JS-5 ||| 人工髋关节假体-JS-HB',
serial_number: 'SC20200506000006, SC20200506000006'
}]
subOption: [
// {
// item_name: '人工髋关节假体-JS-HB ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006'
// },{
// item_name: '人工髋关节假体-JS-22 ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006'
// },{
// item_name: '人工髋关节假体-JS-33 ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006'
// },{
// item_name: '人工髋关节假体-JS-44 ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006'
// },{
// item_name: '人工髋关节假体-JS-5 ||| 人工髋关节假体-JS-HB',
// serial_number: 'SC20200506000006, SC20200506000006'
// }
]
},
{
"id": "7",
title: '添加片',
title: '添加片',
value: '',
isAddImage: true // 添加图片
isAddImage: true, // 添加图片
uploadImgArr: [] // 上传后的路径
}
],
subInitListOption: [], // 提交成功后,初始化当前数据
submitOption: { // 提交的信息
org_code: '',
collect_number: '',
remark: '',
voice_url: '',
sur_order_transfer_line: '',
img_url: ''
// seller_code: '', // 用户名username
// org_code: '', // 组织
// customer_code: '', // 手术医院
// customer_code: '', // 客户名称
// bill_to_site_code: '', // 收单地点
// ship_to_site_code: '', // 收货地点
// doctor_name: '', // 主治医生
......@@ -149,27 +175,27 @@ class EquipConsuPage extends Component {
isSubLoding: false, // 加载中弹窗
lodingTitle: '加载中',
listCurrentOption: [ // 当前选择器数据
{
name: '男',
value: 'boy'
},
{
name: '女',
value: 'girl'
},
{
name: '其他',
value: 'other'
}
// {
// name: '男',
// value: 'boy'
// },
// {
// name: '女',
// value: 'girl'
// },
// {
// name: '其他',
// value: 'other'
// }
],
hasPermission: undefined, //录音 授权状态
// audioPath: AudioUtils.DocumentDirectoryPath + `/quickAudio${Math.floor(Math.random() * (1000))+1}.aac`, // 文件路径
audioPath: AudioUtils.DocumentDirectoryPath + `/quickAudio${Math.floor(Math.random() * (1000))+1}.ogg`, // 文件路径
recording: false, //是否录音
pause: false, //录音是否暂停
audioPath: AudioUtils.DocumentDirectoryPath + `/trans_audio_${new Date().getTime()}.aac`, // 文件路径
// recording: false, //是否录音
// pause: false, //录音是否暂停
stop: false, //录音是否停止
currentTime: 0, //录音时长
// localCustomersOption: [], // 当前医院信息:手术医院、收单地点、收货地点、主治医生
localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生
localPhoOption: [ // 添加的图片
// 'file:///storage/emulated/0/Pictures/images/image-ea1a24b8-2d12-468f-ac23-e9aed20c6d31.jpg'
],
......@@ -179,29 +205,373 @@ class EquipConsuPage extends Component {
componentDidMount() {
this.getSellerName()
this.getAudioAuthorize()
}
// 赋值销售员
// 赋值销售员 初始化数据
getSellerName() {
let {state, props} = this
let { state, props } = this
let { listOptionData } = this.state
// console.log('---userInfo',props.userInfo)
this.setState({
subInitListOption: cloneObject(listOptionData) // 存储初始化数据,提交成功后赋此值
})
if(state.listOptionData[0].name !== props.userInfo.person_name) {
listOptionData[0].name = props.userInfo.person_name
listOptionData[0].value = props.userInfo.user_name
this.setState({
listOptionData: state.listOptionData.map((item) => {
if(item.title === '销售员') {
item.name = props.userInfo.person_name
item.value = props.userInfo.user_name
listOptionData,
subInitListOption: cloneObject(listOptionData)
})
}
}
// 请求授权
getAudioAuthorize() {
AudioRecorder.requestAuthorization()
.then(isAuthor => {
console.log('是否授权: ' + isAuthor)
if(!isAuthor) {
// return alert('APP需要使用录音,请打开录音权限允许APP使用')
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
text: '设置',
onPress: () => {
if(Platform.OS == 'ios') {
Linking.openURL('app-settings:')
.catch(err => console.log('error', err))
} else if(Platform.OS == 'android') {
NativeModules.OpenSettings.openNetworkSettings(data => {
console.log('call back data', data)
}).catch(err => console.log('android---', err))
}
}
}, {
text: '取消',
}])
}
this.setState({hasPermission: isAuthor})
this.prepareRecordingPath(this.state.audioPath);
// 录音进展
AudioRecorder.onProgress = (data) => {
this.setState({
currentTime: Math.ceil(data.currentTime)
});
};
// 完成录音
AudioRecorder.onFinished = (data) => {
// data 录音数据
console.log(this.state.currentTime)
};
})
}
/**
* AudioRecorder.prepareRecordingAtPath(path,option)
* 录制路径
* path 路径
* option 参数
*/
prepareRecordingPath = (path) => {
const option = {
SampleRate: 44100.0, //采样率
Channels: 2, //通道
AudioQuality: 'High', //音质
AudioEncoding: 'aac', //音频编码 aac
OutputFormat: 'mpeg_4', //输出格式
MeteringEnabled: false, //是否计量
MeasurementMode: false, //测量模式
AudioEncodingBitRate: 32000, //音频编码比特率
IncludeBase64: true, //是否是base64格式
AudioSource: 0, //音频源
}
AudioRecorder.prepareRecordingAtPath(path,option)
}
// 开始录音
_record = async () => {
console.log('-----this.state.hasPermission---', this.state.hasPermission)
// 【有问题】
// let {hasPermission} = this.state
// if(!hasPermission) {
// AudioRecorder.requestAuthorization()
// .then(async (isAuthor) => {
// console.log('是否授权: ' + isAuthor)
// if(!isAuthor) {
// // return Alert.alert('提示信息','APP需要使用录音,请打开录音权限允许APP使用')
// return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
// text: '设置',
// onPress: () => {
// if(Platform.OS == 'ios') {
// Linking.openURL('app-settings:')
// .catch(err => console.log('error', err))
// } else if(Platform.OS == 'android') {
// NativeModules.OpenSettings.openNetworkSettings(data => {
// console.log('call back data', data)
// }).catch(err => console.log('android---', err))
// }
// }
// }, {
// text: '取消',
// }])
// }
// console.log('this.state.hasPermission---!!----', this.state.hasPermission)
// this.setState({hasPermission: isAuthor})
// this.prepareRecordingPath(this.state.audioPath);
// // 录音进展
// AudioRecorder.onProgress = (data) => {
// this.setState({
// currentTime: Math.ceil(data.currentTime)
// });
// };
// // 完成录音
// AudioRecorder.onFinished = (data) => {
// // data 录音数据
// console.log(this.state.currentTime)
// };
// show('录音开始!!')
// if(this.state.stop) {
// // 初始化录音
// this.prepareRecordingPath(this.state.audioPath)
// }
// try {
// // await AudioRecorder.startRecording()
// } catch (err) {
// console.log('start record-!!-error->',err)
// }
// })
// } else {
// console.log('---否则---')
// show('录音开始')
// if(this.state.stop) {
// // 初始化录音
// this.prepareRecordingPath(this.state.audioPath)
// }
// try {
// await AudioRecorder.startRecording()
// } catch (err) {
// console.log('start record--error->',err)
// }
// }
if(!this.state.hasPermission) {
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
text: '设置',
onPress: () => {
if(Platform.OS == 'ios') {
Linking.openURL('app-settings:')
.catch(err => console.log('error', err))
} else if(Platform.OS == 'android') {
NativeModules.OpenSettings.openNetworkSettings(data => {
console.log('call back data', data)
}).catch(err => console.log('android---', err))
}
return item
})
}
}, {
text: '取消',
}])
// return
}
show('录音开始')
if(this.state.stop) {
// 初始化录音
this.prepareRecordingPath(this.state.audioPath)
}
try {
await AudioRecorder.startRecording()
} catch (err) {
console.error(err)
}
}
// 停止录音
_stop = async () => {
console.log('----stop---', this.state.hasPermission)
if(!this.state.hasPermission) {
return
// return alert('没有授权')
}
show('录音结束')
try {
await AudioRecorder.stopRecording();
this.setState({ stop: true });
} catch (error) {
console.log('stop record--error->', error);
}
}
// 播放录音
_play = async () => {
let self = this
show('正在播放')
self.whoosh = new Sound(this.state.audioPath, '', (err) => {
if(err) {
show('加载音频失败')
return console.log('加载音频失败-->',err)
}
self.whoosh.play(success => {
if(success) {
show('播放完毕')
}else {
show('播放失败')
console.log('fail - 播放失败')
}
})
})
}
// 删除录音
_del = async () => {
// 初始化录音
this.prepareRecordingPath(this.state.audioPath)
let { listOptionData } = this.state
listOptionData[5].value = ''
this.setState({
currentTime: 0,
stop: false,
listOptionData
})
}
componentWillReceiveProps(nextProps) {
let { trans_list_status, loginState, navigation, submit_trans_order_status, subTransDetOption} = this.props
let self = 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({
isSubLoding: false,
lodingTitle: '加载中'
},() => {
self.changeCurrentOption()
})
break;
case TRANS_ORDER_LIST_FAILURE:
this.changeSubLoding(false)
break;
default:
break;
}
}
if(loginState != nextProps.loginState) {
switch(nextProps.loginState) {
case LOGIN_NO:
navigation.navigate('LoginPage')
break;
default:
break;
}
}
if(subTransDetOption != nextProps.subTransDetOption) {
let { listOptionData } = this.state
listOptionData[6].subOption = nextProps.subTransDetOption
this.setState({
listOptionData
}, () => {
self.changeCanSub()
})
}
if(submit_trans_order_status != nextProps.submit_trans_order_status) {
switch (nextProps.submit_trans_order_status) {
case TRANS_SUBMIT_DOING:
this.changeSubLoding(true, '提交中')
break;
case TRANS_SUBMIT_SUCCESS:
self.setState({
isSubLoding: false,
lodingTitle: '提交中'
},() => {
self.processReturnData()
})
break;
case TRANS_SUBMIT_FAILURE:
this.changeSubLoding(false, '提交中')
break;
default:
break;
}
}
}
// 修改正在加载
changeSubLoding(loading, loadTit) {
this.setState({
isSubLoding: loading || false,
lodingTitle: loadTit || '加载中'
})
}
// 清空当前项以下的值
clearInitNameAndValue(curIndex) {
let { listOptionData, localOtherObj } = this.state
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(index > curIndex && index < 4 ) {
item.name = localOtherObj.name
item.value = localOtherObj.value
}
return item
})
})
}
// 判断是否都有值,修改提交按钮的颜色
changeCanSub(isSubCheck) {
let { listOptionData } = this.state
let tempStatus = false
let tempTit = ''
for(let chIndex in listOptionData) {
if(chIndex > 0 && chIndex < 4
&& !listOptionData[chIndex].value) {
tempTit = `“${listOptionData[chIndex].title}”未选择`
tempStatus = true
break
} else if( chIndex == 6
&& !listOptionData[chIndex].subOption.length ){
tempTit = `“${listOptionData[chIndex].title}”未添加`
tempStatus = true
break
}
}
this.setState({
canSubFlag: !tempStatus
})
if(isSubCheck && tempStatus) {
show(`${tempTit},不能提交`)
}
}
// 选择器弹窗回调函数
handleCallBack(item, itemTitle) {
console.warn(item, 'item--选择器弹窗回调函数----')
console.warn('item-itemTitle-----',itemTitle)
let { listOptionData} = this.state
let self = this
this.setState({
currentItem: item,
})
this.setState({
listOptionData: listOptionData.map((chItem, index) => {
if(chItem.title === itemTitle) {
chItem.name = item.name
chItem.value = item.value
if(itemTitle === '组织') {
self.clearInitNameAndValue(1)
}
if(itemTitle === '客户名称') {
self.clearInitNameAndValue(2)
}
}
return chItem
})
}, () => {
self.changeCanSub()
})
}
// 关闭弹窗
......@@ -211,46 +581,155 @@ class EquipConsuPage extends Component {
})
}
// 修改当前选择器数据
changeCurrentOption() {
let { currentTitle } = this.state
let { transOrderOption } = this.props
let tempOption = []
let that = this
if(transOrderOption.length === 0) {
show(`当前${currentTitle}为空`)
return
}
if(currentTitle === '组织') {
tempOption = this.changeNameAndValue(transOrderOption, 'org_name', 'org_code')
} else if(currentTitle === '客户名称') {
this.setState({
localCustomersOption: transOrderOption // 用了吗??
})
// 去重医院数据
let filterOpt = dedupQuoteArray(transOrderOption, 'customer_code')
let currentArr = []
if(filterOpt.length) {
filterOpt.forEach(item => {
let obj = {}
obj.customer_code = item.customer_code
obj.customer_name = item.customer_name
currentArr.push(obj)
})
}
tempOption = this.changeNameAndValue(currentArr, 'customer_name', 'customer_code')
} else if(currentTitle == '目标订单信息') {
let resultArr = []
transOrderOption.forEach(item => {
let obj = {}
let collect_number = item.collect_number ? item.collect_number : '空'
let surgery_name = item.surgery_name ? item.surgery_name : '空'
let create_time = item.create_time ? moment(item.create_time).format("YYYY-MM-DD") : '空'
let tempName = `${collect_number}-${surgery_name}-${create_time}`
obj.name = tempName,
obj.value = item.collect_number
resultArr.push(obj)
})
tempOption = [...resultArr]
}
this.setState({
listCurrentOption: [...tempOption]
}, () => {
// 解决 IOS 弹窗显示问题
setTimeout(() => {
that.setState({
showTypePop: true
})
}, 500)
})
}
// 修改选择器为属性 name 和 value
changeNameAndValue(data, nameType, valueType) {
let result = []
data.forEach(item => {
let obj = {}
obj.name = item[nameType],
obj.value = item[valueType]
result.push(obj)
})
return result
}
// 组织 点击
handleOrganizationCheck() {
console.warn('组织------check')
// let { state, props } = this
// this.setState({
// currentTitle: '组织',
// currentItem: {
// name: state.listOptionData[1].name,
// value: state.listOptionData[1].value
// }
// }, () => {
// let params = {
// access_token: props.token
// }
// props.requestQuickOrganizations(params)
// })
let { state, props } = this
this.setState({
currentTitle: '组织',
currentItem: {
name: state.listOptionData[1].name,
value: state.listOptionData[1].value
}
}, () => {
let params = {
access_token: props.token
}
props.requestTransOrganizations(params)
})
}
// 手术医院 点击
// 客户名称 点击
handleCustomerCheck() {
console.warn('手术医院------check')
// let { state, props } = this
// let self = this
// if(this.judgeOrgIsNull()) {
// self.setState({
// currentTitle: '手术医院',
// currentItem: {
// name: state.listOptionData[2].name,
// value: state.listOptionData[2].value
// }
// }, () => {
// // 在此修改接口
// self.getCustomerData()
// })
// }
console.warn('客户名称------check')
let { state, props } = this
let self = this
if(this.judgeOrgIsNull()) {
self.setState({
currentTitle: '客户名称',
currentItem: {
name: state.listOptionData[2].name,
value: state.listOptionData[2].value
}
}, () => {
// 在此修改接口
let params = {
access_token: props.token,
org_code: state.listOptionData[1].value,
seller_code: props.userInfo.user_name
}
props.requestTransSurgeryHospital(params)
})
}
}
// 目标订单信息 点击
handleTargetOrderCheck() {
console.warn('目标订单信息------check')
let { state, props } = this
let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({
currentTitle: '目标订单信息',
currentItem: {
name: state.listOptionData[3].name,
value: state.listOptionData[3].value
}
}, () => {
// 在此修改接口
let params = {
access_token: props.token,
org_code: state.listOptionData[1].value,
seller_code: props.userInfo.user_name,
customer_code: state.listOptionData[2].value,
collect_header_status: 'COLLECTING_WAITING_CONFIRM,CONFIRM_COLLECT,COLLECTED_WAITING_CONFIRMED,APPROVED,COLLECTED'
}
props.requestTransTargetOrderInfo(params)
})
}
}
// 备注 输入
handleRemarkInput(text) {
// console.warn('备注---',text)
let { listOptionData } = this.state
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(item.title === '备注') {
item.value = text
}
return item
})
})
}
// 耗材明细 隐藏子项
......@@ -286,19 +765,277 @@ class EquipConsuPage extends Component {
// 耗材明细 点击
handleConsumDetailCheck() {
console.warn('耗材明细------check')
let { listOptionData } = this.state
// if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()
// && this.judgeOrderInfoIsNull()) {
// this.props.navigation.navigate('TransSearchPage', {
// title: '耗材明细 - 转单查询',
// org_code: listOptionData[1].value
// })
// }
let subTransObj = {
seller_name: listOptionData[0].name,
org_code: listOptionData[1].value,
customer_code: listOptionData[2].value,
collect_number: listOptionData[3].value
}
if(!listOptionData[6].subOption.length) {
this.props.setTransDetailOption([], {})
}
// 测试
this.props.navigation.navigate('TransSearchPage', {
title: '耗材明细 - 转单查询'
title: '耗材明细 - 转单查询',
subTransObj
})
}
// 添加图片 点击
handleAddPicCheck() {
console.warn('添加图片------check')
let { localPhoOption, listOptionData } = this.state
let { props } = this
let that = this
const options = {
title: '选择图片',
cancelButtonTitle: '取消',
takePhotoButtonTitle: '拍照',
chooseFromLibraryButtonTitle: '相册',
cameraType: 'back',
mediaType: 'photo',
videoQuality: 'high',
durationLimit: 10,
maxWidth: 720,
maxHeight: 1280,
aspectX: 2,
aspectY: 1,
quality: 1,
angle: 0,
allowsEditing: false,
noData: false,
storageOptions: {
skipBackup: true,
path: 'WisdomTrans' // 存储本地地址
}
};
ImagePicker.showImagePicker(options, async (res) => {
if (res.didCancel) {
console.log('User cancelled photo picker');
}
else if (res.error) {
console.log('ImagePicker Error: ', res.error);
if(res.error.indexOf('Camera permissions not granted') > -1){
Alert.alert(('提示信息', 'APP需要使用相机,请打开相机权限允许APP使用'), [{
text: '设置',
onPress: () => {
Linking.openURL('app-settings:')
.catch(err => console.log('error', err))
}
},{
text: '取消'
}])
}
if(res.error.indexOf('Photo library permissions not granted') > -1){
Alert.alert('提示信息', 'APP需要使用相册,请打开相册权限允许APP使用', [{
text: '设置',
onPress: () => {
Linking.openURL('app-settings:')
.catch(err => console.log('error', err))
}
},{
text: '取消'
}]);
}
}
else if (res.customButton) {
console.log('User tapped custom button: ', res.customButton);
} else {
that.changeSubLoding(true, '上传中')
let source; //保存选中的图片
if (Platform.OS === 'android') {
source = res.uri;
} else {
source = res.uri.replace('file://','');
}
const formData = new FormData();
let file = { uri: source, type: 'multipart/form-data', name: res.fileName };
formData.append('file',file);
let params = {
access_token: props.token,
formData
}
let {global_domain_config} = props
//上传图片接口
let imgResult = await uploadTransImg(global_domain_config, params);
if(imgResult.error_code == 0) {
that.changeSubLoding(false)
// 提交订单
show('上传成功');
let {url} = imgResult.data
localPhoOption.push(source); // 本地图片地址
listOptionData[13].uploadImgArr.push(url) // 服务器图片地址
that.setState({
localPhoOption,
listOptionData
});
} else if(imgResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
that.changeSubLoding(false)
let error_msg = imgResult.error_msg || imgResult.message
show(error_msg);
}
}
})
}
// 删除单个照片 点击
handleDelPickCheck(item, index) {
let {listOptionData, localPhoOption} = this.state
localPhoOption.splice(index, 1) // 删除本地地址
listOptionData[7].uploadImgArr.splice(index, 1) // 删除服务器地址
this.setState({
listOptionData,
localPhoOption
}, () => {
show('删除成功')
})
}
// 生成订单 点击
handleSubmit() {
async handleSubmit() {
console.warn('生成订单------check')
this.changeCanSub(true)
let { state, props } = this
let that = this
// 对接接口
// 可提交 并且 不处于正在提交中
if(state.canSubFlag && !state.isSubLoding) {
// 先提交录音,再提交接口
if(state.stop) {
// 有录音
let params = {
access_token: props.token,
path: state.audioPath
}
let {global_domain_config} = props
let audioResult = await requestTransAudio(global_domain_config, params);
that.changeSubLoding(true, '上传中')
if(audioResult.error_code == 0) {
// 提交订单
that.setState({
listOptionData: state.listOptionData.map((item, index) => {
if(index == 5) {
item.value = audioResult.data.url
}
return item
})
}, () => {
that.changeSubLoding(false)
that.submitTransOrder()
})
} else if(audioResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
that.changeSubLoding(false)
let error_msg = audioResult.error_msg || audioResult.message
show(error_msg);
}
} else {
that.submitTransOrder()
}
}
}
// 提交订单
submitTransOrder() {
let { state, props } = this
let tempSubOption = state.submitOption
tempSubOption.org_code = state.listOptionData[1].value
tempSubOption.collect_number = state.listOptionData[3].value
tempSubOption.remark = state.listOptionData[4].value
tempSubOption.voice_url = state.listOptionData[5].value
tempSubOption.sur_order_transfer_line = state.listOptionData[6].subOption
tempSubOption.img_url = state.listOptionData[7].uploadImgArr.join(',')
let params = {
access_token: props.token,
data: { ...tempSubOption }
}
props.requestTransSumbit(params)
}
// 判断组织是否为空
judgeOrgIsNull() {
return this.showTipFirstSelect(1)
}
// 判断客户名称是否为空
judgeCustomerIsNull() {
return this.showTipFirstSelect(2)
}
// 判断目标订单信息是否为空
judgeOrderInfoIsNull() {
return this.showTipFirstSelect(3)
}
// 提示请先选择
showTipFirstSelect(ind) {
let { listOptionData } = this.state
let orgVal = listOptionData[ind].value
if(!orgVal) {
show(`请先选择${listOptionData[ind].title}`)
return false
} else {
return true
}
}
// 处理提交后返回的数据
processReturnData() {
// 打开下单成功页面
let { transOrderOption } = this.props
console.log('transOrderOption-----------', transOrderOption)
if(transOrderOption.error_code == 0) {
this.clearAllData() // 清空数据
let { state: { params: { title } } } = this.props.navigation
this.props.navigation.navigate('SubSuccPage', {
title: `${title} - 下单成功`,
orderNumber: transOrderOption.data.sur_order_transfer_number // 订单号
})
}
}
// 清空数据
clearAllData() {
let {props} = this
let {listOptionData, subInitListOption} = this.state
props.setTransInitData() // 清空缓存数据
let imgArr = []
this.setState({
listOptionData: listOptionData.map((item, index) => {
// 转单 和 快速下单一样赋值方式不一样
Object.keys(item).forEach(key => {
item[key] = subInitListOption[index][key]
})
return item
}),
localPhoOption: [...imgArr]
})
}
// 返回备注以上的元素
......@@ -337,7 +1074,7 @@ class EquipConsuPage extends Component {
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'手术医院'}</TitleTextStyle>
<TitleTextStyle>{'客户名称'}</TitleTextStyle>
<ContTextStyle>{listOptionData[2].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
......@@ -351,13 +1088,13 @@ class EquipConsuPage extends Component {
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'目标订单信息'}</TitleTextStyle>
<ContTextStyle>{listOptionData[3].name}</ContTextStyle>
<ContTextStyle style={styles.small_txt}>{listOptionData[3].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
{/* { this.renderPickerModel() } */}
{ this.renderPickerModel() }
</View>
)
......@@ -375,12 +1112,12 @@ class EquipConsuPage extends Component {
// 返回选择器弹窗
renderPickerModel() {
let {
listCurrentOption,
currentItem,
currentTitle,
showTypePop,
} = this.state
console.warn('弹窗-----,', listCurrentOption)
listCurrentOption,
currentItem,
currentTitle,
showTypePop,
} = this.state
// console.warn('弹窗-----,', listCurrentOption)
return (
<SafeAreaView style={styles.item_container}>
<DialogModel
......@@ -564,6 +1301,11 @@ class EquipConsuPage extends Component {
<View style={list_common_item.addpic_inner}>
<Text style={list_common_item.addpic_tit}>添加图片</Text>
<View style={list_common_item.addpic_cont}>
{
state.localPhoOption.length
? state.localPhoOption.map((item, index) => this.renderPicItem(item, index) )
: null
}
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.addpic_img_btn}
......@@ -571,30 +1313,46 @@ class EquipConsuPage extends Component {
>
<Image style={icon_style} source={require('../../images/add_icon_large.png')} />
</TouchableOpacity>
{/* <TouchableOpacity
activeOpacity={.8}
style={list_common_item.addpic_img_btn}>
<Image style={icon_style} source={require('../../images/add_icon_large.png')} />
</TouchableOpacity> */}
</View>
</View>
</CellTextStyle>
)
}
// 返回增加的图片
renderPicItem(item, index) {
return (
<View style={list_common_item.addnew_pic_btn} key={index}>
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.show_pic_btn}
onPress={()=>console.log('放大图片')}
>
<Image style={icon_style} source={{uri: item}} />
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.del_img_box}
onPress={(item, index) => this.handleDelPickCheck(item, index)}
>
<Image style={icon_style} source={require('../../images/close_err_icon.png')} />
</TouchableOpacity>
</View>
)
}
// 返回正在加载中
renderLodingItem() {
// let { lodingTitle, isSubLoding } = this.state
// return(
// <LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
// )
let { lodingTitle, isSubLoding } = this.state
return(
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
)
}
render() {
let {canSubFlag} = this.state
let {navigation} = this.props
let {title} = navigation.state.params
let { canSubFlag } = this.state
let { navigation } = this.props
let { title } = navigation.state.params
return (
<View style={styles.trans_container}>
<StatusBarView
......@@ -629,10 +1387,10 @@ class EquipConsuPage extends Component {
/>
</ScrollView>
</SafeAreaView>
{/* { this.renderLodingItem() } */}
{ this.renderLodingItem() }
</SafeAreaView>
</View>
);
}
......@@ -658,6 +1416,9 @@ const styles = StyleSheet.create({
sub_btn: {},
loding_back: {
backgroundColor: 'rgba(0, 0, 0, 0)'
},
small_txt: {
fontSize: 14
}
})
......@@ -669,7 +1430,7 @@ const mapStateToProps = (state) => {
trans_list_status: state.trans.trans_list_status,
submit_trans_order_status: state.trans.submit_trans_order_status,
transOrderOption: state.trans.transOrderOption,
subTransDetOption: state.trans.subTransDetOption, // 器械消耗对应 subDetOption
subTransDetOption: state.trans.subTransDetOption,
global_domain_config: state.login.global_domain_config
}
}
......@@ -694,7 +1455,10 @@ const mapDispatchToProps = (dispatch) => {
setTransInitData: (params) => {
dispatch(setTransInitData(params))
},
setTransDetailOption: (data, searchData) => {
dispatch(setTransDetailOption(data, searchData))
}
}
}
export default connect(mapStateToProps, mapDispatchToProps)(EquipConsuPage);
\ No newline at end of file
export default connect(mapStateToProps, mapDispatchToProps)(TransOrderPage);
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
SafeAreaView,
Modal,
ScrollView,
TouchableOpacity,
FlatList,
Image
} from 'react-native';
import {
pxHeight,
foundation_color,
promary_color,
second_text_color,
first_text_color,
Width,
pxSize,
safe_view,
list_common_item,
icon_style,
font_family_regular
} from '../../../base/BaseStyle';
class TransDetailsModel extends Component {
constructor(props) {
super(props);
this.state = {
isVisible: this.props.show,
topProcOptionList: [
{
title: '已选'
},
// {
// title: '螺钉盒'
// },
// {
// title: '器械包'
// },
// {
// title: '工具'
// }
],
topActiveIndex: 0,
contOptionData: [ // 底部产品内容
{
"id": "0",
item_name: '人工髋关节假体-JS-HB ||| T',
specification: '3g,Ytg-DG-SZGT',
surgery_collect_number: "SC20200529000010",
serial_number: '2001202001001771',
select: false
},{
"id": "1",
item_name: '人工髋关节假体-JS-HB ||| T2',
specification: '3g,Ytg-DG-SZGT',
surgery_collect_number: "SC20200529000010",
serial_number: '2001202001001772',
select: false
},{
"id": "2",
item_name: '人工髋关节假体-JS-HB ||| T3',
specification: '3g,Ytg-DG-SZGT',
surgery_collect_number: "SC20200529000010",
serial_number: '2001202001001773',
select: true
},{
"id": "3",
item_name: '人工髋关节假体-JS-HB ||| T4',
specification: '3g,Ytg-DG-SZGT',
surgery_collect_number: "SC20200529000010",
serial_number: '2001202001001774',
select: true
},{
"id": "4",
item_name: '人工髋关节假体-JS-HB ||| T5',
specification: '3g,Ytg-DG-SZGT',
surgery_collect_number: "SC20200529000010",
serial_number: '2001202001001775',
select: true
},{
"id": "5",
item_name: '人工髋关节假体-JS-HB ||| T6',
specification: '3g,Ytg-DG-SZGT',
surgery_collect_number: "SC20200529000010",
serial_number: '2001202001001776',
select: true
}
]
}
}
componentWillReceiveProps(nextProps) {
if (this.state.isVisible != nextProps.show) {
this.setState({ isVisible: nextProps.show });
}
if (nextProps.subOption) {
this.setState({ contOptionData: nextProps.subOption });
}
}
// 已选 点击
handleCloseSelected() {
// console.warn('已选:666--model')
let {contOptionData} = this.state
this.props.callback(contOptionData)
this.closeModal()
// this.props.closeSelected(false)
}
// 确定耗材 点击
handleCloseSubmit() {
// console.warn('确定耗材--model')
this.closeModal()
this.props.closeSubmit(false)
}
closeModal() {
this.setState({
isVisible: false
});
this.props.closeModal(false);
}
/**
* 删除当前耗材
* @param {object} item 当前小类数据
* @param {number} index 当前角标
*/
handleDelItemClick(item, index) {
// console.log('-----删除-----', item, index)
let { contOptionData } = this.state
contOptionData.splice(index, 1)
this.setState({
contOptionData
})
}
// 点击顶部菜单
handleTopNav(item, index) {
this.setState({
topActiveIndex: index
})
}
// 返回顶部编辑选项
renderTopProItem() {
let { topProcOptionList, topActiveIndex, contOptionData } = this.state
return (
<View style={styles.top_box}>
<ScrollView
style={styles.top_scroll_cont}
horizontal={true}
showsHorizontalScrollIndicator={false}
>
{
topProcOptionList.map((item, index) =>
<TouchableOpacity
activeOpacity={1}
style={styles.top_touch_cont}
// onPress={() => this.handleTopNav(item, index)}
>
<View style={[
styles.top_inner,
// (index == 1 || index == 2) ? styles.se_thr_width : '',
// index == 3 ? styles.four_width : '',
index == topActiveIndex ? styles.top_inner_act : ''
]}>
<Text style={[styles.top_tit, index == topActiveIndex ? styles.top_tit_act : '']}>
{item.title}({contOptionData.length})
</Text>
</View>
</TouchableOpacity>
)
}
</ScrollView>
</View>
)
}
// 返回底部主要元素
renderContItem() {
return(
<View style={styles.edit_cont}>
<ScrollView
style={styles.edit_scroll_cont}
showsVerticalScrollIndicator={false}
>
<FlatList
style={styles.edit_list}
keyExtractor={item => item.id}
data={this.state.contOptionData}
extraData={this.state}
renderItem={ ({item, index}) => this.renderContColumnItem(item, index) }
/>
</ScrollView>
</View>
)
}
// 返回每一列元素
renderContColumnItem(item, index) {
return (
<TouchableOpacity
activeOpacity={1}
style={styles.column_container}>
<View style={styles.ri_inner}>
<View style={styles.ri_text_box}>
<Text style={styles.ri_te_tit}>
{ item.item_name } - {item.specification}
</Text>
<Text style={[styles.ri_te_ot, styles.thr_ot]}>
{item.surgery_collect_number}{item.serial_number}
</Text>
</View>
<View style={styles.ri_num_box}>
<TouchableOpacity
activeOpacity={.9}
style={styles.btn_inner}
onPress={() => this.handleDelItemClick(item, index)}
>
<View style={[styles.thr_num_btn, styles.thr_btn_left]}>
<Image source={require('../../../images/close_light_icon.png')} style={icon_style}></Image>
</View>
</TouchableOpacity>
</View>
</View>
</TouchableOpacity>
)
}
// 返回底部按钮
renderFooterBtnItem() {
let { contOptionData } = this.state
return (
<View style={list_common_item.sub_box}>
<View style={list_common_item.sub_two_btn}>
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.lef_btn}
onPress={() => this.handleCloseSelected()}
>
<Text style={list_common_item.lef_tip}>已选:{contOptionData.length}</Text>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.rig_btn}
onPress={() => this.handleCloseSubmit()}
>
<Text style={list_common_item.rig_tip}>{'确定'}</Text>
</TouchableOpacity>
</View>
</View>
)
}
// 返回主要元素
renderDialog() {
return (
<View style={styles.opt_area}>
<View style={styles.modal_style}>
<View style={styles.scro_box}>
{this.renderTopProItem()}
{this.renderContItem()}
{/* {this.renderFooterBtnItem()} */}
</View>
{this.renderFooterBtnItem()}
</View>
</View>
)
}
render() {
return (
<View style={styles.dia_container}>
<Modal
transparent={true}
visible={this.state.isVisible}
animationType={'fade'}
onRequestClose={() => this.closeModal()}>
<SafeAreaView style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1}
// onPress={() => this.closeModal()}
>
{this.renderDialog()}
</TouchableOpacity>
</SafeAreaView>
</Modal>
</View>
);
}
}
const styles = StyleSheet.create({
dia_container: {
flex: 1,
},
container: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)'
},
opt_area: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
position: 'relative'
},
modal_style: {
position: "absolute",
left: 0,
bottom: 0,
width: Width(),
flex: 1,
flexDirection: "column",
backgroundColor: '#ffffff',
borderTopLeftRadius: 12,
borderTopRightRadius: 12,
height: pxHeight(580)
},
// item: {
// width: Width(),
// height: 40,
// paddingLeft: 20,
// paddingRight: 20,
// alignItems: 'center'
// },
// itemText: {
// fontSize: 16,
// color: third_text_color
// },
// curr_item: {
// color: first_text_color,
// fontWeight: 'bold'
// },
scro_box: {
flex: 1
},
top_box: {
width: Width(),
paddingHorizontal: 20
// backgroundColor: foundation_color,
},
top_scroll_cont: {
paddingBottom: 4,
borderBottomColor: '#DEDBDB',
borderBottomWidth: 1
},
top_touch_cont: {},
top_inner: {
justifyContent: 'center',
alignItems: 'center',
marginRight: 14,
borderBottomWidth: 2,
borderBottomColor: foundation_color,
minWidth: 50,
},
se_thr_width: {
minWidth: 42
},
four_width: {
minWidth: 28
},
top_inner_act: {
borderBottomWidth: 2,
borderBottomColor: promary_color
},
top_tit: {
paddingTop: 16,
paddingBottom: 12,
color: second_text_color,
// fontSize: third_text_size
fontSize: 14
},
top_tit_act: {
color: first_text_color,
fontWeight: 'bold'
},
edit_cont: {
// height: pxHeight(430)
flex: 1
},
edit_scroll_cont: {
height: '100%'
},
edit_list: {},
column_container: {
paddingHorizontal: 14
},
ri_inner: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
paddingHorizontal: 8,
backgroundColor: foundation_color,
},
ri_text_box: {
flex: 1,
borderBottomWidth: 1,
borderBottomColor: '#EAEAEA',
paddingVertical: 14,
},
ri_te_tit: {
fontSize: 14,
color: first_text_color,
fontFamily: font_family_regular
},
thr_ot: {},
ri_te_ot: {
fontSize: 14,
color: '#C5C6C5',
fontFamily: font_family_regular
},
ri_num_box: {
flexDirection: 'row',
alignItems: 'center'
},
thr_num_btn: {
width: pxSize(22),
height: pxSize(22)
},
thr_btn_left: {
marginRight: 4,
marginLeft: 14
},
btn_inner: {},
})
export default TransDetailsModel;
\ No newline at end of file
......@@ -5,7 +5,8 @@ import {
SafeAreaView,
TouchableOpacity,
Text,
Image
Image,
FlatList
} from 'react-native';
import {
home_background_color,
......@@ -20,41 +21,601 @@ import {
second_text_size,
font_family_regular,
first_text_color,
promary_text_color
promary_text_color,
list_common_item,
third_text_color
} from '../../../base/BaseStyle';
import StatusBarView from '../../common/StatusBarView';
import {
FooterBtnStyle,
CellTextStyle,
TitleTextStyle,
ContInputTextStyle
ContInputTextStyle,
ContTextStyle,
ImageTextStyle
} from '../../common/CellTextStyle';
import { ScrollView } from 'react-native-gesture-handler';
import HeadBackItem from '../../common/HeadBackItem';
import LodingModel from '../../common/LodingModel';
import { connect } from 'react-redux';
import { show} from '../../../utils/Utils';
import {
requestTransDetails,
requestSubTransOrganizations,
requestSubSourBorOrdNum,
setTransDetailOption
} from '../../../action/TransAction';
import TransDetailsModel from './TransDetailsModel';
import { exitLoginStatus } from '../../../action/LoginAction';
import DialogModel from '../../common/DialogModel';
import DateModel from '../../common/DateModel';
import moment from 'moment';
class TransSearchPage extends Component {
constructor(props) {
super(props);
this.state = { }
this.state = {
serchForm: {
seller_name: '', // 销售员
org_code: '', // 组织
surgery_collect_number: '', // 来源借货订单号
serial_number: '', // 序列号
surgery_date_from: '', // 手术时间开始
surgery_date_to: '', // 手术时间结束
},
listOptionData: [
{
"id": "0",
title: '来源借货订单号',
name: '',
value: ''
},
{
"id": "1",
title: '序列号',
value: ''
},
{
"id": "2",
title: '手术时间',
name: '开始时间',
value: '',
dateValue: new Date()
},
{
"id": "3",
title: '手术时间',
name: '结束时间',
value: '',
dateValue: new Date()
}
],
conDetaOption:[
// {
// "id": "0",
// item_name: '人工髋关节假体-JS-HB ||| T',
// specification: '3g,Ytg-DG-SZGT',
// surgery_collect_number: "SC20200529000010",
// serial_number: '2001202001001771',
// select: false
// },{
// "id": "1",
// item_name: '人工髋关节假体-JS-HB ||| T2',
// specification: '3g,Ytg-DG-SZGT',
// surgery_collect_number: "SC20200529000010",
// serial_number: '2001202001001772',
// select: false
// },{
// "id": "2",
// item_name: '人工髋关节假体-JS-HB ||| T3',
// specification: '3g,Ytg-DG-SZGT',
// surgery_collect_number: "SC20200529000010",
// serial_number: '2001202001001773',
// select: true
// },{
// "id": "3",
// item_name: '人工髋关节假体-JS-HB ||| T4',
// specification: '3g,Ytg-DG-SZGT',
// surgery_collect_number: "SC20200529000010",
// serial_number: '2001202001001774',
// select: true
// },{
// "id": "4",
// item_name: '人工髋关节假体-JS-HB ||| T5',
// specification: '3g,Ytg-DG-SZGT',
// surgery_collect_number: "SC20200529000010",
// serial_number: '2001202001001775',
// select: true
// },{
// "id": "5",
// item_name: '人工髋关节假体-JS-HB ||| T6',
// specification: '3g,Ytg-DG-SZGT',
// surgery_collect_number: "SC20200529000010",
// serial_number: '2001202001001776',
// select: true
// },{
// "id": "6",
// item_name: '人工髋关节假体-JS-HB ||| T',
// specification: '3g,Ytg-DG-SZGT',
// surgery_collect_number: "SC20200529000010",
// serial_number: '2001202001001777',
// select: false
// },
],
allConOption: [], // 所有数据(未筛选过的)
selectShowPopup: false, // 共计已选弹窗
localSelectOption: [], // 已选数据
isSubLoding: false, // true 加载中弹窗
lodingTitle: '加载中',
isAllSelect: false, // 是否全选
currentItem: {
name: '请选择',
value: '-1'
},
currentTitle: '组织', // 当前点击项
showTypePop: false, // 选择器弹窗
listCurrentOption: [ // 当前选择器数据
// {
// name: '男cs',
// value: 'boy'
// },
// {
// name: '女cs',
// value: 'girl'
// },
// {
// name: '其他',
// value: 'other'
// }
],
dateModelPop: false, // 日期选择器
currentDateVal: new Date() , // 当前日期值
}
}
componentDidMount() {
this.getCurExitData()
}
// 获取已存在的数据
getCurExitData() {
let { subTransSearchForm } = this.props
this.handleSearchData(subTransSearchForm)
}
// 选择器弹窗回调函数
handleCallBack(item, itemTitle) {
// console.warn(item, 'item--选择器弹窗回调函数----')
// console.warn('item-itemTitle-----',itemTitle)
let { listOptionData} = this.state
let self = this
self.setState({
currentItem: item,
})
self.setState({
listOptionData: listOptionData.map((chItem) => {
if(chItem.title === itemTitle) {
chItem.name = item.name
chItem.value = item.value
}
return chItem
})
})
}
// 关闭弹窗
handleCloseModal(show) {
this.setState({
showTypePop: show
})
}
// 日期选择器回调
dateModalCallback(date) {
// console.warn('date------', date)
let { currentTitle, listOptionData } = this.state
if(currentTitle.includes('start')) {
listOptionData[2].name = date
listOptionData[2].value = date
listOptionData[2].dateValue = new Date(date)
} else if(currentTitle.includes('end')) {
listOptionData[3].name = date
listOptionData[3].value = date
listOptionData[3].dateValue = new Date(date)
}
this.setState({
listOptionData
})
}
// 关闭 日期选择器弹窗
closeDateModal(show) {
this.setState({
dateModelPop: show
})
}
// 修改选择器为属性 name 和 value
changeNameAndValue(data, nameType, valueType) {
let result = []
data.forEach(item => {
let obj = {}
obj.name = item[nameType],
obj.value = item[valueType]
result.push(obj)
})
return result
}
// 来源借货订单号 点击
handleSourNumCheck() {
let { state, props } = this
let { subTransObj } = props.navigation.state.params
let that = this
this.setState({
currentTitle: '来源借货订单号',
currentItem: {
name: state.listOptionData[0].name,
value: state.listOptionData[0].value
}
}, async () => {
let params = {
access_token: props.token,
org_code: subTransObj.org_code,
seller_code: props.userInfo.user_name,
customer_code: '',
// customer_code: subTransObj.customer_code,
// collect_header_status: 'COLLECTING_WAITING_CONFIRM,CONFIRM_COLLECT,COLLECTED_WAITING_CONFIRMED,APPROVED,COLLECTED'
}
let { global_domain_config } = that.props
that.changeLodingFlag(true)
console.log('params------', params)
let sourResult = await requestSubSourBorOrdNum(global_domain_config, params)
console.log('sourResult---', sourResult)
if(sourResult.error_code === 0) {
that.changeLodingFlag(false)
let { data: { surgery_collect_headers } } = sourResult
surgery_collect_headers = surgery_collect_headers.filter(fiItem => {
return fiItem.collect_number != subTransObj.collect_number
})
if(surgery_collect_headers.length == 0) {
show('当前来源借货订单为空')
return
}
let resultArr = []
surgery_collect_headers.forEach(item => {
let obj = {}
let collect_number = item.collect_number ? item.collect_number : '空'
let surgery_name = item.surgery_name ? item.surgery_name : '空'
let create_time = item.create_time ? moment(item.create_time).format("YYYY-MM-DD") : '空'
let tempName = `${collect_number}-${surgery_name}-${create_time}`
obj.name = tempName,
obj.value = item.collect_number
resultArr.push(obj)
})
let tempOption = [...resultArr]
that.setState({
listCurrentOption: [...tempOption]
}, () => {
// 解决 IOS 弹窗显示问题
setTimeout(() => {
that.setState({
showTypePop: true
})
}, 500)
})
} else if(detailResult.error_code === 41006) {
that.changeLodingFlag(false)
show('登录过期,请重新登录')
that.props.exitLoginStatus()
} else {
that.changeLodingFlag(false)
let error_msg = detailResult.error_msg || detailResult.message
show(error_msg)
}
})
}
// 序列号 输入
handleSerialNumInput(text) {
console.log('序列号------input:', text)
this.changeInputValue('序列号', text)
}
changeInputValue(curTitle, text) {
let { listOptionData } = this.state
let that = this
that.setState({
listOptionData: listOptionData.map((item) => {
if(item.title === curTitle) {
item.value = text
}
return item
})
})
}
// 手术时间
handleSurDateCheck(typeName) {
console.log('筛选 - 手术时间---', typeName)
let { listOptionData } = this.state
let tempCurTit = '手术时间'
let tempCurDate = new Date()
if(typeName == 'start') {
tempCurDate = listOptionData[2].dateValue
} else if(typeName == 'end') {
tempCurDate = listOptionData[3].dateValue
}
this.setState({
currentTitle: tempCurTit+typeName,
currentDateVal: tempCurDate,
dateModelPop: true
})
}
// 查询
async handleSearchData(curForm) {
let { listOptionData } = this.state;
let seaFlag = false
let that = this
for(let item of listOptionData) {
if(item.value) {
seaFlag = true
break
}
}
let curLen = curForm && Object.keys(curForm).length
console.log('curLen----', curLen)
if(curLen) {
// 已存在明细数据
seaFlag = true
}
if(seaFlag) {
// 调用接口
let { subTransObj } = that.props.navigation.state.params
let { token, userInfo } = that.props
let { listOptionData } = that.state
let seaForm = {
surgery_collect_number: listOptionData[0].value,
serial_number: listOptionData[1].value,
surgery_date_from: listOptionData[2].value,
surgery_date_to: listOptionData[3].value
}
if(curLen) {
seaForm = {...curForm}
}
let params = {
access_token: token,
seller_name: subTransObj.seller_name,
org_code: subTransObj.org_code,
item_name: '钉', // 测试
...seaForm
}
console.log('查询===========》', params)
this.changeLodingFlag(true)
let { global_domain_config } = that.props
let detailResult = await requestTransDetails(global_domain_config, params)
console.log('detailResult-----',detailResult)
if(detailResult.error_code === 0) {
let { data: { sur_transfer_lines }} = detailResult
if(sur_transfer_lines.length == 0) {
show('当前明细数据为空,请重现选择订单')
} else {
let {subTransDetOption} = this.props // 【转单】主页面已存在的明细
console.log('subTransDetOption-----', subTransDetOption)
subTransDetOption.length && subTransDetOption.forEach((item, index) => {
sur_transfer_lines.length && sur_transfer_lines.forEach((chItem, chInd) => {
if(chItem.serial_number == item.serial_number
&& chItem.surgery_collect_number == item.surgery_collect_number ) {
// chItem.sale_price = item.sale_price
// chItem.local_add_price = item.local_add_price
chItem.select = true
}
})
})
}
this.setState({
isSubLoding: false,
conDetaOption: sur_transfer_lines,
allConOption: sur_transfer_lines
})
this.changeIsSelected()
} else if(detailResult.error_code === 41006) {
this.changeLodingFlag(false)
show('登录过期,请重新登录');
this.props.exitLoginStatus()
} else {
this.changeLodingFlag(false)
let error_msg = detailResult.error_msg || detailResult.message
show(error_msg);
}
} else {
show('请至少输入一个查询条件')
}
}
// 修改加载中
changeLodingFlag(show) {
this.setState({
isSubLoding: show
})
}
// 取消选择
handleCelSelCheck(item, index) {
// console.log('取消===cel:', item, index)
this.changeIsSelected(index, false)
}
// 确定选择
handleSubSelectedCheck(item, index) {
// console.log('确定===sub:', item, index)
this.changeIsSelected(index, true)
}
// 修改 当前已选择
changeIsSelected(ind, selFlag) {
let { conDetaOption } = this.state
let { subTransDetOption } = this.props
if(ind != undefined) {
conDetaOption[ind].select = selFlag
}
let that = this
this.setState({
conDetaOption
},() => {
// console.log('conDetaOption---修改-', conDetaOption)
let tempArr = []
conDetaOption.forEach(item => {
if(item.select) {
tempArr.push(item)
}
})
// let curOthOption = subTransDetOption.filter(fiItem => {
// if(fiItem.serial_number) {
// }
// })
// tempArr = tempArr.concat(subTransDetOption)
tempArr = [...tempArr, ...subTransDetOption]
tempArr = that.dedupQuoteDetailArr(tempArr, 'serial_number', 'surgery_collect_number')
that.setState({
localSelectOption: tempArr
})
})
}
// 去重耗材明细 根据两个属性
dedupQuoteDetailArr(arr, typeName1, typeName2){
let result = [], tmp = {}
if( arr.length ) {
result = arr.reduce(function(init, item) {
if(!tmp[item[typeName1]+item[typeName2]]) {
tmp[item[typeName1]+item[typeName2]] = true
init.push(item)
}
return init
}, [])
}
return result;
}
// 已选回调函数
detailsCallbak(subOpt) {
console.log('----回调:',subOpt)
let tempOption = [...this.state.conDetaOption]
// 获取当前已选值
tempOption = tempOption.map(item => {
// 全部初始化
item.select = false
if(subOpt.length) {
subOpt.forEach(subIt => {
// 序列号唯一:serial_number ??? 哪一个唯一!!!!
if(subIt.serial_number == item.serial_number) {
item.select = true
}
})
}
return item
})
this.setState({
conDetaOption: tempOption
})
}
// 打开/关闭 共计已选弹窗
handleCloseSelectModal(show) {
this.setState({
selectShowPopup: show
})
}
// 点击 已选
handleSubSelected(show) {
// console.warn('已选:666!!')
this.handleCloseSelectModal(true)
}
// 点击 确定
handleSubmit() {
// console.warn('确定', this.props.navigation.navigate)
this.handleCloseSelectModal(false)
let { localSelectOption, listOptionData } = this.state
if(!localSelectOption.length) {
show('请选择耗材')
return
}
let searchForm = {
surgery_collect_number: listOptionData[0].value,
serial_number: listOptionData[1].value,
surgery_date_from: listOptionData[2].value,
surgery_date_to: listOptionData[3].value
}
this.props.setTransDetailOption(localSelectOption, searchForm)
this.props.navigation.navigate('TransOrderPage', '转单申请')
}
// 全选 / 取消全选 默认取消全选
handleSelAllOrClear(flag) {
let { conDetaOption } = this.state;
let that = this;
conDetaOption = conDetaOption.map(item => {
item.select = flag;
return item;
})
that.setState({
isAllSelect: flag,
conDetaOption
}, () => {
that.changeIsSelected()
});
}
// 返回顶部查询
renderTopProItem() {
let { serchForm, listOptionData } = this.state
return(
<View style={styles.list_cont}>
<Text style={styles.search_top_tip}>查询条件,至少输入一个条件</Text>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleSourNumCheck()}
>
<CellTextStyle style={styles.cell_box}>
<TitleTextStyle>{'来源借货订单号'}</TitleTextStyle>
<ContTextStyle style={styles.sour_txt}>
{listOptionData[0].name}
</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={1}
>
<CellTextStyle style={styles.cell_box}>
<TitleTextStyle style={styles.cell_title}>{'序列号'}</TitleTextStyle>
<ContInputTextStyle
style={styles.cell_input}
placeholder={'不支持模糊查询'}
defaultValue={''}
onChangeText={(text) => console.log('序列号=====', text)}
placeholder={'支持模糊查询'}
keyboardType={'numeric'}
defaultValue={listOptionData[1].value}
onChangeText={(text) => this.handleSerialNumInput(text)}
/>
</CellTextStyle>
</TouchableOpacity>
</View>
......@@ -63,13 +624,52 @@ class TransSearchPage extends Component {
activeOpacity={1}
>
<CellTextStyle style={styles.cell_box}>
<TitleTextStyle style={styles.cell_title}>{'来源借货订单号'}</TitleTextStyle>
<ContInputTextStyle
style={styles.cell_input}
placeholder={'不支持模糊查询'}
defaultValue={''}
onChangeText={(text) => console.log('来源借货订单号=====', text)}
/>
<TitleTextStyle>{'手术时间'}</TitleTextStyle>
<View style={styles.qui_cell_rig_date}>
<TouchableOpacity
activeOpacity={.8}
style={styles.qui_date_box}
onPress={() => this.handleSurDateCheck('start') }
>
<Text style={styles.qui_date_inp}>{listOptionData[2].name}</Text>
<View style={styles.date_icon_box}>
<Image source={require('../../../images/date_icon.png')} style={icon_style} />
</View>
</TouchableOpacity>
<Text style={styles.qui_date_line}></Text>
<TouchableOpacity
activeOpacity={.8}
style={styles.qui_date_box}
onPress={() => this.handleSurDateCheck('end') }
>
<Text style={styles.qui_date_inp}>{listOptionData[3].name}</Text>
<View style={styles.date_icon_box}>
<Image source={require('../../../images/date_icon.png')} style={icon_style} />
</View>
</TouchableOpacity>
</View>
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={[styles.item_container, styles.item_btn_cont]}>
<TouchableOpacity
activeOpacity={.8}
style={styles.search_btn_box}
onPress={() => this.handleSearchData()}
>
<Text style={styles.search_btn}>查询</Text>
</TouchableOpacity>
</View>
{/* <View style={styles.item_container}>
<TouchableOpacity
activeOpacity={1}
>
<CellTextStyle style={styles.cell_box}>
<TitleTextStyle>{'销售员'}</TitleTextStyle>
<ContTextStyle>
{listOptionData[0].name}
</ContTextStyle>
</CellTextStyle>
</TouchableOpacity>
</View>
......@@ -78,81 +678,155 @@ class TransSearchPage extends Component {
activeOpacity={1}
>
<CellTextStyle style={styles.cell_box}>
<TitleTextStyle style={styles.cell_title}>{'物料名称'}</TitleTextStyle>
<ContInputTextStyle
style={styles.cell_input}
placeholder={'不支持模糊查询'}
defaultValue={''}
onChangeText={(text) => console.log('物料名称=====', text)}
/>
<TitleTextStyle>{'组织'}</TitleTextStyle>
<ContTextStyle>
{listOptionData[1].name}
</ContTextStyle>
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleStatusCheck()}
>
<CellTextStyle style={styles.cell_box}>
<TitleTextStyle style={styles.cell_title}>{'状态'}</TitleTextStyle>
<ContTextStyle>
{listOptionData[2].name}
</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={1}
>
<CellTextStyle style={styles.cell_box}>
<TitleTextStyle style={styles.cell_title}>{'手术名称'}</TitleTextStyle>
<TitleTextStyle style={styles.cell_title}>{'申请单号'}</TitleTextStyle>
<ContInputTextStyle
style={styles.cell_input}
placeholder={'支持模糊查询'}
defaultValue={''}
onChangeText={(text) => console.log('手术名称=====', text)}
placeholder={'支持模糊查询'}
defaultValue={listOptionData[3].value}
onChangeText={(text) => this.handleRequiNumInput(text)}
/>
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={[styles.item_container, styles.item_btn_cont]}>
</View> */}
{/* <View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
style={styles.search_btn_box}
onPress={() => console.log('查询')}
activeOpacity={1}
>
<Text style={styles.search_btn}>查询</Text>
<CellTextStyle style={styles.cell_box}>
<TitleTextStyle style={styles.cell_title}>{'来源借货订单号'}</TitleTextStyle>
<ContInputTextStyle
style={styles.cell_input}
placeholder={'支持模糊查询'}
defaultValue={listOptionData[4].value}
onChangeText={(text) => this.handleTarBorOrdInput(text)}
/>
</CellTextStyle>
</TouchableOpacity>
</View>
</View> */}
{ this.renderDateModel() }
{ this.renderPickerModel() }
</View>
)
}
// 返回右侧箭头
renderRightArrowItem() {
return (
<ImageTextStyle>
<Image source={require('../../../images/arr_rig.png')} style={icon_style}/>
</ImageTextStyle>
)
}
// 返回选择器
renderPickerModel() {
let {
listCurrentOption,
currentItem,
currentTitle,
showTypePop,
} = this.state
return (
<SafeAreaView style={styles.item_container}>
<DialogModel
entityList={listCurrentOption}
callback={(item, itemTitle) => this.handleCallBack(item, itemTitle)}
show={showTypePop}
itemValue={currentItem.value}
itemTitle={currentTitle}
closeModal={(show) => this.handleCloseModal(show)}
/>
</SafeAreaView>
)
}
// 返回日期选择器
renderDateModel() {
let { currentDateVal, dateModelPop } = this.state
// console.warn('弹窗--日期---,', currentDateVal)
return (
<DateModel
date={currentDateVal}
closeModal={(show) => this.closeDateModal(show)}
show={dateModelPop}
callback={(date) => this.dateModalCallback(date)}
date_mode={'date'}
/>
)
}
// 返回主要查询内容
renderContItem() {
let { conDetaOption, isAllSelect } = this.state
return(
<View style={styles.search_cont}>
<View style={styles.search_cont_inner}>
<Text style={styles.cont_tit}>
当前查询(5)数据
当前查询({conDetaOption.length})数据
</Text>
<TouchableOpacity
activeOpacity={.8}
style={styles.tit_btn_box}
onPress={() => console.log('全选,取消全选')}
>
<Text style={styles.tit_btn}>全选</Text>
</TouchableOpacity>
</View>
<View style={styles.cont_list}>
<View style={styles.cont_list_item}>
<View style={styles.list_left}>
{
!isAllSelect ?
<TouchableOpacity
activeOpacity={.8}
style={styles.btn_single_box}
onPress={() => console.log('单选!!!')}
style={styles.tit_btn_box}
onPress={() => this.handleSelAllOrClear(true)}
>
<Image style={icon_style} source={require('../../../images/add_icon.png')}/>
<Text style={styles.tit_btn}>全选</Text>
</TouchableOpacity>
</View>
<View style={styles.list_right}>
<Text style={styles.right_top_tit}>
人工髋关节假体-JS-HB ||| T人工髋关节假体-JS
</Text>
<Text style={styles.right_tip}>
SC20200506000006, SC20200506000006
</Text>
</View>
</View>
<View style={styles.cont_list_item}>
: <TouchableOpacity
activeOpacity={.8}
style={[styles.tit_btn_box, styles.cle_btn_box]}
onPress={() => this.handleSelAllOrClear(false)}
>
<Text style={[styles.tit_btn, styles.cle_btn]}>取消全选</Text>
</TouchableOpacity>
}
</View>
<View style={styles.cont_list}>
<FlatList
style={styles.cons_cont}
keyExtractor={item => item.id}
data={this.state.conDetaOption}
extraData={this.state}
renderItem={ ({item, index}) => this.renderSubListItem(item, index) }
/>
{/* <View style={styles.cont_list_item}>
<View style={styles.list_left}>
<TouchableOpacity
activeOpacity={.8}
......@@ -190,30 +864,88 @@ class TransSearchPage extends Component {
</Text>
</View>
</View>
<View style={styles.cont_list_item}>
<View style={styles.list_left}>
*/}
</View>
</View>
)
}
// 返回每一列数据
renderSubListItem(item, index) {
return(
<View style={styles.cons_sub_list}>
<View style={styles.sub_list_lef}>
{
item.select ?
<TouchableOpacity
activeOpacity={.8}
style={styles.btn_single_box}
onPress={() => console.log('单选!!!')}
>
<Image style={icon_style} source={require('../../../images/add_icon.png')}/>
style={styles.sub_icon_box}
onPress={() => this.handleCelSelCheck(item, index)}>
<Image style={icon_style} source={require('../../../images/radio_yes.png')} />
</TouchableOpacity>
</View>
<View style={styles.list_right}>
<Text style={styles.right_top_tit}>
人工髋关节假体-JS-HB ||| T人工髋关节假体-JS
</Text>
<Text style={styles.right_tip}>
SC20200506000006, SC20200506000006
</Text>
</View>
</View>
: <TouchableOpacity
activeOpacity={.8}
style={styles.sub_icon_box}
onPress={() => this.handleSubSelectedCheck(item, index)}>
<Image style={icon_style} source={require('../../../images/radio_no.png')} />
</TouchableOpacity>
}
</View>
<View style={styles.sub_list_rig}>
<Text style={styles.rig_tit}>
{item.item_name}
</Text>
<Text style={styles.rig_ser}>
{item.surgery_collect_number}{item.serial_number}
</Text>
</View>
</View>
)
}
// 返回底部按钮
renderFooterBtnItem() {
let { selectShowPopup, localSelectOption } = this.state
return (
<View style={list_common_item.sub_box}>
<View style={list_common_item.sub_two_btn}>
<TouchableOpacity
activeOpacity={.8}
style={[list_common_item.lef_btn, styles.fot_btn_lef]}
onPress={() => this.handleSubSelected(selectShowPopup)}
>
<Text style={list_common_item.lef_tip}>已选:{localSelectOption.length}</Text>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
style={[list_common_item.rig_btn, styles.fot_btn_rig]}
onPress={() => this.handleSubmit()}
>
<Text style={list_common_item.rig_tip}>{'确定'}</Text>
</TouchableOpacity>
</View>
<TransDetailsModel
show={ selectShowPopup }
closeModal={(show) => this.handleCloseSelectModal(show)}
closeSelected={(show) => this.handleSubSelected(show)}
closeSubmit={() => this.handleSubmit()}
subOption={ localSelectOption }
callback={(subOpt) => this.detailsCallbak(subOpt)}
/>
</View>
)
}
// 返回正在加载中
renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state
return(
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
)
}
render() {
let {navigation} = this.props
let {title} = navigation.state.params
......@@ -230,15 +962,21 @@ class TransSearchPage extends Component {
<ScrollView style={styles.search_scroll}>
{this.renderTopProItem()}
{this.renderContItem()}
{this.renderLodingItem()}
</ScrollView>
</View>
<FooterBtnStyle
{/* <FooterBtnStyle
style={styles.sub_btn_pro}
activeOpacity={.8}
title={'确定'}
textStyle= {styles.sub_btn}
onPress={() => console.warn('确定')}
/>
/> */}
{this.renderFooterBtnItem()}
</SafeAreaView>
</View>
);
......@@ -256,7 +994,7 @@ const styles = StyleSheet.create({
flex: 1
},
search_scroll: {
paddingTop: 16,
paddingTop: 20,
paddingHorizontal: 16
},
list_cont: {
......@@ -279,11 +1017,46 @@ const styles = StyleSheet.create({
height: 46,
marginBottom: 10
},
sour_txt: {
fontSize: 14
},
cell_title: {
width: 120
width: 52
},
qui_cell_rig_date: {
height: pxHeight(52),
flex: 1,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between'
},
qui_date_box: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
width: '48%',
backgroundColor: foundation_color,
paddingHorizontal: 10
},
qui_date_line: {
color: third_text_color,
fontSize: 14
},
qui_date_inp: {
lineHeight: 38,
color: third_text_color,
fontSize: 14,
fontFamily: font_family_regular
},
date_icon_box: {
width: pxSize(14),
height: pxSize(14)
},
cell_input: {
textAlign: 'left'
textAlign: 'left',
paddingRight: 0,
fontSize: 14
},
search_btn_box: {
backgroundColor: promary_color,
......@@ -324,7 +1097,16 @@ const styles = StyleSheet.create({
textAlign: 'center',
fontSize: 14
},
cont_list:{},
cle_btn_box: {
width: 80,
backgroundColor: '#666'
},
cle_btn: {
// color: ''
},
cont_list:{
paddingVertical: 16
},
cont_list_item:{
flexDirection: 'row',
justifyContent: 'space-between',
......@@ -341,11 +1123,59 @@ const styles = StyleSheet.create({
},
right_top_tit:{},
right_tip:{},
cons_cont: {},
cons_sub_list: {
// paddingHorizontal: 0,
paddingVertical: 12,
flexDirection: 'row',
alignItems: 'center'
},
sub_list_lef: {
paddingRight: 10
},
sub_icon_box: {
width: pxSize(20),
height: pxSize(20)
},
sub_list_rig: {
flex: 1
},
rig_tit: {
fontSize: second_text_size,
color: promary_text_color,
fontFamily: font_family_regular
},
rig_ser: {
fontSize: 14,
color: '#ADADAD',
fontFamily: font_family_regular
},
sub_btn_pro: {
backgroundColor: promary_color
},
})
const mapStateToProps = (state) => {
return {
userInfo: state.login.userInfo,
token: state.login.token,
loginState: state.login.loginState,
subTransDetOption: state.trans.subTransDetOption,
subTransSearchForm: state.trans.subTransSearchForm,
global_domain_config: state.login.global_domain_config
}
}
const mapDispatchToProps = (dispatch) => {
return {
exitLoginStatus: () => {
dispatch(exitLoginStatus())
},
setTransDetailOption: (data, searchData) => {
dispatch(setTransDetailOption(data, searchData))
}
}
}
export default TransSearchPage;
\ No newline at end of file
export default connect(mapStateToProps, mapDispatchToProps)(TransSearchPage);
\ No newline at end of file
......@@ -8,7 +8,8 @@ import {
TRANS_SUBMIT_SUCCESS,
TRANS_SUBMIT_FAILURE,
TRANS_INIT_DATA,
GET_TRANS_DETAIL_OPTION
SET_TRANS_DETAIL_OPTION,
// SET_TRANS_SEARCH_FORM
} from '../../base/ActionTypes';
// 转单状态
......@@ -17,6 +18,7 @@ const defaultState = {
submit_trans_order_status: TRANS_SUBMIT_NO, // 提交订单状态
transOrderOption: {}, // 当前选择器临时存储数据
subTransDetOption: [], // 选择的消耗明细数据
subTransSearchForm: {}, // 消耗明细筛选条件
}
export default trans = (state = defaultState, action) => {
......@@ -54,12 +56,18 @@ export default trans = (state = defaultState, action) => {
trans_list_status: TRANS_ORDER_LIST_NO,
submit_trans_order_status: TRANS_SUBMIT_NO,
transOrderOption: {},
subTransDetOption: []
subTransDetOption: [],
subTransSearchForm: {}
})
case GET_TRANS_DETAIL_OPTION:
case SET_TRANS_DETAIL_OPTION:
return Object.assign({}, state, {
subTransDetOption: action.rawData
subTransDetOption: action.rawData,
subTransSearchForm: action.searchForm
})
// case SET_TRANS_SEARCH_FORM:
// return Object.assign({}, state, {
// subTransSearchForm: action.rawData
// })
default:
return state;
}
......
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