更改区县根据定位

This commit is contained in:
闫晓茹 2023-11-13 10:37:21 +08:00
parent 67c22e8731
commit 38f694e948
3 changed files with 304 additions and 279 deletions

View File

@ -20,7 +20,6 @@
预约状态
<!-- <span v-if="item.exceedStatus == '0'">生效中</span>
<span v-if="item.exceedStatus == '1'">已过期</span> -->
<uni-tag v-if="item.exceedStatus == '0'" text="生效中" size="mini" type="success" />
<uni-tag v-if="item.exceedStatus == '1'" size="mini" text="已过期" />
</view>

View File

@ -62,7 +62,6 @@
</view>
<u-action-sheet :show="showSex" :actions="actions" title="请选择性别" @close="showSex = false" @select="sexSelect">
</u-action-sheet>
11
<u-toast ref="uToast" />
</view>
</template>

View File

@ -197,14 +197,15 @@
protocolshow: false,
radio: '',
stepnumber: 1,
code:'',
query: {
province: '370000000000',
provinceName: '山东省',
residentName: null,
identity: null,
phone: null,
city: '371400000000',
cityName: '德州市',
city: '',
cityName: '',
county: null,
countyName: null,
town: null,
@ -303,295 +304,321 @@
title: '请先同意并签署服务协议',
type: 'error',
})
}else{
// if (!this.query.county || !this.query.orgNo || !this.query.userName || !this.query.crowdList || this.query
// .crowdList.length == 0 || !this.query.packageList ||
// this.query.packageList.length == 0) {
// this.$refs.uToast.show({
// title: '',
// type: 'error',
// })
// return
// }
if (this.query.signYears >= 10) {
} else {
// if (!this.query.county || !this.query.orgNo || !this.query.userName || !this.query.crowdList || this.query
// .crowdList.length == 0 || !this.query.packageList ||
// this.query.packageList.length == 0) {
// this.$refs.uToast.show({
// title: '',
// type: 'error',
// })
// return
// }
if (this.query.signYears >= 10) {
this.$refs.uToast.show({
title: '签约周期过长',
type: 'error',
})
return
}
if (!this.query.signYears) {
this.query.signYears = 1
}
let signTime = new Date(this.query.signTime);
let dueTime = new Date(new Date(signTime.setFullYear(signTime.getFullYear() + Number(this.query
.signYears)))
.setDate(signTime.getDate() - 1))
let dueY = dueTime.getFullYear()
let dueM = dueTime.getMonth() + 1
let dueD = dueTime.getDate()
this.query.signDeadline = dueY + '-' + dueM + '-' + dueD
if (this.query.identity) {
this.query.birthday = getBirthday(this.query.identity)
this.query.age = getAgeFun(this.query.birthday)
let gender = getSex(this.query.identity)
if (gender == '女') {
this.query.gender = 2
} else if (gender == '男') {
this.query.gender = 1
} else {
this.query.gender = 99
}
}
if (this.query.residentAutographPath) {
this.updata();
} else {
this.protocolshow = true
}
}
},
updata() {
if (this.radio == 2) {
if (!this.query.signYears) this.query.signYears = 1
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (month < 10) {
month = '0' + month;
}
if (day < 10) {
day = '0' + day;
}
this.query.signTime = year + '-' + month + '-' + day;
if (this.query.identity) {
this.query.birthday = getBirthday(this.query.identity)
let gender = getSex(this.query.identity)
if (gender == '女') {
this.query.gender = 2
} else if (gender == '男') {
this.query.gender = 1
} else {
this.query.gender = 99
}
}
applysave(this.query).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '签约成功',
type: 'success',
})
uni.switchTab({
url: "/pages/homepage/homepage"
})
} else {
this.$refs.uToast.show({
title: '签约失败,请重新签约',
type: 'error',
})
}
})
// }
} else {
this.$refs.uToast.show({
title: '签约周期过长',
title: '请先同意并签署服务协议',
type: 'error',
})
}
},
//
changeRadio() {
this.radio == 1 ? this.radio = 2 : this.radio = 1
},
//
tapstep(val) {
if (val == 1) {
this.stepnumber = 1
} else if (val == 2) {
this.stepnumber = 2
} else if (val == '+') {
this.stepnumber++
} else if (val == '-') {
this.stepnumber--
}
},
//
countyconfirm(e) {
this.query.county = e[0].value
this.query.countyName = e[0].label
const pid = this.countylist.find(m => m.areaCode === e[0].value).id
this.arealistinfo(pid, 'Township')
},
//
Townshipconfirm(e) {
this.query.town = e[0].value
this.query.townName = e[0].label
const pid = this.Townshiplist.find(m => m.streetCode === e[0].value).id
this.arealistinfo(pid, 'village')
},
//
villageconfirm(e) {
this.query.committee = e[0].value
this.query.committeeName = e[0].label
},
//list
arealistinfo(code, list) {
var region = uni.getStorageSync('region')
//
if (region == 1) {
this.query.city='371400000000'
this.query.cityName='德州市'
arealist(code).then(res => {
if (list == 'county') {
this.countylist = res.data
} else if (list == 'Township') {
this.Townshiplist = res.data
} else if (list == 'village') {
this.villagelist = res.data
}
})
} else {
this.query.city = 370500000000
this.query.cityName='东营市'
arealist(code).then(res => {
if (list == 'county') {
this.countylist = res.data
} else if (list == 'Township') {
this.Townshiplist = res.data
} else if (list == 'village') {
this.villagelist = res.data
}
})
}
},
//
gochoosedoctor() {
if (!this.query.orgNo) {
this.$refs.uToast.show({
title: '请先选择签约机构',
type: 'error',
})
} else {
uni.navigateTo({
url: `/pagesC/choosedoctor/choosedoctor?orgNo=${this.query.orgNo}&userNo=${this.query.userNo}&static=${1}`
})
}
},
//
goselectInstitution() {
uni.navigateTo({
url: `/pagesC/selectInstitution/selectInstitution?orgNo=${this.query.orgNo}`
})
},
//
Townshipshowtrue() {
if (!this.query.county) {
this.$refs.uToast.show({
title: '请先选择区县',
type: 'error',
})
} else {
this.Townshipshow = true
}
},
//
villageshowtrue() {
if (!this.query.townName) {
this.$refs.uToast.show({
title: '请先选择街道/乡镇',
type: 'error',
})
} else {
this.villageshow = true
}
},
//
changeCrowd() {
this.showGroup = 1
this.popupShow = true
},
//
changePackages() {
if (!this.query.crowdNoList) {
this.$refs.uToast.show({
title: '请先选择所属人群',
type: 'error',
})
return
}
if (!this.query.signYears) {
this.query.signYears = 1
}
let signTime = new Date(this.query.signTime);
let dueTime = new Date(new Date(signTime.setFullYear(signTime.getFullYear() + Number(this.query
.signYears)))
.setDate(signTime.getDate() - 1))
let dueY = dueTime.getFullYear()
let dueM = dueTime.getMonth() + 1
let dueD = dueTime.getDate()
this.query.signDeadline = dueY + '-' + dueM + '-' + dueD
if (this.query.identity) {
this.query.birthday = getBirthday(this.query.identity)
this.query.age = getAgeFun(this.query.birthday)
let gender = getSex(this.query.identity)
if (gender == '女') {
this.query.gender = 2
} else if (gender == '男') {
this.query.gender = 1
} else {
this.query.gender = 99
}
}
if (this.query.residentAutographPath) {
this.updata();
} else {
this.protocolshow = true
}
}
},
updata() {
if (this.radio == 2) {
if (!this.query.signYears) this.query.signYears = 1
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (month < 10) {
month = '0' + month;
}
if (day < 10) {
day = '0' + day;
}
this.query.signTime = year + '-' + month + '-' + day;
if (this.query.identity) {
this.query.birthday = getBirthday(this.query.identity)
let gender = getSex(this.query.identity)
if (gender == '女') {
this.query.gender = 2
} else if (gender == '男') {
this.query.gender = 1
} else {
this.query.gender = 99
}
}
applysave(this.query).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '签约成功',
type: 'success',
})
uni.switchTab({
url: "/pages/homepage/homepage"
})
} else {
this.$refs.uToast.show({
title: '签约失败,请重新签约',
type: 'error',
})
}
})
// }
} else {
this.$refs.uToast.show({
title: '请先同意并签署服务协议',
type: 'error',
})
}
},
//
changeRadio() {
this.radio == 1 ? this.radio = 2 : this.radio = 1
},
//
tapstep(val) {
if (val == 1) {
this.stepnumber = 1
} else if (val == 2) {
this.stepnumber = 2
} else if (val == '+') {
this.stepnumber++
} else if (val == '-') {
this.stepnumber--
}
},
//
countyconfirm(e) {
this.query.county = e[0].value
this.query.countyName = e[0].label
const pid = this.countylist.find(m => m.areaCode === e[0].value).id
this.arealistinfo(pid, 'Township')
},
//
Townshipconfirm(e) {
this.query.town = e[0].value
this.query.townName = e[0].label
const pid = this.Townshiplist.find(m => m.streetCode === e[0].value).id
this.arealistinfo(pid, 'village')
},
//
villageconfirm(e) {
this.query.committee = e[0].value
this.query.committeeName = e[0].label
},
//list
arealistinfo(code, list) {
arealist(code).then(res => {
if (list == 'county') {
this.countylist = res.data
} else if (list == 'Township') {
this.Townshiplist = res.data
} else if (list == 'village') {
this.villagelist = res.data
}
})
},
//
gochoosedoctor() {
if (!this.query.orgNo) {
this.$refs.uToast.show({
title: '请先选择签约机构',
type: 'error',
})
} else {
uni.navigateTo({
url: `/pagesC/choosedoctor/choosedoctor?orgNo=${this.query.orgNo}&userNo=${this.query.userNo}&static=${1}`
})
}
},
//
goselectInstitution() {
uni.navigateTo({
url: `/pagesC/selectInstitution/selectInstitution?orgNo=${this.query.orgNo}`
})
},
//
Townshipshowtrue() {
if (!this.query.county) {
this.$refs.uToast.show({
title: '请先选择区县',
type: 'error',
})
} else {
this.Townshipshow = true
}
},
//
villageshowtrue() {
if (!this.query.town) {
this.$refs.uToast.show({
title: '请先选择街道/乡镇',
type: 'error',
})
} else {
this.villageshow = true
}
},
//
changeCrowd() {
this.showGroup = 1
this.popupShow = true
},
//
changePackages() {
if (!this.query.crowdNoList) {
this.$refs.uToast.show({
title: '请先选择所属人群',
type: 'error',
})
return
}
if (!this.query.orgNo) {
this.$refs.uToast.show({
title: '请先选择签约机构',
type: 'error',
})
return
}
this.showGroup = 2
this.popupShow = true
},
//list
getCrowdinfo() {
getCrowd(uni.getStorageSync('userinfo').cardNo).then(res => {
res.data.forEach(e => {
e.checked = false
})
this.crowdslist = res.data
})
},
closeCrowds() {
this.popupShow = false
if (this.showGroup == 1) {
this.query.crowdList = []
this.query.crowdsName = ''
this.query.crowdNoList.forEach(el => {
this.crowdslist.forEach(ele => {
if (el == ele.crowdNo) {
var obj = {
crowdNo: ele.crowdNo,
crowdName: ele.crowdName
}
this.query.crowdList.push(obj)
this.query.crowdsName = ele.crowdName + ',' + this.query.crowdsName
}
if (!this.query.orgNo) {
this.$refs.uToast.show({
title: '请先选择签约机构',
type: 'error',
})
})
var obj = {
crowdNoList: this.query.crowdNoList,
orgNo: this.query.orgNo
return
}
getPackageByCrowdNo(obj, '1').then(res => {
this.showGroup = 2
this.popupShow = true
},
//list
getCrowdinfo() {
getCrowd(uni.getStorageSync('userinfo').cardNo).then(res => {
res.data.forEach(e => {
e.checked = false
})
this.packageslist = res.data
this.crowdslist = res.data
})
} else {
this.query.packageList = []
this.query.packagesName = ''
this.query.BasePackage = ''
this.query.PersonalityPack = ''
this.query.packSignCost = 0
this.query.packageNoList.forEach(el => {
this.packageslist.forEach(ele => {
if (el == ele.packageNo) {
this.query.packSignCost = this.query.packSignCost + ele.packCost
var obj = {
packageNo: ele.packageNo,
packageName: ele.packageName
},
closeCrowds() {
this.popupShow = false
if (this.showGroup == 1) {
this.query.crowdList = []
this.query.crowdsName = ''
this.query.crowdNoList.forEach(el => {
this.crowdslist.forEach(ele => {
if (el == ele.crowdNo) {
var obj = {
crowdNo: ele.crowdNo,
crowdName: ele.crowdName
}
this.query.crowdList.push(obj)
this.query.crowdsName = ele.crowdName + ',' + this.query.crowdsName
}
this.query.packageList.push(obj)
this.query.packagesName = ele.packageName + ',' + this.query.packagesName
if (ele.packCategory == 0) {
this.query.BasePackage = ele.packageName + ',' + this.query.BasePackage
} else if (ele.packCategory == 1) {
this.query.PersonalityPack = ele.packageName + ',' + this.query
.PersonalityPack
}
}
})
})
})
var obj = {
crowdNoList: this.query.crowdNoList,
orgNo: this.query.orgNo
}
getPackageByCrowdNo(obj, '1').then(res => {
res.data.forEach(e => {
e.checked = false
})
this.packageslist = res.data
})
} else {
this.query.packageList = []
this.query.packagesName = ''
this.query.BasePackage = ''
this.query.PersonalityPack = ''
this.query.packSignCost = 0
this.query.packageNoList.forEach(el => {
this.packageslist.forEach(ele => {
if (el == ele.packageNo) {
this.query.packSignCost = this.query.packSignCost + ele.packCost
var obj = {
packageNo: ele.packageNo,
packageName: ele.packageName
}
this.query.packageList.push(obj)
this.query.packagesName = ele.packageName + ',' + this.query.packagesName
if (ele.packCategory == 0) {
this.query.BasePackage = ele.packageName + ',' + this.query.BasePackage
} else if (ele.packCategory == 1) {
this.query.PersonalityPack = ele.packageName + ',' + this.query
.PersonalityPack
}
}
})
})
}
},
crowdscheckboxGroupChange(e) {
this.query.crowdNoList = e
},
packagescheckboxGroupChange(e) {
this.query.packageNoList = e
},
//
residentAutographPath(data) {
this.query.residentAutographPath = data.residentAutographPath
this.protocolshow = false
},
},
onLoad(options) {
var region = uni.getStorageSync('region')
//
if (region == 1) {
this.arealistinfo('371400000000 ', 'county');
} else {
this.arealistinfo('370500000000', 'county');
}
},
crowdscheckboxGroupChange(e) {
this.query.crowdNoList = e
},
packagescheckboxGroupChange(e) {
this.query.packageNoList = e
},
//
residentAutographPath(data) {
this.query.residentAutographPath = data.residentAutographPath
this.protocolshow = false
},
},
onLoad(options) {
this.arealistinfo('371400000000 ', 'county');
// }
this.getCrowdinfo();
let date = new Date();
let year = date.getFullYear();