index.vue 39 KB

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