Commit 6b897e07 by Denglingling

优化【消耗确认】,新增单价支持 0 ,以及相关订单排序规则

parent 04f673b6
...@@ -9,7 +9,7 @@ import { dedupQuoteArray, show, formatStrForDate, cloneObject } from '../../util ...@@ -9,7 +9,7 @@ import { dedupQuoteArray, show, formatStrForDate, cloneObject } from '../../util
import DateModel from '../common/DateModel'; import DateModel from '../common/DateModel';
import DialogModel from '../common/DialogModel'; import DialogModel from '../common/DialogModel';
import ZoomPictureModel from '../common/ZoomPictureModel'; import ZoomPictureModel from '../common/ZoomPictureModel';
import { requestEquipOrganizations, requestEquipSurgeryHospital, requestEquipOrderInfo, uploadEquipImg, setSubdetailOption, setCharDetailsOption, requestEquipSumbit, setEquipInitData, reqEquipSurgeryHospital, reqEquipOrderInfo, requestListDataSuccess } from '../../action/EquipAction'; import { requestEquipOrganizations, requestEquipSurgeryHospital, requestEquipOrderInfo, uploadEquipImg, setSubdetailOption, setCharDetailsOption, requestEquipSumbit, setEquipInitData, reqEquipSurgeryHospital, reqEquipOrderInfo, requestListDataSuccess, reqEquipOrganizations, requestEquipDetails } from '../../action/EquipAction';
import { EQUIP_CONSU_LIST_DOING, EQUIP_CONSU_LIST_SUCCESS, EQUIP_CONSU_LIST_FAILURE, LOGIN_NO, EQUIP_SUBMIT_DOING, EQUIP_SUBMIT_SUCCESS, EQUIP_SUBMIT_FAILURE } from '../../base/ActionTypes'; import { EQUIP_CONSU_LIST_DOING, EQUIP_CONSU_LIST_SUCCESS, EQUIP_CONSU_LIST_FAILURE, LOGIN_NO, EQUIP_SUBMIT_DOING, EQUIP_SUBMIT_SUCCESS, EQUIP_SUBMIT_FAILURE } from '../../base/ActionTypes';
import moment from 'moment'; import moment from 'moment';
import ImagePicker from 'react-native-image-picker'; import ImagePicker from 'react-native-image-picker';
...@@ -165,6 +165,7 @@ class EquipConsuPage extends Component { ...@@ -165,6 +165,7 @@ class EquipConsuPage extends Component {
componentDidMount() { componentDidMount() {
this.getSellerName() this.getSellerName()
this.initSetOptsValue() this.initSetOptsValue()
this.getOrganizationData()
} }
// 赋值销售员 // 赋值销售员
...@@ -197,18 +198,18 @@ class EquipConsuPage extends Component { ...@@ -197,18 +198,18 @@ class EquipConsuPage extends Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
let { equip_list_status, loginState, navigation, subDetOption, charDetailOption, submit_equip_order_status} = this.props let { equip_list_status, loginState, navigation, subDetOption, charDetailOption, submit_equip_order_status} = this.props
let self = this let that = this
if(equip_list_status != nextProps.equip_list_status) { if(equip_list_status != nextProps.equip_list_status) {
switch (nextProps.equip_list_status) { switch (nextProps.equip_list_status) {
case EQUIP_CONSU_LIST_DOING: case EQUIP_CONSU_LIST_DOING:
this.changeSubLoding(true) this.changeSubLoding(true)
break; break;
case EQUIP_CONSU_LIST_SUCCESS: case EQUIP_CONSU_LIST_SUCCESS:
self.setState({ that.setState({
isSubLoding: false, isSubLoding: false,
lodingTitle: '加载中' lodingTitle: '加载中'
},() => { },() => {
self.changeCurrentOption() that.changeCurrentOption()
}) })
break; break;
case EQUIP_CONSU_LIST_FAILURE: case EQUIP_CONSU_LIST_FAILURE:
...@@ -233,7 +234,7 @@ class EquipConsuPage extends Component { ...@@ -233,7 +234,7 @@ class EquipConsuPage extends Component {
this.setState({ this.setState({
listOptionData listOptionData
},() => { },() => {
self.changeCanSub() that.changeCanSub()
}) })
} }
if(charDetailOption != nextProps.charDetailOption){ if(charDetailOption != nextProps.charDetailOption){
...@@ -249,12 +250,20 @@ class EquipConsuPage extends Component { ...@@ -249,12 +250,20 @@ class EquipConsuPage extends Component {
this.changeSubLoding(true, '提交中') this.changeSubLoding(true, '提交中')
break; break;
case EQUIP_SUBMIT_SUCCESS: case EQUIP_SUBMIT_SUCCESS:
self.setState({ // that.setState({
// isSubLoding: false,
// lodingTitle: '提交中'
// },() => {
// that.processReturnData()
// })
setTimeout(() => {
that.setState({
isSubLoding: false, isSubLoding: false,
lodingTitle: '提交中' lodingTitle: '提交中'
},() => { }, () => {
self.processReturnData() that.processReturnData()
}) })
}, 500)
break; break;
case EQUIP_SUBMIT_FAILURE: case EQUIP_SUBMIT_FAILURE:
this.changeSubLoding(false, '提交中') this.changeSubLoding(false, '提交中')
...@@ -342,7 +351,7 @@ class EquipConsuPage extends Component { ...@@ -342,7 +351,7 @@ class EquipConsuPage extends Component {
// 选择器弹窗回调函数 // 选择器弹窗回调函数
handleCallBack(item, itemTitle) { handleCallBack(item, itemTitle) {
let { listOptionData} = this.state let { listOptionData} = this.state
let self = this let that = this
this.setState({ this.setState({
currentItem: item, currentItem: item,
}) })
...@@ -352,19 +361,20 @@ class EquipConsuPage extends Component { ...@@ -352,19 +361,20 @@ class EquipConsuPage extends Component {
chItem.name = item.name chItem.name = item.name
chItem.value = item.value chItem.value = item.value
if(itemTitle === '组织') { if(itemTitle === '组织') {
self.clearInitNameAndValue(1) that.clearInitNameAndValue(1)
} }
if(itemTitle === '客户名称') { if(itemTitle === '客户名称') {
self.clearInitNameAndValue(2) that.clearInitNameAndValue(2)
} }
if(itemTitle === '订单信息') { if(itemTitle === '订单信息') {
self.clearInitNameAndValue(3) that.clearInitNameAndValue(3)
that.getCurOrderDetail()
} }
} }
return chItem return chItem
}) })
}, () => { }, () => {
self.changeCanSub() that.changeCanSub()
}) })
} }
...@@ -455,20 +465,54 @@ class EquipConsuPage extends Component { ...@@ -455,20 +465,54 @@ class EquipConsuPage extends Component {
props.requestEquipOrganizations(params) props.requestEquipOrganizations(params)
}) })
} }
async getOrganizationData() {
let { state, props } = this
let params = {
access_token: props.token
}
let that = this
let { global_domain_config } = props
let orgResult = await reqEquipOrganizations(global_domain_config, params);
if (orgResult.error_code == 0) {
let { data: { organizations } } = orgResult
let { listOptionData } = state
// props.requestListDataSuccess(organizations)
let filterOpt = dedupQuoteArray(organizations, 'org_code')
if (filterOpt.length === 0) {
show(`当前${listOptionData[1].title}为空`)
return
}
if (filterOpt.length === 1) {
listOptionData[1].name = filterOpt[0].org_name
listOptionData[1].value = filterOpt[0].org_code
that.setState({
listOptionData
}, () => {
that.organizationGetCustomerData()
})
}
} else if (orgResult.error_code == 41006) {
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
let error_msg = orgResult.error_msg || orgResult.message
show(error_msg);
}
}
// 客户名称 点击 // 客户名称 点击
handleCustomerCheck() { handleCustomerCheck() {
let { state } = this let { state } = this
let self = this let that = this
if(this.judgeOrgIsNull()) { if(this.judgeOrgIsNull()) {
self.setState({ that.setState({
currentTitle: '客户名称', currentTitle: '客户名称',
currentItem: { currentItem: {
name: state.listOptionData[2].name, name: state.listOptionData[2].name,
value: state.listOptionData[2].value value: state.listOptionData[2].value
} }
}, () => { }, () => {
self.getCustomerData() that.getCustomerData()
}) })
} }
} }
...@@ -497,14 +541,14 @@ class EquipConsuPage extends Component { ...@@ -497,14 +541,14 @@ class EquipConsuPage extends Component {
let cusResult = await reqEquipSurgeryHospital(global_domain_config, params); let cusResult = await reqEquipSurgeryHospital(global_domain_config, params);
if(cusResult.error_code == 0) { if(cusResult.error_code == 0) {
let { data: { customers } } = cusResult let { data: { customers } } = cusResult
props.requestListDataSuccess(customers) let { listOptionData } = state
// props.requestListDataSuccess(customers)
let filterOpt = dedupQuoteArray(customers, 'customer_code') let filterOpt = dedupQuoteArray(customers, 'customer_code')
if(filterOpt.length === 0) { if(filterOpt.length === 0) {
show(`当前客户名称为空`) show(`当前${listOptionData[2].title}为空`)
return return
} }
if(filterOpt.length === 1) { if(filterOpt.length === 1) {
let { listOptionData } = state
listOptionData[2].name = filterOpt[0].customer_name listOptionData[2].name = filterOpt[0].customer_name
listOptionData[2].value = filterOpt[0].customer_code listOptionData[2].value = filterOpt[0].customer_code
that.setState({ that.setState({
...@@ -560,13 +604,13 @@ class EquipConsuPage extends Component { ...@@ -560,13 +604,13 @@ class EquipConsuPage extends Component {
let cusResult = await reqEquipOrderInfo(global_domain_config, params); let cusResult = await reqEquipOrderInfo(global_domain_config, params);
if(cusResult.error_code == 0) { if(cusResult.error_code == 0) {
let { data: { surgery_collect_headers } } = cusResult let { data: { surgery_collect_headers } } = cusResult
let { listOptionData } = state
props.requestListDataSuccess(surgery_collect_headers) props.requestListDataSuccess(surgery_collect_headers)
if(surgery_collect_headers.length === 0) { if(surgery_collect_headers.length === 0) {
show(`当前订单信息为空`) show(`当前${listOptionData[3].title}为空`)
return return
} }
if(surgery_collect_headers.length === 1) { if(surgery_collect_headers.length === 1) {
let { listOptionData } = state
let collect_number = surgery_collect_headers[0].collect_number ? surgery_collect_headers[0].collect_number : '空' let collect_number = surgery_collect_headers[0].collect_number ? surgery_collect_headers[0].collect_number : '空'
let surgery_name = surgery_collect_headers[0].surgery_name ? surgery_collect_headers[0].surgery_name : '空' let surgery_name = surgery_collect_headers[0].surgery_name ? surgery_collect_headers[0].surgery_name : '空'
let create_time = surgery_collect_headers[0].create_time ? moment(surgery_collect_headers[0].create_time).format("YYYY-MM-DD") : '空' let create_time = surgery_collect_headers[0].create_time ? moment(surgery_collect_headers[0].create_time).format("YYYY-MM-DD") : '空'
...@@ -575,6 +619,8 @@ class EquipConsuPage extends Component { ...@@ -575,6 +619,8 @@ class EquipConsuPage extends Component {
listOptionData[3].value = surgery_collect_headers[0].collect_number listOptionData[3].value = surgery_collect_headers[0].collect_number
that.setState({ that.setState({
listOptionData listOptionData
}, () => {
that.getCurOrderDetail()
}) })
} }
} else if(cusResult.error_code == 41006) { } else if(cusResult.error_code == 41006) {
...@@ -586,6 +632,37 @@ class EquipConsuPage extends Component { ...@@ -586,6 +632,37 @@ class EquipConsuPage extends Component {
} }
} }
// 获取当前订单的消耗明细
async getCurOrderDetail() {
let {listOptionData} = this.state
let {global_domain_config} = this.props
let cur_collect_number = listOptionData[3].value
if(cur_collect_number){
let params = {
access_token: this.props.token,
surgery_collect_number: cur_collect_number
}
let detailResult = await requestEquipDetails(global_domain_config, params)
console.log('消耗明细 res===', detailResult)
if(detailResult.error_code === 0) {
let {lines} = detailResult.data
// 需要过滤已提过消耗的数据 raised_consume="Y"
lines = lines.filter((fiItem) => {
return fiItem.raised_consume != 'Y'
})
if(lines.length == 0) {
show('当前订单无明细数据,请重新选择订单!')
}
} else if(detailResult.error_code === 41006) {
show('登录过期,请重新登录');
this.props.exitLoginStatus()
} else {
let error_msg = detailResult.error_msg || detailResult.message
show(error_msg);
}
}
}
// 消耗时间 点击 // 消耗时间 点击
handleEquipDateCheck() { handleEquipDateCheck() {
let { listOptionData } = this.state let { listOptionData } = this.state
...@@ -613,7 +690,7 @@ class EquipConsuPage extends Component { ...@@ -613,7 +690,7 @@ class EquipConsuPage extends Component {
// 修改当前日期数据 // 修改当前日期数据
dateModalCallback(date) { dateModalCallback(date) {
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this let that = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '消耗时间') { if(item.title === '消耗时间') {
...@@ -624,14 +701,14 @@ class EquipConsuPage extends Component { ...@@ -624,14 +701,14 @@ class EquipConsuPage extends Component {
return item return item
}) })
},() => { },() => {
self.changeCanSub() that.changeCanSub()
}) })
} }
// 患者姓名 输入 // 患者姓名 输入
handlePatNameInput(text) { handlePatNameInput(text) {
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this let that = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '患者姓名') { if(item.title === '患者姓名') {
...@@ -640,23 +717,23 @@ class EquipConsuPage extends Component { ...@@ -640,23 +717,23 @@ class EquipConsuPage extends Component {
return item return item
}) })
},() => { },() => {
self.changeCanSub() that.changeCanSub()
}) })
} }
// 性别 点击 // 性别 点击
handleGenderCheck() { handleGenderCheck() {
let { listOptionData, sexTypeOption } = this.state let { listOptionData, sexTypeOption } = this.state
let self = this let that = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({ that.setState({
currentTitle: '性别', currentTitle: '性别',
currentItem: { currentItem: {
name: listOptionData[6].name, name: listOptionData[6].name,
value: listOptionData[6].value value: listOptionData[6].value
} }
}, () => { }, () => {
self.setState({ that.setState({
showTypePop: true, showTypePop: true,
listCurrentOption: [...sexTypeOption] listCurrentOption: [...sexTypeOption]
}) })
...@@ -667,7 +744,7 @@ class EquipConsuPage extends Component { ...@@ -667,7 +744,7 @@ class EquipConsuPage extends Component {
// 年龄 输入 // 年龄 输入
handleAgeInput(text) { handleAgeInput(text) {
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this let that = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '年龄') { if(item.title === '年龄') {
...@@ -676,14 +753,14 @@ class EquipConsuPage extends Component { ...@@ -676,14 +753,14 @@ class EquipConsuPage extends Component {
return item return item
}) })
},() => { },() => {
self.changeCanSub() that.changeCanSub()
}) })
} }
// 床位 输入 // 床位 输入
handleBedInput(text) { handleBedInput(text) {
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this let that = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '床位') { if(item.title === '床位') {
...@@ -692,14 +769,14 @@ class EquipConsuPage extends Component { ...@@ -692,14 +769,14 @@ class EquipConsuPage extends Component {
return item return item
}) })
},() => { },() => {
self.changeCanSub() that.changeCanSub()
}) })
} }
// 病历号 输入 // 病历号 输入
handleRecordNumInput(text) { handleRecordNumInput(text) {
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this let that = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(item.title === '病历号') { if(item.title === '病历号') {
...@@ -708,7 +785,7 @@ class EquipConsuPage extends Component { ...@@ -708,7 +785,7 @@ class EquipConsuPage extends Component {
return item return item
}) })
},() => { },() => {
self.changeCanSub() that.changeCanSub()
}) })
} }
......
...@@ -73,7 +73,7 @@ class ChargeDetailsPage extends Component { ...@@ -73,7 +73,7 @@ class ChargeDetailsPage extends Component {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
let { data: { sys_values } } = charRes let { data: { sys_values } } = charRes
if (sys_values.length === 0) { if (sys_values.length === 0) {
that.showErrorModel(`当前费用类型为空,联系管理员配置!`) show(`当前费用类型为空,联系管理员配置!`)
return return
} }
let resultArr = [] let resultArr = []
...@@ -89,12 +89,12 @@ class ChargeDetailsPage extends Component { ...@@ -89,12 +89,12 @@ class ChargeDetailsPage extends Component {
}) })
} else if (charRes.error_code == 41006) { } else if (charRes.error_code == 41006) {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
that.showErrorModel(`登录过期,请重新登录`) show(`登录过期,请重新登录`)
props.exitLoginStatus(); props.exitLoginStatus();
} else { } else {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
let error_msg = charRes.error_msg || charRes.message let error_msg = charRes.error_msg || charRes.message
that.showErrorModel(error_msg); show(error_msg);
} }
} }
......
...@@ -71,7 +71,7 @@ class ConsumDetailsPage extends Component { ...@@ -71,7 +71,7 @@ class ConsumDetailsPage extends Component {
return fiItem.raised_consume != 'Y' return fiItem.raised_consume != 'Y'
}) })
if(lines.length == 0) { if(lines.length == 0) {
show('当前明细数据为空,请重新选择订单') show('当前订单无明细数据,请重新选择订单!')
} else { } else {
let {subDetOption} = this.props // 【器械消耗】已存在的明细 let {subDetOption} = this.props // 【器械消耗】已存在的明细
lines.length && lines.forEach((chItem, chInd) => { lines.length && lines.forEach((chItem, chInd) => {
...@@ -104,7 +104,7 @@ class ConsumDetailsPage extends Component { ...@@ -104,7 +104,7 @@ class ConsumDetailsPage extends Component {
// 搜索 输入 // 搜索 输入
handleSearchInput(text) { handleSearchInput(text) {
let { allConOption } = this.state let { allConOption } = this.state
let self = this let that = this
let tempArr = [] let tempArr = []
if(text) { if(text) {
allConOption.forEach(item => { allConOption.forEach(item => {
...@@ -120,7 +120,7 @@ class ConsumDetailsPage extends Component { ...@@ -120,7 +120,7 @@ class ConsumDetailsPage extends Component {
this.setState({ this.setState({
conDetaOption: tempArr conDetaOption: tempArr
}, () => { }, () => {
self.changeIsSelected() that.changeIsSelected()
}) })
} }
......
...@@ -42,21 +42,34 @@ class FillUnitPricePage extends Component { ...@@ -42,21 +42,34 @@ class FillUnitPricePage extends Component {
let {unitPriceOption} = this.state let {unitPriceOption} = this.state
let canSubFlag = true let canSubFlag = true
let {props} = this let {props} = this
let cur_zero = []
let cur_timer = 0
for(let i in unitPriceOption) { for(let i in unitPriceOption) {
if(!unitPriceOption[i].local_add_price) { if(!unitPriceOption[i].local_add_price) {
if(unitPriceOption[i].local_add_price === 0){
cur_zero.push(parseInt(i)+1)
unitPriceOption[i].sale_price = unitPriceOption[i].local_add_price
}else {
show('请填写完单价!') show('请填写完单价!')
canSubFlag = false canSubFlag = false
break break
} }
}
unitPriceOption[i].sale_price = unitPriceOption[i].local_add_price unitPriceOption[i].sale_price = unitPriceOption[i].local_add_price
} }
if(cur_zero.length > 0){
show(`请确认当前第${cur_zero.join('、')}个明细单价为0!`)
cur_timer = 500
}
if(canSubFlag) { if(canSubFlag) {
this.setState({ this.setState({
unitPriceOption unitPriceOption
}) })
// 存储于store中,并跳转 // 存储于store中,并跳转
props.setSubdetailOption(unitPriceOption) props.setSubdetailOption(unitPriceOption)
setTimeout(() => {
props.navigation.navigate('EquipConsuPage', { title: '器械消耗' }) props.navigation.navigate('EquipConsuPage', { title: '器械消耗' })
}, cur_timer)
} }
} }
...@@ -81,7 +94,7 @@ class FillUnitPricePage extends Component { ...@@ -81,7 +94,7 @@ class FillUnitPricePage extends Component {
// 返回每一列元素 // 返回每一列元素
renderSubListItem(item, index) { renderSubListItem(item, index) {
let price = '' let price = ''
if(item.local_add_price) { if(item.local_add_price || item.local_add_price === 0) {
price = String(item.local_add_price) price = String(item.local_add_price)
} }
return( return(
......
...@@ -124,6 +124,7 @@ class LineOrderPage extends Component { ...@@ -124,6 +124,7 @@ class LineOrderPage extends Component {
surgery_collect_number: supData.local_his_number surgery_collect_number: supData.local_his_number
} }
let bowResult = await requestGetLineFormBorrow(props.global_domain_config, params) let bowResult = await requestGetLineFormBorrow(props.global_domain_config, params)
console.log('获取借货订单行数据 res=====', bowResult)
if(bowResult.error_code == 0) { if(bowResult.error_code == 0) {
that.changeSubLoding(false) that.changeSubLoding(false)
// 成功 // 成功
...@@ -161,6 +162,7 @@ class LineOrderPage extends Component { ...@@ -161,6 +162,7 @@ class LineOrderPage extends Component {
consume_order_number: supData.local_his_number consume_order_number: supData.local_his_number
} }
let conResult = await requestGetLineFormConsume(props.global_domain_config, params) let conResult = await requestGetLineFormConsume(props.global_domain_config, params)
console.log('获取消耗订单行数据 res=====', conResult)
if(conResult.error_code == 0) { if(conResult.error_code == 0) {
that.changeSubLoding(false) that.changeSubLoding(false)
// 成功 // 成功
...@@ -205,6 +207,7 @@ class LineOrderPage extends Component { ...@@ -205,6 +207,7 @@ class LineOrderPage extends Component {
source_surgery_order_number: supData.source_surgery_order_number source_surgery_order_number: supData.source_surgery_order_number
} }
let conResult = await requestGetLineFormTrans(props.global_domain_config, params) let conResult = await requestGetLineFormTrans(props.global_domain_config, params)
console.log('获取转单订单行数据 res=====', conResult)
if(conResult.error_code == 0) { if(conResult.error_code == 0) {
that.changeSubLoding(false) that.changeSubLoding(false)
// 成功 // 成功
......
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