index.vue 45 KB

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