homePage.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. <template>
  2. <view class="headerView">
  3. <u-navbar title="首页" v-show="false"></u-navbar>
  4. <!-- 头部 -->
  5. <view class="header">
  6. <view class="main">
  7. <view class="title">
  8. <view class="name" @click="changeShow()">
  9. <view class="text">
  10. 你好,{{userInfo.name}}!
  11. </view>
  12. <view class="icon">
  13. <u-icon name='arrow-down' color="#fff" size="28"></u-icon>
  14. </view>
  15. </view>
  16. <view class="options" v-if="show==true" >
  17. <view v-if="false" @click="changeShow4()">订阅</view>
  18. <view v-if="false" @click="changeShow2()">修改openId</view>
  19. <view @click="logout()">退出账号</view>
  20. </view>
  21. <view class="qr-code" v-if="false">
  22. <!-- <img src="@/assets/img/riLine-qr-scan-line@1x.png" alt=""> -->
  23. <u-icon name="scan" size="48" color="#fff"></u-icon>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 宫格 -->
  29. <view class="gird" >
  30. <!-- 公告 -->
  31. <view class="notice" v-if="false" >
  32. <ujp-notice-bar mode="horizontal"
  33. bg-color="#6290f7" color="#fff"
  34. :list="['库存PDA设备将于2023年4月1日升级维护']"></ujp-notice-bar>
  35. <!-- <u-icon name="volume-up-fill" size="40" color="#fff"></u-icon>
  36. <text></text> -->
  37. </view>
  38. <template v-if="role('3')">
  39. <view class="item" @click="gotoUrl('pages/projectDepartment/exportProcess/exportProcess')">
  40. <view class="title">
  41. 出库审核
  42. <u-badge type="error" style=" position: unset; padding: 2px 3px;" :fontSize="36"
  43. :isCenter="true" :count="badgeGet.outApproveList"></u-badge>
  44. </view>
  45. <view class="hint">
  46. 审批出库申请单据
  47. </view>
  48. <view class="img">
  49. <img src="@/assets/img/projectGird2.png" alt="">
  50. </view>
  51. </view>
  52. </template>
  53. <template v-if="role('2')">
  54. <view class="item" @click="gotoUrl('pages/projectDepartment/exportApplication/exportApplication')">
  55. <view class="title">
  56. 出库申请
  57. </view>
  58. <view class="hint">
  59. 提交出库申请单据
  60. </view>
  61. <view class="img">
  62. <img src="@/assets/img/projectGird1.png" alt="">
  63. </view>
  64. </view>
  65. <view class="item" @click="gotoUrl('pages/projectDepartment/exportReturn/exportReturn')">
  66. <view class="title">
  67. 设备归还
  68. </view>
  69. <view class="hint">
  70. 提交设备归还单据
  71. </view>
  72. <view class="img">
  73. <img src="@/assets/img/projectGird3.png" alt="">
  74. </view>
  75. </view>
  76. </template>
  77. <template v-if="role('1')">
  78. <view class="item" @click="gotoUrl('pages/storeManagement/equipmentDelivery/equipmentDelivery')">
  79. <view class="title">
  80. 设备出库
  81. <u-badge type="error" style=" position: unset; padding: 2px 3px;" :fontSize="36"
  82. :isCenter="true" :count="badgeGet.outWaitList"></u-badge>
  83. </view>
  84. <view class="hint">
  85. 申请物品登记核准出库
  86. </view>
  87. <view class="img">
  88. <img src="@/assets/img/girdH1.png" alt="">
  89. </view>
  90. </view>
  91. <view class="item" @click="gotoUrl('pages/storeManagement/equipmentEnter/equipmentEnter')">
  92. <view class="title">
  93. 设备入库
  94. <u-badge type="error" style=" position: unset; padding: 2px 3px;" :fontSize="36"
  95. :isCenter="true" :count="badgeGet.inWaitList"></u-badge>
  96. </view>
  97. <view class="hint">
  98. 申购采购收货入库登记
  99. </view>
  100. <view class="img">
  101. <img src="@/assets/img/girdH2.png" alt="">
  102. </view>
  103. </view>
  104. <view class="item" @click="gotoUrl('pages/storeManagement/equipmentInspection/equipmentInspection')" >
  105. <view class="title">
  106. 设备巡检
  107. <u-badge type="error" style=" position: unset; padding: 2px 3px;" :fontSize="36"
  108. :isCenter="true" :count="badgeGet.deviceList"></u-badge>
  109. </view>
  110. <view class="hint">
  111. 当前物品计量库存盘点
  112. </view>
  113. <view class="img">
  114. <img src="@/assets/img/girdH3.png" alt="">
  115. </view>
  116. </view>
  117. </template>
  118. <view class="item" @click="gotoUrl('pages/otherFunctions/equipmentRetrieval/equipmentRetrieval')">
  119. <view class="title">
  120. 设备检索
  121. </view>
  122. <view class="hint">
  123. 库存物品信息检索
  124. </view>
  125. <view class="img">
  126. <img src="@/assets/img/projectGird4.png" alt="">
  127. </view>
  128. </view>
  129. </view>
  130. <!-- 其他功能 -->
  131. <view class="other-functions" v-if="role('other')">
  132. <view class="title">
  133. 其他功能
  134. </view>
  135. <view class="function-gird">
  136. <view class="item">
  137. <img src="@/assets/img/riLine-file-add-line@1x.png" alt="">
  138. <text>新增巡检</text>
  139. </view>
  140. <view class="item">
  141. <img src="@/assets/img/riLine-printer-line@1x.png" alt="">
  142. <text>打印标签</text>
  143. </view>
  144. <view class="item">
  145. <img src="@/assets/img/riLine-spam-line@1x.png" alt="">
  146. <text>故障申报</text>
  147. </view>
  148. <view class="item">
  149. <img src="@/assets/img/riLine-arrow-left-right-line@1x.png" alt="">
  150. <text>设备移交</text>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </template>
  156. <script>
  157. import * as API from '@/apis/pagejs/index.js'
  158. import ujpNoticeBar from "@/pages/otherFunctions/components/u-notice-bar.vue"
  159. export default {
  160. data() {
  161. return {
  162. show:false,
  163. badgeexportProcess:0,
  164. userInfo:{
  165. name:""
  166. },
  167. badgeGet:{
  168. },
  169. badgeList:[
  170. {
  171. url:"/mobile/out/outApproveList",
  172. role:"3",
  173. key:"outApproveList",
  174. page:{
  175. pageIndex: 1,
  176. pageSize: 0,
  177. status: 0,
  178. }
  179. },
  180. {
  181. url:"/mobile/out/outWaitList",
  182. role:"1",
  183. key:"outWaitList",
  184. page:{
  185. pageIndex: 1,
  186. pageSize: 0,
  187. status: 0,
  188. }
  189. },
  190. {
  191. url:"/mobile/in/inWaitList",
  192. role:"1",
  193. key:"inWaitList",
  194. page:{
  195. pageIndex: 1,
  196. pageSize: 0,
  197. status: 0,
  198. }
  199. },
  200. {
  201. url:"/mobile/inspection/deviceList",
  202. role:"1",
  203. key:"deviceList",
  204. page:{
  205. pageIndex: 1,
  206. pageSize: 0,
  207. healthStatus: 5,
  208. }
  209. }
  210. ]
  211. }
  212. },
  213. components:{
  214. ujpNoticeBar
  215. },
  216. onLoad() {
  217. this.userInfo=this.carhelp.getPersonInfo()
  218. //this.getUserDepartmentList()
  219. this.getInfo()
  220. },
  221. onReady() {
  222. // #ifdef MP-WEIXIN
  223. wx.getSetting({
  224. success: res => {
  225. console.log("onReady2")
  226. if (!res.authSetting['scope.camera']) {
  227. wx.authorize({
  228. scope: 'scope.camera',
  229. success () {
  230. // 用户已经同意小程序使用摄像头
  231. },
  232. fail () {
  233. // 用户拒绝了小程序使用摄像头
  234. }
  235. })
  236. }
  237. }
  238. })
  239. // #endif
  240. },
  241. onShow(){
  242. this.badgeGetMethodApi()
  243. },
  244. methods: {
  245. badgeGetMethodApi(){
  246. var tdate=new Date( +new Date() + 8 * 3600 * 1000 ).toJSON().substr(0,15).replace("T"," ")
  247. var token_tdate=this.carhelp.get("badgeGet_token_tdate");//每60分钟存储一次token
  248. if(token_tdate&&token_tdate==tdate){
  249. this.badgeGetMethod();
  250. this.$forceUpdate()
  251. }else{
  252. for(var i in this.badgeList){
  253. var obj=this.badgeList[i]
  254. console.log(this.role(obj.role),obj.role)
  255. if(this.role(obj.role)){
  256. this.carhelp.set("badgeGet_token_tdate",tdate);
  257. this.urlgetlisg(obj)
  258. }
  259. }
  260. }
  261. },
  262. urlgetlisg(obj){
  263. API.urlgetlisg(obj.page,obj.url).then((res) => {
  264. var count=res.data.recordsTotal;
  265. this.badgeGet[obj.key]=count;
  266. this.carhelp.set("badgeList_"+obj.key,count)
  267. this.$forceUpdate()
  268. }).catch(error => {
  269. })
  270. },
  271. badgeGetMethod(){
  272. for(var i in this.badgeList){
  273. var obj=this.badgeList[i]
  274. this.badgeGet[obj.key]=this.carhelp.get("badgeList_"+obj.key);
  275. }
  276. },
  277. error(e) {
  278. console.log(e);
  279. },
  280. role(val){
  281. if(this.userInfo.type!=null&&this.userInfo.type!=undefined){
  282. var index=this.userInfo.type.split(',').indexOf(val)
  283. return index>-1
  284. }else{
  285. return false
  286. }
  287. },
  288. getInfo(){
  289. API.findByOpenId({
  290. openId: this.carhelp.getOpenId(),
  291. noerror:true,
  292. }).then((res) => {
  293. this.carhelp.setPersonInfo(res.data.regUser );
  294. this.userInfo=this.carhelp.getPersonInfo()
  295. this.badgeGetMethodApi()
  296. }).catch(error => {
  297. uni.hideLoading();
  298. //this.getPhone()
  299. })
  300. },
  301. logout(){
  302. this.changeShow()
  303. uni.showModal({
  304. title: '提示',
  305. content: '确认是否退出?',
  306. success: res=> {
  307. if (res.confirm) {
  308. //付钱 改为组件
  309. this.logoutApi();
  310. } else if (res.cancel) {
  311. console.log('用户点击取消');
  312. }
  313. }
  314. });
  315. },
  316. logoutApi(){
  317. uni.showLoading({
  318. title: "加载中",
  319. mask: true,
  320. })
  321. var data = {
  322. };
  323. API.logout(data).then((res) => {
  324. this.carhelp.logoff();
  325. uni.redirectTo({
  326. url:"/pages/index/index"
  327. })
  328. }).catch(error => {
  329. uni.showToast({
  330. title: error
  331. })
  332. })
  333. },
  334. changeShow(){
  335. this.show=!this.show
  336. },
  337. changeShow4(openId){
  338. uni.requestSubscribeMessage({
  339. tmplIds: ['YJo0Ji-N--n27fGB41pFVCCvFCNlsJwwScN1mD13Uu4'],
  340. success (res) { }
  341. })
  342. },
  343. changeShow3(openId){
  344. this.carhelp.setOpenId(openId);
  345. this.carhelp.logoff();
  346. uni.redirectTo({
  347. url:"/pages/index/index"
  348. })
  349. },
  350. changeShow2(){
  351. var _this=this
  352. uni.showModal({
  353. title: '输入openId',
  354. editable: true,
  355. //content: '这是一个模态弹窗',
  356. success: function(res) {
  357. if (res.confirm) {
  358. if(res.content){
  359. _this.changeShow3(res.content)
  360. }
  361. } else if (res.cancel) {
  362. console.log('用户点击取消');
  363. }
  364. }
  365. });
  366. }
  367. }
  368. }
  369. </script>
  370. <style >
  371. page{
  372. background-color: rgba(1,122,255,1);
  373. padding-bottom: 100rpx;
  374. }
  375. </style>
  376. <style lang="scss" scoped>
  377. .options{
  378. width: 260rpx;
  379. line-height: 60rpx;
  380. //text-align: center;
  381. padding:8rpx 0px 8rpx 16rpx;
  382. background-color: #fff;
  383. color: rgba(65, 80, 88, 1);
  384. font-family: Microsoft Yahei;
  385. position: absolute;
  386. top: 228rpx;
  387. border-radius: 1px;
  388. //right: 24rpx;
  389. box-shadow:5px 5px 10px gray;
  390. }
  391. .headerView{
  392. //background:linear-gradient(180deg, rgba(0,45,194,1) 0%,rgba(0,59,254,1) 49%,rgba(1,122,255,1) 100%);
  393. background-color: rgba(1,122,255,1);
  394. }
  395. page{
  396. background-color: rgba(1,122,255,1);
  397. padding-bottom: 100rpx;
  398. }
  399. // 头部
  400. .header{
  401. width: 100%;
  402. height: 289px;
  403. background:linear-gradient(180deg, rgba(0,45,194,1) 0%,rgba(0,59,254,1) 49%,rgba(1,122,255,1) 100%);
  404. padding: 0 40rpx;
  405. .main{
  406. width: 100%;
  407. height: 100%;
  408. background: url(@/assets/img/background.png) no-repeat;
  409. background-position: top -70rpx right -50rpx;
  410. position: relative;
  411. background-position-y: 20px;
  412. padding-top: 20rpx;
  413. }
  414. .title{
  415. //margin-top: 60px;
  416. padding-top: 60px;
  417. display: flex;
  418. justify-content: space-between;
  419. align-items: center;
  420. color: rgba(255, 255, 255, 1);
  421. line-height: 88rpx;
  422. .name{
  423. display: flex;
  424. font-size: 40rpx;
  425. }
  426. .qr-code{
  427. display: flex;
  428. }
  429. }
  430. }
  431. // 宫格
  432. .gird{
  433. // 公告
  434. .notice{
  435. overflow: hidden;
  436. width: 100%;
  437. display: flex;
  438. align-items: center;
  439. background-color: #6290f7;
  440. color: rgba(255, 255, 255, 1);
  441. font-weight: bold;
  442. border-radius: 8px;
  443. height: 80rpx;
  444. line-height: 80rpx;
  445. padding: 0 24rpx;
  446. // position: absolute;
  447. bottom: 260rpx;
  448. left: 0;
  449. right: 0;
  450. margin-bottom: 40rpx;
  451. text{
  452. font-size: 28rpx;
  453. width: 542px;
  454. margin-left: 16rpx;
  455. white-space: nowrap;
  456. overflow: hidden;
  457. text-overflow: ellipsis;
  458. }
  459. }
  460. padding: 0 40rpx;
  461. display: flex;
  462. justify-content: space-between;
  463. flex-wrap: wrap;
  464. margin-top: -124rpx;
  465. .item{
  466. width: 720rpx;
  467. height: 100px;
  468. background-color: rgba(255, 255, 255, 1);
  469. border-radius: 8px;
  470. padding: 32rpx 24rpx;
  471. position: relative;
  472. margin-bottom: 30rpx;
  473. .title{
  474. color: rgba(16, 16, 16, 1);
  475. font-size: 44rpx;
  476. margin-bottom: 8rpx;
  477. font-family: 'Alibaba-PuHuiTi-Regular';
  478. }
  479. .hint{
  480. color: rgba(106, 121, 142, 1);
  481. font-size: 32rpx;
  482. margin-bottom: 44rpx;
  483. }
  484. .img{
  485. width: 75px;
  486. height: 75px;
  487. position: absolute;
  488. right: 24rpx;
  489. bottom: 24rpx;
  490. img{
  491. width: 100%;
  492. height: 100%;
  493. }
  494. }
  495. }
  496. }
  497. // 其他功能
  498. .other-functions{
  499. padding: 0 40rpx;
  500. .title{
  501. color: rgba(255, 255, 255, 1);
  502. font-size: 36rpx;
  503. margin-bottom: 16rpx;
  504. }
  505. .function-gird{
  506. display: flex;
  507. flex-wrap: wrap;
  508. justify-content: space-between;
  509. .item{
  510. display: flex;
  511. align-items: center;
  512. justify-content: center;
  513. width: 320rpx;
  514. height: 80rpx;
  515. line-height: 80rpx;
  516. margin-bottom: 24rpx;
  517. color: rgba(255, 255, 255, 1);
  518. border-radius: 8px;
  519. background-color: rgba(255, 255, 255, 0.25);
  520. text-align: center;
  521. border: 1px solid rgba(255, 255, 255, 0.35);
  522. img{
  523. width: 32rpx;
  524. height: 32rpx;
  525. margin-right: 8rpx;
  526. }
  527. }
  528. }
  529. }
  530. </style>