|
|
@@ -2,6 +2,12 @@
|
|
|
<div id="container"></div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+window.info = '';
|
|
|
+
|
|
|
+function getInfo(info) {
|
|
|
+ console.log(info);
|
|
|
+}
|
|
|
+window.getInfo = getInfo;
|
|
|
import { mapState } from 'vuex';
|
|
|
import Marker from '../utils/Marker';
|
|
|
import { getStatusInfo } from '../utils/OrderUtils';
|
|
|
@@ -11,6 +17,8 @@ export default {
|
|
|
return {
|
|
|
map: null,
|
|
|
orderInfo: null,
|
|
|
+ userLoaction: null,
|
|
|
+ merchantLoaction: null,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -30,23 +38,6 @@ export default {
|
|
|
return { lat: 40.02906301748584, lng: 116.25499991104516 };
|
|
|
}
|
|
|
},
|
|
|
- userLoaction() {
|
|
|
- return this.orderInfo.location
|
|
|
- ? {
|
|
|
- lat: this.orderInfo.location.split(',')[1],
|
|
|
-
|
|
|
- lng: this.orderInfo.location.split(',')[0],
|
|
|
- }
|
|
|
- : null;
|
|
|
- },
|
|
|
- merchantLoaction() {
|
|
|
- return this.orderInfo.merchant
|
|
|
- ? {
|
|
|
- lng: this.orderInfo.merchant.longitude,
|
|
|
- lat: this.orderInfo.merchant.latitude,
|
|
|
- }
|
|
|
- : null;
|
|
|
- },
|
|
|
userMarker() {
|
|
|
if (this.map && this.userLoaction) {
|
|
|
return new Marker({
|
|
|
@@ -75,26 +66,33 @@ export default {
|
|
|
}
|
|
|
return null;
|
|
|
},
|
|
|
-
|
|
|
nowStatus() {
|
|
|
- if (this.orderInfo) {
|
|
|
- return getStatusInfo(this.orderInfo);
|
|
|
+ if (this.$route.query) {
|
|
|
+ return getStatusInfo(this.$route.query);
|
|
|
} else {
|
|
|
return null;
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.orderInfo = localStorage.getItem('orderInfo')
|
|
|
- ? JSON.parse(localStorage.getItem('orderInfo'))
|
|
|
- : {};
|
|
|
- if (this.orderInfo.id) {
|
|
|
- this.$nextTick(() => {
|
|
|
- setTimeout(() => {
|
|
|
- this.initMap();
|
|
|
- }, 1000);
|
|
|
- });
|
|
|
+ if (this.$route.query.location) {
|
|
|
+ this.userLoaction = {
|
|
|
+ lat: this.$route.query.location.split(',')[1],
|
|
|
+ lng: this.$route.query.location.split(',')[0],
|
|
|
+ };
|
|
|
}
|
|
|
+ if (this.$route.query.merchantLocation) {
|
|
|
+ this.merchantLoaction = {
|
|
|
+ lat: this.$route.query.merchantLocation.split(',')[1],
|
|
|
+ lng: this.$route.query.merchantLocation.split(',')[0],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.initMap();
|
|
|
+ }, 1000);
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
initMap() {
|