|
@@ -9,6 +9,7 @@ import { addDogList, addlication, getDogInfo, getCardLicenseInfo } from '@/servi
|
9
|
9
|
import { handleFile } from '@/utils/request';
|
10
|
10
|
import { useModel } from '@/store';
|
11
|
11
|
import './style.less'
|
|
12
|
+import { getApplicationList } from '../../services/dogAPI';
|
12
|
13
|
|
13
|
14
|
export default (props) => {
|
14
|
15
|
function getBool (val) {
|
|
@@ -18,9 +19,7 @@ export default (props) => {
|
18
|
19
|
|
19
|
20
|
const { dogs, setDogs, person } = useModel('userData')
|
20
|
21
|
const [formData, setFormData] = useState()
|
21
|
|
- const [isOrgState, setIsOrgState] = useState(
|
22
|
|
- false
|
23
|
|
- )
|
|
22
|
+ const [isOrgState, setIsOrgState] = useState(false)
|
24
|
23
|
const [dogDate, setDogDate] = useState({ immunizationDate: null, petBirthday: null, petSex: [], petType: [] })
|
25
|
24
|
//狗证详情
|
26
|
25
|
const [renewalAndReissue, setRenewalAndReissue] = useState()
|
|
@@ -44,14 +43,7 @@ export default (props) => {
|
44
|
43
|
}
|
45
|
44
|
}, [applyType])
|
46
|
45
|
useDidShow(() => {
|
47
|
|
- // addDogList().then((res) => {
|
48
|
|
- // setDogs(res.records)
|
49
|
|
- // if (res.records && res.records.length == 1) {
|
50
|
|
- // getDetail(res.records[0])
|
51
|
|
- // }
|
52
|
|
- // })
|
53
|
46
|
if (dogs) {
|
54
|
|
- console.log("🚀 ~ file: index.jsx ~ line 41 ~ useDidShow ~ dogs", dogs)
|
55
|
47
|
if (dogs.length == 1) {
|
56
|
48
|
getDetail(dogs[0])
|
57
|
49
|
}
|
|
@@ -69,7 +61,6 @@ export default (props) => {
|
69
|
61
|
const getDogInfoFunction = (petId) => {
|
70
|
62
|
getDogInfo(petId).then((e) => {
|
71
|
63
|
setFormData(e)
|
72
|
|
- console.log("🚀 ~ file: index.jsx ~ line 58 ~ getDogInfo ~ e", e)
|
73
|
64
|
const sex = [{ value: e?.sex, text: e?.sex == 1 ? '雄' : '雌' }];
|
74
|
65
|
const petType = [{ value: 0, name: e?.petType }];
|
75
|
66
|
setDogDate({ ...dogDate, petBirthday: e?.birthday, petSex: sex, petType: petType, })
|
|
@@ -143,87 +134,185 @@ export default (props) => {
|
143
|
134
|
|
144
|
135
|
// ...dogDate,
|
145
|
136
|
const formSubmit = (value) => {
|
|
137
|
+
|
146
|
138
|
if (applyType == 'renewal' || applyType == 'reissue') {
|
147
|
|
- addlication({ ...value, applyType, originCardNo: renewalAndReissue?.cardNo, petName: formData.name, isOrg: isOrgState }).then((res) => {
|
148
|
|
- console.log('dogInfo xinwe', res);
|
149
|
|
- Taro.showToast({
|
150
|
|
- title: '申请成功,等待审核',
|
151
|
|
- icon: 'none',
|
152
|
|
- duration: 1000
|
153
|
|
- })
|
154
|
|
- if (applyType == 'renewal') {
|
155
|
|
- Taro.navigateBack({
|
156
|
|
- delta: 1
|
157
|
|
- })
|
158
|
|
- return;
|
159
|
|
- } else {
|
160
|
|
- Taro.reLaunch({
|
161
|
|
- url: `/pages/payPage/index?id=${res.applyId}`
|
162
|
|
- })
|
|
139
|
+
|
|
140
|
+ getApplicationList({ pageSize: 500 }).then((e) => {
|
|
141
|
+ console.log('e', e);
|
|
142
|
+ const array = e.records
|
|
143
|
+ for (let i = 0; i < array.length; i++) {
|
|
144
|
+ if (array[i].petId == formData.petId) {
|
|
145
|
+ if (array[i].status == 1) {
|
|
146
|
+ console.log('支付过了',);
|
|
147
|
+ Taro.showToast({
|
|
148
|
+ title: '申请成功,等待审核',
|
|
149
|
+ icon: 'none',
|
|
150
|
+ duration: 1000
|
|
151
|
+ })
|
|
152
|
+ setTimeout(() => {
|
|
153
|
+ Taro.navigateBack({
|
|
154
|
+ delta: 1
|
|
155
|
+ })
|
|
156
|
+ }, 1000);
|
|
157
|
+
|
|
158
|
+ return;
|
|
159
|
+ } else {
|
|
160
|
+ console.log('没有支付',);
|
|
161
|
+ other(value);
|
|
162
|
+ return;
|
|
163
|
+ }
|
|
164
|
+ } else {
|
|
165
|
+ console.log('没有这个订单',);
|
|
166
|
+ other(value);
|
|
167
|
+ return;
|
|
168
|
+ }
|
163
|
169
|
}
|
164
|
170
|
|
165
|
171
|
})
|
|
172
|
+
|
166
|
173
|
} else {
|
167
|
|
- getCardLicenseInfo(renewalAndReissue?.petId).then((res) => {
|
168
|
|
- if (!res) {
|
169
|
|
- addlication({ ...value, applyType, petName: formData.name, isOrg: isOrgState }).then((ress) => {
|
170
|
|
- console.log('dogInfo xinwe', ress);
|
171
|
|
- Taro.showToast({
|
172
|
|
- title: '申请成功,等待审核',
|
173
|
|
- icon: 'none',
|
174
|
|
- duration: 1000
|
|
174
|
+
|
|
175
|
+ getApplicationList({ pageSize: 500 }).then((e) => {
|
|
176
|
+ console.log('开始',);
|
|
177
|
+
|
|
178
|
+ console.log('e', e);
|
|
179
|
+ const array = e.records
|
|
180
|
+ if (array.length > 0) {
|
|
181
|
+ for (let i = 0; i < array.length; i++) {
|
|
182
|
+ if (array[i].petId == formData.petId) {
|
|
183
|
+ if (array[i].status == 1) {
|
|
184
|
+ console.log('支付过了',);
|
|
185
|
+ Taro.showToast({
|
|
186
|
+ title: '申请成功,等待审核',
|
|
187
|
+ icon: 'none',
|
|
188
|
+ duration: 1000
|
|
189
|
+ })
|
|
190
|
+ setTimeout(() => {
|
|
191
|
+ Taro.navigateBack({
|
|
192
|
+ delta: 1
|
|
193
|
+ })
|
|
194
|
+ }, 1000);
|
|
195
|
+ return;
|
|
196
|
+ } else {
|
|
197
|
+ console.log('没有支付',);
|
|
198
|
+ goPayPage(value)
|
|
199
|
+
|
|
200
|
+ return;
|
|
201
|
+ }
|
|
202
|
+ } else {
|
|
203
|
+ console.log('没有这个订单-----------',);
|
|
204
|
+ goPayPage(value)
|
|
205
|
+
|
|
206
|
+ return;
|
|
207
|
+ }
|
|
208
|
+
|
|
209
|
+ }
|
|
210
|
+ } else {
|
|
211
|
+ goPayPage(value)
|
|
212
|
+
|
|
213
|
+ }
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+ })
|
|
217
|
+
|
|
218
|
+ }
|
|
219
|
+ }
|
|
220
|
+ const goPayPage = (value) => {
|
|
221
|
+ getCardLicenseInfo(renewalAndReissue?.petId).then((res) => {
|
|
222
|
+ if (!res) {
|
|
223
|
+ addlication({ ...value, applyType, petName: formData.name, isOrg: isOrgState }).then((ress) => {
|
|
224
|
+ console.log('dogInfo xinwe', ress);
|
|
225
|
+ Taro.showToast({
|
|
226
|
+ title: '申请成功,等待审核',
|
|
227
|
+ icon: 'none',
|
|
228
|
+ duration: 1000
|
|
229
|
+ })
|
|
230
|
+ if (applyType == 'renewal') {
|
|
231
|
+ Taro.navigateBack({
|
|
232
|
+ delta: 1
|
175
|
233
|
})
|
176
|
|
- if (applyType == 'renewal') {
|
177
|
|
- Taro.navigateBack({
|
178
|
|
- delta: 1
|
|
234
|
+ return;
|
|
235
|
+ } else {
|
|
236
|
+ if (value.applyMethod == '1') {
|
|
237
|
+ console.log('不跳转',);
|
|
238
|
+ Taro.showToast({
|
|
239
|
+ title: '申请成功,等待审核',
|
|
240
|
+ icon: 'none',
|
|
241
|
+ duration: 1000
|
179
|
242
|
})
|
180
|
|
- return;
|
|
243
|
+ setTimeout(() => {
|
|
244
|
+ Taro.navigateBack({
|
|
245
|
+ delta: 1
|
|
246
|
+ })
|
|
247
|
+ }, 1000);
|
181
|
248
|
} else {
|
|
249
|
+ console.log('跳转',);
|
182
|
250
|
Taro.reLaunch({
|
183
|
251
|
url: `/pages/payPage/index?id=${ress.applyId}`
|
184
|
252
|
})
|
185
|
253
|
}
|
|
254
|
+ }
|
|
255
|
+ })
|
|
256
|
+ } else {
|
|
257
|
+ Taro.showModal({
|
|
258
|
+ title: '提示',
|
|
259
|
+ content: '当前狗狗已有证件,请勿重复申请!',
|
|
260
|
+ showCancel: false,
|
|
261
|
+ success: function (v) {
|
|
262
|
+ if (v.confirm) {
|
|
263
|
+ // console.log('用户点击确定')
|
|
264
|
+ // Taro.navigateBack({
|
|
265
|
+ // delta: 1
|
|
266
|
+ // })
|
|
267
|
+ }
|
|
268
|
+ }
|
|
269
|
+ })
|
|
270
|
+ }
|
|
271
|
+ })
|
|
272
|
+ }
|
186
|
273
|
|
|
274
|
+ const other = (value) => {
|
|
275
|
+ addlication({ ...value, applyType, originCardNo: renewalAndReissue?.cardNo, petName: formData.name, isOrg: isOrgState }).then((res) => {
|
|
276
|
+ console.log('dogInfo xinwe', res);
|
|
277
|
+ Taro.showToast({
|
|
278
|
+ title: '申请成功,等待审核',
|
|
279
|
+ icon: 'none',
|
|
280
|
+ duration: 1000
|
|
281
|
+ })
|
|
282
|
+ if (applyType == 'renewal') {
|
|
283
|
+ Taro.navigateBack({
|
|
284
|
+ delta: 1
|
|
285
|
+ })
|
|
286
|
+ return;
|
|
287
|
+ } else {
|
|
288
|
+ if (value.applyMethod == '1') {
|
|
289
|
+ console.log('不跳转',);
|
|
290
|
+ Taro.showToast({
|
|
291
|
+ title: '申请成功,等待审核',
|
|
292
|
+ icon: 'none',
|
|
293
|
+ duration: 1000
|
187
|
294
|
})
|
|
295
|
+ setTimeout(() => {
|
|
296
|
+ Taro.navigateBack({
|
|
297
|
+ delta: 1
|
|
298
|
+ })
|
|
299
|
+ }, 1000);
|
188
|
300
|
} else {
|
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
|
|
- }
|
|
301
|
+ console.log('跳转',);
|
|
302
|
+ Taro.reLaunch({
|
|
303
|
+ url: `/pages/payPage/index?id=${res.applyId}`
|
201
|
304
|
})
|
202
|
305
|
}
|
203
|
|
- })
|
204
|
|
- }
|
|
306
|
+ }
|
|
307
|
+
|
|
308
|
+ })
|
205
|
309
|
}
|
206
|
|
- const [abcc, setAbc] = useState(
|
207
|
|
- [
|
208
|
|
- {
|
209
|
|
- value: false,
|
210
|
|
- text: '个人',
|
211
|
|
- checked: false,
|
212
|
|
- },
|
213
|
|
- {
|
214
|
|
- value: true,
|
215
|
|
- text: '企业',
|
216
|
|
- checked: false,
|
217
|
|
-
|
218
|
|
- },
|
219
|
|
-
|
220
|
|
- ]
|
221
|
|
- )
|
|
310
|
+
|
222
|
311
|
const orgState = [
|
223
|
312
|
{
|
224
|
313
|
value: false,
|
225
|
314
|
text: '个人',
|
226
|
|
- checked: false,
|
|
315
|
+ checked: true,
|
227
|
316
|
},
|
228
|
317
|
{
|
229
|
318
|
value: true,
|
|
@@ -237,11 +326,7 @@ export default (props) => {
|
237
|
326
|
|
238
|
327
|
|
239
|
328
|
|
240
|
|
- const handleRadio = (index) => {
|
241
|
|
- setAbc([...abcc, abcc[index].checked = true])
|
242
|
|
- setIsOrgState(getBool(abcc[index].checked))
|
243
|
|
- console.log("🚀 ~ file: index.jsx ~ line 224 ~ handleRadio ~ orgState", abcc, abcc[index])
|
244
|
|
- }
|
|
329
|
+
|
245
|
330
|
|
246
|
331
|
const rules = {
|
247
|
332
|
petId: [{ required: true, message: '请填写狗狗名称' }],
|
|
@@ -262,27 +347,29 @@ export default (props) => {
|
262
|
347
|
<>
|
263
|
348
|
<AuthProfile />
|
264
|
349
|
<View class='page' >
|
|
350
|
+ <View style={{ backgroundColor: 'white' }}>
|
|
351
|
+ <FormItem title='是否企业' extClass='' required >
|
|
352
|
+ <View className='radio-list' >
|
|
353
|
+ <RadioGroup name='isOrg' onChange={(e) => setIsOrgState(getBool(e.detail.value))} >
|
|
354
|
+ {orgState.map((item, i) => {
|
|
355
|
+ return (
|
|
356
|
+ <Label className='radio-list__label' for={i} key={i}>
|
|
357
|
+ <Radio color='#FCD905' checked={item.checked} className='radio-list__radio' value={item.value} >{item.text}</Radio>
|
|
358
|
+ </Label>
|
|
359
|
+ )
|
|
360
|
+ })}
|
|
361
|
+ </RadioGroup>
|
|
362
|
+ </View>
|
|
363
|
+ </FormItem>
|
|
364
|
+ </View>
|
265
|
365
|
<Form onSubmit={formSubmit} rules={rules} >
|
266
|
366
|
<mp-form >
|
267
|
367
|
<mp-cells >
|
268
|
|
- <FormItem title='是否企业' >
|
|
368
|
+ {/* <FormItem title='是否企业' >
|
269
|
369
|
<s-picker name='isOrg' rangeKey='text' rangeValue='value' range={orgState} value={orgState?.text} onChange={(e) => { setIsOrgState(e.detail.value) }} />
|
270
|
|
- </FormItem>
|
271
|
|
- {/* setIsOrgState(getBool(e.detail.value)) */}
|
272
|
|
- {/*
|
273
|
|
- <FormItem title='是否企业' extClass='' required >
|
274
|
|
- <View className='radio-list'>
|
275
|
|
- <RadioGroup name='isOrg' >
|
276
|
|
- {orgState.map((item, i) => {
|
277
|
|
- return (
|
278
|
|
- <Label className='radio-list__label' for={i} key={i}>
|
279
|
|
- <Radio onClick={() => { handleRadio(i) }} color='#FCD905' checked={item.checked} className='radio-list__radio' value={item.value} >{item.text}</Radio>
|
280
|
|
- </Label>
|
281
|
|
- )
|
282
|
|
- })}
|
283
|
|
- </RadioGroup>
|
284
|
|
- </View>
|
285
|
370
|
</FormItem> */}
|
|
371
|
+ {/* setIsOrgState(getBool(e.detail.value)) */}
|
|
372
|
+
|
286
|
373
|
<FormItem title='犬主姓名' required>
|
287
|
374
|
<View >{person?.nickName}</View>
|
288
|
375
|
</FormItem>
|
|
@@ -352,7 +439,6 @@ export default (props) => {
|
352
|
439
|
<FormItem title='处罚信息' >
|
353
|
440
|
<uploader name='penaltyInfo' onFile={handleFile} />
|
354
|
441
|
</FormItem>
|
355
|
|
-
|
356
|
442
|
<FormItem title='最近免疫日期' required>
|
357
|
443
|
<Picker name='immunizationDate' mode='date' onChange={(e) => { onDateChange('immunizationDate', e.detail.value) }}>
|
358
|
444
|
{dogDate?.immunizationDate ? (
|