finance.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <image src="../../static/img/sybg.png" mode="" class="sybg"></image>
  5. <picker mode="date" :value="now_date" @change="bindDateChange" :fields="'date'" :end="now_date">
  6. <view class="uni-input choose-time">{{now_date}} ></view>
  7. </picker>
  8. <view class="top-card">
  9. <view class="card-tit">
  10. <view class="tit-point"></view>
  11. 营业额总览
  12. </view>
  13. <view class="card-icon">
  14. <image src="../../static/icon/moneyget.png" mode=""></image>
  15. </view>
  16. <view class="now-tit">
  17. 本月营业额
  18. </view>
  19. <view class="now-money">
  20. {{month_momey}}
  21. </view>
  22. <view class="card-btm flex">
  23. <view class="card-info flex">
  24. <image src="../../static/icon/dayget.png" mode=""></image>
  25. <view class="info-wrap">
  26. <view class="info-tit">
  27. 今日营业额
  28. </view>
  29. <view class="info-val">
  30. ¥{{today_momey}}
  31. </view>
  32. </view>
  33. </view>
  34. <view class="card-info flex">
  35. <image src="../../static/icon/daydd.png" mode=""></image>
  36. <view class="info-wrap">
  37. <view class="info-tit">
  38. 今日订单
  39. </view>
  40. <view class="info-val dan">
  41. {{today_count }}
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="mid-tit flex">
  49. <view class="mid-left flex">
  50. <image src="../../static/icon/time.png" mode=""></image>
  51. <view class="left-tit">
  52. 本月订单数
  53. </view>
  54. </view>
  55. <view class="mid-right">
  56. {{month_count}}单
  57. </view>
  58. </view>
  59. <view class="btm-tab">
  60. <view class="tab-tit flex">
  61. <view class="tab-top-left tab-content">
  62. 月份
  63. </view>
  64. <view class="tab-top-center tab-content">
  65. 订单数
  66. </view>
  67. <view class="tab-top-right tab-content">
  68. 金额
  69. </view>
  70. </view>
  71. <scroll-view scroll-y="true" class="list-wrapper" :style="{'height':height}">
  72. <!-- 空白页 -->
  73. <empty v-if=" loaded && monthList.length == 0"></empty>
  74. <view v-for="item in monthList" class="flex list" :key="item.time">
  75. <view class="tab-top-left tab-content ">
  76. {{item.time | time}}
  77. </view>
  78. <view class="tab-top-center tab-content">
  79. {{item.frontNumber}}单
  80. </view>
  81. <view class="tab-top-right tab-content money">
  82. ¥{{item.frontPrice}}
  83. </view>
  84. </view>
  85. <uni-load-more :status="loadingType" v-if="loadingType == 'loading'"></uni-load-more>
  86. </scroll-view>
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. import {
  92. getOrderTime,
  93. getOrderData,
  94. getOrderMonth
  95. } from '@/api/wallet.js'
  96. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  97. import empty from '@/components/empty';
  98. export default {
  99. components: {
  100. empty,
  101. uniLoadMore
  102. },
  103. data() {
  104. let start = new Date(new Date().toLocaleDateString()).getTime()
  105. let a = new Date()
  106. let month = a.getMonth() + 1
  107. let date = a.getDate()
  108. let year = a.getFullYear() + ''
  109. if(month < 10) {
  110. month = '0' +month
  111. }else {
  112. month = month + ''
  113. }
  114. if(date < 10) {
  115. date = '0' +date
  116. }else {
  117. date = date + ''
  118. }
  119. return {
  120. height: '',
  121. list: [],
  122. loadingType: 'more',
  123. page: 1,
  124. limit: 10,
  125. monthList: {},
  126. loaded: false,
  127. month_momey: '',//月营业额
  128. today_momey: '',//日营业额
  129. tiday_start: start/1000,//今日零点时间戳
  130. today_count: '',//今日订单数
  131. now_date: year+ '-' + month + '-' +date
  132. }
  133. },
  134. computed: {
  135. month_count() {
  136. if(this.monthList.length > 0) {
  137. return this.monthList[0].frontNumber
  138. }else {
  139. return 0
  140. }
  141. }
  142. },
  143. filters: {
  144. time(val) {
  145. let str = ''
  146. if (val) {
  147. val = val + ''
  148. let str1 = val.slice(0, 4)
  149. let str2 = val.slice(4, )
  150. return str = str1 + '年' + str2 + '月'
  151. }
  152. return str
  153. }
  154. },
  155. onReady(res) {
  156. var _this = this;
  157. uni.getSystemInfo({
  158. success: resu => {
  159. const query = uni.createSelectorQuery();
  160. query.select('.list-wrapper').boundingClientRect();
  161. query.exec(function(res) {
  162. console.log(res, 'ddddddddddddd');
  163. _this.height = resu.windowHeight - res[0].top + 'px';
  164. console.log('打印页面的剩余高度', _this.height);
  165. });
  166. },
  167. fail: res => {}
  168. });
  169. },
  170. onLoad() {
  171. console.log(this.tiday_start,'start')
  172. console.log(this.now_date)
  173. this.getOrderMonth()
  174. this.getMonth()
  175. this.getTaday()
  176. this.getTadayCount()
  177. },
  178. methods: {
  179. // 获取每月数据
  180. getOrderMonth() {
  181. this.loadingType = 'loading'
  182. getOrderMonth().then(({
  183. data
  184. }) => {
  185. this.loadingType = 'noMore'
  186. let arr = []
  187. for (let val in data) {
  188. arr.push({
  189. time: +val.replace(/-/, ''),
  190. frontPrice: data[val].frontPrice,
  191. frontNumber: data[val].frontNumber
  192. })
  193. }
  194. this.monthList = arr.sort(function(a, b) {
  195. return b.time - a.time
  196. })
  197. })
  198. },
  199. // 获取本月营业额
  200. getMonth() {
  201. getOrderTime({
  202. type: 1
  203. }).then(({
  204. data
  205. }) => {
  206. console.log(data, '本月营业额')
  207. this.month_momey = data.time
  208. })
  209. },
  210. // 获取本日营业额
  211. getTaday() {
  212. getOrderTime({
  213. start: this.tiday_start,
  214. type: 1
  215. }).then(({data}) => {
  216. console.log(data, '本日营业额')
  217. this.today_momey = data.time
  218. })
  219. },
  220. //获取本日订单数
  221. getTadayCount() {
  222. getOrderTime({
  223. start: this.tiday_start,
  224. type: 0
  225. }).then(({data}) => {
  226. console.log(data, '本日单数')
  227. this.today_count= data.time
  228. })
  229. },
  230. // 切换月份
  231. bindDateChange(e) {
  232. console.log(e.detail,'dddddddddddd')
  233. this.now_date = e.detail.value
  234. }
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .top {
  240. height: 585rpx;
  241. // background-color: #f6f7f8;
  242. position: relative;
  243. .sybg {
  244. position: absolute;
  245. width: 100%;
  246. height: 265rpx;
  247. }
  248. .top-card {
  249. width: 688rpx;
  250. height: 398rpx;
  251. padding: 32rpx;
  252. background: #FFFFFF;
  253. box-shadow: -2rpx 4rpx 18rpx 0px rgba(0, 110, 238, 0.2);
  254. border-radius: 24rpx;
  255. position: absolute;
  256. right: 0;
  257. left: 0;
  258. bottom: 40rpx;
  259. margin: 0 auto;
  260. .now-tit {
  261. text-align: right;
  262. font-size: 24rpx;
  263. font-family: PingFang SC;
  264. font-weight: 500;
  265. color: #999999;
  266. }
  267. .now-money {
  268. padding-top: 10rpx;
  269. text-align: right;
  270. font-size: 72rpx;
  271. font-family: PingFang SC;
  272. font-weight: bold;
  273. color: #52C696;
  274. &::before {
  275. content: '¥';
  276. font-size: 44rpx;
  277. position: relative;
  278. bottom: 5rpx;
  279. }
  280. }
  281. .card-icon {
  282. position: absolute;
  283. top: 100rpx;
  284. left: 48rpx;
  285. width: 224rpx;
  286. height: 122rpx;
  287. image {
  288. width: 100%;
  289. height: 100%;
  290. }
  291. }
  292. .card-tit {
  293. display: flex;
  294. align-items: center;
  295. .tit-point {
  296. display: inline-block;
  297. width: 12rpx;
  298. height: 32rpx;
  299. background: #52C696;
  300. border-radius: 3rpx;
  301. margin-right: 17rpx;
  302. }
  303. font-size: 32rpx;
  304. font-family: PingFang SC;
  305. font-weight: 500;
  306. color: #333333;
  307. }
  308. .card-btm {
  309. position: absolute;
  310. bottom: 32rpx;
  311. width: 624rpx;
  312. height: 122rpx;
  313. background: linear-gradient(180deg, rgba(220, 184, 118, 0.12) 0%, rgba(220, 184, 118, 0) 100%);
  314. border-radius: 12rpx;
  315. .card-info {
  316. width: 50%;
  317. flex-shrink: 0;
  318. padding-left: 30rpx;
  319. justify-content: flex-start;
  320. align-items: center;
  321. image {
  322. width: 48rpx;
  323. height: 48rpx;
  324. }
  325. .info-wrap {
  326. padding-left: 20rpx;
  327. .info-tit {
  328. font-size: 28rpx;
  329. font-family: PingFang SC;
  330. font-weight: 500;
  331. color: #999999;
  332. }
  333. .info-val {
  334. // padding-top: 15rpx;
  335. font-size: 36rpx;
  336. font-family: PingFang SC;
  337. font-weight: bold;
  338. color: #DCB876;
  339. text-align: center;
  340. }
  341. .dan {
  342. &::after {
  343. content: '单';
  344. font-size: 32rpx;
  345. position: relative;
  346. bottom: 3rpx;
  347. }
  348. }
  349. }
  350. }
  351. }
  352. }
  353. }
  354. .mid-tit {
  355. background-color: #fff;
  356. height: 80rpx;
  357. padding: 0 30rpx 0 33rpx;
  358. justify-content: space-between;
  359. align-items: center;
  360. margin-bottom: 12rpx;
  361. .mid-left {
  362. image {
  363. margin-right: 13rpx;
  364. width: 33rpx;
  365. height: 33rpx;
  366. }
  367. }
  368. }
  369. .btm-tab {
  370. background-color: #fff;
  371. // padding: 0 30rpx 0 35rpx;
  372. .tab-top-left {
  373. text-align: left;
  374. padding-left: 35rpx;
  375. }
  376. .tab-top-center {
  377. text-align: center;
  378. }
  379. .tab-top-right {
  380. text-align: right;
  381. padding-right: 30rpx;
  382. }
  383. .tab-tit {
  384. height: 72rpx;
  385. font-size: 24rpx;
  386. font-family: PingFang SC;
  387. font-weight: 500;
  388. color: #999999;
  389. .tab-content {
  390. width: 33%;
  391. }
  392. }
  393. }
  394. .list-wrapper {
  395. background-color: #fff;
  396. .list {
  397. height: 70rpx;
  398. view {
  399. width: 33.3%;
  400. flex-shrink: 0;
  401. font-size: 28rpx;
  402. font-family: PingFang SC;
  403. font-weight: 500;
  404. color: #333333;
  405. }
  406. .money {
  407. color: #52C696;
  408. }
  409. }
  410. }
  411. .choose-time {
  412. position: absolute;
  413. top: 90rpx;
  414. line-height: 1.5;
  415. padding-left: 32rpx;
  416. font-size: 28rpx;
  417. font-family: PingFang SC;
  418. font-weight: 500;
  419. color: #FFFFFF;
  420. }
  421. </style>