老登陆,经营分析,被挤掉提示

This commit is contained in:
xk_guohonglei
2020-09-05 11:53:19 +08:00
parent 395ebd432d
commit a5fe20c721
14 changed files with 1065 additions and 329 deletions

View File

@@ -81,4 +81,25 @@ export default {
data: data
})
},
// 经营分析 日
getAnyDay(date) {
return request({
url: `/${service_name}/${group_name}/getAnyDay/${date}`,
method: 'get'
})
},
// 经营分析 月
getAnyMonth(date) {
return request({
url: `/${service_name}/${group_name}/getAnyMonth/${date}`,
method: 'get'
})
},
// 昨日数据
getYesterday() {
return request({
url: `/${service_name}/${group_name}/getYesterday`,
method: 'get'
})
},
}

View File

@@ -0,0 +1,85 @@
<template>
<view class="margin radius bg-white">
<view class="main-money ">
<view class="padding-xs flex align-center">
<view class="flex-sub text-center padding-top-lg">
<view class="txet-xxs">
<text class="">交易金额()</text>
</view>
<view class=" text-sl padding padding-top-xs"><text class="">
{{basicData.totalAmout|numberFilter}}
</text></view>
</view>
</view>
</view>
<view class="bg-white to-top">
<view class=" flex ">
<view class="padding text-center flex-sub">
<text>交易笔数</text>
<view class="padding-sm">
<text class="oil-main-color">{{basicData.totalCount}}</text>
</view>
</view>
<view class="padding text-center flex-sub">
<text>客单均价</text>
<view class="padding-sm">
<text class="oil-main-color">{{basicData.totalAmout/basicData.totalAccount|numberFilter}}</text>
</view>
</view>
<view class="padding text-center flex-sub">
<text>顾客数</text>
<view class="padding-sm">
<text class="oil-main-color">{{basicData.totalAccount}}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
basicData: {
type: Object,
default () {}
}
},
data() {
return {
}
},
methods: {
showModal() {
this.$emit('showModal')
}
},
watch: {
basicData: {
handler(newVal, oldVal) {
console.log('深度监听', newVal, oldVal)
this.basicData = newVal
},
deep: true
}
},
filters: {
numberFilter(value) {
if (value) {
value = value - 1 + 1
return value.toFixed(2)
} else {
return '0.00'
}
}
}
}
</script>
<style>
</style>

198
components/area-month.vue Normal file
View File

