123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618 |
- <template>
- <view>
- <u-navbar title="充值记录" title-color="#101010"></u-navbar>
- <view class="tabs-box" v-if="!popShow" >
- <view class="tabs1" v-show="tenantList.length>1" :style="{width: tenantList.length>4 ? '' : '100%'}" >
- <u-tabs :list="tenantList1" inactive-color="#777777" active-color="#333333 "
- bg-color="#fff" :is-scroll="false" :current="current" @change="change"></u-tabs>
- </view>
- <view class="icon" @click="popShow=true" v-if="tenantList.length >= 4" >
- <u-icon name="arrow-down" color="#777777" size="28"></u-icon>
- </view>
- </view>
- <!-- 标签弹出层 -->
- <u-popup v-model="popShow" length="80%" @close="keyword=''" duration="10" mode="top" :negative-top="188" border-radius="32">
- <u-navbar title="充值记录" title-color="#101010"></u-navbar>
-
- <view class="head-head">
- <u-search placeholder="请输入关键字" :show-action="false" v-model="keyword"></u-search>
-
- </view>
- <view class="head-head-placeholder ">
-
- </view>
-
- <view class="popup-tabs" v-if="false">
- <view class="tabs1">
- <!-- <u-tabs :list="tenantList1" inactive-color="#777777" active-color="#333333 "
- bg-color="#fff" :is-scroll="false" :current="current" @change="change"></u-tabs> -->
- <u-tabs :list="tenantList1" :is-scroll="false" :current="current" @change="change"></u-tabs >
- </view>
- <view class="more">
- <u-icon name="arrow-up" color="#777777" size="40" @click="popShow=false"></u-icon>
- </view>
- </view>
- <view class="tabs-options">
- <view class="item" v-for="(item, index) in tenantList"
- v-show="keyword==''||(item.name&&item.name.indexOf(keyword)!=-1)"
-
- :class="{
- 'item-index' : item.id==formData.tenantId
- }"
- :key="index"
- @click="merchantChange(item,index)">
- {{item.name}}
- </view>
- <u-divider nonetext="没有找到相关内容"
- border-color="#CFD2D5">已经到底了</u-divider>
- </view>
- </u-popup>
-
-
- <!-- 折线图 -->
- <view class="chart-box">
- <view class="chart">
- <view id="pieEcharts" >
-
- </view>
- </view>
- </view>
- <!-- 标签 -->
- <view class="tabs">
- <u-picker v-model="tabsFrom.show1" mode="selector"
- :default-selector="[tabsFrom.show1Index]"
- :range="tabsFrom.selector1" range-key="label" @confirm="selector1confirm" ></u-picker>
- <u-picker-select title="日期选择" v-model="tabsFrom.show2"
- :defaultTime="tabsFrom.show2Index" :endYear="endYear"
- mode="time" :params="params" @confirm="selector2confirm" @reset="selector2reset" ></u-picker-select>
-
- <view class="tabsItem" @click="tabsFrom.show1=!tabsFrom.show1">{{tabsFrom.show1Text}} <u-icon name="arrow-up"
- v-if="tabsFrom.show1"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
- <view class="tabsItem" @click="tabsFrom.show2=!tabsFrom.show2">{{tabsFrom.show2Text}} <u-icon name="arrow-up"
- v-if="tabsFrom.show2"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
- </view>
- <!-- 记录 -->
- <view class="records" >
- <view class="time">
- {{queryMonth}} 充值 {{jpAmount(sumAmount)}}元
- </view>
- <view class="details" v-for="(item,i) in list" :key="i">
- <view class="details-title">
- <view class="name">
- {{item.remark}}-{{item.methodN}}
- </view>
- <view class="record-time" v-if="item.extraInfo" v-html="extraInfoText(item.extraInfo)" >
-
- </view>
- <view class="record-time">
- {{item.createTime}}
- </view>
- </view>
-
-
- <view class="sum">
- {{jpAmount(item.amount)}}
- </view>
- </view>
- <u-divider :isnone="list.length==0" nonetext="没有找到相关内容"
- border-color="#CFD2D5">已经到底了</u-divider>
- </view>
- </view>
- </template>
- <script>
- //import * as API from '@/apis/pagejs/deduction.js'
- import * as API from '@/apis/pagejs/tenantList.js'
- import {
- nextDay,
- nextMonth,
-
- } from '@/apis/utils'
- import * as echarts from "echarts";
-
- export default {
- data() {
- return {
- myChart:null,
- list:[],
- formData:{
- pageIndex:1,
- pageSize:9999,
- },
-
- popShow:false,
- keyword:'',
- current:0,
- current1: 0,
- current2: 0,
- tenantList:[],
- tenantList1:[],
- endYear:'',
- queryMonth:"",
- params: {
- year: true,
- month: true,
- day: true,
- hour: false,
- minute: false,
- second: false
- },
- tabsFrom: {
- show1: false,
- show1Index:0,
- show2Index:'',
- show2: false,
- show1Text: "全部类型",
- show2Text: "全部时间",
- selector1:[
- {
- label: '全部类型',
- value: '',
- },
- {
- label: '线上充值',
- value: '1',
- },
- {
- label: '线下充值',
- value: '2',
- },
- ]
- },
-
-
-
- }
- },
- onLoad() {
- this.endYear=new Date().getFullYear()
-
- var date=new Date()
- this.formData.startDate=date.getFullYear()+"-"+(date.getMonth() + 1) +"-1"
- this.queryMonth=date.getFullYear()+"年"+(date.getMonth() + 1) +"月"
-
- this.getTenantList()
-
- },
- computed:{
-
- sumAmount(){
- let totalAmount =0
- if(this.list){
- var amounts=this.list.map(item=>{
- return item.amount
- })
-
- totalAmount = amounts.reduce((accumulator, currentValue) => {
- return accumulator + currentValue;
- }, 0);
- }
-
-
- return totalAmount
- }
- },
- methods:{
- merchantChangeApi(){
- this.rechargeRecord();
- this.rechargeRecordGraph();
- },
- change(index) {
-
- this.current = index;
- this.formData.tenantId = this.tenantList1[index].id;
- this.popShow = false;
- this.merchantChangeApi()
- },
- merchantChange(item, index) {
- // if(this.current==0){
- // this.current=1;
- // }
- this.formData.tenantId= item.id;
-
-
- //this.$forceUpdate()
-
- this.getTenantListSort(this.tenantList)
- this.merchantChangeApi()
- this.popShow = false;
- },
-
- getTenantList(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.tenantList().then((response) => {
- uni.hideLoading();
-
-
- var list=response.data.tenantInfoList;
- this.formData.tenantId=list[0].id
-
- this.getTenantListSort(list)
- this.merchantChangeApi()
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getTenantListSort(list){
- for(var i in list){
- var obj=list[i]
- if(this.formData.tenantId==obj.id){
- var obj1=list[this.current];
- list[this.current]=obj;
- list[i]=obj1;
- }
- }
-
-
- this.tenantList=list;
- var mList1 = [];
-
- for (var i = 0; i < list.length; i++) {
- if (i >= 4) {
-
- } else {
- mList1.push(list[i]);
- }
- }
- this.tenantList1 = mList1;
- },
- extraInfoText(extraInfo){
- var obj=JSON.parse(extraInfo)
- if(obj.outOrderNo){
- return `充值订单编号:${obj.outOrderNo}`
- }else{
- return ''
- }
-
-
- },
- selector2confirm(e){
-
- this.tabsFrom.show2Text=e.year+"年"+e.month+"月"
-
- this.tabsFrom.show2Index=e.year+"-"+e.month
- if(e.day){
- this.tabsFrom.show2Text+=e.day+"日"
- this.tabsFrom.show2Index+='-'+e.day
- }
- //this.tabsFrom.show2Index=this.tabsFrom.show2Text
-
-
- if(e.day){
- this.formData.startDate=e.year+"-"+e.month +"-"+e.day
-
- this.queryMonth=e.year+"年"+e.month+"月"+e.day+"日"
- this.formData.endDate=this.formData.startDate
- //nextDay(e.year,e.month, e.day)
-
-
- }else{
- this.queryMonth=e.year+"年"+e.month+"月"
- this.formData.startDate=e.year+"-"+e.month +"-1"
-
- this.formData.endDate=nextMonth(e.year,e.month, 1,1)
-
-
- }
- this.rechargeRecord()
- },
- selector2reset(e){
-
- this.tabsFrom.show2Text='全部时间'
- this.tabsFrom.show2Index='';
-
-
- this.formData.startDate=date.getFullYear()+"-"+(date.getMonth() + 1) +"-1"
- this.queryMonth=date.getFullYear()+"年"+(date.getMonth() + 1)+"月"
- this.rechargeRecord()
- },
- selector1confirm(e){
-
- var index=e[0]
- this.tabsFrom.show1Index=index
- this.tabsFrom.show1Text=this.tabsFrom.selector1[index].label
- this.formData.type=this.tabsFrom.selector1[index].value
- this.rechargeRecord()
- },
- rechargeRecordGraph(){
-
- API.rechargeRecordGraph({
- tenantId:this.formData.tenantId
- }).then((response) => {
-
- var list=response.data;
-
- // uni.getSystemInfo({
- // success: (res) => {
- // const screenWidth = res.windowWidth; // 屏幕宽度,单位为px
- // console.log('屏幕宽度:', screenWidth);
-
- // },
- // });
- this.getPle(list)
- //uni.upx2px(600)
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getPle(list){
-
- if (!this.myChart) {
- this.myChart = echarts.init(document.getElementById('pieEcharts'),null,{
- width:uni.upx2px(700),height:uni.upx2px(280)
- });
- }
- this.myChart.clear();
- var data1=list.map(item=>{
- return item.month.replace("-", "年")+"月"
- });
- var data2=list.map(item=>{
- return item.monthAmount
- });
- var headitemby=""
- var showkey = "";
- var option = {
- tooltip: {
- trigger: 'axis'
- },
- grid: {
- top: '6%',
- left: '3%',
- right: '8%',
- bottom: '8%',
- containLabel: true
- },
- xAxis: {
- type: 'category',
- data: data1,
- axisLabel: {
- formatter: (value) => {
- if (headitemby == "") {
- headitemby = value
- }
- var i = 0
-
- var showvalue = "";
- var key = value.substring(0, 5);
-
- if (showkey == "" || value == headitemby) {
- showkey = key
-
- showvalue = value
- showvalue = value.substring(2)
- } else {
- if (key != showkey) {
- showkey = key
- showvalue = value
- showvalue = value.substring(2)
- } else {
- showvalue = value.substring(5)
- }
- }
- return showvalue.replace("年", ".").replace("月", "");
-
- },
- textStyle: {
- color: "#333"
- }
- },
- },
- yAxis: {
- type: 'value'
- },
- series: [
- {
- name: '合计',
- data: data2,
- type: 'line'
- }
- ]
- }
- console.log(option)
- this.myChart.setOption(option);
-
-
- },
- rechargeRecord(){
- uni.showLoading({
- mask:true,title:'加载中...'
- })
- API.rechargeRecord(this.formData).then((response) => {
- uni.hideLoading();
- this.list=response.data.data;
- }).catch(error => {
- uni.hideLoading();
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
-
- // 标签
- .tabs-box{
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 16rpx 32rpx 16rpx 0;
- .tabs{
- width: 96%;
- }
- /deep/.u-tabs{
- background-color: inherit !important
- }
- }
-
- // 标签
- .tabs-box{
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 16rpx 32rpx 16rpx 0;
- .tabs{
- width: 96%;
- }
- }
- .tabs-box{
- background-color: #fff;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 16rpx 32rpx 16rpx 32rpx;
- .tabs1{
- width: 96%;
- }
- }
-
-
- .popup-tabs {
- background-color: #fff;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-top: 32rpx;
- padding-right: 32rpx;
- color: rgba(51, 51, 51, 1);
- font-size: 32rpx;
-
- .tabs1 {
- width: 88%;
-
- }
- }
-
- /deep/.u-tab-item {
- width: 25% !important;
- flex: none !important;
- }
-
- .tabs-options {
- //display: flex;
- padding: 24rpx 32rpx ;
- flex-wrap: wrap;
-
- .item {
- //width: 25%;
- color:rgb(119, 119, 119);
- margin-bottom: 24rpx;
- font-size: 32rpx;
- }
- .item-index{
- color: rgb(51, 51, 51);
- font-weight: bold;
- }
- }
- .head-head{
- box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.15);
- background: #fff;
- padding:24rpx;
- position: fixed;
- left: 0;
- right: 0;
- top: 80rpx;
- z-index: 991;
- }
- .head-head-placeholder{
- height: 112rpx;
-
- }
- // 折线图
- .chart-box {
- padding: 24rpx 32rpx;
- background: linear-gradient(180deg, rgba(203, 234, 255, 1) 0%, rgba(255, 255, 255, 1) 100%);
- .title {
- color: rgb(16, 16, 16);
- }
- .sum {
- color: rgb(51, 51, 51);
- font-size: 64rpx;
- margin-top: 16rpx;
- .unit {
- color: rgb(16, 16, 16);
- font-size: 28rpx;
- margin-left: 8rpx;
- }
- }
- .chart {
- width: 100%;
- height: 240rpx;
- margin-top: 8rpx;
- .img {
- width: 100%;
- height: 100%;
- }
- }
- }
- // 标签
- .tabs {
- height: 96rpx;
- line-height: 96rpx;
- background-color: #fff;
- border-top: 1px solid rgba(241, 241, 241, 1);
- display: flex;
- justify-content: space-around;
- }
- // 记录
- .records {
- .time {
- padding: 24rpx 32rpx;
- color: rgba(119, 119, 119, 1);
- font-size: 32rpx;
- }
- .details {
- background-color: #fff;
- padding: 32rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .details-title {
- .title {
- color: rgba(51, 51, 51, 1);
- font-size: 32rpx;
- }
- .record-time {
- color: rgb(153, 153, 153);
- font-size: 24rpx;
- margin-top: 8rpx;
- }
- }
- .sum {
- color: rgb(16, 16, 16);
- font-size: 40rpx;
- }
- }
- }
- </style>
|