Commit 7a156482 by peii

feat

parent 55ab9255
Showing with 12 additions and 31 deletions
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/order/self.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/order/self.tsx
* @Author: peii * @Author: peii
* @Date: 2021-07-13 22:40:12 * @Date: 2021-07-13 22:40:12
* @LastEditTime: 2022-11-02 19:41:00 * @LastEditTime: 2022-11-04 15:16:13
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 自助下单 * @Description: 自助下单
...@@ -35,6 +35,7 @@ type IProps = { ...@@ -35,6 +35,7 @@ type IProps = {
type IState = { type IState = {
data: { [key: string]: any[] } data: { [key: string]: any[] }
formItems: IFormField[] formItems: IFormField[]
doctorNames: []
} }
class SelfOrder extends Component<IProps, IState> { class SelfOrder extends Component<IProps, IState> {
...@@ -282,13 +283,17 @@ class SelfOrder extends Component<IProps, IState> { ...@@ -282,13 +283,17 @@ class SelfOrder extends Component<IProps, IState> {
* @return {*} * @return {*}
*/ */
setBillToSitesCallback() { setBillToSitesCallback() {
const { formItems, data } = this.state const { formItems, data, doctorNames } = this.state
const { billToSiteCode } = data const { billToSiteCode } = data
const item = getFormItem(formItems, 'shipToSiteCode') const item = getFormItem(formItems, 'shipToSiteCode')
const billItem = getFormItem(formItems, 'billToSiteCode') const billItem = getFormItem(formItems, 'billToSiteCode')
const billToSiteItem = R.find(R.propEq('value', billToSiteCode))(billItem.options || []) const billToSiteItem = R.find(R.propEq('value', billToSiteCode))(billItem.options || [])
doctorNames = R.compose(R.uniq, R.pluck('customer_name'))(billToSiteItem.shipToSites)
const doctorItem = getFormItem(formItems, 'doctorName')
doctorItem.options = R.map(R.applySpec({ label: R.identity, value: R.identity }))(doctorNames)
item.options = R.compose( item.options = R.compose(
R.map( R.map(
R.applySpec({ R.applySpec({
...@@ -299,7 +304,7 @@ class SelfOrder extends Component<IProps, IState> { ...@@ -299,7 +304,7 @@ class SelfOrder extends Component<IProps, IState> {
), ),
)(billToSiteItem.shipToSites || []) )(billToSiteItem.shipToSites || [])
this.setState({ formItems }) this.setState({ formItems, doctorNames })
} }
/** /**
...@@ -308,36 +313,12 @@ class SelfOrder extends Component<IProps, IState> { ...@@ -308,36 +313,12 @@ class SelfOrder extends Component<IProps, IState> {
* @return {*} * @return {*}
*/ */
setShipToSiteCallback() { setShipToSiteCallback() {
const { formItems, data } = this.state const { shipToSiteCode } = this.state.data
const { sellerCode, orgCode, customerCode, billToSiteCode, shipToSiteCode } = data
const { formItems, data } = this.state
const { billToSiteCode } = data
const item = getFormItem(formItems, 'doctorName')
const shipItem = getFormItem(formItems, 'shipToSiteCode')
const billToSiteItem = R.find(R.propEq('value', billToSiteCode))(billItem.options || [])
item.options = R.map(
R.applySpec({
label: R.prop('ship_to_site_name'),
value: R.prop('ship_to_site_code'),
doctorName: R.prop('customer_doctor'),
}),
)(billToSiteItem.shipToSites || [])
this.setState({ formItems })
// const doctors = this.props.orgStore.doctors(sellerCode, orgCode, customerCode, billToSiteCode)
// const item = getFormItem(formItems, 'doctorName')
// item.options = doctors
// this.setState({ formItems })
// 借货仓库依赖收货地址 // 借货仓库依赖收货地址
// if (isNotBlank(shipToSiteCode)) { if (isNotBlank(shipToSiteCode)) {
// this.getInventories() this.getInventories()
// } }
} }
/** /**
......
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