|
|
// pages/backpeople/backpeople.js
|
|
|
const app = getApp()
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
chuxing: '请选择出行方式',
|
|
|
chuixngarray: ['飞机', '自驾', '火车', '大巴', '其他'],
|
|
|
chuxingindex: 0,
|
|
|
chuxingid: '',
|
|
|
danweiarray: [],
|
|
|
danweiindex: 0,
|
|
|
danweiname: '请选择工作单位',
|
|
|
danweiid: "",
|
|
|
danweiindexk: 0,
|
|
|
danweinamek: '请选择工作单位',
|
|
|
danweiidk: "",
|
|
|
phone: "",
|
|
|
date: '请选择时间',
|
|
|
datek: '请选择时间',
|
|
|
time: '请选择时间',
|
|
|
timek: '请选择时间',
|
|
|
fromname: '请选择来源地',
|
|
|
fromnamek: '请选择来源地',
|
|
|
toname: "请选择目的地",
|
|
|
region: ['天津市', '天津市', '静海区'],
|
|
|
xiangarray: [],
|
|
|
xiangindex: 0,
|
|
|
xiangname: '请选择乡镇',
|
|
|
xiangid: '',
|
|
|
xiangindexk: 0,
|
|
|
xiangnamek: '请选择乡镇',
|
|
|
xiangidk: '',
|
|
|
quarray: [],
|
|
|
quname: '请选择社区',
|
|
|
quid: '',
|
|
|
quindex: 0,
|
|
|
qunamek: '请选择社区',
|
|
|
quidk: '',
|
|
|
quindexk: 0,
|
|
|
is_symptom: 2,
|
|
|
is_symptomk: 2,
|
|
|
gocity: '',
|
|
|
is_epidemic: 2,
|
|
|
is_epidemick: 2,
|
|
|
from_province_id: '',
|
|
|
from_city_id: '',
|
|
|
from_region_id: '',
|
|
|
from_province: '',
|
|
|
from_city: '',
|
|
|
from_region: '',
|
|
|
from_province_idk: '',
|
|
|
from_city_idk: '',
|
|
|
from_region_idk: '',
|
|
|
from_provincek: '',
|
|
|
from_cityk: '',
|
|
|
from_regionk: '',
|
|
|
xingname: '',
|
|
|
|
|
|
card: '',
|
|
|
people: [],
|
|
|
suichebox: [1],
|
|
|
detailadd: '',
|
|
|
back_list: '',
|
|
|
basic: '',
|
|
|
first: '',
|
|
|
companyname: '',
|
|
|
shortworkname: '',
|
|
|
type: "",
|
|
|
basicinfo: '',
|
|
|
clock: '',
|
|
|
scene: '',
|
|
|
falsebtn: false,
|
|
|
workid: '',
|
|
|
|
|
|
nationarray: [{
|
|
|
id: 1,
|
|
|
name: '中国'
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
|
name: '港澳台'
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
|
name: '外籍'
|
|
|
},
|
|
|
|
|
|
|
|
|
],
|
|
|
nationindex: 0,
|
|
|
nation: '中国',
|
|
|
nationid: 1,
|
|
|
certificate: '身份证',
|
|
|
certificateid: 1,
|
|
|
certificatearray: [{
|
|
|
id: 1,
|
|
|
name: '身份证'
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
|
name: '港澳台通行证'
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
|
name: '护照'
|
|
|
},
|
|
|
],
|
|
|
certificateindex:0,
|
|
|
// 从何国返静
|
|
|
from_province:"",
|
|
|
arrivecity:''
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
console.log(options)
|
|
|
this.setData({
|
|
|
falsebtn: false
|
|
|
})
|
|
|
this.getdanweilist();
|
|
|
// 获取乡
|
|
|
this.getxiang();
|
|
|
if (options.type != undefined) {
|
|
|
this.setData({
|
|
|
type: options.type
|
|
|
})
|
|
|
this.getbackinfo()
|
|
|
}
|
|
|
|
|
|
if (options.clock != undefined) {
|
|
|
this.setData({
|
|
|
clock: options.clock,
|
|
|
scene: options.scene
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
// 选择国籍
|
|
|
bindnationChange(e) {
|
|
|
this.setData({
|
|
|
nationindex: e.detail.value,
|
|
|
nation: this.data.nationarray[e.detail.value].name,
|
|
|
nationid: this.data.nationarray[e.detail.value].id
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 从何国返静
|
|
|
fromprovince(e){
|
|
|
this.setData({
|
|
|
from_province:e.detail.value
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//途径国家城市
|
|
|
enterbyway(e){
|
|
|
this.setData({
|
|
|
arrivecity:e.detail.value
|
|
|
})
|
|
|
},
|
|
|
// 选择证件类型
|
|
|
bindcertificateChange(e){
|
|
|
this.setData({
|
|
|
certificateindex:e.detail.value,
|
|
|
certificate: this.data.certificatearray[e.detail.value].name,
|
|
|
certificateid: this.data.certificatearray[e.detail.value].id
|
|
|
})
|
|
|
},// 选择工作单位
|
|
|
selectcompany() {
|
|
|
console.log(8888)
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/selectdanwei/selectdanwei',
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 获取详细信息
|
|
|
getbackinfo() {
|
|
|
let that = this;
|
|
|
var url = '/api/user/back_detail';
|
|
|
var params = {};
|
|
|
app.post(url, params, "post").then((res) => {
|
|
|
console.log(res);
|
|
|
let tempPeople = res.back_list;
|
|
|
|
|
|
that.setData({
|
|
|
people: res.back_list,
|
|
|
basic: res.basic,
|
|
|
chuxing: res.basic.travel,
|
|
|
typename: res.basic.number,
|
|
|
xingname: res.first.name,
|
|
|
card: res.first.identity,
|
|
|
companyname: res.first.company_name,
|
|
|
workid: res.first.company_id,
|
|
|
danweiname: res.first.unit,
|
|
|
phone: res.first.mobile,
|
|
|
date: res.first.arrivetime,
|
|
|
fromname: res.first.from_province + res.first.from_city + res.first.from_region,
|
|
|
from_province_id: res.first.from_province_id,
|
|
|
from_region_id: res.first.from_region_id,
|
|
|
from_city_id: res.first.from_city_id,
|
|
|
from_province: res.first.from_province,
|
|
|
from_city: res.first.from_city,
|
|
|
from_region: res.first.from_region,
|
|
|
xiangname: res.first.town_p_name,
|
|
|
xiangid: res.first.town_pid,
|
|
|
quname: res.first.town_name,
|
|
|
quid: res.first.town_id,
|
|
|
detailadd: res.first.add,
|
|
|
is_epidemic: res.first.is_epidemic,
|
|
|
is_symptom: res.first.is_symptom,
|
|
|
gocity: res.first.arrivecity,
|
|
|
xiangindex: res.first.town_pid - 1,
|
|
|
quindex: res.first.town_id - 41,
|
|
|
arrivecity: res.first.arrivecity,
|
|
|
nation: res.first.nation == 1 ? '中国' : res.first.nation == 2 ? '港澳台通行证' :'护照',
|
|
|
nationid: res.first.nation,
|
|
|
certificate: res.first.credentials_type == 1 ? '身份证号' : res.first.credentials_type == 2 ? '港澳台通行证' :'护照',
|
|
|
certificateid: res.first.credentials_type,
|
|
|
|
|
|
|
|
|
})
|
|
|
let chuixngarray = that.data.chuixngarray;
|
|
|
for (var i = 0; i < chuixngarray.length; i++) {
|
|
|
if (chuixngarray[i] == res.basic.travel) {
|
|
|
|
|
|
that.setData(({
|
|
|
chuxingindex: i
|
|
|
}))
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
that.getqu();
|
|
|
// 获取司机目标社区
|
|
|
var first = res.first;
|
|
|
if (first.length == 0) {
|
|
|
that.setData({
|
|
|
xiangname: that.data.xiangarray[0].name,
|
|
|
xiangid: that.data.xiangarray[0].id,
|
|
|
xiangindex: 0
|
|
|
})
|
|
|
} else {
|
|
|
app.post('/api/index/town', {
|
|
|
type: 2,
|
|
|
pid: first.town_pid || 1
|
|
|
}).then((res) => {
|
|
|
let town = res.town;
|
|
|
first.quarray = town;
|
|
|
for (let i in town) {
|
|
|
if (town[i].id == first.town_id) {
|
|
|
first.quindex = i;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
that.setData({
|
|
|
first: first,
|
|
|
})
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 初始化随车人员乡镇所在地
|
|
|
|
|
|
for (let obj of tempPeople) {
|
|
|
for (let i in that.data.xiangarray) {
|
|
|
if (obj.town_pid == that.data.xiangarray[i].id) {
|
|
|
obj.xiangindex = i
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.setData({
|
|
|
people: tempPeople
|
|
|
})
|
|
|
|
|
|
for (let i in tempPeople) {
|
|
|
that.getTown(tempPeople[i].town_pid, i, tempPeople[i].town_id)
|
|
|
}
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 添加随车人员
|
|
|
addsuiche() {
|
|
|
let newsuichebox = this.data.suichebox;
|
|
|
var newpeople = this.data.people;
|
|
|
let obj = {
|
|
|
is_symptom: 2,
|
|
|
is_epidemic: 2,
|
|
|
unit_id: '',
|
|
|
town_p_name: '请选择乡镇',
|
|
|
town_name: '请选择社区',
|
|
|
arrivetime: '请选择时间',
|
|
|
from_province: '请选择来源地',
|
|
|
|
|
|
}
|
|
|
newsuichebox.push(1);
|
|
|
newpeople.push(obj)
|
|
|
this.setData({
|
|
|
suichebox: newsuichebox,
|
|
|
people: newpeople
|
|
|
})
|
|
|
console.log(this.data.people)
|
|
|
this.getxiang();
|
|
|
|
|
|
},
|
|
|
selsy() {
|
|
|
this.setData({
|
|
|
is_symptom: 1
|
|
|
})
|
|
|
|
|
|
|
|
|
},
|
|
|
selsyk(e) {
|
|
|
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].is_symptom = 1;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
|
|
|
console.log(this.data.people)
|
|
|
},
|
|
|
selsn(e) {
|
|
|
this.setData({
|
|
|
is_symptom: 2
|
|
|
})
|
|
|
},
|
|
|
selsnk(e) {
|
|
|
this.setData({
|
|
|
is_symptomk: 2
|
|
|
})
|
|
|
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].is_symptom = 2;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
|
|
|
console.log(this.data.people)
|
|
|
},
|
|
|
selzy(e) {
|
|
|
this.setData({
|
|
|
is_epidemic: 1
|
|
|
})
|
|
|
|
|
|
},
|
|
|
selzyk(e) {
|
|
|
this.setData({
|
|
|
is_epidemick: 1
|
|
|
})
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].is_epidemic = 1;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
},
|
|
|
selzn(e) {
|
|
|
this.setData({
|
|
|
is_epidemic: 2
|
|
|
})
|
|
|
},
|
|
|
selznk(e) {
|
|
|
this.setData({
|
|
|
is_epidemick: 2
|
|
|
})
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].is_epidemic = 2;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
},
|
|
|
gocity(e) {
|
|
|
this.setData({
|
|
|
gocity: e.detail.value
|
|
|
})
|
|
|
|
|
|
console.log(this.data.gocity)
|
|
|
},
|
|
|
gocityk(e) {
|
|
|
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].arrivecity = e.detail.value;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
console.log(this.data.people)
|
|
|
},
|
|
|
// 获取乡镇
|
|
|
getxiang() {
|
|
|
let that = this;
|
|
|
var url = '/api/index/town';
|
|
|
var params = {
|
|
|
type: 1,
|
|
|
pid: ''
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
that.setData({
|
|
|
xiangarray: res.town
|
|
|
})
|
|
|
console.log(this.data.xiangarray)
|
|
|
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
bindxiangChange: function(e) {
|
|
|
|
|
|
this.setData({
|
|
|
xiangname: this.data.xiangarray[e.detail.value].name,
|
|
|
xiangid: this.data.xiangarray[e.detail.value].id,
|
|
|
xiangindex: e.detail.value,
|
|
|
quname: '',
|
|
|
quid: ''
|
|
|
})
|
|
|
this.getqu()
|
|
|
},
|
|
|
bindxiangChangek: function(e) {
|
|
|
console.log(e)
|
|
|
let that = this,
|
|
|
index = e.currentTarget.dataset.index,
|
|
|
t_index = e.detail.value,
|
|
|
xiangArry = this.data.xiangarray;
|
|
|
let pid = xiangArry[t_index].id;
|
|
|
|
|
|
if (that.data.people[index].town_pid != pid) {
|
|
|
that.data.people[index].xiangindex = index;
|
|
|
that.data.people[index].town_p_name = xiangArry[t_index].name;
|
|
|
that.data.people[index].town_pid = pid;
|
|
|
that.data.people[index].town_name = ""
|
|
|
that.data.people[index].town_id = ""
|
|
|
this.setData({
|
|
|
people: that.data.people
|
|
|
})
|
|
|
this.getTown(pid, index, '')
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getqu() {
|
|
|
let that = this;
|
|
|
var url = '/api/index/town';
|
|
|
var params = {
|
|
|
type: 2,
|
|
|
pid: that.data.xiangid || 1
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
this.setData({
|
|
|
'first.quarray': res.town,
|
|
|
'first.quindex': 0,
|
|
|
quname: this.data.quname || res.town[0].name,
|
|
|
quid: this.data.quid || res.town[0].id
|
|
|
})
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
|
|
|
getTown(id, index, townId) {
|
|
|
let that = this;
|
|
|
var url = '/api/index/town';
|
|
|
var params = {
|
|
|
type: 2,
|
|
|
pid: id
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
let town = res.town;
|
|
|
that.data.people[index].quarrayk = town;
|
|
|
for (let i in town) {
|
|
|
if (town[i].id == townId) {
|
|
|
that.data.people[index].quindex = i;
|
|
|
that.data.people[index].town_name = town[i].name;
|
|
|
that.data.people[index].town_id = town[i].id;
|
|
|
break;
|
|
|
} else {
|
|
|
that.data.people[index].quindex = 0;
|
|
|
that.data.people[index].town_id = town[0].id;
|
|
|
that.data.people[index].town_name = town[0].name;
|
|
|
}
|
|
|
}
|
|
|
that.setData({
|
|
|
people: that.data.people,
|
|
|
})
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
|
|
|
bindquChange: function(e) {
|
|
|
|
|
|
this.setData({
|
|
|
quname: this.data.first.quarray[e.detail.value].name,
|
|
|
quid: this.data.first.quarray[e.detail.value].id,
|
|
|
quindex: e.detail.value,
|
|
|
'first.quindex': e.detail.value,
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
bindquChangek: function(e) {
|
|
|
console.log(e)
|
|
|
let index = e.currentTarget.dataset.index,
|
|
|
chooseIndex = e.detail.value;
|
|
|
this.data.people[index].quindex = chooseIndex;
|
|
|
this.data.people[index].town_name = this.data.people[index].quarrayk[chooseIndex].name;
|
|
|
this.data.people[index].town_id = this.data.people[index].quarrayk[chooseIndex].id;
|
|
|
this.setData({
|
|
|
people: this.data.people
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 判断乡镇
|
|
|
panduan(e) {
|
|
|
console.log(343)
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people
|
|
|
for (var i = 0; i < newpeople.length; i++) {
|
|
|
if (newpeople[i].town_p_name == '请选择乡镇') {
|
|
|
|
|
|
wx.showToast({
|
|
|
title: '请先选择乡镇',
|
|
|
icon: "none"
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
bindtypeChange: function(e) {
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
chuxingindex: e.detail.value,
|
|
|
|
|
|
chuxing: this.data.chuixngarray[e.detail.value]
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
// 获取工作单位
|
|
|
getdanweilist() {
|
|
|
let that = this;
|
|
|
var url = '/api/index/unit';
|
|
|
var params = {
|
|
|
|
|
|
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
|
|
|
that.setData({
|
|
|
danweiarray: res.unit
|
|
|
})
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
binddanChange: function(e) {
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
danweiindex: e.detail.value,
|
|
|
|
|
|
danweiname: this.data.danweiarray[e.detail.value].name,
|
|
|
danweiid: this.data.danweiarray[e.detail.value].id
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
binddanChangek: function(e) {
|
|
|
console.log(e)
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
// this.setData({
|
|
|
// danweiindexk: e.detail.value,
|
|
|
|
|
|
// danweinamek: this.data.danweiarray[e.detail.value].name,
|
|
|
// danweiidk: this.data.danweiarray[e.detail.value].id
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].unit_id = this.data.danweiarray[e.detail.value].id;
|
|
|
newpeople[index].unit = this.data.danweiarray[e.detail.value].name;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 到达静海时间
|
|
|
bindDateChange: function(e) {
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
date: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
bindDateChangek: function(e) {
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
datek: e.detail.value
|
|
|
})
|
|
|
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].arrivetime = e.detail.value
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
|
|
|
},
|
|
|
bindTimeChange: function(e) {
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
time: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
bindTimeChangek: function(e) {
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
timek: e.detail.value
|
|
|
})
|
|
|
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].arrivetime = this.data.dateK = this.data.timeK
|
|
|
},
|
|
|
|
|
|
bindRegionChange: function(e) {
|
|
|
console.log(e)
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
fromname: e.detail.value[0] + e.detail.value[1] + e.detail.value[2],
|
|
|
from_province_id: e.detail.code[0],
|
|
|
from_city_id: e.detail.code[1],
|
|
|
from_region_id: e.detail.code[2],
|
|
|
from_province: e.detail.value[0],
|
|
|
from_city: e.detail.value[1],
|
|
|
from_region: e.detail.value[2]
|
|
|
|
|
|
})
|
|
|
},
|
|
|
bindRegionChangek: function(e) {
|
|
|
console.log(e)
|
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
this.setData({
|
|
|
fromnamek: e.detail.value[0] + e.detail.value[1] + e.detail.value[2],
|
|
|
from_province_idk: e.detail.code[0],
|
|
|
from_city_idk: e.detail.code[1],
|
|
|
from_region_idk: e.detail.code[2],
|
|
|
from_provincek: e.detail.value[0],
|
|
|
from_cityk: e.detail.value[1],
|
|
|
from_regionk: e.detail.value[2]
|
|
|
|
|
|
})
|
|
|
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].from_province_id = e.detail.code[0],
|
|
|
newpeople[index].from_city_id = e.detail.code[1],
|
|
|
newpeople[index].from_region_id = e.detail.code[2],
|
|
|
newpeople[index].from_province = e.detail.value[0],
|
|
|
newpeople[index].from_city = e.detail.value[1],
|
|
|
newpeople[index].from_region = e.detail.value[2]
|
|
|
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
},
|
|
|
entertype(e) {
|
|
|
this.setData({
|
|
|
typename: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
// 手机号
|
|
|
enterphone(e) {
|
|
|
this.setData({
|
|
|
phone: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
enterphonek(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].mobile = e.detail.value;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
},
|
|
|
// 姓名
|
|
|
entername(e) {
|
|
|
this.setData({
|
|
|
xingname: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
enternamek(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].name = e.detail.value;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
console.log(this.data.people)
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
// 输入公司
|
|
|
entercompany(e) {
|
|
|
this.setData({
|
|
|
companyname: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
entercompanyk(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].unit_id = e.detail.value;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 身份证号
|
|
|
entercard(e) {
|
|
|
let that = this
|
|
|
that.setData({
|
|
|
card: e.detail.value
|
|
|
})
|
|
|
if (that.data.type == '') {
|
|
|
|
|
|
}
|
|
|
|
|
|
console.log(this.data.card)
|
|
|
},
|
|
|
entercardk(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
console.log(index)
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].identity = e.detail.value;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
|
|
|
console.log(this.data.people)
|
|
|
},
|
|
|
|
|
|
// 详细地址
|
|
|
enterdetailadd(e) {
|
|
|
this.setData({
|
|
|
detailadd: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
enterdetailaddk(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let newpeople = this.data.people;
|
|
|
newpeople[index].add = e.detail.value;
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
},
|
|
|
|
|
|
del(e) {
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
console.log(index)
|
|
|
let newpeople = this.data.people;
|
|
|
for (var i = 0; i < newpeople.length; i++) {
|
|
|
newpeople.splice(index, 1)
|
|
|
}
|
|
|
this.setData({
|
|
|
people: newpeople
|
|
|
})
|
|
|
|
|
|
|
|
|
},
|
|
|
finish() {
|
|
|
let that = this;
|
|
|
|
|
|
console.log(that.data.falsebtn)
|
|
|
var url = '/api/user/back_nation';
|
|
|
console.log(this.data.people)
|
|
|
if (that.data.chuxing == '请选择出行方式') {
|
|
|
wx.showToast({
|
|
|
title: '请选择出行方式',
|
|
|
icon: "none"
|
|
|
})
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
|
|
|
let newpeople = that.data.people;
|
|
|
|
|
|
newpeople.forEach(item => delete item.quarray)
|
|
|
console.log(newpeople)
|
|
|
for (let obj of newpeople) {
|
|
|
delete obj['quarrayk'];
|
|
|
delete obj['quindex'];
|
|
|
delete obj['xiangindex'];
|
|
|
}
|
|
|
var params = {
|
|
|
travel: that.data.chuxing,
|
|
|
number: that.data.typename,
|
|
|
name: this.data.xingname,
|
|
|
mobile: this.data.phone,
|
|
|
nation: that.data.nationid,
|
|
|
credentials_type: that.data.certificateid,
|
|
|
identity: this.data.card,
|
|
|
from_province: this.data.from_province,
|
|
|
arrivecity: this.data.arrivecity,
|
|
|
arrivetime: this.data.date,
|
|
|
|
|
|
town_pid: this.data.xiangid,
|
|
|
town_id: this.data.quid,
|
|
|
add: this.data.detailadd,
|
|
|
is_symptom: this.data.is_symptom,
|
|
|
is_epidemic: this.data.is_epidemic,
|
|
|
people: JSON.stringify(newpeople),
|
|
|
}
|
|
|
app.post(url, params, "post").then((res) => {
|
|
|
console.log(res);
|
|
|
wx.showToast({
|
|
|
title: '提交成功',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
that.setData({
|
|
|
falsebtn: true
|
|
|
})
|
|
|
if (that.data.clock == 1) {
|
|
|
setTimeout(function() {
|
|
|
wx.redirectTo({
|
|
|
url: '/pages/clock/clock?scene=' + that.data.scene,
|
|
|
})
|
|
|
}, 1500)
|
|
|
} else {
|
|
|
setTimeout(function() {
|
|
|
wx.redirectTo({
|
|
|
url: '/pages/outbackpeopledetail/outbackpeopledetail',
|
|
|
})
|
|
|
}, 1500)
|
|
|
}
|
|
|
}).catch((err) => {
|
|
|
|
|
|
wx.showToast({
|
|
|
title: err.data.msg,
|
|
|
icon: 'none'
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
companyname: app.globalData.workname != undefined ? app.globalData.workname : '请选择工作单位',
|
|
|
shortworkname: app.globalData.shortworkname != undefined ? app.globalData.shortworkname : '',
|
|
|
workid: app.globalData.workid != undefined ? app.globalData.workid : ''
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log(app.globalData.workname);
|
|
|
console.log(app.globalData.workid)
|
|
|
console.log(app.globalData.shortworkname)
|
|
|
|
|
|
let token = wx.getStorageSync("token");
|
|
|
if (token == '') {
|
|
|
wx.showToast({
|
|
|
title: '请先授权登录',
|
|
|
icon: "none"
|
|
|
})
|
|
|
|
|
|
setTimeout(function() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/start/start',
|
|
|
})
|
|
|
}, 1500)
|
|
|
|
|
|
|
|
|
|
|
|
let url = '/pages/outbackpeopledoor/outbackpeopledoor';
|
|
|
wx.setStorageSync("url", url)
|
|
|
wx.setStorageSync("nologin", true)
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|