|
|
@ -9,13 +9,26 @@ |
|
|
|
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>抵达时间</view> |
|
|
|
<date-selector @change="getEndData" /> |
|
|
|
</view> |
|
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
|
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>行程类型</view> |
|
|
|
<radio-group class="block" @change="TypeChange"> |
|
|
|
<view class="flex"> |
|
|
|
<view class="flex-sub margin-tb-sm" v-for="(journey,index) in journeys" :key="index"> |
|
|
|
<label class="flex justify-between align-center"> |
|
|
|
<radio class="round margin-right-xs" :checked="index === journeyType" :value="journey.value"></radio> |
|
|
|
<text class="flex-sub" style="font-size: 34rpx;">{{ journey.name }}</text> |
|
|
|
</label> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</radio-group> |
|
|
|
</view> |
|
|
|
<view class="cu-form-group flex flex-direction padding-top"> |
|
|
|
<view class="text-xl padding-tb-sm">出行交通方式(必选)</view> |
|
|
|
<radio-group class="block" @change="RadioChange"> |
|
|
|
<view class="cu-list menu text-left"> |
|
|
|
<view class="cu-item" v-for="(transport,index) in transports" :key="index"> |
|
|
|
<label class="flex justify-between align-center"> |
|
|
|
<radio class="round margin-right-xs" :checked="index === current" :value="transport.value"></radio> |
|
|
|
<radio class="round margin-right-xs" :checked="index === tripMode" :value="transport.value"></radio> |
|
|
|
<view class="flex-sub" style="font-size: 34rpx;">{{ transport.name }}</view> |
|
|
|
</label> |
|
|
|
</view> |
|
|
@ -24,7 +37,11 @@ |
|
|
|
</view> |
|
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
|
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>乘坐航班车次或车牌号码及座位号(没有填无)</view> |
|
|
|
<input placeholder="请输入" name="input" type="text" v-model="carNumber" /> |
|
|
|
<input placeholder="请输入" name="input" type="text" v-model="carNo" /> |
|
|
|
</view> |
|
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
|
<view class="title padding-bottom-sm">同行人</view> |
|
|
|
<input placeholder="请输入同行人" name="input" type="text" v-model="together" /> |
|
|
|
</view> |
|
|
|
</form> |
|
|
|
<view class="margin flex flex-wrap"> |
|
|
@ -49,6 +66,8 @@ export default { |
|
|
|
components: {UniCalendar,DateSelector}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
startTime: this.$moment().format('YYYY-MM-DD'), |
|
|
|
endTime: this.$moment().format('YYYY-MM-DD'), |
|
|
|
transports: [ |
|
|
|
{ |
|
|
|
value: '0', |
|
|
@ -75,8 +94,20 @@ export default { |
|
|
|
name: '其他', |
|
|
|
} |
|
|
|
], |
|
|
|
carNumber: '', |
|
|
|
current: 0, |
|
|
|
carNo: '', |
|
|
|
journeys: [ |
|
|
|
{ |
|
|
|
value: '0', |
|
|
|
name: '返校行程', |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: '1', |
|
|
|
name: '日常外出', |
|
|
|
} |
|
|
|
], |
|
|
|
together: '', |
|
|
|
tripMode: 0, |
|
|
|
journeyType: 0, |
|
|
|
agree: false |
|
|
|
}; |
|
|
|
}, |
|
|
@ -84,7 +115,16 @@ export default { |
|
|
|
RadioChange: function(evt) { |
|
|
|
for (let i = 0; i < this.transports.length; i++) { |
|
|
|
if (this.transports[i].value === evt.target.value) { |
|
|
|
this.current = i; |
|
|
|
this.tripMode = i; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
TypeChange: function(evt) { |
|
|
|
for (let i = 0; i < this.journeys.length; i++) { |
|
|
|
if (this.journeys[i].value === evt.target.value) { |
|
|
|
this.journeyType = i; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -97,6 +137,7 @@ export default { |
|
|
|
*/ |
|
|
|
getStartData(start) { |
|
|
|
console.log('出发时间 start: ', start); |
|
|
|
this.startTime = start; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -106,6 +147,7 @@ export default { |
|
|
|
*/ |
|
|
|
getEndData(end) { |
|
|
|
console.log('抵达时间 end: ', end); |
|
|
|
this.endTime = end; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -114,30 +156,26 @@ export default { |
|
|
|
async handleAddStroke() { |
|
|
|
try { |
|
|
|
if (!this.checkRules()) return; |
|
|
|
|
|
|
|
const { |
|
|
|
address, |
|
|
|
animalHeat, |
|
|
|
district, |
|
|
|
healthTypeId, |
|
|
|
hospital, |
|
|
|
token, |
|
|
|
touchHubei, |
|
|
|
touchSick |
|
|
|
carNo, |
|
|
|
endTime, |
|
|
|
journeyType, |
|
|
|
startTime, |
|
|
|
together, |
|
|
|
tripMode |
|
|
|
} = this; |
|
|
|
const params = { |
|
|
|
param: { |
|
|
|
address, |
|
|
|
animalHeat, |
|
|
|
district, |
|
|
|
healthTypeId, |
|
|
|
hospital, |
|
|
|
token, |
|
|
|
touchHubei, |
|
|
|
touchSick |
|
|
|
carNo, |
|
|
|
endTime: +this.$moment(endTime).format('x'), |
|
|
|
journeyType: journeyType+1, |
|
|
|
startTime: +this.$moment(startTime).format('x'), |
|
|
|
together, |
|
|
|
tripMode |
|
|
|
} |
|
|
|
}; |
|
|
|
const res = await this.$http.post(HEALTH_SIGN, params); |
|
|
|
console.log('params2',params) |
|
|
|
const res = await this.$http.post(SUBMIT_JOURNEYS, params); |
|
|
|
const { |
|
|
|
success, |
|
|
|
code, |
|
|
@ -145,14 +183,13 @@ export default { |
|
|
|
data |
|
|
|
} = res.data; |
|
|
|
if (success && code === 200) { |
|
|
|
this.setHealthCode(data.healthCode) |
|
|
|
this.success = true; |
|
|
|
uni.reLaunch({ |
|
|
|
url: `/pages/index/index`, |
|
|
|
}); |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: msg || '申请健康码成功', |
|
|
|
title: msg || '行程添加成功', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
} |
|
|
@ -160,7 +197,7 @@ export default { |
|
|
|
console.log('error: ', error); |
|
|
|
if (error.msg) { |
|
|
|
uni.showToast({ |
|
|
|
title: error.msg || '申请健康码失败', |
|
|
|
title: error.msg || '行程添加失败', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
} |
|
|
@ -169,13 +206,25 @@ export default { |
|
|
|
|
|
|
|
// 验证信息 |
|
|
|
checkRules() { |
|
|
|
const { district,address,healthTypeId,animalHeat,agree } = this; |
|
|
|
if (!this.transports) { |
|
|
|
showToast('请选择身份'); |
|
|
|
const { startTime,endTime,journeyType,tripMode,carNo,agree } = this; |
|
|
|
if (!this.startTime) { |
|
|
|
showToast('请选择出发时间'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.endTime) { |
|
|
|
showToast('请选择抵达时间'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.journeyType<0) { |
|
|
|
showToast('请选择行程类型'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.tripMode<0) { |
|
|
|
showToast('请选择出行交通方式'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.carNumber) { |
|
|
|
showToast('请输入学号'); |
|
|
|
if (!this.carNo) { |
|
|
|
showToast('乘坐航班车次或车牌号码及座位号'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.agree) { |
|
|
|