Commit bdb925d7 by peii

自助下单实现订单类型接口

parent 170695bb
......@@ -12,6 +12,7 @@ import {
SET_SELECT_PRODUCT_OPTS
} from '../base/ActionTypes';
import local_inter_mock from '../containers/selfOrder/module/mock/inter_mock'
import * as R from 'ramda'
// 获取组织 params={access_token:''}
export function requestSelfOrganizations(params) {
......@@ -126,33 +127,42 @@ export const reqSelfSurgeryHospital = async (global_domain_config, params) => {
}
// 获取订单类型 params={access_token:'', value_set_code:'SUR_ORDER_TYPE'}
export function requestSelfOrderType(params) {
export function requestSelfOrderType(params, url) {
return (dispatch, getState) => {
dispatch(requestListDataing());
let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params))
// GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params))
if (!url) {
url = '/system/order_type/search'
}
GetRequest(global_domain_config, getUrlParams(url, params))
.then(res => {
console.log('获取订单类型 res=====', res);
// 兼容老的接口,有的环境没有实现获取订单类型接口
if (res.status === 404) {
return dispatch(requestSelfOrderType(params, '/system/value_set/search'))
}
if(res.error_code == 0) {
let { data: { sys_values } } = res
dispatch(requestListDataSuccess(sys_values));
let data = []
if (R.includes('order_type', url)) {
data = R.map(R.applySpec({
value_name: R.prop('order_type_name'),
value_code: R.prop('order_type_code'),
}))(res.data)
} else {
data = res.data.sys_values
}
dispatch(requestListDataSuccess(data));
}else {
showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail)
}
// else if(res.error_code === 41006) {
// show('登录过期,请重新登录');
// dispatch(exitLoginStatus());
// } else {
// let error_msg = res.error_msg || res.message
// show(error_msg);
// dispatch(requestListDataFail());
// }
})
.catch(err => {
if (!url) {
requestSelfOrderType(params, '/system/value_set/search')
} else {
showErrorMessage(dispatch, err, requestListDataFail, '获取订单类型')
// console.log('------err--====获取订单类型----', Object.keys(err), err)
// show(err.error);
// dispatch(requestListDataFail());
}
})
}
}
......
......@@ -30,7 +30,7 @@ class FillDomainModel extends Component {
super(props);
this.state = {
isVisible: false,
defaDomainHead: 'http://',
defaDomainHead: 'https://',
domainValue: '',
isNull: false
}
......
......@@ -1221,6 +1221,7 @@ class SelfOrderPage extends Component {
// 订单类型 点击
handleOrderCheck(curData) {
let { props } = this
const { listOptionData } = this.state
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({
currentTitle: curData.title,
......@@ -1231,7 +1232,9 @@ class SelfOrderPage extends Component {
}, () => {
let params = {
access_token: props.token,
value_set_code: 'SUR_ORDER_TYPE'
value_set_code: 'SUR_ORDER_TYPE',
org_code: listOptionData[1].value,
order_type: 'SUR_ORDER_TYPE'
}
props.requestSelfOrderType(params)
})
......
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