1002884655 il y a 3 ans
Parent
révision
507259eb97
1 fichiers modifiés avec 24 ajouts et 7 suppressions
  1. 24
    7
      src/pages/mine/components/EditUserDetailBasicInfo/index.jsx

+ 24
- 7
src/pages/mine/components/EditUserDetailBasicInfo/index.jsx Voir le fichier

@@ -9,10 +9,12 @@ export default function EditUserDetailBasicInfo (props) {
9 9
   const { Data = {}, close = () => { }, CustomerId = null } = props
10 10
 
11 11
   const [FormData, setFormData] = useState({ ...Data })
12
-  const [Age, setAge] = useState(null)
13
-  const [HouseholdIncome, setHouseholdIncome] = useState(null)
14
-  const [EstimatedPurchaseTime, setEstimatedPurchaseTime] = useState(null)
12
+  const [Sex, setSex] = useState(Data?.sex - 0 === 1 ? '男' : '女')
13
+  const [Age, setAge] = useState(Data?.age || null)
14
+  const [HouseholdIncome, setHouseholdIncome] = useState(Data?.householdIncome || null)
15
+  const [EstimatedPurchaseTime, setEstimatedPurchaseTime] = useState(Data?.estimatedPurchaseTime || null)
15 16
 
17
+  const [SexList] = useState(['男', '女'])
16 18
   const [AgeRange] = useState(['18-25', '26-30', '30-35', '36-45', '46-50', '50-60', '60以上'])
17 19
   const [IncomeRange] = useState(['10万以下', '10-15万', '15-20万', '20-30万', '30-50万', '50-75万', '75-100万', '100万以上'])
18 20
   const [BuyTimeRange] = useState(['1月以内', '1至3月', '半年以内', '一年以内', '一年以上'])
@@ -40,12 +42,17 @@ export default function EditUserDetailBasicInfo (props) {
40 42
     let resData = FormData
41 43
     if (key === 'age') {
42 44
       resData[key] = AgeRange[e.detail.value]
45
+      setAge(AgeRange[e.detail.value])
43 46
     } else if (key === 'householdIncome') {
44 47
       resData[key] = IncomeRange[e.detail.value]
48
+      setHouseholdIncome(IncomeRange[e.detail.value])
45 49
     } else if (key === 'estimatedPurchaseTime') {
46 50
       resData[key] = BuyTimeRange[e.detail.value]
51
+      setEstimatedPurchaseTime(BuyTimeRange[e.detail.value])
52
+    } else if (key === 'sex') {
53
+      resData[key] = SexList[e.detail.value] === '男' ? 1 : 2
54
+      setSex(SexList[e.detail.value])
47 55
     }
48
-    console.log(resData)
49 56
     setFormData(resData)
50 57
   }
51 58
 
@@ -87,6 +94,16 @@ export default function EditUserDetailBasicInfo (props) {
87 94
             </view>
88 95
           </view>
89 96
 
97
+          <text>性别</text>
98
+          <view className='FormLine flex-h'>
99
+            <view className='flex-item'>
100
+              <Picker onChange={PickerChange.bind(this, 'sex')} value={null} range={SexList}>
101
+                <text>{Sex || '请选择'}</text>
102
+              </Picker>
103
+            </view>
104
+            <text className='iconfont icon-jiantoudown'></text>
105
+          </view>
106
+
90 107
           <text>家庭住址</text>
91 108
           <view className='FormLine flex-h'>
92 109
             <view className='flex-item'>
@@ -105,7 +122,7 @@ export default function EditUserDetailBasicInfo (props) {
105 122
           <view className='FormLine flex-h'>
106 123
             <view className='flex-item'>
107 124
               <Picker onChange={PickerChange.bind(this, 'age')} value={null} range={AgeRange}>
108
-                <text>{FormData.age || '请选择'}</text>
125
+                <text>{Age || '请选择'}</text>
109 126
               </Picker>
110 127
             </view>
111 128
             <text className='iconfont icon-jiantoudown'></text>
@@ -122,7 +139,7 @@ export default function EditUserDetailBasicInfo (props) {
122 139
           <view className='FormLine flex-h'>
123 140
             <view className='flex-item'>
124 141
               <Picker onChange={PickerChange.bind(this, 'householdIncome')} value={null} range={IncomeRange}>
125
-                <text>{FormData.householdIncome || '请选择'}</text>
142
+                <text>{HouseholdIncome || '请选择'}</text>
126 143
               </Picker>
127 144
             </view>
128 145
             <text className='iconfont icon-jiantoudown'></text>
@@ -153,7 +170,7 @@ export default function EditUserDetailBasicInfo (props) {
153 170
           <view className='FormLine flex-h'>
154 171
             <view className='flex-item'>
155 172
               <Picker onChange={PickerChange.bind(this, 'estimatedPurchaseTime')} value={null} range={BuyTimeRange}>
156
-                <text>{FormData.estimatedPurchaseTime || '请选择'}</text>
173
+                <text>{EstimatedPurchaseTime || '请选择'}</text>
157 174
               </Picker>
158 175
             </view>
159 176
             <text className='iconfont icon-jiantoudown'></text>