@@ -0,0 +1,198 @@
<template>
<view class="qiun-columns">
<!--#ifdef H5 -->
<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
<view class="qiun-title-dot-light">页面地址</view>
</view>
<view class="qiun-bg-white qiun-padding">
<text>pages/basic/area/time</text>
</view>
<!--#endif-->
<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
<view class="qiun-title-dot-light">单量</view>
</view>
<view class="qiun-charts">
<!--#ifdef MP-ALIPAY -->
<canvas canvas-id="canvasLineA" id="canvasLineA" class="charts" :width="cWidth*pixelRatio" :height="cHeight*pixelRatio"
:style="{'width':cWidth+'px','height':cHeight+'px'}" @touchstart="touchLineA"></canvas>
<!--#endif-->
<!--#ifndef MP-ALIPAY -->
<canvas canvas-id="canvasLineA" id="canvasLineA" class="charts" @touchstart="touchLineA"></canvas>
<!--#endif-->
</view>
<!--#ifdef H5 -->
<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
<view class="qiun-title-dot-light">标准数据格式</view>
</view>
<view class="qiun-bg-white qiun-padding">
<textarea class="qiun-textarea" auto-height="true" maxlength="-1" v-model="textarea" />
</view>
<view class="qiun-text-tips">Tips修改后点击更新图表</view>
<button class="qiun-button" @tap="changeData()">更新图表</button>
<!--#endif-->
</view>
</template>
<script>
import uCharts from '@/js_sdk/u-charts/u-charts/u-charts.js';
import { isJSON } from '@/common/checker.js';
var _self;
var canvaLineA = null;
export default {
props: {
chartData: {
type: Array,
default: []
}
},
data() {
return {
cWidth: '',
cHeight: '',
pixelRatio: 1,
textarea: ''
}
},
created() {
_self = this;
//#ifdef MP-ALIPAY
uni.getSystemInfo({
success: function (res) {
if (res.pixelRatio > 1) {
//正常这里给2就行如果pixelRatio=3性能会降低一点
//_self.pixelRatio =res.pixelRatio;
_self.pixelRatio = 2;
}
}
});
//#endif
this.cWidth = uni.upx2px(650);
this.cHeight = uni.upx2px(500);
console.log('chartData', this.chartData)
},
watch: {
chartData: {
handler(newVal, oldVal) {
console.log('深度监听', newVal, oldVal)
this.chartData = newVal
this.getServerData()
},
deep: true
}
},
methods: {
getServerData() {
if (this.chartData) {
let LineA = {
series: [{
name: '交易时段分布', data: this.chartData
}]
}
_self.textarea = JSON.stringify(LineA);
console.log('-----------------------')
console.log('_self.textarea', _self.textarea)
console.log('LineA', LineA)
console.log('-----------------------')
_self.showLineA("canvasLineA", LineA);
}
},
formatDateTime(timeStamp) {
var date = new Date();
date.setTime(timeStamp);
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
return m + '-' + d
},
showLineA(canvasId, chartData) {
canvaLineA = new uCharts({
$this: _self,
canvasId: canvasId,
type: 'area',
fontSize: 11,
padding: [15, 20, 0, 15],
legend: false,
dataLabel: true,
dataPointShape: true,
background: '#FFFFFF',
pixelRatio: _self.pixelRatio,
// categories: chartData.categories,
series: chartData.series,
animation: true,
xAxis: {
type: 'grid',
gridColor: '#CCCCCC',
gridType: 'dash',
dashLength: 8,
boundaryGap: 'justify',
splitNumber: 5,
format: (val) => {
// console.log('----', val, '-----')
// console.log('----', this.formatDateTime(val, 'str'), '-----')
return this.formatDateTime(val) }
},
yAxis: {
gridType: 'dash',
gridColor: '#CCCCCC',
dashLength: 8,
splitNumber: 5,
format: (val) => { return val > 0 ? val.toFixed(0) : 0 + '单' }
},
width: _self.cWidth * _self.pixelRatio,
height: _self.cHeight * _self.pixelRatio,
extra: {
area: {
type: 'curve',
addLine: true,
gradient: true
}
}
});
},
touchLineA(e) {
var that = this
canvaLineA.showToolTip(e, {
format: function (item, category) {
console.log(' item.data', item.data)
return that.formatDateTime(item.data[0])+' ' + item.data[1] + '单 ' + '交易金额' + item.data[2] + '元'
}
});
},
changeData() {
if (isJSON(_self.textarea)) {
let newdata = JSON.parse(_self.textarea);
canvaLineA.updateData({
series: newdata.series,
categories: newdata.categories
});
} else {
uni.showToast({
title: '数据格式错误',
image: '../../../static/images/alert-warning.png'
})
}
}
}
}
</script>
<style scoped>
/*样式的width和height一定要与定义的cWidth和cHeight相对应*/
.qiun-charts {
width: 640upx;
height: 500rpx;
background-color: #ffffff;
}
.charts {
width: 640upx;
height: 500rpx;
background-color: #ffffff;
}
</style>

View File

