123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775 |
- <template>
-
- <view class="info">
- <view class="selected" v-if="role=='技术管理员'">
- <view @click="select_merchants">
- <text>{{merchantList[merchantIndex]}}</text>
- <image src="../../static/img/right-arrow.png" mode=""></image>
- </view>
- <view @click="select_area">
- <text>{{areaList[areaIndex]}}</text>
- <image src="../../static/img/right-arrow.png" mode=""></image>
- </view>
- </view>
- <view class="date">
- <view style="width:70%;">
- <view class="flexA" @click="choice">
- <text>开始时间:{{timeShowS}}</text>
-
- </view>
- <view class="flexA" style="margin-top:20rpx;">
- <text>结束时间:{{timeShowE}}</text>
-
- </view>
- </view>
- <view class="dates">已查询{{list.days}}天</view>
- </view>
- <view class="list">
- <view class="income">
- <view class="flexB title">
- <text>收入明细</text>
- <text class="state">总收入:{{list.totalProfit}}</text>
- </view>
- <view class="flex">
- <text>普通订单收入(含调度费):{{list.orderTotalProfit}}</text>
- </view>
- <view class="flex">
- <text>日租订单收入(含调度费):{{list.orderRentTotalProfit}}</text>
- </view>
- <view class="flex">
- <text style="width:50%;">订单调度费:{{list.orderDispatchTotalProfit}}</text>
- <text style="width:50%;">日租订单调度费:{{list.orderRentDispatchTotalProfit}}</text>
- </view>
- <view class="flex">
- <text>待支付订单:{{list.wiatPayTotal}}</text>
- </view>
- </view>
- <view class="income">
- <view class="flexB title">
- <text>用户明细</text>
- <text class="state">总用户:{{list.userTotal}}</text>
- </view>
- <view class="flexB small">
- <text>新增认证用户:{{list.userTotalCardOk}}</text>
- <text>总缴纳押金用户:{{list.userDepositTotal}}</text>
- </view>
- </view>
- <view class="income">
- <view class="flexB title">
- <text>押金明细</text>
- <text class="state">累计净押金:{{list.cumulativeDepositTotal}}</text>
- </view>
- <view class="flexB small">
- <text>新增押金:{{list.depositTotal}}</text>
- </view>
- </view>
- <view class="income">
- <view class="flexB title">
- <text>订单明细</text>
- <text class="state">总订单数:{{list.orderRentTotal+list.orderTotal}}</text>
- </view>
- <view class="flexB small">
- <text>普通订单:{{list.orderTotal}}</text>
- <text>待支付订单:{{list.wiatNum}}</text>
- </view>
- <view class="flex">
- <text>日租订单:{{list.orderRentTotal}}</text>
- </view>
- </view>
- <view class="income">
- <view class="flexB title">
- <text>活动明细</text>
- <text class="state">活动收益:{{list.activityTotalProfit}}</text>
- </view>
- <view class="flexB small">
- <text>充值订单收益:{{list.rechargeOrderTotalProfit}}</text>
- <text>免押金卡收益:{{list.depositCardTotalProfit}}</text>
- </view>
- <view class="flex">
- <text>骑行卡收益:{{list.riddingCardOrderTotalProfit}}</text>
- </view>
- </view>
- <view class="bike">
- <view>
- <text>投放车辆</text>
- <text>{{list.bikeTotal}}</text>
- </view>
- </view>
- </view>
- <view class="cover" v-if="showCal" @click="closeCal" catchtouchmove="true"></view>
- <view class="calendar" v-if="showCal">
- <view class="section">
- <view class="title flex-box">
- <view @click="past">
- <image src="../../static/img/zuo.png" mode="" style="width: 60upx;height: 60upx;"></image>
- </view>
- <view class="title">{{currentShow}}</view>
- <view @click="future">
- <image src="../../static/img/you.png" mode="" style="width: 60upx;height: 60upx;"></image>
- </view>
- </view>
- <view class="week flex-box">
- <view class="weekday" v-for="(item,index) in week" :key='index'>{{item}}</view>
- </view>
- <view class="days flex-box">
- <view class="day" @click="select(item.today)" v-for="(item,index1) in days" :key="index1">
- <view :class="item.today == today ? 'now' : (item.sign ? 'sign' : '')" class="circle">
- <view> {{item.day}} </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- var app = getApp()
- export default {
- data() {
- return {
- showCal: false,
- list: {},
- week: ['日', '一', '二', '三', '四', '五', '六'],
- days: [],
- today: '',
- currentShow: '',
- currentDate: '',
- changeTap: false,
- startRange: '',
- timeRange: [],
- timeStart: '',
- timeEnd: '',
- role: uni.getStorageSync('token').role,
- merchantIndex: 0,
- merchant: [],
- merchantList: [],
- merchantId: '',
- areaIndex: 0,
- area: [],
- areaList: [],
- areaId: '',
- areaID: ''
- }
- },
- onLoad(options) {
- this.areaID = options.areaId
- this.getState();
- let day = this.getDay();
- this.today = day,
- this.currentDate = day
- this.calendar(day);
- console.log(this.role)
- if (this.role == '技术管理员') {
- app.request('order/merchantList', '', 'GET').then(res => {
- uni.hideLoading();
- console.log(res);
- if (res.statusCode == 200) {
- if (res.data.length > 1) {
- var obj = [{
- "id": '',
- "username": '',
- "name": "全部商户"
- }]
- var data = res.data
- obj = obj.concat(data)
- this.merchant = obj;
- var merchantArr = []
- for (var i = 0; i < this.merchant.length; i++) {
- console.log(this.merchant[i].name)
- merchantArr = merchantArr.concat(this.merchant[i].name)
- }
- console.log(merchantArr)
- this.merchantList = merchantArr;
- this.getArea()
- } else {
- this.merchant = res.data;
- var merchantArr = []
- merchantArr.push(this.merchant[0].name)
- this.merchantList = merchantArr;
- this.merchantId = this.merchant[0].id
- this.getArea()
- }
- }
- })
- }
- },
- methods: {
- getArea: function() {
- console.log(this.merchantId)
- app.request('order/areaList?merchant_id=' + this.merchantId, '', 'GET').then(res => {
- console.log(res);
- if (res.statusCode == 200) {
- if (res.data.length > 1) {
- var obj = [{
- "id": '',
- "username": '',
- "name": "全部区域"
- }]
- var data = res.data
- obj = obj.concat(data)
- this.area = obj;
- var areaArr = []
- for (var i = 0; i < this.area.length; i++) {
- console.log(this.area[i].name)
- areaArr = areaArr.concat(this.area[i].name)
- }
- console.log(areaArr)
- this.areaList = areaArr;
- this.areaId = '';
- } else {
- this.area = res.data;
- var areaArr = []
- areaArr.push(this.area[0].name)
- this.areaId = this.area[0].id;
- this.areaList = areaArr;
- console.log(this.area[0].name)
- console.log(this.areaList)
- }
- }
- })
- },
- select_merchants: function() {
- var that = this;
- uni.showActionSheet({
- itemList: that.merchantList,
- success: function(res) {
- that.merchantId = that.merchant[res.tapIndex].id
- that.getArea()
- that.merchantIndex = res.tapIndex
- that.areaIndex = 0
- setTimeout(function() {
- that.getState()
- }, 500)
- }
- })
- },
- select_area: function() {
- var that = this;
- uni.showActionSheet({
- itemList: that.areaList,
- success: function(res) {
- that.areaIndex = res.tapIndex
- that.areaId = that.area[res.tapIndex].id
- that.getState()
- }
- })
- },
-
- getDay: function() {
- var today = new Date();
- var y = today.getFullYear();
- var m = today.getMonth();
- var d = today.getDate();
-
- var todayMonth = today.getMonth() + 1;
- if (todayMonth < 10) {
- todayMonth = "0" + todayMonth;
- }
- var sendDay = y + "-" + todayMonth + '-' + d;
- return sendDay;
- },
- calendar: function(e) {
- console.log(e)
- var now = e.toString();
- now = now.split('-');
- console.log(now);
- let today = new Date(now[0], (now[1] - 1), now[2]);
-
- let y = today.getFullYear();
- let m = today.getMonth();
- let d = today.getDate();
- console.log(y, m, d, 'ymd')
-
- let todayMonth = today.getMonth() + 1;
- let day = d;
- console.log(d)
- if (todayMonth < 10) {
- todayMonth = "0" + todayMonth;
- }
- if (day < 10) {
- d = "0" + day;
- }
-
- let week = new Date(y, m, 1).getDay();
- console.log(week)
-
- let lastDay = new Date(y, m + 1, 0).getDate();
- console.log(lastDay)
-
- let days = [];
- for (let i = 0; i < week; i++) {
- let obj = {
- id: i,
- day: '',
- today: '',
- sign: false
- };
- days.push(obj);
- }
- let timeRange = this.timeRange;
- let timeLen = timeRange.length;
- for (let j = 0; j < lastDay; j++) {
- let k = j + 1;
- if (k < 10) {
- k = '0' + k
- }
- let idx = j + week;
-
- let theDay = y + "-" + todayMonth + '-' + k;
- let show = false;
- let starts = false;
- let ends = false;
- for (let m = 0; m < timeLen; m++) {
- if (timeRange[m] == theDay) {
- show = true;
-
- if (m == 0) {
- starts = true;
- }
- if (m == (timeLen - 1)) {
- ends = true;
- }
- }
- }
-
- let cell = {
- id: idx,
- day: k,
- today: theDay,
- sign: show,
- start: starts,
- end: ends
- };
- days.push(cell);
- }
- let currentShow = y + "年" + todayMonth + "月";
- this.days = days,
- this.currentDate = e,
- this.currentShow = currentShow
- },
-
- choice: function() {
- this.showCal = true
- },
-
- closeCal: function() {
- this.showCal = false
- },
-
- past: function() {
- let last = this.currentDate;
- last = last.split('-');
- let today = new Date(last[0], (last[1] - 1), last[2]);
- let y = today.getFullYear();
-
- let m = today.getMonth();
- let d = 1;
-
- if (m < 1) {
- y = y - 1;
- m = 12;
- }
- if (m < 10) {
- m = '0' + m;
- }
- let day = y + '-' + m + '-' + d;
- console.log(day, 'day')
- this.calendar(day);
- },
-
- future: function() {
- let next = this.currentDate;
- next = next.split('-');
-
- let today = new Date(next[0], (next[1] - 1), next[2]);
- let y = today.getFullYear();
-
- let m = today.getMonth();
- let d = 1;
-
- if (m > 10) {
- y = y + 1;
- m = 1;
- } else {
- m = m + 2;
- }
- if (m < 10) {
- m = '0' + m;
- }
- let day = y + '-' + m + '-' + d;
- this.calendar(day);
- },
-
- select(e) {
- console.log(e)
- let that = this;
- let day = e;
- let taps = this.changeTap;
- let startRange = this.startRange;
-
- if (startRange == '') {
- startRange = day;
- }
- console.log(startRange)
- let list = [];
- let paramR = day;
- let paramS = day;
- let paramE = day;
- let timeShowS = '';
- let timeShowE = '';
- if (taps && day) {
-
- let dateS = new Date(startRange);
- let dateE = new Date(day);
- console.log(dateS.getTime())
- console.log(dateE.getTime())
- if (dateS.getTime() == dateE.getTime()) {
- list = [day];
- } else if (dateS.getTime() > dateE.getTime()) {
- list = that.datesList(day, startRange);
- paramE = startRange;
- } else if (dateS.getTime() < dateE.getTime()) {
- list = that.datesList(startRange, day);
- paramS = startRange;
- }
- console.log(list)
- that.showCal = false
- timeShowS = paramS;
- timeShowE = paramE;
- let data = {
- " pay_time_between[0]": timeShowS,
- " pay_time_between[1]": timeShowE,
- }
- wx.showLoading({
- title: '加载中...',
- })
- var url = ''
- if (that.role == '技术管理员') {
- url = "order/profitDetail?area_id=" + that.areaId + '&merchant_id=' + that.merchantId
- } else {
- url = "order/profitDetail?area_id=" + that.areaID
- }
- app.request(url, data, 'GET').then(res => {
- wx.hideLoading();
- console.log(res);
- if (res.statusCode == 200) {
- console.log(res)
- that.list = res.data
- }
- })
- } else if (!taps && day) {
-
- list = [day];
- }
- console.log(list)
- that.changeTap = !taps;
- that.startRange = paramR;
- that.timeRange = list;
- that.timeStart = paramS;
- that.timeEnd = paramE;
- that.timeShowS = timeShowS;
- that.timeShowE = timeShowE;
- that.calendar(day);
-
- },
-
- getDates: function(datestr) {
- var temp = datestr.split("-");
- var m = parseInt(temp[1]) - 1;
- var date = new Date(temp[0], m, temp[2]);
- return date;
- },
-
- datesList: function(s, e) {
-
- let arys = [];
- let start = s;
- let end = e;
- let startTime = this.getDates(start);
- let endTime = this.getDates(end);
- while ((endTime.getTime() - startTime.getTime()) >= 0) {
- console.log(startTime.getDate() < 10)
- let year = startTime.getFullYear();
- let monthA = startTime.getMonth() + 1;
- let month = monthA.toString() < 10 ? '0' + monthA.toString() : monthA.toString();
- let d = startTime.getDate() < 10 ? '0' + startTime.getDate() : startTime.getDate();
- let ds = year + "-" + month + "-" + d;
- arys.push(ds)
- startTime.setDate(startTime.getDate() + 1);
- }
- console.log(arys)
- return arys;
- },
- getState: function() {
- uni.showLoading({
- title: '加载中...',
- })
- let that = this;
- let day = new Date();
- day.setTime(day.getTime());
- let today = day.getFullYear() + "-" + (day.getMonth() + 1) + "-" + day.getDate();
- var day1 = new Date();
- day1.setTime(day1.getTime() + 24 * 60 * 60 * 1000);
- var tommorw = day1.getFullYear() + "-" + (day1.getMonth() + 1) + "-" + day1.getDate();
- this.timeShowS = today,
- this.timeShowE = tommorw
- console.log(this.timeShowS)
- console.log(this.timeShowE)
- let data = {
- " pay_time_between[0]": this.timeShowS,
- " pay_time_between[1]": this.timeShowE,
- }
- console.log(this.areaId)
- console.log(this.merchantId)
- var url = ''
- if (that.role == '技术管理员') {
- url = "order/profitDetail?area_id=" + that.areaId + '&merchant_id=' + that.merchantId
- } else {
- url = "order/profitDetail?area_id=" + that.areaID
- }
- app.request(url, data, 'GET').then(res => {
- console.log(res)
- uni.hideLoading();
- if (res.statusCode == 200) {
- this.list = res.data
- }
- })
- },
- }
- }
- </script>
- <style>
-
- @import url("/static/css/base.css");
- page {
- background: #f4f4f4;
- }
- .date {
- width: 90%;
- margin: 20rpx auto;
- background: #fff;
- padding: 20rpx 10rpx;
- box-sizing: border-box;
- border-radius: 10rpx;
- position: relative;
- }
- .date text {
- font-size: 26rpx;
- }
- .dates {
- background: linear-gradient(-86deg, rgba(24, 213, 185, 1) 0%, rgba(89, 240, 202, 1) 100%);
- border-radius: 26rpx 0px 0px 26rpx;
- position: absolute;
- top: 0rpx;
- right: 0rpx;
- color: #fff;
- font-size: 26rpx;
- padding: 7rpx 20rpx;
- }
- .search {
- text-align: center;
- }
- .search text {
- font-size: 26rpx;
- color: #fff;
- background: #18d5b9;
- padding: 8rpx 20rpx;
- border-radius: 10rpx;
- }
- .list {
- margin: 20rpx auto;
- width: 90%;
- }
- .income,
- .bike {
- border: 1rpx solid #efefef;
- font-size: 28rpx;
- border-radius: 10rpx;
- padding: 20rpx;
- margin-top: 15rpx;
- background: #fff;
- position: relative;
- }
- .bike view {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .income .title text {
- font-size: 28rpx;
- margin-bottom: 20rpx;
- }
- .flex {
- display: flex;
- }
- .flex text,
- .small text {
-
- font-size: 26rpx;
- margin-bottom: 10rpx;
- color: #808080;
- }
-
- .calendar {
- color: #666;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 90%;
- margin: 0 auto;
- z-index: 9999;
- border: 2rpx solid #38acff;
- -webkit-box-shadow: 0 0 10rpx #38acff;
- -moz-box-shadow: 0 0 10rpx #38acff;
- box-shadow: 0 0 10rpx #38acff;
- border-radius: 15rpx;
- box-sizing: border-box;
- padding: 20rpx 30rpx;
- background: #fff;
- }
- .title {
- padding: 20rpx 0;
- align-items: center;
- justify-content: space-between;
- }
- .week {
- padding: 20rpx 0;
- border-radius: 20rpx 20rpx 0 0;
- }
- .weekday {
- margin-right: 1%;
- width: 13.28%;
- text-align: center;
- }
- .days {
- padding: 10rpx 0;
- flex-wrap: wrap;
- }
- .day {
- position: relative;
- margin: 0;
- padding: 0;
- height: 90rpx;
- width: 14.28%;
- text-align: center;
- border-radius: 10rpx;
- background: #fff;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .circle {
- margin: 0 auto;
- width: 100%;
- height: 90rpx;
- line-height: 90rpx;
- font-size: 26rpx;
- }
- .sign {
- color: #fff;
- background: #18d5b9;
- border-radius: 50%;
- }
- .now {
- color: #fff;
- background: #708eff;
- border-radius: 50%;
- }
- .flex-box {
- display: flex;
- }
- .state {
- position: absolute;
- top: 0rpx;
- right: 0rpx;
- background: linear-gradient(163deg, rgba(24, 213, 185, 1) 0%, rgba(89, 240, 202, 1) 100%);
- box-shadow: 0px 0px 6rpx 0px rgba(24, 213, 185, 1);
- border-radius: 0px 2rpx 0px 20rpx;
- padding: 5rpx 30rpx;
- color: #fff;
- }
- .selected {
- width: 90%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 0 auto;
- margin-top: 20upx !important;
- }
- .selected view {
- width: 45%;
- display: flex;
- align-items: center;
- justify-content: space-around;
- height: 80upx;
- border: 2upx solid #CCCCCC;
- font-size: 28rpx;
- background: #FFFFFF;
- }
- .selected view image {
- width: 30upx;
- height: 30upx;
- }
- .cover {
- position: fixed !important;
- }
- .circle {
- margin: 0 auto;
- width: 100%;
- height: 90rpx;
- line-height: 90rpx;
- font-size: 26rpx;
- }
- .sign {
- color: #fff;
- background: #18d5b9;
- border-radius: 50%;
- }
- .now {
- color: #fff;
- background: #708eff;
- border-radius: 50%;
- }
- </style>
|