Commit 3a87b630 by peii

客户业务员自助下单

parent aaa73541
......@@ -140,7 +140,7 @@ android {
}
buildTypes {
debug {
resValue "string", "CodePushDeploymentKey", '"OQxOHKC_pU5KPExPvQLLfeOdhO4_zss5pKduM"'
resValue "string", "CodePushDeploymentKey", '""'
resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis())
}
release {
......@@ -162,7 +162,7 @@ android {
resValue "string", "baseUrl", '"https://obs.uat.guke.tech"'
}
xhk {
resValue "string", "baseUrl", '"https://obs.xhk.orth.tech"'
resValue "string", "baseUrl", '"https://obs.dev.xhk.guke.tech"'
}
bjzr {
resValue "string", "baseUrl", '"https://hos.dev.bjhh.guke.tech"'
......
......@@ -1266,6 +1266,40 @@ class SelfOrderPage extends Component {
// 选择产品 点击跳转
handleProductCheck() {
const { localCustomersOption, listOptionData } = this.state
console.log(localCustomersOption);
if (isBlank(listOptionData[2].value) || isBlank(listOptionData[3].value) || isBlank(listOptionData[4].value)) {
return show('请先选择客户相关信息')
}
const customer = R.find(R.propEq('customer_code', listOptionData[2].value))(localCustomersOption)
const billToSite = R.find(R.propEq('bill_to_site_code', listOptionData[3].value))(customer.bill_to_sites)
const shipToSites = R.filter(R.propEq('ship_to_site_code', listOptionData[4].value))(billToSite.ship_to_sites)
const productAuthorization = R.pathOr('N', [0, 'sal_seller_customer_product_authorization'])(shipToSites)
let authorizations = []
if (productAuthorization === 'Y') {
const auths = R.compose(R.unnest, R.pluck('authorization'))(shipToSites)
const suppliers = R.groupBy(R.prop('supplier_code'))(auths)
authorizations = R.compose(
R.map(key => {
const values = suppliers[key]
return {
product_line_category_list: R.compose(
R.uniqBy(R.prop('product_line_category_code')),
R.unnest,
R.pluck('product_line_category_list')
)(values),
supplier_code: R.pathOr('', [0, 'supplier_code'])(values),
supplier_name: R.pathOr('', [0, 'supplier_name'])(values),
}
}),
R.keys,
R.clone
)(suppliers)
}
if (this.judgeOrgIsNull()) {
let { listOptionData } = this.state
let that = this
......@@ -1273,7 +1307,9 @@ class SelfOrderPage extends Component {
title: `选择产品`,
selfData: {
org_code: listOptionData[1].value,
doctor_name: (listOptionData[5].name == '其他' || listOptionData[5].name == '请选择') ? listOptionData[5].inputValue : listOptionData[5].name
doctor_name: (listOptionData[5].name == '其他' || listOptionData[5].name == '请选择') ? listOptionData[5].inputValue : listOptionData[5].name,
authorizations,
productAuthorization
},
productCallBack: that.productCallBack.bind(that)
})
......
......@@ -77,22 +77,27 @@ class ChooseProductPage extends Component {
options: [],
value: '',
type: 'select'
}]
}],
productAuthorization: 'N',
authorizations: []
}
this.inputSearchValue = debounce(this.inputSearchValue.bind(this), 500)
}
componentDidMount() {
this.initGetData()
const {authorizations = [], productAuthorization = 'N'} = R.pathOr({}, ['state', 'params', 'selfData'])(this.props.navigation)
this.setState({authorizations, productAuthorization}, () => {
this.initGetData()
})
}
// 返回
handleGoBack() {
let { topProcOptionList } = this.state
let { topProcOptionList, originManufacterList } = this.state
let { setSelectProductOpts } = this.props
setSelectProductOpts(topProcOptionList)
this.props.navigation.state.params.productCallBack(topProcOptionList)
setSelectProductOpts(originManufacterList)
this.props.navigation.state.params.productCallBack(originManufacterList)
this.props.navigation.goBack()
}
......@@ -100,12 +105,24 @@ class ChooseProductPage extends Component {
async initGetData() {
let that = this
let { token, global_domain_config, navigation, local_sele_pro_options } = that.props
let { productAuthorization, authorizations } = this.state
if (local_sele_pro_options && local_sele_pro_options.length > 0) {
let list = local_sele_pro_options
if (productAuthorization === 'Y') {
const filterSuppliers = R.pluck('supplier_code', authorizations)
if (isNotBlank(filterSuppliers)) {
list = R.filter(R.propSatisfies(R.includes(R.__, filterSuppliers), 'supplier_code'))(local_sele_pro_options)
}
}
// 之前选择过值
that.setState({
topProcOptionList: local_sele_pro_options
topProcOptionList: list,
originManufacterList: local_sele_pro_options
}, () => {
that.handleTopNav(local_sele_pro_options[0], 0)
that.handleTopNav(list[0], 0)
})
return
}
......@@ -135,8 +152,18 @@ class ChooseProductPage extends Component {
topObj.supplier_short_name = topObj.supplier_name.substring(0, 3)
}
})
let list = topProcOptionList
if (productAuthorization === 'Y') {
const filterSuppliers = R.pluck('supplier_code', authorizations)
if (isNotBlank(filterSuppliers)) {
list = R.filter(R.propSatisfies(R.includes(R.__, filterSuppliers), 'supplier_code'))(topProcOptionList)
}
}
that.setState({
topProcOptionList
topProcOptionList: list,
originManufacterList: topProcOptionList,
}, () => {
that.refs.LoadingModel.hide()
that.handleTopNav(topProcOptionList[0], 0)
......@@ -653,7 +680,17 @@ class ChooseProductPage extends Component {
* @return {*}
*/
rightFilter(list = []) {
const {filterData} = this.state
const {filterData, authorizations, productAuthorization, topActiveIndex, topProcOptionList} = this.state
if (productAuthorization === 'Y') {
const curSupplier = topProcOptionList[topActiveIndex]
const auth = R.find(R.propEq('supplier_code', curSupplier.supplier_code))(authorizations)
if (isNotBlank(auth) && isNotBlank(auth.product_line_category_list)) {
const typeCodes = R.pluck('product_line_category_name', auth.product_line_category_list)
list = R.filter(R.propSatisfies(R.includes(R.__, typeCodes), 'surgery_type'))(list)
}
}
R.compose(R.map(filter => {
const value = filter.value
if (isNotBlank(value)) {
......@@ -672,7 +709,17 @@ class ChooseProductPage extends Component {
* @return {*}
*/
rightNameFilter(list = []) {
const {searchValue} = this.state
const {searchValue, authorizations, productAuthorization, topActiveIndex, topProcOptionList, leftActiveIndex} = this.state
if (productAuthorization === 'Y' && R.includes(leftActiveIndex, [1, 2, 3])) {
const curSupplier = topProcOptionList[topActiveIndex]
const auth = R.find(R.propEq('supplier_code', curSupplier.supplier_code))(authorizations)
if (isNotBlank(auth) && isNotBlank(auth.product_line_category_list)) {
const typeCodes = R.pluck('product_line_category_code', auth.product_line_category_list)
list = R.filter(R.propSatisfies(R.includes(R.__, typeCodes), 'product_line_category_code'))(list)
}
}
const includes = item => {
const reg = new RegExp(searchValue, 'g')
return R.test(reg, item.general_name) || R.test(reg, item.item_name)
......
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