提交 6738b197 编写于 作者: 张敬贤's avatar 张敬贤

Feature/zjx

上级 040d2ee4
...@@ -3,7 +3,7 @@ import request from 'mn-template/plugins/http'; ...@@ -3,7 +3,7 @@ import request from 'mn-template/plugins/http';
// 根据订单号获取检测名称 // 根据订单号获取检测名称
// /tis/insurance/detectionName?yunOrderNo=11 // /tis/insurance/detectionName?yunOrderNo=11
export const getDetectionName = (yunOrderNo) => { export const getDetectionName = async (yunOrderNo) => {
return request({ return request({
method: 'get', method: 'get',
url: `/tis/insurance/detectionName?yunOrderNo=${yunOrderNo}`, url: `/tis/insurance/detectionName?yunOrderNo=${yunOrderNo}`,
...@@ -13,14 +13,14 @@ export const getDetectionName = (yunOrderNo) => { ...@@ -13,14 +13,14 @@ export const getDetectionName = (yunOrderNo) => {
// /tis/insurance/order/info?yunOrderNo=1 // /tis/insurance/order/info?yunOrderNo=1
// 查询订单信息 // 查询订单信息
export const getOrderInfo = (yunOrderNo) => { export const getOrderInfo = async (yunOrderNo) => {
return request({ return request({
method: 'get', method: 'get',
url: `/tis/insurance/order/info?yunOrderNo=${yunOrderNo}`, url: `/tis/insurance/order/info?yunOrderNo=${yunOrderNo}`,
withCredentials: true, withCredentials: true,
}); });
}; };
export const appointment = (data) => { export const appointment = async (data) => {
return request({ return request({
method: 'post', method: 'post',
data, data,
...@@ -31,17 +31,20 @@ export const appointment = (data) => { ...@@ -31,17 +31,20 @@ export const appointment = (data) => {
// /insurance/getDetailByYunOrderNo // /insurance/getDetailByYunOrderNo
// 查看预约详情 // 查看预约详情
export const getDetailByYunOrderNo = (yunOrderNo) => { export const getDetailByYunOrderNo = async (yunOrderNo) => {
return request({ return request({
method: 'get', method: 'get',
url: `/tis/insurance/getDetailByYunOrderNo?yunOrderNo=${yunOrderNo}`, url: `/tis/insurance/getDetailByYunOrderNo?yunOrderNo=${yunOrderNo}`,
withCredentials: true, withCredentials: true,
}); });
}; };
export const getHospitalList = (data) => { export const getHospitalList = async(data) => {
return request({ return request({
method: 'post', method: 'post',
data, data,
headers: {
noLoading:true,
},
url: '/tis/insurance/hospitalList', url: '/tis/insurance/hospitalList',
withCredentials: true, withCredentials: true,
}); });
......
...@@ -19,6 +19,7 @@ const loading = { ...@@ -19,6 +19,7 @@ const loading = {
instance.show = true; instance.show = true;
}, },
hide: () => { hide: () => {
setTimeout(() => { setTimeout(() => {
instance.show = false; instance.show = false;
}, 300); }, 300);
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
:close-on-click-overlay="false" :close-on-click-overlay="false"
style="background-color: transparent" style="background-color: transparent"
> >
<div class="loadingWrap"> <div
id="globalLoading"
class="loadingWrap"
>
<van-loading <van-loading
v-if="show" v-if="show"
type="spinner" type="spinner"
......
// //
import request from 'mn-template/plugins/http'; import request from 'mn-template/plugins/http';
// * // *
// * 获取省列表 // * 获取省列表
// * // *
...@@ -7,6 +8,9 @@ export const getProvinceList = async params => { ...@@ -7,6 +8,9 @@ export const getProvinceList = async params => {
return request({ return request({
method: 'get', method: 'get',
params: params, params: params,
headers: {
noLoading:true,
},
withCredentials: true, withCredentials: true,
url: 'tis/insurance/provinces' url: 'tis/insurance/provinces'
}); });
...@@ -19,6 +23,9 @@ export const getCityList = async params => { ...@@ -19,6 +23,9 @@ export const getCityList = async params => {
method: 'get', method: 'get',
params: params, params: params,
withCredentials: true, withCredentials: true,
headers: {
noLoading:true,
},
url: 'tis/insurance/cities' url: 'tis/insurance/cities'
}); });
}; };
...@@ -29,6 +36,9 @@ export const getCountyList = async params => { ...@@ -29,6 +36,9 @@ export const getCountyList = async params => {
return request({ return request({
method: 'get', method: 'get',
params: params, params: params,
headers: {
noLoading:true,
},
withCredentials: true, withCredentials: true,
url: '/tis/insurance/counties' url: '/tis/insurance/counties'
}); });
...@@ -40,6 +50,9 @@ export const getTownList = async params => { ...@@ -40,6 +50,9 @@ export const getTownList = async params => {
return request({ return request({
method: 'get', method: 'get',
params: params, params: params,
headers: {
noLoading:true,
},
withCredentials: true, withCredentials: true,
url: '/basic-data/position/towns' url: '/basic-data/position/towns'
}); });
......
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
</template> </template>
<script> <script>
import {getProvinceList, getCityList, getCountyList} from './api'; import { getProvinceList, getCityList, getCountyList } from './api';
import store from 'storejs';
export default { export default {
props: { props: {
show: { show: {
...@@ -64,6 +65,7 @@ export default { ...@@ -64,6 +65,7 @@ export default {
cityList: [], cityList: [],
countyList:[], countyList:[],
loading: true, loading: true,
result:{}
}; };
}, },
watch: { watch: {
...@@ -80,7 +82,9 @@ export default { ...@@ -80,7 +82,9 @@ export default {
this.columns = [{ values: this.provinceList, defaultIndex:provinceIndex}, { values: this.cityList, defaultIndex:cityIndex}, { values: this.countyList, defaultIndex:countyIndex }]; this.columns = [{ values: this.provinceList, defaultIndex:provinceIndex}, { values: this.cityList, defaultIndex:cityIndex}, { values: this.countyList, defaultIndex:countyIndex }];
console.log('locationAreaCode', this.provinceList, provinceIndex); console.log('locationAreaCode', this.provinceList, provinceIndex);
const data = [this.provinceList[provinceIndex], this.cityList[cityIndex], this.countyList[countyIndex]]; const data = [this.provinceList[provinceIndex], this.cityList[cityIndex], this.countyList[countyIndex]];
this.$emit('confirm', data); if (this.result) {
this.$emit('confirm', data);
}
} }
}, },
...@@ -95,7 +99,7 @@ export default { ...@@ -95,7 +99,7 @@ export default {
}, },
created() { created() {
this.result = store.get('geolocation');
}, },
methods: { methods: {
// 初始化 省市县信息 // 初始化 省市县信息
...@@ -107,7 +111,9 @@ export default { ...@@ -107,7 +111,9 @@ export default {
this.columns = [{ values: this.provinceList }, { values: this.cityList }, { values: this.countyList }]; this.columns = [{ values: this.provinceList }, { values: this.cityList }, { values: this.countyList }];
const data = [this.provinceList[0], this.cityList[0], this.countyList[0]]; const data = [this.provinceList[0], this.cityList[0], this.countyList[0]];
console.log('initData', data); console.log('initData', data);
this.$emit('confirm', data); if (this.result) {
this.$emit('confirm', data);
}
}, },
// 获取省列表 // 获取省列表
getProvinceList() { getProvinceList() {
......
...@@ -4,6 +4,9 @@ export const getHospitalList = (data) => { ...@@ -4,6 +4,9 @@ export const getHospitalList = (data) => {
return request({ return request({
method: 'post', method: 'post',
data, data,
headers: {
noLoading:true,
},
url: '/tis/insurance/hospitalList', url: '/tis/insurance/hospitalList',
withCredentials: true, withCredentials: true,
}); });
......
import $http from 'mn-template/plugins/http'; import $http from 'mn-template/plugins/http';
import { vueApp } from '@pica-cli/vue-cli-plugin-pica-cli-plugin/auto';
// 设置axios默认属性 // 设置axios默认属性
$http.setDefaults({ $http.setDefaults({
headers: {} headers: {}
}); });
// 设置http配置信息 loading、error、clear、encrypt、mockUserInfo // 设置http配置信息 loading、error、clear、encrypt、mockUserInfo
$http.setOptions({ $http.setOptions({
loading () { loading(opt) {
console.log('我重写了默认的loading'); const noLoading = opt.headers.noLoading || false;
console.log('我重写了默认的loading1', opt);
const globalLoading = document.getElementById('globalLoading');
if (!globalLoading && !noLoading) {
vueApp.$loading.show();
}
} }
}); });
...@@ -16,6 +23,6 @@ $http.addBeforeHook(config => console.log('我是新增的前置钩子', config) ...@@ -16,6 +23,6 @@ $http.addBeforeHook(config => console.log('我是新增的前置钩子', config)
// 新增后置钩子 // 新增后置钩子
$http.addAfterHook(response => { $http.addAfterHook(response => {
vueApp.$loading.hide();
console.log('我是新增的后置钩子', response); console.log('我是新增的后置钩子', response);
}, 0); }, 0);
...@@ -199,12 +199,13 @@ ...@@ -199,12 +199,13 @@
</template> </template>
<script> <script>
import store from 'storejs';
import {getDetectionName, getOrderInfo, appointment, getHospitalList} from '@/api/appoint'; import {getDetectionName, getOrderInfo, appointment, getHospitalList} from '@/api/appoint';
import SelectHospital from '@/components/selectHospital/index.vue'; import SelectHospital from '@/components/selectHospital/index.vue';
import SelectTime from '@/components/selectTime/index.vue'; import SelectTime from '@/components/selectTime/index.vue';
import PickArea from '@/components/pickArea/index.vue'; import PickArea from '@/components/pickArea/index.vue';
import { getJumpPageStatus } from '@/api/question'; import { getJumpPageStatus } from '@/api/question';
import storejs from 'storejs';
import AMapLoader from '@amap/amap-jsapi-loader';
export default { export default {
components: { components: {
SelectHospital, SelectHospital,
...@@ -323,7 +324,6 @@ export default { ...@@ -323,7 +324,6 @@ export default {
this.$toast('活动已经结束'); this.$toast('活动已经结束');
} }
} }
this.$loading.hide();
console.log('getJumpPageStatus', res); console.log('getJumpPageStatus', res);
}); });
}, },
...@@ -334,18 +334,54 @@ export default { ...@@ -334,18 +334,54 @@ export default {
// }, // },
// 高德地图导航只有在线上环境才能使用 // 高德地图导航只有在线上环境才能使用
initMap() { initMap() {
const result = store.get('geolocation'); const that = this;
AMapLoader.load({
key:'009dd02e4fe0a1b5f895cd7b86b9e216', // 申请好的Web端开发者Key,首次调用 load 时必填
plugins:[''], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
}).then((AMap) => {
AMap.plugin('AMap.Geolocation', function() {
var geolocation = new AMap.Geolocation({
// 是否使用高精度定位,默认:true
enableHighAccuracy: true,
// 设置定位超时时间,默认:无穷大
timeout: 10000,
// 定位按钮的停靠位置的偏移量,默认:Pixel(10, 20)
buttonOffset: new AMap.Pixel(10, 20),
// 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
zoomToAccuracy: true,
// 定位按钮的排放位置, RB表示右下
buttonPosition: 'RB'
});
geolocation.getCurrentPosition((status, result) => {
console.log('geolocationgeolocation,', status, result);
if (result.position) {
const position = { ...result.position, addr: result.formattedAddress };
storejs.set('geolocation', position);
} else {
storejs.remove('geolocation');
}
that.initHospitalList();
});
});
});
},
initHospitalList() {
const result = storejs.get('geolocation');
console.log('initHospitalList', result);
// 没有位置信息,不请求机构信息
if (result) { if (result) {
console.log('geolocation', result); console.log('geolocation', result);
this.position.latitude = result.lat || ''; this.position.latitude = result.lat || '';
this.position.longitude = result.lng || ''; this.position.longitude = result.lng || '';
const data = {
projectEquityNo: this.projectEquityNo,
latitude: this.position.latitude,
longitude:this.position.longitude,
};
this.getHospitalList(data);
} }
const data = {
projectEquityNo: this.projectEquityNo,
latitude: this.position.latitude,
longitude:this.position.longitude,
};
this.getHospitalList(data);
}, },
// 根据坐标获取最近的机构id // 根据坐标获取最近的机构id
...@@ -425,7 +461,6 @@ export default { ...@@ -425,7 +461,6 @@ export default {
cancelSearch() {}, cancelSearch() {},
selectAddress() {}, selectAddress() {},
appointment() { appointment() {
this.$loading.show();
this.$refs.dectionForm.validate().then(result => { this.$refs.dectionForm.validate().then(result => {
console.log('this.dectionForm', result); console.log('this.dectionForm', result);
const data = { const data = {
...@@ -439,7 +474,6 @@ export default { ...@@ -439,7 +474,6 @@ export default {
yunOrderNo:this.yunOrderNo, yunOrderNo:this.yunOrderNo,
}; };
appointment(data).then(res => { appointment(data).then(res => {
this.$loading.hide();
if (res.code === '000000') { if (res.code === '000000') {
this.$router.push({ this.$router.push({
path: '/appoint-details', path: '/appoint-details',
...@@ -452,7 +486,6 @@ export default { ...@@ -452,7 +486,6 @@ export default {
}); });
}).catch(err => { }).catch(err => {
this.$loading.hide();
console.log(err); console.log(err);
}); });
}, },
......
...@@ -93,7 +93,10 @@ ...@@ -93,7 +93,10 @@
class="tips" class="tips"
> >
<div class="tip-org"> <div class="tip-org">
<van-icon name="warning-o" size="16px"/> 温馨提示 <van-icon
name="warning-o"
size="16px"
/> 温馨提示
</div> </div>
<div class="tip-grey"> <div class="tip-grey">
(1)请在预约日期前往预约医院完成采样。无需空腹,采样前三天可适当清淡饮食; (1)请在预约日期前往预约医院完成采样。无需空腹,采样前三天可适当清淡饮食;
...@@ -140,6 +143,8 @@ ...@@ -140,6 +143,8 @@
import {getDetailByYunOrderNo} from '@/api/appoint'; import {getDetailByYunOrderNo} from '@/api/appoint';
import store from 'storejs'; import store from 'storejs';
import { formatDate } from '@/utils/common'; import { formatDate } from '@/utils/common';
import storejs from 'storejs';
import AMapLoader from '@amap/amap-jsapi-loader';
export default { export default {
data() { data() {
return { return {
...@@ -205,6 +210,38 @@ export default { ...@@ -205,6 +210,38 @@ export default {
this.$loading.hide(); this.$loading.hide();
}); });
}, },
initMap() {
AMapLoader.load({
key:'009dd02e4fe0a1b5f895cd7b86b9e216', // 申请好的Web端开发者Key,首次调用 load 时必填
plugins:[''], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
}).then((AMap) => {
AMap.plugin('AMap.Geolocation', function() {
var geolocation = new AMap.Geolocation({
// 是否使用高精度定位,默认:true
enableHighAccuracy: true,
// 设置定位超时时间,默认:无穷大
timeout: 10000,
// 定位按钮的停靠位置的偏移量,默认:Pixel(10, 20)
buttonOffset: new AMap.Pixel(10, 20),
// 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
zoomToAccuracy: true,
// 定位按钮的排放位置, RB表示右下
buttonPosition: 'RB'
});
geolocation.getCurrentPosition((status, result) => {
console.log('geolocationgeolocation,', status, result);
if (result.position) {
const position = { ...result.position, addr: result.formattedAddress };
storejs.set('geolocation', position);
} else {
storejs.remove('geolocation');
}
});
});
});
},
reAppoint() { reAppoint() {
this.$router.push({ this.$router.push({
...@@ -301,6 +338,7 @@ export default { ...@@ -301,6 +338,7 @@ export default {
this.$rocNative.WXInstance.openLocation(addressInfo); this.$rocNative.WXInstance.openLocation(addressInfo);
return; return;
} }
this.initMap();
this.showSsheet = true; this.showSsheet = true;
}, },
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
<script> <script>
import { getJumpPageStatus, createOrder } from '@/api/question'; import { getJumpPageStatus, createOrder } from '@/api/question';
import { getDetectionName } from '@/api/appoint'; import { getDetectionName } from '@/api/appoint';
import storejs from 'storejs';
import AMapLoader from '@amap/amap-jsapi-loader';
export default { export default {
data() { data() {
return { return {
...@@ -94,37 +93,7 @@ export default { ...@@ -94,37 +93,7 @@ export default {
// longitude: 50.2, // longitude: 50.2,
// }; // };
this.getJumpPageStatus(data); this.getJumpPageStatus(data);
var that = this; // var that = this;
AMapLoader.load({
key:'009dd02e4fe0a1b5f895cd7b86b9e216', // 申请好的Web端开发者Key,首次调用 load 时必填
plugins:[''], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
}).then((AMap) => {
AMap.plugin('AMap.Geolocation', function() {
var geolocation = new AMap.Geolocation({
// 是否使用高精度定位,默认:true
enableHighAccuracy: true,
// 设置定位超时时间,默认:无穷大
timeout: 10000,
// 定位按钮的停靠位置的偏移量,默认:Pixel(10, 20)
buttonOffset: new AMap.Pixel(10, 20),
// 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
zoomToAccuracy: true,
// 定位按钮的排放位置, RB表示右下
buttonPosition: 'RB'
});
geolocation.getCurrentPosition((status, result) => {
console.log('geolocationgeolocation,', status, result);
if (result.position) {
const position = { ...result.position, addr: result.formattedAddress };
storejs.set('geolocation', position);
}
that.getJumpPageStatus(data);
});
});
});
}, },
// 目前是配置一个检测信息,可能会拓展,所以返回的是一个list // 目前是配置一个检测信息,可能会拓展,所以返回的是一个list
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册