homePage.vue 11 KB

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