狸车宝

This commit is contained in:
老叶
2021-09-13 17:58:07 +08:00
parent 1d3291cdbd
commit 15b9cba7c1
29 changed files with 596 additions and 62 deletions
+5 -37
View File
@@ -21,7 +21,9 @@
"pages/distribute/reward/index",
"pages/distribute/statistics/index",
"pages/distribute/assets/index",
"pages/customer/editCard/index"
"pages/customer/editCard/index",
"pages/channel/index",
"pages/dataAnalysis/index"
],
"echarts": [
{
@@ -37,42 +39,6 @@
"navigationBarTitleText": "狸车宝",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#999999",
"selectedColor": "#000000",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "commons/images/tab-home.png",
"selectedIconPath": "commons/images/tab-home-ac.png",
"badge": false,
"text": "首页"
},
{
"pagePath": "pages/customer/index",
"iconPath": "commons/images/tab-customer.png",
"selectedIconPath": "commons/images/tab-customer-ac.png",
"badge": false,
"text": "客户"
},
{
"pagePath": "pages/order/index",
"iconPath": "commons/images/tab-order.png",
"selectedIconPath": "commons/images/tab-order-ac.png",
"badge": false,
"text": "订单"
},
{
"pagePath": "pages/mine/index",
"iconPath": "commons/images/tab-mine.png",
"selectedIconPath": "commons/images/tab-mine-ac.png",
"badge": false,
"text": "我的"
}
]
},
"sitemapLocation": "sitemap.json",
"usingComponents": {
"lcb-msg": "/components/msg/index",
@@ -80,6 +46,8 @@
"lcb-navBar": "/components/navBar/navBar",
"lcb-footer": "/components/footer/footer",
"lcb-listmore": "/components/listMore/index",
"lcb-channelTabBarNav": "/components/channel-tab-bar/index",
"lcb-shopTabBarNav": "/components/shop-tab-bar/index",
"QYWXcontact": "plugin://contactPlugin/cell",
"kefuSuccess": "/components/kefuSuccess/index"
},
+1
View File
@@ -1,6 +1,7 @@
.color-fff{color:#fff;}
.color-f8{color:#f8f8f8;}
.color-e4e4e4{color:#e4e4e4;}
.color-1a{color:#1a1a1a;}
.color-333{color:#333;}
.color-666{color:#666;}
.color-777{color:#777;}
+1
View File
@@ -42,6 +42,7 @@
.fn-flex-itemfixed{flex:0 0 auto;}
.fn-flex-between{justify-content: space-between;}/*两端对齐*/
.fn-flex-wrap{flex-wrap:wrap}/*多行*/
.fn-flex-around{justify-content: space-around;}/*各项周围留有空白*/
.wp20{width:20%;box-sizing:border-box;}
.wp25{width:25%;box-sizing:border-box;}
+1
View File
@@ -71,4 +71,5 @@
.mb60{margin-bottom:60rpx;}
.mb100{margin-bottom:100rpx;}
.mb120{margin-bottom:120rpx;}
.mb180{margin-bottom:180rpx;}
.mb200{margin-bottom:200rpx;}
+1 -1
View File
@@ -1,4 +1,4 @@
const env = "p";
const env = "d";
const version = 1,
+104 -15
View File
@@ -164,12 +164,12 @@ function getCurrentPath() {
}
}
/**
* 获取路由跳转过来的数据
*/
function getRouterData (URL) {
return wx.getStorageSync('router-/' + URL + '-params')
}
/**
* 获取路由跳转过来的数据
*/
function getRouterData(URL) {
return wx.getStorageSync('router-/' + URL + '-params')
}
/**
@@ -184,7 +184,7 @@ function throttle(fn, gapTime) {
// 返回新的函数
return (function (e) {
console.log(this)
// console.log(this)
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
// fn.apply(this, arguments) //将this和参数传给原函数
@@ -197,11 +197,11 @@ function throttle(fn, gapTime) {
/*函数防抖*/
function debounce(fn, interval) {
var timer;
var gapTime = interval || 200;//间隔时间,如果interval不传,则默认200ms
var gapTime = interval || 200; //间隔时间,如果interval不传,则默认200ms
return function () {
clearTimeout(timer);
var context = this;
var args = arguments;//保存此处的arguments,因为setTimeout是全局的,arguments不是防抖函数需要的。
var args = arguments; //保存此处的arguments,因为setTimeout是全局的,arguments不是防抖函数需要的。
timer = setTimeout(function () {
fn.call(context, args);
}, gapTime);
@@ -209,7 +209,7 @@ function debounce(fn, interval) {
}
//去掉前后空格
function trim(s){
function trim(s) {
return s.toString().replace(/(^\s*)|(\s*$)/g, "");
}
@@ -251,8 +251,8 @@ function compareVersion(v1, v2) {
/**
* 内存报警
* 报警后,使用reLaunch,并记录当前页面及页面栈
*/
function memoryWarning(){
*/
function memoryWarning() {
wx.onMemoryWarning(function () {
let getPath = getCurrentPath()
wx.reportAnalytics('outofmemory', getPath)
@@ -264,18 +264,102 @@ function memoryWarning(){
/**
* 取消内存报警
*/
function offMemoryWarning(){
*/
function offMemoryWarning() {
if (wx.canIUse('offMemoryWarning')) {
wx.offMemoryWarning()
app.printErrorClient('offmemory')
} else {
app.printErrorClient('offmemorylowversion')
log.warn('当前微信版本'+wx.getSystemInfoSync().SDKVersion+'过低,无法使用该功能,请升级到最新微信版本后重试。')
log.warn('当前微信版本' + wx.getSystemInfoSync().SDKVersion + '过低,无法使用该功能,请升级到最新微信版本后重试。')
}
}
/**
* 设置底部导航选中
*/
function setBottomTabbar(page, isUnRead, that) {
if (typeof that.getTabBar === 'function' &&
that.getTabBar()) {
that.getTabBar().setData({
show: true,
selected: page,
isUnRead: isUnRead || false
})
}
}
/**
* 页面滚动到指定的上一个dom位置
*/
function scrollPageToDom(el, extraHeight = 0) {
let query = wx.createSelectorQuery()
query.select(el).boundingClientRect()
query.selectViewport().scrollOffset()
query.exec(function (res) {
wx.pageScrollTo({
scrollTop: res[0].height + extraHeight,
duration: 100
});
})
}
/**
* 页面滚动到dom指定位置
* 注:如果该dom滚动到顶部之后,他的top就变成0了。
* 再下次滚动的话,就会依照0来滚动,也就变成回到顶部了
*/
function scrollPageToDomForTop(el, extraHeight = 0) {
let query = wx.createSelectorQuery()
query.select(el).boundingClientRect()
query.selectViewport().scrollOffset()
query.exec(function (res) {
wx.pageScrollTo({
scrollTop: res[0].top + extraHeight,
duration: 100
});
})
}
let scrollFloatwindow_id = null;
//悬浮窗滚动方法判断方法
function scrollFloatwindow(e, that) {
if (e.scrollTop <= 0) {
//最顶部
e.scrollTop = 0;
} else if (e.scrollTop > that.data.scrollHeight) {
//最底部
e.scrollTop = that.data.scrollHeight;
}
if (scrollFloatwindow_id) clearTimeout(scrollFloatwindow_id);
//给scrollTop重新赋值
scrollFloatwindow_id = setTimeout(() => {
that.setData({
istrue_scroll: e.scrollTop > that.data.scrollTop || e.scrollTop >= that.data.scrollHeight,
scrollTop: e.scrollTop
});
}, 50);
}
let monitor = {
reportMonitor: function (id, value) {
if (wx.reportMonitor) {
wx.reportMonitor(id, value);
}
},
Error_Fail_Image: '1', //转化网络图片失败
Error_Req_Fail: '2',//网络请求失败
Error_Fail_Canvas: '3', //canvas转化失败
Error_Req_code_400: '4', //请求失败
Error_Req_code_401: '5', //非法参数
Error_Req_code_403: '6', //禁止访问
Error_Req_code_404: '7', //请求不存在
Error_Req_code_408: '8', //未登录
Error_Req_code_500: '9', //请求失败
};
module.exports = {
@@ -296,5 +380,10 @@ module.exports = {
getNumber,
memoryWarning,
offMemoryWarning,
setBottomTabbar,
scrollPageToDom,
scrollPageToDomForTop,
scrollFloatwindow,
monitor
// printErrorClient
}
+92
View File
@@ -0,0 +1,92 @@
import _ from '../../commons/js/commons'
const app = getApp()
Component({
//组件的属性列表
properties: {
currentIndex: {
type: String,
value: '0'
},
},
//组件的初始数据
data: {
list: [
{
"url": "/pages/channel/index",
"iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-home.png",
"selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-home-ac.png",
"title": "首页",
},
{
"url": "/pages/dataAnalysis/index",
"iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-dataAnalysis.png",
"selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-dataAnalysis-ac.png",
"title": "数据分析",
},
{
"url": "/pages/mine/index?source=channel",
"iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-mine.png",
"selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-mine-ac.png",
"title": "我的",
},
],
},
//生命周期方法
lifetimes: {
//在组件实例进入页面节点树时执行
attached: function () {
},
//在组件实例被从页面节点树移除时执行
detached: function () {
},
},
//组件所在页面的生命周期
pageLifetimes: {
//组件所在的页面被展示时执行
show: function () {
},
//组件所在的页面被隐藏时执行
hide: function () {
},
//组件所在的页面尺寸变化时执行
resize: function () {
},
},
//组件的方法列表
methods: {
//页面跳转
pushNavTab(e) {
let pages = getCurrentPages() //获取加载的页面
let currentPage = pages[pages.length - 1] //获取当前页面的对象
let url = currentPage.route //当前页面url
let isBack = false
let backIndex = 0
if (e.currentTarget.dataset.url && e.currentTarget.dataset.url != '/' + url) {
pages.forEach((item,index) => {
if(e.currentTarget.dataset.url=='/'+item.route){
isBack = true
backIndex = index
}
});
if(isBack){//后退
_.$router.back(Number(pages.length-backIndex-1))
}else{//前进打开
_.$router.openUrlScheme(e.currentTarget.dataset.url)
}
} else {
_.utils.scrollPageToDomForTop('.container')
}
},
}
})
+3
View File
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
+9
View File
@@ -0,0 +1,9 @@
<view class="safe-pb height-190"></view>
<view class="fixed bottom-0 left-0 wp100 fn-flex bg-fff fn-flex-around safe-pb bg-fff bts-1-eb text-center z-index-4">
<block wx:for="{{list}}" wx:key='index'>
<view class="fn-flex-item pt10 pb10" bindtap="pushNavTab" data-url="{{item.url}}">
<image class='img-60x60' lazy-load="{{true}}" mode="aspectFit" src="{{currentIndex == index?item.selectedIconPath:item.iconPath}}"></image>
<view class="font-22 {{currentIndex == index?'color-1a':'color-999'}}">{{item.title}}</view>
</view>
</block>
</view>
+2
View File
@@ -0,0 +1,2 @@
@import "../../commons/css/common.wxss";
.z-index-4{z-index:9999999999;}
+98
View File
@@ -0,0 +1,98 @@
import _ from '../../commons/js/commons'
const app = getApp()
Component({
//组件的属性列表
properties: {
currentIndex: {
type: String,
value: '0'
},
},
//组件的初始数据
data: {
list: [
{
"url": "/pages/index/index",
"iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-home.png",
"selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-home-ac.png",
"title": "首页",
},
{
"url": "/pages/customer/index",
"iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-customer.png",
"selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-customer-ac.png",
"title": "客户",
},
{
"url": "/pages/order/index",
"iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-order.png",
"selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-order-ac.png",
"title": "订单",
},
{
"url": "/pages/mine/index?source=shop",
"iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-mine.png",
"selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-mine-ac.png",
"title": "我的",
},
],
},
//生命周期方法
lifetimes: {
//在组件实例进入页面节点树时执行
attached: function () {
},
//在组件实例被从页面节点树移除时执行
detached: function () {
},
},
//组件所在页面的生命周期
pageLifetimes: {
//组件所在的页面被展示时执行
show: function () {
},
//组件所在的页面被隐藏时执行
hide: function () {
},
//组件所在的页面尺寸变化时执行
resize: function () {
},
},
//组件的方法列表
methods: {
//页面跳转
pushNavTab(e) {
let pages = getCurrentPages() //获取加载的页面
let currentPage = pages[pages.length - 1] //获取当前页面的对象
let url = currentPage.route //当前页面url
let isBack = false
let backIndex = 0
if (e.currentTarget.dataset.url && e.currentTarget.dataset.url != '/' + url) {
pages.forEach((item,index) => {
if(e.currentTarget.dataset.url=='/'+item.route){
isBack = true
backIndex = index
}
});
if(isBack){//后退
_.$router.back(Number(pages.length-backIndex-1))
}else{//前进打开
_.$router.openUrlScheme(e.currentTarget.dataset.url)
}
} else {
_.utils.scrollPageToDomForTop('.container')
}
},
}
})
+3
View File
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
+9
View File
@@ -0,0 +1,9 @@
<view class="safe-pb height-190"></view>
<view class="fixed bottom-0 left-0 wp100 fn-flex bg-fff fn-flex-around safe-pb bg-fff bts-1-eb text-center z-index-4">
<block wx:for="{{list}}" wx:key='index'>
<view class="fn-flex-item pt10 pb10" bindtap="pushNavTab" data-url="{{item.url}}">
<image class='img-60x60' lazy-load="{{true}}" mode="aspectFit" src="{{currentIndex == index?item.selectedIconPath:item.iconPath}}"></image>
<view class="font-22 {{currentIndex == index?'color-1a':'color-999'}}">{{item.title}}</view>
</view>
</block>
</view>
+2
View File
@@ -0,0 +1,2 @@
@import "../../commons/css/common.wxss";
.z-index-4{z-index:9999999999;}
+114
View File
@@ -0,0 +1,114 @@
import * as echarts from '../../ecCanvas/components/ec-canvas/echarts';
let chartData;
function initChart(canvas, width, height, dpr) {
const chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr // new
});
canvas.setChart(chart);
let option = chartData
chart.setOption(option);
return chart;
}
import _ from '../../commons/js/commons'
const app = getApp()
Page({
data: {
imgUrl:_.config.imgUrl,
shoplist:[
{
id:'1',
title:'泉州鲤城区4s店',
tag:[
'东风EX·1',
'雷丁',
],
},
{
id:'1',
title:'泉州鲤城区4s店',
tag:[
'东风EX·1',
'雷丁',
],
},
],
deallist:'',
hoursTip:'',
},
onLoad(options) {
for (let key in options) {
this.setData({
[key]: options[key]
})
}
chartData = res.data
this.setData({
showChart:true,
['ec.onInit']: initChart
})
this.getUserInfo()
},
onShow: function () {
this.getHoursTip()
},
//候取时间
getHoursTip(){
let hoursTip = '';
let date=new Date();
  if(date.getHours()>=0&&date.getHours()<12){
  hoursTip="上午好!"
  }else if(date.getHours()>=12&&date.getHours()<18){
  hoursTip="下午好!"
  }else{
  hoursTip="晚上好!"
  }
this.setData({
hoursTip:hoursTip
})
},
//获取用户信息
getUserInfo(){
_.apiQuery.getUserInfo().then(res => {
this.setData({
userInfo: res
})
});
},
//推送链接
pushLink(e) {
if(e.currentTarget.dataset.url){
_.$router.openUrlScheme(e.currentTarget.dataset.url)
}
},
//客服电话
call(e) {
wx.makePhoneCall({
phoneNumber: '18965133055',
})
},
//页面相关事件处理函数--监听用户下拉动作
onPullDownRefresh: function () {
},
})
+10
View File
@@ -0,0 +1,10 @@
{
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#1a1c26",
"backgroundColor": "#ffffff",
"backgroundColorTop": "#1a1c26",
"usingComponents": {
}
}
+43
View File
@@ -0,0 +1,43 @@
<view class="container">
<view class="inner30 img-top-cover" style="background-image:url({{imgUrl}}channel/theme.jpg);">
<view class="relative pt20 pb20 pl110 pr10">
<view class="absolute left-0 box-middle mr10 img-90x90 ulib-r750 overflowhidden">
<open-data type="userAvatarUrl"></open-data>
</view>
<view>
<view class="font-22 color-fff">Hi~ {{hoursTip}}欢迎回到狸车宝!</view>
<view>
<text class="text-middle text-bold font-48 color-fff">{{userInfo.uname}}</text>
<text class="inline-block ml10 pl10 pr10 bg-fff text-middle font-18 ulib-r750">{{userInfo.biz_name}}</text>
</view>
</view>
</view>
<view class="mt40 inner30 pt40 bg-fff box-shadow-000-10-10 ulib-r10">
<view class="font-36">管辖门店</view>
<view>
<block wx:for="{{shoplist}}" wx:key='index'>
<view class="mt20 inner30 bg-2e3246-8058fe ulib-r10" bindtap="pushLink" data-url="/pages/index/index?id={{item.id}}">
<view class="relative pr40 font-32 color-fff">{{item.title}}<i class="absolute right-0 box-middle iconfont icon-gengduo text-middle font-26"></i></view>
<view class="font-22">
<block wx:for="{{item.tag}}" wx:for-item="tag" wx:key='index'>
<text class="inline-block mt10 mr10 pl20 pr20 bg-fff ulib-r750">{{tag}}</text>
</block>
</view>
</view>
</block>
</view>
</view>
</view>
</view>
<view class="container relative">
<ec-canvas id="mychart-dom-bar" canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>
</view>
<!-- <lcb-footer></lcb-footer> -->
<lcb-shopTabBarNav currentIndex='0'></lcb-shopTabBarNav>
+8
View File
@@ -0,0 +1,8 @@
.bg-2e3246-8058fe{background-image:linear-gradient(45deg, #2e3246, #1a1c26);}
.bg-1c89fd-8058fe{background-image:linear-gradient(45deg, #1c89fd, #8058fe);}
.bg-fe606c-ff9026{background-image:linear-gradient(45deg, #fe606c, #ff9026);}
ec-canvas {
width: 100%;
height: 100%;
}
+3 -2
View File
@@ -75,7 +75,8 @@
</view>
</view>
<lcb-footer></lcb-footer>
<!-- <lcb-footer></lcb-footer> -->
<lcb-shopTabBarNav currentIndex='1'></lcb-shopTabBarNav>
<lcb-msg isShow="{{isShowMessage}}">
<view slot="content">
@@ -197,7 +198,7 @@
</view>
<view class="pt50 pb100"></view>
</scroll-view>
<view class="absolute left-0 bottom-0 right-0 fn-flex pt20 pb20 pl60 pr60 bg-fff-op90 text-center">
<view class="absolute left-0 bottom-0 right-0 fn-flex mb180 pt20 pb20 pl60 pr60 bg-fff-op90 text-center">
<view class="fn-flex-item mr20 pt15 pb15 bds-2-36afa2 font-32 color-36afa2 ulib-r750" bindtap="resetFilter">重置</view>
<view class="fn-flex-item ml20 pt15 pb15 bg-36afa2 font-32 color-fff ulib-r750" bindtap="submitFilter">确定</view>
</view>
+1 -1
View File
@@ -8,7 +8,7 @@
.opt-item{border:#ebebeb 1rpx solid;line-height:40rpx;}
.opt-item.active{background-color:#36afa2;border:#36afa2 1rpx solid;}
.fixedopt{position:fixed;bottom:40rpx;right:40rpx;}
.fixedopt{position:fixed;bottom:200rpx;right:40rpx;}
.optpin{width:100rpx;height:100rpx;}
.search-sort{right:-650rpx;width:650rpx;}
+66
View File
@@ -0,0 +1,66 @@
// pages/dataAnalysis/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
+3
View File
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
+4
View File
@@ -0,0 +1,4 @@
<!--pages/dataAnalysis/index.wxml-->
<text>pages/dataAnalysis/index.wxml</text>
<lcb-channelTabBarNav currentIndex='1'></lcb-channelTabBarNav>
+1
View File
@@ -0,0 +1 @@
/* pages/dataAnalysis/index.wxss */
+2 -1
View File
@@ -62,4 +62,5 @@
</view>
</view>
<lcb-footer></lcb-footer>
<!-- <lcb-footer></lcb-footer> -->
<lcb-shopTabBarNav currentIndex='0'></lcb-shopTabBarNav>
+4 -2
View File
@@ -24,7 +24,8 @@ Page({
if (pages.length > 1) {
wx.navigateBack();
}else{
_.$router.switchTab('/pages/index/index')
_.$router.openUrlScheme('/pages/index/index')
//_.$router.switchTab('/pages/index/index')
}
}else{
this.setData({
@@ -109,7 +110,8 @@ Page({
if (pages.length > 1) {
wx.navigateBack();
}else{
_.$router.switchTab('/pages/index/index')
_.$router.openUrlScheme('/pages/index/index')
//_.$router.switchTab('/pages/index/index')
}
});
+3 -1
View File
@@ -31,4 +31,6 @@
</view>
</view>
<lcb-footer></lcb-footer>
<!-- <lcb-footer></lcb-footer> -->
<lcb-channelTabBarNav currentIndex='2' wx:if="{{source=='channel'}}"></lcb-channelTabBarNav>
<lcb-shopTabBarNav currentIndex='3' wx:if="{{source=='shop'}}"></lcb-shopTabBarNav>
+2 -1
View File
@@ -65,7 +65,8 @@
</view>
</view>
<lcb-footer></lcb-footer>
<!-- <lcb-footer></lcb-footer> -->
<lcb-shopTabBarNav currentIndex='2'></lcb-shopTabBarNav>
<lcb-msg isShow="{{isShowMessage}}">
<view slot="content">
+1 -1
View File
@@ -8,7 +8,7 @@
.opt-item{border:#ebebeb 1rpx solid;line-height:40rpx;}
.opt-item.active{background-color:#36afa2;border:#36afa2 1rpx solid;}
.fixedopt{position:fixed;bottom:40rpx;right:40rpx;}
.fixedopt{position:fixed;bottom:200rpx;right:40rpx;}
.optpin{width:100rpx;height:100rpx;}
.search-sort{right:-650rpx;width:650rpx;}