finance.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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="'month'" :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 year = a.getFullYear() + ''
  108. return {
  109. height: '',
  110. list: [],
  111. loadingType: 'more',
  112. page: 1,
  113. limit: 10,
  114. monthList: {},
  115. loaded: false,
  116. month_momey: '',//月营业额
  117. today_momey: '',//日营业额
  118. tiday_start: start/1000,//今日零点时间戳
  119. today_count: '',//今日订单数
  120. now_date: year+ '-' + month
  121. }
  122. },
  123. computed: {
  124. month_count() {
  125. if(this.monthList.length > 0) {
  126. return this.monthList[0].frontNumber
  127. }else {
  128. return 0
  129. }
  130. }
  131. },
  132. filters: {
  133. time(val) {
  134. let str = ''
  135. if (val) {
  136. val = val + ''
  137. let str1 = val.slice(0, 4)
  138. let str2 = val.slice(4, )
  139. return str = str1 + '年' + str2 + '月'
  140. }
  141. return str
  142. }
  143. },
  144. onReady(res) {
  145. var _this = this;
  146. uni.getSystemInfo({
  147. success: resu => {
  148. const query = uni.createSelectorQuery();
  149. query.select('.list-wrapper').boundingClientRect();
  150. query.exec(function(res) {
  151. console.log(res, 'ddddddddddddd');
  152. _this.height = resu.windowHeight - res[0].top + 'px';
  153. console.log('打印页面的剩余高度', _this.height);
  154. });
  155. },
  156. fail: res => {}
  157. });
  158. },
  159. onLoad() {
  160. console.log(this.tiday_start,'start')
  161. this.getOrderMonth()
  162. this.getMonth()
  163. this.getTaday()
  164. this.getTadayCount()
  165. },
  166. methods: {
  167. // 获取每月数据
  168. getOrderMonth() {
  169. this.loadingType = 'loading'
  170. getOrderMonth().then(({
  171. data
  172. }) => {
  173. this.loadingType = 'noMore'
  174. let arr = []
  175. for (let val in data) {
  176. arr.push({
  177. time: +val.replace(/-/, ''),
  178. frontPrice: data[val].frontPrice,
  179. frontNumber: data[val].frontNumber
  180. })
  181. }
  182. this.monthList = arr.sort(function(a, b) {
  183. return b.time - a.time
  184. })
  185. })
  186. },
  187. // 获取本月营业额
  188. getMonth() {
  189. getOrderTime({
  190. type: 1
  191. }).then(({
  192. data
  193. }) => {
  194. console.log(data, '本月营业额')
  195. this.month_momey = data.time
  196. })
  197. },
  198. // 获取本日营业额
  199. getTaday() {
  200. getOrderTime({
  201. start: this.tiday_start,
  202. type: 1
  203. }).then(({data}) => {
  204. console.log(data, '本日营业额')
  205. this.today_momey = data.time
  206. })
  207. },
  208. //获取本日订单数
  209. getTadayCount() {
  210. getOrderTime({
  211. start: this.tiday_start,
  212. type: 0
  213. }).then(({data}) => {
  214. console.log(data, '本日单数')
  215. this.today_count= data.time
  216. })
  217. },
  218. // 切换月份
  219. bindDateChange(e) {
  220. console.log(e.detail,'dddddddddddd')
  221. this.now_date = e.detail.value
  222. }
  223. }
  224. }
  225. </script>
  226. <style lang="scss" scoped>
  227. .top {
  228. height: 585rpx;
  229. // background-color: #f6f7f8;
  230. position: relative;
  231. .sybg {
  232. position: absolute;
  233. width: 100%;
  234. height: 265rpx;
  235. }
  236. .top-card {
  237. width: 688rpx;
  238. height: 398rpx;
  239. padding: 32rpx;
  240. background: #FFFFFF;
  241. box-shadow: -2rpx 4rpx 18rpx 0px rgba(0, 110, 238, 0.2);
  242. border-radius: 24rpx;
  243. position: absolute;
  244. right: 0;
  245. left: 0;
  246. bottom: 40rpx;
  247. margin: 0 auto;
  248. .now-tit {
  249. text-align: right;
  250. font-size: 24rpx;
  251. font-family: PingFang SC;
  252. font-weight: 500;
  253. color: #999999;
  254. }
  255. .now-money {
  256. padding-top: 10rpx;
  257. text-align: right;
  258. font-size: 72rpx;
  259. font-family: PingFang SC;
  260. font-weight: bold;
  261. color: #52C696;
  262. &::before {
  263. content: '¥';
  264. font-size: 44rpx;
  265. position: relative;
  266. bottom: 5rpx;
  267. }
  268. }
  269. .card-icon {
  270. position: absolute;
  271. top: 100rpx;
  272. left: 48rpx;
  273. width: 224rpx;
  274. height: 122rpx;
  275. image {
  276. width: 100%;
  277. height: 100%;
  278. }
  279. }
  280. .card-tit {
  281. display: flex;
  282. align-items: center;
  283. .tit-point {
  284. display: inline-block;
  285. width: 12rpx;
  286. height: 32rpx;
  287. background: #52C696;
  288. border-radius: 3rpx;
  289. margin-right: 17rpx;
  290. }
  291. font-size: 32rpx;
  292. font-family: PingFang SC;
  293. font-weight: 500;
  294. color: #333333;
  295. }
  296. .card-btm {
  297. position: absolute;
  298. bottom: 32rpx;
  299. width: 624rpx;
  300. height: 122rpx;
  301. background: linear-gradient(180deg, rgba(220, 184, 118, 0.12) 0%, rgba(220, 184, 118, 0) 100%);
  302. border-radius: 12rpx;
  303. .card-info {
  304. width: 50%;
  305. flex-shrink: 0;
  306. padding-left: 30rpx;
  307. justify-content: flex-start;
  308. align-items: center;
  309. image {
  310. width: 48rpx;
  311. height: 48rpx;
  312. }
  313. .info-wrap {
  314. padding-left: 20rpx;
  315. .info-tit {
  316. font-size: 28rpx;
  317. font-family: PingFang SC;
  318. font-weight: 500;
  319. color: #999999;
  320. }
  321. .info-val {
  322. // padding-top: 15rpx;
  323. font-size: 36rpx;
  324. font-family: PingFang SC;
  325. font-weight: bold;
  326. color: #DCB876;
  327. text-align: center;
  328. }
  329. .dan {
  330. &::after {
  331. content: '单';
  332. font-size: 32rpx;
  333. position: relative;
  334. bottom: 3rpx;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. }
  341. }
  342. .mid-tit {
  343. background-color: #fff;
  344. height: 80rpx;
  345. padding: 0 30rpx 0 33rpx;
  346. justify-content: space-between;
  347. align-items: center;
  348. margin-bottom: 12rpx;
  349. .mid-left {
  350. image {
  351. margin-right: 13rpx;
  352. width: 33rpx;
  353. height: 33rpx;
  354. }
  355. }
  356. }
  357. .btm-tab {
  358. background-color: #fff;
  359. // padding: 0 30rpx 0 35rpx;
  360. .tab-top-left {
  361. text-align: left;
  362. padding-left: 35rpx;
  363. }
  364. .tab-top-center {
  365. text-align: center;
  366. }
  367. .tab-top-right {
  368. text-align: right;
  369. padding-right: 30rpx;
  370. }
  371. .tab-tit {
  372. height: 72rpx;
  373. font-size: 24rpx;
  374. font-family: PingFang SC;
  375. font-weight: 500;
  376. color: #999999;
  377. .tab-content {
  378. width: 33%;
  379. }
  380. }
  381. }
  382. .list-wrapper {
  383. background-color: #fff;
  384. .list {
  385. height: 70rpx;
  386. view {
  387. width: 33.3%;
  388. flex-shrink: 0;
  389. font-size: 28rpx;
  390. font-family: PingFang SC;
  391. font-weight: 500;
  392. color: #333333;
  393. }
  394. .money {
  395. color: #52C696;
  396. }
  397. }
  398. }
  399. .choose-time {
  400. position: absolute;
  401. top: 90rpx;
  402. line-height: 1.5;
  403. padding-left: 32rpx;
  404. font-size: 28rpx;
  405. font-family: PingFang SC;
  406. font-weight: 500;
  407. color: #FFFFFF;
  408. }
  409. </style>