homePage.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  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 @click="changeShow5()">扫码</view>
  19. <view v-if="false" @click="changeShow2()">修改openId</view>
  20. <view @click="logout()">退出账号</view>
  21. </view>
  22. <view class="qr-code" v-if="false">
  23. <!-- <img src="@/assets/img/riLine-qr-scan-line@1x.png" alt=""> -->
  24. <u-icon name="scan" size="48" color="#fff"></u-icon>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <u-popup v-model="showpopup" class="scanpopo" mode="bottom"
  30. border-radius="14"
  31. :closeable="true" >
  32. <view class="scantitle">连续扫码</view>
  33. <view class="scanlist">
  34. <view class="scan-list-infos" :style="nowscan.healthStatus&&nowscan.healthStatus!=1?'background-color:#FFC107':''">
  35. <view class="scan-infos-head" @click="gotoInfo(nowscan.id)">
  36. <view class="name">
  37. {{nowscan.title?nowscan.title:'扫码后出当前结果'}}
  38. </view>
  39. <view class="name">
  40. 编号:{{nowscan.code}}
  41. <span class="name" v-show="nowscan&&nowscan.id" style="color:blue;">
  42. 点击查看
  43. </span>
  44. </view>
  45. </view>
  46. <view class="scan-infos-head " style="margin-bottom: 12rpx;">
  47. <view class="name" v-html="descriptionKey(nowscan)">
  48. </view>
  49. </view>
  50. <view class="scan-infos">
  51. <!-- <view class="infos-2">
  52. <view class="infos-item">
  53. <view class="item-name">
  54. 规格:
  55. </view>
  56. <view class="item-value">
  57. {{nowscan.specifications}}
  58. </view>
  59. </view>
  60. <view class="infos-item">
  61. <view class="item-name">
  62. 型号:
  63. </view>
  64. <view class="item-value">
  65. {{nowscan.model}}
  66. </view>
  67. </view>
  68. </view> -->
  69. </view>
  70. </view>
  71. </view>
  72. <!-- #ifdef MP-WEIXIN -->
  73. <camera mode="scanCode" resolution='medium'
  74. @scancode="takeCode" v-if="showpopup"
  75. device-position="back" flash="off" @error="error"
  76. style="width: 100%; height: 300px;"></camera>
  77. <!-- #endif -->
  78. </u-popup>
  79. <!-- 宫格 -->
  80. <view class="gird" >
  81. <!-- 公告 -->
  82. <view class="notice" v-if="false" >
  83. <ujp-notice-bar mode="horizontal"
  84. bg-color="#6290f7" color="#fff"
  85. :list="['库存PDA设备将于2023年4月1日升级维护']"></ujp-notice-bar>
  86. <!-- <u-icon name="volume-up-fill" size="40" color="#fff"></u-icon>
  87. <text></text> -->
  88. </view>
  89. <template v-if="role('3')">
  90. <view class="item" @click="gotoUrl('pages/projectDepartment/exportProcess/exportProcess')">
  91. <view class="title">
  92. 出库审核
  93. <u-badge type="error" :absolute="false" style=" position: unset; padding: 2px 3px;" :fontSize="36"
  94. :isCenter="true" :count="badgeGet.outApproveList"></u-badge>
  95. </view>
  96. <view class="hint">
  97. 审批出库申请单据
  98. </view>
  99. <view class="img">
  100. <img src="@/assets/img/projectGird2.png" alt="">
  101. </view>
  102. </view>
  103. <view class="item" @click="gotoUrl('pages/otherFunctions/lendLedger/lendLedger')">
  104. <view class="title">
  105. 借出台账
  106. </view>
  107. <view class="hint">
  108. 查询本项目部借出设备
  109. </view>
  110. <view class="img">
  111. <img src="@/assets/img/projectGird4.png" alt="">
  112. </view>
  113. </view>
  114. </template>
  115. <template v-if="role('2')">
  116. <view class="item" @click="gotoUrl('pages/projectDepartment/exportApplication/exportApplication')">
  117. <view class="title">
  118. 出库申请
  119. </view>
  120. <view class="hint">
  121. 提交出库申请单据
  122. </view>
  123. <view class="img">
  124. <img src="@/assets/img/projectGird1.png" alt="">
  125. </view>
  126. </view>
  127. <view class="item" @click="gotoUrl('pages/projectDepartment/exportReturn/exportReturn')">
  128. <view class="title">
  129. 设备归还
  130. </view>
  131. <view class="hint">
  132. 提交设备归还单据
  133. </view>
  134. <view class="img">
  135. <img src="@/assets/img/projectGird3.png" alt="">
  136. </view>
  137. </view>
  138. </template>
  139. <template v-if="role('1')">
  140. <view class="item" @click="gotoUrl('pages/storeManagement/equipmentDelivery/equipmentDelivery')">
  141. <view class="title">
  142. 设备出库
  143. <u-badge type="error" :absolute="false" style=" position: unset; padding: 2px 3px;" :fontSize="36"
  144. :isCenter="true" :count="badgeGet.outWaitList"></u-badge>
  145. </view>
  146. <view class="hint">
  147. 申请物品登记核准出库
  148. </view>
  149. <view class="img">
  150. <img src="@/assets/img/girdH1.png" alt="">
  151. </view>
  152. </view>
  153. <view class="item" @click="gotoUrl('pages/storeManagement/equipmentEnter/equipmentEnter')">
  154. <view class="title">
  155. 设备入库
  156. <u-badge type="error" :absolute="false" style=" position: unset; padding: 2px 3px;" :fontSize="36"
  157. :isCenter="true" :count="badgeGet.inWaitList"></u-badge>
  158. </view>
  159. <view class="hint">
  160. 申购采购收货入库登记
  161. </view>
  162. <view class="img">
  163. <img src="@/assets/img/girdH2.png" alt="">
  164. </view>
  165. </view>
  166. <view class="item" @click="gotoUrl('pages/storeManagement/equipmentInspection/equipmentInspection')" >
  167. <view class="title">
  168. 设备检验
  169. <u-badge type="error" :absolute="false" style=" position: unset; padding: 2px 3px;" :fontSize="36"
  170. :isCenter="true" :count="badgeGet.deviceList"></u-badge>
  171. </view>
  172. <view class="hint">
  173. 当前物品计量库存盘点
  174. </view>
  175. <view class="img">
  176. <img src="@/assets/img/girdH3.png" alt="">
  177. </view>
  178. </view>
  179. </template>
  180. <view class="item" @click="gotoUrl('pages/otherFunctions/equipmentRetrieval/equipmentRetrieval')">
  181. <view class="title">
  182. 设备检索
  183. </view>
  184. <view class="hint">
  185. 库存物品信息检索
  186. </view>
  187. <view class="img">
  188. <img src="@/assets/img/projectGird4.png" alt="">
  189. </view>
  190. </view>
  191. </view>
  192. <!-- 其他功能 -->
  193. <view class="other-functions" v-if="role('other')">
  194. <view class="title">
  195. 其他功能
  196. </view>
  197. <view class="function-gird">
  198. <view class="item">
  199. <img src="@/assets/img/riLine-file-add-line@1x.png" alt="">
  200. <text>新增检验</text>
  201. </view>
  202. <view class="item">
  203. <img src="@/assets/img/riLine-printer-line@1x.png" alt="">
  204. <text>打印标签</text>
  205. </view>
  206. <view class="item">
  207. <img src="@/assets/img/riLine-spam-line@1x.png" alt="">
  208. <text>故障申报</text>
  209. </view>
  210. <view class="item">
  211. <img src="@/assets/img/riLine-arrow-left-right-line@1x.png" alt="">
  212. <text>设备移交</text>
  213. </view>
  214. </view>
  215. </view>
  216. </view>
  217. </template>
  218. <script>
  219. import * as API from '@/apis/pagejs/index.js'
  220. import ujpNoticeBar from "@/pages/otherFunctions/components/u-notice-bar.vue"
  221. export default {
  222. data() {
  223. return {
  224. scanFunctionIsUseable:true,
  225. nowscan:{
  226. "title": "",
  227. "specifications": "",
  228. "experimentLastTime":"",
  229. "manufactor": "",
  230. "unit": "",
  231. "model": "",
  232. "code": "",
  233. },
  234. showpopup:false,
  235. show:false,
  236. badgeexportProcess:0,
  237. userInfo:{
  238. name:""
  239. },
  240. badgeGet:{
  241. },
  242. badgeList:[
  243. {
  244. url:"/mobile/out/outApproveList",
  245. role:"3",
  246. key:"outApproveList",
  247. page:{
  248. pageIndex: 1,
  249. pageSize: 0,
  250. status: 0,
  251. }
  252. },
  253. {
  254. url:"/mobile/out/outWaitList",
  255. role:"1",
  256. key:"outWaitList",
  257. page:{
  258. pageIndex: 1,
  259. pageSize: 0,
  260. status: 0,
  261. }
  262. },
  263. {
  264. url:"/mobile/in/inWaitList",
  265. role:"1",
  266. key:"inWaitList",
  267. page:{
  268. pageIndex: 1,
  269. pageSize: 0,
  270. status: 0,
  271. }
  272. },
  273. {
  274. url:"/mobile/inspection/deviceList",
  275. role:"1",
  276. key:"deviceList",
  277. page:{
  278. pageIndex: 1,
  279. pageSize: 0,
  280. healthStatus: 5,
  281. }
  282. }
  283. ]
  284. }
  285. },
  286. components:{
  287. ujpNoticeBar
  288. },
  289. onLoad() {
  290. this.userInfo=this.carhelp.getPersonInfo()
  291. //this.getUserDepartmentList()
  292. this.getInfo()
  293. },
  294. onReady() {
  295. // #ifdef MP-WEIXIN
  296. wx.getSetting({
  297. success: res => {
  298. console.log("onReady2")
  299. if (!res.authSetting['scope.camera']) {
  300. wx.authorize({
  301. scope: 'scope.camera',
  302. success () {
  303. // 用户已经同意小程序使用摄像头
  304. },
  305. fail () {
  306. // 用户拒绝了小程序使用摄像头
  307. }
  308. })
  309. }
  310. }
  311. })
  312. // #endif
  313. },
  314. onShow(){
  315. this.badgeGetMethodApi()
  316. },
  317. methods: {
  318. badgeGetMethodApi(){
  319. var tdate=new Date( +new Date() + 8 * 3600 * 1000 ).toJSON().substr(0,15).replace("T"," ")
  320. var token_tdate=this.carhelp.get("badgeGet_token_tdate");//每60分钟存储一次token
  321. if(token_tdate&&token_tdate==tdate){
  322. this.badgeGetMethod();
  323. this.$forceUpdate()
  324. }else{
  325. for(var i in this.badgeList){
  326. var obj=this.badgeList[i]
  327. if(this.role(obj.role)){
  328. this.carhelp.set("badgeGet_token_tdate",tdate);
  329. this.urlgetlisg(obj)
  330. }
  331. }
  332. }
  333. },
  334. urlgetlisg(obj){
  335. API.urlgetlisg(obj.page,obj.url).then((res) => {
  336. var count=res.data.recordsTotal;
  337. this.badgeGet[obj.key]=count;
  338. this.carhelp.set("badgeList_"+obj.key,count)
  339. this.$forceUpdate()
  340. }).catch(error => {
  341. })
  342. },
  343. badgeGetMethod(){
  344. for(var i in this.badgeList){
  345. var obj=this.badgeList[i]
  346. this.badgeGet[obj.key]=this.carhelp.get("badgeList_"+obj.key);
  347. }
  348. },
  349. error(e) {
  350. console.log(e);
  351. },
  352. role(val){
  353. if(this.userInfo.type!=null&&this.userInfo.type!=undefined){
  354. var index=this.userInfo.type.split(',').indexOf(val)
  355. return index>-1
  356. }else{
  357. return false
  358. }
  359. },
  360. getInfo(){
  361. API.findByOpenId({
  362. openId: this.carhelp.getOpenId(),
  363. noerror:true,
  364. }).then((res) => {
  365. this.carhelp.setPersonInfo(res.data.regUser );
  366. this.userInfo=this.carhelp.getPersonInfo()
  367. this.badgeGetMethodApi()
  368. }).catch(error => {
  369. uni.hideLoading();
  370. //this.getPhone()
  371. })
  372. },
  373. logout(){
  374. this.changeShow()
  375. uni.showModal({
  376. title: '提示',
  377. content: '确认是否退出?',
  378. success: res=> {
  379. if (res.confirm) {
  380. //付钱 改为组件
  381. this.logoutApi();
  382. } else if (res.cancel) {
  383. console.log('用户点击取消');
  384. }
  385. }
  386. });
  387. },
  388. logoutApi(){
  389. uni.showLoading({
  390. title: "加载中",
  391. mask: true,
  392. })
  393. var data = {
  394. };
  395. API.logout(data).then((res) => {
  396. this.carhelp.logoff();
  397. uni.redirectTo({
  398. url:"/pages/index/index"
  399. })
  400. }).catch(error => {
  401. uni.showToast({
  402. title: error
  403. })
  404. })
  405. },
  406. changeShow(){
  407. this.show=!this.show
  408. },
  409. changeShow4(openId){
  410. uni.requestSubscribeMessage({
  411. tmplIds: ['YJo0Ji-N--n27fGB41pFVCCvFCNlsJwwScN1mD13Uu4'],
  412. success (res) { }
  413. })
  414. },
  415. changeShow5(){
  416. //this.showpopup=true
  417. //this.gotoscanH5('')
  418. this.gotoscan('')
  419. },
  420. changeShow3(openId){
  421. this.carhelp.setOpenId(openId);
  422. this.carhelp.logoff();
  423. uni.redirectTo({
  424. url:"/pages/index/index"
  425. })
  426. },
  427. changeShow2(){
  428. var _this=this
  429. uni.showModal({
  430. title: '输入openId',
  431. editable: true,
  432. //content: '这是一个模态弹窗',
  433. success: function(res) {
  434. if (res.confirm) {
  435. if(res.content){
  436. _this.changeShow3(res.content)
  437. }
  438. } else if (res.cancel) {
  439. console.log('用户点击取消');
  440. }
  441. }
  442. });
  443. },
  444. gotoscan(val) {
  445. // #ifdef H5
  446. this.gotoscanH5(val)
  447. // #endif
  448. // #ifdef MP-WEIXIN
  449. this.gotoscanMP(val)
  450. // #endif
  451. },
  452. takeCode(e){
  453. console.log(e);
  454. if(this.scanFunctionIsUseable) {
  455. this.scanFunctionIsUseable = false;
  456. // 对扫码结果进行处理
  457. console.log(e.detail.result);
  458. this.getscan(this.takeCodeJp(e.detail.result))
  459. // 扫码间隔两秒
  460. setTimeout(() => {
  461. this.scanFunctionIsUseable = true;
  462. }, 1000)
  463. }
  464. },
  465. gotoscanMP(val){
  466. this.showpopup=true;
  467. // const ctx = uni.createCameraContext();
  468. // ctx.takePhoto({
  469. // quality: 'high',
  470. // success: (res) => {
  471. // this.src = res.tempImagePath
  472. // }
  473. // });
  474. },
  475. getscan(val) {
  476. this.showpopup=true;
  477. uni.showLoading({
  478. title: "加载中",
  479. mask: true,
  480. })
  481. API.queryDeviceByCode({
  482. code: val,
  483. }).then((res) => {
  484. uni.hideLoading();
  485. if (res.data.deviceInfo) {
  486. console.log(res.data.deviceInfo)
  487. this.nowscan=res.data.deviceInfo;
  488. uni.showToast({
  489. title: "添加成功",
  490. icon: "none"
  491. })
  492. } else {
  493. uni.showToast({
  494. title: "二维码无效",
  495. icon: "none"
  496. })
  497. this.nowscan={}
  498. }
  499. }).catch(error => {
  500. uni.showToast({
  501. title: error,
  502. icon: "none"
  503. })
  504. })
  505. },
  506. gotoscanH5(val) {
  507. console.log('111')
  508. var _this = this;
  509. uni.showModal({
  510. title: '提示',
  511. editable: true,
  512. //content: '这是一个模态弹窗',
  513. success: function(res) {
  514. if (res.confirm) {
  515. _this.getscan(res.content)
  516. } else if (res.cancel) {
  517. console.log('用户点击取消');
  518. }
  519. }
  520. });
  521. },
  522. }
  523. }
  524. </script>
  525. <style >
  526. page{
  527. background-color: rgba(1,122,255,1);
  528. padding-bottom: 100rpx;
  529. }
  530. </style>
  531. <style lang="scss" scoped>
  532. .options{
  533. width: 260rpx;
  534. line-height: 60rpx;
  535. //text-align: center;
  536. padding:8rpx 0px 8rpx 16rpx;
  537. background-color: #fff;
  538. color: rgba(65, 80, 88, 1);
  539. font-family: Microsoft Yahei;
  540. position: absolute;
  541. top: 228rpx;
  542. border-radius: 1px;
  543. //right: 24rpx;
  544. box-shadow:5px 5px 10px gray;
  545. }
  546. .headerView{
  547. //background:linear-gradient(180deg, rgba(0,45,194,1) 0%,rgba(0,59,254,1) 49%,rgba(1,122,255,1) 100%);
  548. background-color: rgba(1,122,255,1);
  549. }
  550. page{
  551. background-color: rgba(1,122,255,1);
  552. padding-bottom: 100rpx;
  553. }
  554. // 头部
  555. .header{
  556. width: 100%;
  557. height: 289px;
  558. background:linear-gradient(180deg, rgba(0,45,194,1) 0%,rgba(0,59,254,1) 49%,rgba(1,122,255,1) 100%);
  559. padding: 0 40rpx;
  560. .main{
  561. width: 100%;
  562. height: 100%;
  563. background: url(@/assets/img/background.png) no-repeat;
  564. background-position: top -70rpx right -50rpx;
  565. position: relative;
  566. background-position-y: 20px;
  567. padding-top: 20rpx;
  568. }
  569. .title{
  570. //margin-top: 60px;
  571. padding-top: 60px;
  572. display: flex;
  573. justify-content: space-between;
  574. align-items: center;
  575. color: rgba(255, 255, 255, 1);
  576. line-height: 88rpx;
  577. .name{
  578. display: flex;
  579. font-size: 40rpx;
  580. }
  581. .qr-code{
  582. display: flex;
  583. }
  584. }
  585. }
  586. // 宫格
  587. .gird{
  588. // 公告
  589. .notice{
  590. overflow: hidden;
  591. width: 100%;
  592. display: flex;
  593. align-items: center;
  594. background-color: #6290f7;
  595. color: rgba(255, 255, 255, 1);
  596. font-weight: bold;
  597. border-radius: 8px;
  598. height: 80rpx;
  599. line-height: 80rpx;
  600. padding: 0 24rpx;
  601. // position: absolute;
  602. bottom: 260rpx;
  603. left: 0;
  604. right: 0;
  605. margin-bottom: 40rpx;
  606. text{
  607. font-size: 28rpx;
  608. width: 542px;
  609. margin-left: 16rpx;
  610. white-space: nowrap;
  611. overflow: hidden;
  612. text-overflow: ellipsis;
  613. }
  614. }
  615. padding: 0 40rpx;
  616. display: flex;
  617. justify-content: space-between;
  618. flex-wrap: wrap;
  619. margin-top: -124rpx;
  620. .item{
  621. width: 720rpx;
  622. height: 100px;
  623. background-color: rgba(255, 255, 255, 1);
  624. border-radius: 8px;
  625. padding: 32rpx 24rpx;
  626. position: relative;
  627. margin-bottom: 30rpx;
  628. .title{
  629. color: rgba(16, 16, 16, 1);
  630. font-size: 44rpx;
  631. margin-bottom: 8rpx;
  632. font-family: 'Alibaba-PuHuiTi-Regular';
  633. }
  634. .hint{
  635. color: rgba(106, 121, 142, 1);
  636. font-size: 32rpx;
  637. margin-bottom: 44rpx;
  638. }
  639. .img{
  640. width: 75px;
  641. height: 75px;
  642. position: absolute;
  643. right: 24rpx;
  644. bottom: 24rpx;
  645. img{
  646. width: 100%;
  647. height: 100%;
  648. }
  649. }
  650. }
  651. }
  652. // 其他功能
  653. .other-functions{
  654. padding: 0 40rpx;
  655. .title{
  656. color: rgba(255, 255, 255, 1);
  657. font-size: 36rpx;
  658. margin-bottom: 16rpx;
  659. }
  660. .function-gird{
  661. display: flex;
  662. flex-wrap: wrap;
  663. justify-content: space-between;
  664. .item{
  665. display: flex;
  666. align-items: center;
  667. justify-content: center;
  668. width: 320rpx;
  669. height: 80rpx;
  670. line-height: 80rpx;
  671. margin-bottom: 24rpx;
  672. color: rgba(255, 255, 255, 1);
  673. border-radius: 8px;
  674. background-color: rgba(255, 255, 255, 0.25);
  675. text-align: center;
  676. border: 1px solid rgba(255, 255, 255, 0.35);
  677. img{
  678. width: 32rpx;
  679. height: 32rpx;
  680. margin-right: 8rpx;
  681. }
  682. }
  683. }
  684. }
  685. </style>