Commit 444d2586 by Denglingling

调整正在加载中的交互

(cherry picked from commit 8b1b87ba)
parent 56151aa5
...@@ -17,6 +17,7 @@ import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE ...@@ -17,6 +17,7 @@ import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE
import PageListArrow from '../common/listDataComponent/PageListArrow'; import PageListArrow from '../common/listDataComponent/PageListArrow';
import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect'; import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect';
import LocalVariable from '../common/LocalVariable'; import LocalVariable from '../common/LocalVariable';
import LoadingModel from '../common/listDataComponent/LoadingModel';
class SelfOrderPage extends Component { class SelfOrderPage extends Component {
constructor(props) { constructor(props) {
...@@ -149,14 +150,11 @@ class SelfOrderPage extends Component { ...@@ -149,14 +150,11 @@ class SelfOrderPage extends Component {
} }
componentDidMount() { componentDidMount() {
this.props.setSelectProductOpts([])
this.getSellerName() this.getSellerName()
this.getAudioAuthorize() this.getAudioAuthorize()
} }
componentWillUnmount() {
this.props.setSelectProductOpts([])
}
// 赋值销售员 初始化数据 // 赋值销售员 初始化数据
getSellerName() { getSellerName() {
let { state, props } = this let { state, props } = this
...@@ -281,14 +279,14 @@ class SelfOrderPage extends Component { ...@@ -281,14 +279,14 @@ class SelfOrderPage extends Component {
// 播放录音 // 播放录音
_play = async () => { _play = async () => {
let self = this let that = this
show('正在播放') show('正在播放')
self.whoosh = new Sound(this.state.audioPath, '', (err) => { that.whoosh = new Sound(this.state.audioPath, '', (err) => {
if (err) { if (err) {
show('加载音频失败') show('加载音频失败')
return console.log('加载音频失败-->', err) return console.log('加载音频失败-->', err)
} }
self.whoosh.play(success => { that.whoosh.play(success => {
if (success) { if (success) {
show('播放完毕') show('播放完毕')
} else { } else {
...@@ -318,17 +316,23 @@ class SelfOrderPage extends Component { ...@@ -318,17 +316,23 @@ class SelfOrderPage extends Component {
if (self_list_status != nextProps.self_list_status) { if (self_list_status != nextProps.self_list_status) {
switch (nextProps.self_list_status) { switch (nextProps.self_list_status) {
case SELF_ORDER_LIST_DOING: case SELF_ORDER_LIST_DOING:
// that.refs.LoadingModel.show()
that.changeSubLoding(true) that.changeSubLoding(true)
break; break;
case SELF_ORDER_LIST_SUCCESS: case SELF_ORDER_LIST_SUCCESS:
// that.refs.LoadingModel.hide()
// setTimeout(() => {
// that.changeCurrentOption()
// }, 500) // IOS问题
that.setState({ that.setState({
isSubLoding: false, isSubLoding: false,
lodingTitle: '加载中' lodingTitle: '加载中'
}, () => { },() => {
that.changeCurrentOption() that.changeCurrentOption()
}) })
break; break;
case SELF_ORDER_LIST_FAILURE: case SELF_ORDER_LIST_FAILURE:
// that.refs.LoadingModel.hide()
that.changeSubLoding(false) that.changeSubLoding(false)
break; break;
default: default:
...@@ -347,17 +351,25 @@ class SelfOrderPage extends Component { ...@@ -347,17 +351,25 @@ class SelfOrderPage extends Component {
if (submit_self_order_status != nextProps.submit_self_order_status) { if (submit_self_order_status != nextProps.submit_self_order_status) {
switch (nextProps.submit_self_order_status) { switch (nextProps.submit_self_order_status) {
case SELF_SUBMIT_DOING: case SELF_SUBMIT_DOING:
// that.refs.LoadingModel.show('提交中')
that.changeSubLoding(true, '提交中') that.changeSubLoding(true, '提交中')
break; break;
case SELF_SUBMIT_SUCCESS: case SELF_SUBMIT_SUCCESS:
// setTimeout(() => {
// that.refs.LoadingModel.hide()
// that.processReturnData()
// }, 500) // IOS问题
setTimeout(() => {
that.setState({ that.setState({
isSubLoding: false, isSubLoding: false,
lodingTitle: '提交中' lodingTitle: '提交中'
}, () => { },() => {
that.processReturnData() that.processReturnData()
}) })
}, 500)
break; break;
case SELF_SUBMIT_FAILURE: case SELF_SUBMIT_FAILURE:
// that.refs.LoadingModel.hide()
that.changeSubLoding(false, '提交中') that.changeSubLoding(false, '提交中')
break; break;
default: default:
...@@ -407,6 +419,7 @@ class SelfOrderPage extends Component { ...@@ -407,6 +419,7 @@ class SelfOrderPage extends Component {
let { listOptionData } = this.state let { listOptionData } = this.state
let tempStatus = false let tempStatus = false
let tempTit = '' let tempTit = ''
let curTip = '未选择'
for (let chIndex in listOptionData) { for (let chIndex in listOptionData) {
if (chIndex > 0 && chIndex < 11 && chIndex != 8 if (chIndex > 0 && chIndex < 11 && chIndex != 8
&& !listOptionData[chIndex].value && !listOptionData[chIndex].value
...@@ -414,6 +427,9 @@ class SelfOrderPage extends Component { ...@@ -414,6 +427,9 @@ class SelfOrderPage extends Component {
// 不是主治医生 // 不是主治医生
tempTit = listOptionData[chIndex].title tempTit = listOptionData[chIndex].title
tempStatus = true tempStatus = true
if (chIndex == 6) {
curTip = '未输入'
}
break break
} }
} }
...@@ -421,23 +437,23 @@ class SelfOrderPage extends Component { ...@@ -421,23 +437,23 @@ class SelfOrderPage extends Component {
canSubFlag: !tempStatus canSubFlag: !tempStatus
}) })
if (isSubCheck && tempStatus) { if (isSubCheck && tempStatus) {
show(`${tempTit}未选择,不能提交`) show(`${tempTit}${curTip},不能提交`)
} }
} }
// 选择器弹窗回调函数 // 选择器弹窗回调函数
handleCallBack(item, itemTitle) { handleCallBack(item, itemTitle) {
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this let that = this
listOptionData.map(function (chItem, index) { listOptionData.map(function (chItem, index) {
if (chItem.title === itemTitle) { if (chItem.title === itemTitle) {
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 === '主治医生') {
if (item.name === '其他') { if (item.name === '其他') {
...@@ -448,7 +464,7 @@ class SelfOrderPage extends Component { ...@@ -448,7 +464,7 @@ class SelfOrderPage extends Component {
} }
} }
// if (itemTitle === '手术类型') { // if (itemTitle === '手术类型') {
// self.clearInitNameAndValue(8) // that.clearInitNameAndValue(8)
// } // }
} }
}) })
...@@ -456,7 +472,7 @@ class SelfOrderPage extends Component { ...@@ -456,7 +472,7 @@ class SelfOrderPage extends Component {
currentItem: item, currentItem: item,
listOptionData: listOptionData listOptionData: listOptionData
}, () => { }, () => {
self.changeCanSub() that.changeCanSub()
}) })
} }
...@@ -478,9 +494,9 @@ class SelfOrderPage extends Component { ...@@ -478,9 +494,9 @@ class SelfOrderPage extends Component {
return return
} }
if (currentTitle === '组织') { if (currentTitle === '组织') {
tempOption = this.changeNameAndValue(selfOrderOption, 'org_name', 'org_code') tempOption = that.changeNameAndValue(selfOrderOption, 'org_name', 'org_code')
} else if (currentTitle === '客户名称') { } else if (currentTitle === '客户名称') {
this.setState({ that.setState({
localCustomersOption: selfOrderOption localCustomersOption: selfOrderOption
}) })
// 去重医院数据 // 去重医院数据
...@@ -494,7 +510,7 @@ class SelfOrderPage extends Component { ...@@ -494,7 +510,7 @@ class SelfOrderPage extends Component {
currentArr.push(obj) currentArr.push(obj)
}) })
} }
tempOption = this.changeNameAndValue(currentArr, 'customer_name', 'customer_code') tempOption = that.changeNameAndValue(currentArr, 'customer_name', 'customer_code')
} else if (currentTitle === '手术类型') { } else if (currentTitle === '手术类型') {
let resultArr = [] let resultArr = []
selfOrderOption.forEach(item => { selfOrderOption.forEach(item => {
...@@ -505,16 +521,18 @@ class SelfOrderPage extends Component { ...@@ -505,16 +521,18 @@ class SelfOrderPage extends Component {
}) })
tempOption = [...resultArr] tempOption = [...resultArr]
} else if (currentTitle === '订单类型') { } else if (currentTitle === '订单类型') {
tempOption = this.changeNameAndValue(selfOrderOption, 'value_name', 'value_code') tempOption = that.changeNameAndValue(selfOrderOption, 'value_name', 'value_code')
} }
this.setState({ that.setState({
listCurrentOption: [...tempOption] listCurrentOption: [...tempOption]
}, () => { }, () => {
if (tempOption && tempOption.length === 0) {
show('当前数据为空!')
return
}
// 解决 IOS 弹窗显示问题 // 解决 IOS 弹窗显示问题
setTimeout(() => { setTimeout(() => {
that.setState({ that.handleCloseModal(true)
showTypePop: true
})
}, 500) }, 500)
}) })
} }
...@@ -522,12 +540,14 @@ class SelfOrderPage extends Component { ...@@ -522,12 +540,14 @@ class SelfOrderPage extends Component {
// 修改选择器为属性 name 和 value // 修改选择器为属性 name 和 value
changeNameAndValue(data, nameType, valueType) { changeNameAndValue(data, nameType, valueType) {
let result = [] let result = []
if (data && data.length > 0) {
data.forEach(item => { data.forEach(item => {
let obj = {} let obj = {}
obj.name = item[nameType], obj.name = item[nameType],
obj.value = item[valueType] obj.value = item[valueType]
result.push(obj) result.push(obj)
}) })
}
return result return result
} }
...@@ -551,18 +571,16 @@ class SelfOrderPage extends Component { ...@@ -551,18 +571,16 @@ class SelfOrderPage extends Component {
// 客户名称 点击 // 客户名称 点击
handleCustomerCheck(curData) { handleCustomerCheck(curData) {
// let { state, props } = this let that = this
let self = this
if (this.judgeOrgIsNull()) { if (this.judgeOrgIsNull()) {
self.setState({ that.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value
} }
}, () => { }, () => {
// 在此修改接口 that.getCustomerData()
self.getCustomerData()
}) })
} }
} }
...@@ -619,9 +637,9 @@ class SelfOrderPage extends Component { ...@@ -619,9 +637,9 @@ class SelfOrderPage extends Component {
// 收单地点 点击 // 收单地点 点击
handleBillCheck(curData) { handleBillCheck(curData) {
let { localCustomersOption, listOptionData } = this.state let { localCustomersOption, listOptionData } = this.state
let self = this let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({ that.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
...@@ -641,7 +659,7 @@ class SelfOrderPage extends Component { ...@@ -641,7 +659,7 @@ class SelfOrderPage extends Component {
}) })
} }
tempOption = dedupQuoteArray(tempOption, 'name') tempOption = dedupQuoteArray(tempOption, 'name')
self.setState({ that.setState({
showTypePop: true, showTypePop: true,
listCurrentOption: [...tempOption] listCurrentOption: [...tempOption]
}) })
...@@ -669,9 +687,9 @@ class SelfOrderPage extends Component { ...@@ -669,9 +687,9 @@ class SelfOrderPage extends Component {
// 收货地点 点击 // 收货地点 点击
handleShipCheck(curData) { handleShipCheck(curData) {
let { localCustomersOption, listOptionData } = this.state let { localCustomersOption, listOptionData } = this.state
let self = this let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({ that.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
...@@ -691,7 +709,7 @@ class SelfOrderPage extends Component { ...@@ -691,7 +709,7 @@ class SelfOrderPage extends Component {
}) })
} }
tempOption = dedupQuoteArray(tempOption, 'name') tempOption = dedupQuoteArray(tempOption, 'name')
self.setState({ that.setState({
showTypePop: true, showTypePop: true,
listCurrentOption: [...tempOption] listCurrentOption: [...tempOption]
}) })
...@@ -719,10 +737,10 @@ class SelfOrderPage extends Component { ...@@ -719,10 +737,10 @@ class SelfOrderPage extends Component {
// 主治医生 点击 // 主治医生 点击
handleDoctorCheck(curData) { handleDoctorCheck(curData) {
let { localCustomersOption, listOptionData } = this.state let { localCustomersOption, listOptionData } = this.state
let self = this let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
// 点击 // 点击
self.setState({ that.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
...@@ -747,7 +765,7 @@ class SelfOrderPage extends Component { ...@@ -747,7 +765,7 @@ class SelfOrderPage extends Component {
} }
tempOption.push(othObj) tempOption.push(othObj)
tempOption = dedupQuoteArray(tempOption, 'name') tempOption = dedupQuoteArray(tempOption, 'name')
self.setState({ that.setState({
showTypePop: true, showTypePop: true,
listCurrentOption: [...tempOption] listCurrentOption: [...tempOption]
}) })
...@@ -770,13 +788,16 @@ class SelfOrderPage extends Component { ...@@ -770,13 +788,16 @@ class SelfOrderPage extends Component {
// 手术名称 输入 // 手术名称 输入
handleSurNameInput(text, curData) { handleSurNameInput(text, curData) {
let { listOptionData } = this.state let { listOptionData } = this.state
let that = this
listOptionData.map(function (item) { listOptionData.map(function (item) {
if (item.title === curData.title) { if (item.title === curData.title) {
item.value = text item.value = text
} }
}) })
this.setState({ that.setState({
listOptionData: listOptionData listOptionData: listOptionData
}, () => {
that.changeCanSub()
}) })
} }
...@@ -822,9 +843,9 @@ class SelfOrderPage extends Component { ...@@ -822,9 +843,9 @@ class SelfOrderPage extends Component {
// 手术类型 点击 // 手术类型 点击
handleSurTypeCheck(curData) { handleSurTypeCheck(curData) {
let { props } = this let { props } = this
let self = this let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({ that.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
...@@ -1099,9 +1120,6 @@ class SelfOrderPage extends Component { ...@@ -1099,9 +1120,6 @@ class SelfOrderPage extends Component {
processReturnData() { processReturnData() {
let { selfOrderOption } = this.props let { selfOrderOption } = this.props
let that = this let that = this
that.setState({
isSubLoding: false
})
if (selfOrderOption && selfOrderOption.create_success == 'Y') { if (selfOrderOption && selfOrderOption.create_success == 'Y') {
// 打开下单成功页面 // 打开下单成功页面
that.clearAllData() that.clearAllData()
...@@ -1370,6 +1388,13 @@ class SelfOrderPage extends Component { ...@@ -1370,6 +1388,13 @@ class SelfOrderPage extends Component {
) )
} }
// 返回加载中
renderLodingItemNew() {
return (
<LoadingModel ref="LoadingModel" />
)
}
// 返回提交器械包提示 // 返回提交器械包提示
renderTipModelPackage() { renderTipModelPackage() {
return ( return (
...@@ -1415,6 +1440,7 @@ class SelfOrderPage extends Component { ...@@ -1415,6 +1440,7 @@ class SelfOrderPage extends Component {
</ScrollView> </ScrollView>
{this.renderLodingItem()} {this.renderLodingItem()}
{this.renderLodingItemNew()}
</SafeAreaView> </SafeAreaView>
</View> </View>
......
...@@ -111,6 +111,14 @@ class ChooseProductPage extends Component { ...@@ -111,6 +111,14 @@ class ChooseProductPage extends Component {
let that = this let that = this
let { token, global_domain_config } = that.props let { token, global_domain_config } = that.props
let { topProcOptionList, defalutLeftItem } = this.state let { topProcOptionList, defalutLeftItem } = this.state
if (topItem[LocalVariable.SELECTED_QUQNTITY] !== 0){
that.setState({
topActiveIndex: topIndex
}, () => {
that.handleLeftNav(topItem['leftOptionList'][0], 0)
})
return
}
that.refs.LoadingModel.show() that.refs.LoadingModel.show()
let params = { let params = {
access_token: token, access_token: token,
...@@ -120,7 +128,6 @@ class ChooseProductPage extends Component { ...@@ -120,7 +128,6 @@ class ChooseProductPage extends Component {
let pro_scate_search = await reqProCategorySearch(global_domain_config, params) let pro_scate_search = await reqProCategorySearch(global_domain_config, params)
console.log('res_2 : ', pro_scate_search) console.log('res_2 : ', pro_scate_search)
if (pro_scate_search.error_code === 0) { if (pro_scate_search.error_code === 0) {
if (topItem[LocalVariable.SELECTED_QUQNTITY] === 0) {
let { data } = pro_scate_search let { data } = pro_scate_search
topItem.leftOptionList = defalutLeftItem.concat(data.item) topItem.leftOptionList = defalutLeftItem.concat(data.item)
topItem.leftOptionList.forEach(function (leftObj) { topItem.leftOptionList.forEach(function (leftObj) {
...@@ -128,7 +135,6 @@ class ChooseProductPage extends Component { ...@@ -128,7 +135,6 @@ class ChooseProductPage extends Component {
leftObj[LocalVariable.LOCAL_SECOND_DATA] = [] leftObj[LocalVariable.LOCAL_SECOND_DATA] = []
}) })
topProcOptionList[topIndex] = topItem topProcOptionList[topIndex] = topItem
}
that.setState({ that.setState({
topActiveIndex: topIndex, topActiveIndex: topIndex,
topProcOptionList: topProcOptionList topProcOptionList: topProcOptionList
......
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