|
@@ -5,10 +5,10 @@ import ContainerLayout from '../../../compents/container/index'
|
5
|
5
|
import { AtInput } from 'taro-ui'
|
6
|
6
|
import Tab from '../../../compents/tab'
|
7
|
7
|
import Layout from '../../../layout'
|
|
8
|
+import request from '@/util/request'
|
8
|
9
|
|
9
|
10
|
|
10
|
11
|
const InputGroup = props => {
|
11
|
|
- console.log('---------', JSON.stringify(props.dataSource))
|
12
|
12
|
const [name, setName] = useState(props.dataSource.name)
|
13
|
13
|
const [phone, setPhone] = useState(props.dataSource.phone)
|
14
|
14
|
|
|
@@ -25,7 +25,6 @@ const InputGroup = props => {
|
25
|
25
|
}, [props.dataSource.phone])
|
26
|
26
|
|
27
|
27
|
const handeNameChange = e => {
|
28
|
|
- console.log('333333333333333333')
|
29
|
28
|
const v = e.detail.value
|
30
|
29
|
setName(v)
|
31
|
30
|
if (props.onChange) {
|
|
@@ -72,28 +71,49 @@ const register = (props) => {
|
72
|
71
|
|
73
|
72
|
let [list, setList] = useState([])
|
74
|
73
|
useEffect(() => {
|
75
|
|
- // console.log(page,'page')
|
76
|
|
- const arr = []
|
77
|
|
- for (let i = 0; i < 4; i++) {
|
78
|
|
- arr.push({
|
79
|
|
- name:'',
|
80
|
|
- phone:'',
|
81
|
|
- })
|
|
74
|
+ if (props.dataSource) {
|
|
75
|
+ const {personNum} = props.dataSource.houseSetting || {}
|
|
76
|
+
|
|
77
|
+ setList(new Array(personNum || 0).fill('*').map(x => ({name: undefined, phone: undefined})))
|
82
|
78
|
}
|
83
|
|
- setList(arr)
|
84
|
|
- }, [])
|
|
79
|
+ }, [props.dataSource])
|
85
|
80
|
|
86
|
81
|
const onClick = () => {
|
87
|
|
- console.log(list)
|
|
82
|
+ const hasNull = list.filter(x => !x.name || !x.phone)[0]
|
|
83
|
+ if (hasNull) {
|
|
84
|
+ Taro.showModal({
|
|
85
|
+ title: '请将信息填写完成',
|
|
86
|
+ showCancel: false,
|
|
87
|
+ success: () => {}
|
|
88
|
+ })
|
|
89
|
+
|
|
90
|
+ return
|
|
91
|
+ }
|
|
92
|
+
|
|
93
|
+ const data = {
|
|
94
|
+ orderId: props.dataSource.orderId,
|
|
95
|
+ houseId: props.dataSource.houseSetting.houseId,
|
|
96
|
+ personList: list,
|
|
97
|
+ }
|
|
98
|
+
|
|
99
|
+ request({ url: '/taHousePerson', method: 'POST', data }).then(res => {
|
|
100
|
+ if (props.onFinished) {
|
|
101
|
+ props.onFinished(res)
|
|
102
|
+ }
|
|
103
|
+ }).catch(err => {
|
|
104
|
+ console.error(err)
|
|
105
|
+ const message = err.message || err.errMsg || err
|
|
106
|
+ Taro.showToast({
|
|
107
|
+ title: message,
|
|
108
|
+ icon: 'none',
|
|
109
|
+ duration: 3000
|
|
110
|
+ })
|
|
111
|
+ })
|
88
|
112
|
}
|
89
|
113
|
|
90
|
|
- const onChangeList = index => value => {
|
91
|
|
- console.log(111111111, value, index)
|
92
|
|
-
|
|
114
|
+ const onChangeList = index => value => {
|
93
|
115
|
list[index] = value
|
94
|
|
-
|
95
|
116
|
setList([...list])
|
96
|
|
-
|
97
|
117
|
}
|
98
|
118
|
|
99
|
119
|
return <View className='register'>
|