Commit 1b696d4c by peii

【需求】转单选择单号使用单页,搜索单号、业务员和备注

parent 3ced7b22
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/app/containers/equipConsu/module/OrdersPage.js * @FilePath: /BoneHouse_Business_APP/app/containers/equipConsu/module/OrdersPage.js
* @Author: peii * @Author: peii
* @Date: 2021-07-06 15:29:45 * @Date: 2021-07-06 15:29:45
* @LastEditTime: 2021-07-08 15:58:39 * @LastEditTime: 2021-12-16 14:49:55
* @LastEditors: peii * @LastEditors: peii
* @Vision: 1.0 * @Vision: 1.0
* @Description: 消耗时选择借货单 * @Description: 消耗时选择借货单
...@@ -78,7 +78,7 @@ export default class CollectOrder extends Component { ...@@ -78,7 +78,7 @@ export default class CollectOrder extends Component {
return this.setState({ orders: ords }) return this.setState({ orders: ords })
} }
const match = R.test(new RegExp(text, 'g')) const match = R.test(new RegExp(text, 'g'))
const keys = ['collect_number', 'seller_name', 'doctor_name', 'surgery_desc', 'remark'] const keys = ['collect_number', 'seller_name', 'remark']
ords = R.filter(R.anyPass(R.map(k => R.compose(match, R.prop(k)), keys)))(ords) ords = R.filter(R.anyPass(R.map(k => R.compose(match, R.prop(k)), keys)))(ords)
this.setState({ orders: ords }) this.setState({ orders: ords })
} }
...@@ -94,16 +94,12 @@ export default class CollectOrder extends Component { ...@@ -94,16 +94,12 @@ export default class CollectOrder extends Component {
<TouchableOpacity style={styles.item} activeOpacity={0.8} onPress={() => this.selectHandler(item)}> <TouchableOpacity style={styles.item} activeOpacity={0.8} onPress={() => this.selectHandler(item)}>
<Text style={styles.item_text}>借货单号: {item.collect_number}</Text> <Text style={styles.item_text}>借货单号: {item.collect_number}</Text>
<Text style={styles.item_text}> : {item.seller_name || '无'}</Text> <Text style={styles.item_text}> : {item.seller_name || '无'}</Text>
<Text style={styles.item_text}>主治医生: {item.doctor_name || '无'}</Text>
<Text style={styles.item_text}> <Text style={styles.item_text}>
手术日期: {(item.surgery_date && changeDateFormat(item.surgery_date, 'yyyy-MM-dd')) || '无'} 手术日期: {(item.surgery_date && changeDateFormat(item.surgery_date, 'yyyy-MM-dd')) || '无'}
</Text> </Text>
<Text style={styles.item_text}>手术说明: {item.surgery_desc || '无'}</Text> <Text style={styles.item_text} numberOfLines={3}>
{!!item.remark && ( 备注: {item.remark}
<Text style={styles.item_text} numberOfLines={3}> </Text>
{item.remark}
</Text>
)}
</TouchableOpacity> </TouchableOpacity>
) )
} }
...@@ -123,7 +119,7 @@ export default class CollectOrder extends Component { ...@@ -123,7 +119,7 @@ export default class CollectOrder extends Component {
<Image source={require('../../../images/search_icon.png')} style={styles.search_icon} /> <Image source={require('../../../images/search_icon.png')} style={styles.search_icon} />
<TextInput <TextInput
style={styles.search_input} style={styles.search_input}
placeholder="搜索单号、业务员、主治、备注" placeholder="搜索单号、业务员、备注"
onChangeText={ev => { onChangeText={ev => {
this.changeTextHandler(ev) this.changeTextHandler(ev)
}} }}
......
...@@ -65,6 +65,7 @@ import { ...@@ -65,6 +65,7 @@ import {
} from '../../base/ActionTypes'; } from '../../base/ActionTypes';
import ImagePicker from 'react-native-image-picker'; import ImagePicker from 'react-native-image-picker';
import { exitLoginStatus, requestSysProfile } from '../../action/LoginAction'; import { exitLoginStatus, requestSysProfile } from '../../action/LoginAction';
import { isNotBlank, isBlank } from "../../utils/Utils";
import moment from 'moment'; import moment from 'moment';
import PageListArrow from '../common/listDataComponent/PageListArrow'; import PageListArrow from '../common/listDataComponent/PageListArrow';
import * as R from 'ramda'; import * as R from 'ramda';
...@@ -185,7 +186,8 @@ class TransOrderPage extends Component { ...@@ -185,7 +186,8 @@ class TransOrderPage extends Component {
OBS_MOBILE_BOR_WARE_REQUIRED: 0, // APP目标仓库显示及必填权限 OBS_MOBILE_BOR_WARE_REQUIRED: 0, // APP目标仓库显示及必填权限
OBS_MOBILE_TRANS_DEPARTMENT_DISPLAY: 0 OBS_MOBILE_TRANS_DEPARTMENT_DISPLAY: 0
}, },
departments: [] departments: [],
orders: {}
} }
} }
...@@ -599,7 +601,7 @@ class TransOrderPage extends Component { ...@@ -599,7 +601,7 @@ class TransOrderPage extends Component {
// 修改当前选择器数据 // 修改当前选择器数据
changeCurrentOption() { changeCurrentOption() {
let { currentTitle, listOptionData } = this.state let { currentTitle, listOptionData, orders } = this.state
let { transOrderOption } = this.props let { transOrderOption } = this.props
let tempOption = [] let tempOption = []
let that = this let that = this
...@@ -637,6 +639,12 @@ class TransOrderPage extends Component { ...@@ -637,6 +639,12 @@ class TransOrderPage extends Component {
resultArr.push(obj) resultArr.push(obj)
}) })
tempOption = [...resultArr] tempOption = [...resultArr]
const key = `${listOptionData[1].value}_${listOptionData[2].value}`
orders[key] = tempOption
orders[`${key}_source`] = transOrderOption
this.props.navigation.navigate('OrdersPage', {orders: transOrderOption, title: '选择借货订单', selectCallback: this.selectOrderCallback.bind(this)})
return
} }
this.setState({ this.setState({
...@@ -711,7 +719,7 @@ class TransOrderPage extends Component { ...@@ -711,7 +719,7 @@ class TransOrderPage extends Component {
}) })
} }
// 贵州需要不显示组织, 所以只能每个用户只能授权1个组织 // 贵州需要不显示组织, 所以只能每个用户只能授权1个组织
const isShowOrg = R.compose(R.equals('Y'), R.prop('OBS_SHOW_ORG_FLAG'))(this.props.sysProfiles) const isShowOrg = R.compose(R.equals('Y'), R.prop('OBS_SHOW_ORG_FLAG'))(this.props.sysProfiles)
if (!isShowOrg && filterOpt.length > 1) { if (!isShowOrg && filterOpt.length > 1) {
show(`请先选择组织`) show(`请先选择组织`)
...@@ -867,6 +875,16 @@ class TransOrderPage extends Component { ...@@ -867,6 +875,16 @@ class TransOrderPage extends Component {
value: curData.value value: curData.value
} }
}, () => { }, () => {
const {listOptionData, orders} = this.state
const key = listOptionData[1].value + '_' + listOptionData[2].value
if (isNotBlank(orders[key])) {
const orderes = orders[key + '_source']
this.props.navigation.navigate('OrdersPage', {orders: orderes, title: '选择借货订单', selectCallback: this.selectOrderCallback.bind(this)})
return
}
// 在此修改接口 // 在此修改接口
let params = { let params = {
access_token: props.token, access_token: props.token,
...@@ -885,6 +903,19 @@ class TransOrderPage extends Component { ...@@ -885,6 +903,19 @@ class TransOrderPage extends Component {
}) })
} }
} }
/**
* @description: 订单选择回调
* @param {*} order
* @return {*}
*/
selectOrderCallback(order) {
const { listOptionData } = this.state
listOptionData[3].value = order.collect_number
listOptionData[3].name = order.collect_number
this.setState({ listOptionData })
}
// 客户名称选择后,判断目标订单信息是否只有一条数据 // 客户名称选择后,判断目标订单信息是否只有一条数据
async customerGetTargetOrder() { async customerGetTargetOrder() {
let { state, props } = this let { state, props } = this
......
...@@ -42,7 +42,7 @@ import { ...@@ -42,7 +42,7 @@ import {
import HeadBackItem from '../../common/HeadBackItem'; import HeadBackItem from '../../common/HeadBackItem';
import LodingModel from '../../common/LodingModel'; import LodingModel from '../../common/LodingModel';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { show } from '../../../utils/Utils'; import { show, isBlank, isNotBlank } from '../../../utils/Utils';
import { import {
requestTransDetails, requestTransDetails,
requestSubSourBorOrdNum, requestSubSourBorOrdNum,
...@@ -114,6 +114,7 @@ class TransSearchPage extends Component { ...@@ -114,6 +114,7 @@ class TransSearchPage extends Component {
listCurrentOption: [], // 当前选择器数据 listCurrentOption: [], // 当前选择器数据
dateModelPop: false, // 日期选择器 dateModelPop: false, // 日期选择器
currentDateVal: new Date() , // 当前日期值 currentDateVal: new Date() , // 当前日期值
orders: []
} }
} }
...@@ -221,6 +222,7 @@ class TransSearchPage extends Component { ...@@ -221,6 +222,7 @@ class TransSearchPage extends Component {
let { state, props } = this let { state, props } = this
let { subTransObj } = props.navigation.state.params let { subTransObj } = props.navigation.state.params
let that = this let that = this
// 这个setState其实没用了
this.setState({ this.setState({
currentTitle: '来源借货订单号', currentTitle: '来源借货订单号',
currentItem: { currentItem: {
...@@ -228,6 +230,15 @@ class TransSearchPage extends Component { ...@@ -228,6 +230,15 @@ class TransSearchPage extends Component {
value: state.listOptionData[0].value value: state.listOptionData[0].value
} }
}, async () => { }, async () => {
const { orders } = this.state
if (isNotBlank(orders)) {
this.props.navigation.navigate('OrdersPage', {orders, title: '选择借货订单', selectCallback: this.selectOrderCallback.bind(this)})
return
}
let params = { let params = {
access_token: props.token, access_token: props.token,
org_code: subTransObj.org_code, org_code: subTransObj.org_code,
...@@ -254,28 +265,37 @@ class TransSearchPage extends Component { ...@@ -254,28 +265,37 @@ class TransSearchPage extends Component {
show('当前来源借货订单为空') show('当前来源借货订单为空')
return return
} }
let resultArr = []
surgery_collect_headers.forEach(item => { this.setState({orders: surgery_collect_headers})
let obj = {} this.props.navigation.navigate('OrdersPage', {
let collect_number = item.collect_number ? item.collect_number : '空' orders: surgery_collect_headers,
let surgery_name = item.surgery_name ? item.surgery_name : '空' title: '选择借货订单',
let create_time = item.create_time ? moment(item.create_time).format("YYYY-MM-DD") : '空' selectCallback: this.selectOrderCallback.bind(this)
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)
}) })
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(sourResult.error_code === 41006) { } else if(sourResult.error_code === 41006) {
that.changeLodingFlag(false) that.changeLodingFlag(false)
show('登录过期,请重新登录') show('登录过期,请重新登录')
...@@ -289,6 +309,20 @@ class TransSearchPage extends Component { ...@@ -289,6 +309,20 @@ class TransSearchPage extends Component {
}) })
} }
/**
* @description: 订单选择回调
* @param {*} order
* @return {*}
*/
selectOrderCallback(order) {
const { listOptionData } = this.state
listOptionData[0].value = order.collect_number
listOptionData[0].name = order.collect_number
this.setState({ listOptionData }, () => {
this.handleSearchData()
})
}
// 来源借货订单号 扫一扫 // 来源借货订单号 扫一扫
handleSourScanCheck() { handleSourScanCheck() {
this.props.navigation.navigate('BarCodePage', { this.props.navigation.navigate('BarCodePage', {
......
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