workbench.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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>
  8. <div class="income-amount">
  9. <div>收入金额</div>
  10. <div class="price">{{ $util.numberFormat(data.todayData.income) }}</div>
  11. </div>
  12. <div class="user-bottom">
  13. <div class="info-list">
  14. <div class="info-list-name">开单</div>
  15. <div class="info-list-value">
  16. {{ $util.numberFormat(data.todayData.order) || 0 }}
  17. </div>
  18. </div>
  19. <div class="info-list">
  20. <div class="info-list-name">新客</div>
  21. <div class="info-list-value">
  22. {{ $util.numberFormat(data.todayData.custom) || 0 }}
  23. </div>
  24. </div>
  25. <div class="info-list">
  26. <div class="info-list-name">支出</div>
  27. <div class="info-list-value">
  28. {{ $util.numberFormat(data.todayData.expend) || 0 }}
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <!-- 订单总览 -->
  34. <div class="module-com order-wrap">
  35. <div class="total-blo">
  36. <div
  37. class="total-list"
  38. v-for="(item, index) in orderData"
  39. :key="index"
  40. @click="pageTo(item)"
  41. >
  42. <div class="list-num">{{ item.value }}</div>
  43. <div class="app-color-3">{{ item.name }}</div>
  44. </div>
  45. </div>
  46. </div>
  47. <!-- 消息 -->
  48. <div class="module-com news-wrap">
  49. <div
  50. class="news-list"
  51. v-for="(item, index) in data.notice"
  52. :key="index"
  53. @click="pageToFn(item)"
  54. >
  55. <div class="news-left">
  56. <i class="iconfont iconxiaoxi2"></i>
  57. <span>{{ item.title }}</span>
  58. </div>
  59. <div class="news-right">
  60. <span>立即授权绑定</span>
  61. <i class="iconfont iconxiangyou"></i>
  62. </div>
  63. </div>
  64. </div>
  65. <!-- 客户按钮 -->
  66. <view class="module-com">
  67. <view class="tabs-head_bx">
  68. <image
  69. @click="pageTo({ url: '/admin/billing/index' })"
  70. :src="kdSrc"
  71. mode="widthFix"
  72. ></image>
  73. </view>
  74. <div class="tabs-wrap">
  75. <div class="tabs-list" v-for="(item, index) in tabsData" :key="index">
  76. <div @click="goPage(item)">
  77. <div class="tabs-img">
  78. <img :src="item.img" alt mode="widthFix" />
  79. </div>
  80. <div class="tabs-name">{{ item.name }}</div>
  81. </div>
  82. </div>
  83. </div>
  84. </view>
  85. <!-- 总览 -->
  86. <div class="module-com total-wrap">
  87. <div class="total-tit">总览</div>
  88. <div class="total-blo">
  89. <div class="total-list" v-for="(item, index) in totalData" :key="index">
  90. <div class="list-num">{{ $util.numberFormat(item.value) }}</div>
  91. <div class="app-color-3">{{ item.name }}</div>
  92. </div>
  93. </div>
  94. </div>
  95. <!-- <fab-module /> -->
  96. <!-- 续费遮罩层 -->
  97. <modal-module
  98. :show="renewMask"
  99. :custom="true"
  100. :maskClosable="true"
  101. padding="30rpx 30rpx"
  102. >
  103. <template>
  104. <div class="renew-wrap">
  105. <div class="renew-wrap-text">你的账号已到期</div>
  106. <button class="admin-button-com middle" @click="renewFn()">
  107. 立即续费
  108. </button>
  109. </div>
  110. </template>
  111. </modal-module>
  112. </div>
  113. </template>
  114. <script>
  115. import { mapGetters, mapState } from "vuex";
  116. import FabModule from "@/components/plugin/fab";
  117. import AppAvatarModule from "@/components/module/app-avatar";
  118. import ModalModule from "@/components/plugin/modal";
  119. import { getDataTimestamp } from "@/utils/common";
  120. import { getWeixinId } from "@/api/invite/index";
  121. import { getUser } from "@/utils/auth";
  122. import { consoleIndex } from "@/api/workbench";
  123. // import priceSocket from "@/mixins/priceSocket";
  124. export default {
  125. name: "admin-workbench",
  126. components: {
  127. ModalModule,
  128. FabModule,
  129. AppAvatarModule
  130. },
  131. // mixins:[priceSocket],
  132. data() {
  133. return {
  134. constant: this.$constant,
  135. // 遮罩层
  136. renewMask: false,
  137. getappIdList: {},
  138. data: {
  139. admin: {},
  140. asset: {},
  141. notice: {},
  142. todayData: {}
  143. },
  144. // 订单总览
  145. orderData: [
  146. {
  147. name: "待付款",
  148. url: "/admin/home/order",
  149. type: 4,
  150. query: {
  151. tabIndex: 1
  152. },
  153. value: 0
  154. },
  155. {
  156. name: "待配送",
  157. value: 0,
  158. url: "/admin/home/order",
  159. type: 4,
  160. query: {
  161. tabIndex: 2
  162. }
  163. },
  164. {
  165. name: "配送中",
  166. value: 0,
  167. url: "/admin/home/order",
  168. type: 4,
  169. query: {
  170. tabIndex: 3
  171. }
  172. }
  173. ],
  174. // tab按钮
  175. tabsData: [
  176. {
  177. name: "商城",
  178. img: `${this.$constant.imgUrl}/ghs/home/shop.png`,
  179. url: "/admin/my-mall"
  180. },
  181. {
  182. name: "改价",
  183. img: `${this.$constant.imgUrl}/ghs/home/gj.png`,
  184. url: "/admin/billing/priceChange"
  185. },
  186. {
  187. name: "采购单",
  188. img: `${this.$constant.imgUrl}/ghs/home/icon_caigou.png`,
  189. url: "/pagesPurchase/order"
  190. },
  191. {
  192. name: "库存",
  193. img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`,
  194. url: "/pagesStorehouse/stockWarn/manage"
  195. },
  196. {
  197. name: "调拨出库",
  198. img: `${this.$constant.imgUrl}/ghs/home/dbck.png`,
  199. url: "/pagesStorehouse/allot/allotEx"
  200. },
  201. {
  202. name: "调拨入库",
  203. img: `${this.$constant.imgUrl}/ghs/home/dbrk.png`,
  204. url: "/pagesStorehouse/allot/allotPut"
  205. },
  206. {
  207. name: "花材",
  208. img: `${this.$constant.imgUrl}/ghs/home/hcgl.png`,
  209. url: "/pagesStorehouse/flower/manage"
  210. },
  211. {
  212. name: "客户欠款",
  213. img: `${this.$constant.imgUrl}/ghs/home/khqk.png`,
  214. url: "/pagesArrears/list"
  215. },
  216. {
  217. name: "员工",
  218. img: `${this.$constant.imgUrl}/ghs/home/yggl.png`,
  219. url: "/admin/staff/list"
  220. },
  221. {
  222. name: "邀请开店",
  223. img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,
  224. url: "/pagesInvite/list"
  225. },
  226. {
  227. name: "经营概况",
  228. img: `${this.$constant.imgUrl}/ghs/home/jyzk.png`,
  229. url: "/pagesStatistics/business"
  230. },
  231. {
  232. name: "全部",
  233. img: `${this.$constant.imgUrl}/ghs/home/qball.png`,
  234. url: "/admin/home/apply",
  235. type:4
  236. }
  237. ],
  238. // 总览
  239. totalData: [
  240. {
  241. name: "客户数",
  242. value: 0
  243. },
  244. {
  245. name: "总访问",
  246. value: 0
  247. },
  248. {
  249. name: "总订单",
  250. value: 0
  251. },
  252. {
  253. name: "总收入(元)",
  254. value: 0.00
  255. },
  256. {
  257. name: "总支出(元)",
  258. value: 0.00
  259. },
  260. {
  261. name: "总采购(元)",
  262. value: 0.00
  263. }
  264. ],
  265. cgSrc: `${this.$constant.imgUrl}/ghs/home/open_order.png`,
  266. kdSrc: `${this.$constant.imgUrl}/ghs/home/open_order.png`
  267. };
  268. },
  269. onShareAppMessage(res) {
  270. if (res.target.id === "shareStore") {
  271. return {
  272. title: "商城分享",
  273. desc: "",
  274. imgUrl: "",
  275. path: `/admin/billing/customerPlace?shopId=${this.loginInfo.shopId}`
  276. };
  277. } else if (res.target.id === "sharePay") {
  278. return {
  279. title: "分享收款",
  280. desc: "",
  281. imgUrl: "",
  282. path: "pagesShare/pay"
  283. };
  284. }
  285. },
  286. computed: {
  287. ...mapGetters({ userInfo: "getUser" }),
  288. ...mapGetters({ loginInfo: "getLoginInfo" }),
  289. },
  290. onLoad(option) {
  291. },
  292. onPullDownRefresh() {
  293. this.init();
  294. uni.stopPullDownRefresh();
  295. },
  296. onShow() {
  297. // this.init();
  298. },
  299. methods: {
  300. init() {
  301. /*延迟监听token*/
  302. if(!uni.getStorageSync('token')){
  303. setTimeout(()=>{
  304. this.init();
  305. },100);
  306. }else{
  307. // 获取小程序的APPID
  308. getWeixinId().then(res => {
  309. this.getappIdList = res.data
  310. });
  311. getUser().then(res => {
  312. uni.setNavigationBarTitle({
  313. title: res.name
  314. });
  315. let nowTime = getDataTimestamp(new Date(), true);
  316. if (nowTime > res.setDeadline) {
  317. this.renewMask = true;
  318. }
  319. });
  320. consoleIndex().then(res => {
  321. this.data = res.data;
  322. const { asset, todayData } = res.data;
  323. if (!this.$util.isEmpty(asset)) {
  324. // 订单总览
  325. this.orderData[0].value = asset.unPayOrder;
  326. this.orderData[1].value = asset.unSendOrder;
  327. this.orderData[2].value = asset.sendingOrder;
  328. // 总览数据
  329. this.totalData[0].value = asset.totalUser;
  330. this.totalData[1].value = asset.totalView;
  331. this.totalData[2].value = asset.finishOrder;
  332. this.totalData[3].value = asset.totalIncome;
  333. this.totalData[4].value = asset.totalExpend;
  334. this.totalData[5].value = asset.totalPurchase;
  335. }
  336. });
  337. }
  338. },
  339. goPage (item) {
  340. if (item.url === '/admin/my-mall') {
  341. this.getMyMall()
  342. return
  343. }
  344. this.$util.pageTo(item)
  345. },
  346. // 跳转
  347. pageToFn(item) {
  348. // #ifdef H5
  349. location.href = item.url;
  350. // #endif
  351. // #ifndef H5
  352. // #endif
  353. },
  354. // 续费
  355. renewFn() {
  356. this.$util.pageTo({
  357. url: "/pagesClient/official/index",
  358. query: {
  359. pay: 1
  360. },
  361. type: 2
  362. });
  363. },
  364. getMyMall(){
  365. console.log('pagesPurchase/ghsProduct?shopId='+ this.loginInfo.shopId+'&id=0&ghsShopAdminId='+this.loginInfo.shopAdminId)
  366. uni.navigateToMiniProgram({
  367. //姜枫-2021.04.13
  368. appId: this.getappIdList.hd.miniAppId,
  369. path: 'pagesPurchase/ghsProduct?shopId='+ this.loginInfo.shopId+'&id=0&ghsShopAdminId='+this.loginInfo.shopAdminId,
  370. //develop 开发版 trial 体验版 release 正式版
  371. envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
  372. extraData: {
  373. 'shopId': this.loginInfo.shopId,
  374. 'id': 0,
  375. 'name': '假数据',
  376. },
  377. success(res) {
  378. // 打开成功
  379. }
  380. })
  381. },
  382. }
  383. };
  384. </script>
  385. <style lang="scss" scoped>
  386. // button {
  387. // margin: 0;
  388. // padding: 0;
  389. // border: 1px solid transparent; //自定义边框
  390. // outline: none; //消除默认点击蓝色边框效果
  391. // }
  392. .app-content {
  393. padding-bottom: 10px;
  394. }
  395. // 公共
  396. .module-com {
  397. margin-bottom: 20px;
  398. // padding: 20px;
  399. background-color: #fff;
  400. // box-shadow: 0px 6px 16px #ddd;
  401. // border-radius: 10px;
  402. }
  403. // 用户信息
  404. .user-wrap {
  405. padding: 20px 30px 34px 30px;
  406. color: #fff;
  407. text-align: center;
  408. background-image: url("../../static/images/admin/bg.png");
  409. background-size: 100% 380px;
  410. background-repeat: no-repeat;
  411. .user-top {
  412. @include disFlex(center, space-between);
  413. .open-bt_bx {
  414. display: flex;
  415. align-items: center;
  416. line-height: 1upx;
  417. & > button {
  418. padding:0;
  419. line-height: auto;
  420. background-color: transparent;
  421. border: 1px solid #ffffff;
  422. border-radius: 22px;
  423. padding: 10upx 17upx!important;
  424. // height: 44px;
  425. // line-height: 44px;
  426. font-size: 24px;
  427. font-family: PingFang SC;
  428. font-weight: 400;
  429. color: #ffffff;
  430. // margin: 0 10px;
  431. & > .iconfont {
  432. font-size: 25px;
  433. padding-right: 10px;
  434. margin-top: -3px;
  435. }
  436. }
  437. }
  438. }
  439. .income-amount {
  440. margin-top: 36px;
  441. margin-bottom: 37px;
  442. .price {
  443. font-size: 50px;
  444. font-weight: bold;
  445. margin-top: 4px;
  446. }
  447. }
  448. .user-bottom {
  449. @include disFlex(center, space-around);
  450. // padding-bottom: 40px;
  451. .info-list-name {
  452. color: #bfd4ff;
  453. }
  454. .info-list-value {
  455. font-size: 36px;
  456. font-weight: bold;
  457. margin-top: 4px;
  458. }
  459. }
  460. }
  461. // 消息
  462. .news-wrap {
  463. .news-list {
  464. @include disFlex(center, space-between);
  465. padding: 30px 24px 30px 30px;
  466. border-bottom: 1px solid $borderColor;
  467. font-size: 26px;
  468. color: $fontColor2;
  469. &:active {
  470. background-color: $backColor;
  471. }
  472. & > div {
  473. @include disFlex(center, flex-start);
  474. }
  475. .news-left {
  476. .iconfont {
  477. color: $mainColor;
  478. margin-right: 10px;
  479. }
  480. }
  481. .news-right {
  482. font-size: 24px;
  483. color: $mainColor;
  484. transform: scale(0.9);
  485. @include disFlex(flex-end, flex-start);
  486. .iconfont {
  487. font-size: 24px;
  488. margin-left: 10px;
  489. }
  490. }
  491. }
  492. }
  493. // 总览
  494. .total-wrap,
  495. .order-wrap {
  496. .total-tit {
  497. padding: 18px 0 18px 20px;
  498. border-bottom: 1px solid $borderColor;
  499. font-weight: 600;
  500. font-size: 24px;
  501. color: #333333;
  502. }
  503. .total-blo {
  504. @include disFlex(center, space-between);
  505. flex-wrap: wrap;
  506. padding: 30px 0 40px;
  507. .total-list {
  508. width: 33%;
  509. text-align: center;
  510. margin: 20px 0px;
  511. border-right: 1px solid $borderColor;
  512. .list-num {
  513. margin-bottom: 8px;
  514. font-size: 36px;
  515. font-weight: bold;
  516. }
  517. }
  518. .total-list:nth-child(3n) {
  519. border-right: none;
  520. }
  521. .total-list:nth-child(n + 4) {
  522. padding-bottom: 0;
  523. }
  524. }
  525. }
  526. .tabs-head_bx {
  527. display: flex;
  528. align-items: center;
  529. padding: 20px 15px;
  530. }
  531. // tabs
  532. .tabs-wrap {
  533. padding: 20px 10px;
  534. @include disFlex(center, flex-start);
  535. flex-wrap: wrap;
  536. .tabs-list {
  537. width: 25%;
  538. margin-top: 50px;
  539. text-align: center;
  540. .tabs-img {
  541. width: 100px;
  542. height: 100px;
  543. margin: 0 auto;
  544. img {
  545. height: 100%;
  546. }
  547. }
  548. .tabs-name {
  549. color: $fontColor2;
  550. margin-top: 10px;
  551. }
  552. &:nth-child(-n + 4) {
  553. margin-top: 0;
  554. }
  555. }
  556. }
  557. // 遮罩层
  558. .renew-wrap {
  559. text-align: center;
  560. .renew-wrap-text {
  561. margin-top: 30px;
  562. margin-bottom: 60px;
  563. font-size: 34px;
  564. }
  565. }
  566. </style>