Commit fc803436 by Denglingling

【器械消耗】提交接口,以及提示信息;【消耗明细】搜索功能等;

parent f02dea34
......@@ -116,7 +116,6 @@ function requestListDataFail() {
// 获取当前临时存储的明细
export function getSubdetailOption(data) {
console.log('data====!!!!', data)
return {
type: GET_SUB_DETAIL_OPTION,
rawData: data
......@@ -143,11 +142,10 @@ export function requestEquipSumbit({access_token, ...params}) {
dispatch(requestSubmiting());
PostRequest(getUrlParams('/surgery/consume_order/create', {access_token: access_token}), params)
.then(res => {
console.warn('res=====', Object.keys(res));
console.warn('res=====', Object.keys(res), res);
if(res.error_code == 0) {
console.warn('res====requestEquipSumbit==========', res.data);
let { data } = res
dispatch(requestSubmitSuccess(data));
console.warn('res====requestEquipSumbit==========', res);
dispatch(requestSubmitSuccess(res));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
......@@ -182,3 +180,10 @@ function requestSubmitFail() {
type: EQUIP_SUBMIT_FAILURE
}
}
// 初始化数据
export function setEquipInitData() {
return {
type: EQUIP_INIT_DATA
}
}
\ No newline at end of file
......@@ -7,14 +7,14 @@ export function requestLogin(params) {
dispatch(logining());
PostRequest('/access_token/password/search?app_code=PDA', params).then((res) => {
if(res.error_code === 0){
show('登录成功');
show('登录成功', 'success');
dispatch(loginSuccess(res, params.data.user_name, params.data.user_password));
}else {
show(res.error_msg);
show(res.error_msg, 'error');
dispatch(loginFailure())
}
}).catch((err) => {
show(err.error);
show(err.error, 'error');
})
}
}
......@@ -67,11 +67,11 @@ export function autoLogin(params) {
dispatch(autoLoginSuccess(res))
}else {
console.warn(res.error_msg);
show(res.error_msg);
show(res.error_msg, 'error');
dispatch(autoLoginFailure())
}
}).catch((err) => {
show(err.error);
show(err.error, 'error');
})
}
}
\ No newline at end of file
......@@ -99,6 +99,7 @@ class ConsumDetailsPage extends Component {
// select: false
// }
],
allConOption: [], // 所有数据(未筛选过的)
selectShowPopup: false, // 共计已选弹窗
localSelectOption: [], // 已选数据
isSubLoding: true, // 加载中弹窗
......@@ -133,7 +134,8 @@ class ConsumDetailsPage extends Component {
})
this.setState({
isSubLoding: false,
conDetaOption: lines
conDetaOption: lines,
allConOption: lines
})
this.changeIsSelected()
} else if(detailResult.error_code === 41006) {
......@@ -147,6 +149,30 @@ class ConsumDetailsPage extends Component {
}
}
// 搜索 输入
handleSearchInput(text) {
console.log('搜索 输入---', text)
let {allConOption} = this.state
let self = this
let tempArr = []
if(text) {
allConOption.forEach(item => {
let itemStr = JSON.stringify(item)
if(itemStr.indexOf(text) != -1) {
// 满足搜索条件
tempArr.push(item)
}
})
} else {
tempArr = [...allConOption]
}
this.setState({
conDetaOption: tempArr
}, () => {
self.changeIsSelected()
})
}
// 修改加载中
changeLodingFlag(show) {
this.setState({
......@@ -169,14 +195,13 @@ class ConsumDetailsPage extends Component {
// 修改 当前已选择
changeIsSelected(ind, selFlag) {
let {conDetaOption} = this.state
if(ind) {
if(ind != undefined) {
conDetaOption[ind].select = selFlag
}
let that = this
this.setState({
conDetaOption
},() => {
// let {conDetaOption} = this.state
console.log('conDetaOption---修改-', conDetaOption)
let tempArr = []
conDetaOption.forEach(item => {
......@@ -186,8 +211,6 @@ class ConsumDetailsPage extends Component {
})
that.setState({
localSelectOption: tempArr
}, () => {
console.log('this.localSelectOption--!!2--that====' , that.state.localSelectOption)
})
})
}
......@@ -195,7 +218,6 @@ class ConsumDetailsPage extends Component {
// 已选回调函数
detailsCallbak(subOpt) {
console.log('----回调:',subOpt)
// let {conDetaOption} = this.state
let tempOption = [...this.state.conDetaOption]
// 获取当前已选值
tempOption = tempOption.map(item => {
......@@ -233,10 +255,7 @@ class ConsumDetailsPage extends Component {
handleSubmit() {
console.warn('确定耗材', this.props.navigation.navigate)
this.handleCloseSelectModal(false)
console.warn('携带数据,填写单价') // 可存储于store中!!!
let {localSelectOption} = this.state
if(!localSelectOption.length) {
show('请选择耗材')
return
......@@ -256,6 +275,7 @@ class ConsumDetailsPage extends Component {
placeholder={'请输入搜索关键词'}
style={list_common_item.ser_text_input}
defaultValue={this.state.searchValue}
onChangeText={(text) => this.handleSearchInput(text)}
/>
<View style={list_common_item.ser_img_box}>
<Image source={require('../../../images/search_icon.png')} style={icon_style}/>
......@@ -266,7 +286,6 @@ class ConsumDetailsPage extends Component {
// 返回中间主要内容
renderContItem() {
// let {conDetaOption} = this.state
return (
<ScrollView
style={styles.cons_cont_scroll}
......
......@@ -16,7 +16,7 @@ const defaultState = {
equip_list_status: EQUIP_CONSU_LIST_NO, // 获取数据状态
submit_equip_order_status: EQUIP_SUBMIT_NO, // 提交订单状态
equipOrderOption: {}, // 当前选择器临时存储数据
subDetOption: {}, // 选择的消耗明细数据
subDetOption: [], // 选择的消耗明细数据
}
export default equip = (state = defaultState, action) => {
......@@ -54,10 +54,9 @@ export default equip = (state = defaultState, action) => {
equip_list_status: EQUIP_CONSU_LIST_NO,
submit_equip_order_status: EQUIP_SUBMIT_NO,
equipOrderOption: {},
subDetOption: {}
subDetOption: []
})
case GET_SUB_DETAIL_OPTION:
console.log('----??----存储啦吗??', action.rawData)
return Object.assign({}, state, {
subDetOption: action.rawData
})
......
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