v2.36.6 优化统计数值

This commit is contained in:
磷叶 2026-05-22 09:57:54 +08:00
parent f87d09ee68
commit 95faa0a0a3
5 changed files with 156 additions and 114 deletions

View File

@ -1,9 +1,9 @@
const install = (Vue, vm) => {
uni.setStorageSync('deptId', 100);
Vue.prototype.$u.http.setConfig({
baseUrl: 'http://192.168.1.6:4101', //键辉本地
// baseUrl: 'http://192.168.1.6:4101', //键辉本地
// baseUrl: 'http://192.168.2.221:4101', //景森本地
// baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 小鹿appid wx8a05cf95418a6859 小兔骑骑appidwx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe
baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 小鹿appid wx8a05cf95418a6859 小兔骑骑appidwx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe
// baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上
// baseUrl:'https://ysd.chuantewulian.cn/prod-api', //嵛山岛线上api 嵛山岛appidwx4d178f8c80348214
loadingText: '努力加载中~',

View File

@ -55,7 +55,7 @@
// "baseurl": "http://test.com"
// },
"libVersion" : "latest",
"appid" : "wx8a05cf95418a6859",
"appid" : "wxc7e95836981d11fc",
"setting" : {
"urlCheck" : false,
"es6" : true,

View File

@ -4,7 +4,7 @@
<view class="toptit" hover-class="is-hover app-tap-hover" hover-stay-time="100" @click="btnqh"><!-- @click="topage(4)" -->
<image hover-class="app-tap-hover" class="toptit-avatar" @click.stop="topage(4)" src="https://api.ccttiot.com/smartmeter/img/static/uEQLkI1vDF4PTy44DTXH" mode=""></image> {{areaname}} <u-icon style="margin-left: 10rpx;" name="arrow-down" color="#fff" size="28"></u-icon>
</view>
<view class="op-card">
<view class="op-card" hover-class="is-hover app-tap-hover" hover-stay-time="100" @click="btnchakan">
<view class="op-head">
<view class="op-head-left">
<view class="op-head-title">运营状况</view>
@ -12,7 +12,7 @@
<text class="op-head-sub">今日数据 · 核心指标</text>
</view>
</view>
<view class="op-more" hover-class="is-hover app-tap-hover" hover-stay-time="100" @click="btnchakan">
<view class="op-more">
查看更多 <u-icon style="margin-left: 6rpx;" name="arrow-right" color="#4297F3" size="28"></u-icon>
</view>
</view>
@ -41,6 +41,12 @@
</view>
<view class="bot">进行中</view>
</view>
<view class="li li--revenue li--wait-pay">
<view class="top">
{{ statRideWaitPay }} <text class="top-unit"></text>
</view>
<view class="bot">待付车费</view>
</view>
</view>
</view>
@ -65,7 +71,7 @@
<view class="menu-item" hover-class="is-hover app-tap-hover" hover-stay-time="100" @click="btnreturnbike">
<image src="https://api.ccttiot.com/smartmeter/img/static/uJ4x8uTOMd7pmTeBiX8p" mode=""></image>
<text>订单审核</text>
<view v-if="waitVerifyCount > 0" class="badge">{{waitVerifyCount > 99 ? '99+' : waitVerifyCount}}</view>
<view v-if="statWaitVerify > 0" class="badge">{{ statWaitVerify > 99 ? '99+' : statWaitVerify }}</view>
</view>
</view>
@ -173,7 +179,7 @@
</template>
<script>
import TabBar from '@/page_shanghu/components/tab-bar/tab-bar.vue'
import TabBar from '@/page_shanghu/components/tab-bar/tab-bar.vue';
var xBlufi = require("@/components/blufi/xBlufi.js")
export default {
components: { TabBar },
@ -200,9 +206,9 @@ export default {
userId:'',
fuwuewm:false,
weinum:0,
waitVerifyCount: 0,
areaname:'',
yunyingobj:{},
dateStat: {},
pendingStat: {},
kstime:'',
jstime:'',
statsLoading: false,
@ -239,7 +245,6 @@ export default {
// this.getArea()
this.getinfo()
this.getweicl()
this.getWaitVerifyCount()
}
if (uni.getStorageSync('adminname')) {
this.areaname = uni.getStorageSync('adminname')
@ -253,19 +258,27 @@ export default {
)
},
statOrderCount() {
const v = this.yunyingobj.orderCount
const v = this.dateStat.orderCount
return v == null ? 0 : v
},
statRevenue() {
const v = this.yunyingobj.orderActualAmount
const v = this.dateStat.orderActualAmount
return v == null ? 0 : v
},
statFinished() {
const v = this.yunyingobj.finishedOrderCount
const v = this.dateStat.finishedOrderCount
return v == null ? 0 : v
},
statProcessing() {
const v = this.yunyingobj.orderProcessingCount
const v = this.pendingStat.orderProcessingCount
return v == null ? 0 : v
},
statRideWaitPay() {
const v = this.pendingStat.orderRideWaitPayCount
return v == null ? 0 : v
},
statWaitVerify() {
const v = this.pendingStat.orderWaitVerifyCount
return v == null ? 0 : v
},
complaintBadge() {
@ -319,8 +332,7 @@ export default {
if (uni.getStorageSync('adminname')) this.areaname = uni.getStorageSync('adminname')
tasks.push(
this.getinfo({ silent: true }),
this.fetchComplaintBadge(),
this.fetchWaitVerifyCount()
this.fetchComplaintBadge()
)
}
Promise.all(tasks.map((p) => Promise.resolve(p).catch(() => null))).finally(() => {
@ -349,18 +361,6 @@ export default {
})
.catch(() => {})
},
fetchWaitVerifyCount() {
if (!this.areaId) return Promise.resolve()
return this.$u.get('/bst/order/list?', {
status: 'WAIT_VERIFY',
areaId: this.areaId,
pageSize: 1,
pageNum: 1
}).then((res) => {
if (res.code === 200) this.waitVerifyCount = res.total || 0
})
.catch(() => {})
},
//
btnyy(){
uni.navigateTo({
@ -373,46 +373,52 @@ export default {
url:'/page_shanghu/guanli/yunying'
})
},
//
//
gettongji(options = {}) {
const silent = options.silent === true
if (!this.areaId || !this.userinfo.userId) {
return Promise.resolve()
}
let StatKeys = 'order_actual_amount,order_count,order_finished_count,order_processing_count,bonus_actual_amount,order_ridding_fee,order_deduction_fee,order_dispatch_fee,order_manage_fee,order_refund_amount'
const url = `/dashboard/revenueStat?keys=${StatKeys}&dateRange=${this.kstime + ',' + this.jstime}&userId=${this.userinfo.userId}&areaId=${this.areaId}`
const dateStatKeys = 'order_actual_amount,order_count,order_finished_count'
const pendingStatKeys = 'order_processing_count,order_wait_verify_count,order_ride_wait_pay_count'
const dateRangeStr = `${this.kstime},${this.jstime}`
const commonParams = `userId=${this.userinfo.userId}&areaId=${this.areaId}`
this._beginStatsLoading()
return this.$u
.get(url)
.then((res) => {
if (res && res.code === 200) {
this.yunyingobj = res.data || {}
this.statsLoadError = false
} else {
this.statsLoadError = true
const msg = (res && res.msg) || '统计数据加载失败'
if (!silent) {
const tip = msg.indexOf('超时') !== -1 || msg.indexOf('时间') !== -1
? '网络较慢,请稍后重试'
: msg
uni.showToast({ title: tip, icon: 'none', duration: 2600 })
}
}
})
.catch(() => {
return Promise.all([
this.$u.get(`/dashboard/revenueStat?keys=${dateStatKeys}&dateRange=${dateRangeStr}&${commonParams}`),
this.$u.get(`/dashboard/revenueStat?keys=${pendingStatKeys}&${commonParams}`)
]).then(([dateRes, pendingRes]) => {
if (dateRes && dateRes.code === 200) {
this.dateStat = dateRes.data || {}
}
if (pendingRes && pendingRes.code === 200) {
this.pendingStat = pendingRes.data || {}
}
if ((dateRes && dateRes.code === 200) || (pendingRes && pendingRes.code === 200)) {
this.statsLoadError = false
} else {
this.statsLoadError = true
const msg = (dateRes && dateRes.msg) || (pendingRes && pendingRes.msg) || '统计数据加载失败'
if (!silent) {
uni.showToast({
title: '网络异常,请检查网络后重试',
icon: 'none',
duration: 2600
})
const tip = msg.indexOf('超时') !== -1 || msg.indexOf('时间') !== -1
? '网络较慢,请稍后重试'
: msg
uni.showToast({ title: tip, icon: 'none', duration: 2600 })
}
})
.finally(() => {
this._endStatsLoading()
})
},
}
}).catch(() => {
this.statsLoadError = true
if (!silent) {
uni.showToast({
title: '网络异常,请检查网络后重试',
icon: 'none',
duration: 2600
})
}
}).finally(() => {
this._endStatsLoading()
})
},
//
getCurrentDate(num) {
const currentDate = new Date()
@ -483,24 +489,11 @@ export default {
url:'/page_shanghu/guanli/Qrcode?areaId=' + this.areaId + '&type=1'
})
},
//
//
getweicl() {
if (!this.areaId) return
this.fetchComplaintBadge()
},
//
getWaitVerifyCount() {
this.$u.get('/bst/order/list?', {
status: 'WAIT_VERIFY',
areaId: this.areaId,
pageSize: 1,
pageNum: 1
}).then((res) => {
if (res.code === 200) {
this.waitVerifyCount = res.total || 0;
}
})
},
//
btnfuwuewm(){
let that = this
@ -687,12 +680,12 @@ export default {
this.searchKey = ''
this.displayList = this.list
},
getinfo() {
this.$u.get("/getInfo").then((res) => {
getinfo(options = {}) {
return this.$u.get("/getInfo").then((res) => {
if (res.code == 200) {
this.userinfo = res.user
this.gettongji()
}
return this.gettongji(options)
}
})
},
shows() {
@ -709,7 +702,6 @@ export default {
this.areaname = e[0].label
this.areaId = e[0].value
this.getArea()
this.getWaitVerifyCount()
this.getweicl()
if (this.userinfo && this.userinfo.userId) {
this.gettongji()
@ -954,6 +946,13 @@ export default {
color: #d48806;
font-weight: 500;
}
.li--wait-pay .top {
color: #fa8c16;
}
.li--wait-pay .bot {
color: #d48806;
font-weight: 500;
}
}
.fuwuewm{
position: fixed;

View File

@ -28,6 +28,12 @@
<u-picker mode="time" v-model="oneshow" :params="oneparams" @confirm="confirmone"></u-picker>
<u-picker mode="time" v-model="twoshow" :params="twoparams" @confirm="confirmtwo"></u-picker>
<view class="stats-body">
<view class="stats-loading-mask" v-if="loading">
<u-loading mode="circle" color="#3B82F6" size="48"></u-loading>
<text class="stats-loading-tip">加载中...</text>
</view>
<!-- 期间营收统计 -->
<view class="section-container">
@ -47,12 +53,12 @@
<view class="item-sub-pill">
<view class="sub-seg">
<text class="sub-lbl">骑行</text>
<text class="sub-val color-primary">{{yunyingobj.finishedOrderCount | fmtInt}}</text>
<text class="sub-val color-primary">{{dateStat.finishedOrderCount | fmtInt}}</text>
<text class="sub-lbl"></text>
</view>
<view class="sub-seg">
<text class="sub-lbl">卡券</text>
<text class="sub-val color-primary">{{yunyingobj.vipOrderCount | fmtInt}}</text>
<text class="sub-val color-primary">{{dateStat.vipOrderCount | fmtInt}}</text>
<text class="sub-lbl"></text>
</view>
</view>
@ -64,15 +70,15 @@
<view class="icon-box bg-light-warning"><u-icon name="car" color="#F59E0B" size="28"></u-icon></view>
<text class="lbl">订单实收 ()</text>
</view>
<view class="item-val color-warning">{{ yunyingobj.orderActualReceivedAmount | fix2 }}</view>
<view class="item-val color-warning">{{ dateStat.orderActualReceivedAmount | fix2 }}</view>
<view class="item-sub-pill">
<view class="sub-seg">
<text class="sub-lbl">总额</text>
<text class="sub-val color-warning">{{yunyingobj.orderActualAmount | fix2}}</text>
<text class="sub-val color-warning">{{dateStat.orderActualAmount | fix2}}</text>
</view>
<view class="sub-seg">
<text class="sub-lbl">退款</text>
<text class="sub-val color-warning">{{yunyingobj.orderAdminRefundAmount | fix2}}</text>
<text class="sub-val color-warning">{{dateStat.orderAdminRefundAmount | fix2}}</text>
</view>
</view>
</view>
@ -83,11 +89,11 @@
<view class="icon-box bg-light-success"><u-icon name="coupon" color="#10B981" size="28"></u-icon></view>
<text class="lbl">卡券实收 ()</text>
</view>
<view class="item-val color-success">{{ yunyingobj.vipOrderAmount | fix2 }}</view>
<view class="item-val color-success">{{ dateStat.vipOrderAmount | fix2 }}</view>
<view class="item-sub-pill">
<view class="sub-seg">
<text class="sub-lbl">售出</text>
<text class="sub-val color-success">{{ yunyingobj.vipOrderCount | fmtInt }}</text>
<text class="sub-val color-success">{{ dateStat.vipOrderCount | fmtInt }}</text>
<text class="sub-lbl"></text>
</view>
</view>
@ -103,11 +109,11 @@
<view class="item-sub-pill">
<view class="sub-seg">
<text class="sub-lbl">骑行</text>
<text class="sub-val color-purple">{{yunyingobj.bonusActualAmount | fix2}}</text>
<text class="sub-val color-purple">{{dateStat.bonusActualAmount | fix2}}</text>
</view>
<view class="sub-seg">
<text class="sub-lbl">卡券</text>
<text class="sub-val color-purple">{{yunyingobj.vipOrderBonusActualAmount | fix2}}</text>
<text class="sub-val color-purple">{{dateStat.vipOrderBonusActualAmount | fix2}}</text>
</view>
</view>
</view>
@ -122,41 +128,41 @@
</view>
<view class="fee-header-extra">
<text class="ft-lbl">订单总额</text>
<text class="ft-val color-primary">¥{{ yunyingobj.orderActualAmount | fix2 }}</text>
<text class="ft-val color-primary">¥{{ dateStat.orderActualAmount | fix2 }}</text>
</view>
</view>
<view class="fee-wrapper">
<view class="fee-list">
<view class="fee-item">
<text class="f-val color-primary">¥{{ yunyingobj.orderRiddingFee | fix2 }}</text>
<text class="f-val color-primary">¥{{ dateStat.orderRiddingFee | fix2 }}</text>
<view class="f-name-row">
<view class="dot" style="background: #3B82F6;"></view>
<text class="f-name">骑行费</text>
</view>
</view>
<view class="fee-item">
<text class="f-val color-success">¥{{ yunyingobj.orderDispatchFee | fix2 }}</text>
<text class="f-val color-success">¥{{ dateStat.orderDispatchFee | fix2 }}</text>
<view class="f-name-row">
<view class="dot" style="background: #10B981;"></view>
<text class="f-name">调度费</text>
</view>
</view>
<view class="fee-item">
<text class="f-val color-warning">¥{{ yunyingobj.orderManageFee | fix2 }}</text>
<text class="f-val color-warning">¥{{ dateStat.orderManageFee | fix2 }}</text>
<view class="f-name-row">
<view class="dot" style="background: #F59E0B;"></view>
<text class="f-name">管理费</text>
</view>
</view>
<view class="fee-item">
<text class="f-val color-success">¥{{ yunyingobj.orderInsureFee | fix2 }}</text>
<text class="f-val color-success">¥{{ dateStat.orderInsureFee | fix2 }}</text>
<view class="f-name-row">
<view class="dot" style="background: #10B981;"></view>
<text class="f-name">保险费</text>
</view>
</view>
<view class="fee-item">
<text class="f-val color-purple">¥{{ yunyingobj.orderDeductionFee | fix2 }}</text>
<text class="f-val color-purple">¥{{ dateStat.orderDeductionFee | fix2 }}</text>
<view class="f-name-row">
<view class="dot" style="background: #8B5CF6;"></view>
<text class="f-name">车损费</text>
@ -182,7 +188,7 @@
</view>
<view class="p-info">
<view class="p-label">进行中订单</view>
<view class="p-val">{{ yunyingobj.orderProcessingCount | dv }}<text class="unit"></text></view>
<view class="p-val">{{ pendingStat.orderProcessingCount | dv }}<text class="unit"></text></view>
</view>
</view>
<view class="pending-item">
@ -191,7 +197,7 @@
</view>
<view class="p-info">
<view class="p-label">待支付骑行费</view>
<view class="p-val">{{ yunyingobj.orderRideWaitPayCount | dv }}<text class="unit"></text></view>
<view class="p-val">{{ pendingStat.orderRideWaitPayCount | dv }}<text class="unit"></text></view>
</view>
</view>
<view class="pending-item">
@ -200,12 +206,14 @@
</view>
<view class="p-info">
<view class="p-label">待审核订单</view>
<view class="p-val">{{ yunyingobj.orderWaitVerifyCount | dv }}<text class="unit"></text></view>
<view class="p-val">{{ pendingStat.orderWaitVerifyCount | dv }}<text class="unit"></text></view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
@ -235,13 +243,13 @@
},
computed: {
totalOrderCount() {
const ride = parseInt(this.yunyingobj.finishedOrderCount) || 0
const vip = parseInt(this.yunyingobj.vipOrderCount) || 0
const ride = parseInt(this.dateStat.finishedOrderCount) || 0
const vip = parseInt(this.dateStat.vipOrderCount) || 0
return ride + vip
},
totalBonusAmount() {
const ride = parseFloat(this.yunyingobj.bonusActualAmount) || 0
const vip = parseFloat(this.yunyingobj.vipOrderBonusActualAmount) || 0
const ride = parseFloat(this.dateStat.bonusActualAmount) || 0
const vip = parseFloat(this.dateStat.vipOrderBonusActualAmount) || 0
return (ride + vip).toFixed(2)
}
},
@ -271,9 +279,11 @@
twoshow: false,
kstime: '',
jstime: '',
yunyingobj: {},
dateStat: {},
pendingStat: {},
infoobj: {},
areaId: '',
loading: false,
}
},
onPullDownRefresh() {
@ -292,21 +302,32 @@
},
methods: {
getinfo() {
this.$u.get(`/getInfo`).then(res => {
if (res.code == 200) {
this.infoobj = res.user
this.gettongji()
}
})
this.$u.get(`/getInfo`).then(res => {
if (res.code == 200) {
this.infoobj = res.user
this.gettongji()
}
})
},
gettongji() {
//
let StatKeys = 'order_actual_amount,order_refund_amount,order_finished_count,bonus_actual_amount,order_ridding_fee,order_deduction_fee,order_dispatch_fee,order_manage_fee,order_insure_fee,vip_order_count,vip_order_amount,vip_order_bonus_actual_amount,order_processing_count,order_wait_verify_count,order_ride_wait_pay_count,order_admin_refund_amount'
let dateRangeStr = (this.kstime && this.jstime) ? `${this.kstime},${this.jstime}` : ''
this.$u.get(`/dashboard/revenueStat?keys=${StatKeys}&dateRange=${dateRangeStr}&userId=${this.infoobj.userId}&areaId=${this.areaId}`).then(res => {
if (res.code == 200) {
this.yunyingobj = res.data
if (!this.infoobj.userId) return Promise.resolve()
const dateStatKeys = 'order_actual_amount,order_refund_amount,order_finished_count,bonus_actual_amount,order_ridding_fee,order_deduction_fee,order_dispatch_fee,order_manage_fee,order_insure_fee,vip_order_count,vip_order_amount,vip_order_bonus_actual_amount,order_admin_refund_amount'
const pendingStatKeys = 'order_processing_count,order_wait_verify_count,order_ride_wait_pay_count'
const dateRangeStr = (this.kstime && this.jstime) ? `${this.kstime},${this.jstime}` : ''
const commonParams = `userId=${this.infoobj.userId}&areaId=${this.areaId}`
this.loading = true
return Promise.all([
this.$u.get(`/dashboard/revenueStat?keys=${dateStatKeys}&dateRange=${dateRangeStr}&${commonParams}`),
this.$u.get(`/dashboard/revenueStat?keys=${pendingStatKeys}&${commonParams}`)
]).then(([dateRes, pendingRes]) => {
if (dateRes.code == 200) {
this.dateStat = dateRes.data
}
if (pendingRes.code == 200) {
this.pendingStat = pendingRes.data
}
}).finally(() => {
this.loading = false
})
},
getCurrentDate(num) {
@ -397,6 +418,28 @@
padding-bottom: 60rpx;
box-sizing: border-box;
}
.stats-body {
position: relative;
min-height: 520rpx;
}
.stats-loading-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.78);
}
.stats-loading-tip {
margin-top: 20rpx;
font-size: 26rpx;
color: #6B7280;
}
.is-hover {
opacity: 0.85;
transform: scale(0.98);

View File

@ -8,7 +8,7 @@ const store = new Vuex.Store({
isLogin: false,
userInfo: null,
token:"",
appid:'1',//1小鹿 6创享 2嵛山岛 7小兔 1福兴 10易达
appid:'10',//1小鹿 6创享 2嵛山岛 7小兔 1福兴 10易达
// 电动车图标
iconobj:{
tabcion:'https://api.ccttiot.com/smartmeter/img/static/uIiSizdNVb65ATEXvxfT', //底部导航栏图标