Commit 7dda0ec2 by Denglingling

调整快速下单 - 手术模板(此功能待定)

parent 622e3bc6
......@@ -15,6 +15,8 @@ import ConsumDetailsPage from './containers/equipConsu//module/ConsumDetailsPage
import FillUnitPricePage from './containers/equipConsu/module/FillUnitPricePage';
import ShowDetailPage from './containers/equipConsu/module/ShowDetailPage';
import QuickOrderPage from './containers/quickOrder/QuickOrderPage';
import surgeryTemplatePage from './containers/quickOrder/module/surgeryTemplatePage';
import surgeryDetailsPage from './containers/quickOrder/module/surgeryDetailsPage';
import TransOrderPage from './containers/transOrder/TransOrderPage';
import DeviceInfoPage from './containers/deviceInfo/DeviceInfoPage';
import TransSearchPage from './containers/transOrder/module/TransSearchPage';
......@@ -35,6 +37,8 @@ const Router = createAppContainer(createStackNavigator({
FillUnitPricePage: {screen: FillUnitPricePage},
ShowDetailPage: {screen: ShowDetailPage},
QuickOrderPage: {screen: QuickOrderPage},
surgeryTemplatePage: {screen: surgeryTemplatePage},
surgeryDetailsPage: {screen: surgeryDetailsPage},
TransOrderPage: {screen: TransOrderPage},
DeviceInfoPage: {screen: DeviceInfoPage},
TransSearchPage: {screen: TransSearchPage},
......
......@@ -385,6 +385,19 @@ export const list_common_item = {
fontSize: 16,
fontFamily: font_family_medium
},
def_btn: {
backgroundColor: promary_color,
width: '100%',
borderRadius: 10,
height: 50
},
def_tip: {
color: title_text_color,
lineHeight: 48,
textAlign: 'center',
fontSize: 16,
fontFamily: font_family_medium
},
// 二级页面顶部搜索
ser_cont: {
width: Width(),
......
......@@ -24,7 +24,7 @@ class TabBottomItem extends Component {
tabs: PropTypes.array, // 所有tabs集合
tabNames: PropTypes.array, // tab名称
tabIconNames: PropTypes.array, // tab默认图标
tabSelIconNames: PropTypes.tabSelIconNames // tab选中图标
tabSelIconNames: PropTypes.string // tab选中图标
};
constructor(props) {
......
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
SafeAreaView,
ScrollView,
TouchableOpacity,
Image,
TextInput,
Alert,
Linking,
NativeModules,
Platform
} from 'react-native';
import {
home_background_color,
promary_color,
safe_view,
icon_style,
placehold_text_color,
list_common_item
} from '../../base/BaseStyle';
import StatusBarView from '../common/StatusBarView';
import HeadBackItem from '../common/HeadBackItem';
import {
AsteriskTextStyle,
TitleTextStyle,
ContTextStyle,
ImageTextStyle,
CellTextStyle,
ContInputTextStyle,
FooterBtnStyle
} from '../common/CellTextStyle';
import { connect } from 'react-redux';
import { show, dedupQuoteArray, formatStrForDate, cloneObject } from '../../utils/Utils';
import { AudioRecorder, AudioUtils } from 'react-native-audio';
import Sound from 'react-native-sound';
import DateModel from '../common/DateModel';
import DialogModel from '../common/DialogModel';
import LodingModel from '../common/LodingModel';
import NotEnoughModel from '../common/NotEnoughModel';
import {
requestQuickOrganizations,
requestQuickSurgeryHospital,
requestQuickOrderType,
requestQuickTemplateCollect,
requestQuickAudio,
requestQuickSumbit,
setQuickInitData,
reqQuickSurgeryHospital,
requestListDataSuccess,
requestQuickSurgeryType
} from '../../action/QuickAction';
import { exitLoginStatus } from '../../action/LoginAction';
import {
QUICK_ORDER_LIST_DOING,
QUICK_ORDER_LIST_SUCCESS,
QUICK_ORDER_LIST_FAILURE,
LOGIN_NO,
QUICK_SUBMIT_DOING,
QUICK_SUBMIT_SUCCESS,
QUICK_SUBMIT_FAILURE
} from '../../base/ActionTypes';
class EquipConsuPage extends Component {
constructor(props) {
super(props);
this.state = {
canSubFlag: false, // 生成订单按钮样式改变
listOptionData: [ // 页面元素
{
"id": "0",
title: '销售员',
name: '',
value: ''
},
{
"id": "1",
title: '组织',
name: '请选择',
value: ''
},
{
"id": "2",
title: '客户名称',
name: '请选择',
value: ''
},
{
"id": "3",
title: '收单地点',
name: '请选择',
value: ''
},
{
"id": "4",
title: '收货地点',
name: '请选择',
value: ''
},
{
"id": "5",
title: '主治医生',
name: '请选择',
value: '',
showInput: false,
inputValue: ''
},
{
"id": "6",
title: '手术类型',
name: '请选择',
value: ''
},
{
"id": "7",
title: '手术模板',
name: '请选择',
value: ''
},
{
"id": "8",
title: '手术时间',
name: '请选择',
value: '',
dateValue: new Date(),
showDatePicker: true
},
{
"id": "9",
title: '订单类型',
name: '请选择',
value: ''
},
{
"id": "10",
title: '备注',
value: '',
isRemark: true // 备注
},
{
"id": "11",
title: '还有什么要安排的,可录音备注哟!',
value: '',
isRecode: true // 录音
}
],
subInitListOption: [], // 提交成功后,初始化当前数据
submitOption: { // 提交的信息
seller_code: '', // 用户名username
org_code: '', // 组织
customer_code: '', // 客户名称
bill_to_site_code: '', // 收单地点
ship_to_site_code: '', // 收货地点
doctor_name: '', // 主治医生
// surgery_name: '', // 手术名称
surgery_date: '', // 手术时间
// surgery_type_code: '', // 手术类型
template_collect_number: '', // 手术模板
order_type_code: '', // 订单类型
surgery_desc: '', // 备注信息
voice_url: '', // 录音地址
order_currency: 'CNY',
Caller: 'dingding',
force_balance_check_flag: 'Y', // 检查缺失物料
},
currentItem: {
name: '请选择',
value: ''
},
localOtherObj: { // 恢复原状态
name: '请选择',
value: ''
},
currentTitle: '组织', // 当前点击项
showTypePop: false, // 选择器弹窗
isSubLoding: false, // 加载中弹窗
lodingTitle: '加载中',
listCurrentOption: [ // 当前选择器数据
// {
// name: '男',
// value: 'boy'
// }
],
dateModelPop: false, // 日期选择器
hasPermission: undefined, //录音 授权状态
audioPath: AudioUtils.DocumentDirectoryPath + `/quick_audio_${new Date().getTime()}.aac`, // 文件路径
stop: false, //录音是否停止
currentTime: 0, //录音时长
localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生
// surgeryTypeOption: [
// {
// name:'创伤',
// value:'创伤'
// },{
// name:'关节',
// value:'关节'
// },
// {
// name:'脊柱',
// value:'脊柱'
// },
// {
// name:'运动医学',
// value:'运动医学'
// }
// ],
showNotEnogPop: false, // 库存不足弹窗
not_enough_items_list:[], // 库存不足数据
}
}
componentDidMount() {
this.getSellerName()
this.getAudioAuthorize()
}
// 赋值销售员 初始化数据
getSellerName() {
let { state, props } = this
let { listOptionData } = this.state
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,
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))
}
}
}, {
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[11].value = ''
this.setState({
currentTime: 0,
stop: false,
listOptionData
})
}
componentWillReceiveProps(nextProps) {
let { quick_list_status, loginState, navigation, submit_quick_order_status} = this.props
let self = this
if(quick_list_status != nextProps.quick_list_status) {
switch (nextProps.quick_list_status) {
case QUICK_ORDER_LIST_DOING:
this.changeSubLoding(true)
break;
case QUICK_ORDER_LIST_SUCCESS:
self.setState({
isSubLoding: false,
lodingTitle: '加载中'
},() => {
self.changeCurrentOption()
})
break;
case QUICK_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(submit_quick_order_status != nextProps.submit_quick_order_status) {
switch (nextProps.submit_quick_order_status) {
case QUICK_SUBMIT_DOING:
this.changeSubLoding(true, '提交中')
break;
case QUICK_SUBMIT_SUCCESS:
self.setState({
isSubLoding: false,
lodingTitle: '提交中'
},() => {
self.processReturnData()
})
break;
case QUICK_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
let that = this
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(index > curIndex && index < 11 ) {
item.name = localOtherObj.name
item.value = localOtherObj.value
if(listOptionData[1].value && item.title == '客户名称') {
that.organizationGetCustomerData()
}
if(listOptionData[2].value && item.title == '收单地点') {
that.customerGetBill()
}
if(listOptionData[2].value && item.title == '收货地点') {
that.customerGetShip()
}
if(item.title == '主治医生') {
item.showInput = false,
item.inputValue = ''
}
}
return item
})
})
}
// 判断是否都有值,修改提交按钮的颜色
changeCanSub(isSubCheck) {
let { listOptionData } = this.state
let tempStatus = false
let tempTit = ''
for(let chIndex in listOptionData) {
if(chIndex > 0 && chIndex < 10
&& chIndex != 6 && chIndex != 8
&& !listOptionData[chIndex].value
&& listOptionData[chIndex].name !== '其他') {
// 不是主治医生
tempTit = listOptionData[chIndex].title
tempStatus = true
break
}
}
this.setState({
canSubFlag: !tempStatus
})
if(isSubCheck && tempStatus) {
show(`${tempTit}未选择,不能提交`)
}
}
// 选择器弹窗回调函数
handleCallBack(item, 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)
}
if (itemTitle === '主治医生') {
if(item.name === '其他') {
chItem.showInput = true
} else {
chItem.showInput = false
chItem.inputValue = ''
}
self.clearInitNameAndValue(5)
}
if(itemTitle === '手术类型') {
self.clearInitNameAndValue(6)
}
if (itemTitle === '手术模板') {
listOptionData[10].value = item.desc
}
}
return chItem
})
}, () => {
self.changeCanSub()
})
}
// 关闭弹窗
handleCloseModal(show) {
this.setState({
showTypePop: show
})
}
// 修改当前选择器数据
changeCurrentOption() {
let { currentTitle } = this.state
let { quickOrderOption } = this.props
let tempOption = []
let that = this
if(quickOrderOption.length === 0) {
show(`当前${currentTitle}为空`)
return
}
if (currentTitle === '组织') {
tempOption = this.changeNameAndValue(quickOrderOption, 'org_name', 'org_code')
} else if (currentTitle === '客户名称') {
this.setState({
localCustomersOption: quickOrderOption
})
// 去重医院数据
let filterOpt = dedupQuoteArray(quickOrderOption, '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 = []
quickOrderOption.forEach(item => {
let obj = {}
obj.name = item.value_name
obj.value = item.value_code
resultArr.push(obj)
})
tempOption = [...resultArr]
} else if (currentTitle === '手术模板') {
let resultArr = []
quickOrderOption.forEach(item => {
let obj = {}
let tempName = item.template_name
if(item.doctor_name) {
tempName += `——${item.doctor_name}`
}
obj.name = tempName
obj.value = item.template_number
obj.desc = item.template_desc
obj.template_pic = item.template_pic
resultArr.push(obj)
})
tempOption = [...resultArr]
} else if (currentTitle === '订单类型') {
tempOption = this.changeNameAndValue(quickOrderOption, 'value_name', 'value_code')
}
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() {
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)
})
}
// 客户名称 点击
handleCustomerCheck() {
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()
})
}
}
// 获取客户名称
getCustomerData() {
let { state, props } = this
let params = {
access_token: props.token,
org_code: state.listOptionData[1].value,
seller_code: props.userInfo.user_name
}
props.requestQuickSurgeryHospital(params)
}
// 组织选择后,判断当前客户名称是否只有一个
async organizationGetCustomerData() {
let { state, props } = this
let params = {
access_token: props.token,
org_code: state.listOptionData[1].value,
seller_code: props.userInfo.user_name
}
let that = this
let { global_domain_config } = props
let cusResult = await reqQuickSurgeryHospital(global_domain_config, params);
if(cusResult.error_code == 0) {
let { data: { customers } } = cusResult
props.requestListDataSuccess(customers)
let filterOpt = dedupQuoteArray(customers, 'customer_code')
if(filterOpt.length === 0) {
show(`当前客户名称为空`)
return
}
if(filterOpt.length === 1) {
let { listOptionData } = state
listOptionData[2].name = filterOpt[0].customer_name
listOptionData[2].value = filterOpt[0].customer_code
that.setState({
listOptionData,
localCustomersOption: customers
}, () => {
that.customerGetBill()
that.customerGetShip()
})
}
} else if(cusResult.error_code == 41006) {
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
let error_msg = cusResult.error_msg || cusResult.message
show(error_msg);
}
}
// 收单地点 点击
handleBillCheck() {
let { localCustomersOption, listOptionData } = this.state
let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({
currentTitle: '收单地点',
currentItem: {
name: listOptionData[3].name,
value: listOptionData[3].value
}
}, () => {
let tempOption = []
if( localCustomersOption.length ) {
localCustomersOption.forEach((item) => {
if(item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的地点
let obj = {}
obj.value = item.bill_to_site_code
obj.name = item.bill_to_site_name
tempOption.push(obj)
}
})
}
tempOption = dedupQuoteArray(tempOption, 'name')
self.setState({
showTypePop: true,
listCurrentOption: [...tempOption]
})
})
}
}
customerGetBill() {
let { localCustomersOption, listOptionData } = this.state
let that = this
let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value)
tempLocalOption = dedupQuoteArray(tempLocalOption, 'bill_to_site_code')
if(tempLocalOption.length === 0) {
show(`当前收单地点为空`)
return
}
if(tempLocalOption.length === 1) {
listOptionData[3].name = tempLocalOption[0].bill_to_site_name
listOptionData[3].value = tempLocalOption[0].bill_to_site_code
that.setState({
listOptionData
})
}
}
// 收货地点 点击
handleShipCheck() {
let { localCustomersOption, listOptionData } = this.state
let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({
currentTitle: '收货地点',
currentItem: {
name: listOptionData[4].name,
value: listOptionData[4].value
}
}, () => {
let tempOption = []
if( localCustomersOption.length ) {
localCustomersOption.forEach((item, index) => {
if(item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的地点
let obj = {}
obj.value = item.ship_to_site_code
obj.name = item.ship_to_site_name
tempOption.push(obj)
}
})
}
tempOption = dedupQuoteArray(tempOption, 'name')
self.setState({
showTypePop: true,
listCurrentOption: [...tempOption]
})
})
}
}
customerGetShip() {
let { localCustomersOption, listOptionData } = this.state
let that = this
let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value)
tempLocalOption = dedupQuoteArray(tempLocalOption, 'ship_to_site_code')
if(tempLocalOption.length === 0) {
show(`当前收货地点为空`)
return
}
if(tempLocalOption.length === 1) {
listOptionData[4].name = tempLocalOption[0].ship_to_site_name
listOptionData[4].value = tempLocalOption[0].ship_to_site_code
that.setState({
listOptionData
})
}
}
// 主治医生 点击
handleDoctorCheck() {
let { localCustomersOption, listOptionData } = this.state
let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
// 点击
self.setState({
currentTitle: '主治医生',
currentItem: {
name: listOptionData[5].name,
value: listOptionData[5].value
}
}, () => {
let tempOption = []
if( localCustomersOption.length ) {
localCustomersOption.forEach((item) => {
if(item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的医生
let obj = {}
obj.value = item.customer_doctor
obj.name = item.customer_doctor
tempOption.push(obj)
}
})
}
let othObj = {
name: '其他',
value: '-1'
}
tempOption.push(othObj)
tempOption = dedupQuoteArray(tempOption, 'name')
self.setState({
showTypePop: true,
listCurrentOption: [...tempOption]
})
})
}
}
// 主治医生 输入
handleDoctorInput(text) {
let { listOptionData } = this.state
this.setState({
listOptionData: listOptionData.map(item => {
if(item.title === '主治医生') {
item.inputValue = text
}
return item
})
})
}
// 手术类型 点击
handleSurTypeCheck() {
let { listOptionData } = this.state
let { props } = this
let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({
currentTitle: '手术类型',
currentItem: {
name: listOptionData[6].name,
value: listOptionData[6].value
}
}, () => {
let params = {
access_token: props.token,
value_set_code: 'ORTHOPEDICS_PRODUCT_CLASS'
}
props.requestQuickSurgeryType(params)
})
}
}
// 手术模板 点击
handleMatchTempCheck() {
let { state, props } = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({
currentTitle: '手术模板',
currentItem: {
name: state.listOptionData[7].name,
value: state.listOptionData[7].value
}
}, () => {
// 在此修改接口
let tempDoctorName = ''
if(state.listOptionData[5].name !== '其他') {
tempDoctorName = state.listOptionData[5].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,
surgery_type: state.listOptionData[6].value,
doctor_name: tempDoctorName
}
props.requestQuickTemplateCollect(params)
})
}
}
// 手术模板 跳转
handleMathTempJump() {
let {template_search_data, navigation} = this.props
let { state: { params: { title } } } = this.props.navigation
let {listOptionData} = this.state
let superData = {
org_code: {
name: listOptionData[1].name,
value: listOptionData[1].value,
},
customer_code: {
name: listOptionData[2].name,
value: listOptionData[2].value
},
doctor_name: {
name: listOptionData[5].name,
value: listOptionData[5].inputValue || (listOptionData[5].value === '-1' ? '' : listOptionData[5].value)
},
surgery_type_code: {
name: listOptionData[6].name,
value: listOptionData[6].value
}
}
navigation.navigate('surgeryTemplatePage', {
title: `${title} - 手术模板查询`,
template_search_data: template_search_data,
superData
})
}
// 手术时间 点击 2020-04-23 17:41
handleSurDateCheck() {
let { listOptionData } = this.state
let date = listOptionData[8].value
if(date) {
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(item.title === '手术时间') {
item.dateValue = formatStrForDate(date)
}
return item
})
})
}
this.closeDateModal(true)
}
// 关闭日期选择器
closeDateModal(show) {
this.setState({
dateModelPop: show
})
}
// 修改当前日期数据
dateModalCallback(date) {
let { listOptionData } = this.state
this.setState({
listOptionData: listOptionData.map((item) => {
if(item.title === '手术时间') {
item.name = date
item.value = date
item.dateValue = formatStrForDate(date)
}
return item
})
})
}
// 订单类型 点击
handleOrderCheck() {
let { state, props } = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({
currentTitle: '订单类型',
currentItem: {
name: state.listOptionData[9].name,
value: state.listOptionData[9].value
}
}, () => {
// 在此修改接口
let params = {
access_token: props.token,
value_set_code:'SUR_ORDER_TYPE'
}
props.requestQuickOrderType(params)
})
}
}
// 备注 输入
handleRemarkInput(text) {
let { listOptionData } = this.state
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(item.title === '备注') {
item.value = text
}
return item
})
})
}
// 生成订单 点击
async handleSubmit() {
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 requestQuickAudio(global_domain_config, params);
that.changeSubLoding(true, '上传中')
if(audioResult.error_code == 0) {
// 提交订单
that.setState({
listOptionData: state.listOptionData.map((item, index) => {
if(index == 11) {
item.value = audioResult.data.url
}
return item
})
}, () => {
that.changeSubLoding(false)
that.submitQuickOrder()
})
} 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);
that.submitQuickOrder()
}
} else {
that.submitQuickOrder()
}
}
}
// 提交订单
submitQuickOrder() {
let { state, props } = this
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
let params = {
access_token: props.token,
data: { ...tempSubOption }
}
props.requestQuickSumbit(params)
}
// 判断组织是否为空
judgeOrgIsNull() {
let { listOptionData } = this.state
let orgVal = listOptionData[1].value
if(!orgVal) {
show('请先选择组织')
return false
} else {
return true
}
}
// 判断客户名称是否为空
judgeCustomerIsNull() {
let { listOptionData } = this.state
let orgVal = listOptionData[2].value
if(!orgVal) {
show('请先选择客户名称')
return false
} else {
return true
}
}
// 处理提交后返回的数据
processReturnData() {
let { quickOrderOption } = this.props
let that = this
if(quickOrderOption.create_success) {
if(quickOrderOption.create_success == 'N') {
// 打开库存不足弹窗
this.setState({
not_enough_items_list: quickOrderOption.not_enough_items_list
},() => {
// 解决 IOS 弹窗显示问题
setTimeout(() => {
that.setState({
showNotEnogPop: true
})
}, 500)
})
} else if(quickOrderOption.create_success == 'Y') {
// 打开下单成功页面
this.clearAllData()
let { state: { params: { title } } } = this.props.navigation
this.props.navigation.navigate('SubSuccPage', {
title: `${title} - 下单成功`,
orderNumber: quickOrderOption.survey_collect_number
})
}
}
}
// 清空数据
clearAllData() {
let {props} = this
let {listOptionData, subInitListOption} = this.state
props.setQuickInitData() // 清空缓存数据
listOptionData = cloneObject(subInitListOption) // 清空本地数据
this.setState({
listOptionData,
currentTime: 0, // 清除语音
stop: false
})
}
// 库存不足弹窗回调 -- 确定
handleNotEnoughCallBack() {
let { submitOption } = this.state
let self = this
this.setState({
submitOption: {
...submitOption,
force_balance_check_flag: 'N'
}
}, () => {
self.handleSubmit()
})
}
// 库存不足弹窗关闭
handleNotEnoughCloseModal(show) {
this.setState({
showNotEnogPop: show
})
}
// 返回备注以上的元素
renderListItem() {
let { listOptionData, dateModelPop } = this.state
return(
<View style={styles.list_cont}>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={1}
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'销售员'}</TitleTextStyle>
<ContInputTextStyle editable={false} defaultValue={listOptionData[0].name}></ContInputTextStyle>
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleOrganizationCheck()}
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'组织'}</TitleTextStyle>
<ContTextStyle>{listOptionData[1].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleCustomerCheck()}
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'客户名称'}</TitleTextStyle>
<ContTextStyle>{listOptionData[2].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleBillCheck()}
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'收单地点'}</TitleTextStyle>
<ContTextStyle>{listOptionData[3].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleShipCheck()}
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'收货地点'}</TitleTextStyle>
<ContTextStyle>{listOptionData[4].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleDoctorCheck()}
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'主治医生'}</TitleTextStyle>
<ContTextStyle>{listOptionData[5].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
{
listOptionData[5].showInput ?
<CellTextStyle>
<ContInputTextStyle
style={styles.cell_input}
placeholder={`请输入主治医生`}
onChangeText={(text) => this.handleDoctorInput(text)}
></ContInputTextStyle>
</CellTextStyle> : null
}
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleSurTypeCheck()}
>
<CellTextStyle>
<TitleTextStyle>{'手术类型'}</TitleTextStyle>
<ContTextStyle>{listOptionData[6].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
// onPress={() => this.handleMatchTempCheck()}
onPress={() => this.handleMathTempJump()}
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'手术模板'}</TitleTextStyle>
<ContTextStyle>{listOptionData[7].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleSurDateCheck()}
>
<CellTextStyle>
<TitleTextStyle>{'手术时间'}</TitleTextStyle>
<ContTextStyle>{listOptionData[8].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
<DateModel
date={listOptionData[8].dateValue}
closeModal={(show) => this.closeDateModal(show)}
show={dateModelPop}
callback={(date) => this.dateModalCallback(date)}
/>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleOrderCheck()}
>
<CellTextStyle>
<AsteriskTextStyle>*</AsteriskTextStyle>
<TitleTextStyle>{'订单类型'}</TitleTextStyle>
<ContTextStyle>{listOptionData[9].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
{ 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>
)
}
// 返回备注元素
renderRemarksItem() {
let { state } = this
return (
<CellTextStyle style={list_common_item.remark_item}>
<View style={list_common_item.rema_box}>
<Text style={list_common_item.rema_tit}>备注</Text>
<View style = {list_common_item.rema_Input_outer} >
<TouchableOpacity activeOpacity = {1} style = {list_common_item.rema_Input_inner} onPress = {() => this.TextInput.focus()} >
<TextInput
placeholder = {'请输入备注信息'}
placeholderTextColor = {placehold_text_color}
underlineColorAndroid = {'transparent'}
multiline = {true}
ref = {textInput => this.TextInput = textInput}
numberOfLines = {8}
style={list_common_item.rema_Input}
maxLength={140}
onChangeText={(text) => this.handleRemarkInput(text)}
defaultValue={state.listOptionData[10].value}
/>
</TouchableOpacity>
</View>
</View>
</CellTextStyle>
)
}
// 返回录音元素
renderRecordingItem() {
let { stop, currentTime } = this.state
return (
<CellTextStyle style={[list_common_item.reco_item, !stop ? '' : list_common_item.reco_play_height]}>
<View style={list_common_item.reco_btn_cont}>
{ !stop ? <Text style={list_common_item.reco_btn_tit}>还有什么要安排的,可录音备注哟!</Text> : null }
{
!stop ?
<View style={list_common_item.reco_btn_inner}>
<TouchableOpacity
activeOpacity = {.8}
style={list_common_item.reco_btn_box}
onLongPress={this._record}
onPressOut={this._stop}
>
<View style={list_common_item.reco_img_box}>
<Image source={require('../../images/record_icon.png')} style={icon_style}/>
</View>
<Text style={list_common_item.reco_btn_text}>长按录音</Text>
</TouchableOpacity>
</View>
: <View style={list_common_item.reco_play_box}>
<View style={list_common_item.play_btn}>
<TouchableOpacity
activeOpacity = {.8}
style={[list_common_item.reco_list_box, list_common_item.reco_del_btn]}
onPress={this._del}
>
<Text style={[list_common_item.reco_text, list_common_item.reco_del_tit]}> 删除 </Text>
</TouchableOpacity>
<TouchableOpacity
activeOpacity = {.8}
style={[list_common_item.reco_list_box, list_common_item.reco_play_btn]}
onPress={this._play}
>
<Text style={[list_common_item.reco_text, list_common_item.reco_play_tit]}> 点击播放({currentTime}'') </Text>
</TouchableOpacity>
</View>
</View>
}
</View>
</CellTextStyle>
)
}
// 返回正在加载中
renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state
return(
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
)
}
// 返回库存不足弹窗
renderNotEnoughModel() {
let {
not_enough_items_list,
showNotEnogPop
} = this.state
return (
<SafeAreaView style={styles.item_container}>
<NotEnoughModel
not_enough_items_list={not_enough_items_list}
callback={() => this.handleNotEnoughCallBack()}
show={showNotEnogPop}
closeModal={(show) => this.handleNotEnoughCloseModal(show)}
/>
</SafeAreaView>
)
}
render() {
let {canSubFlag} = this.state
let {navigation} = this.props
let {title} = navigation.state.params
return (
<View style={styles.quick_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<ScrollView
style={styles.quick_main}
showsVerticalScrollIndicator={false}
>
{this.renderListItem()}
{this.renderRemarksItem()}
{this.renderRecordingItem()}
<FooterBtnStyle
style={canSubFlag ? styles.sub_btn_pro : ''}
activeOpacity={canSubFlag ? .8 : 1}
title={'生成订单'}
textStyle= {styles.sub_btn}
onPress={() => this.handleSubmit()}
/>
</ScrollView>
{ this.renderLodingItem() }
{ this.renderNotEnoughModel() }
</SafeAreaView>
</View>
);
}
}
const styles = StyleSheet.create({
quick_container : {
flex: 1,
backgroundColor: home_background_color
},
quick_main : {
padding: 14
},
list_cont: {
flex: 1
},
item_container: {
flex: 1
},
sub_btn_pro: {
backgroundColor: promary_color
},
sub_btn: {},
cell_input: {
textAlign: 'left'
},
loding_back: {
backgroundColor: 'rgba(0, 0, 0, 0)'
}
})
const mapStateToProps = (state) => {
return {
userInfo: state.login.userInfo,
token: state.login.token,
loginState: state.login.loginState,
quick_list_status: state.quick.quick_list_status,
submit_quick_order_status: state.quick.submit_quick_order_status,
quickOrderOption: state.quick.quickOrderOption,
global_domain_config: state.login.global_domain_config
}
}
const mapDispatchToProps = (dispatch) => {
return {
requestQuickOrganizations: (params) => {
dispatch(requestQuickOrganizations(params))
},
requestQuickSurgeryHospital: (params) => {
dispatch(requestQuickSurgeryHospital(params))
},
requestQuickOrderType: (params) => {
dispatch(requestQuickOrderType(params))
},
requestQuickTemplateCollect: (params) => {
dispatch(requestQuickTemplateCollect(params))
},
requestQuickSumbit: (params) => {
dispatch(requestQuickSumbit(params))
},
exitLoginStatus: () => {
dispatch(exitLoginStatus())
},
setQuickInitData: () => {
dispatch(setQuickInitData())
},
requestListDataSuccess: (data) => {
dispatch(requestListDataSuccess(data))
},
requestQuickSurgeryType: (params) => {
dispatch(requestQuickSurgeryType(params))
}
}
}
export default connect(mapStateToProps, mapDispatchToProps)(EquipConsuPage);
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
Image,
TouchableOpacity,
ScrollView,
SafeAreaView
} from 'react-native';
import {
promary_color,
safe_view,
list_common_item,
icon_style,
font_family_medium,
second_text_color,
font_family_regular,
third_text_size,
second_text_size,
home_background_color,
first_text_color,
foundation_color,
pxSize
} from '../../../base/BaseStyle';
import StatusBarView from '../../common/StatusBarView';
import HeadBackItem from '../../common/HeadBackItem';
import { CellTextStyle } from '../../common/CellTextStyle';
import LodingModel from '../../common/LodingModel';
import {
requestGetLineFormBorrow,
requestGetLineFormConsume,
requestGetLineFormTrans
} from '../../../action/HistorAction';
import { connect } from 'react-redux';
import { show } from '../../../utils/Utils';
import {
exitLoginStatus
} from '../../../action/LoginAction';
import { LOGIN_NO } from '../../../base/ActionTypes';
import moment from 'moment';
import ShowModel from '../../common/ShowModel';
class LineOrderPage extends Component {
constructor(props) {
super(props);
this.state = {
isSubLoding: false, // 加载中弹窗
lodingTitle: '加载中',
consumaData: {
isShowSub: true, // 展开耗材
subOption: [
// {
// "id": "0",
// item_name: '人工髋关节假体-JS-HB ||| T',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// }
]
},
orderSupOptions: {}, // 获取主表数据
toolShowPopup: false, // 弹窗显示
popFormItem: {}, // 弹窗对象
}
}
componentDidMount() {
this.getLineOptionData()
}
componentWillReceiveProps(nextProps) {
let {loginState, navigation} = this.props
if(loginState != nextProps.loginState) {
switch(nextProps.loginState) {
case LOGIN_NO:
navigation.navigate('LoginPage')
break;
default:
break;
}
}
}
// 修改正在加载
changeSubLoding(loading, loadTit) {
this.setState({
isSubLoding: loading || false,
lodingTitle: loadTit || '加载中'
})
}
// 获取行订单数据
getLineOptionData() {
let {supIndex, data} = this.props.navigation.state.params
this.setState({
orderSupOptions: data
})
switch(supIndex) {
case 0:
// 借货
this.getReqBorrowLineData(data)
break;
case 1:
// 消耗
this.getReqConsumeLineData(data)
break;
case 2:
// 转单
this.getReqTransLineData(data)
break;
default:
break;
}
}
// 获取借货订单行数据
async getReqBorrowLineData(supData) {
let that = this
let {consumaData} = that.state
let {props} = this
that.changeSubLoding(true)
let params = {
access_token: props.token,
surgery_collect_number: supData.local_his_number
}
let bowResult = await requestGetLineFormBorrow(props.global_domain_config, params)
if(bowResult.error_code == 0) {
that.changeSubLoding(false)
// 成功
let {surgery_collect_lines} = bowResult.data
let tempSum = 0
surgery_collect_lines.length && surgery_collect_lines.forEach(item => {
if(item.plan_quantity) {
tempSum += Number(item.plan_quantity)
}
})
consumaData.subOption = [...surgery_collect_lines]
consumaData.allPlanQuanSum = tempSum
that.setState({
consumaData
})
} else if(bowResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
that.changeSubLoding(false)
let error_msg = bowResult.error_msg || bowResult.message
show(error_msg);
}
}
// 获取消耗订单行数据
async getReqConsumeLineData(supData) {
let that = this
let {consumaData} = that.state
let {props} = this
that.changeSubLoding(true)
let params = {
access_token: props.token,
consume_order_number: supData.local_his_number
}
let conResult = await requestGetLineFormConsume(props.global_domain_config, params)
if(conResult.error_code == 0) {
that.changeSubLoding(false)
// 成功
let {sur_consume_lines} = conResult.data
let tempSum = 0
let tempConQuanSum = 0
sur_consume_lines.length && sur_consume_lines.forEach(item => {
if(item.sale_price) {
tempSum += Number(item.sale_price)
}
if(item.consumed_quantity) {
tempConQuanSum += Number(item.consumed_quantity)
}
})
consumaData.subOption = [...sur_consume_lines]
consumaData.allOptSum = tempSum
consumaData.allConmQuanSum = tempConQuanSum
that.setState({
consumaData
})
} else if(conResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
that.changeSubLoding(false)
let error_msg = conResult.error_msg || conResult.message
show(error_msg);
}
}
// 获取转单订单行数据
async getReqTransLineData(supData) {
let that = this
let {consumaData} = that.state
let {props} = this
that.changeSubLoding(true)
let params = {
access_token: props.token,
order_number: supData.order_number,
destination_surgery_collect_number: supData.destination_surgery_collect_number,
source_surgery_order_number: supData.source_surgery_order_number
}
let conResult = await requestGetLineFormTrans(props.global_domain_config, params)
if(conResult.error_code == 0) {
that.changeSubLoding(false)
// 成功
let {sur_order_transfer_lines} = conResult.data
let tempSum = 0
let tempConQuanSum = 0
sur_order_transfer_lines.length && sur_order_transfer_lines.forEach(item => {
if(item.sale_price) {
tempSum += Number(item.sale_price)
}
if(item.consumed_quantity) {
tempConQuanSum += Number(item.consumed_quantity)
}
})
consumaData.subOption = [...sur_order_transfer_lines]
consumaData.allOptSum = tempSum
consumaData.allConmQuanSum = tempConQuanSum
that.setState({
consumaData
})
} else if(conResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
that.changeSubLoding(false)
let error_msg = conResult.error_msg || conResult.message
show(error_msg);
}
}
// 耗材明细 隐藏/显示子项
handleDetailBtmCheck(flagType) {
let {consumaData} = this.state
consumaData.isShowSub = flagType
this.setState({
consumaData
})
}
// 关闭当前弹窗
handleCloseModal(show) {
this.setState({
toolShowPopup: show
})
}
// 耗材弹窗显示
handleIsShowDialog(item) {
this.setState({
toolShowPopup: !this.state.toolShowPopup,
popFormItem: item
})
}
// 返回耗材内容
renderConsumablesItem() {
let { state } = this
return (
<CellTextStyle style={list_common_item.consu_detail}>
<View style={list_common_item.detail_inner}>
{
state.consumaData.subOption.length ?
<View style={list_common_item.detail_sub_cont}>
<View style={list_common_item.detail_sub_tit}>
<Text style={list_common_item.detail_tit_text}>
耗材({state.consumaData.subOption.length}
</Text>
{
state.consumaData.isShowSub ?
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.detail_icon}
onPress={() => this.handleDetailBtmCheck(false)}
>
<Image style={[icon_style, list_common_item.detail_top_icon]} source={require('../../../images/arr_btm.png')} />
</TouchableOpacity> :
<TouchableOpacity
activeOpacity={.8}
style={[list_common_item.detail_icon, list_common_item.detail_icon_rig]}
onPress={() => this.handleDetailBtmCheck(true)}
>
<Image style={[icon_style, list_common_item.detail_top_icon]} source={require('../../../images/arr_rig.png')} />
</TouchableOpacity>
}
</View>
{
state.consumaData.isShowSub ?
<View style={list_common_item.detail_sub_inner}>
{
state.consumaData.subOption.map((item, index) => {
return this.renderConDeSubItem(item, index)
})
}
</View> : null
}
</View> : null
}
</View>
</CellTextStyle>
)
}
// 返回耗材明细子项
renderConDeSubItem(item, index) {
let {supIndex} = this.props.navigation.state.params
return(
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.con_de_sub}
key={index}
onPress={() => this.handleIsShowDialog(item)}
>
<Text style={list_common_item.de_sub_tit}>
{index+1}{ item.item_name } - {item.specification}
</Text>
{
(supIndex == 1 && item.sale_price) ? <Text style={list_common_item.de_tip}>
单价(¥){ item.sale_price }
</Text>
: null
}
</TouchableOpacity>
)
}
// 返回主要内容
renderContItem() {
let {orderSupOptions, consumaData} = this.state
let {supIndex} = this.props.navigation.state.params
let tempTit = []
if(supIndex == 0) {
tempTit.push('手术名称:', '手术时间:')
} else if(supIndex == 1) {
tempTit.push('结单标识:', '消耗时间:')
} else if(supIndex == 2) {
tempTit.push('目标借货订单号:', '手术时间:')
}
return (
<ScrollView style={styles.line_cont_scroll}>
<View style={styles.fo_cont_inner}>
<Text style={styles.fo_cont_top_tit}>订单信息</Text>
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
{tempTit[0]}{orderSupOptions.local_his_name}
{
supIndex == 2 ? `(${orderSupOptions.local_his_time})` : null
}
</Text>
</View>
{
supIndex == 2 && orderSupOptions.source_surgery_order_number ?
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
来源借货订单号:{orderSupOptions.source_surgery_order_number}
{
orderSupOptions.source_surgery_date ? `(${moment(orderSupOptions.source_surgery_date).format('YYYY/MM/DD HH:mm')})` : null
}
</Text>
</View> : null
}
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
手术医生:{orderSupOptions.doctor_name ? orderSupOptions.doctor_name : '无'}
</Text>
</View>
{
supIndex !== 2 ?
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
{tempTit[1]}{orderSupOptions.local_his_time}
</Text>
</View> : null
}
{
supIndex !== 2 ?
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
客户名称:{orderSupOptions.customer_name ? orderSupOptions.customer_name : '无'}
</Text>
</View> :
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
目标客户名称:{orderSupOptions.destination_customer_name ? orderSupOptions.destination_customer_name : '无'}
</Text>
<Text style={styles.fo_tip_txt}>
来源客户名称:{orderSupOptions.source_customer_name ? orderSupOptions.source_customer_name : '无'}
</Text>
</View>
}
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
订单号:{supIndex == 0 ? orderSupOptions.local_his_number :
(supIndex == 1 ? orderSupOptions.surgery_collect_number : orderSupOptions.order_number)}
</Text>
</View>
{
supIndex == 0 ?
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
下单日期 {orderSupOptions.create_time ? moment(orderSupOptions.create_time).format('YYYY/MM/DD HH:mm') : '无'}
</Text>
</View>
: null
}
{
supIndex == 0 ?
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
下单数量 {consumaData.allPlanQuanSum}
</Text>
</View>
: null
}
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
备注信息:{orderSupOptions.surgery_desc ? orderSupOptions.surgery_desc : '无'}
</Text>
</View>
{
supIndex == 1 ?
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
消耗数量:{consumaData.allConmQuanSum}
</Text>
</View>
: null
}
{
consumaData.allOptSum ?
<View style={styles.fo_cell_box}>
<Text style={styles.fo_sum_txt}>
消耗金额:¥{consumaData.allOptSum}
</Text>
</View>
: null
}
</View>
<View style={styles.line_cont}>
<Text style={styles.cont_tip_tit}>订单详情</Text>
{ this.renderConsumablesItem() }
{ this.renderDetailModel() }
<View style={styles.line_footer}>
<View style={styles.fo_sta_inner}>
<Text style={[
styles.fo_sta_txt,
(orderSupOptions.local_his_status == '待审核' || orderSupOptions.local_his_status == '已提交') ? styles.status_audit : '',
(orderSupOptions.local_his_status == '待还货' || orderSupOptions.local_his_status == '已输入' || orderSupOptions.local_his_status == '已驳回') ? styles.status_return : '',
(orderSupOptions.local_his_status == '其他' || orderSupOptions.local_his_status == '已取消') ? styles.status_other : ''
]}>
{orderSupOptions.local_his_status}
</Text>
</View>
</View>
</View>
</ScrollView>
)
}
// 返回正在加载中
renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state
return(
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
)
}
// 返回弹窗
renderDetailModel() {
let {popFormItem, toolShowPopup} = this.state
return (
<ShowModel
title={ popFormItem.item_name}
show={ toolShowPopup }
closeModal={(show) => this.handleCloseModal(show)}
>
<View style={styles.model_cont}>
<View style={styles.model_cont_inner}>
<Text style={styles.mo_cont_title}>详细信息:</Text>
{
popFormItem.item_name ?
<Text style={styles.mo_cont_tip}>
通用名称:{popFormItem.item_name}
</Text> : null
}
{
popFormItem.serial_number ?
<Text style={styles.mo_cont_tip}>
物料序列:{popFormItem.serial_number}
</Text> : null
}
{
popFormItem.item_code ?
<Text style={styles.mo_cont_tip}>
物料代码:{popFormItem.item_code}
</Text> : null
}
{
popFormItem.specification ?
<Text style={styles.mo_cont_tip}>
规格型号:{popFormItem.specification}
</Text> : null
}
{
popFormItem.plan_quantity ?
<Text style={styles.mo_cont_tip}>
计划数量:{popFormItem.plan_quantity}
</Text> : null
}
{
popFormItem.storage_quantity ?
<Text style={styles.mo_cont_tip}>
库存数量:{popFormItem.storage_quantity}
</Text> : null
}
{
popFormItem.consumed_quantity ?
<Text style={styles.mo_cont_tip}>
消耗数量:{popFormItem.consumed_quantity}
</Text> : null
}
{
popFormItem.sale_price ?
<Text style={styles.mo_cont_tip}>
销售价格:{popFormItem.sale_price}
</Text> : null
}
</View>
</View>
</ShowModel>
)
}
render() {
let {navigation} = this.props
let {title} = navigation.state.params
return (
<View style={styles.line_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.line_main}>
{ this.renderContItem() }
{this.renderLodingItem()}
</View>
</SafeAreaView>
</View>
);
}
}
const styles = StyleSheet.create({
line_container: {
flex: 1,
backgroundColor: home_background_color,
padding: 0,
margin: 0
},
line_main: {
flex: 1
},
loding_back: {
backgroundColor: 'rgba(0, 0, 0, 0)'
},
line_cont_scroll: {},
line_cont: {
paddingHorizontal: 20,
paddingVertical: 16,
paddingBottom: 20
},
cont_tip_tit: {
fontSize: 16,
fontFamily: font_family_regular,
color: first_text_color
},
line_footer: {},
fo_cont_inner: {
// borderBottomWidth: 1,
// borderBottomColor: '#CCCCCC',
// paddingBottom: 18
backgroundColor: foundation_color,
padding: 20
},
fo_cont_top_tit: {
color: first_text_color,
fontFamily: font_family_medium,
fontSize: second_text_size,
paddingBottom: 8
},
fo_tit_box: {
paddingBottom: 12
},
fo_txt: {
fontSize: 14,
fontFamily: font_family_regular,
color: second_text_color
},
fo_cell_box: {},
fo_tip_txt: {
fontSize: third_text_size,
fontFamily: font_family_regular,
color: second_text_color,
lineHeight: 18
},
fo_sum_txt: {
color: first_text_color,
fontSize: 14,
fontFamily: font_family_medium,
paddingTop: 8
},
fo_sta_inner: {
paddingTop: 12,
alignItems: 'flex-end',
borderTopWidth: 1,
borderTopColor: '#ECECEC',
paddingTop: 18
},
fo_sta_txt: {
fontSize: second_text_size,
fontFamily: font_family_medium,
color: '#01B2B9'
},
status_audit: {
color: '#FF0000'
},
status_return: {
color: '#007EFF'
},
status_other: {
color: '#F4B61B'
},
// 弹窗
model_cont: {
// flex: 1
},
model_cont_inner: {
marginBottom: 48
},
mo_cont_title: {
color: first_text_color,
// fontWeight: 'bold',
fontSize: 14,
lineHeight: 24,
fontFamily: font_family_medium
},
mo_cont_tip: {
color: second_text_color,
fontSize: 14,
lineHeight: 24,
fontFamily: font_family_regular
},
mo_img_box: {
flex: 1,
borderWidth: 1,
borderColor: '#E1E1E1',
justifyContent: 'center',
alignItems: 'center',
height: pxSize(120)
},
mo_img: {
width: pxSize(100),
height: '100%'
},
})
const mapStateToProps = (state) => {
return {
token: state.login.token,
loginState: state.login.loginState,
global_domain_config: state.login.global_domain_config
}
}
const mapDispatchToProps = (dispatch) => {
return {
exitLoginStatus: () => {
dispatch(exitLoginStatus())
},
}
}
export default connect(mapStateToProps, mapDispatchToProps)(LineOrderPage);
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
SafeAreaView,
ScrollView,
TouchableOpacity,
Image,
TextInput,
Alert,
Linking,
NativeModules,
Platform,
FlatList
} from 'react-native';
import {
home_background_color,
promary_color,
safe_view,
icon_style,
placehold_text_color,
list_common_item,
pxHeight,
title_text_color,
second_text_color,
pxSize,
foundation_color,
second_text_size,
font_family_regular,
promary_text_color,
third_text_color,
font_family_medium,
Width
} from '../../../base/BaseStyle';
import StatusBarView from '../../common/StatusBarView';
import HeadBackItem from '../../common/HeadBackItem';
import {
AsteriskTextStyle,
TitleTextStyle,
ContTextStyle,
ImageTextStyle,
CellTextStyle,
ContInputTextStyle,
FooterBtnStyle
} from '../../common/CellTextStyle';
import { connect } from 'react-redux';
import { show, dedupQuoteArray, formatStrForDate, cloneObject } from '../../../utils/Utils';
import { AudioRecorder, AudioUtils } from 'react-native-audio';
import Sound from 'react-native-sound';
import DateModel from '../../common/DateModel';
import DialogModel from '../../common/DialogModel';
import LodingModel from '../../common/LodingModel';
import {
requestQuickOrganizations,
requestQuickSurgeryHospital,
requestQuickOrderType,
requestQuickTemplateCollect,
requestQuickAudio,
requestQuickSumbit,
setQuickInitData,
reqQuickSurgeryHospital,
requestListDataSuccess,
requestQuickSurgeryType
} from '../../../action/QuickAction';
import { exitLoginStatus } from '../../../action/LoginAction';
import {
QUICK_ORDER_LIST_DOING,
QUICK_ORDER_LIST_SUCCESS,
QUICK_ORDER_LIST_FAILURE,
LOGIN_NO,
QUICK_SUBMIT_DOING,
QUICK_SUBMIT_SUCCESS,
QUICK_SUBMIT_FAILURE
} from '../../../base/ActionTypes';
import moment from 'moment';
import ZoomPictureModel from '../../common/ZoomPictureModel';
// @connect(mapStateToProps, mapDispatchToProps)
class surgeryTemplatePage extends Component {
constructor(props) {
super(props);
this.state = {
listOptionData: [
{
"id": "0",
title: '组织', // 从上一页显示组织
name: '',
value: ''
},
{
"id": "1",
title: '客户名称',
name: '请选择',
value: ''
},
{
"id": "2",
title: '主治医生',
name: '请选择',
value: '',
showInput: false,
inputValue: ''
},
{
"id": "3",
title: '手术类型',
name: '请选择',
value: ''
}
],
conDetaOption:[
// {
// "id": "0",
// customer_code: '客户名称',
// doctor_name: "主治医生",
// order_type_code: '手术类型'
// surgery_desc: '备注信息',
// }
{
bill_to_site_code: "1",
bill_to_site_name: "唐县向阳北街28号",
customer_code: "CU00000017",
customer_name: "唐县人民医院",
doctor_name: "赵宏伟",
org_code: "A02",
org_name: "河北十方医疗器械物流有限公司",
seller_code: "shi.ming",
seller_name: "石明",
ship_to_site_code: "1",
ship_to_site_name: "唐县向阳北街28号",
surgery_type: "创伤",
template_desc: "",
template_name: "胫骨远端骨折(右)",
template_number: "ST202010800097-3" // 唯一
},{
bill_to_site_code: "1",
bill_to_site_name: "唐县向阳北街28号",
customer_code: "CU00000017",
customer_name: "唐县人民医院",
doctor_name: "赵宏伟",
org_code: "A02",
org_name: "河北十方医疗器械物流有限公司",
seller_code: "shi.ming",
seller_name: "石明",
ship_to_site_code: "1",
ship_to_site_name: "唐县向阳北街28号",
surgery_type: "创伤",
template_desc: "",
template_name: "胫骨远端骨折(右)",
template_number: "ST202010800097-2" // 唯一
},{
bill_to_site_code: "1",
bill_to_site_name: "唐县向阳北街28号",
customer_code: "CU00000017",
customer_name: "唐县人民医院",
doctor_name: "赵宏伟",
org_code: "A02",
org_name: "河北十方医疗器械物流有限公司",
seller_code: "shi.ming",
seller_name: "石明",
ship_to_site_code: "1",
ship_to_site_name: "唐县向阳北街28号",
surgery_type: "创伤",
template_desc: "",
template_name: "胫骨远端骨折(右)",
template_number: "ST202010800097-1" // 唯一
},{
bill_to_site_code: "1",
bill_to_site_name: "唐县向阳北街28号",
customer_code: "CU00000017",
customer_name: "唐县人民医院",
doctor_name: "赵宏伟",
org_code: "A02",
org_name: "河北十方医疗器械物流有限公司",
seller_code: "shi.ming",
seller_name: "石明",
ship_to_site_code: "1",
ship_to_site_name: "唐县向阳北街28号",
surgery_type: "创伤",
template_desc: "",
template_name: "胫骨远端骨折(右)",
template_number: "ST202010800097-0" // 唯一
}
],
allConOption: [], // 所有数据(未筛选过的)
selectShowPopup: false, // 共计已选弹窗
localSelectOption: [], // 已选数据
isSubLoding: false, // true 加载中弹窗
lodingTitle: '加载中',
currentItem: {
name: '请选择',
value: '-1'
},
localOtherObj: { // 恢复原状态
name: '请选择',
value: ''
},
currentTitle: '组织', // 当前点击项
showTypePop: false, // 选择器弹窗
listCurrentOption: [], // 当前选择器数据
isShowImage: false,
zoomImages: []
}
}
componentDidMount() {
this.getInitSearchData()
}
componentWillReceiveProps(nextProps) {
let { quick_list_status, loginState, navigation} = this.props
let self = this
if(quick_list_status != nextProps.quick_list_status) {
switch (nextProps.quick_list_status) {
case QUICK_ORDER_LIST_DOING:
this.changeSubLoding(true)
break;
case QUICK_ORDER_LIST_SUCCESS:
self.setState({
isSubLoding: false,
lodingTitle: '加载中'
},() => {
self.changeCurrentOption()
})
break;
case QUICK_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;
}
}
}
// 修改正在加载
changeSubLoding(loading, loadTit) {
this.setState({
isSubLoding: loading || false,
lodingTitle: loadTit || '加载中'
})
}
getInitSearchData() {
let { state: { params: { template_search_data, superData } } } = this.props.navigation
let {listOptionData} = this.state
console.log('template_search_data=====>', template_search_data)
console.log('superData=====>', superData)
console.log('this.props.navigation=====>', this.props.navigation)
let superKeys = Object.keys(superData)
if(superKeys.length > 0) {
if(superData.org_code) {
listOptionData[0].name = superData.org_code.name
listOptionData[0].value = superData.org_code.value
}
if(superData.customer_code) {
listOptionData[1].name = superData.customer_code.name
listOptionData[1].value = superData.customer_code.value
}
if(superData.doctor_name) {
listOptionData[2].name = superData.doctor_name.name
listOptionData[2].value = superData.doctor_name.value
}
if(superData.surgery_type_code) {
listOptionData[3].name = superData.surgery_type_code.name
listOptionData[3].value = superData.surgery_type_code.value
}
}
console.log('listOptionData---', listOptionData)
this.setState({
listOptionData: listOptionData
})
// 根据查询条件查询手术模板
if(template_search_data) {
this.handleSearchData(template_search_data)
}
}
// 选择器弹窗回调函数
handleCallBack(item, 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 === '主治医生') {
if(item.name === '其他') {
chItem.showInput = true
} else {
chItem.showInput = false
chItem.inputValue = ''
}
}
}
return chItem
})
})
}
// 清空当前项以下的值
clearInitNameAndValue(curIndex) {
let { listOptionData, localOtherObj } = this.state
let that = this
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(index > curIndex) {
item.name = localOtherObj.name
item.value = localOtherObj.value
if(item.title == '主治医生') {
item.showInput = false,
item.inputValue = ''
}
}
return item
})
})
}
// 关闭弹窗
handleCloseModal(show) {
this.setState({
showTypePop: show
})
}
// 修改当前选择器数据
changeCurrentOption() {
let { currentTitle } = this.state
let { quickOrderOption } = this.props
let tempOption = []
let that = this
console.log('quickOrderOption---', quickOrderOption )
console.log('currentTitle---', currentTitle )
if(quickOrderOption.length === 0) {
show(`当前${currentTitle}为空`)
return
}
// if (currentTitle === '组织') {
// tempOption = this.changeNameAndValue(quickOrderOption, 'org_name', 'org_code')
// } else
if (currentTitle === '客户名称') {
this.setState({
localCustomersOption: quickOrderOption
})
// 去重医院数据
let filterOpt = dedupQuoteArray(quickOrderOption, '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 = []
quickOrderOption.forEach(item => {
let obj = {}
obj.name = item.value_name
obj.value = item.value_code
resultArr.push(obj)
})
tempOption = [...resultArr]
}
// else if (currentTitle === '手术模板') {
// let resultArr = []
// quickOrderOption.forEach(item => {
// let obj = {}
// let tempName = item.template_name
// if(item.doctor_name) {
// tempName += `——${item.doctor_name}`
// }
// obj.name = tempName
// obj.value = item.template_number
// obj.desc = item.template_desc
// obj.template_pic = item.template_pic
// resultArr.push(obj)
// })
// tempOption = [...resultArr]
// } else if (currentTitle === '订单类型') {
// tempOption = this.changeNameAndValue(quickOrderOption, 'value_name', 'value_code')
// }
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
}
// 客户名称 点击
handleCustomerCheck() {
let { state, props } = this
let self = this
// if(this.judgeOrgIsNull()) {
self.setState({
currentTitle: '客户名称',
currentItem: {
name: state.listOptionData[1].name,
value: state.listOptionData[1].value
}
}, () => {
// 在此修改接口
self.getCustomerData()
})
// }
}
// 获取客户名称
getCustomerData() {
let { state, props } = this
let params = {
access_token: props.token,
org_code: state.listOptionData[0].value,
seller_code: props.userInfo.user_name
}
props.requestQuickSurgeryHospital(params)
}
// 主治医生 点击
handleDoctorCheck() {
let { localCustomersOption, listOptionData } = this.state
let self = this
// if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
// 点击
self.setState({
currentTitle: '主治医生',
currentItem: {
name: listOptionData[2].name,
value: listOptionData[2].value
}
}, () => {
let tempOption = []
if( localCustomersOption.length ) {
localCustomersOption.forEach((item) => {
if(item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的医生
let obj = {}
obj.value = item.customer_doctor
obj.name = item.customer_doctor
tempOption.push(obj)
}
})
}
tempOption = dedupQuoteArray(tempOption, 'name')
self.setState({
showTypePop: true,
listCurrentOption: [...tempOption]
})
})
// }
}
// 手术类型 点击
handleSurTypeCheck() {
let { listOptionData } = this.state
let { props } = this
let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({
currentTitle: '手术类型',
currentItem: {
name: listOptionData[3].name,
value: listOptionData[3].value
}
}, () => {
let params = {
access_token: props.token,
value_set_code: 'ORTHOPEDICS_PRODUCT_CLASS'
}
props.requestQuickSurgeryType(params)
})
}
}
// 查询
async handleSearchData(curForm) {
let { state, props } = this
let tempDoctorName = ''
if(state.listOptionData[2].name !== '其他') {
tempDoctorName = state.listOptionData[2].value
}else {
tempDoctorName = state.listOptionData[2].inputValue
}
let params = {
access_token: props.token,
org_code: state.listOptionData[0].value,
seller_code: props.userInfo.user_name,
customer_code: state.listOptionData[1].value,
doctor_name: tempDoctorName,
surgery_type: state.listOptionData[3].value,
}
props.requestQuickTemplateCollect(params)
}
// 修改加载中
changeLodingFlag(show) {
this.setState({
isSubLoding: show
})
}
// 取消选择
handleCelSelCheck(index) {
this.changeIsSelected(index, false)
}
// 确定选择
handleSubSelectedCheck(index) {
this.changeIsSelected(index, true)
}
// // 修改选择
// handleChangeSelCheck(index, selFlag){
// this.changeIsSelected(index, selFlag)
// }
// 修改 当前已选择
changeIsSelected(ind, selFlag) {
// 选择☑️一个
// 如果是当前项,判断是清空/选中
// 如果不是当前项,清空其他选择性,再选中当前
let {conDetaOption} = this.state
conDetaOption.map(function(item, itemIndex){
if(selFlag) {
item.select = Boolean(itemIndex === ind)
}else {
item.select = selFlag
}
})
console.log('conDetaOption---', conDetaOption)
this.setState({
conDetaOption: conDetaOption
})
}
// 跳转详情页
handleJumpDetails(item) {
this.props.navigation.navigate('surgeryDetailsPage', {
title: `${title} - 模板详情`,
superData: item
})
}
// 点击 确定
handleSubmit() {
// let { localSelectOption, listOptionData } = this.state
// 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', { title: '转单申请' })
}
// 展示/隐藏 放大图片
handleZoomPicture(flag, uri) {
this.setState({
isShowImage: flag,
zoomImages: [{ url: uri }]
})
}
// 返回顶部查询
renderTopProItem() {
let { listOptionData } = this.state
return(
<View style={styles.list_cont}>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={1}
>
<CellTextStyle>
<TitleTextStyle>{'组织'}</TitleTextStyle>
<ContInputTextStyle editable={false} defaultValue={listOptionData[0].name} style={styles.top_org_input}></ContInputTextStyle>
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleCustomerCheck()}
>
<CellTextStyle>
<TitleTextStyle>{'客户名称'}</TitleTextStyle>
<ContTextStyle>{listOptionData[1].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleDoctorCheck()}
>
<CellTextStyle>
<TitleTextStyle>{'主治医生'}</TitleTextStyle>
<ContTextStyle>{listOptionData[2].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</CellTextStyle>
</TouchableOpacity>
</View>
<View style={styles.item_container}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleSurTypeCheck()}
>
<CellTextStyle>
<TitleTextStyle>{'手术类型'}</TitleTextStyle>
<ContTextStyle>{listOptionData[3].name}</ContTextStyle>
{ this.renderRightArrowItem() }
</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>
{ 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>
)
}
// 返回主要查询内容
renderContItem() {
let { conDetaOption } = this.state
return(
<View style={styles.search_cont}>
<View style={styles.search_cont_inner}>
<Text style={styles.cont_tit}>
当前查询({conDetaOption.length})数据
</Text>
</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>
</View>
)
}
// 返回每一列数据
renderSubListItem(item, index) {
let isExitPicUrl = item.template_pic
let sel_icon = require('../../../images/radio_no.png')
if(isExitPicUrl) {
let { global_domain_config } = this.props
isExitPicUrl = `${global_domain_config}/jeecg-boot/sys/common/view/${item.template_pic}`
}
if(item.select) {
sel_icon = require('../../../images/radio_yes.png')
}
return(
<View style={styles.cons_sub_list} key={item.id}>
<View style={styles.sub_list_lef}>
<TouchableOpacity
activeOpacity={.8}
style={styles.sub_icon_box}
onPress={() => this.changeIsSelected(index,!item.select)}
>
<Image style={icon_style} source={sel_icon} />
</TouchableOpacity>
</View>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.handleJumpDetails(item)}
style={styles.sub_list_cen}
>
<Text style={styles.rig_tit}>
{item.template_name}
</Text>
<Text style={styles.rig_ser}>
{item.template_number}{item.surgery_type}
</Text>
</TouchableOpacity>
<View style={styles.list_img_box}>
<TouchableOpacity
activeOpacity={.8}
style={styles.list_item_img}
onPress={() => this.handleZoomPicture(true, isExitPicUrl)}
>
<Image
defaultSource={require('../../../images/not_img.png')}
source={{uri: isExitPicUrl}}
style={icon_style} />
</TouchableOpacity>
{this.renderZoomPicture()}
</View>
</View>
)
}
// 加载放大图片弹窗
renderZoomPicture() {
// // 测试
// let { isShowImage } = this.state
// let zoomImages = [{
// url: 'https://obs.uat.sfrx.guke.tech/upload/dingding/image/QDw05sTo.jpg',
// },{
// url: 'https://obs.uat.sfrx.guke.tech/upload/dingding/image/QDw05sTo.jpg',
// },{
// url: 'https://obs.uat.sfrx.guke.tech/jeecg-boot/sys/common/view/upload/dingding/image/8V4599aH.jpg'
// }]
// 正式
let { isShowImage, zoomImages } = this.state
return (
<ZoomPictureModel
isShowImage={isShowImage}
currShowImgIndex={0}
zoomImages={zoomImages}
callBack={(flag) => this.handleZoomPicture(flag)}
></ZoomPictureModel>
)
}
// 返回底部按钮
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.def_btn]}
onPress={() => this.handleSubmit()}
>
<Text style={list_common_item.def_tip}>{'确定'}</Text>
</TouchableOpacity>
</View>
</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
return (
<View style={styles.search_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.search_main}>
<ScrollView style={styles.search_scroll}>
{this.renderTopProItem()}
{this.renderContItem()}
{this.renderLodingItem()}
</ScrollView>
</View>
{this.renderFooterBtnItem()}
</SafeAreaView>
</View>
);
}
}
const styles = StyleSheet.create({
search_container: {
flex: 1,
backgroundColor: home_background_color,
padding: 0,
margin: 0
},
search_main: {
flex: 1
},
search_scroll: {
paddingTop: 20,
paddingHorizontal: 16
},
list_cont: {
flex: 1
},
item_container: {
flex: 1
},
top_org_input: {
paddingRight: 0
},
item_btn_cont: {
alignItems: 'flex-end',
justifyContent: 'center'
},
search_btn_box: {
backgroundColor: promary_color,
width: 100,
borderRadius: 10,
height: 40,
marginBottom: 10
},
search_btn: {
color: title_text_color,
lineHeight: 38,
textAlign: 'center',
fontSize: 14,
fontFamily: font_family_medium
},
list_item_img: {
width: pxSize(36),
height: 'auto'
},
search_cont: {
paddingBottom: 48
},
search_cont_inner: {
marginBottom: 10
},
cont_tit: {
fontSize: 14
},
cont_list: {},
cons_cont: {},
list_img_box: {
width: pxSize(70),
height: pxSize(39),
borderWidth: 1,
borderColor: '#DDDDDD',
borderRadius: 4,
padding: 1,
alignItems: 'center',
justifyContent: 'center'
},
cons_sub_list: {
flexDirection: 'row',
alignItems: 'center',
marginBottom: 16
},
sub_list_lef: {
paddingRight: 14
},
sub_list_cen: {
flex: 1
},
rig_tit: {
paddingBottom: 2
},
sub_icon_box: {
width: pxSize(20),
height: pxSize(20)
}
})
const mapStateToProps = (state) => {
return {
userInfo: state.login.userInfo,
token: state.login.token,
loginState: state.login.loginState,
global_domain_config: state.login.global_domain_config,
quick_list_status: state.quick.quick_list_status,
quickOrderOption: state.quick.quickOrderOption,
}
}
const mapDispatchToProps = (dispatch) => {
return {
exitLoginStatus: () => {
dispatch(exitLoginStatus())
},
requestQuickTemplateCollect: (params) => {
dispatch(requestQuickTemplateCollect(params))
},
requestQuickSurgeryHospital: (params) => {
dispatch(requestQuickSurgeryHospital(params))
},
requestQuickSurgeryType: (params) => {
dispatch(requestQuickSurgeryType(params))
}
}
}
export default connect(mapStateToProps, mapDispatchToProps)(surgeryTemplatePage);
// export default surgeryTemplatePage
\ No newline at end of file
export default [
{
isRequest: true,
title: '销售员',
value: '易凯源',
isPicker: false,
isEditText: true
},
{
isRequest: true,
title: '组织',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '客户名称',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '收单地点',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '收货地点',
value: '请选择',
isPicker: true
},
{
isRequest: false,
title: '主治医生',
value: '请选择',
isPicker: true,
showInput: true
},
{
isRequest: false,
title: '手术名称',
value: '请输入',
isPicker: false
},
{
isRequest: false,
title: '手术时间',
value: '请选择',
isPicker: true,
showDatePicker: true
},
{
isRequest: true,
title: '手术类型',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '订单类型',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '选择产品',
value: '请选择',
isPicker: true,
showItemPage: true
}
]
\ No newline at end of file
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