同步代码
This commit is contained in:
312
pages/index/components/Stats.vue
Normal file
312
pages/index/components/Stats.vue
Normal file
@@ -0,0 +1,312 @@
|
||||
<template>
|
||||
<view class="index-header" @tap="go.to('PAGES_STAT')">
|
||||
<view class="index-selected">
|
||||
<view class="index-time">
|
||||
<block v-for="v in timeList" :key="v.value">
|
||||
<view class="time-item flex-center" :class="{ 'time-active': vdata.timeSelected == v.value }"
|
||||
@tap.stop="changeTimeFunc(v.value)">
|
||||
{{ v.title }}
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="index-scan flex-center" @click.stop="scanFunc">
|
||||
<image src="/static/iconImg/icon-scan-index.svg" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="receipts-money">
|
||||
<text class="money-title">成交金额 (元)</text>
|
||||
<view class="money-num">{{ list?list.sale.incomeAmountAll:0}}</view>
|
||||
</view>
|
||||
<view class="money-list">
|
||||
<view class="money-item">
|
||||
<text class="money-title">消费笔数</text>
|
||||
<view class="money-num">{{ list?list.vip.useNum:0 }}</view>
|
||||
</view>
|
||||
<view class="money-item">
|
||||
<text class="money-title">退款金额 (元)</text>
|
||||
<view class="money-num">{{ list?list.sale.outAmount:0}}</view>
|
||||
</view>
|
||||
<view class="money-item">
|
||||
<text class="money-title">消费金额</text>
|
||||
<view class="money-num">{{ list?list.vip.useAmount:0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="money-list" v-if="vdata.memberIsShow">
|
||||
<view class="money-item">
|
||||
<text class="money-title">会员充值(元)</text>
|
||||
<view class="money-num">{{ cal.cert2Dollar(memberData.payAmount) }}</view>
|
||||
</view>
|
||||
<view class="money-item">
|
||||
<text class="money-title">会员消费(元)</text>
|
||||
<view class="money-num">{{ cal.cert2Dollar(Math.abs(memberData.changeAmount)) }}</view>
|
||||
</view>
|
||||
|
||||
<view class="money-item">
|
||||
<text class="money-title">会员消费笔数</text>
|
||||
<view class="money-num">{{ memberData.changeCount }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<!-- <text class="money-title">展开全部</text> -->
|
||||
</view>
|
||||
<!-- <button v-if="ak.ent.has('ENT_C_QUICKCASHIER')" class="quick-money flex-center" @tap.stop="go.to('PAGES_QUICK_PAY')">快捷收银</button> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
$indexStatistics,
|
||||
$memberInfoCount
|
||||
} from '@/http/apiManager.js';
|
||||
import cal from '@/commons/utils/cal.js';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import ak from '@/commons/utils/ak.js';
|
||||
import ent from '@/commons/utils/ent.js';
|
||||
import unionScan from '@/commons/utils/unionScan.js';
|
||||
import storageManage from '@/commons/utils/storageManage.js';
|
||||
import dayjs from 'dayjs' //时间格式库
|
||||
import {
|
||||
summaryTrade,
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
onMounted(() => {
|
||||
vdata.memberIsShow = ent.has('ENT_MCH_MEMBER') && storageManage.userInfo().isHasMemberEnt;
|
||||
if (ent.has('ENT_MCH_MEMBER') && storageManage.userInfo().isHasMemberEnt) {
|
||||
getMemberData();
|
||||
}
|
||||
getList()
|
||||
});
|
||||
const emits = defineEmits(['click']);
|
||||
const timeList = [{
|
||||
title: '今天',
|
||||
value: 'today'
|
||||
},
|
||||
{
|
||||
title: '昨天',
|
||||
value: 'yesterday'
|
||||
},
|
||||
{
|
||||
title: '近7天',
|
||||
value: 'circumference'
|
||||
},
|
||||
{
|
||||
title: '近30天',
|
||||
value: 'moon'
|
||||
}
|
||||
];
|
||||
let list = ref()
|
||||
const vdata = reactive({
|
||||
timeSelected: 'today', // 当前时间选择器的
|
||||
payAmount: -1, // 实收金额
|
||||
payCount: -1, // 交易笔数
|
||||
refundAmount: -1, // 退款金额
|
||||
refundCount: -1, // 退款笔数
|
||||
memberIsShow: false //是否开启会员模块
|
||||
});
|
||||
const memberData = reactive({});
|
||||
|
||||
function getList() {
|
||||
let startTime, endTime;
|
||||
if (vdata.timeSelected == 'today') {
|
||||
startTime = dayjs().format('YYYY-MM-DD') + ' 00:00:00'
|
||||
endTime = dayjs().format('YYYY-MM-DD') + ' 23:59:59'
|
||||
} else if (vdata.timeSelected == 'yesterday') {
|
||||
startTime = formatTime() + ' 00:00:00'
|
||||
endTime = formatTime() + ' 23:59:59'
|
||||
} else if (vdata.timeSelected == 'circumference') {
|
||||
startTime = dayjs().add(-7, 'day').format('YYYY-MM-DD 00:00:00')
|
||||
endTime = dayjs().format('YYYY-MM-DD 23:59:59')
|
||||
} else if (vdata.timeSelected == 'moon') {
|
||||
startTime = dayjs().add(-30, 'day').format('YYYY-MM-DD 00:00:00')
|
||||
endTime = dayjs().format('YYYY-MM-DD 23:59:59')
|
||||
} else if (vdata.timeSelected == 'custom') {
|
||||
startTime = start
|
||||
endTime = end
|
||||
}
|
||||
summaryTrade({
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
startTime,
|
||||
endTime,
|
||||
}).then((res) => {
|
||||
list.value = res
|
||||
})
|
||||
}
|
||||
// 切换 时间卡片
|
||||
function changeTimeFunc(val) {
|
||||
vdata.timeSelected = val;
|
||||
getList()
|
||||
// refData();
|
||||
// if (vdata.memberIsShow) {
|
||||
// getMemberData();
|
||||
// }
|
||||
}
|
||||
// 根据选择请求数据
|
||||
function refData() {
|
||||
// 获取 统计数据
|
||||
$indexStatistics(vdata.timeSelected).then(({
|
||||
bizData
|
||||
}) => {
|
||||
vdata.payAmount = bizData.totalSuccAmt;
|
||||
vdata.payCount = bizData.totalSuccNum;
|
||||
vdata.refundAmount = bizData.totalRefundAmt;
|
||||
vdata.refundCount = bizData.totalRefundNum;
|
||||
});
|
||||
}
|
||||
|
||||
// 扫码动作
|
||||
function scanFunc() {
|
||||
unionScan.scan(true).then((res) => {
|
||||
// 登录类型
|
||||
if (res.type == unionScan.QR_TYPE_LOGIN) {
|
||||
return go.to('PAGES_SCAN_LOGIN', {
|
||||
qrcodeNo: res.originQrVal
|
||||
});
|
||||
}
|
||||
|
||||
// 二维码
|
||||
if (res.type == unionScan.QR_TYPE_QRC) {
|
||||
return go.to('PAGES_APP_CODE_BIND', {
|
||||
qrcId: res.bizValue
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 获取当前时间
|
||||
function getdate() {
|
||||
const dt = new Date();
|
||||
const y = dt.getFullYear();
|
||||
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
||||
const d = (dt.getDate() + "").padStart(2, "0");
|
||||
const hh = (dt.getHours() + "").padStart(2, "0");
|
||||
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
||||
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
||||
return `${y}-${m}-${d}`;
|
||||
}
|
||||
// 获取昨天时间
|
||||
const formatTime = () => {
|
||||
let strDate = getdate()
|
||||
let dateFormat = new Date(strDate);
|
||||
dateFormat = dateFormat.setDate(dateFormat.getDate() - 1);
|
||||
dateFormat = new Date(dateFormat);
|
||||
let y = dateFormat.getFullYear()
|
||||
let m = (dateFormat.getMonth() + 1).toString().padStart(2, '0')
|
||||
let d = dateFormat.getDate().toString().padStart(2, '0')
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
const getMemberData = () => {
|
||||
$memberInfoCount({
|
||||
queryDateRange: vdata.timeSelected
|
||||
}).then(({
|
||||
bizData
|
||||
}) => {
|
||||
Object.assign(memberData, bizData);
|
||||
});
|
||||
};
|
||||
defineExpose({
|
||||
refData
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.index-header {
|
||||
width: 680rpx;
|
||||
margin: 0 auto;
|
||||
transform: translateY(30rpx);
|
||||
margin-bottom: 25rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: $J-b-r32;
|
||||
background: $jeepay-bg-primary;
|
||||
backdrop-filter: blur(20rpx);
|
||||
box-shadow: 0 50rpx 70rpx -60rpx rgba(0, 65, 164, 0.5);
|
||||
|
||||
.index-selected {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.index-time {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 490rpx;
|
||||
height: 90rpx;
|
||||
border-radius: 20rpx;
|
||||
padding: 10rpx;
|
||||
background-color: rgba($color: #fff, $alpha: 0.1);
|
||||
|
||||
.time-item {
|
||||
flex: 1;
|
||||
// width: 120rpx;
|
||||
height: 100%;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 0.75);
|
||||
}
|
||||
|
||||
.time-active {
|
||||
background-color: $J-bg-ff;
|
||||
color: $J-color-t21;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.index-scan {
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 20rpx;
|
||||
background-color: rgba($color: #fff, $alpha: 0.1);
|
||||
|
||||
image {
|
||||
width: 41rpx;
|
||||
height: 35rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.receipts-money {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 30rpx 0;
|
||||
color: $J-color-tff;
|
||||
|
||||
.money-num {
|
||||
font-size: 70rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.money-list {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 72rpx;
|
||||
margin-bottom: 50rpx;
|
||||
text-align: center;
|
||||
color: $J-color-tff;
|
||||
|
||||
.money-item {
|
||||
.money-num {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.money-title {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $J-color-tSff;
|
||||
}
|
||||
|
||||
.quick-money {
|
||||
height: 110rpx;
|
||||
border-radius: 20rpx;
|
||||
color: $J-color-t29;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
448
pages/index/components/my-date-pickerview.vue
Normal file
448
pages/index/components/my-date-pickerview.vue
Normal file
@@ -0,0 +1,448 @@
|
||||
<template>
|
||||
<view class="mask" v-if="show" @tap="close">
|
||||
<view class="box" @tap.stop="nullFunction">
|
||||
<view class="u-flex u-relative u-row-center u-p-30 top">
|
||||
<view class="font-bold u-font-32">筛选日期时间</view>
|
||||
<view class="close" @tap="close">
|
||||
<uni-icons type="closeempty" size="24"></uni-icons>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- <view class="u-p-30 u-flex u-flex-wrap gap-20 fastTime">
|
||||
<view class="item" v-for="(item,index) in fastTime" :key="index" @tap="changeTime(item.key)">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view> -->
|
||||
<picker-view :immediate-change="true" @pickend="pickend" :value="value" @change="bindChange"
|
||||
class="picker-view">
|
||||
<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-column>
|
||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in minutes" :key="index">{{item}}分</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||
</picker-view-column> -->
|
||||
</picker-view>
|
||||
<view class="u-text-center color-999">至</view>
|
||||
<picker-view :immediate-change="true" :value="value1" @pickend="pickend1" @change="bindChange1"
|
||||
class="picker-view">
|
||||
<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 days1" :key="index">{{item}}日</view>
|
||||
</picker-view-column>
|
||||
<!-- <picker-view-column>
|
||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in minutes" :key="index">{{item}}分</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||
</picker-view-column> -->
|
||||
</picker-view>
|
||||
|
||||
<!-- 站位 -->
|
||||
<view style="height: 80px;"></view>
|
||||
<view class="fixed_b">
|
||||
<my-button shape="circle" @tap="confirm">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import myButton from "@/components/my-components/my-button.vue"
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
const $nowDate = new Date()
|
||||
const nowDate = {
|
||||
year: $nowDate.getFullYear(),
|
||||
month: $nowDate.getMonth() + 1,
|
||||
day: $nowDate.getDate(),
|
||||
hours: $nowDate.getHours(),
|
||||
minutes: $nowDate.getMinutes(),
|
||||
seconds: $nowDate.getSeconds()
|
||||
}
|
||||
const yearsLen = 30
|
||||
const years = new Array(yearsLen).fill(1).map((v, index) => {
|
||||
return nowDate.year - index
|
||||
}).reverse()
|
||||
const months = new Array(12).fill(1).map((v, index) => {
|
||||
return index + 1
|
||||
})
|
||||
const days = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
||||
return index + 1
|
||||
}))
|
||||
const days1 = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
||||
return index + 1
|
||||
}))
|
||||
const hours = new Array(24).fill(1).map((v, index) => {
|
||||
return index
|
||||
})
|
||||
const minutes = new Array(60).fill(1).map((v, index) => {
|
||||
return index
|
||||
})
|
||||
const seconds = new Array(60).fill(1).map((v, index) => {
|
||||
return index
|
||||
})
|
||||
const fastTime = reactive([{
|
||||
title: '今日',
|
||||
key: 'now'
|
||||
},
|
||||
{
|
||||
title: '昨日',
|
||||
key: 'prve'
|
||||
},
|
||||
{
|
||||
title: '本月',
|
||||
key: 'nowMonth'
|
||||
},
|
||||
{
|
||||
title: '上月',
|
||||
key: 'prveMonth'
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
|
||||
function setPrveDay() {
|
||||
|
||||
}
|
||||
|
||||
function setNowMoneth() {
|
||||
|
||||
}
|
||||
|
||||
function setprveMoneth() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function setDay(start, end) {
|
||||
value.value = [
|
||||
start.year,
|
||||
start.month,
|
||||
start.day,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
]
|
||||
value1.value = [
|
||||
end.year,
|
||||
end.month,
|
||||
end.day,
|
||||
23,
|
||||
59,
|
||||
59,
|
||||
]
|
||||
}
|
||||
|
||||
function changeTime(key) {
|
||||
const yearIndex = years.findIndex(v => v == nowDate.year)
|
||||
const prveyearIndex = years.findIndex(v => v == nowDate.year) - 1
|
||||
const nowMonthIndex = nowDate.month - 1
|
||||
const nowDayIndex = nowDate.day - 1
|
||||
const dataMap = {
|
||||
now: function() {
|
||||
return {
|
||||
start: {
|
||||
year: yearIndex,
|
||||
month: nowMonthIndex,
|
||||
day: nowDayIndex
|
||||
},
|
||||
end: {
|
||||
year: yearIndex,
|
||||
month: nowMonthIndex,
|
||||
day: nowDayIndex
|
||||
}
|
||||
}
|
||||
},
|
||||
prve: function() {
|
||||
const oneDay=1000*60*60*24
|
||||
const date=new Date(new Date(nowDate.year,nowDate.month,nowDate.day,0,0,0).getTime()-oneDay)
|
||||
return {
|
||||
start: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
||||
day: date.getDate()-1
|
||||
},
|
||||
end: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
||||
day: date.getDate()-1
|
||||
}
|
||||
}
|
||||
},
|
||||
nowMonth: function() {
|
||||
return {
|
||||
start: {
|
||||
year:yearIndex,
|
||||
month:nowMonthIndex,
|
||||
day: 0
|
||||
},
|
||||
end: {
|
||||
year:yearIndex,
|
||||
month:nowMonthIndex,
|
||||
day:new Date(nowDate.year, nowDate.month , 0).getDate() - 1
|
||||
}
|
||||
}
|
||||
},
|
||||
prveMonth: function() {
|
||||
const oneDay=1000*60*60*24
|
||||
const date=new Date(new Date(nowDate.year, nowDate.month-1,0,0,0).getTime()-oneDay)
|
||||
console.log(date.getMonth());
|
||||
return {
|
||||
start: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth(),
|
||||
day: 0
|
||||
},
|
||||
end: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth(),
|
||||
day: date.getDate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const data = dataMap[key]()
|
||||
setDay(data.start, data.end)
|
||||
changeDays(false,value.value)
|
||||
changeDays(true,value1.value)
|
||||
|
||||
console.log(value1.value);
|
||||
const start = returnDateString(value.value)
|
||||
const end = returnDateString(value1.value)
|
||||
|
||||
emits('confirm', {
|
||||
text: `${start}——${end}`,
|
||||
start,
|
||||
end
|
||||
})
|
||||
close()
|
||||
}
|
||||
let value = ref([
|
||||
years.length - 1,
|
||||
nowDate.month - 1,
|
||||
nowDate.day - 1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
])
|
||||
let value1 = ref([
|
||||
years.length - 1,
|
||||
nowDate.month - 1,
|
||||
nowDate.day - 1,
|
||||
23,
|
||||
59,
|
||||
59,
|
||||
])
|
||||
|
||||
let show = ref(false)
|
||||
const emits = defineEmits('close', 'open', 'confirm')
|
||||
|
||||
function toggle() {
|
||||
show.value = !show.value
|
||||
if (show.value) {
|
||||
emits('open', true)
|
||||
} else {
|
||||
emits('close', false)
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
emits('close', false)
|
||||
}
|
||||
|
||||
function open() {
|
||||
show.value = true
|
||||
emits('open', true)
|
||||
}
|
||||
|
||||
function returnDateString(arr) {
|
||||
const year = years[arr[0]]
|
||||
const month = arr[1] + 1
|
||||
const day = arr[2] + 1
|
||||
const hour = ('0' + arr[3]).slice(-2)
|
||||
const min = ('0' + arr[4]).slice(-2)
|
||||
const sen = ('0' + arr[5]).slice(-2)
|
||||
return `${year}-${month}-${day} ${hour}:${min}:${sen}`
|
||||
}
|
||||
|
||||
|
||||
function confirm(e) {
|
||||
const start = returnDateString(value.value)
|
||||
const end = returnDateString(value1.value)
|
||||
console.log(start);
|
||||
console.log(end);
|
||||
emits('confirm', {
|
||||
text: `${start}——${end}`,
|
||||
start,
|
||||
end
|
||||
})
|
||||
close()
|
||||
}
|
||||
|
||||
function returnMonthStart(arr) {
|
||||
return new Date(years[arr[0]], months[arr[1]] - 1, 1).getDate();
|
||||
}
|
||||
|
||||
function returnMonthEnd(arr) {
|
||||
return new Date(years[arr[0]], months[arr[1]], 0).getDate();
|
||||
}
|
||||
|
||||
function changeDays(isDays1,arr){
|
||||
const end = returnMonthEnd(arr)
|
||||
if (end) {
|
||||
if(isDays1){
|
||||
days1.value= new Array(end).fill(1).map((v,
|
||||
index) => {
|
||||
return index + 1
|
||||
})
|
||||
}else{
|
||||
days.value= new Array(end).fill(1).map((v,
|
||||
index) => {
|
||||
return index + 1
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function bindChange(e) {
|
||||
value.value = e.detail.value
|
||||
changeDays(false, e.detail.value)
|
||||
}
|
||||
|
||||
function bindChange1(e) {
|
||||
value1.value = e.detail.value
|
||||
changeDays(true, e.detail.value)
|
||||
}
|
||||
|
||||
function getDayDate(date = new Date(), type) {
|
||||
const now = date
|
||||
if (type === 'start') {
|
||||
const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
return startOfDay
|
||||
}
|
||||
if (type === 'end') {
|
||||
const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
||||
return endOfDay;
|
||||
}
|
||||
}
|
||||
|
||||
function getMonthArea(date = new Date(), type) {
|
||||
let now = date
|
||||
let currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
let currentMonthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
||||
if (type === 'start') {
|
||||
return currentMonthStart
|
||||
}
|
||||
if (type === 'end') {
|
||||
return currentMonthEnd;
|
||||
}
|
||||
return {
|
||||
start: currentMonthStart,
|
||||
end: currentMonthEnd
|
||||
};
|
||||
}
|
||||
|
||||
function nullFunction() {
|
||||
|
||||
}
|
||||
|
||||
function pickend(e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
function pickend1(e) {
|
||||
console.log(e);
|
||||
}
|
||||
defineExpose({
|
||||
close,
|
||||
open,
|
||||
confirm,
|
||||
toggle
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.fastTime {
|
||||
.item {
|
||||
background-color: rgb(247, 247, 247);
|
||||
padding: 6rpx 40rpx;
|
||||
border-radius: 6rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
right: 30rpx;
|
||||
}
|
||||
|
||||
.mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
background-color: rgba(0, 0, 0, .7);
|
||||
|
||||
.box {
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.fixed_b {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 30rpx;
|
||||
z-index: 100;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.picker-view {
|
||||
width: 750rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
line-height: 34px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
248
pages/index/components/statistics.vue
Normal file
248
pages/index/components/statistics.vue
Normal file
@@ -0,0 +1,248 @@
|
||||
<template>
|
||||
<view class="statistics">
|
||||
<view class="statisticsBox">
|
||||
<view class="time-wrapper">
|
||||
<view v-for="(v, i) in timeList" :key="i" class="timelistbox">
|
||||
<view class="time-item" @tap="changeTime(v.value)" :class="{ 'time-selected':v.value==selected }">
|
||||
{{v.label}}
|
||||
</view>
|
||||
<view class="xian" v-if="v.value==selected "> </view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="payList">
|
||||
<view class="li" v-for="(item,index) in list" :key="index">
|
||||
<view style="text-align: center;">
|
||||
{{item.payType}}
|
||||
</view>
|
||||
<view style="text-align: center;" class="u-m-t-6">
|
||||
{{item.payAmount}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-8 u-flex u-row-center u-font-24 u-col-center color-666">
|
||||
<view class="u-flex" @click="toggleShowAll">
|
||||
<view>{{!showAll?'展开全部':'收起全部' }}</view>
|
||||
<view class="u-flex u-col-center u-m-t-4 tranistion-2" :class="{rotate:showAll}">
|
||||
<up-icon color="#666" name="arrow-down" :size="12"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<datePickerview @confirm="datePickerConfirm" ref="datePicker" style="z-index: 999;"></datePickerview>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
summaryTrade,
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
import dayjs from 'dayjs' //时间格式库
|
||||
import {
|
||||
getCurrentInstance,
|
||||
ref
|
||||
} from 'vue';
|
||||
import datePickerview from './my-date-pickerview.vue'
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app';
|
||||
let selected = ref('today')
|
||||
let showAll = ref(false);
|
||||
let $list = []
|
||||
|
||||
function toggleShowAll() {
|
||||
showAll.value = !showAll.value
|
||||
setList()
|
||||
}
|
||||
|
||||
function setList() {
|
||||
list.value = showAll.value ? $list : $list.slice(0, 4)
|
||||
}
|
||||
let list = ref()
|
||||
const emit = defineEmits(['totalRevenue'])
|
||||
const timeList = [{
|
||||
label: '今天',
|
||||
value: 'today'
|
||||
},
|
||||
{
|
||||
label: '昨天',
|
||||
value: 'yesterday'
|
||||
},
|
||||
{
|
||||
label: '本周',
|
||||
value: 'circumference'
|
||||
}, {
|
||||
label: '本月',
|
||||
value: 'moon'
|
||||
},
|
||||
{
|
||||
label: '自定义',
|
||||
value: 'custom'
|
||||
}
|
||||
]
|
||||
const currentInstance = getCurrentInstance()
|
||||
onShow((options) => {
|
||||
let iToken = uni.getStorageSync('iToken')
|
||||
if (iToken) {
|
||||
getlist()
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/index'
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
function getlist(start, end) {
|
||||
let startTime, endTime;
|
||||
if (selected.value == 'today') {
|
||||
startTime = dayjs().format('YYYY-MM-DD') + ' 00:00:00'
|
||||
endTime = dayjs().format('YYYY-MM-DD') + ' 23:59:59'
|
||||
} else if (selected.value == 'yesterday') {
|
||||
startTime = formatTime() + ' 00:00:00'
|
||||
endTime = formatTime() + ' 23:59:59'
|
||||
} else if (selected.value == 'circumference') {
|
||||
var now = new Date();
|
||||
var nowTime = now.getTime();
|
||||
var day = now.getDay();
|
||||
var oneDayTime = 24 * 60 * 60 * 1000;
|
||||
//显示周一
|
||||
var MondayTime = nowTime - (day - 1) * oneDayTime;
|
||||
//显示周日
|
||||
var SundayTime = nowTime + (7 - day) * oneDayTime;
|
||||
startTime = dayjs(MondayTime).format('YYYY-MM-DD 00:00:00')
|
||||
endTime = dayjs(SundayTime).format('YYYY-MM-DD 23:59:59')
|
||||
} else if (selected.value == 'moon') {
|
||||
startTime = dayjs().startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
|
||||
endTime = dayjs().endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
|
||||
} else if (selected.value == 'custom') {
|
||||
let s = start.substring(0, start.indexOf(' '))
|
||||
let e = end.substring(0, end.indexOf(' '))
|
||||
startTime = s + ' 00:00:00'
|
||||
endTime = e + ' 23:59:59'
|
||||
}
|
||||
summaryTrade({
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
startTime,
|
||||
endTime,
|
||||
}).then((res) => {
|
||||
$list = res.sale.payCount
|
||||
setList()
|
||||
emit('totalRevenue', res.sale.incomeAmountAll)
|
||||
})
|
||||
}
|
||||
|
||||
function datePickerConfirm(e) {
|
||||
getlist(e.start, e.end)
|
||||
}
|
||||
// 获取当前时间
|
||||
function getdate() {
|
||||
const dt = new Date();
|
||||
const y = dt.getFullYear();
|
||||
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
||||
const d = (dt.getDate() + "").padStart(2, "0");
|
||||
const hh = (dt.getHours() + "").padStart(2, "0");
|
||||
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
||||
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
||||
return `${y}-${m}-${d}`;
|
||||
}
|
||||
// 获取昨天时间
|
||||
const formatTime = () => {
|
||||
let strDate = getdate()
|
||||
let dateFormat = new Date(strDate);
|
||||
dateFormat = dateFormat.setDate(dateFormat.getDate() - 1);
|
||||
dateFormat = new Date(dateFormat);
|
||||
let y = dateFormat.getFullYear()
|
||||
let m = (dateFormat.getMonth() + 1).toString().padStart(2, '0')
|
||||
let d = dateFormat.getDate().toString().padStart(2, '0')
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
|
||||
function changeTime(e) {
|
||||
selected.value = e
|
||||
if (e == 'custom') {
|
||||
currentInstance.ctx.$refs.datePicker.toggle()
|
||||
} else {
|
||||
getlist()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
ul,
|
||||
li {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.rotate {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.statistics {
|
||||
padding: 0 28rpx;
|
||||
|
||||
.statisticsBox {
|
||||
width: 694rpx;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
|
||||
border-radius: 16rpx 16rpx 16rpx 16rpx;
|
||||
padding: 32rpx 22rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top: 54rpx;
|
||||
|
||||
.time-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
.timelistbox {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.time-item {
|
||||
font-size: 28rpx;
|
||||
text-align: center;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.xian {
|
||||
width: 40rpx;
|
||||
height: 3rpx;
|
||||
background-color: #318AFE;
|
||||
// position: absolute;
|
||||
// left: 16rpx;
|
||||
// bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.time-selected {
|
||||
color: #318afe;
|
||||
font-size: 32rpx !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.payList {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 32rpx;
|
||||
|
||||
.li {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
width: 25%;
|
||||
white-space: nowrap;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
>view {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
427
pages/index/index.vue
Normal file
427
pages/index/index.vue
Normal file
@@ -0,0 +1,427 @@
|
||||
<!-- 首页 -->
|
||||
<template>
|
||||
<JeepayBackground :bgColorStyle="{}">
|
||||
<!-- 导航条 -->
|
||||
<up-navbar title="首页" bg-color="#318AFE" titleStyle="color:#fff;font-size:16px;" @leftClick="toSetting">
|
||||
<template #left>
|
||||
<up-icon name="/static/indexImg/icon-menu.svg" color="#fff" :size="16"></up-icon>
|
||||
</template>
|
||||
</up-navbar>
|
||||
<!-- <JeepayCustomNavbar title="首页" textColor="#fff" bgDefaultColor="#318AFE" /> -->
|
||||
<view class="income">
|
||||
<view class="u-flex u-row-center u-relative">
|
||||
<view class="u-flex u-col-center">
|
||||
<view class="u-m-r-12">总收入</view>
|
||||
<up-icon name="/static/indexImg/icon-help.svg" color="#fff" :size="12"
|
||||
@click="toggleTips"></up-icon>
|
||||
</view>
|
||||
<view class="tips u-absolute color-666 u-font-20 u-text-left " :class="{'showTips':showTips}">
|
||||
<view class="sanjiao u-flex"><up-icon name="play-left-fill" size="12" color="#fff"></up-icon></view>
|
||||
总收入为除会员余额
|
||||
支付外所有收入
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-center">
|
||||
<view class="">¥{{((totalRevenuedata||0)*1).toFixed(2)}}</view>
|
||||
</view>
|
||||
<view>{{shopName||''}}</view>
|
||||
</view>
|
||||
<!-- 统计 or 快捷扫码 -->
|
||||
<!-- <Stats ref="statsRef" /> -->
|
||||
<statistics @totalRevenue="totalRevenue"></statistics>
|
||||
<!-- 导航栅格 -->
|
||||
<JeepayNavigation :navList="navList" type="grid" />
|
||||
</JeepayBackground>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
onMounted,
|
||||
nextTick
|
||||
} from 'vue';
|
||||
import {
|
||||
onShareAppMessage,
|
||||
onShareTimeline
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reqLoad,
|
||||
API_URL_SYS_ARTICLES,
|
||||
$indexStatistics,
|
||||
$getSiteInfos
|
||||
} from '@/http/apiManager.js';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import Stats from './components/Stats.vue';
|
||||
import statistics from './components/statistics.vue'
|
||||
import {
|
||||
onPullDownRefresh,
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app';
|
||||
import storageManage from '@/commons/utils/storageManage.js';
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js'
|
||||
uni.hideTabBar()
|
||||
let shopName = ref()
|
||||
onLoad((options) => {
|
||||
shopName.value = uni.getStorageSync('shopName');
|
||||
});
|
||||
let totalRevenuedata = ref()
|
||||
let totalRevenue = (d) => {
|
||||
totalRevenuedata.value = d
|
||||
}
|
||||
|
||||
let showTips = ref(false)
|
||||
|
||||
function toggleTips() {
|
||||
showTips.value = !showTips.value
|
||||
}
|
||||
|
||||
function toSetting() {
|
||||
go.to('PAGES_SHOP_SETUP')
|
||||
}
|
||||
// 导航列表
|
||||
const navList = [
|
||||
// {
|
||||
// title: '收银',
|
||||
// icon: '/static/indexImg/icon-cashier.svg',
|
||||
// pageUrl: 'PAGES_QUICK_PAY',
|
||||
// },
|
||||
{
|
||||
title: '销售汇总',
|
||||
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg',
|
||||
pageUrl: 'PAGES_SALES_SUMMARY'
|
||||
},
|
||||
{
|
||||
title: '代客下单',
|
||||
icon: '/static/indexImg/icon-substitute-ordering.svg',
|
||||
pageUrl: 'PAGES_CREATE_ORDER',
|
||||
clickFunc: () => {
|
||||
hasPermission('允许下单').then(res => {
|
||||
if (res) {
|
||||
go.to('PAGES_CREATE_ORDER')
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '桌台',
|
||||
icon: '/static/indexImg/icon-table.svg',
|
||||
pageUrl: 'PAGES_TABLE'
|
||||
},
|
||||
{
|
||||
title: '商品管理',
|
||||
icon: '/static/indexImg/icon-product-control.svg',
|
||||
pageUrl: 'PAGES_PRODUCT',
|
||||
},
|
||||
{
|
||||
title: '分组管理',
|
||||
icon: '/static/indexImg/goods-group.svg',
|
||||
pageUrl: 'PAGES_GOODS_GROUP',
|
||||
},
|
||||
{
|
||||
title: '分类管理',
|
||||
icon: '/static/indexImg/icon-category.svg',
|
||||
pageUrl: 'PAGES_CATEGORY',
|
||||
},
|
||||
{
|
||||
title: '会员管理',
|
||||
icon: '/static/indexImg/icon-user.svg',
|
||||
pageUrl: 'PAGES_USER_CONTROL',
|
||||
}, {
|
||||
title: '员工管理',
|
||||
icon: '/static/indexImg/icon-staff.svg',
|
||||
pageUrl: 'PAGES_STAFF'
|
||||
},
|
||||
{
|
||||
title: '耗材管理',
|
||||
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg',
|
||||
pageUrl: 'PAGES_SALES_CONSUMABLES'
|
||||
},
|
||||
{
|
||||
title: '订单管理',
|
||||
icon: '/static/indexImg/icon-order.svg',
|
||||
pageUrl: 'PAGES_ORDER_INDEX',
|
||||
},
|
||||
{
|
||||
title: '设备管理',
|
||||
icon: '/static/indexImg/icon-printer.svg',
|
||||
pageUrl: 'PAGES_PRINTER_INDEX',
|
||||
},
|
||||
{
|
||||
title: '交班',
|
||||
icon: '/static/indexImg/icon-work.svg',
|
||||
pageUrl: 'PAGES_WORK_INDEX',
|
||||
},
|
||||
// {
|
||||
// title: '极速开票',
|
||||
// icon: '/static/indexImg/red-envelope.svg',
|
||||
// pageUrl: 'PAGES_INVOICE'
|
||||
// },
|
||||
{
|
||||
title: '排队',
|
||||
icon: '/static/indexImg/icon-line-up.svg',
|
||||
pageUrl: 'PAGES_LINE_UP'
|
||||
},
|
||||
{
|
||||
title: '霸王餐',
|
||||
icon: '/static/indexImg/icon-bwc.svg',
|
||||
pageUrl: 'PAGES_BWC'
|
||||
},
|
||||
// {
|
||||
// title: '成员管理',
|
||||
// icon: '/static/indexImg/icon-staff.svg',
|
||||
// pageUrl: 'PAGES_USER'
|
||||
// },
|
||||
// {
|
||||
// title: '订阅通知',
|
||||
// icon: '/static/indexImg/icon-notification.svg',
|
||||
// pageUrl: 'PAGES_NOTIFICATION_INDEX',
|
||||
// },
|
||||
// {
|
||||
// title: '设置中心',
|
||||
// icon: '/static/indexImg/icon-cashier.svg',
|
||||
// pageUrl: 'PAGES_SHOP_SETUP',
|
||||
// },
|
||||
{
|
||||
title: '优惠券',
|
||||
icon: '/static/coupon/icon_coupon.svg',
|
||||
pageUrl: 'PAGES_COUPON_INDEX',
|
||||
},
|
||||
{
|
||||
title: '订阅通知',
|
||||
icon: '/static/indexImg/icon-notification.svg',
|
||||
pageUrl: 'PAGES_NOTIFICATION_INDEX',
|
||||
},
|
||||
{
|
||||
title: '挂账管理',
|
||||
icon: '/static/indexImg/icon_credit.svg',
|
||||
pageUrl: 'PAGES_CREDIT_BUYER_INDEX',
|
||||
},
|
||||
// // // {
|
||||
// // // title: '进销存',
|
||||
// // // icon: '/static/indexImg/icon-invoicing.svg',
|
||||
// // // pageUrl: 'PAGES_INVOICING_INDEX',
|
||||
// // // },
|
||||
|
||||
// // // {
|
||||
// // // title: '预定座位',
|
||||
// // // icon: '/static/indexImg/icon-yuyue-zuo.svg',
|
||||
// // // pageUrl: 'PAGES_RESERVE_SEAT_INDEX',
|
||||
// // // },
|
||||
// // // {
|
||||
// // // title: '预约管理',
|
||||
// // // icon: '/static/indexImg/icon-yuyue.svg',
|
||||
// // // pageUrl: 'PAGES_BOOKING_INDEX',
|
||||
// // // },
|
||||
// // // {
|
||||
// // // title: '充值管理',
|
||||
// // // icon: '/static/indexImg/icon-recharge.svg',
|
||||
// // // pageUrl: 'PAGES_RECHARGE_INDEX',
|
||||
// // // },
|
||||
// // // {
|
||||
// // // title: '存酒管理',
|
||||
// // // icon: '/static/indexImg/icon-wine.svg',
|
||||
// // // pageUrl: 'PAGES_STORING_WINE_INDEX',
|
||||
// // // },
|
||||
// // // {
|
||||
// // // title: '进件管理',
|
||||
// // // icon: '/static/indexImg/icon-passage.svg',
|
||||
// // // pageUrl: 'PAGES_APPLYMENT',
|
||||
// // // entId: 'ENT_MCH_APPLYMENT_LIST'
|
||||
// // // },
|
||||
// // // {
|
||||
// // // title: '商户管理',
|
||||
// // // icon: '/static/indexImg/business.svg',
|
||||
// // // pageUrl: 'PAGES_APPLYMENT_BUSINESS',
|
||||
// // // entId: 'ENT_MCH_APPLYMENT_LIST'
|
||||
// // // },
|
||||
// // // {
|
||||
// // // title: '门店管理',
|
||||
// // // icon: '/static/indexImg/icon-store.svg',
|
||||
// // // pageUrl: 'PAGES_STORE',
|
||||
// // // entId: 'ENT_MCH_STORE'
|
||||
// // // },
|
||||
// // {
|
||||
// // title: '设备管理',
|
||||
// // icon: '/static/indexImg/icon-calc.svg',
|
||||
// // pageUrl: 'PAGES_DEVICE_MAIN',
|
||||
// // entId: 'ENT_DEVICE'
|
||||
// // },
|
||||
|
||||
// {
|
||||
// title: '数据中心',
|
||||
// icon: '/static/indexImg/icon-pro.svg',
|
||||
// pageUrl: 'PAGES_STAT',
|
||||
// entId: 'ENT_ORDER_STATISTIC'
|
||||
// },
|
||||
// {
|
||||
// title: '商户应用',
|
||||
// icon: '/static/indexImg/icon-app.svg',
|
||||
// pageUrl: 'PAGES_APP',
|
||||
// entId: 'ENT_MCH_APP_LIST'
|
||||
// },
|
||||
// {
|
||||
// title: '会员中心',
|
||||
// icon: '/static/indexImg/icon-member.svg',
|
||||
// pageUrl: 'PAGES_MEMBER_CENTER',
|
||||
// entId: 'ENT_MCH_MEMBER'
|
||||
// },
|
||||
// {
|
||||
// title: '广告管理',
|
||||
// icon: '/static/indexImg/icon-ad.svg',
|
||||
// pageUrl: 'PAGES_AD_LIST',
|
||||
// entId: 'ENT_ADVERT_CONTROL'
|
||||
// },
|
||||
|
||||
|
||||
|
||||
|
||||
// {
|
||||
// title: '营销红包',
|
||||
// icon: '/static/indexImg/red-envelope.svg',
|
||||
// pageUrl: 'PAGES_RED_INDEX',
|
||||
// entId: 'ENT_MCH_MEMBER'
|
||||
// },
|
||||
{
|
||||
title: '核销管理',
|
||||
icon: '/static/indexImg/pagewriteoff.svg',
|
||||
pageUrl: 'PAGES_WEITEOFF'
|
||||
},
|
||||
{
|
||||
title: '退出登录',
|
||||
icon: '/static/indexImg/icon-login-out.svg',
|
||||
pageUrl: 'PAGES_LOGIN',
|
||||
clickFunc: () => {
|
||||
storageManage.cleanByLogout()
|
||||
go.to('PAGES_LOGIN', {}, 'redirect')
|
||||
}
|
||||
}
|
||||
|
||||
];
|
||||
// 如果不是超管 删除 刷脸广告菜单
|
||||
if (storageManage.userInfo().userType != 1) {
|
||||
const index = navList.findIndex((v) => v.entId == 'ENT_ADVERT_CONTROL');
|
||||
if (index != -1) {
|
||||
navList.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
const vdata = reactive({
|
||||
noticeList: [], // 公告列表
|
||||
adList: [],
|
||||
shareImgUrl: '' //分享图片
|
||||
});
|
||||
|
||||
// 公告的点击事件。
|
||||
const listviewClickFunc = (isClickMore, record) => {
|
||||
if (isClickMore) {
|
||||
return go.to('PAGES_NOTICE_LIST');
|
||||
}
|
||||
|
||||
return go.to('PAGES_NOTICE_DETAIL', {
|
||||
id: record.articleId
|
||||
});
|
||||
};
|
||||
|
||||
// 刷新数据 async 异步函数, 每个查询需要返回promise对象,并标识await
|
||||
async function refData() {
|
||||
// 查询公告列表
|
||||
|
||||
// 调用子组件方法 , 避免组件没有加载完成。
|
||||
// nextTick(() => statsRef.value.refData());
|
||||
// 停止刷新
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
// 获取 统计数据
|
||||
const getIndexStat = (time) => {
|
||||
$indexStatistics(time).then(({
|
||||
bizData
|
||||
}) => {
|
||||
vdata.statInfo = bizData.dayCount;
|
||||
});
|
||||
};
|
||||
|
||||
// 启动加载
|
||||
onMounted(() => {
|
||||
// refData();
|
||||
});
|
||||
// 微信分享
|
||||
onShareAppMessage((res) => {
|
||||
if (res.from == 'menu')
|
||||
return {
|
||||
title: uni.$appName,
|
||||
path: '/pages/index/index',
|
||||
imageUrl: vdata.shareImgUrl
|
||||
};
|
||||
});
|
||||
// 分享到朋友圈
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: uni.$appName,
|
||||
imageUrl: vdata.shareImgUrl
|
||||
};
|
||||
});
|
||||
// 下拉刷新
|
||||
onPullDownRefresh(() => {
|
||||
refData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.income {
|
||||
/* #ifdef H5 */
|
||||
padding-top: calc(84rpx);
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
padding-top: calc(84rpx + 44px);
|
||||
|
||||
/* #endif */
|
||||
>view {
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
}
|
||||
|
||||
>view:nth-child(1) {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
margin-top: 84rpx;
|
||||
}
|
||||
|
||||
>view:nth-child(2) {
|
||||
margin-top: 20rpx;
|
||||
font-weight: 500;
|
||||
font-size: 64rpx;
|
||||
}
|
||||
|
||||
>view:nth-child(3) {
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
opacity: 0;
|
||||
right: 28rpx;
|
||||
transition: opacity .3s;
|
||||
background: #FFFFFF;
|
||||
padding: 20rpx 14rpx;
|
||||
width: 211rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
|
||||
&.showTips {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sanjiao {
|
||||
position: absolute;
|
||||
right: 100%;
|
||||
top: 50%;
|
||||
transform: translateX(10rpx) translateY(-50%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
191
pages/index/indexCopy.vue
Normal file
191
pages/index/indexCopy.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<!-- 首页 -->
|
||||
<template>
|
||||
<view class="" @click="tologin">
|
||||
<JeepayBackground :bgColorStyle="{}">
|
||||
<!-- 导航条 -->
|
||||
<JeepayCustomNavbar title="首页" textColor="#fff" bgDefaultColor="linear-gradient(270deg, rgba(72, 192, 255, 1) 0%, rgba(51, 157, 255, 1) 100%)" />
|
||||
|
||||
<!-- 统计 or 快捷扫码 -->
|
||||
<view class="code-box">
|
||||
<view class="today-box">
|
||||
<view class="today">
|
||||
<view class="today-title">今天</view>
|
||||
<view class="jing-box">
|
||||
<text>昨天</text>
|
||||
<text>近7天</text>
|
||||
<text>近30天</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="saoma">扫码</view>
|
||||
</view>
|
||||
<view class="" style="display: flex; flex-direction: column; justify-content: space-around; align-items: center; height: 400rpx; color: #fff; font-size: 28rpx">
|
||||
<view class="" style="display: flex; flex-direction: column; align-items: center">
|
||||
<view class="">成交金额(元)</view>
|
||||
<view class="">0.00</view>
|
||||
</view>
|
||||
<view class="" style="display: flex; justify-content: space-around; width: 100%; align-items: center">
|
||||
<view class="" style="display: flex; flex-direction: column; align-items: center">
|
||||
<view class="">成交笔数</view>
|
||||
<view class="">0</view>
|
||||
</view>
|
||||
<view class="" style="display: flex; flex-direction: column; align-items: center">
|
||||
<view class="">退款金额(元)</view>
|
||||
<view class="" style="font-size: 60rpx">0.00</view>
|
||||
</view>
|
||||
<view class="" style="display: flex; flex-direction: column; align-items: center">
|
||||
<view class="">退款笔数</view>
|
||||
<view class="">0</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="width: 100%">
|
||||
<button>快捷收银</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 导航栅格 -->
|
||||
<view class="" style="margin-top: 85%; display: flex; flex-wrap: wrap; padding: 0 40rpx; justify-content: space-around">
|
||||
<view class="" v-for="item in navList" style="width: 30%; margin: 10rpx 0; background: #fff; padding: 10rpx 0; border-radius: 30rpx">
|
||||
<view class="" style="display: flex; flex-direction: column; justify-content: center; align-items: center">
|
||||
<image :src="item.icon" mode="" style="width: 100rpx; height: 100rpx"></image>
|
||||
{{ item.title }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</JeepayBackground>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import storageManage from '@/commons/utils/storageManage.js';
|
||||
// 导航列表
|
||||
const navList = [
|
||||
{
|
||||
title: '商户进件',
|
||||
icon: '/static/indexImg/icon-passage.svg',
|
||||
pageUrl: 'PAGES_APPLYMENT',
|
||||
entId: 'ENT_MCH_APPLYMENT_LIST'
|
||||
},
|
||||
{
|
||||
title: '商户管理',
|
||||
icon: '/static/indexImg/business.svg',
|
||||
pageUrl: 'PAGES_APPLYMENT_BUSINESS',
|
||||
entId: 'ENT_MCH_APPLYMENT_LIST'
|
||||
},
|
||||
{
|
||||
title: '我的门店',
|
||||
icon: '/static/indexImg/icon-store.svg',
|
||||
pageUrl: 'PAGES_STORE',
|
||||
entId: 'ENT_MCH_STORE'
|
||||
},
|
||||
{
|
||||
title: '我的设备',
|
||||
icon: '/static/indexImg/icon-calc.svg',
|
||||
pageUrl: 'PAGES_DEVICE_MAIN',
|
||||
entId: 'ENT_DEVICE'
|
||||
},
|
||||
{
|
||||
title: '员工管理',
|
||||
icon: '/static/indexImg/icon-staff.svg',
|
||||
pageUrl: 'PAGES_USER',
|
||||
entId: 'ENT_UR_USER_LIST'
|
||||
},
|
||||
{
|
||||
title: '统计报表',
|
||||
icon: '/static/indexImg/icon-pro.svg',
|
||||
pageUrl: 'PAGES_STAT',
|
||||
entId: 'ENT_ORDER_STATISTIC'
|
||||
},
|
||||
{
|
||||
title: '商户应用',
|
||||
icon: '/static/indexImg/icon-app.svg',
|
||||
pageUrl: 'PAGES_APP',
|
||||
entId: 'ENT_MCH_APP_LIST'
|
||||
},
|
||||
{
|
||||
title: '会员中心',
|
||||
icon: '/static/indexImg/icon-member.svg',
|
||||
pageUrl: 'PAGES_MEMBER_CENTER',
|
||||
entId: 'ENT_MCH_MEMBER'
|
||||
},
|
||||
{
|
||||
title: '广告管理',
|
||||
icon: '/static/indexImg/icon-ad.svg',
|
||||
pageUrl: 'PAGES_AD_LIST',
|
||||
entId: 'ENT_ADVERT_CONTROL'
|
||||
},
|
||||
{
|
||||
title: '营销红包',
|
||||
icon: '/static/indexImg/red-envelope.svg',
|
||||
pageUrl: 'PAGES_RED_INDEX',
|
||||
entId: 'ENT_MCH_MEMBER'
|
||||
}
|
||||
];
|
||||
|
||||
// 如果不是超管 删除 刷脸广告菜单
|
||||
if (storageManage.userInfo().userType != 1) {
|
||||
const index = navList.findIndex((v) => v.entId == 'ENT_ADVERT_CONTROL');
|
||||
if (index != -1) {
|
||||
navList.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
const tologin = () => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/index'
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.code-box {
|
||||
background: #1c72fe;
|
||||
position: fixed;
|
||||
width: 90%;
|
||||
right: 5%;
|
||||
height: 500rpx;
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
top: 15%;
|
||||
|
||||
.today-box {
|
||||
display: flex;
|
||||
color: #fff;
|
||||
.today {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
margin-right: 10rpx;
|
||||
background: #368bfd;
|
||||
padding: 10rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.today-title {
|
||||
height: 70rpx;
|
||||
background: #fff;
|
||||
width: 100rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 10rpx;
|
||||
color: #1b6dfe;
|
||||
}
|
||||
.saoma {
|
||||
width: 100rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 10rpx;
|
||||
color: #fff;
|
||||
background: #368bfd;
|
||||
}
|
||||
|
||||
.jing-box {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
93
pages/index/scan.vue
Normal file
93
pages/index/scan.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<JeepayCustomNavbar backIcon="closeempty" title="登录取认" backCtrl="back" />
|
||||
<view class="scan-content">
|
||||
<view class="computer">
|
||||
<image src="/static/iconImg/computer.svg" mode=""></image>
|
||||
<text>您正在登录商户管理系统网站</text>
|
||||
</view>
|
||||
<view class="btn confirm" @tap="codeOk('confirmed')" hover-class="touch-button ">确认登录</view>
|
||||
<view class="btn cancel" @tap="codeOk('canceled')" hover-class="touch-hover">取消登录</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { $scanCodeLogin } from '@/http/apiManager.js'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
|
||||
const vdata = reactive({
|
||||
qrcodeNo : ''
|
||||
})
|
||||
|
||||
onLoad((option) => {
|
||||
vdata.qrcodeNo = option.qrcodeNo
|
||||
|
||||
// 已扫
|
||||
$scanCodeLogin(vdata.qrcodeNo, "scaned")
|
||||
|
||||
})
|
||||
|
||||
const codeOk = (val) => {
|
||||
$scanCodeLogin(vdata.qrcodeNo, val).then((res) => {
|
||||
if(val == 'confirmed'){
|
||||
return infoBox.showSuccessToast('登录成功')
|
||||
}else{
|
||||
return infoBox.showToast("已取消")
|
||||
}
|
||||
}).then(() => {
|
||||
go.back()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.scan-content {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
.computer {
|
||||
margin-top: 260rpx;
|
||||
margin-bottom: 150rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
text {
|
||||
line-height: 46px;
|
||||
font-size: 33rpx;
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 360rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #4dab68;
|
||||
font-size: 33rpx;
|
||||
}
|
||||
.confirm {
|
||||
color: #fff;
|
||||
background: $jeepay-bg-primary;
|
||||
}
|
||||
.cancel {
|
||||
margin-top: 35rpx;
|
||||
color: #666;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
.canceled {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user