Переглянути джерело

订单支付代码优化上正式

yuwenjun1997 3 роки тому
батько
коміт
3ddc2ddb29
2 змінених файлів з 0 додано та 75 видалено
  1. 0 3
      services/index.js
  2. 0 72
      services/locate.service.js

+ 0 - 3
services/index.js

@@ -2,7 +2,6 @@ import Vue from 'vue'
 
 import ajaxService from './ajax.service.js'
 import CommonService from './common.service'
-import LocateService from './locate.service'
 import UserService from './user.service'
 import ProductService from './product.service'
 import PayService from './pay.service'
@@ -12,7 +11,6 @@ import CouponService from './coupon.service.js'
 import FightService from './fight.service.js'
 
 export const commonService = new CommonService(ajaxService)
-export const locateService = new LocateService(ajaxService)
 export const userService = new UserService(ajaxService)
 export const productService = new ProductService(ajaxService)
 export const payService = new PayService(ajaxService)
@@ -25,7 +23,6 @@ const install = (Vue) => {
     console.log('初始化挂载接口方法')
     Vue.prototype.AjaxService = ajaxService
     Vue.prototype.CommonService = commonService
-    Vue.prototype.LocateService = locateService
     Vue.prototype.UserService = userService
     Vue.prototype.ProductService = productService
     Vue.prototype.PayService = payService

+ 0 - 72
services/locate.service.js

@@ -1,72 +0,0 @@
-/**
- * 定位相关的业务服务
- */
-// import { qqMapKey } from '@/common/config.js'
-// const QQMapWX = require('@/static/base/js/qqmap-wx-jssdk.min.js')
-// const qqmapsdk = new QQMapWX({
-//   coord_type: 5,
-//   key: qqMapKey
-// })
-
-export default class LocateService {
-    constructor(AjaxService) {
-        Object.assign(this, { AjaxService })
-        this.name = 'LocateService'
-    }
-    /* 获取当前的地理位置 */
-    getGeoLocation() {
-        return new Promise(function(reslove, reject) {
-            wx.getLocation({
-                type: 'gcj02',
-                success: function(res) {
-                    reslove(res)
-                },
-                fail: function(err) {
-                    reject(err)
-                },
-                complete: function(res) {}
-            })
-        })
-    }
-
-    /* 获取城市名 */
-    getCityName(lat, lon) {
-        return new Promise(function(reslove, reject) {
-            qqmapsdk.reverseGeocoder({
-                location: {
-                    latitude: lat,
-                    longitude: lon
-                },
-                success: function(res) {
-                    const {
-                        ad_info: addressInfo,
-                        location,
-                        formatted_addresses: formattedAddress = {},
-                        address
-                    } = res.result || {}
-
-                    let locationInfo = {
-                        cityName: addressInfo.city,
-                        location: location,
-                        address: formattedAddress.recommend || address
-                    }
-                    console.log('locationInfo: ' + locationInfo)
-                    reslove(locationInfo)
-                },
-                fail: function(err) {
-                    reject(err)
-                }
-            })
-        })
-    }
-
-    /* 获取当前定位 */
-    async getLocationByLocate() {
-        // 获取地理位置
-        let locationInfo = await this.getGeoLocation()
-        const { latitude, longitude } = locationInfo || {}
-        // 获取城市名
-        let cityInfo = await this.getCityName(latitude, longitude)
-        const { location = {}, cityName, address } = cityInfo
-    }
-}