business.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <view>
  3. <scroll-view scroll-y class="business-page">
  4. <template v-if="!$util.isEmpty(baseInfo)">
  5. <view class="business-info">
  6. <view class="amount-view">
  7. <text class="amount-label">账户余额</text>
  8. </view>
  9. <view class="price-view">
  10. <text class="unit">¥</text>
  11. <text class="price">{{ baseInfo.balance || "--" }}</text>
  12. </view>
  13. <view class="down-view">
  14. <view class="down-item">
  15. <text class="label">应收客户款</text>
  16. <text class="value"
  17. ><text class="unit">¥</text>{{ baseInfo.mayGathering || "--" }}</text
  18. >
  19. </view>
  20. <view class="down-item">
  21. <text class="label">应付供货商款</text>
  22. <text class="value"
  23. ><text class="unit">¥</text>{{ baseInfo.mayPay || "--" }}</text
  24. >
  25. </view>
  26. </view>
  27. </view>
  28. <view class="space-view space-layout">
  29. <view class="space-left">
  30. <view class="title-bar">
  31. <image
  32. class="title-icon"
  33. :src="`${constant.imgUrl}/common/inventory.png`"
  34. >
  35. </image>
  36. <text class="title">
  37. 库存成本 ¥ {{baseInfo.stockCost}}
  38. </text>
  39. </view>
  40. </view>
  41. <view class="space-right"> </view>
  42. </view>
  43. <view class="space-view space-remark">
  44. <view class="space-left">
  45. <view class="show-item">
  46. <view class="show-name">库存总数(大约)</view>
  47. <view class="show-value">{{baseInfo.stockBigNum}}扎 {{baseInfo.stockSmallNum}}支</view>
  48. </view>
  49. </view>
  50. <view class="space-right">
  51. <view class="show-item">
  52. <view class="show-name">库存预警数</view>
  53. <view class="show-value red">{{baseInfo.stockWarning}}</view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="space-view space-layout">
  58. <view class="space-left">
  59. <view class="title-bar">
  60. <image
  61. class="title-icon"
  62. :src="`${constant.imgUrl}/common/icon_market.png`"
  63. >
  64. </image>
  65. <text class="title">
  66. 今日收入 ¥ {{baseInfo.today}}
  67. </text>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="space-view space-remark">
  72. <view class="space-left">
  73. <view class="show-item">
  74. <view class="show-name">近7天收入</view>
  75. <view class="show-value"><text class="unit">¥</text>{{baseInfo.latestSeven}}</view>
  76. </view>
  77. </view>
  78. <view class="space-right">
  79. <view class="show-item">
  80. <view class="show-name">
  81. 近30天收入
  82. </view>
  83. <view class="show-value red"><text class="unit">¥</text>{{baseInfo.latestThirty}}</view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="space-view space-layout business-list">
  88. <view class="list-tab">
  89. <view
  90. @click="changeDate(index)"
  91. :class="['tab-item', { active: curTabIndex == index }]"
  92. v-for="(item, index) in tabList"
  93. :key="index"
  94. >
  95. {{ item.label }}
  96. </view>
  97. </view>
  98. <view class="list-main">
  99. <view v-for="(item, index) in bussinessList" :key="index">
  100. <template v-if="index == curTabIndex">
  101. <view class="list-item" >
  102. <view class="item-left">
  103. <view class="content-row">
  104. <text class="content-label"> 收入金额</text>
  105. <text class="content-value"> <text class="unit">¥</text> {{item.saleAmount}}</text>
  106. </view>
  107. </view>
  108. <view class="item-right">
  109. <!-- <text class="iconfont iconxiangyou"> </text> -->
  110. </view>
  111. </view>
  112. <view class="list-item" >
  113. <view class="item-left">
  114. <view class="content-row">
  115. <text class="content-label"> 采购数量</text>
  116. <text class="content-value"> <text class="unit"></text> {{item.purchaseNum}}</text>
  117. </view>
  118. <view class="content-row">
  119. <text class="content-label"> 采购金额</text>
  120. <text class="content-value"> <text class="unit">¥</text> {{item.purchaseAmount}}</text>
  121. </view>
  122. </view>
  123. <view class="item-right">
  124. <!-- <text class="iconfont iconxiangyou"> </text> -->
  125. </view>
  126. </view>
  127. </template>
  128. </view>
  129. </view>
  130. </view>
  131. </template>
  132. </scroll-view>
  133. </view>
  134. </template>
  135. <script>
  136. import {getMainProfile} from '@/api/stat'
  137. import {mapGetters} from "vuex";
  138. export default {
  139. name:'Business',
  140. components:{
  141. },
  142. mixins:[],
  143. computed:{
  144. ...mapGetters(["getMyShopInfo"]),
  145. },
  146. data() {
  147. return {
  148. curTabIndex: 0,
  149. tabList: [
  150. {
  151. label: "今日",
  152. value: "01"
  153. },
  154. {
  155. label: "昨日",
  156. value: "02"
  157. },
  158. {
  159. label: "近7天",
  160. value: "03"
  161. },
  162. {
  163. label: "近30天",
  164. value: "04"
  165. }
  166. ],
  167. bussinessList: [{}, {}],
  168. baseInfo:{},
  169. };
  170. },
  171. onPullDownRefresh() {
  172. this.init().then(res => {
  173. uni.stopPullDownRefresh();
  174. })
  175. },
  176. methods:{
  177. async init(id){
  178. this.shopId = id?id:this.getMyShopInfo.id
  179. uni.showLoading({
  180. title: '加载中'
  181. });
  182. try {
  183. let {data:{base,more}} = await getMainProfile({
  184. shopId: this.shopId
  185. })
  186. this.baseInfo = base
  187. this.bussinessList = [more.today,more.yesterday,more.latestSeven,more.latestThirty]
  188. } finally {
  189. uni.hideLoading();
  190. }
  191. },
  192. changeDate(idx){
  193. this.curTabIndex = idx;
  194. },
  195. selectSussess(val){
  196. this.shopId = val.selectItem.id;
  197. this.init(val.selectItem.id);
  198. }
  199. },
  200. };
  201. </script>
  202. <style lang="scss" scoped>
  203. .business-page {
  204. width: 100%;
  205. height: 100%;
  206. background-color: #f9fbfc;
  207. .space-layout {
  208. margin-top: 20upx;
  209. }
  210. .space-remark {
  211. margin-top: 1upx;
  212. }
  213. .space-view {
  214. display: flex;
  215. padding: 30upx;
  216. background-color: #fff;
  217. .space-left {
  218. flex: 1.5;
  219. .title-bar {
  220. display: flex;
  221. align-items: center;
  222. .title-icon {
  223. margin-right: 20upx;
  224. width: 36upx;
  225. height: 36upx;
  226. // background-color: pink;
  227. }
  228. .title {
  229. font-size: 28upx;
  230. font-weight: 600;
  231. color: #333333;
  232. }
  233. }
  234. }
  235. .space-right {
  236. flex: 1;
  237. }
  238. .show-item {
  239. .show-name {
  240. display: flex;
  241. align-items: center;
  242. font-size: 24upx;
  243. font-weight: 400;
  244. .iconfont {
  245. margin-left: 10upx;
  246. color: $mainColor;
  247. font-size: 30upx;
  248. }
  249. }
  250. .show-value {
  251. margin-top: 20upx;
  252. color: #999999;
  253. font-size: 36upx;
  254. font-weight: bold;
  255. .unit {
  256. margin-right: 5upx;
  257. font-size: 24upx;
  258. }
  259. &.red {
  260. color: $redColor;
  261. }
  262. }
  263. }
  264. .show-tag {
  265. margin-top: 10upx;
  266. display: flex;
  267. align-items: center;
  268. &.up {
  269. color: $redColor;
  270. .tag {
  271. background-color: $redColor;
  272. }
  273. }
  274. &.down {
  275. color: $mainColor1;
  276. .tag {
  277. background-color: $mainColor1;
  278. }
  279. .arrow {
  280. transform: rotate(180deg);
  281. }
  282. }
  283. .tag {
  284. margin-right: 10upx;
  285. display: flex;
  286. justify-content: center;
  287. align-items: center;
  288. width: 80upx;
  289. height: 30upx;
  290. color: #fff;
  291. border-radius: 4upx;
  292. font-size: 22upx;
  293. }
  294. .arrow {
  295. margin-left: 10upx;
  296. width: 13upx;
  297. height: 19upx;
  298. }
  299. }
  300. }
  301. .business-list {
  302. display: flex;
  303. flex-direction: column;
  304. padding: 30upx;
  305. width: 100%;
  306. .list-tab {
  307. width: 100%;
  308. display: flex;
  309. align-items: center;
  310. border-radius: 8upx;
  311. overflow: hidden;
  312. border: 1upx solid $mainColor;
  313. .tab-item {
  314. flex: 1;
  315. display: flex;
  316. justify-content: center;
  317. align-items: center;
  318. height: 60upx;
  319. background: #ffffff;
  320. color: $mainColor;
  321. &:not(:last-child) {
  322. border-right: 1upx solid $mainColor;
  323. }
  324. &.active {
  325. color: #fff;
  326. background-color: $mainColor;
  327. }
  328. }
  329. }
  330. .list-main {
  331. margin-top: 20upx;
  332. width: 100%;
  333. .list-item {
  334. &:not(:last-child) {
  335. border-bottom: 1upx solid #eee;
  336. }
  337. padding: 30upx 0;
  338. width: 100%;
  339. display: flex;
  340. align-items: center;
  341. .item-left {
  342. flex: 1;
  343. .content-row {
  344. .content-label {
  345. font-size: 28upx;
  346. font-weight: 400;
  347. color: #666;
  348. }
  349. .content-value {
  350. margin-left: 20upx;
  351. font-size: 28upx;
  352. font-weight: 400;
  353. color: #333333;
  354. .unit {
  355. font-size: 24upx;
  356. }
  357. }
  358. }
  359. }
  360. .item-right {
  361. flex-shrink: 0;
  362. .iconfont {
  363. font-size: 28upx;
  364. color: #bbbbbb;
  365. }
  366. }
  367. }
  368. }
  369. }
  370. .business-info {
  371. display: flex;
  372. flex-direction: column;
  373. justify-content: center;
  374. width: 100%;
  375. height: 300upx;
  376. padding: 30upx;
  377. // background: linear-gradient(30deg, #3ab7ff, #38a6ff, #3386ff);
  378. background: url(../static/images/admin/bg2.png) no-repeat;
  379. background-size: 100% 100%;
  380. color: #fff;
  381. .amount-view {
  382. display: flex;
  383. justify-content: space-between;
  384. align-items: center;
  385. .amount-btn {
  386. border: 1upx solid #ffffff;
  387. border-radius: 22upx;
  388. text-align: center;
  389. display: flex;
  390. align-items: center;
  391. justify-content: center;
  392. padding: 0upx 17upx;
  393. //width: 165upx;
  394. height: 44upx;
  395. & ::v-deep .select-title {
  396. color: #FFFFFF;
  397. }
  398. // font-size: 24upx;
  399. // font-family: PingFang SC;
  400. // font-weight: 400;
  401. // color: #ffffff;
  402. // // margin: 0 10upx;
  403. // position: relative;
  404. // .iconfont {
  405. // margin-left: 20upx;
  406. // font-size: 25upx;
  407. // padding-right: 10upx;
  408. // }
  409. }
  410. }
  411. .price-view {
  412. margin-top: 10upx;
  413. .unit {
  414. font-size: 24upx;
  415. font-family: DIN Alternate;
  416. font-weight: bold;
  417. }
  418. .price {
  419. font-size: 60upx;
  420. font-family: DIN Alternate;
  421. font-weight: bold;
  422. }
  423. }
  424. .down-view {
  425. display: flex;
  426. margin-top: 30upx;
  427. .down-item {
  428. position: relative;
  429. flex: 1;
  430. display: flex;
  431. flex-direction: column;
  432. &:nth-child(2) {
  433. padding-left: 60upx;
  434. &:after {
  435. position: absolute;
  436. left: 0;
  437. top: 50%;
  438. transform: translateY(-50%);
  439. content: "";
  440. width: 1upx;
  441. height: 70upx;
  442. background-color: #dddddd;
  443. }
  444. }
  445. .label {
  446. font-size: 24upx;
  447. font-weight: 400;
  448. }
  449. .value {
  450. margin-top: 20upx;
  451. font-size: 32upx;
  452. font-family: DIN Alternate;
  453. font-weight: bold;
  454. .unit {
  455. font-size: 24upx;
  456. }
  457. }
  458. }
  459. }
  460. }
  461. }
  462. </style>