import Vue from 'vue'
import App from './App'

import QQMapWX from 'static/qqmap-wx-jssdk.min.js'

import cuCustom from './colorui/components/cu-custom.vue'
import myIcon from '@/components/my-icon/my-icon.vue'
import encode from '@/utils/encode'
import global from '@/api/global.js'
import topBar from './components/topbar.vue'
import tools from '@/utils/tools.js'






import Empty from '@/components/Empty.vue'

Vue.component('my-icon', myIcon)
Vue.component('cu-custom', cuCustom)
Vue.component('my-empty', Empty)
Vue.component("topBar", topBar);

Vue.mixin({
	data() {
			return {
				// 默认的全局分享内容
				share: {
					title: '一路油你,星油能源',
					path: '/pages/index/startPage/startPage',    // 全局分享的路径,比如 首页
					imageUrl: 'https://xoi-support.oss-cn-hangzhou.aliyuncs.com/星油admin小程序/xxxxx.png',    // 全局分享的图片(可本地可网络)
				}
			}
		},
		// 定义全局分享
		// 1.发送给朋友
	    onShareAppMessage(res) {
	        return {
				title: this.share.title,
				path: this.share.path,
				imageUrl: this.share.imageUrl,
			}
	    },
		//2.分享到朋友圈
	    onShareTimeline(res) {
	        return {
				title: this.share.title,
				path: this.share.path,
				imageUrl: this.share.imageUrl,
			}
	    },
})

Vue.filter('olitype',(value)=>{
	switch (value) {
		case 'XOIL':
			return '星油'
		case 'WJY':
			return '万金油'
		case 'LV':
			 return '其他'
		case 'TY':
			return '团油'
		case 'YDJY':
			return '一点加油(壳牌'
	}
})

let qqmapsdk = new QQMapWX({
	key: 'NYEBZ-YURY3-XTU3N-YBR54-PKW6E-ROB2F'
	// 个人key
})
Vue.prototype.$qqmapsdk = qqmapsdk;
Vue.prototype.olitype = function(value){
	switch (value) {
		case 'XOIL':
			return '../../static/img/xy.png'
		case 'WJY':
			return '../../static/img/wyj.png'
		case 'LV':
			return '../../static/img/common.png'
		case 'TY':
			return '../../static/img/ty1.png'
		case 'YDJY':
			return '../../static/img/qp.png'
	}
}
Vue.prototype.moneyIntercept = function(value){
		if (value != 'xxx.x') {
		return String(value).split('.')[1]&&String(value).split('.')[1].length>2?Number(`${String(value).split('.')[0]}.${String(value).split('.')[1].substring(0,2)}${Number(String(value).split('.')[1].substr(2))==0?'':9}`).toFixed(2) :Number(value).toFixed(2);
		} else {
			return Number(value).toFixed(2)
		}
}


Vue.config.productionTip = false

App.mpType = 'app'
Vue.prototype.utils = encode
Vue.prototype.global = global;
Vue.prototype.tools = tools;

const app = new Vue({
	...App
})
app.$mount()