index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. <template>
  2. <block>
  3. <view class="topBack" :style="'top: ' + menuButton.top + 'px'">
  4. <!-- <text class="ico-moon icon-leftarrow" wx:if="{{pages > 1}}" bindtap="toPage" data-mold="back"></text> -->
  5. <image v-if="pages > 1" @tap="toback"
  6. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/f566738e424f33a415dea22dc4e11eec.png"
  7. class="ico-moon"></image>
  8. <image mode="heightFix" :style="'height: ' + menuButton.height * 2 + 'rpx'" @tap="toPage"
  9. data-url="/pages/index/index" class="h-backBtn" v-else
  10. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/2847/41c5f36528b8f4204130c4977c1ec2c5.png">
  11. </image>
  12. <view class="userName">后台管理</view>
  13. </view>
  14. <view class="tpBg"></view>
  15. <view class="content">
  16. <view class="box">
  17. <view class="totalAllTitle">今日营业额(元)</view>
  18. <view class="total">
  19. <view class="totalNum">{{ info.today }}</view>
  20. </view>
  21. <view class="datas">
  22. <view class="dataItem">
  23. <view>昨日营业额</view>
  24. <view>{{ info.yesterday }}</view>
  25. <!-- <image
  26. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0a57e6af52d6001a69c585478c71f8b6.png"
  27. mode="widthFix" class="iicon"></image> -->
  28. </view>
  29. <view class="dataItem">
  30. <view>当月营业额</view>
  31. <view>{{ info.month }}</view>
  32. </view>
  33. <view class="dataItem">
  34. <view>总营业额</view>
  35. <view>{{ info.total }}</view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="box1">
  40. <view class="iItem" @tap="toPage" :data-url="item.url" v-for="(item, index) in list2" :key="index">
  41. <view class="iLeft">
  42. <image :src="item.icon" mode="widthFix"></image>
  43. <view>{{ item.name }}</view>
  44. </view>
  45. <image
  46. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/9badd173c236af20edc6f800111d24c3.png"
  47. mode="widthFix" class="iRight"></image>
  48. </view>
  49. </view>
  50. <view class="box" style="padding-bottom: 30rpx;">
  51. <view class="shopname">八十一坊1935(元)</view>
  52. <view class="datas" style="padding-top: 30rpx;">
  53. <view class="dataItem">
  54. <view>今日营业额</view>
  55. <view>{{ info2.bsyToday }}</view>
  56. <!-- <image
  57. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0a57e6af52d6001a69c585478c71f8b6.png"
  58. mode="widthFix" class="iicon"></image> -->
  59. </view>
  60. <view class="dataItem">
  61. <view>本月营业额</view>
  62. <view>{{ info2.bsyMonth }}</view>
  63. </view>
  64. <view class="dataItem">
  65. <view>总营业额</view>
  66. <view>{{ info2.bsyTotal }}</view>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="box" style="padding-bottom: 30rpx;">
  71. <view class="shopname">成义酒坊</view>
  72. <view class="datas" style="padding-top: 30rpx;">
  73. <view class="dataItem">
  74. <view>今日营业额</view>
  75. <view>{{ info2.cyToday }}</view>
  76. <!-- <image
  77. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0a57e6af52d6001a69c585478c71f8b6.png"
  78. mode="widthFix" class="iicon"></image> -->
  79. </view>
  80. <view class="dataItem">
  81. <view>本月营业额</view>
  82. <view>{{ info2.cyMonth }}</view>
  83. </view>
  84. <view class="dataItem">
  85. <view>总营业额</view>
  86. <view>{{ info2.cyTotal }}</view>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="timeSelect">
  91. <view class="pickwrap">
  92. <picker class="aaaa" @change="bindPickerChange" :value="index" :range="array">
  93. <view class="uni-input">{{array[index]}}
  94. <view class="arow">
  95. </view>
  96. </view>
  97. </picker>
  98. </view>
  99. <view>
  100. 收入:¥{{income}}
  101. </view>
  102. </view>
  103. <block v-for="(item, index) in list" :key="index">
  104. <view class="orderItem">
  105. <view class="info1">
  106. <view>{{item.have_paid }}</view>
  107. <view>{{item.status}}
  108. </view>
  109. </view>
  110. <view class="orderinfo">
  111. <image :src="item.image">
  112. </image>
  113. <view class="orderdesc">
  114. <view class="desctop">
  115. <view>{{item.title}}</view>
  116. <!-- <view>+{{item.score}}积分</view> -->
  117. </view>
  118. <view class="descbot">
  119. <view>购买人:{{item.buyer||''}}</view>
  120. <view>实付:¥{{item.total_price}}</view>
  121. </view>
  122. </view>
  123. </view>
  124. <block v-for="(item2,index2) in item.share" :key="index2">
  125. <view class="ordertip" v-if="item2.lv !=-1">
  126. <view>{{item2.lv}}级分销:{{item2.username}} </view>
  127. <view>+{{item2.num}}</view>
  128. </view>
  129. </block>
  130. </view>
  131. </block>
  132. <view v-if="!list.length" style='color:#999;text-align:center;margin:100rpx 0;'>暂无数据</view>
  133. </view>
  134. </block>
  135. </template>
  136. <script module="parse" lang="wxs">
  137. module.exports = {
  138. filterTime: function(time) {
  139. console.log(time)
  140. var nowDate = getDate(time * 1000);
  141. var year = nowDate.getFullYear();
  142. var month = nowDate.getMonth() + 1;
  143. var date = nowDate.getDate();
  144. var hours = nowDate.getHours();
  145. var minutes = nowDate.getMinutes();
  146. var seconds = nowDate.getSeconds();
  147. month = month > 9 ? month : '0' + month;
  148. date = date > 9 ? date : '0' + date;
  149. hours = hours > 9 ? hours : '0' + hours;
  150. minutes = minutes > 9 ? minutes : '0' + minutes;
  151. seconds = seconds > 9 ? seconds : '0' + seconds;
  152. return year + '-' + month + '-' + date + " " + hours + ":" + minutes + ":" + seconds;
  153. }
  154. }
  155. </script>
  156. <script>
  157. // pages/backstage/index/index.js
  158. var app = getApp();
  159. export default {
  160. data() {
  161. return {
  162. list2: [{
  163. name: '团队管理',
  164. icon: 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/612dcfbf599a0be79cab31e7e9ceb651.png',
  165. url: '/pages/term/manage'
  166. },
  167. ],
  168. info: {
  169. },
  170. info2: {
  171. },
  172. pages: '',
  173. menuButton: {
  174. top: '',
  175. height: 0
  176. },
  177. Page: 0,
  178. index: 0,
  179. array: ['2022年1月', '2022年2月', '2022年3月', '2022年4月', '2022年5月', '2022年6月', '2022年7月', '2022年8月', '2022年9月',
  180. '2022年10月', '2022年11月', '2022年12月'
  181. ],
  182. array2: ['2022-01', '2022-02', '2022-03', '2022-04', '2022-05', '2022-06', '2022-07', '2022-08', '2022-09',
  183. '2022-10', '2022-11', '2022-12',
  184. ],
  185. page: 1,
  186. pageSize: 10,
  187. list: [],
  188. loaded: false,
  189. income:0
  190. };
  191. }
  192. /**
  193. * 生命周期函数--监听页面加载
  194. */
  195. ,
  196. onLoad: function(options) {
  197. let page = getCurrentPages();
  198. var menuButton = uni.getMenuButtonBoundingClientRect();
  199. console.log(menuButton);
  200. this.pages = page.length;
  201. this.menuButton = menuButton;
  202. var nowdate = new Date();
  203. var mounth = nowdate.getMonth();
  204. console.log(mounth)
  205. this.index = mounth
  206. this.getinfo(); //获取统计营业额
  207. this.getinfo1();//获取指定类型营业额
  208. this.getlist(); //获取订单列表
  209. },
  210. /**
  211. * 生命周期函数--监听页面初次渲染完成
  212. */
  213. onReady: function() {},
  214. /**
  215. * 生命周期函数--监听页面显示
  216. */
  217. onShow: function() {},
  218. /**
  219. * 生命周期函数--监听页面隐藏
  220. */
  221. onHide: function() {},
  222. /**
  223. * 生命周期函数--监听页面卸载
  224. */
  225. onUnload: function() {},
  226. /**
  227. * 页面相关事件处理函数--监听用户下拉动作
  228. */
  229. onPullDownRefresh: function() {
  230. this.init();
  231. this.getlist();
  232. uni.stopPullDownRefresh();
  233. },
  234. /**
  235. * 页面上拉触底事件的处理函数
  236. */
  237. onReachBottom: function() {
  238. this.loaded || this.getlist();
  239. },
  240. /**
  241. * 用户点击右上角分享
  242. */
  243. onShareAppMessage: function() {},
  244. methods: {
  245. bindPickerChange: function(e) {
  246. console.log('picker发送选择改变,携带值为', e.detail.value)
  247. this.index = e.detail.value
  248. },
  249. async getinfo() {
  250. let data = await this.$api.request('/stats/getByDateStats');
  251. console.log(data)
  252. this.info = data;
  253. },
  254. async getinfo1() {
  255. let data = await this.$api.request('/stats/getByTypeStats');
  256. console.log(data)
  257. this.info2 = data;
  258. },
  259. async getlist() {
  260. var that = this;
  261. let res = await this.$api.request('/stats/getByDateOrder', 'GET', {
  262. page: this.page,
  263. count: this.pageSize,
  264. date:this.array2[this.index]
  265. });
  266. console.log(res)
  267. if (res) {
  268. this.income = res.income
  269. if (res.rows.length > 0) {
  270. this.list = this.list.concat(res.rows);
  271. this.page++;
  272. } else {
  273. this.loaded = true
  274. this.$api.msg('没有更多数据');
  275. }
  276. }
  277. },
  278. init() {
  279. this.page = 1
  280. this.loaded = false
  281. this.list = []
  282. },
  283. toPage(e) {
  284. app.globalData.toPage(e);
  285. },
  286. toback() {
  287. uni.navigateBack({
  288. delta: 1
  289. });
  290. },
  291. }
  292. };
  293. </script>
  294. <style>
  295. page {
  296. background: #F4F5F9;
  297. }
  298. .topBack {
  299. position: absolute;
  300. top: 0;
  301. left: 0;
  302. z-index: 1;
  303. margin-top: 2rpx;
  304. display: flex;
  305. align-items: center;
  306. }
  307. .topBack .ico-moon {
  308. padding: 0 0rpx 0 30rpx;
  309. width: 70rpx;
  310. height: 40rpx;
  311. }
  312. .h-backBtn {
  313. margin-left: 30rpx;
  314. }
  315. .homeImg {
  316. height: 40rpx;
  317. width: 40rpx;
  318. margin-right: 10rpx;
  319. }
  320. .userName {
  321. font-size: 28rpx;
  322. color: #fff;
  323. margin-left: 20rpx;
  324. font-size: 36rpx;
  325. }
  326. .tpBg {
  327. background: #FE5879;
  328. background-size: 100% 100%;
  329. width: 100%;
  330. height: 380rpx;
  331. }
  332. .content {
  333. margin: -180rpx 30rpx 25rpx;
  334. }
  335. .box {
  336. border-radius: 12rpx;
  337. background: #fff;
  338. padding: 50rpx 20rpx 40rpx;
  339. margin-bottom: 25rpx;
  340. }
  341. .totalAllTitle {
  342. color: #9194A6;
  343. margin-bottom: 28rpx;
  344. text-align: center;
  345. }
  346. .total {
  347. display: flex;
  348. align-items: center;
  349. justify-content: center;
  350. padding-bottom: 20rpx;
  351. }
  352. .totalNum {
  353. font-size: 50rpx;
  354. }
  355. .totalJump {
  356. display: flex;
  357. align-items: center;
  358. width: 220rpx;
  359. height: 70rpx;
  360. justify-content: center;
  361. background: #FB4C6F;
  362. border-radius: 12rpx;
  363. border-radius: 12rpx;
  364. }
  365. .totalJump>view {
  366. font-size: 28rpx;
  367. color: #fff;
  368. }
  369. .totalJump>image {
  370. width: 14rpx;
  371. margin-left: 14rpx;
  372. margin-top: 5rpx;
  373. }
  374. .tip {
  375. font-size: 30rpx;
  376. padding-bottom: 10rpx;
  377. }
  378. .iItem {
  379. display: flex;
  380. align-items: center;
  381. justify-content: space-between;
  382. padding: 32rpx 0;
  383. border-bottom: 1px solid #E4E5EE;
  384. }
  385. .iItem:last-child {
  386. border-bottom: none;
  387. padding-bottom: 0;
  388. }
  389. .iLeft {
  390. display: flex;
  391. align-items: center;
  392. }
  393. .iLeft>image {
  394. width: 40rpx;
  395. }
  396. .iLeft>view {
  397. font-size: 28rpx;
  398. margin-left: 32rpx;
  399. }
  400. .iRight {
  401. width: 12rpx;
  402. }
  403. .datas {
  404. padding-top: 50rpx;
  405. display: flex;
  406. align-items: center;
  407. justify-content: space-between;
  408. padding-bottom: 16rpx;
  409. }
  410. .dataItem {
  411. display: flex;
  412. flex-direction: column;
  413. align-items: center;
  414. position: relative;
  415. }
  416. .dataItem>view:nth-child(1) {
  417. color: #9194A6;
  418. }
  419. .dataItem>view:nth-child(2) {
  420. margin-top: 15rpx;
  421. font-size: 30rpx;
  422. }
  423. .iicon {
  424. width: 28rpx;
  425. position: absolute;
  426. top: 4rpx;
  427. right: -38rpx;
  428. }
  429. .btns {
  430. display: flex;
  431. align-items: center;
  432. justify-content: space-around;
  433. }
  434. .btn1 {
  435. background: #fff;
  436. border: 1px solid #9194A6;
  437. color: #011B33 !important;
  438. }
  439. .btn1>view {
  440. color: #011B33 !important;
  441. }
  442. .box1 {
  443. border-radius: 12rpx;
  444. background: #fff;
  445. padding: 50rpx;
  446. margin-bottom: 25rpx;
  447. padding-top: 0;
  448. }
  449. .iItem {
  450. display: flex;
  451. align-items: center;
  452. justify-content: space-between;
  453. padding: 32rpx 0;
  454. border-bottom: 1px solid #e4e5ee;
  455. }
  456. .iItem:last-child {
  457. border-bottom: none;
  458. padding-bottom: 0;
  459. }
  460. .iLeft {
  461. display: flex;
  462. align-items: center;
  463. }
  464. .iLeft>image {
  465. width: 40rpx;
  466. }
  467. .iLeft>view {
  468. font-size: 28rpx;
  469. margin-left: 32rpx;
  470. }
  471. .iRight {
  472. width: 12rpx;
  473. }
  474. view {
  475. font-size: 24rpx;
  476. }
  477. .rWrap {
  478. display: flex;
  479. align-items: center;
  480. }
  481. .intergal {
  482. color: #000000;
  483. font-size: 30rpx;
  484. margin-right: 12rpx;
  485. }
  486. .shopname {
  487. color: #010101;
  488. font-size: 28rpx;
  489. }
  490. .timeSelect {
  491. display: flex;
  492. justify-content: space-between;
  493. align-items: center;
  494. margin-bottom: 20rpx;
  495. margin-top: 40rpx;
  496. }
  497. .aaaa {
  498. display: flex;
  499. align-items: center;
  500. }
  501. .uni-input {
  502. font-size: 30rpx;
  503. color: #000000;
  504. }
  505. .arow {
  506. margin-left: 10rpx;
  507. transform: rotate(90deg);
  508. display: inline-block;
  509. color: #000000;
  510. font-size: 30rpx;
  511. }
  512. .timeSelect>view:nth-child(2) {
  513. color: #8E8E8E;
  514. font-size: 26rpx;
  515. }
  516. .orderItem {
  517. background: #fff;
  518. padding: 30rpx 20rpx;
  519. box-sizing: border-box;
  520. border-radius: 12rpx;
  521. margin-bottom: 24rpx;
  522. }
  523. .info1 {
  524. display: flex;
  525. align-items: center;
  526. justify-content: space-between;
  527. margin-bottom: 12rpx;
  528. }
  529. .info1>view:nth-child(1) {
  530. font-size: 24rpx;
  531. color: #8E8E8E;
  532. }
  533. .info1>view:nth-child(2) {
  534. font-size: 24rpx;
  535. color: #7B9D3E;
  536. }
  537. .orderinfo {
  538. display: flex;
  539. align-items: center;
  540. padding-bottom: 36rpx;
  541. border-bottom: 1px solid #F0EDF1;
  542. }
  543. .orderinfo1 {
  544. display: flex;
  545. align-items: center;
  546. margin-top: 20rpx;
  547. }
  548. .orderinfo1>image {
  549. width: 100rpx;
  550. height: 100rpx;
  551. }
  552. .orderinfo>image {
  553. width: 100rpx;
  554. height: 100rpx;
  555. }
  556. .orderdesc {
  557. margin-left: 15rpx;
  558. flex: 1;
  559. }
  560. .desctop {
  561. display: flex;
  562. align-items: center;
  563. justify-content: space-between;
  564. margin-bottom: 10rpx;
  565. }
  566. .desctop>view:nth-child(1) {
  567. color: #010101;
  568. font-size: 28rpx;
  569. width: 280rpx;
  570. overflow: hidden;
  571. text-overflow: ellipsis;
  572. white-space: nowrap;
  573. }
  574. .desctop>view:nth-child(2) {
  575. font-size: 26rpx;
  576. font-weight: 700;
  577. color: #FB4C6F;
  578. }
  579. .descbot {
  580. display: flex;
  581. align-items: center;
  582. justify-content: space-between;
  583. }
  584. .descbot>view:nth-child(1) {
  585. color: #8E8E8E;
  586. font-size: 28rpx;
  587. width: 302rpx;
  588. overflow: hidden;
  589. text-overflow: ellipsis;
  590. white-space: nowrap;
  591. }
  592. .descbot>view:nth-child(2) {
  593. color: #8E8E8E;
  594. font-size: 24rpx;
  595. }
  596. .ordertip {
  597. margin: 20rpx 0 0;
  598. padding-left: 136rpx;
  599. box-sizing: border-box;
  600. display: flex;
  601. align-items: center;
  602. justify-content: space-between;
  603. }
  604. .ordertip>view:nth-child(1) {
  605. font-size: 24rpx;
  606. color: #8E8E8E;
  607. width: 350rpx;
  608. overflow: hidden;
  609. text-overflow: ellipsis;
  610. white-space: nowrap;
  611. }
  612. .ordertip>view:nth-child(2) {
  613. font-size: 26rpx;
  614. font-weight: 700;
  615. color: #FB4C6F;
  616. }
  617. </style>