workbench.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <div class="app-main app-content">
  3. <!-- 用户信息 -->
  4. <div class="user-wrap">
  5. <div class="user-top">
  6. <div class="app-size-28">今日概况</div>
  7. <div @click="pageTo('/admin/setting/password')">
  8. <app-avatar-module :src="avatarImg | default_avatar" :width="80" />
  9. </div>
  10. </div>
  11. <div class="income-amount" @click="pageTo('/admin/assets/list')">
  12. <div>收入金额</div>
  13. <div class="price">{{ $util.numberFormat(data.todayData.income) }}</div>
  14. </div>
  15. <div class="user-bottom">
  16. <div class="info-list">
  17. <div class="info-list-name">浏览量</div>
  18. <div class="info-list-value">{{ $util.numberFormat(data.todayData.visit) || 0 }}</div>
  19. </div>
  20. <div class="info-list">
  21. <div class="info-list-name">新粉丝</div>
  22. <div class="info-list-value">{{ $util.numberFormat(data.todayData.fans) || 0 }}</div>
  23. </div>
  24. <div class="info-list">
  25. <div class="info-list-name">新客户</div>
  26. <div class="info-list-value">{{ $util.numberFormat(data.todayData.user) || 0 }}</div>
  27. </div>
  28. </div>
  29. </div>
  30. <!-- 订单总览 -->
  31. <div class="module-com order-wrap">
  32. <div class="total-blo">
  33. <div
  34. class="total-list"
  35. v-for="(item, index) in orderData"
  36. :key="index"
  37. @click="pageTo(item)"
  38. >
  39. <div class="list-num">{{ item.value }}</div>
  40. <div class="app-color-3">{{ item.name }}</div>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- 消息 -->
  45. <div class="module-com news-wrap">
  46. <div
  47. class="news-list"
  48. v-for="(item, index) in data.notice"
  49. :key="index"
  50. @click="pageToFn(item)"
  51. >
  52. <div class="news-left">
  53. <i class="iconfont iconxiaoxi2"></i>
  54. <span>{{ item.title }}</span>
  55. </div>
  56. <div class="news-right">
  57. <span>{{ item.action }}</span>
  58. <i class="iconfont iconxiangyou"></i>
  59. </div>
  60. </div>
  61. </div>
  62. <!-- 客户按钮 -->
  63. <div class="module-com tabs-wrap">
  64. <div class="tabs-list" v-for="(item, index) in tabsData" :key="index">
  65. <div @click="goToItem(item)">
  66. <div class="tabs-img">
  67. <img :src="item.img" alt mode="widthFix" />
  68. </div>
  69. <div class="tabs-name">{{ item.name }}</div>
  70. </div>
  71. </div>
  72. </div>
  73. <!-- 总览 -->
  74. <div class="module-com total-wrap">
  75. <div class="total-tit">总览</div>
  76. <div class="total-blo">
  77. <div class="total-list" v-for="(item, index) in totalData" :key="index">
  78. <div class="list-num">{{ $util.numberFormat(item.value) }}</div>
  79. <div class="app-color-3">{{ item.name }}</div>
  80. </div>
  81. </div>
  82. </div>
  83. <!-- <fab-module /> -->
  84. <!-- 续费遮罩层 -->
  85. <modal-module :show="renewMask" :custom="true" :maskClosable="true" padding="30rpx 30rpx">
  86. <template>
  87. <div class="renew-wrap">
  88. <div class="renew-wrap-text">你的账号已到期</div>
  89. <button class="admin-button-com middle" @click="renewFn()">立即续费</button>
  90. </div>
  91. </template>
  92. </modal-module>
  93. </div>
  94. </template>
  95. <script>
  96. import { mapGetters, mapState } from "vuex";
  97. import FabModule from "@/components/plugin/fab";
  98. import AppAvatarModule from "@/components/module/app-avatar";
  99. import ModalModule from "@/components/plugin/modal";
  100. import { getDataTimestamp } from "@/utils/common";
  101. // api
  102. import { getUser } from "@/utils/auth";
  103. import { consoleIndex } from "@/api/workbench";
  104. export default {
  105. name: "admin-workbench",
  106. components: {
  107. ModalModule,
  108. FabModule,
  109. AppAvatarModule
  110. },
  111. data() {
  112. return {
  113. constant: this.$constant,
  114. // 遮罩层
  115. renewMask: false,
  116. data: {
  117. admin: {},
  118. asset: {},
  119. notice: {},
  120. todayData: {}
  121. },
  122. // 订单总览
  123. orderData: [
  124. {
  125. name: "待付款",
  126. value: 0,
  127. url: "/admin/home/order",
  128. type: 4,
  129. query: {
  130. tabIndex: 1
  131. }
  132. },
  133. {
  134. name: "待配送",
  135. value: 0,
  136. url: "/admin/home/order",
  137. type: 4,
  138. query: {
  139. tabIndex: 2
  140. }
  141. },
  142. {
  143. name: "配送中",
  144. value: 0,
  145. url: "/admin/home/order",
  146. type: 4,
  147. query: {
  148. tabIndex: 3
  149. }
  150. },
  151. {
  152. name: "待通知",
  153. value: 0
  154. },
  155. {
  156. name: "已完结",
  157. url: "/admin/home/order",
  158. type: 4,
  159. query: {
  160. tabIndex: 4
  161. },
  162. value: 0
  163. },
  164. {
  165. name: "全部",
  166. url: "/admin/home/order",
  167. type: 4,
  168. query: {
  169. tabIndex: 0
  170. },
  171. value: 0
  172. }
  173. ],
  174. // tab按钮
  175. tabsData: [
  176. {
  177. name: "商品",
  178. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-1.png`,
  179. url: "/admin/goodsManage/list"
  180. },
  181. {
  182. name: "老带新",
  183. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-2.png`,
  184. url: "/admin/interest/invite"
  185. },
  186. {
  187. name: "优惠券",
  188. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-3.png`,
  189. url: "/admin/coupon/list"
  190. },
  191. {
  192. name: "广告",
  193. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-4.png`,
  194. url: "/admin/ad/list"
  195. },
  196. {
  197. name: "图库",
  198. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-1.png`,
  199. url: "/admin/goodsManage/img-store"
  200. },
  201. {
  202. name: "数据统计",
  203. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-5.png`,
  204. url: "/admin/statistics/demo"
  205. },
  206. {
  207. name: "员工",
  208. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-6.png`,
  209. url: "/admin/staff/list"
  210. },
  211. {
  212. name: "门店",
  213. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-6.png`,
  214. url: "/admin/shop/list"
  215. },
  216. {
  217. name: "邀请开店",
  218. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-511.png`,
  219. url: "/admin/interest/my-invite"
  220. },
  221. {
  222. name: "进货",
  223. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-7.png`,
  224. url: "/admin/shop/list"
  225. },
  226. {
  227. name: "设置",
  228. img: `${this.$constant.imgUrl}/retail/admin/tab-icon-8.png`,
  229. url: "/admin/setting/list"
  230. }
  231. ],
  232. // 总览
  233. totalData: [
  234. {
  235. name: "会员数",
  236. value: 0
  237. },
  238. {
  239. name: "粉丝数",
  240. value: 0
  241. },
  242. {
  243. name: "客户数",
  244. value: 0
  245. },
  246. {
  247. name: "总收入(元)",
  248. value: 0
  249. },
  250. {
  251. name: "总访问量",
  252. value: 0
  253. },
  254. {
  255. name: "剩余短信",
  256. value: 0
  257. }
  258. ]
  259. };
  260. },
  261. computed: {
  262. ...mapGetters({ userInfo: "getUser" }),
  263. ...mapGetters({ loginInfo: "getLoginInfo" }),
  264. avatarImg() {
  265. return this.$util.isEmpty(this.loginInfo) ? "" : this.loginInfo.avatar;
  266. }
  267. },
  268. onLoad(option) {
  269. },
  270. onPullDownRefresh() {
  271. this.init();
  272. uni.stopPullDownRefresh();
  273. },
  274. onShow() {
  275. this.init();
  276. },
  277. methods: {
  278. init() {
  279. getUser().then(res => {
  280. uni.setNavigationBarTitle({
  281. title: res.merchantName
  282. });
  283. let nowTime = getDataTimestamp(new Date(), true);
  284. if (nowTime > res.setDeadline) {
  285. this.renewMask = true;
  286. }
  287. });
  288. consoleIndex().then(res => {
  289. this.data = res.data;
  290. const { asset } = res.data;
  291. if (!this.$util.isEmpty(asset)) {
  292. // 订单总览
  293. this.orderData[0].value = asset.unPayOrder;
  294. this.orderData[1].value = asset.unSendOrder;
  295. this.orderData[2].value = asset.sendingOrder;
  296. this.orderData[3].value = asset.unNoticeOrder;
  297. this.orderData[4].value = asset.finishOrder;
  298. this.orderData[5].value = asset.totalOrder;
  299. // 总览数据
  300. this.totalData[0].value = asset.totalMember;
  301. this.totalData[1].value = asset.totalFans;
  302. this.totalData[2].value = asset.totalUser;
  303. this.totalData[3].value = asset.totalIncome;
  304. this.totalData[4].value = asset.totalVisit;
  305. this.totalData[5].value = asset.remainSmsNum;
  306. }
  307. });
  308. },
  309. // 跳转
  310. pageToFn(item) {
  311. // #ifdef H5
  312. location.href = item.url;
  313. // #endif
  314. // #ifndef H5
  315. // #endif
  316. },
  317. // 续费
  318. renewFn() {
  319. this.$util.pageTo({
  320. url: "/admin/official/index",
  321. query: {
  322. pay: 1
  323. },
  324. type: 2
  325. });
  326. },
  327. goToItem(item) {
  328. this.$util.pageTo(item);
  329. }
  330. }
  331. };
  332. </script>
  333. <style lang="scss" scoped>
  334. .app-content {
  335. padding-bottom: 10px;
  336. }
  337. // 公共
  338. .module-com {
  339. margin-bottom: 20px;
  340. // padding: 20px;
  341. background-color: #fff;
  342. // box-shadow: 0px 6px 16px #ddd;
  343. // border-radius: 10px;
  344. }
  345. // 用户信息
  346. .user-wrap {
  347. padding: 20px 40px 40px 30px;
  348. color: #fff;
  349. text-align: center;
  350. background-image: url("../../static/images/admin/bg.png");
  351. background-size: 100% 380px;
  352. background-repeat: no-repeat;
  353. .user-top {
  354. // padding-top: 20px;
  355. @include disFlex(center, space-between);
  356. }
  357. .income-amount {
  358. margin-top: 14px;
  359. margin-bottom: 40px;
  360. .price {
  361. font-size: 50px;
  362. font-weight: bold;
  363. margin-top: 4px;
  364. }
  365. }
  366. .user-bottom {
  367. @include disFlex(center, space-around);
  368. // padding-bottom: 40px;
  369. .info-list-name {
  370. color: #bfd4ff;
  371. }
  372. .info-list-value {
  373. font-size: 36px;
  374. font-weight: bold;
  375. margin-top: 4px;
  376. }
  377. }
  378. }
  379. // 消息
  380. .news-wrap {
  381. .news-list {
  382. @include disFlex(center, space-between);
  383. padding: 30px 24px 30px 30px;
  384. border-bottom: 1px solid $borderColor;
  385. font-size: 26px;
  386. color: $fontColor2;
  387. &:active {
  388. background-color: $backColor;
  389. }
  390. & > div {
  391. @include disFlex(center, flex-start);
  392. }
  393. .news-left {
  394. .iconfont {
  395. color: $mainColor;
  396. margin-right: 10px;
  397. }
  398. }
  399. .news-right {
  400. font-size: 24px;
  401. color: $mainColor;
  402. transform: scale(0.9);
  403. @include disFlex(flex-end, flex-start);
  404. .iconfont {
  405. font-size: 24px;
  406. margin-left: 10px;
  407. }
  408. }
  409. }
  410. }
  411. // 总览
  412. .total-wrap,
  413. .order-wrap {
  414. .total-tit {
  415. padding: 18px 0 18px 20px;
  416. border-bottom: 1px solid $borderColor;
  417. font-weight: 600;
  418. }
  419. .total-blo {
  420. @include disFlex(center, space-between);
  421. flex-wrap: wrap;
  422. padding: 30px 0 40px;
  423. .total-list {
  424. width: 33%;
  425. text-align: center;
  426. padding-bottom: 54px;
  427. border-right: 1px solid $borderColor;
  428. .list-num {
  429. margin-bottom: 8px;
  430. font-size: 36px;
  431. font-weight: bold;
  432. }
  433. }
  434. .total-list:nth-child(3n) {
  435. border-right: none;
  436. }
  437. .total-list:nth-child(n + 4) {
  438. padding-bottom: 0;
  439. }
  440. }
  441. }
  442. // tabs
  443. .tabs-wrap {
  444. padding: 40px 10px;
  445. @include disFlex(center, flex-start);
  446. flex-wrap: wrap;
  447. .tabs-list {
  448. width: 25%;
  449. margin-top: 50px;
  450. text-align: center;
  451. .tabs-img {
  452. width: 100px;
  453. height: 100px;
  454. margin: 0 auto;
  455. img {
  456. height: 100%;
  457. }
  458. }
  459. .tabs-name {
  460. color: $fontColor2;
  461. }
  462. &:nth-child(-n + 4) {
  463. margin-top: 0;
  464. }
  465. }
  466. }
  467. // 遮罩层
  468. .renew-wrap {
  469. text-align: center;
  470. .renew-wrap-text {
  471. margin-top: 30px;
  472. margin-bottom: 60px;
  473. font-size: 34px;
  474. }
  475. }
  476. </style>