[baozhangchao] 3 jaren geleden
bovenliggende
commit
2f852435d3
2 gewijzigde bestanden met toevoegingen van 53 en 25 verwijderingen
  1. 2
    1
      src/pages/setDogInfo/index.jsx
  2. 51
    24
      src/pages/setDogLicense/index.jsx

+ 2
- 1
src/pages/setDogInfo/index.jsx Bestand weergeven

@@ -62,7 +62,8 @@ export default (props) => {
62 62
 
63 63
       addDogInfo(value).then((e) => {
64 64
         console.log("🚀 修改前s", dogs)
65
-        setDogs((dogs || [e]))
65
+        // setDogs((dogs || [e]))
66
+        setDogs((dogs || []).concat(e))
66 67
 
67 68
         console.log("🚀 ~ 保存成功数据", value, e)
68 69
 

+ 51
- 24
src/pages/setDogLicense/index.jsx Bestand weergeven

@@ -15,8 +15,8 @@ import { getCardLicenseInfo } from '../../services/dogAPI';
15 15
 export default (props) => {
16 16
   const { dogs, person } = useModel('userData')
17 17
   const [formData, setFormData] = useState()
18
-  const value = useRouter();
19
-  const { petId } = value.params
18
+  const values = useRouter();
19
+  // const { petId } = value.params
20 20
 
21 21
   const [dogDate, setDogDate] = useState({ immunizationDate: null, petBirthday: null, petSex: [], petType: [] })
22 22
   const [mainDog, setMainDog] = useState([])
@@ -67,13 +67,16 @@ export default (props) => {
67 67
   }
68 68
   const getMainDogChange = (value) => {
69 69
     console.log("🚀 ~ file: index.jsx ~ line 34 ~ getMainDogChange ~ value", value)
70
-    const { petId } = value.detail.data
70
+    const valuess = value.detail.data
71
+    const { petId } = valuess
72
+    setRenewalAndReissue({ ...renewalAndReissue, ...valuess })
73
+
71 74
     if (applyType == 'renewal' || applyType == 'reissue') {
72 75
       setDogStatus(false)
73 76
       getDogInfoFunction(petId)
74 77
       getCardLicenseInfo(petId).then((res) => {
75 78
         console.log('狗子证件有效期', res);
76
-        setRenewalAndReissue(res)
79
+        setRenewalAndReissue({ ...renewalAndReissue, ...res })
77 80
       })
78 81
     }
79 82
     if (applyType == 'first') {
@@ -89,10 +92,10 @@ export default (props) => {
89 92
             showCancel: false,
90 93
             success: function (v) {
91 94
               if (v.confirm) {
92
-                console.log('用户点击确定')
93
-                Taro.navigateBack({
94
-                  delta: 1
95
-                })
95
+                // console.log('用户点击确定')
96
+                // Taro.navigateBack({
97
+                //   delta: 1
98
+                // })
96 99
               }
97 100
             }
98 101
           })
@@ -137,7 +140,7 @@ export default (props) => {
137 140
   ]
138 141
 
139 142
   // ...dogDate,
140
-  const formSubmit = value => {
143
+  const formSubmit = (value) => {
141 144
     if (applyType == 'renewal' || applyType == 'reissue') {
142 145
       addlication({ ...value, applyType, petId: formData.petId, originCardNo: renewalAndReissue?.cardNo }).then((res) => {
143 146
         console.log('dogInfo xinwe', res);
@@ -159,25 +162,48 @@ export default (props) => {
159 162
 
160 163
       })
161 164
     } else {
162
-      addlication({ ...value, applyType, petId: formData.petId }).then((res) => {
163
-        console.log('dogInfo xinwe', res);
164
-        Taro.showToast({
165
-          title: '申请成功,等待审核',
166
-          icon: 'none',
167
-          duration: 1000
168
-        })
169
-        if (applyType == 'renewal') {
170
-          Taro.navigateBack({
171
-            delta: 1
165
+      console.log("🚀 ~ file: index.jsx ~ line 166 ~ getCardLicenseInfo ~ renewalAndReissue", renewalAndReissue)
166
+
167
+      getCardLicenseInfo(renewalAndReissue?.petId).then((res) => {
168
+        if (!res) {
169
+          addlication({ ...value, applyType, petId: formData.petId }).then((res) => {
170
+            console.log('dogInfo xinwe', res);
171
+            Taro.showToast({
172
+              title: '申请成功,等待审核',
173
+              icon: 'none',
174
+              duration: 1000
175
+            })
176
+            if (applyType == 'renewal') {
177
+              Taro.navigateBack({
178
+                delta: 1
179
+              })
180
+              return;
181
+            } else {
182
+              Taro.reLaunch({
183
+                url: `/pages/payPage/index?id=${res.applyId}`
184
+              })
185
+            }
186
+
172 187
           })
173
-          return;
174 188
         } else {
175
-          Taro.reLaunch({
176
-            url: `/pages/payPage/index?id=${res.applyId}`
189
+          Taro.showModal({
190
+            title: '提示',
191
+            content: '当前狗狗已有证件,请勿重复申请!',
192
+            showCancel: false,
193
+            success: function (v) {
194
+              if (v.confirm) {
195
+                // console.log('用户点击确定')
196
+                // Taro.navigateBack({
197
+                //   delta: 1
198
+                // })
199
+              }
200
+            }
177 201
           })
178
-        }
179 202
 
203
+
204
+        }
180 205
       })
206
+
181 207
     }
182 208
 
183 209
   }
@@ -296,7 +322,8 @@ export default (props) => {
296 322
 
297 323
             </mp-cells>
298 324
           </mp-form>
299
-          <Button disabled={dogStatus} title='确定' />
325
+          {/* <Button disabled={dogStatus} title='确定' /> */}
326
+          <Button title='确定' />
300 327
         </Form>
301 328
       </View>
302 329
     </>