revenueCenter.vue 8.2 KB

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