@@ -9,19 +9,12 @@
</view>
<!--#endif-->
<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
<view class="qiun-title-dot-light">发生金额</view>
<view class="qiun-title-dot-light">单量</view>
</view>
<view class="qiun-charts">
<!--#ifdef MP-ALIPAY -->
<canvas
canvas-id="canvasLineA"
id="canvasLineA"
class="charts"
:width="cWidth*pixelRatio"
:height="cHeight*pixelRatio"
:style="{'width':cWidth+'px','height':cHeight+'px'}"
@touchstart="touchLineA"
></canvas>
<canvas canvas-id="canvasLineA" id="canvasLineA" class="charts" :width="cWidth*pixelRatio" :height="cHeight*pixelRatio"
:style="{'width':cWidth+'px','height':cHeight+'px'}" @touchstart="touchLineA"></canvas>
<!--#endif-->
<!--#ifndef MP-ALIPAY -->
<canvas canvas-id="canvasLineA" id="canvasLineA" class="charts" @touchstart="touchLineA"></canvas>
@@ -47,6 +40,13 @@ import { isJSON } from '@/common/checker.js';
var _self;
var canvaLineA = null;
export default {
props: {
chartData: {
type: Array,
default: []
}
},
data() {
return {
cWidth: '',
@@ -70,66 +70,39 @@ export default {
//#endif
this.cWidth = uni.upx2px(650);
this.cHeight = uni.upx2px(500);
this.getServerData();
console.log('chartData', this.chartData)
},
watch: {
chartData: {
handler(newVal, oldVal) {
console.log('深度监听', newVal, oldVal)
this.chartData = newVal
this.getServerData()
},
deep: true
}
},
methods: {
getServerData() {
console.log('/')
uni.request({
url: 'https://www.ucharts.cn/data.json',
data: {
},
success: function (res) {
console.log(res.data.data)
if (this.chartData) {
let LineA = {
series: [{
name: '交易时段分布', data: [
[10000, 75], [50000, 35], [150000, 55], [170000, 35], [190000, 75],
[210000, 25], [280000, 5], [450000, 95], [460000, 5], [470000, 95],
[490000, 5]
]
},
{
name: '交易时段分布', data: [
[30000, 77], [50000, 25], [170000, 50], [200000, 40], [210000, 25],
[220000, 45], [280000,55], [450000,19], [460000, 30], [470000, 88],
[490000, 95]
]
name: '交易时段分布', data: this.chartData
}]
};
_self.textarea = JSON.stringify(res.data.data.LineA);
}
_self.textarea = JSON.stringify(LineA);
console.log('-----------------------')
console.log('res.data.data.LineA', res.data.data.LineA)
console.log('_self.textarea', _self.textarea)
console.log('LineA', LineA)
console.log('-----------------------')
_self.showLineA("canvasLineA", LineA);
}
},
fail: () => {
_self.tips = "网络错误,小程序端请检查合法域名";
},
});
},
formatDateTime(timeStamp, returnType) {
var date = new Date();
date.setTime(timeStamp * 1000);
console.log('\n\n------ begin:', timeStamp, ' ------')
console.log('')
console.log('------ end: ', date.setTime(timeStamp * 1000), ' ------\n\n')
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
if (returnType == 'str') { return h + ':' + minute; }
// return [y, m, d, h, minute, second];
// return [y + '-'+ m + '-'+ d +' '+ h+ ':'+ minute + ':' + second];
formatDateTime(timeStr) {
console.log('-----------------------')
console.log('timeStr', timeStr)
console.log('-----------------------')
return (timeStr > 0 ? timeStr.toFixed(0) : 0) + ':00'
},
showLineA(canvasId, chartData) {
canvaLineA = new uCharts({
@@ -154,16 +127,16 @@ export default {
boundaryGap: 'justify',
splitNumber: 5,
format: (val) => {
console.log('----', val, '-----')
console.log('----', this.formatDateTime(val, 'str'), '-----')
return this.formatDateTime(val, 'str') }
// console.log('----', val, '-----')
// console.log('----', this.formatDateTime(val, 'str'), '-----')
return this.formatDateTime(val) }
},
yAxis: {
gridType: 'dash',
gridColor: '#CCCCCC',
dashLength: 8,
splitNumber: 5,
format: (val) => { return val.toFixed(0) + '' }
format: (val) => { return val>0?val.toFixed(0):0 + '' }
},
width: _self.cWidth * _self.pixelRatio,
height: _self.cHeight * _self.pixelRatio,
@@ -182,7 +155,7 @@ export default {
canvaLineA.showToolTip(e, {
format: function (item, category) {
console.log(' item.data', item.data)
return that.formatDateTime(item.data[0], 'str') +'交易金额'+ item.data[1] + '元'
return (item.data[0] + ':00 ') + item.data[1] + '单 ' + '交易金额' + item.data[2] + '元'
}
});
},

View File

@@ -3,19 +3,31 @@
{
"path": "pages/startPage/startPage",
"style": {}
},
{
},{
"path": "pages/operation-analysis/operation-analysis",
"style": {}
},
{
"path": "pages/login/boforeLogin/boforeLogin",
"style": {}
"style": {
"enablePullDownRefresh": true
}
},{
"path" : "pages/operation-analysis/analysis/daily",
"style" : {
"enablePullDownRefresh": true
}
},{
"path": "pages/login/login",
"style": {
}
},{
"path": "pages/login/posLogin/posLogin",
"style": {}
}
,
{
"path": "pages/login/boforeLogin/boforeLogin",
"style": {}
}, {
"path": "pages/staff/editStaff/addUser",
"style": {}
@@ -69,14 +81,14 @@
"style": {}
}
, {
"path": "pages/login/posLogin/posLogin",
"style": {}
}
,{
"path" : "pages/operation-analysis/analysis/analysis",
"style" : {}
},{
"path" : "pages/operation-analysis/analysis/monthly",
"style" : {
"enablePullDownRefresh": true
}
}
],
"globalStyle": {

View File

@@ -27,9 +27,7 @@
</view>
</view>
<view class="margin-left padding-left-lg">
<text class="text-sm">短信验证码登录</text>
</view>
</view>
<view class="bottom-part">
<service-hotline />

View File

@@ -6,43 +6,36 @@
</cu-custom>
<view class="bg-img margin flex padding-lg radius align-center text-center" :style="'background-image: url('+mainURL+'login-bg.png)'">
<view class="padding-lg margin text-center text-lg text-white w100">
<text class="">
油站工作人员绑定油站
</text>
<text class>油站工作人员绑定油站</text>
</view>
</view>
<view class="pannel">
<view class="bg-white margin padding radius shadow-warp">
<view class="cu-form-group">
<view class="title text-black">手机号</view>
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input"></input>
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input" />
</view>
<view class="cu-form-group padding-top-sm" v-if="showRandom">
<view class="title text-black">验证码</view>
<input type="number" :maxlength="6" v-model="auth.captcha" placeholder="六位数字验证码" name="input"></input>
<button class='cu-btn bg-main-oil shadow' @tap="sendMsg">验证码</button>
<input type="number" :maxlength="6" v-model="auth.captcha" placeholder="六位数字验证码" name="input" />
<text :class="frozen?'text-gray':'oil-main-color'" @tap="sendMsg">{{tips}}</text>
</view>
<view class="cu-form-group padding-top-sm" v-else>
<view class="title text-black">密码</view>
<input inpitype="password" v-model="auth.password" placeholder="请输入登入密码" name="input"></input>
<input inpitype="password" v-model="auth.password" placeholder="请输入登入密码" name="input" />
</view>
</view>
<view class="margin-left padding-left-lg" @tap="showRandom=true" v-if="!showRandom">
<text class="text-sm">短信验证码登录</text>
<view class="margin-right padding-right-lg text-right" @tap="showRandom=true" v-if="!showRandom">
<text class="text-sm text-red padding-right">短信验证码登录</text>
</view>
<view class="margin-left padding-left-lg" @tap="showRandom=false" v-else>
<text class="text-sm">密码登录</text>
<view class="margin-right padding-right-lg text-right" @tap="showRandom=false" v-else>
<text class="text-sm text-red padding-right">密码登录</text>
</view>
</view>
<view class="margin-lg padding-lg bottom-bg">
<button class="bg-main-oil round" v-if="showRandom" @tap="loginRandom">
登录
</button>
<button class="bg-main-oil round" v-else @tap="loginPwd">
登录
</button>
<button class="bg-main-oil round" v-if="showRandom" @tap="loginRandom">登录</button>
<button class="bg-main-oil round" v-else @tap="loginPwd">登录</button>
</view>
<view class="bottom-part">
<service-hotline />
@@ -53,6 +46,8 @@
<script>
import cloudSiteApi from '@/api/cloud-site.js'
import loginApi from '@/api/login.js'
import md5 from 'js-md5'
export default {
data() {
return {
@@ -61,7 +56,10 @@
forcedLogin: true,
oilSiteNo: '',
showRandom: true,
auth: {}
auth: {},
tips: '发送验证码',
frozen: false // 二维码冷却时间
}
},
created() {
@@ -70,19 +68,65 @@
},
methods: {
loginPwd() {
uni.login({
provider: 'weixin',
success: loginRes => {
const code = loginRes.code
console.log(code)
console.log('加密', this.auth.password)
const data3 = {
username: this.auth.phone,
password: this.auth.password,
IMEI: 'IMEI',
androidMsgId: 'androidMsgId'
password: md5(this.auth.password),
code: code
}
loginApi.loginApp(data3).then(res => {
loginApi.loginWeiXinByPassword(data3).then(res => {
console.log('res', res)
uni.showToast({
title: res.msg,
icon: 'none'
})
console.log('oilSiteCode', this.oilSiteNo)
if (res.code === 20000) {
uni.reLaunch({
url: '/pages/index/index',
fail: (err) => {
console.log(err)
}
})
uni.showToast({
title: res.msg,
icon: 'success',
duration: 3000
})
uni.setStorage({
key: 'Authorization',
data: res.data.accessToken,
success: () => {
console.log('Authorization成功', res.data.accessToken)
}
})
uni.setStorage({
key: 'device',
data: res.data.openid,
success: () => {
console.log('deviceopenid', res.data.openid)
}
})
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
})
}
})
},
fail: err => {
console.log(err)
}
});
},
loginWeixin() {
uni.login({
@@ -135,6 +179,8 @@
});
},
sendMsg() {
if (!this.frozen) {
if (this.auth.phone) {
const data2 = {
phone: this.auth.phone
}
@@ -144,7 +190,32 @@
title: res.msg,
icon: 'none'
})
if (res.code === 20000) {
this.frozen = true
setTimeout(() => {
this.frozen = true
clearInterval(timer)
}, 1000 * 60);
let second = 60
const timer = setInterval(() => {
if (second) {
this.tips = `${second}秒后重发`
} else {
this.tips = `发送验证码`
this.disabled = false
this.btnColor = '#FE0505'
}
second--
}, 1000)
}
})
} else {
uni.showToast({
title: '请输入您的账号',
icon: 'none'
})
}
}
},
loginRandom() {
uni.login({
@@ -154,9 +225,9 @@
console.log(code)
const data2 = {
phone: this.auth.phone,
username: "mock", //类型String 必有字段 备注:手机号
verifyCode: "mock", //类型String 必有字段 备注:验证码
code: "mock" //类型String 必有字段 备注微信code
username: this.auth.phone, //类型String 必有字段 备注:手机号
verifyCode: this.auth.captcha, //类型String 必有字段 备注:验证码
code: code //类型String 必有字段 备注微信code
}
loginApi.loginWeiXinSMS(data2).then(res => {
console.log('res', res)
@@ -167,28 +238,35 @@
console.log('oilSiteCode', this.oilSiteNo)
if (res.code === 20000) {
// address: "安徽省合肥市庐阳区大杨镇"
// fuelLogo: null
// linkMan: "符红敏"
// oilSiteCode: "1591260293"
// oilSiteName: "杭州首鸿金融信息服务有限公司"
// phone: "15617055136"
uni.reLaunch({
url: '/pages/index/index',
fail: (err) => {
console.log(err)
}
})
uni.showToast({
title: res.msg,
icon: 'success',
duration: 3000
})
uni.setStorage({
key: 'oilSiteCode',
data: this.oilSiteNo,
key: 'Authorization',
data: res.data.accessToken,
success: () => {
console.log('缓存成功')
console.log('Authorization成功', res.data.accessToken)
}
})
uni.setStorage({
key: 'oilSite',
data: res.data,
key: 'device',
data: res.data.openid,
success: () => {
console.log('缓存成功')
console.log('deviceopenid', res.data.openid)
}
})
uni.navigateTo({
url: '/pages/Auth/Auth'
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
})
}
})
@@ -198,17 +276,6 @@
}
});
// uni.setStorage({
// key: 'oilSiteCode',
// data: this.oilSiteNo,
// success: () => {
// console.log('缓存成功')
// }
// })
// uni.navigateTo({
// url: '/pages/Auth/Auth'
// })
},
getMsg() {
uni.requestSubscribeMessage({

View File

@@ -4,6 +4,9 @@
<block slot="backText">返回</block>
<block slot="content">列表</block>
</cu-custom>
<view class="">
<analysis-card />
</view>
<view class="margin bg-white radius">
<view class="margin">
<area-time />
@@ -15,9 +18,10 @@
<script>
import areaTime from '@/components/area-time.vue'
import analysisCard from '@/components/analysis-card/analysis-card.vue'
export default {
components: {
areaTime
areaTime,analysisCard
},
data() {
return {

View File

@@ -1,8 +1,179 @@
// 昨日经营分析
<template>
<view class="page-content my-bg">
<cu-custom bgColor="bg-main-oil" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">日报</block>
</cu-custom>
<view class="card-container">
<view class="cu-capsule-container">
<view class="cu-capsule round bg-white solid line-gray" @tap="showModal">
<view class='cu-tag bg-white'>
{{selDate}}
</view>
<view class="cu-tag bg-white">
<text class='cuIcon-usefullfill rr90 padding-left-xs'></text>
</view>
</view>
</view>
<analysis-card @showModal="showModal" :basicData="basicData" />
</view>
<view class="margin bg-white radius">
<view class="margin">
<area-time :chartData="detailData" />
</view>
</view>
<view class="cu-modal bottom-modal" :class="dialogModal">
<view class="cu-dialog">
<view class="cu-bar bg-white ">
<view class="action text-blue" @tap="hideModal">取消</view>
<view class="content">选择日期</view>
<view class="action text-green" @tap="onConfirm">确定</view>
</view>
<picker-view :value="value" style="min-height: 250upx;width: 100%;" @change="bindChange">
<picker-view-column>
<view class="item" v-for="(item,index) in years" :key="index">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view class="item" v-for="(item,index) in months" :key="index">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view class="item" v-for="(item,index) in days" :key="index">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
</view>
</view>
</template>
<script>
import areaTime from '@/components/area-time.vue'
import analysisCard from '@/components/analysis-card/analysis-card.vue'
import cloudSiteApi from '@/api/cloud-site.js'
export default {
components: {
areaTime,
analysisCard
},
data: function() {
const date = new Date()
const years = []
const year = date.getFullYear()
const months = []
const month = date.getMonth() + 1
const days = []
const day = date.getDate() - 1
for (let i = 2020; i <= date.getFullYear(); i++) {
years.push(i)
}
for (let i = 1; i <= month; i++) {
months.push(i)
}
for (let i = 1; i <= 31; i++) {
days.push(i)
}
return {
title: 'picker-view',
years: [2020],
year: 2020,
months: months,
dialogModal: '',
month: month,
days: days,
day: day,
// value: [9999, month - 1, day - 1],
value: [0, month - 1, day - 1],
selDate: year + '-' + month + '-' + day,
detailData: [],
basicData: {
totalAccount: 0,
totalAmout: 0,
totalCount: 0
}
}
},
onPullDownRefresh() {
this.onConfirm()
// this.getUserInfo()
// uni.stopPullDownRefresh();
},
onShow() {
this.formatDate()
this.getDaily()
},
methods: {
getDaily() {
cloudSiteApi.getAnyDay(this.selDate).then(res => {
uni.stopPullDownRefresh();
if (res.code === 20000) {
this.basicData = res.data.basicData
this.detailData = res.data.detailData
}
})
},
onConfirm() {
this.hideModal()
this.formatDate()
this.getDaily()
},
formatDate() {
var m = ''
var d = ''
if (this.month < 10) {
m = '0' + this.month
} else {
m = this.month
}
if (this.day < 10) {
d = '0' + this.day
} else {
d = this.day
}
this.selDate = this.year + '-' + m + '-' + d
this.selDate = this.selDate.toString()
console.log(this.selDate)
},
showModal(e) {
this.dialogModal = 'show'
},
hideModal(e) {
this.dialogModal = null
},
bindChange: function(e) {
const val = e.detail.value
this.year = this.years[val[0]]
this.month = this.months[val[1]]
this.day = this.days[val[2]]
console.log('年鱼儿', this.year, this.month, this.day)
}
}
}
</script>
<style>
<style scoped>
.card-container {
position: relative;
}
.card-container .cu-capsule {
margin: auto;
margin-bottom: -40px;
}
.cu-capsule-container {
min-width: 100%;
text-align: center;
}
.rr90 {
rotate: 180deg;
}
</style>

View File

@@ -1,8 +1,193 @@
// 昨日经营分析
<template>
<view class="page-content my-bg">
<cu-custom bgColor="bg-main-oil" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">月报</block>
</cu-custom>
<view class="card-container">
<view class="cu-capsule-container">
<view class="cu-capsule round bg-white solid line-gray" @tap="showModal">
<view class='cu-tag bg-white'>
{{selDate}}
</view>
<view class="cu-tag bg-white">
<text class='cuIcon-usefullfill rr90 padding-left-xs'></text>
</view>
</view>
</view>
<analysis-card @showModal="showModal" :basicData="basicData" />
<view class="margin bg-white radius">
<view class="margin">
<area-month :chartData="detailData" />
</view>
</view>
<view class="cu-modal bottom-modal" :class="dialogModal">
<view class="cu-dialog">
<view class="cu-bar bg-white ">
<view class="action text-blue" @tap="hideModal">取消</view>
<view class="content">选择日期</view>
<view class="action text-green" @tap="onConfirm">确定</view>
</view>
<picker-view :value="value" style="min-height: 250upx;width: 100%;" @change="bindChange">
<picker-view-column>
<view class="item" v-for="(item,index) in years" :key="index">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view class="item" v-for="(item,index) in months" :key="index">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view class="item" v-for="(item,index) in days" :key="index">{{item}}</view>
</picker-view-column>
</picker-view>
<view class="cu-bar bg-white justify-end">
<view class="action">
<button class="cu-btn line-green text-green" @tap="hideModal">取消</button>
<button class="cu-btn bg-green margin-left" @tap="onConfirm">确定</button>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import areaMonth from '@/components/area-month.vue'
import analysisCard from '@/components/analysis-card/analysis-card.vue'
import cloudSiteApi from '@/api/cloud-site.js'
export default {
components: {
areaMonth,
analysisCard
},
data: function() {
const date = new Date()
const years = []
const year = date.getFullYear()
const months = []
const month = date.getMonth() + 1
const days = []
const day = date.getDate() - 1
for (let i = 2020; i <= date.getFullYear(); i++) {
years.push(i)
}
for (let i = 1; i <= month; i++) {
months.push(i)
}
for (let i = 1; i <= 31; i++) {
days.push(i)
}
return {
title: 'picker-view',
years: [2020],
year: 2020,
months: months,
dialogModal: '',
month: month,
days: days,
day: day,
// value: [9999, month - 1, day - 1],
value: [0, month - 1, day - 1],
selDate: year + '-' + month + '-' + day,
detailData: [],
basicData: {
totalAccount: 0,
totalAmout: 0,
totalCount: 0
}
}
},
onPullDownRefresh() {
this.onConfirm()
// this.getUserInfo()
// uni.stopPullDownRefresh();
},
onShow() {
this.formatDate()
this.getMonthly()
var date = '2019-9-5';
date = date.substring(0, 19);
date = date.replace(/-/g, '/');
var timestamp = new Date(date).getTime();
console.log(timestamp)
},
methods: {
getMonthly() {
cloudSiteApi.getAnyMonth(this.selDate).then(res => {
uni.stopPullDownRefresh()
if (res.code === 20000) {
this.basicData = res.data.basicData
res.data.detailData.forEach(item=>{
var date = item[0]
date = date.substring(0, 19);
date = date.replace(/-/g, '/');
item[0] = new Date(date).getTime();
})
this.detailData = res.data.detailData
}
})
},
onConfirm() {
this.hideModal()
this.formatDate()
this.getMonthly()
},
formatDate() {
var m = ''
var d = ''
if (this.month < 10) {
m = '0' + this.month
} else {
m = this.month
}
if (this.day < 10) {
d = '0' + this.day
} else {
d = this.day
}
this.selDate = this.year + '-' + m + '-' + d
console.log(this.selDate)
},
showModal(e) {
this.dialogModal = 'show'
},
hideModal(e) {
this.dialogModal = null
},
bindChange: function(e) {
const val = e.detail.value
this.year = this.years[val[0]]
this.month = this.months[val[1]]
this.day = this.days[val[2]]
console.log('年鱼儿', this.year, this.month, this.day)
}
}
}
</script>
<style>
<style scoped>
.card-container {
position: relative;
}
.card-container .cu-capsule {
margin: auto;
margin-bottom: -40px;
}
.cu-capsule-container {
min-width: 100%;
text-align: center;
}
.rr90 {
rotate: 180deg;
}
</style>

View File

@@ -2,15 +2,16 @@
<view class="page-content my-bg">
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-main-oil" :isBack="true">
<block slot="content">经营分析</block>
<block slot="backText">返回</block>
<block slot="backText" class="back-text">返回</block>
</cu-custom>
<view class="main-money bg-main-oil">
<view class="padding-xs flex align-center">
<view class="flex-sub text-center padding-top-lg">
<view class="txet-xxs">
<text class="text-white">昨日交易金额()</text>
</view>
<view class=" text-sl padding padding-top-xs"><text class="text-white">{{userAccount.totalMoney|numberFilter}}</text></view>
<view class=" text-sl padding padding-top-xs"><text class="text-white">{{basicData.totalAmout|numberFilter}}</text></view>
</view>
</view>
</view>
@@ -23,7 +24,7 @@
<view class="padding text-center flex-sub" @tap="routerTo('/pages/orderList/dailyOrder/dailyOrder')">
<text>交易笔数</text>
<view class="padding-sm">
<text class="oil-main-color">{{userAccount.totalCount}}</text>
<text class="oil-main-color">{{basicData.totalCount}}</text>
</view>
<!-- <button class="cu-btn bg-main-oil text-white text-sm ">
查看明细
@@ -32,7 +33,7 @@
<view class="padding text-center flex-sub">
<text>顾客数</text>
<view class="padding-sm">
<text class="oil-main-color">{{userAccount.totalMoney|numberFilter}}</text>
<text class="oil-main-color">{{basicData.totalAccount|numberFilter}}</text>
</view>
<!-- <button class="cu-btn bg-main-oil text-white text-sm ">
查看明细
@@ -42,26 +43,26 @@
</view>
<view class="margin">
<view class="cu-list menu-avatar radius">
<view class="cu-item">
<view class="cu-item" @tap="routerTo('/pages/operation-analysis/analysis/daily')">
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'">
</view>
<view class="content ">
<text>经营分析日报</text>
</view>
<view class="action">
<button class="cu-btn padding-left-xs padding-right-xs bg-white" @tap="routerTo('/pages/operation-analysis/analysis/analysis')">
<button class="cu-btn padding-left-xs padding-right-xs bg-white">
<text class="cuIcon-right"></text>
</button>
</view>
</view>
<view class="cu-item">
<view class="cu-item" @tap="routerTo('/pages/operation-analysis/analysis/monthly')">
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'">
</view>
<view class="content">
<text> 经营分析月报</text>
</view>
<view class="action solid-left">
<view class="action ">
<button class="cu-btn padding-left-xs padding-right-xs bg-white" @tap="routerTo('path')">
<text class="cuIcon-right"></text>
</button>
@@ -81,9 +82,10 @@
return {
mainURL: this.global.mainURL,
userAccount: {
totalCount: 0,
totalMoney: 0.00
basicData: {
totalAccount: 0,
totalAmout: 0,
totalCount: 0
},
scanUrl: '',
userMenu: uni.getStorageSync('userMenu'),
@@ -92,19 +94,15 @@
cuIconList: []
};
},
onLoad() {
uni.showShareMenu()
uni.navigateTo({
url:''
})
},
onShow() {
onShow() {
this.getYesterday()
},
onPullDownRefresh() {
this.getUserInfo()
this.getYesterday()
},
filters: {
numberFilter(value) {
if (value) {
value = value - 1 + 1
@@ -128,16 +126,13 @@
}
})
},
getUserInfo() {
cloudSiteApi.getSiteBasicData().then(res => {
console.log('用户资料', res)
uni.stopPullDownRefresh();
getYesterday() {
cloudSiteApi.getYesterday().then(res => {
uni.stopPullDownRefresh()
if(res.code===20000){
this.userAccount = res.data
this.basicData = res.data
}
})
},
scanQr() {
var that = this
@@ -191,15 +186,6 @@
margin-top: 0;
}
.main-topbar>>>.cu-bar {
height: 380rpx !important;
z-index: 0 !important;
}
.main-topbar>>>.cu-bar .content {
padding-bottom: 300rpx;
}
.bottom-bar-fixed {
position: fixed;
bottom: 0;

View File

@@ -11,10 +11,8 @@
</view>-->
<view class="text-center logo-part">
<view class="cu-avatar xl text-sl" :style="'background-image: url('+mainURL+'qr-icon.png)'"></view>
<view class="">
<text class="text-lg">
星油云站
</text>
<view class>
<text class="text-lg">星油云站</text>
</view>
</view>
</view>
@@ -37,7 +35,7 @@
provider: 'weixin',
success: loginRes => {
const code = loginRes.code
console.log(code)
console.log('启动页code',code)
loginApi.loginWeixin(code).then(res => {
if (res.code === 20000) {
uni.reLaunch({
@@ -81,6 +79,13 @@
}
}).catch(err => {
uni.reLaunch({
url: '/pages/login/boforeLogin/boforeLogin',
fail: (err) => {
console.log(err)
}
})
})
},
fail: err => {

View File

@@ -58,10 +58,10 @@ export default {
md5Salt(str) {
// console.log('hahahahaha',str, str + "Do&9hY%l8e", md5(str + 'Do&9hY%l8e'))
// str ='fd3fc615-3554-4ff5-8848-364577e8687d'
console.log('hahahahaha', str, str + "kdq*&qflbn1gga?aDq", md5(str + 'kdq*&qflbn1gga?aDq'))
console.log('\n\n------ begin: ------')
console.log("md5(str + 'kdq*&qflbn1gga?aDq')", md5(str + 'kdq*&qflbn1gga?aDq'))
console.log('------ end: ------\n\n')
// console.log('hahahahaha', str, str + "kdq*&qflbn1gga?aDq", md5(str + 'kdq*&qflbn1gga?aDq'))
// console.log('\n\n------ begin: ------')
// console.log("md5(str + 'kdq*&qflbn1gga?aDq')", md5(str + 'kdq*&qflbn1gga?aDq'))
// console.log('------ end: ------\n\n')
return md5(str + 'kdq*&qflbn1gga?aDq')
},
md5NoSalt(str) {

View File

@@ -22,14 +22,14 @@ service.interceptors.request.use(
config.headers['device'] = openid
config.headers['dataSources'] = 'MP'
// if (env === 'production') {
if (env === 'production') {
// 生产环境,加密,不输出任何东西
// 设置jsessionid和token
const JSESSIONID = utils.uuid()
config.headers['JSESSIONID'] = JSESSIONID
config.headers['token'] = utils.md5Salt(JSESSIONID)
// if ( encryptWhite.indexOf(config.url) < 0) {
// if (!notEncrypt && encryptWhite.indexOf(config.url) < 0) {
if (!notEncrypt && encryptWhite.indexOf(config.url) < 0) {
// 这是定义在哪的
const data = { // 用于存储加密
params: '' // 加密后的密文
@@ -38,10 +38,10 @@ service.interceptors.request.use(
data.params = utils.encrypt(JSON.stringify(config.data))
console.log(data.params)
config.data = data
// }
// } else {
}
} else {
console.log('请求路径', config.url, '参数加密前', config.data)
// }
}
return config
},
@@ -60,17 +60,17 @@ service.interceptors.response.use(
const res = response.data
const env = process.env.NODE_ENV
// if (env === 'production') {
if (env === 'production') {
// 生产环境,进行加密解密,不输出日志
if (res.encrypt === 1) {
if (res.encrypt == 1) {
// 加密的数据,需要解密
const dataParam = JSON.parse(utils.decrypt(res.data))
res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam
}
// } else {
} else {
console.log('请求路径', response.config.url, '返回结果未加密', res)
console.log('-------------------------------------------')
// }
}
uni.hideLoading()
if (res.code != 20000) {
@@ -90,6 +90,37 @@ service.interceptors.response.use(
// }
// })
}
if (res.msg === '您已被迫下线') {
uni.showModal({
title: '下线提醒',
confirmText: '重新登录',
cancelText: "退出",
content: '您的账号在另一微信下登录了星油云站,请确认是否本加油站工作人员操作',
success: function(res) {
if (res.confirm) {
uni.reLaunch({
url: '/pages/startPage/startPage',
success: () => {
console.log('跳转成功')
},
fail: (err) => {
console.log(err)
}
})
} else if (res.cancel) {
uni.reLaunch({
url: '/pages/login/boforeLogin/boforeLogin',
success: () => {
console.log('跳转成功')
},
fail: (err) => {
console.log(err)
}
})
}
}
});
}
}
return res
},