Commit 67085158 authored by huangyecong's avatar huangyecong

添加省市区接口

parent 89d8e598
......@@ -8,34 +8,34 @@
<ul class="area_box">
<li>
<label>省:</label>
<a-select style="width: 120px">
<a-select style="width: 120px" @change="handleSelectProvince">
<a-select-option
v-for="item in provinceList"
:key="item"
:value="item"
>{{ item }}</a-select-option
:key="item.id"
:value="item.provinceCode"
>{{ item.provinceName }}</a-select-option
>
</a-select>
</li>
<li>
<label>市:</label>
<a-select style="width: 120px">
<a-select style="width: 120px" @change="handleSelectCity">
<a-select-option
v-for="item in provinceList"
:key="item"
:value="item"
>{{ item }}</a-select-option
v-for="item in cityList"
:key="item.id"
:value="item.cityCode"
>{{ item.cityName }}</a-select-option
>
</a-select>
</li>
<li>
<label>区:</label>
<a-select style="width: 120px">
<a-select style="width: 120px" @change="handleSelectDistrict">
<a-select-option
v-for="item in areaList"
:key="item"
:value="item"
>{{ item }}</a-select-option
:key="item.id"
:value="item.districtCode"
>{{ item.districtName }}</a-select-option
>
</a-select>
</li>
......@@ -51,8 +51,8 @@
v-for="(item, index) in mechanismList"
:key="index"
:class="index === selectIndex ? 'active' : ''"
@click="clickTab(index,(item.id))"
>{{ item.supplierName }}-{{item.id}}</span
@click="clickTab(index, item.id)"
>{{ item.supplierName }}-{{ item.id }}</span
>
</div>
</div>
......@@ -94,7 +94,6 @@
<script>
import api from '@/api/customer'
import reserveDate from '../../../components/reserve-date'
import { log } from 'util'
export default {
name: 'selectInstitution',
components: {
......@@ -110,49 +109,91 @@ export default {
return {
datePickShow: false,
selectIndex: 0,
provinceList: ['上海市'],
provinceList: ['上海市'],
areaList: ['静安区'],
provinceList: [], //省
cityList: [], //市
areaList: [], //区
provinceCode: '', //选择省
cityCode: '', //选择市
mechanismList: [],
hospitalList: [],
supplierIds:"",//体检中心ids,默认显示全部
supplierIds: '', //体检中心ids,默认显示全部
servicepackageId: '', //产品id
}
},
created() {
this.getProvinceList()//省
const { servicepackageId } = this.$route.query
this.servicepackageId = servicepackageId ? servicepackageId : ''
this.getProvinceList() //省
this.getSupplierList() //获取体检机构
this.getShopByDistrictCode()//根据体检结构-显示可选择的体检中心,默认显示全部
this.getShopByDistrictCode() //根据体检结构-显示可选择的体检中心,默认显示全部
},
methods: {
// 省
// 获取
async getProvinceList() {
const query = {
customerSex: 'M',
customerMaritalStatus: '02',
chooseList: [{id: 1069}],
payList: [],
chooseList: JSON.parse(window.localStorage.getItem('chooseList')),
servicepackageId: this.servicepackageId,
}
await api.getProvinceList(query).then((res) => {
console.log('省=', res)
if (res.returnCode === '0000') {
this.provinceList = res.content
} else {
this.$message.error(res.returnMsg)
}
})
// await this.getCityListByProvinceCode()
// await this.getDistrictListByCityCode()
},
// 市
// 获取
getCityListByProvinceCode() {
api.getCityListByProvinceCode().then((res) => {
console.log('市=', res)
const query = {
provinceCode: this.provinceCode,
chooseList: JSON.parse(window.localStorage.getItem('chooseList')),
servicepackageId: this.servicepackageId,
}
api.getCityListByProvinceCode(query).then((res) => {
if (res.returnCode === '0000') {
this.cityList = res.content
} else {
this.$message.error(res.returnMsg)
}
})
},
// 区/城市
// 获取区/城市
getDistrictListByCityCode() {
api.getDistrictListByCityCode().then((res) => {
console.log('区/城市=', res)
const query = {
cityCode: this.cityCode,
chooseList: JSON.parse(window.localStorage.getItem('chooseList')),
servicepackageId: this.servicepackageId,
}
api.getDistrictListByCityCode(query).then((res) => {
if (res.returnCode === '0000') {
this.areaList = res.content
} else {
this.$message.error(res.returnMsg)
}
})
},
// 选择省
handleSelectProvince(value) {
console.log(`选择省provinceCode= ${value}`)
this.provinceCode = value
this.getCityListByProvinceCode() // 根据省-获取市
},
// 选择市
handleSelectCity(value) {
console.log(`选择市CityCode= ${value}`)
this.cityCode = value
this.getDistrictListByCityCode() // 根据市-获取区
},
// 选择区
handleSelectDistrict(value){
console.log(`选择区DistrictCode= ${value}`)
},
// 获取体检机构
getSupplierList() {
// this.id
......@@ -167,10 +208,12 @@ export default {
...res.content,
]
// 提取所有的体检机构ids,并用逗号隔开,比如:1004,1007
this.supplierIds = data.map(function(e,i){
this.supplierIds = data
.map(function (e, i) {
return e.id
}).join(',')
console.log('this.supplierIds===',this.supplierIds)
})
.join(',')
console.log('this.supplierIds===', this.supplierIds)
} else {
this.$message.error(res.returnMsg)
}
......@@ -178,9 +221,9 @@ export default {
},
// 选择体检机构
clickTab(index,id) {
clickTab(index, id) {
this.selectIndex = index
console.log("选择体检机构id",index,id);
console.log('选择体检机构id', index, id)
this.supplierIds = id
// 点击选择体检机构,显示该机构下的体检中心
this.getShopByDistrictCode()
......@@ -189,20 +232,19 @@ export default {
// 根据体检机构-获取体检中心列表
getShopByDistrictCode() {
const params = {
customerSex: 'M',//性别
customerMaritalStatus: '02',//婚姻状况
chooseList: [{ id: 1069 }],//必选服务
customerSex: 'M', //性别
customerMaritalStatus: '02', //婚姻状况
chooseList: [{ id: 1069 }], //必选服务
payList: [],
provinceCode: null,//省编号
cityCode: '',//市编号
areaCode: '',//区号
supplierIds: this.supplierIds,//体检机构d
location: ',',//经纬度
servicepackageId: 1043,//客户id
provinceCode: null, //省编号
cityCode: '', //市编号
areaCode: '', //区号
supplierIds: this.supplierIds, //体检机构d
location: ',', //经纬度
servicepackageId: 1043, //客户id
}
api.getShopByDistrictCode(params).then((res) => {
if(res.returnCode==='0000'){
if (res.returnCode === '0000') {
this.hospitalList = res.content
}
})
......
......@@ -57,7 +57,6 @@ import SelectInstitution from './components/selectInstitution.vue'
import Combos from './components/combo.vue'
import Detail from './components/detail.vue'
import api from '@/api/customer'
import { log } from 'util'
export default {
name: 'componentName',
components: {
......
......@@ -2,7 +2,7 @@
<div class="item">
<div class="left">
<div class="title">
<span class="point"></span> {{ item.servicepackageName }}
<span class="point"></span> {{ item.servicepackageName }}-{{item.id}}
</div>
<div class="detail" @click="$router.push(item.detailUrl)">
<img :src="eyes" alt="" />点击查看体检套餐详情
......@@ -55,13 +55,14 @@ export default {
// 立即预约
handleSubmit() {
console.log('立即预约~',this.item.chooseList)
// 本地存储数据-该产品下可选择的体检套餐
window.localStorage.setItem('reservedInfo',JSON.stringify(this.item))
this.$router.push({
name: 'Flow',
query: {
id: this.id,
id: this.id,//客户id
servicepackageId:this.item.id//产品id
},
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment