workbench.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <view>
  3. <block v-if="loginStyle == 0">
  4. <!-- #ifdef MP-WEIXIN -->
  5. <view style="width:100vw;height:400upx;display:flex;align-items:center;justify-content:center;position:relative;">
  6. <view style="position:absolute;top:60upx;font-size:35upx;">
  7. <text style="color:#333333;margin-left:8upx;font-weight:bold;">花店买花点这里</text>
  8. </view>
  9. <button class="admin-button-com big blue" style="width:260upx;" @click="buyItem()">去买花</button>
  10. </view>
  11. <!-- #endif -->
  12. <view style="width:100vw;height:400upx;display:flex;align-items:center;justify-content:center;position:relative;">
  13. <!-- #ifdef MP-WEIXIN -->
  14. <view style="position:absolute;top:60upx;font-size:35upx;">
  15. <text style="color:#333333;margin-left:8upx;font-weight:bold;">批发店点这里登录</text>
  16. </view>
  17. <!-- #endif -->
  18. <button class="admin-button-com big blue" style="width:260upx;" @click="pageTo({url:'/admin/home/login'})">去登录</button>
  19. <text style="color:green;position:absolute;top:300upx;font-size:32upx;" @click="pageTo({url:'/admin/book/index'})">查看教学视频</text>
  20. </view>
  21. </block>
  22. <block v-else>
  23. <view class="app-main app-content">
  24. <template v-if="(loginInfo.staff && loginInfo.staff.super && loginInfo.staff.super == 1) || (loginInfo.staff && loginInfo.staff.lookStat && loginInfo.staff.lookStat ==1)">
  25. <div class="user-wrap">
  26. <div class="user-top">
  27. <div class="app-size-28">今日概况</div>
  28. <text v-if="!$util.isEmpty(errorPirceList)" @click="showErrorPriceFn"
  29. style="float:right;color:yellow;font-weight:bold;font-size:30upx;">价格异常,点击查看</text>
  30. </div>
  31. <div class="income-amount" @click="pageTo({url:'/admin/stat/kdIncome'})">
  32. <div>收入</div>
  33. <div class="price">{{ $util.numberFormat(data.todayData.income) }}</div>
  34. </div>
  35. <div class="user-bottom">
  36. <navigator class="info-list" url="/admin/custom/visit">
  37. <div class="info-list-name">访客</div>
  38. <div class="info-list-value">
  39. {{ $util.numberFormat(data.todayData.visitCustom) || 0 }}
  40. </div>
  41. </navigator>
  42. <navigator url="/admin/home/order" open-type="switchTab" class="info-list">
  43. <div class="info-list-name">订单</div>
  44. <div class="info-list-value">
  45. {{ $util.numberFormat(data.todayData.order) || 0 }}
  46. </div>
  47. </navigator>
  48. <navigator url="/admin/stat/wastage" class="info-list">
  49. <div class="info-list-name">损耗</div>
  50. <div class="info-list-value">
  51. {{ $util.numberFormat(data.todayData.wastage) || 0 }}
  52. </div>
  53. </navigator>
  54. </div>
  55. </div>
  56. <div class="module-com order-wrap" @click="pageTo({url:'/admin/stat/kdIncome'})">
  57. <div class="total-blo">
  58. <div class="total-list2">
  59. <div class="app-color-3">系统收款</div>
  60. <div class="list-num">
  61. <view>{{countStat.systemCount||0}}</view>
  62. <view>{{countStat.systemIncome?parseFloat(countStat.systemIncome):0}}</view>
  63. </div>
  64. </div>
  65. <div class="total-list2">
  66. <div class="app-color-3">线下微信</div>
  67. <div class="list-num">
  68. <view>{{countStat.kfWxCount||0}}</view>
  69. <view>{{countStat.kfWxIncome?parseFloat(countStat.kfWxIncome):0}}</view>
  70. </div>
  71. </div>
  72. <div class="total-list2">
  73. <div class="app-color-3">现金</div>
  74. <div class="list-num">
  75. <view>{{countStat.cashCount||0}}</view>
  76. <view>{{countStat.cashIncome?parseFloat(countStat.cashIncome):0}}</view>
  77. </div>
  78. </div>
  79. <div class="total-list2">
  80. <div class="app-color-3">欠款</div>
  81. <div class="list-num">
  82. <view>{{countStat.debtCount||0}}</view>
  83. <view>{{countStat.debtIncome?parseFloat(countStat.debtIncome):0}}</view>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </template>
  89. <!-- 消息 -->
  90. <div class="module-com news-wrap">
  91. <div class="news-list" v-for="(item, index) in data.notice" :key="index" @click="pageToFn(item)" >
  92. <div class="news-left">
  93. <i class="iconfont iconxiaoxi2"></i>
  94. <span>{{ item.title }}</span>
  95. </div>
  96. <div class="news-right">
  97. <span>{{item.action}}</span>
  98. <i class="iconfont iconxiangyou"></i>
  99. </div>
  100. </div>
  101. </div>
  102. <view class="module-com">
  103. <!-- 个人和花店开单 -->
  104. <view class="tabs-head_bx">
  105. <image @click="skKd()" :src="isScanEnv ? skSrc3 : skSrc" mode="widthFix"></image>
  106. <image @click="customKd()" :src="isScanEnv ? pfSrc3 : pfSrc" mode="widthFix" ></image>
  107. </view>
  108. <!-- 小按钮 -->
  109. <view class="tabs-wrap">
  110. <view class="tabs-list" v-for="(item, index) in tabsData" :key="index">
  111. <view @click="goPage(item)">
  112. <view class="tabs-img">
  113. <image :src="`${constant.imgUrl}/${item.img}`" alt mode="widthFix" ></image>
  114. </view>
  115. <view class="tabs-name">{{ item.name }}</view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. <template v-if="(loginInfo.staff && loginInfo.staff.super && loginInfo.staff.super == 1) || (loginInfo.staff && loginInfo.staff.lookStat && loginInfo.staff.lookStat ==1)">
  121. <div class="module-com total-wrap">
  122. <div class="total-tit">总览</div>
  123. <div class="total-blo">
  124. <div class="total-list" v-for="(item, index) in overview" :key="index" @click="pageTo(item)">
  125. <div class="list-num">{{ $util.numberFormat(item.value) }}</div>
  126. <div class="app-color-3">{{ item.name }}</div>
  127. </div>
  128. </div>
  129. </div>
  130. </template>
  131. </view>
  132. </block>
  133. <uni-popup ref="errorPriceRef" background-color="#fff" type="center" :animation="false">
  134. <view style="padding-top:20upx;font-size:30upx;padding-bottom:20upx;">
  135. <view style="margin-bottom:10upx;" v-for="(errItem, errIndex) in errorPirceList" :key="errIndex">
  136. <text v-if="errItem.name">{{errItem.name}}</text>
  137. <text v-if="errItem.a" style="margin-left:18upx;">A级:¥{{errItem.a?parseFloat(errItem.a):0}}</text>
  138. <text v-if="errItem.b" style="margin-left:18upx;">B级:¥{{errItem.b?parseFloat(errItem.b):0}}</text>
  139. <text v-if="errItem.c" style="margin-left:18upx;">C级:¥{{errItem.c?parseFloat(errItem.c):0}}</text>
  140. </view>
  141. <view style="text-align:center;margin-top:20upx;">
  142. <button @click="closeErrorPriceFn" class="admin-button-com middle blue">知道了</button>
  143. </view>
  144. </view>
  145. </uni-popup>
  146. </view>
  147. </template>
  148. <script>
  149. import { mapGetters,mapActions } from "vuex";
  150. import { getShopInfo } from "@/utils/auth";
  151. import { consoleIndex } from "@/api/workbench";
  152. import { closeBook } from "@/api/book";
  153. import productMins from "@/mixins/product";
  154. import { allProduct } from '@/api/product'
  155. import {currentShop} from "@/api/shop";
  156. import { getStat,getStrokeCount } from '@/api/console'
  157. import autoUpdateMixins from "@/mixins/autoUpdate";
  158. import { getWeixinId } from "@/api/invite/index";
  159. import { getErrorPrice } from "@/api/item"
  160. export default {
  161. name: "admin-workbench",
  162. components: { },
  163. mixins: [productMins,autoUpdateMixins],
  164. data() {
  165. return {
  166. getappIdList: {},
  167. skCustomId:0,
  168. data: {
  169. admin: {},
  170. asset: {},
  171. notice: {},
  172. todayData: { income:0.00, order:0, custom:0, expend:0.00 }
  173. },
  174. tabsData: [
  175. { name: "商城", img: 'ghs/home/shop.png', url: "/admin/home/mall" },
  176. { name: "改价", img: 'ghs/home/gj.png', url: "/admin/changePrice/list" },
  177. { name: "花材", img: 'ghs/home/hcgl.png', url: "/admin/item/list" },
  178. { name: "采购", img: 'ghs/home/icon_caigou.png', url: "/pagesPurchase/order" },
  179. { name: "供货商", img: 'ghs/home/icon_ghs.png', url: "/pagesPurchase/supplier" },
  180. { name: "损耗", img: 'ghs/home/kcyjs.png', url: "/admin/breakage/list" },
  181. { name: "调拨入库", img: 'ghs/home/dbrk.png', url: "/pagesStorehouse/allot/allotPut" },
  182. { name: "调拨出库", img: 'ghs/home/dbck.png', url: "/pagesStorehouse/allot/allotEx" },
  183. {name : "结账记录", img : "ghs/home/kcyjs.png", url : "/admin/clear/customList"},
  184. {name : "支出", img : "ghs/home/kcyjs.png", url : "/admin/expend/list"},
  185. {name : "盘点", img : "/ghs/home/pandian.png", url : "/pagesStorehouse/inventory/list"},
  186. {name : "库存预警", img : "/ghs/home/kcyjs.png", url : "/admin/item/list?warning=1"},
  187. ],
  188. skSrc: `${this.$constant.imgUrl}/ghs/home/kj.png`,
  189. pfSrc: `${this.$constant.imgUrl}/ghs/home/pf.jpg`,
  190. skSrc3: `${this.$constant.imgUrl}/ghs/home/sk33.jpg`,
  191. pfSrc3: `${this.$constant.imgUrl}/ghs/home/pf3.jpg`,
  192. isScanEnv:false,
  193. isMini:0,
  194. todayDebt:0,
  195. totalDebt:0,
  196. countStat:{systemIncome:0,systemCount:0,debtCount:0,debtIncome:0,kfWxCount:0,kfWxIncome:0},
  197. overview:[],
  198. //登录状态 0未登录 1登录
  199. loginStyle :0,
  200. errorPirceList:[]
  201. };
  202. },
  203. onShareAppMessage(res) {
  204. if (res.target.id === "shareStore") {
  205. return { title: "商城分享", desc: "", imgUrl: "", path: `/admin/billing/customerPlace?shopId=${this.loginInfo.shopId}` }
  206. } else if (res.target.id === "sharePay") {
  207. return { title: "分享收款", desc: "", imgUrl: "", path: "pagesShare/pay" }
  208. }
  209. },
  210. computed: {
  211. ...mapGetters({ loginInfo: "getLoginInfo" }),
  212. ...mapGetters({ myShopInfo: "getMyShopInfo" }),
  213. },
  214. watch: {
  215. loginInfo(newVal) {
  216. if(!this.$util.isEmpty(newVal.admin) && newVal.admin.currentGhsShopId > 0){
  217. this.loginStyle = 1
  218. }
  219. }
  220. },
  221. onLoad(option) {
  222. if(this.$util.isScanEnv()){
  223. this.isScanEnv = true
  224. }
  225. },
  226. onPullDownRefresh() {
  227. this.init();
  228. uni.stopPullDownRefresh();
  229. },
  230. onShow() {
  231. this.showShopName()
  232. if(!this.$util.isEmpty(this.loginInfo.admin) && this.loginInfo.admin.currentGhsShopId > 0){
  233. this.loginStyle = 1
  234. }
  235. },
  236. methods: {
  237. ...mapActions(['setUserShopAll']),
  238. showShopName(){
  239. currentShop().then(res => {
  240. if(res.code == 1){
  241. let sjName = res.data.merchantName ? res.data.merchantName : ''
  242. let shopName = res.data.shopName ? res.data.shopName : ''
  243. let title = shopName == '首店' ? sjName : sjName+' '+shopName
  244. uni.setNavigationBarTitle({ title: title })
  245. }
  246. })
  247. },
  248. closeErrorPriceFn(){
  249. this.$refs.errorPriceRef.close()
  250. },
  251. showErrorPriceFn(){
  252. this.$refs.errorPriceRef.open('top')
  253. },
  254. goLjh(){
  255. let that = this
  256. // #ifdef MP-WEIXIN
  257. uni.navigateToMiniProgram({
  258. //姜枫-2021.04.13
  259. appId: that.getappIdList.hd.miniAppId,
  260. path: 'admin/ljh/info',
  261. //develop 开发版 trial 体验版 release 正式版
  262. envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
  263. extraData: {},
  264. success (res) {
  265. }
  266. })
  267. // #endif
  268. // #ifdef APP-PLUS
  269. that.$msg("请用微信打开")
  270. // #endif
  271. },
  272. buyItem() {
  273. let that = this
  274. // #ifdef MP-WEIXIN
  275. uni.navigateToMiniProgram({
  276. //姜枫-2021.04.13
  277. appId: that.getappIdList.hd.miniAppId,
  278. path: 'admin/home/workbench',
  279. //develop 开发版 trial 体验版 release 正式版
  280. envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
  281. extraData: {},
  282. success (res) {
  283. }
  284. })
  285. // #endif
  286. // #ifdef APP-PLUS
  287. that.$msg("请用微信打开")
  288. // #endif
  289. },
  290. closeBook(){
  291. let that = this
  292. that.$util.confirmModal({title:"确定关闭?",content:'关闭后可以在底部菜单【我的】,找到【使用教程】重新打开'},() => {
  293. closeBook().then((res) => {
  294. //有多处相似地方,请全项目搜索about_store_clear
  295. // #ifdef MP-WEIXIN
  296. that.$store.commit("setLoginInfo", {})
  297. that.$util.pageTo({url: "/admin/home/workbench",type: 3})
  298. // #endif
  299. // #ifdef APP-PLUS
  300. this.$store.commit("setLoginInfo", {})
  301. this.$store.commit("setDictionariesInfo", {})
  302. this.$store.commit("setMyShopInfo", {})
  303. plus.runtime.restart()
  304. // #endif
  305. })
  306. })
  307. },
  308. customKd(){
  309. this.pageTo({ url: '/admin/custom/selectCustom',query: {style:1}})
  310. },
  311. skKd(){
  312. let that = this
  313. let currentId = 0;
  314. if(this.skCustomId > 0){
  315. currentId = this.skCustomId
  316. }
  317. if(!this.$util.isEmpty(this.loginInfo.skCustomId) && this.loginInfo.skCustomId > 0){
  318. currentId = this.loginInfo.skCustomId
  319. }
  320. if(currentId > 0){
  321. if(this.$util.isScanEnv()){
  322. this.$util.pageTo({url: "/admin/billing/affirm",query: {customId: currentId}})
  323. }else{
  324. this.$util.pageTo({url: "/admin/billing/index",query: {customId: currentId}})
  325. }
  326. }else{
  327. that.$util.confirmModal({content:'请设置快捷开单的门店',okText:'好的',cancelText:'取消'},() => {
  328. that.$util.pageTo({url: '/admin/shop/sk'})
  329. })
  330. }
  331. },
  332. init() {
  333. this.setIndex()
  334. let that = this
  335. getStrokeCount().then(res=>{
  336. if(res.code == 1){
  337. this.countStat = res.data
  338. }
  339. })
  340. getStat().then(res=>{
  341. if(res.code == 1){
  342. that.todayDebt = res.data.todayDebt ? parseFloat(res.data.todayDebt) : 0
  343. that.totalDebt = res.data.totalDebt ? parseFloat(res.data.totalDebt) : 0
  344. that.overview = res.data.overview
  345. }
  346. })
  347. this.showShopName()
  348. getWeixinId().then(res => {
  349. this.getappIdList = res.data
  350. })
  351. //是否有C级价格比B级和A级贵的情况
  352. getErrorPrice().then(res=>{
  353. let that = this
  354. if(res.code == 1){
  355. that.errorPirceList = res.data.list
  356. }
  357. })
  358. },
  359. setIndex(){
  360. // #ifdef MP-WEIXIN
  361. this.isMini = 1
  362. // #endif
  363. consoleIndex({isMini:this.isMini}).then(res => {
  364. this.data = res.data;
  365. const { menu } = res.data;
  366. this.tabsData = menu
  367. })
  368. },
  369. goPage (item) {
  370. this.$util.pageTo(item)
  371. },
  372. pageToFn(item) {
  373. this.$util.pageTo({url: item.page})
  374. },
  375. pageToNewOrderList(item) {
  376. this.$util.pageTo({url: "newOrderList?type="+item,type:1})
  377. }
  378. }
  379. };
  380. </script>
  381. <style lang="scss" scoped>
  382. .app-content {
  383. padding-bottom: 10upx;
  384. }
  385. .module-com {
  386. margin-bottom: 20upx;
  387. background-color: #fff;
  388. }
  389. // 用户信息
  390. .user-wrap {
  391. padding: 20upx 30upx 34upx 30upx;
  392. color: #fff;
  393. text-align: center;
  394. background-image: url("../../static/images/admin/bg.png");
  395. background-size: 100% 380upx;
  396. background-repeat: no-repeat;
  397. .user-top {
  398. @include disFlex(center, space-between);
  399. .open-bt_bx {
  400. display: flex;
  401. align-items: center;
  402. line-height: 1upx;
  403. & > button {
  404. padding:0;
  405. line-height: auto;
  406. background-color: transparent;
  407. border: 1upx solid #ffffff;
  408. border-radius: 22upx;
  409. padding: 10upx 17upx!important;
  410. font-size: 24upx;
  411. font-family: PingFang SC;
  412. font-weight: 400;
  413. color: #ffffff;
  414. & > .iconfont {
  415. font-size: 25upx;
  416. padding-right: 10upx;
  417. margin-top: -3upx;
  418. }
  419. }
  420. }
  421. }
  422. .income-amount {
  423. margin-top: 36upx;
  424. margin-bottom: 37upx;
  425. .price {
  426. font-size: 50upx;
  427. font-weight: bold;
  428. margin-top: 4upx;
  429. }
  430. }
  431. .user-bottom {
  432. @include disFlex(center, space-around);
  433. .info-list-name {
  434. color: #bfd4ff;
  435. }
  436. .info-list-value {
  437. font-size: 36upx;
  438. font-weight: bold;
  439. margin-top: 4upx;
  440. }
  441. }
  442. }
  443. // 消息
  444. .news-wrap {
  445. .news-list {
  446. @include disFlex(center, space-between);
  447. padding: 25upx 24upx 25upx 30upx;
  448. border-bottom: 1upx solid $borderColor;
  449. font-size: 26upx;
  450. color: $fontColor2;
  451. &:active {
  452. background-color: $backColor;
  453. }
  454. & > div {
  455. @include disFlex(center, flex-start);
  456. }
  457. .news-left {
  458. font-size:30upx;
  459. .iconfont {
  460. color: $mainColor;
  461. margin-right: 10upx;
  462. font-size:29upx;
  463. }
  464. }
  465. .news-right {
  466. font-size:30upx;
  467. color: $mainColor;
  468. transform: scale(0.9);
  469. @include disFlex(flex-end, flex-start);
  470. .iconfont {
  471. font-size: 32upx;
  472. margin-left: 10upx;
  473. }
  474. }
  475. }
  476. }
  477. // 总览
  478. .total-wrap,
  479. .order-wrap {
  480. .total-tit {
  481. padding: 18upx 0 18upx 20upx;
  482. border-bottom: 1upx solid $borderColor;
  483. font-weight: 600;
  484. font-size: 24upx;
  485. color: #333333;
  486. }
  487. .total-blo {
  488. @include disFlex(center, space-between);
  489. flex-wrap: wrap;
  490. padding: 20upx 0 0;
  491. .total-list {
  492. width: 33%;
  493. text-align: center;
  494. margin: 20upx 0upx;
  495. border-right: 1upx solid $borderColor;
  496. .list-num {
  497. margin-bottom: 8upx;
  498. font-size: 36upx;
  499. font-weight: bold;
  500. }
  501. }
  502. .total-list:nth-child(3n) {
  503. border-right: none;
  504. }
  505. .total-list:nth-child(n + 4) {
  506. padding-bottom: 0;
  507. }
  508. .total-list2 {
  509. width: 24%;
  510. text-align: center;
  511. margin: 20upx 0upx;
  512. border-right: 1upx solid $borderColor;
  513. .list-num {
  514. margin-top:10upx;
  515. margin-bottom:8upx;
  516. font-size:26upx;
  517. font-weight:normal;
  518. }
  519. }
  520. .total-list2:nth-child(4n) {
  521. border-right: none;
  522. }
  523. .total-list2:nth-child(n + 4) {
  524. padding-bottom: 0;
  525. }
  526. }
  527. }
  528. .tabs-head_bx {
  529. display: flex;
  530. align-items: center;
  531. padding: 20upx 15upx 10upx 15upx;
  532. }
  533. // tabs
  534. .tabs-wrap {
  535. padding: 20upx 10upx;
  536. @include disFlex(center, flex-start);
  537. flex-wrap: wrap;
  538. .tabs-list {
  539. width: 25%;
  540. margin-top: 50upx;
  541. text-align: center;
  542. .tabs-img {
  543. width: 100upx;
  544. height: 100upx;
  545. margin: 0 auto;
  546. img {
  547. height: 100%;
  548. }
  549. }
  550. .tabs-name {
  551. color: #444444;
  552. margin-top: 10upx;
  553. }
  554. &:nth-child(-n + 4) {
  555. margin-top: 0;
  556. }
  557. }
  558. }
  559. // 遮罩层
  560. .renew-wrap {
  561. text-align: center;
  562. .renew-wrap-text {
  563. margin-top: 30upx;
  564. margin-bottom: 60upx;
  565. font-size: 34upx;
  566. }
  567. }
  568. </style>