index.vue 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207
  1. <template>
  2. <app-layout>
  3. <view class="head">
  4. <image class="head-bg" :src="adminImg.bg"></image>
  5. <image class="mall-img" v-if="userInfo && userInfo.options" :src="userInfo.options.avatar"></image>
  6. <view class="mall-name t-omit">{{mall.name}}</view>
  7. <view v-if="is_scan_code_pay" @click="toPayment">
  8. <view class="mall-scan-code dir-top-nowrap main-center cross-center">
  9. <image src="./../image/scan-code.png"></image>
  10. <view>收款码</view>
  11. </view>
  12. </view>
  13. <!-- 菜单 -->
  14. <view class="main-between menu" v-if="new_msg_num">
  15. <view class="box-grow-1 menu-item" @click="toMessage">
  16. <image class="item-icon" :src="adminImg.order"></image>
  17. <view>订单消息</view>
  18. <view class="red-num cross-center" v-if="new_msg_num.order_num && new_msg_num.order_num > 0">{{new_msg_num.order_num > 99 ? '99+':new_msg_num.order_num}}</view>
  19. </view>
  20. <view v-if="info.share == 1 || info.mch == 1 || info.bonus == 1 || info.stock == 1" class="box-grow-1 menu-item" @click="toReview">
  21. <image class="item-icon" :src="adminImg.msg"></image>
  22. <view>审核消息</view>
  23. <view class="red-num cross-center" v-if="new_msg_num.review_num && new_msg_num.review_num > 0">{{new_msg_num.review_num > 99 ? '99+' : new_msg_num.review_num}}</view>
  24. </view>
  25. <view v-if="info.share == 1 || info.mch == 1 || info.bonus == 1 || info.stock == 1" class="box-grow-1 menu-item" @click="toCash">
  26. <image class="item-icon" :src="adminImg.cash"></image>
  27. <view>提现申请</view>
  28. <view class="red-num cross-center" v-if="new_msg_num.cash_num && new_msg_num.cash_num > 0">{{new_msg_num.cash_num > 99 ? '99+':new_msg_num.cash_num}}</view>
  29. </view>
  30. <view class="box-grow-1 menu-item" @click="toComment">
  31. <image class="item-icon" :src="adminImg.comment"></image>
  32. <view>评论管理</view>
  33. </view>
  34. <view class="box-grow-1 menu-item" @click="toUser">
  35. <image class="item-icon" :src="adminImg.user"></image>
  36. <view>用户管理</view>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 经营状况 -->
  41. <view class="manage-handle statics">
  42. <view class='main-between' style="margin: 0 24rpx">
  43. <view class="title">经营状况</view>
  44. <view v-if="false" @click="toggle(true,1)" class="order">
  45. <view class='cross-center'>
  46. <text>{{plugins_active.name}}</text>
  47. <image class="more" src="/static/image/icon/icon-down.png"></image>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="choose main-between" style="margin-left: 24rpx;margin-right:24rpx">
  52. <!-- <view @click="tab(1)" :class="['box-grow-1 choose-item',`${_num==0?'active':''}`,'choose-item']">汇总</view>-->
  53. <view @click="tab(1)"
  54. :class="['box-grow-1 choose-item',`${num==1?'active':''}`,'choose-item','left-choose-item']">今日
  55. </view>
  56. <view @click="tab(2)" :class="['box-grow-1 choose-item',`${num==2?'active':''}`,'choose-item']">昨日
  57. </view>
  58. <view @click="tab(3)" :class="['box-grow-1 choose-item',`${num==3?'active':''}`,'choose-item']">7日
  59. </view>
  60. <view @click="tab(4)"
  61. :class="['box-grow-1 choose-item',`${num==4?'active':''}`,'choose-item','right-choose-item']">30日
  62. </view>
  63. </view>
  64. <view class="dir-left-wrap" style="padding-bottom: 12rpx">
  65. <view class="manage-box">
  66. <u-count-to :font-size="40" color="#446DFD" :duration="500" :end-val="all_data.order_num"></u-count-to>
  67. <!-- <view class="value">{{all_data.order_num}}</view>-->
  68. <view class="label">支付订单数</view>
  69. </view>
  70. <view class="manage-box">
  71. <u-count-to :font-size="40" color="#446DFD" :duration="500" :decimals="2" :end-val="all_data.total_pay_price"></u-count-to>
  72. <!-- <view class="value">{{all_data.total_pay_price}}</view>-->
  73. <view class="label">支付金额(元)</view>
  74. </view>
  75. <view class="manage-box">
  76. <u-count-to :font-size="40" color="#446DFD" :duration="500" :end-val="all_data.user_num"></u-count-to>
  77. <!-- <view class="value">{{all_data.user_num}}</view>-->
  78. <view class="label">访客数</view>
  79. </view>
  80. <view class="manage-box">
  81. <u-count-to v-if="all_data.data_num < 10000" :duration="500" :font-size="40" color="#446DFD" separator="," :end-val="all_data.data_num"></u-count-to>
  82. <view v-else class="value" v-text="formatNumText"></view>
  83. <view class="label">访问量</view>
  84. </view>
  85. </view>
  86. </view>
  87. <!-- 快速处理 -->
  88. <view class="quick-handle statics">
  89. <view class='main-between'>
  90. <view class="title">快速处理</view>
  91. </view>
  92. <view class="dir-left-nowrap">
  93. <!-- 待付款 @click="toRedirect('/pages/app_admin/order/order?status=0')" -->
  94. <view class="box-grow-1 quick-box" @click="toRedirect('/pages/app_admin/order/order?status=1')">
  95. <view class="num">{{all_data.wait_send_num}}</view>
  96. <view class="label">待发货订单</view>
  97. <view class="dir-left-nowrap cross-center">
  98. <span class="nav-title">立即发货</span>
  99. <icon class="icon-goto" type></icon>
  100. </view>
  101. <img style="height: 80rpx;width: 100rpx" src="../image/icon_sent.png" alt="">
  102. </view>
  103. <view class="box-grow-1 quick-box" style="margin-left: 20rpx"
  104. @click="toRedirect('/pages/app_admin/order/order?refund=1')">
  105. <view class="num">{{all_data.pro_order}}</view>
  106. <view class="label">维权订单</view>
  107. <view class="dir-left-nowrap cross-center">
  108. <span class="nav-title">立即处理</span>
  109. <icon class="icon-goto" type></icon>
  110. </view>
  111. <img style="height: 88rpx;width: 96rpx" src="../image/icon_hand.png" alt="">
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 图表 -->
  116. <view class="statics canvas-sataics">
  117. <view class="main-between">
  118. <view @click="toggle(true,3)" class="order">
  119. <view class='cross-center'>
  120. <text>{{pay_active.name}}</text>
  121. <image class="more" src="/static/image/icon/icon-down.png"></image>
  122. </view>
  123. </view>
  124. <view @click="toggle(true,2)" class="order">
  125. <view class='cross-center'>
  126. <text>{{canvas_plugins.name}}</text>
  127. <image class="more" src="/static/image/icon/icon-down.png"></image>
  128. </view>
  129. </view>
  130. </view>
  131. <view class="choose main-between">
  132. <view @click="tablist(0)" :class="['box-grow-1',`${date==0?'active':''}`,'choose-item','left-choose-item']">今日</view>
  133. <view @click="tablist(1)" :class="['box-grow-1',`${date==1?'active':''}`,'choose-item']">昨日</view>
  134. <view @click="tablist(2)" :class="['box-grow-1',`${date==2?'active':''}`,'choose-item']">7日</view>
  135. <view @click="tablist(3)" :class="['box-grow-1',`${date==3?'active':''}`,'choose-item','right-choose-item']">30日</view>
  136. </view>
  137. <view class="box">
  138. <!--#ifdef MP-ALIPAY -->
  139. <canvas v-show="!dialog" @touchstart="touchIt($event,'canvasColumn')" canvas-id="canvasColumn" id="canvasColumn" class="charts" :style="{'width':cWidth*pixelRatio+'px','height':cHeight*pixelRatio+'px', 'transform': 'scale('+(1/pixelRatio)+')','margin-left':-cWidth*(pixelRatio-1)/2+'px','margin-top':-cHeight*(pixelRatio-1)/2+'px'}"></canvas>
  140. <!--#endif-->
  141. <!--#ifndef MP-ALIPAY -->
  142. <canvas v-show="!dialog" @touchstart="touchIt($event)" canvas-id="canvasColumn" id="canvasColumn" class="charts"></canvas>
  143. <!--#endif-->
  144. </view>
  145. </view>
  146. <view class="safe-area-inset-bottom">
  147. <view class="u-bottom-height"></view>
  148. </view>
  149. <cover-view class="safe-area-inset-bottom u-bottom-fixed">
  150. <cover-view class="main-between bottom-tab">
  151. <cover-view class="box-grow-1 tab-item active" @click="getInfo(today)">
  152. <!-- #ifdef MP-TOUTIAO -->
  153. <image class="tab-icon" src="./../image/index-active.png"></image>
  154. <view>首页</view>
  155. <!-- #endif -->
  156. <!-- #ifndef MP-TOUTIAO -->
  157. <cover-image class="tab-icon" src="./../image/index-active.png"></cover-image>
  158. <cover-view style="font-size: 20upx">首页</cover-view>
  159. <!-- #endif -->
  160. </cover-view>
  161. <cover-view class="box-grow-1 tab-item" @click="toRedirect('/pages/app_admin/order/order')">
  162. <!-- #ifdef MP-TOUTIAO -->
  163. <image class="tab-icon" src="./../image/order.png"></image>
  164. <view>订单</view>
  165. <!-- #endif -->
  166. <!-- #ifndef MP-TOUTIAO -->
  167. <cover-image class="tab-icon" src="./../image/order.png"></cover-image>
  168. <cover-view style="font-size: 20upx">订单</cover-view>
  169. <!-- #endif -->
  170. </cover-view>
  171. <cover-view class="box-grow-1 tab-item" @click="toRedirect('/pages/app_admin/goods/goods')">
  172. <!-- #ifdef MP-TOUTIAO -->
  173. <image class="tab-icon" src="./../image/goods.png"></image>
  174. <view>商品</view>
  175. <!-- #endif -->
  176. <!-- #ifndef MP-TOUTIAO -->
  177. <cover-image class="tab-icon" src="./../image/goods.png"></cover-image>
  178. <cover-view style="font-size: 20upx">商品</cover-view>
  179. <!-- #endif -->
  180. </cover-view>
  181. <cover-view class="box-grow-1 tab-item" @click="toRedirect('/pages/app_admin/setting/setting')">
  182. <!-- #ifdef MP-TOUTIAO -->
  183. <image class="tab-icon" src="./../image/setting.png"></image>
  184. <view>设置</view>
  185. <!-- #endif -->
  186. <!-- #ifndef MP-TOUTIAO -->
  187. <cover-image class="tab-icon" src="./../image/setting.png"></cover-image>
  188. <cover-view style="font-size: 20upx">设置</cover-view>
  189. <!-- #endif -->
  190. </cover-view>
  191. </cover-view>
  192. </cover-view>
  193. <!-- 选择列表 -->
  194. <view class="dialog" v-if="dialog">
  195. <view class="picker-list">
  196. <view class="main-between picker-header">
  197. <view @click="toggle(false,2)">取消</view>
  198. <view @click="toggle(false,1)">确定</view>
  199. </view>
  200. <picker-view indicator-style="height: 34px;" :value="chooseIndex" @change="bindChange">
  201. <picker-view-column>
  202. <view
  203. :style="{'color': newIndex == idx ? '#446dfd' : newIndex == idx + 1 || newIndex == idx - 1 ? '#999999' : newIndex == idx + 2 || newIndex == idx - 2 ? '#cdcdcd' : ''}"
  204. v-for="(item,idx) in choose_list" :key="item.name"
  205. class="picker-view">
  206. {{item.name}}
  207. </view>
  208. </picker-view-column>
  209. </picker-view>
  210. </view>
  211. </view>
  212. </app-layout>
  213. </template>
  214. <script>
  215. import uCharts from '../../../components/u-charts/u-charts.min.js';
  216. import uCountTo from '../../../components/basic-component/u-count-to/u-count-to.vue';
  217. import {mapState} from "vuex";
  218. var _self;
  219. var canvaColumn=null;
  220. export default {
  221. components: {
  222. uCountTo
  223. },
  224. data() {
  225. return {
  226. info: {
  227. comment: 0,
  228. mch: 0,
  229. share: 0,
  230. },
  231. plugins_list: [],
  232. status: [{
  233. name: '支付金额',
  234. sign: 'total_pay_price'
  235. }, {
  236. name: '支付订单数',
  237. sign: 'order_num'
  238. }, {
  239. name: '支付人数',
  240. sign: 'user_num'
  241. }, {
  242. name: '支付件数',
  243. sign: 'goods_num'
  244. }],
  245. plugins_active: {
  246. name: '全部',
  247. sign: 'all'
  248. },
  249. canvas_plugins: {
  250. name: '全部',
  251. sign: 'all'
  252. },
  253. pay_active: {
  254. name: '支付金额',
  255. sign: 'total_pay_price'
  256. },
  257. num: '1',
  258. date: '0',
  259. choose_list: [],
  260. new_msg_num: null,
  261. all_data: {
  262. order_num: 0,
  263. total_pay_price: 0,
  264. user_num: 0,
  265. data_num: 0,
  266. wait_send_num: '--',
  267. pro_order: '--',
  268. },
  269. chooseIndex: [0],
  270. newIndex: 0,
  271. dialog: false,
  272. today: '',
  273. yesterday: '',
  274. weekday: '',
  275. monthday: '',
  276. area: null,
  277. id: null,
  278. is_scan_code_pay: 0,
  279. cWidth:'',
  280. cHeight:'',
  281. pixelRatio:1,
  282. first: true,
  283. }
  284. },
  285. computed: {
  286. ...mapState({
  287. mall: state => state.mallConfig.mall,
  288. adminImg: state => state.mallConfig.__wxapp_img.app_admin,
  289. userInfo: state => state.user.info
  290. }),
  291. formatNumText() {
  292. if(this.all_data.data_num === '--'){
  293. return this.all_data.data_num;
  294. }
  295. if (this.all_data.data_num) {
  296. let numberFormat = function (value) {
  297. let param = {};
  298. let k = 10000,
  299. sizes = ['', '万', '亿', '万亿'],
  300. i;
  301. if (value < k) {
  302. param.value = value
  303. param.unit = ''
  304. } else {
  305. i = Math.floor(Math.log(value) / Math.log(k));
  306. param.value = Math.floor(((value / Math.pow(k, i))) * 100) / 100;
  307. param.unit = sizes[i];
  308. }
  309. return param;
  310. }
  311. let num = this.all_data.data_num;
  312. let format = numberFormat(num);
  313. return format.value + format.unit;
  314. }
  315. },
  316. },
  317. methods: {
  318. bindChange(e) {
  319. this.newIndex = +e.detail.value[0];
  320. },
  321. // 切换
  322. toggle(Bool,num) {
  323. let status;
  324. if(Bool) {
  325. this.area = num;
  326. }else {
  327. status = num;
  328. }
  329. let day;
  330. let otherDay;
  331. switch (this.num) {
  332. case '0':
  333. day = '';
  334. break;
  335. case '1':
  336. day = this.today;
  337. break;
  338. case '2':
  339. day = this.yesterday;
  340. break;
  341. case '3':
  342. day = this.weekday;
  343. break;
  344. case '4':
  345. day = this.monthday;
  346. break;
  347. }
  348. switch (this.date) {
  349. case '0':
  350. otherDay = this.today;
  351. break;
  352. case '1':
  353. otherDay = this.yesterday;
  354. break;
  355. case '2':
  356. otherDay = this.weekday;
  357. break;
  358. case '3':
  359. otherDay = this.monthday;
  360. break;
  361. }
  362. if (this.area === 3 && Bool) {
  363. for(let index in this.status) {
  364. if(this.pay_active.sign == this.status[index].sign) {
  365. this.chooseIndex[0] = +index
  366. this.newIndex = +index;
  367. }
  368. }
  369. this.choose_list = this.status;
  370. this.dialog = !this.dialog;
  371. } else if (this.area < 3 && Bool) {
  372. if (this.area === 1) {
  373. for(let index in this.plugins_list) {
  374. if(this.plugins_active.sign == this.plugins_list[index].sign) {
  375. this.chooseIndex[0] = +index
  376. this.newIndex = +index;
  377. }
  378. }
  379. } else if (this.area === 2) {
  380. for(let index in this.plugins_list) {
  381. if(this.canvas_plugins.sign == this.plugins_list[index].sign) {
  382. this.chooseIndex[0] = +index
  383. this.newIndex = +index;
  384. }
  385. }
  386. }
  387. this.choose_list = this.plugins_list;
  388. this.dialog = !this.dialog;
  389. }
  390. if(!Bool) {
  391. setTimeout(() => {
  392. if (status == 1) {
  393. switch (this.area) {
  394. case 3:
  395. this.pay_active = this.status[this.newIndex];
  396. this.dialog = false;
  397. this.getCanvas(otherDay);
  398. break;
  399. case 1:
  400. this.plugins_active = this.plugins_list[this.newIndex];
  401. this.getInfo(day);
  402. break;
  403. case 2:
  404. this.canvas_plugins = this.plugins_list[this.newIndex];
  405. this.dialog = false;
  406. this.getCanvas(otherDay);
  407. break;
  408. default:
  409. this.dialog = false;
  410. break;
  411. }
  412. } else if (status > 0 && status != 1) {
  413. this.newIndex = 0;
  414. this.dialog = false;
  415. }
  416. }, 500);
  417. }
  418. },
  419. tablist(e) {
  420. this.date = e.toString();
  421. switch (this.date) {
  422. case '0':
  423. this.getCanvas(this.today);
  424. break;
  425. case '1':
  426. this.getCanvas(this.yesterday);
  427. break;
  428. case '2':
  429. this.getCanvas(this.weekday);
  430. break;
  431. case '3':
  432. this.getCanvas(this.monthday);
  433. break;
  434. }
  435. this.$forceUpdate();
  436. },
  437. tab(e) {
  438. this.num = e.toString();
  439. switch (this.num) {
  440. case '0':
  441. this.getInfo();
  442. break;
  443. case '1':
  444. this.getInfo(this.today);
  445. break;
  446. case '2':
  447. this.getInfo(this.yesterday);
  448. break;
  449. case '3':
  450. this.getInfo(this.weekday);
  451. break;
  452. case '4':
  453. this.getInfo(this.monthday);
  454. break;
  455. }
  456. this.$forceUpdate();
  457. },
  458. toRedirect(url) {
  459. uni.redirectTo({
  460. url: url
  461. })
  462. },
  463. toPayment() {
  464. uni.navigateTo({
  465. url: '/pages/app_admin/payment-code/payment-code'
  466. });
  467. },
  468. toMessage() {
  469. uni.navigateTo({
  470. url: '/pages/app_admin/order-message/order-message'
  471. });
  472. },
  473. toReview() {
  474. uni.navigateTo({
  475. url: '/pages/app_admin/review-message/review-message'
  476. });
  477. },
  478. toCash() {
  479. uni.navigateTo({
  480. url: '/pages/app_admin/cash/cash'
  481. });
  482. },
  483. toComment() {
  484. uni.navigateTo({
  485. url: '/pages/app_admin/comment/comment'
  486. });
  487. },
  488. toUser() {
  489. uni.navigateTo({
  490. url: '/pages/app_admin/user/user?share='+this.info.share
  491. });
  492. },
  493. // 获取日期
  494. getDate() {
  495. var myDate = new Date();
  496. // 今天
  497. let year = myDate.getFullYear();
  498. let month = myDate.getMonth() + 1;
  499. if (month >= 1 && month <= 9) {
  500. month = "0" + month;
  501. }
  502. let now = myDate.getDate();
  503. this.today = year + "-" + month + "-" + now;
  504. var timestamp = Date.parse(new Date());
  505. // 昨天
  506. let yesterTime = (timestamp / 1000 - 24 * 60 * 60) * 1000;
  507. let yesterDate = new Date(yesterTime)
  508. let yester_year = yesterDate.getFullYear();
  509. let yester_month = yesterDate.getMonth() + 1;
  510. if (yester_month >= 1 && yester_month <= 9) {
  511. yester_month = "0" + yester_month;
  512. }
  513. let yester_now = yesterDate.getDate();
  514. this.yesterday = yester_year + "-" + yester_month + "-" + yester_now;
  515. // 7天
  516. let weekTime = (timestamp / 1000 - 24 * 60 * 60 * 6) * 1000;
  517. let weekDate = new Date(weekTime)
  518. let week_year = weekDate.getFullYear();
  519. let week_month = weekDate.getMonth() + 1;
  520. if (week_month >= 1 && week_month <= 9) {
  521. week_month = "0" + week_month;
  522. }
  523. let week_now = weekDate.getDate();
  524. this.weekday = week_year + "-" + week_month + "-" + week_now;
  525. // 30天
  526. let monthTime = (timestamp / 1000 - 24 * 60 * 60 * 29) * 1000;
  527. let monthDate = new Date(monthTime)
  528. let month_year = monthDate.getFullYear();
  529. let month_month = monthDate.getMonth() + 1;
  530. if (month_month >= 1 && month_month <= 9) {
  531. month_month = "0" + month_month;
  532. }
  533. let month_now = monthDate.getDate();
  534. this.monthday = month_year + "-" + month_month + "-" + month_now;
  535. },
  536. getInfo(day) {
  537. let that = this;
  538. uni.showLoading({
  539. mask: true,
  540. title: '加载中...'
  541. });
  542. let date_end;
  543. if(day == that.yesterday){
  544. date_end = that.yesterday;
  545. } else {
  546. date_end = that.today;
  547. }
  548. that.$request({
  549. url: that.$api.app_admin.index,
  550. data: {
  551. date_start: day ? day : '',
  552. date_end: date_end,
  553. sign: that.plugins_active.sign
  554. },
  555. method: 'post'
  556. }).then(response=>{
  557. uni.hideLoading();
  558. that.$hideLoading();
  559. if(response.code == 0) {
  560. let plugins = [];
  561. that.info = response.data.admin_info;
  562. that.plugins_list = plugins.concat(response.data.plugins_list);
  563. that.new_msg_num = response.data.new_msg_num;
  564. that.all_data = response.data.all_data;
  565. that.is_scan_code_pay = response.data.is_scan_code_pay;
  566. }else {
  567. uni.showToast({
  568. title: response.msg,
  569. icon: 'none',
  570. duration: 1000
  571. });
  572. }
  573. }).catch(e => {
  574. uni.hideLoading();
  575. that.$hideLoading();
  576. });
  577. },
  578. getCanvas(day, status) {
  579. let that = this;
  580. let date_end = that.today;
  581. if (day == that.yesterday) {
  582. date_end = that.yesterday
  583. }
  584. that.$request({
  585. url: that.$api.app_admin.table,
  586. data: {
  587. date_start: day,
  588. date_end: date_end,
  589. type: 1,
  590. sign: that.canvas_plugins.sign
  591. },
  592. method: 'post'
  593. }).then(response=>{
  594. that.$hideLoading();
  595. if(response.code == 0) {
  596. let list = response.data.list;
  597. let Column = {categories:[],series:[{name: '',data: []}]};
  598. if (that.pay_active.sign == 'total_pay_price') {
  599. Column.series[0].name = '支付金额';
  600. list.forEach(function(row, index) {
  601. let time = list[index].created_at;
  602. if(that.date < 2) {
  603. time = list[index].created_at + '时'
  604. }
  605. let data = {
  606. value: list[index].total_pay_price,
  607. index: list[index].created_at
  608. }
  609. Column.series[0].data.push(data)
  610. Column.categories.push(time)
  611. })
  612. } else if (that.pay_active.sign == 'order_num') {
  613. Column.series[0].name = '支付订单数';
  614. list.forEach(function(row, index) {
  615. let time = list[index].created_at;
  616. if(that.date < 2) {
  617. time = list[index].created_at + '时'
  618. }
  619. let data = {
  620. value: list[index].order_num,
  621. index: list[index].created_at
  622. }
  623. Column.series[0].data.push(data)
  624. Column.categories.push(time)
  625. })
  626. } else if (that.pay_active.sign == 'goods_num') {
  627. Column.series[0].name = '支付件数';
  628. list.forEach(function(row, index) {
  629. let time = list[index].created_at;
  630. if(that.date < 2) {
  631. time = list[index].created_at + '时'
  632. }
  633. let data = {
  634. value: list[index].goods_num,
  635. index: list[index].created_at
  636. }
  637. Column.series[0].data.push(data)
  638. Column.categories.push(time)
  639. })
  640. } else if (that.pay_active.sign == 'user_num') {
  641. Column.series[0].name = '支付人数';
  642. list.forEach(function(row, index) {
  643. let time = list[index].created_at;
  644. if(that.date < 2) {
  645. time = list[index].created_at + '时'
  646. }
  647. let data = {
  648. value: list[index].user_num,
  649. index: list[index].created_at
  650. }
  651. Column.series[0].data.push(data)
  652. Column.categories.push(time)
  653. })
  654. }
  655. let padding = [15,15,4,0]
  656. switch (that.date) {
  657. case '0':
  658. Column.categories.forEach(function(row, index) {
  659. if (index % 4 == 0) {
  660. Column.categories[index] = Column.categories[index]
  661. } else {
  662. Column.categories[index] = ''
  663. }
  664. })
  665. Column.categories.push('24')
  666. padding = [15,15,4,-25]
  667. break;
  668. case '1':
  669. Column.categories.forEach(function(row, index) {
  670. if (index % 4 != 0) {
  671. Column.categories[index] = ''
  672. }
  673. })
  674. Column.categories.push('24')
  675. padding = [15,15,4,-25]
  676. break;
  677. case '2':
  678. Column.categories.forEach(function(row, index) {
  679. Column.categories[index] = Column.categories[index].substring(5)
  680. })
  681. break;
  682. case '3':
  683. Column.categories.forEach(function(row, index) {
  684. Column.categories[index] = Column.categories[index].substring(5)
  685. if (index % 4 != 0) {
  686. Column.categories[index] = ''
  687. }
  688. })
  689. break;
  690. }
  691. that.showColumn(Column,padding);
  692. }else {
  693. uni.showToast({
  694. title: response.msg,
  695. icon: 'none',
  696. duration: 1000
  697. });
  698. }
  699. })
  700. },
  701. touchIt(e) {
  702. let that = this;
  703. canvaColumn.showToolTip(e, {
  704. format: function (item,category) {
  705. item.color = 'rgba(0,0,0,0)';
  706. if(that.date == 0) {
  707. category = that.today + ' ' + item.data.index + '时 '
  708. }else if(that.date == 1) {
  709. category = that.yesterday + ' ' + item.data.index + '时 '
  710. }else if(that.date == 2 || that.date == 3) {
  711. category = item.data.index
  712. }
  713. if(item.name == '支付金额') {
  714. return category + ' ' + item.name + '¥' + item.data.value + ' '
  715. }else {
  716. return category + ' ' + item.name + ' ' + item.data.value + ' '
  717. }
  718. }
  719. });
  720. },
  721. showColumn(chartData,padding){
  722. let _self = this;
  723. canvaColumn=new uCharts({
  724. $this:_self,
  725. canvasId: 'canvasColumn',
  726. type: 'area',
  727. legend:{
  728. show: false
  729. },
  730. fontSize:9,
  731. background:'#FFFFFF',
  732. colors: ["#446DFD"],
  733. padding: padding,
  734. pixelRatio:this.pixelRatio,
  735. categories: chartData.categories,
  736. series: chartData.series,
  737. xAxis: {
  738. disableGrid:true,
  739. },
  740. yAxis: {
  741. gridType: 'dash',
  742. data: {
  743. disabled: true
  744. }
  745. },
  746. dataLabel: false,
  747. dataPointShape: false,
  748. width: this.cWidth*this.pixelRatio,
  749. height: this.cHeight*this.pixelRatio,
  750. extra: {
  751. area: {
  752. type: 'curve',
  753. addLine: true
  754. },
  755. tooltip:{
  756. bgColor:'#000000',
  757. bgOpacity:0.7,
  758. }
  759. }
  760. });
  761. },
  762. },
  763. onLoad() { this.$commonLoad.onload();
  764. let that = this;
  765. that.$store.dispatch('user/refreshInfo');
  766. that.getDate();
  767. that.date = '0';
  768. //#ifdef MP-ALIPAY
  769. uni.getSystemInfo({
  770. success: function (res) {
  771. if(res.pixelRatio>1){
  772. //正常这里给2就行,如果pixelRatio=3性能会降低一点
  773. //_self.pixelRatio =res.pixelRatio;
  774. that.pixelRatio =2;
  775. }
  776. }
  777. });
  778. //#endif
  779. that.cWidth=uni.upx2px(640);
  780. that.cHeight=uni.upx2px(220);
  781. },
  782. onReady() {
  783. let that = this;
  784. var getAdmin = setInterval(() => {
  785. if(that.userInfo) {
  786. that.$showLoading({
  787. type: 'global',
  788. text: '加载中...'
  789. });
  790. clearInterval(getAdmin);
  791. if(that.userInfo && that.userInfo.identity && that.userInfo.identity.is_admin == 0){
  792. that.$hideLoading();
  793. uni.showModal({
  794. title: '提示',
  795. content: '该帐号无管理员权限',
  796. showCancel: false,
  797. success: function (res) {
  798. uni.redirectTo({
  799. url: '/pages/index/index'
  800. })
  801. }
  802. });
  803. }else {
  804. that.$request({
  805. url: that.$api.app_admin.index,
  806. data: {
  807. date_start: that.today,
  808. date_end: that.today,
  809. sign: 'all'
  810. },
  811. method: 'post'
  812. }).then(response=>{
  813. if(response.code == 0) {
  814. let plugins = [];
  815. that.info = response.data.admin_info;
  816. that.plugins_list = plugins.concat(response.data.plugins_list);
  817. that.new_msg_num = response.data.new_msg_num;
  818. that.all_data = response.data.all_data;
  819. that.is_scan_code_pay = response.data.is_scan_code_pay;
  820. that.getCanvas(that.today);
  821. }else {
  822. uni.showToast({
  823. title: response.msg,
  824. icon: 'none',
  825. duration: 1000
  826. });
  827. }
  828. }).catch(e => {
  829. that.$hideLoading();
  830. uni.showModal({
  831. title: '提示',
  832. content: '该帐号无管理员权限',
  833. showCancel: false,
  834. success: function (res) {
  835. uni.redirectTo({
  836. url: '/pages/index/index'
  837. })
  838. }
  839. });
  840. });
  841. }
  842. }
  843. },500)
  844. }
  845. }
  846. </script>
  847. <style scoped lang="scss">
  848. .icon-goto {
  849. background-image: url("../image/goto.png");
  850. height: #{22rpx};
  851. width: #{22rpx};
  852. background-repeat: no-repeat;
  853. background-size: 100% 100%;
  854. }
  855. .manage-handle {
  856. padding-bottom: 0 !important;
  857. margin: 0 #{24rpx} #{24rpx} !important;
  858. .manage-box {
  859. width: 50%;
  860. padding: #{32rpx} #{60rpx};
  861. .value {
  862. color: #446DFD;
  863. font-size: #{40rpx};
  864. }
  865. .label {
  866. margin-top: #{16rpx};
  867. line-height: 1;
  868. font-size: #{24rpx};
  869. color: #999999;
  870. }
  871. }
  872. }
  873. .quick-handle {
  874. .quick-box {
  875. position: relative;
  876. margin-top: #{32rpx};
  877. width: #{309rpx};
  878. height: #{176rpx};
  879. background: rgba(255, 255, 255, 1);
  880. box-shadow: 0 0 #{16rpx} 0 rgba(0, 0, 0, 0.1);
  881. border-radius: #{16rpx};
  882. padding-top: #{24rpx};
  883. padding-left: #{24rpx};
  884. .num {
  885. color: #353535;
  886. font-size: #{40rpx};
  887. line-height: 1;
  888. }
  889. .label {
  890. font-size: #{24rpx};
  891. color: #999999;
  892. padding-top: #{16rpx};
  893. line-height: 1;
  894. padding-bottom: #{24rpx};
  895. }
  896. .nav-title {
  897. font-size: #{20rpx};
  898. color: #999999;
  899. margin-right: #{8rpx};
  900. }
  901. img {
  902. position: absolute;
  903. bottom: 0;
  904. right: 0;
  905. display: block;
  906. }
  907. }
  908. }
  909. .head {
  910. height: #{300rpx};
  911. width: 100%;
  912. position: relative;
  913. margin-bottom: #{50rpx};
  914. }
  915. .head-bg {
  916. height: 100%;
  917. width: 100%;
  918. position: absolute;
  919. top: 0;
  920. left: 0;
  921. z-index: 1;
  922. }
  923. .mall-scan-code {
  924. position: absolute;
  925. top: #{32rpx};
  926. right: #{56rpx};
  927. z-index: 2;
  928. }
  929. .mall-scan-code image {
  930. height: #{44rpx};
  931. width: #{44rpx};
  932. }
  933. .mall-scan-code view {
  934. padding-top: #{8rpx};
  935. font-size: #{20rpx};
  936. color:#FFFFFF;
  937. }
  938. .mall-img {
  939. height: #{72rpx};
  940. width: #{72rpx};
  941. border-radius: #{36rpx};
  942. border: #{2rpx} solid #fff;
  943. position: absolute;
  944. top: #{24rpx};
  945. left: #{24rpx};
  946. z-index: 2;
  947. }
  948. .mall-name {
  949. color: #fff;
  950. position: absolute;
  951. top: 0;
  952. height: #{132rpx};
  953. line-height: #{132rpx};
  954. left: #{116rpx};
  955. font-size: #{40rpx};
  956. z-index: 2;
  957. width: #{466rpx};
  958. }
  959. .menu {
  960. background-color: #fff;
  961. border-radius: #{10rpx};
  962. height: #{194rpx};
  963. bottom: #{-26rpx};
  964. left: #{24rpx};
  965. right: #{24rpx};
  966. position: absolute;
  967. z-index: 3;
  968. }
  969. .item-icon {
  970. height: #{86rpx};
  971. width: #{86rpx};
  972. margin-bottom: #{10rpx};
  973. }
  974. .menu-item {
  975. padding-top: #{35rpx};
  976. text-align: center;
  977. color: #666666;
  978. font-size: #{24rpx};
  979. position: relative;
  980. }
  981. .red-num {
  982. position: absolute;
  983. top: #{16rpx};
  984. left: 50%;
  985. margin-left: #{12rpx};
  986. height: #{34rpx};
  987. border-radius: #{17rpx};
  988. background-color: #FF4544;
  989. color: #fff;
  990. padding: 0 #{10rpx};
  991. border: #{1rpx} solid #fff;
  992. }
  993. .statics {
  994. background-color: #fff;
  995. margin: 0 #{24rpx} #{24rpx};
  996. padding: #{32rpx};
  997. border-radius: #{10rpx};
  998. }
  999. .sataics.canvas-sataics {
  1000. height: #{484rpx};
  1001. }
  1002. .choose {
  1003. margin-top: #{32rpx};
  1004. height: #{56rpx};
  1005. line-height: #{54rpx};
  1006. border-radius: #{28rpx};
  1007. border: #{1rpx} solid #446DFD;
  1008. margin-bottom: #{12rpx};
  1009. }
  1010. .choose-item {
  1011. text-align: center;
  1012. font-size: #{24rpx};
  1013. color: #666666;
  1014. }
  1015. .choose-item.active {
  1016. background-color: #446DFD;
  1017. color: #fff;
  1018. }
  1019. .left-choose-item {
  1020. border-top-left-radius: #{27rpx};
  1021. border-bottom-left-radius: #{27rpx};
  1022. }
  1023. .right-choose-item {
  1024. border-top-right-radius: #{27rpx};
  1025. border-bottom-right-radius: #{27rpx};
  1026. }
  1027. .title {
  1028. display: inline-block;
  1029. width: auto;
  1030. color: #353535;
  1031. font-size: #{28rpx};
  1032. margin-top: #{-2rpx};
  1033. }
  1034. .order {
  1035. font-size: #{24rpx};
  1036. color: #999999;
  1037. }
  1038. .pay-info {
  1039. margin: #{46rpx} 0;
  1040. width: 100%;
  1041. }
  1042. .pay-order,.pay-price {
  1043. margin-left: #{64rpx};
  1044. color: #999999;
  1045. font-size: #{24rpx};
  1046. }
  1047. .pay-order {
  1048. border-right: #{1rpx} solid #E2E2E2;
  1049. margin-left: #{40rpx};
  1050. }
  1051. .pay-txt {
  1052. font-family: DIN;
  1053. font-size: #{40rpx};
  1054. color: #353535;
  1055. }
  1056. .order-item {
  1057. box-shadow: 0 0 #{16rpx} rgba(0, 0, 0, .1);
  1058. border-radius: #{8rpx};
  1059. padding: #{20rpx} 0 #{20rpx} #{20rpx};
  1060. width: #{182rpx};
  1061. font-size: #{24rpx};
  1062. color: #999999;
  1063. }
  1064. .goto {
  1065. height: #{22rpx};
  1066. width: #{22rpx};
  1067. margin-left: #{8rpx};
  1068. }
  1069. .order-num {
  1070. color: #FF9000;
  1071. font-size: #{36rpx};
  1072. font-family: DIN;
  1073. }
  1074. .box {
  1075. width:100%;
  1076. padding-top: #{80rpx};
  1077. height:#{300rpx};
  1078. }
  1079. .bottom-tab {
  1080. width: 100%;
  1081. height: #{96rpx};
  1082. background-color: #fff;
  1083. font-size: #{20rpx};
  1084. color: #9096ad;
  1085. padding-top: #{14rpx};
  1086. }
  1087. .u-bottom-fixed {
  1088. position: fixed;
  1089. bottom: 0;
  1090. left: 0;
  1091. z-index: 999;
  1092. width: 100%;
  1093. background-color: #ffffff;
  1094. }
  1095. .tab-item {
  1096. text-align: center;
  1097. }
  1098. .tab-icon {
  1099. height: #{48rpx};
  1100. width: #{48rpx};
  1101. display: inline-block;
  1102. }
  1103. .tab-item.active {
  1104. color: #446dfd;
  1105. }
  1106. .tab-item view {
  1107. margin-top: #{-5rpx};
  1108. }
  1109. .more {
  1110. width: #{22rpx};
  1111. height: #{12rpx};
  1112. margin-left: #{12rpx};
  1113. }
  1114. .dialog {
  1115. position: fixed;
  1116. height: 100%;
  1117. width: 100%;
  1118. bottom: #{96rpx};
  1119. left: 0;
  1120. z-index: 10;
  1121. background-color: rgba(0, 0, 0, .3);
  1122. }
  1123. .picker-list {
  1124. background-color: #fff;
  1125. padding-top: #{20rpx};
  1126. position: fixed;
  1127. bottom: #{96rpx};
  1128. left: 0;
  1129. width: 100%;
  1130. }
  1131. .picker-header {
  1132. padding: 0 #{24rpx};
  1133. color: #446dfd;
  1134. font-size: #{32rpx};
  1135. }
  1136. canvas {
  1137. width: 100%;
  1138. height: 100%;
  1139. }
  1140. .u-bottom-height {
  1141. height: 116upx;
  1142. }
  1143. .picker-view {
  1144. line-height: 34px;
  1145. text-align:center;
  1146. font-size: #{32rpx};
  1147. }
  1148. picker-view {
  1149. width: 100%;
  1150. height: #{440rpx};
  1151. }
  1152. </style>