index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. <template>
  2. <view class="home-wrap">
  3. <view class="home-title">
  4. <view class="title-bac">
  5. <view class="roomt">
  6. <span class="rom-spn">当前所在机构</span>
  7. <image class="quit-spn" @click.stop="loginOff()" src="../../static/logout.svg"></image>
  8. </view>
  9. <view class="rom-set">
  10. <image class="park" src="../../static/iconPark.svg"></image>
  11. <view class="houseName">
  12. <view>{{ instData.spdName }}</view>
  13. </view>
  14. </view>
  15. <view class="section-view">
  16. <view class="user-cont">
  17. <span class="user-spn">欢迎</span>
  18. <span class="user-spn spnr">{{userData.userName}}</span>
  19. </view>
  20. <view class="sec-data">
  21. <view class="sec-item">
  22. <span class="item-spn spnVal">{{ romDetData.unAcpNum }}</span>
  23. <span class="item-spn" v-if="fromHome==true">{{ userType=='mcs'?instData.wslnum:instData.unAcpNum }}</span>
  24. <span class="item-spn" v-else>{{ durginstData.unAcpNum }}</span>
  25. </view>
  26. <view class="sec-item">
  27. <span class="item-spn spnVal">{{ romDetData.unStoOutNum }}</span>
  28. <span class="item-spn" v-if="fromHome==true">{{ userType=='mcs'?instData.wcknum:instData.unStoOutNum }}</span>
  29. <span class="item-spn" v-else>{{ durginstData.unStoOutNum }}</span>
  30. </view>
  31. <view class="sec-item">
  32. <span class="item-spn spnVal">{{ romDetData.unRetnNum }}</span>
  33. <span class="item-spn" v-if="fromHome==true">{{ userType=='mcs'?instData.wqrnum:instData.unRetnNum }}</span>
  34. <span class="item-spn" v-else>{{ durginstData.unRetnNum }}</span>
  35. </view>
  36. <view class="sec-item">
  37. <span class="item-spn spnVal">{{ romDetData.sumPurcNum }}</span>
  38. <span class="item-spn" v-if="fromHome==true">{{ userType=='mcs'?instData.cgdcx:instData.sumPurcNum }}</span>
  39. <span class="item-spn" v-else>{{ durginstData.sumPurcNum }}</span>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="message-view">
  44. <view class="all-message" @click.stop="allMessage()">
  45. 全部消息 >>
  46. </view>
  47. <view>
  48. <view class="message-item" v-for="(item,index) in msData" :key="index">
  49. <view class="item-mesage" v-html="messItem(item)">
  50. </view>
  51. <view class="fot-btn" @click="jumpDetails(item)">
  52. 查看详情>>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="all-app">
  58. <view class="all-title">
  59. 全部应用
  60. </view>
  61. <view class="all-app-view">
  62. <view class="app-view-item" v-for="(item,index) in appData[userType]" :key="index">
  63. <view class="app-item-img" :style="{background: item.bgColor}" @click.stop="appView(item)">
  64. <image class="app-item-svg" :src="item.iconUrl">
  65. </image>
  66. </view>
  67. <view class="app-item-text">
  68. {{item.name}}
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. mapState,
  80. mapMutations,
  81. mapActions
  82. } from 'vuex';
  83. export default {
  84. components: {},
  85. computed: {
  86. ...mapState(['houseData', 'houseSelectData', 'userData', 'homeAwaitData', 'messData', 'instData']),
  87. },
  88. data() {
  89. return {
  90. listData: [],
  91. msData: [],
  92. outRoom: "请选择仓库",
  93. romDetData: {},
  94. durginstData: {
  95. unAcpNum:"",
  96. unStoOutNum:"",
  97. unRetnNum:"",
  98. sumPurcNum:"",
  99. },
  100. userType: "mcs",
  101. appData: {
  102. drug: [],
  103. mcs: []
  104. },
  105. fromHome: false
  106. }
  107. },
  108. onLoad() {
  109. },
  110. onShow() {
  111. let userType = uni.getStorageSync('userType') || "mcs";
  112. this.userType = userType;
  113. this.fromHome = uni.getStorageSync('fromHome') === '1';
  114. },
  115. mounted() {
  116. this.setInst();
  117. this.getUserData({
  118. sysType: "2"
  119. }).then(res => {
  120. if (res && res.data) {
  121. let menus;
  122. if (this.fromHome === false) {
  123. menus = res.data.permission.weChatMenus;
  124. } else if(this.fromHome === true){
  125. menus = res.data.permission.menus.filter(menu => menu.menuLoc === "wechat");
  126. }
  127. const menuList = menus.map(menu => ({
  128. iconUrl: "../../static/shangjia.svg",
  129. name: menu.menuName,
  130. path: menu.component,
  131. bgColor: '#F4CE98'
  132. }));
  133. if (this.userType === 'mcs') {
  134. this.appData.mcs = menuList;
  135. this.romDetData = {
  136. unAcpNum: '待受理',
  137. unStoOutNum: '待出库',
  138. unRetnNum: "待退货",
  139. sumPurcNum: "采购单"
  140. };
  141. } else if (this.userType === 'drug') {
  142. this.appData.drug = menuList;
  143. this.romDetData = {
  144. unAcpNum: '待审批',
  145. unStoOutNum: '待验收',
  146. unRetnNum: "待退货",
  147. sumPurcNum: "采购单"
  148. };
  149. }
  150. if (this.fromHome == false) {
  151. this.getMenu();
  152. }
  153. }
  154. });
  155. },
  156. watch: {
  157. messData(newOld) {
  158. }
  159. },
  160. methods: {
  161. ...mapActions(['getHouseData', 'getUserData', 'getHomeAwaitData', 'getMessData']),
  162. ...mapMutations(['setHouseName', 'setInst']),
  163. onPullDownRefresh() {
  164. this.setInst();
  165. this.getUserData({
  166. sysType: "2"
  167. });
  168. setTimeout(function() {
  169. uni.stopPullDownRefresh(); //停止下拉刷新动画
  170. }, 1000);
  171. },
  172. //跳转页面
  173. appView(item) {
  174. console.log(item.path);
  175. uni.navigateTo({
  176. url: item.path,
  177. success: function(res) {}
  178. });
  179. },
  180. //退出当前账号
  181. dialogConfirm() {
  182. uni.redirectTo({
  183. url: '/pages/login/index',
  184. success: function(res) {}
  185. });
  186. uni.removeStorageSync('token');
  187. },
  188. dialogClose() {
  189. this.$refs.message.close();
  190. },
  191. //退出确认
  192. loginOff() {
  193. uni.removeStorageSync('fromHome');
  194. uni.redirectTo({
  195. url: '/subpkg/pages/home/home',
  196. success: function(res) {}
  197. });
  198. },
  199. //跳转更多页面
  200. moreView() {
  201. uni.navigateTo({
  202. url: '/pages/grounding/grounding',
  203. success: function(res) {}
  204. });
  205. },
  206. dateChange(slectd) {
  207. this.getDataList({
  208. type: slectd[0][0].value
  209. });
  210. },
  211. // 获取数据
  212. getDataList(data) {
  213. this.getGroundData(data);
  214. },
  215. jumpDetails(item) {
  216. this.$http('home.readData', [{
  217. id: item.id,
  218. msgStas: "1"
  219. }], '加载中', true).then((res) => {
  220. if (res.success == true) {
  221. }
  222. })
  223. // this.$http(item.msgColumnList[0].url, {
  224. // [item.msgColumnList[0].msgKey]: item.msgColumnList[0].msgColumn
  225. // }, '加载中', true).then((res) => {
  226. // if (res.success == true) {
  227. // uni.setStorage({
  228. // key: item.msgColumnList[0].msgRoutePath,
  229. // data: res.data.records[0] || {}
  230. // });
  231. // uni.navigateTo({
  232. // url: `/pages/${item.msgColumnList[0].msgRoutePath}/index`,
  233. // success: function(res) {
  234. // console.log(res, "res")
  235. // }
  236. // });
  237. // }
  238. // })
  239. },
  240. getMenu(){
  241. this.$http('home.getMenuPartCnt', {}, "加载中").then(res => {
  242. if (res && res.data) {
  243. this.durginstData.unAcpNum = res.data.planWaitApprSum;
  244. this.durginstData.unStoOutNum = res.data.stoinWaitSum;
  245. this.durginstData.sumPurcNum = res.data.ordSum;
  246. }
  247. });
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss" scoped>
  253. .home-wrap {
  254. width: 100%;
  255. height: 100%;
  256. background-color: #F5F5F5;
  257. .home-title {
  258. width: 100%;
  259. height: auto;
  260. .title-bac {
  261. width: 100%;
  262. height: 392rpx;
  263. border-radius: 0rpx 0rpx 40rpx 40rpx;
  264. background: linear-gradient(180deg, rgba(1, 169, 146, 1) 0%, rgba(1, 176, 164, 0.54) 46%, rgba(2, 181, 176, 0.24) 100%, rgba(2, 185, 185, 0) 100%);
  265. padding: 20rpx;
  266. box-sizing: border-box;
  267. .roomt {
  268. width: 100%;
  269. height: 70rpx;
  270. display: flex;
  271. align-items: center;
  272. justify-content: space-between;
  273. .rom-spn {
  274. color: rgba(255, 255, 255, 0.9);
  275. font-size: 36rpx;
  276. text-align: left;
  277. font-family: PingFangSC-bold;
  278. }
  279. .quit-spn {
  280. width: 48rpx;
  281. height: 48rpx;
  282. background-size: 100% 100%;
  283. }
  284. }
  285. .rom-set {
  286. width: 100%;
  287. height: 50rpx;
  288. display: flex;
  289. align-items: center;
  290. .park {
  291. width: 40rpx;
  292. height: 40rpx;
  293. background-size: 100% 100%;
  294. }
  295. .houseName {
  296. color: rgba(255, 255, 255, 0.9);
  297. font-size: 36rpx;
  298. text-align: left;
  299. font-family: OPPOSans-medium;
  300. margin-left: 20rpx;
  301. .romtitle {
  302. font-size: 36rpx;
  303. font-family: OPPOSans-medium;
  304. }
  305. .c-flex-align {
  306. display: flex;
  307. align-items: center;
  308. color: #fff;
  309. }
  310. .icon-triangle {
  311. width: 16rpx;
  312. height: 16rpx;
  313. margin-left: 10rpx;
  314. }
  315. }
  316. .down {
  317. width: 40rpx;
  318. height: 40rpx;
  319. background: url('../../static/down.svg');
  320. background-size: 100% 100%;
  321. margin-left: 20rpx;
  322. }
  323. }
  324. .section-view {
  325. width: 97%;
  326. margin: 70rpx auto 40rpx auto;
  327. height: 270rpx;
  328. background-color: rgba(255, 255, 255, 1);
  329. box-shadow: -2rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.4);
  330. border-radius: 20rpx;
  331. padding: 20rpx;
  332. box-sizing: border-box;
  333. .user-cont {
  334. width: 100%;
  335. height: 50rpx;
  336. .user-spn {
  337. color: rgba(0, 0, 0, 0.8);
  338. font-size: 36rpx;
  339. font-family: AlibabaPuHui-medium;
  340. }
  341. .spnr {
  342. margin-left: 20rpx;
  343. font-size: 35rpx;
  344. font-family: AlibabaPuHui-medium;
  345. }
  346. }
  347. .sec-data {
  348. width: 100%;
  349. height: 110rpx;
  350. display: flex;
  351. justify-content: space-around;
  352. margin-top: 60rpx;
  353. .sec-item {
  354. width: 130rpx;
  355. height: 100%;
  356. display: flex;
  357. flex-direction: column;
  358. align-items: center;
  359. justify-content: space-between;
  360. .item-spn {
  361. font-size: 32rpx;
  362. font-family: PingFangSC-bold;
  363. }
  364. .spnVal {
  365. color: rgba(7, 190, 167, 1);
  366. }
  367. }
  368. }
  369. }
  370. .message-view {
  371. width: 100%;
  372. margin-top: 20rpx;
  373. position: relative;
  374. padding-top: 20rpx;
  375. margin-bottom: 20rpx;
  376. .all-message {
  377. position: absolute;
  378. right: 0rpx;
  379. top: 5rpx;
  380. width: 117rpx;
  381. height: 20rpx;
  382. color: rgba(1, 169, 146, 1);
  383. font-size: 20rpx;
  384. font-family: AlibabaPuHui-regular;
  385. display: flex;
  386. align-items: center;
  387. }
  388. .message-item {
  389. margin-top: 20rpx;
  390. width: 100%;
  391. height: 50rpx;
  392. border-radius: 25rpx;
  393. display: flex;
  394. justify-content: space-between;
  395. align-items: center;
  396. padding: 0 20rpx;
  397. box-sizing: border-box;
  398. color: rgba(0, 0, 0, 0.8);
  399. font-size: 20rpx;
  400. text-align: left;
  401. font-family: AlibabaPuHui-regular;
  402. background-color: rgba(255, 255, 255, 1);
  403. box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.4);
  404. .item-mesage {
  405. overflow: hidden;
  406. white-space: nowrap;
  407. text-overflow: ellipsis;
  408. }
  409. .fot-btn {
  410. width: 170rpx;
  411. margin-left: 20rpx;
  412. }
  413. }
  414. }
  415. .all-app {
  416. width: 100%;
  417. .all-title {
  418. width: 100%;
  419. height: 46rpx;
  420. color: rgba(0, 0, 0, 0.8);
  421. font-size: 32rpx;
  422. text-align: left;
  423. font-family: AlibabaPuHui-bold;
  424. }
  425. .all-app-view {
  426. margin-top: 20rpx;
  427. width: 100%;
  428. height: auto;
  429. background-color: #fff;
  430. border-radius: 20rpx;
  431. display: flex;
  432. flex-wrap: wrap;
  433. align-content: flex-start;
  434. padding-bottom: 50rpx;
  435. .app-view-item {
  436. width: 24%;
  437. margin-left: 7rpx;
  438. height: 150rpx;
  439. display: flex;
  440. flex-direction: column;
  441. align-items: center;
  442. margin-top: 20rpx;
  443. margin-bottom: 20rpx;
  444. justify-content: space-between;
  445. .app-item-img {
  446. width: 102rpx;
  447. height: 102rpx;
  448. border-radius: 20rpx;
  449. display: flex;
  450. align-items: center;
  451. justify-content: center;
  452. .app-item-svg {
  453. width: 80rpx;
  454. height: 80rpx;
  455. background-size: 100% 100%;
  456. }
  457. }
  458. .app-item-text {
  459. width: 100%;
  460. height: 34rpx;
  461. color: rgba(0, 0, 0, 0.8);
  462. font-size: 28rpx;
  463. text-align: center;
  464. font-family: AlibabaPuHui-bold;
  465. }
  466. }
  467. }
  468. }
  469. }
  470. }
  471. }
  472. uni-page-body {
  473. width: 100%;
  474. height: 100%;
  475. }
  476. uni-page-wrapper {
  477. width: 100%;
  478. height: 100%;
  479. }
  480. uni-page {
  481. width: 100%;
  482. height: 100%;
  483. }
  484. </style>