Commit 0c643e22 by peii

fix: 修复

parent eba09817
Showing with 42 additions and 15 deletions
...@@ -665,7 +665,8 @@ class SelfOrderPage extends Component { ...@@ -665,7 +665,8 @@ class SelfOrderPage extends Component {
that.customerGetShip() that.customerGetShip()
} }
if (item.title == '主治医生') { if (item.title == '主治医生') {
;(item.showInput = false), (item.inputValue = '') item.showInput = false
item.inputValue = ''
} }
} }
return item return item
...@@ -776,9 +777,10 @@ class SelfOrderPage extends Component { ...@@ -776,9 +777,10 @@ class SelfOrderPage extends Component {
} }
if (itemTitle === '客户名称') { if (itemTitle === '客户名称') {
that.clearInitNameAndValue(2) that.clearInitNameAndValue(2)
// that.setDefaultByCustomer()
} else if (R.includes(itemTitle, ['收货地点'])) {
// TODO:
that.setDefaultByCustomer() that.setDefaultByCustomer()
} else if (R.includes(itemTitle, ['收单地点', '收货地点']) && isBlank(listOptionData[18].value)) {
that.setDefaultByCustomer(true)
} }
if (itemTitle === '主治医生') { if (itemTitle === '主治医生') {
...@@ -1183,11 +1185,14 @@ class SelfOrderPage extends Component { ...@@ -1183,11 +1185,14 @@ class SelfOrderPage extends Component {
callback: customer => { callback: customer => {
if (isBlank(customer)) return if (isBlank(customer)) return
this.setState({localCustomersOption: [customer]}, () => { this.setState({ localCustomersOption: [customer] }, () => {
this.handleCallBack({ this.handleCallBack(
{
name: customer.customer_name, name: customer.customer_name,
value: customer.customer_code, value: customer.customer_code,
}, listOptionData[2].title) },
listOptionData[2].title,
)
}) })
}, },
}) })
...@@ -1261,7 +1266,7 @@ class SelfOrderPage extends Component { ...@@ -1261,7 +1266,7 @@ class SelfOrderPage extends Component {
that.customerGetBill() that.customerGetBill()
that.customerGetShip() that.customerGetShip()
that.getPayBankAccounts() that.getPayBankAccounts()
that.setDefaultByCustomer() // that.setDefaultByCustomer()
}, },
) )
} }
...@@ -1274,15 +1279,33 @@ class SelfOrderPage extends Component { ...@@ -1274,15 +1279,33 @@ class SelfOrderPage extends Component {
} }
} }
async setDefaultByCustomer(onlyInv = false) { /**
* @description 设置默认值
* @param {*}
* @return {*}
*/
async setDefaultByCustomer(defaultValue) {
const { listOptionData, localCustomersOption } = this.state const { listOptionData, localCustomersOption } = this.state
const { sysValueSets, global_domain_config, token } = this.props const { sysValueSets, global_domain_config, token } = this.props
if (isBlank(defaultValue)) {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption) const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
if (isBlank(customer) || isBlank(customer.default)) return if (isBlank(customer)) return
const billSite = R.find(R.propEq('bill_to_site_code', listOptionData[3].value), customer.bill_to_sites || [])
if (isBlank(billSite)) return
const defaultValue = customer.default const shipSite = R.find(
R.allPass([
R.propEq('ship_to_site_code', listOptionData[4].value),
R.propSatisfies(isNotBlank, 'default')
]),
)(billSite.ship_to_sites || [])
if (isBlank(shipSite)) return
defaultValue = shipSite.default
}
if (!onlyInv) {
const templateList = R.compose( const templateList = R.compose(
R.map( R.map(
R.applySpec({ R.applySpec({
...@@ -1316,13 +1339,12 @@ class SelfOrderPage extends Component { ...@@ -1316,13 +1339,12 @@ class SelfOrderPage extends Component {
listOptionData[7].name = orderType.value_name listOptionData[7].name = orderType.value_name
} }
} }
}
if (R.any(isBlank, [listOptionData[2].value, listOptionData[3].value, listOptionData[4].value])) { if (R.any(isBlank, [listOptionData[2].value, listOptionData[3].value, listOptionData[4].value])) {
return this.setState({ listOptionData }) return this.setState({ listOptionData })
} }
let params = { params = {
access_token: token, access_token: token,
org_code: listOptionData[1].value, org_code: listOptionData[1].value,
customer_code: listOptionData[2].value, customer_code: listOptionData[2].value,
...@@ -1477,9 +1499,14 @@ class SelfOrderPage extends Component { ...@@ -1477,9 +1499,14 @@ class SelfOrderPage extends Component {
if (shipSites.length === 1) { if (shipSites.length === 1) {
listOptionData[4].name = shipSites[0].ship_to_site_name listOptionData[4].name = shipSites[0].ship_to_site_name
listOptionData[4].value = shipSites[0].ship_to_site_code listOptionData[4].value = shipSites[0].ship_to_site_code
that.setState({ that.setState(
{
listOptionData, listOptionData,
}) },
() => {
that.setDefaultByCustomer(shipSites[0].default)
},
)
} }
} }
} }
......
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