workbench.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <div class="app-main app-content">
  3. <div class="user-wrap" :style="{ backgroundImage: `url(${constant.imgUrl}/home/bg_hd_home.png)` }">
  4. <div class="user-top">
  5. <div class="app-size-28">今日概况</div>
  6. </div>
  7. <div class="income-amount" @click="goToIncome">
  8. <div>销售收入</div>
  9. <div class="price">{{ $util.numberFormat(data.todayData.income) }}</div>
  10. </div>
  11. <div class="user-bottom">
  12. <navigator url="/admin/home/order" open-type="switchTab" class="info-list">
  13. <div class="info-list-name">开单</div>
  14. <div class="info-list-value">
  15. {{ $util.numberFormat(data.todayData.order) || 0 }}
  16. </div>
  17. </navigator>
  18. <div class="info-list">
  19. <div class="info-list-name">访客</div>
  20. <div class="info-list-value">
  21. {{ $util.numberFormat(data.todayData.visit) || 0 }}
  22. </div>
  23. </div>
  24. <div class="info-list" @click="goToExpend" >
  25. <div class="info-list-name">支出</div>
  26. <div class="info-list-value">
  27. {{ $util.numberFormat(data.todayData.out) || 0 }}
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="module-com news-wrap">
  33. <div class="news-list" v-for="(item, index) in data.notice" :key="index" @click="noticeFn(item)" >
  34. <div class="news-left">
  35. <i class="iconfont iconxiaoxi2 ling"></i>
  36. <span>{{ item.title }}</span>
  37. </div>
  38. <div class="news-right">
  39. <span>{{ item.action }}</span>
  40. <i class="iconfont iconxiangyou"></i>
  41. </div>
  42. </div>
  43. </div>
  44. <view class="module-com">
  45. <view class="tabs-head_bx">
  46. <image @click="goGd()" :src="kdSrc" mode="widthFix" ></image>
  47. <image @click="goCg()" :src="cgSrc" mode="widthFix"></image>
  48. </view>
  49. <div class="tabs-wrap">
  50. <div class="tabs-list" v-for="(item, index) in tabsData" :key="index" >
  51. <div @click="goPage(item)">
  52. <div class="tabs-img">
  53. <img :src="item.img" alt mode="widthFix" />
  54. </div>
  55. <div class="tabs-name">{{ item.name }}</div>
  56. </div>
  57. </div>
  58. </div>
  59. </view>
  60. <div class="module-com total-wrap">
  61. <div class="total-tit">总览</div>
  62. <div class="total-blo">
  63. <div class="total-list" v-for="(item, index) in totalData" :key="index" >
  64. <div class="list-num">{{ $util.numberFormat(item.value) }}</div>
  65. <div class="app-color-3">{{ item.name }}</div>
  66. </div>
  67. </div>
  68. </div>
  69. <NotLogin></NotLogin>
  70. </div>
  71. </template>
  72. <script>
  73. import { mapGetters, mapState } from "vuex";
  74. import { getWeixinId } from "@/api/invite/index";
  75. import { getShopInfo } from "@/utils/auth";
  76. import { consoleIndex } from "@/api/workbench";
  77. import NotLogin from "@/components/not-login";
  78. import autoUpdateMixins from "@/mixins/autoUpdate";
  79. export default {
  80. name: "workbench",
  81. components: { NotLogin },
  82. mixins: [autoUpdateMixins],
  83. data () {
  84. return {
  85. constant: this.$constant,
  86. getappIdList: {},
  87. data: {
  88. admin: {},
  89. asset: {},
  90. notice: {},
  91. todayData: { income:0.00, order:0, custom:0, expend:0.00 },
  92. isMini:0
  93. },
  94. tabsData: [
  95. { name: "商城", img: `${this.$constant.imgUrl}/ghs/home/shop.png`, url: "/admin/cg/mall",pf:1},
  96. { name: "工单", img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`, url: "/admin/work/list",pf:1 },
  97. { name: "花材", img: `${this.$constant.imgUrl}/ghs/home/hcgl.png`, url: "/admin/item/list",pf:1 },
  98. { name: "改价", img: `${this.$constant.imgUrl}/ghs/home/gj.png`, url: "/admin/changePrice/list",pf:0},
  99. { name: "供应商", img: `${this.$constant.imgUrl}/ghs/home/icon_ghs.png`, url: "/pagesPurchase/order",pf:0 },
  100. { name: "采购单", img: `${this.$constant.imgUrl}/ghs/home/icon_caigou.png`, url: "/pagesPurchase/shopping",pf:0 },
  101. { name: "采购结账单", img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`, url: "/admin/clear/list",pf:0 },
  102. { name: "商品", img: `${this.$constant.imgUrl}/ghs/home/hcgl.png`, url: "/admin/goods/list",pf:1 },
  103. { name: "商品采购单", img: `${this.$constant.imgUrl}/ghs/home/icon_caigou.png`, url: "/admin/goods/plantCg",pf:1},
  104. { name: "报损单", img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`, url: "/admin/breakage/list",pf:1},
  105. { name: "员工", img: `${this.$constant.imgUrl}/ghs/home/yggl.png`, url: "/admin/staff/list",pf:0 },
  106. { name: "花材分类", img: `${this.$constant.imgUrl}/ghs/home/hcgl.png`,url: "/admin/itemClass/list",pf:1},
  107. ],
  108. totalData: [
  109. { name: "客户数", value: 0 },
  110. { name: "总访客", value: 0 },
  111. { name: "总订单", value: 0 },
  112. { name: "总收入(元)", value: 0 },
  113. { name: "总支出(元)", value: 0 },
  114. { name: "总采购(元)", value: 0 }
  115. ],
  116. cgSrc: `${this.$constant.imgUrl}/ghs/home/cg.png`,
  117. kdSrc: `${this.$constant.imgUrl}/ghs/home/gd.png`
  118. };
  119. },
  120. onShareAppMessage (res) {
  121. return {
  122. title: "",
  123. desc: "",
  124. imgUrl: "",
  125. path: ""
  126. };
  127. },
  128. computed: {
  129. ...mapGetters({ loginInfo: "getLoginInfo" })
  130. },
  131. onLoad () {
  132. },
  133. onPullDownRefresh () {
  134. this.init();
  135. uni.stopPullDownRefresh();
  136. },
  137. onShow () {
  138. getShopInfo().then(res => {
  139. if(res.name){
  140. uni.setNavigationBarTitle({ title: res.name })
  141. }else{
  142. uni.setNavigationBarTitle({ title: '店铺' })
  143. }
  144. })
  145. },
  146. methods: {
  147. goGd(){
  148. this.$util.pageTo({url:'/admin/work/add'})
  149. },
  150. goCg(){
  151. if(this.getLoginInfo.pfShopId && Number(this.getLoginInfo.pfShopId)>0){
  152. this.$msg('请在批发端操作')
  153. return false
  154. }
  155. this.$util.pageTo({url:'/pagesPurchase/order'})
  156. },
  157. goPage (item) {
  158. if (item.url === '/admin/billing/priceChange') {
  159. this.goToMallPt('pages/pay/index')
  160. return true
  161. }
  162. if(this.getLoginInfo.pfShopId && Number(this.getLoginInfo.pfShopId)>0){
  163. if(item.pf == 0){
  164. this.$msg('请在批发端操作')
  165. return false
  166. }
  167. }
  168. this.$util.pageTo(item)
  169. },
  170. init () {
  171. getWeixinId().then(res => {
  172. this.getappIdList = res.data
  173. });
  174. // #ifdef MP-WEIXIN
  175. this.isMini = 1
  176. // #endif
  177. consoleIndex({isMini:this.isMini}).then(res => {
  178. this.data = res.data;
  179. const { asset, todayData } = res.data;
  180. if (!this.$util.isEmpty(asset)) {
  181. // 总览数据
  182. this.totalData[0].value = asset.totalUser ? parseFloat(asset.totalUser) : 0;
  183. this.totalData[1].value = asset.totalView ? parseFloat(asset.totalView) : 0;
  184. this.totalData[2].value = asset.totalOrder ? parseFloat(asset.totalOrder) : 0;
  185. this.totalData[3].value = asset.totalIncome ? parseFloat(asset.totalIncome) : 0;
  186. this.totalData[4].value = asset.totalExpend ? parseFloat(asset.totalExpend) : 0;
  187. this.totalData[5].value = asset.totalPurchase ? parseFloat(asset.totalPurchase) : 0;
  188. }
  189. });
  190. },
  191. //通知处理
  192. noticeFn (item) {
  193. this.$util.pageTo({ url: item.page })
  194. },
  195. //支出
  196. goToExpend () {
  197. uni.navigateTo({ url: '/pagesStore/me/expend' })
  198. },
  199. //收入
  200. goToIncome () {
  201. uni.navigateTo({ url: '/pagesStore/me/income' })
  202. },
  203. //续费
  204. renewFn () {
  205. this.$util.pageTo({ url: "/pagesClient/official/index", query: { pay: 1 }, type: 2 })
  206. },
  207. goToMallPt (url) {
  208. let self = this
  209. uni.navigateToMiniProgram({
  210. appId: this.getappIdList.mall.miniAppId,
  211. path: url + '?account=' + self.loginInfo.shopId,
  212. //develop 开发版 trial 体验版 release 正式版
  213. envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
  214. extraData: {
  215. 'hdShopAdminId': self.loginInfo.shopAdminId
  216. },
  217. success (res) {
  218. }
  219. })
  220. },
  221. }
  222. };
  223. </script>
  224. <style lang="scss" scoped>
  225. .app-content {
  226. padding-bottom: 10upx;
  227. }
  228. .module-com {
  229. margin-bottom: 20upx;
  230. background-color: #fff;
  231. }
  232. .user-wrap {
  233. padding: 20upx 30upx 34upx 30upx;
  234. color: #fff;
  235. text-align: center;
  236. background-size: 100% 380upx;
  237. background-repeat: no-repeat;
  238. .user-top {
  239. @include disFlex(center, space-between);
  240. .open-bt_bx {
  241. display: flex;
  242. align-items: center;
  243. line-height: 1upx;
  244. & > button {
  245. padding: 0;
  246. line-height: auto;
  247. background-color: transparent;
  248. border: 1px solid #ffffff;
  249. border-radius: 22upx;
  250. padding: 10upx 17upx !important;
  251. font-size: 24upx;
  252. font-family: PingFang SC;
  253. font-weight: 400;
  254. color: #ffffff;
  255. & > .iconfont {
  256. font-size: 25upx;
  257. padding-right: 10upx;
  258. }
  259. }
  260. }
  261. }
  262. .income-amount {
  263. margin-top: 36upx;
  264. margin-bottom: 37upx;
  265. .price {
  266. font-size: 50upx;
  267. font-weight: bold;
  268. margin-top: 4upx;
  269. }
  270. }
  271. .user-bottom {
  272. @include disFlex(center, space-around);
  273. .info-list-name {
  274. color: #bfd4ff;
  275. }
  276. .info-list-value {
  277. font-size: 36upx;
  278. font-weight: bold;
  279. margin-top: 4upx;
  280. }
  281. }
  282. }
  283. // 消息
  284. .news-wrap {
  285. .news-list {
  286. @include disFlex(center, space-between);
  287. padding: 30upx 24upx 30upx 30upx;
  288. border-bottom: 1px solid $borderColor;
  289. font-size: 26upx;
  290. color: $fontColor2;
  291. &:active {
  292. background-color: $backColor;
  293. }
  294. & > div {
  295. @include disFlex(center, flex-start);
  296. }
  297. .news-left {
  298. .iconfont {
  299. color: $mainColor;
  300. margin-right: 10upx;
  301. }
  302. .ling {
  303. font-size: 28upx;
  304. }
  305. span{
  306. font-size:29upx;
  307. }
  308. }
  309. .news-right {
  310. font-size: 26upx;
  311. color: $mainColor;
  312. transform: scale(0.9);
  313. @include disFlex(flex-end, flex-start);
  314. .iconfont {
  315. font-size: 24upx;
  316. margin-left: 10upx;
  317. margin-bottom: 6upx;
  318. }
  319. }
  320. }
  321. }
  322. // 总览
  323. .total-wrap,
  324. .order-wrap {
  325. .total-tit {
  326. padding: 18upx 0 18upx 20upx;
  327. border-bottom: 1px solid $borderColor;
  328. font-weight: 600;
  329. font-size: 24upx;
  330. color: #333333;
  331. }
  332. .total-blo {
  333. @include disFlex(center, space-between);
  334. flex-wrap: wrap;
  335. padding: 30upx 0 40upx;
  336. .total-list {
  337. width: 33%;
  338. text-align: center;
  339. margin: 20upx 0upx;
  340. border-right: 1px solid $borderColor;
  341. .list-num {
  342. margin-bottom: 8upx;
  343. font-size: 36upx;
  344. font-weight: bold;
  345. }
  346. }
  347. .total-list:nth-child(3n) {
  348. border-right: none;
  349. }
  350. .total-list:nth-child(n + 4) {
  351. padding-bottom: 0;
  352. }
  353. }
  354. }
  355. .tabs-head_bx {
  356. display: flex;
  357. align-items: center;
  358. padding: 20upx 15upx;
  359. }
  360. .tabs-wrap {
  361. padding: 20upx 10upx;
  362. @include disFlex(center, flex-start);
  363. flex-wrap: wrap;
  364. .tabs-list {
  365. width: 25%;
  366. margin-top: 50upx;
  367. text-align: center;
  368. .tabs-img {
  369. width: 100upx;
  370. height: 100upx;
  371. margin: 0 auto;
  372. img {
  373. height: 100%;
  374. }
  375. }
  376. .tabs-name {
  377. color: $fontColor2;
  378. margin-top: 10upx;
  379. }
  380. &:nth-child(-n + 4) {
  381. margin-top: 0;
  382. }
  383. }
  384. }
  385. // 遮罩层
  386. .renew-wrap {
  387. text-align: center;
  388. .renew-wrap-text {
  389. margin-top: 30upx;
  390. margin-bottom: 60upx;
  391. font-size: 34upx;
  392. }
  393. }
  394. </style>