deliveryFrom.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. <template>
  2. <view >
  3. <u-navbar title="申请归还">
  4. <view class="details" slot="bottom">
  5. <view class="list">
  6. <view class="list-head" style="margin-bottom: 3px;">
  7. <view class="title">
  8. 出库设备清单
  9. </view>
  10. <view class="amount" @click="gotoscan('')">
  11. <u-icon name="scan" color="#0051ff" ></u-icon>扫码识别
  12. </view>
  13. </view>
  14. <view class="list-head">
  15. <view class="title">
  16. 所属项目<span style="color: red;">*</span>
  17. </view>
  18. <view class="amount" >
  19. <u-input style="border-bottom: 1px solid;"
  20. v-model="form.projectName" placeholder="请输入所属项目" type="text" />
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 出库单详情 -->
  25. </view>
  26. </u-navbar>
  27. <u-popup v-model="showpopup" class="" mode="bottom"
  28. border-radius="14"
  29. :closeable="true" >
  30. <view class="scantitle">连续扫码</view>
  31. <view class="list">
  32. <view class=" list-infos">
  33. <view class="infos-head">
  34. <view class="name">
  35. {{nowscan.title?nowscan.title:'扫码后出当前结果'}}
  36. </view>
  37. <view class="name">
  38. 编号:{{nowscan.code}}
  39. </view>
  40. </view>
  41. <view class="infos-head infos-head2" style="margin-bottom: 12rpx;">
  42. <view class="name">
  43. 上次巡检:{{nowscan.experimentLastTime}}
  44. </view>
  45. <view class="name" v-show="nowscan.experimentPeriod">
  46. 周期:{{nowscan.experimentPeriod}}天
  47. </view>
  48. </view>
  49. <view class="infos">
  50. <view class="infos-1">
  51. <view class="infos-item">
  52. <view class="item-name">
  53. 厂家:
  54. </view>
  55. <view class="item-value">
  56. {{nowscan.manufactor}}
  57. </view>
  58. </view>
  59. <view class="infos-item">
  60. <view class="item-name">
  61. 单位:
  62. </view>
  63. <view class="item-value">
  64. {{nowscan.unit}}
  65. </view>
  66. </view>
  67. </view>
  68. <view class="infos-2">
  69. <view class="infos-item">
  70. <view class="item-name">
  71. 规格:
  72. </view>
  73. <view class="item-value">
  74. {{nowscan.specifications}}
  75. </view>
  76. </view>
  77. <view class="infos-item">
  78. <view class="item-name">
  79. 型号:
  80. </view>
  81. <view class="item-value">
  82. {{nowscan.model}}
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <camera mode="scanCode" resolution='medium'
  90. @scancode="takeCode" v-if="showpopup"
  91. device-position="back" flash="off" @error="error"
  92. style="width: 100%; height: 300px;"></camera>
  93. </u-popup>
  94. <!-- 出库设备清单 -->
  95. <view class="list container" style="padding-bottom: 60px;" v-show="scanList.length" >
  96. <view class="list-view">
  97. <!-- 清单信息 -->
  98. <view class="list-infos" v-for="(item,i) in scanList" :key="i" >
  99. <view class="infos-head">
  100. <view class="name">
  101. {{item.title}}
  102. </view>
  103. <view class="state" @click="delOutListMethod(i)">
  104. <u-icon name="trash-fill" color="#777777" ></u-icon>
  105. </view>
  106. </view>
  107. <view class="infos">
  108. <view class="infos-1">
  109. <view class="infos-item">
  110. <view class="item-name">
  111. 编号:
  112. </view>
  113. <view class="item-value">
  114. {{item.code}}
  115. </view>
  116. </view>
  117. <view class="infos-item">
  118. <view class="item-name">
  119. 单位:
  120. </view>
  121. <view class="item-value">
  122. {{item.unit}}
  123. </view>
  124. </view>
  125. </view>
  126. <view class="infos-2">
  127. <view class="infos-item">
  128. <view class="item-name">
  129. 规格:
  130. </view>
  131. <view class="item-value">
  132. {{item.specifications}}
  133. </view>
  134. </view>
  135. <view class="infos-item">
  136. <view class="item-name">
  137. 型号:
  138. </view>
  139. <view class="item-value">
  140. {{item.model}}
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. </view>
  147. <u-divider :isnone="scanList.length==0"
  148. nonetext="点击'扫码'进行归还" nonetop="110" border-color="#CFD2D5">已经到底了</u-divider>
  149. </view>
  150. <u-divider :isnone="scanList.length==0" v-show="scanList.length==0"
  151. nonetext="点击'扫码'进行归还" nonetop="110" border-color="#CFD2D5">已经到底了</u-divider>
  152. <!-- 确认出库 -->
  153. <view class="bottom" >
  154. <u-button type="primary" @click="gotoOut()" >确认归还</u-button>
  155. </view>
  156. </view>
  157. </template>
  158. <script>
  159. import * as API from '@/apis/pagejs/projectDepartment.js'
  160. export default {
  161. data() {
  162. return {
  163. scanFunctionIsUseable:true,
  164. nowscan:{
  165. "title": "",
  166. "specifications": "",
  167. "experimentLastTime":"",
  168. "manufactor": "",
  169. "unit": "",
  170. "model": "",
  171. "code": "",
  172. },
  173. address:"",
  174. showpopup:false,
  175. deviceposition:"back",
  176. form:{
  177. projectName:"",
  178. addressId:"",
  179. recordId:"",
  180. deviceIds:"",
  181. },
  182. scanList:[],
  183. }
  184. },
  185. methods: {
  186. delOutListMethod(c) {
  187. if (c > -1) {
  188. this.scanList.splice(c, 1)
  189. uni.showToast({
  190. title: "删除成功",
  191. icon: "none"
  192. })
  193. }
  194. },
  195. gotoOut() {
  196. if(!this.form.projectName){
  197. uni.showToast({
  198. title: "请输入项目名称",
  199. icon: "none"
  200. })
  201. return
  202. }
  203. if(this.scanList.length==0){
  204. uni.showToast({
  205. title: "请扫码添加出库设备",
  206. icon: "none"
  207. })
  208. return
  209. }
  210. var _this=this;
  211. uni.showModal({
  212. title: '提示',
  213. content:"确认清单无误",
  214. //content: '这是一个模态弹窗',
  215. success: function(res) {
  216. if (res.confirm) {
  217. _this.gotoOutMethod(res.content)
  218. } else if (res.cancel) {
  219. console.log('用户点击取消');
  220. }
  221. }
  222. });
  223. },
  224. gotoOutMethod() {
  225. //recordData
  226. uni.showLoading({
  227. title: "加载中",
  228. mask: true,
  229. })
  230. var list=this.scanList.map(item=>{
  231. return item.id
  232. });
  233. this.form.deviceIds=list.join()
  234. API.saveInRecord(this.form).then((res) => {
  235. uni.hideLoading();
  236. const eventChannel = this.getOpenerEventChannel();
  237. eventChannel.emit('refreshData');
  238. uni.hideLoading()
  239. uni.showModal({
  240. title: '提示',
  241. content: '操作成功',
  242. showCancel:false,
  243. success: function (res) {
  244. if (res.confirm) {
  245. uni.navigateBack()
  246. } else if (res.cancel) {
  247. console.log('用户点击取消');
  248. }
  249. }
  250. });
  251. }).catch(error => {
  252. uni.showToast({
  253. title: error,
  254. icon: "none"
  255. })
  256. })
  257. },
  258. getscan(val) {
  259. this.showpopup=true;
  260. var c = this.scanList.find(item => {
  261. return item.code == val
  262. })
  263. if (c) {
  264. return
  265. }
  266. uni.showLoading({
  267. title: "加载中",
  268. mask: true,
  269. })
  270. API.queryDeviceByCode({
  271. code: val,
  272. }).then((res) => {
  273. uni.hideLoading();
  274. if (res.data.deviceInfo) {
  275. console.log(res.data.deviceInfo)
  276. this.nowscan=res.data.deviceInfo;
  277. var c = this.scanList.find(item => {
  278. return item.id == res.data.deviceInfo.id
  279. })
  280. if (c) {
  281. uni.showToast({
  282. title: "已存在,添加失败",
  283. icon: "none"
  284. })
  285. } else {
  286. this.scanList.push(res.data.deviceInfo)
  287. uni.showToast({
  288. title: "添加成功",
  289. icon: "none"
  290. })
  291. }
  292. } else {
  293. uni.showToast({
  294. title: "二维码无效",
  295. icon: "none"
  296. })
  297. }
  298. }).catch(error => {
  299. uni.showToast({
  300. title: error,
  301. icon: "none"
  302. })
  303. })
  304. },
  305. error(e) {
  306. console.log(e);
  307. },
  308. gotoscan(val) {
  309. // #ifdef H5
  310. this.gotoscanH5(val)
  311. // #endif
  312. // #ifdef MP-WEIXIN
  313. this.gotoscanMP(val)
  314. // #endif
  315. },
  316. takeCode(e){
  317. console.log(e);
  318. if(this.scanFunctionIsUseable) {
  319. this.scanFunctionIsUseable = false;
  320. // 对扫码结果进行处理
  321. console.log(e.detail.result);
  322. this.getscan(this.takeCodeJp(e.detail.result))
  323. // 扫码间隔两秒
  324. setTimeout(() => {
  325. this.scanFunctionIsUseable = true;
  326. }, 1000)
  327. }
  328. },
  329. gotoscanMP(val){
  330. this.showpopup=true;
  331. // const ctx = uni.createCameraContext();
  332. // ctx.takePhoto({
  333. // quality: 'high',
  334. // success: (res) => {
  335. // this.src = res.tempImagePath
  336. // }
  337. // });
  338. },
  339. gotoscanH5(val) {
  340. console.log('111')
  341. var _this = this;
  342. uni.showModal({
  343. title: '提示',
  344. editable: true,
  345. //content: '这是一个模态弹窗',
  346. success: function(res) {
  347. if (res.confirm) {
  348. _this.getscan(res.content)
  349. } else if (res.cancel) {
  350. console.log('用户点击取消');
  351. }
  352. }
  353. });
  354. },
  355. }
  356. }
  357. </script>
  358. <style scoped lang="scss">
  359. .scantitle{
  360. text-align: center;
  361. font-size: 44rpx;
  362. padding-top: 20px;
  363. }
  364. page {
  365. padding-bottom: 200rpx;
  366. }
  367. // 出库单状态
  368. .head {
  369. background-color: #fff;
  370. padding: 24rpx 32rpx;
  371. display: flex;
  372. align-items: center;
  373. color: #101010;
  374. font-size: 32rpx;
  375. .photo {
  376. width: 84rpx;
  377. height: 84rpx;
  378. border-radius: 100rpx;
  379. img {
  380. width: 100%;
  381. height: 100%;
  382. overflow: hidden;
  383. }
  384. }
  385. .name {
  386. color: #101010;
  387. font-size: 32rpx;
  388. margin-right: 8rpx;
  389. margin-left: 24rpx;
  390. max-width: 200rpx;
  391. overflow: hidden;
  392. text-overflow: ellipsis;
  393. white-space: nowrap
  394. }
  395. .submit {
  396. text {
  397. color: #3385FF;
  398. }
  399. }
  400. .state {
  401. line-height: 48rpx;
  402. padding: 0 24rpx;
  403. border-radius: 50px;
  404. background-color: rgba(255, 255, 255, 1);
  405. color: rgba(51, 133, 255, 1);
  406. font-size: 12px;
  407. text-align: center;
  408. font-family: Arial;
  409. border: 1px solid rgba(51, 133, 255, 1);
  410. margin-left: auto;
  411. }
  412. }
  413. .container{
  414. margin-top: 80px;
  415. }
  416. // 出库单详情
  417. .details {
  418. background-color: #fff;
  419. margin-top: 24rpx;
  420. padding: 16rpx 32rpx;
  421. .item {
  422. display: flex;
  423. justify-content: space-between;
  424. padding: 12rpx 0;
  425. //border-bottom: 1px solid rgba(244, 244, 244, 1);
  426. .name {
  427. line-height: 30px;
  428. color: #333333;
  429. font-size: 32rpx
  430. }
  431. .value {
  432. color: #101010;
  433. }
  434. }
  435. }
  436. // 出库单列表
  437. .list {
  438. //margin-top: 24rpx;
  439. .list-view{
  440. padding: 16rpx 32rpx;
  441. background-color: #fff;
  442. }
  443. .list-head {
  444. display: flex;
  445. justify-content: space-between;
  446. align-items: center;
  447. .title {
  448. color: #333333;
  449. font-size: 32rpx
  450. }
  451. .amount {
  452. color: #777777;
  453. font-size: 24rpx;
  454. text {
  455. color: #3385FF;
  456. }
  457. /deep/.u-icon--right {
  458. margin-left: 8rpx;
  459. }
  460. }
  461. }
  462. // 清单信息
  463. .list-infos {
  464. border-radius: 8px;
  465. background-color: #F5F6F9;
  466. margin-top: 24rpx;
  467. padding: 24rpx;
  468. .infos-head {
  469. display: flex;
  470. justify-content: space-between;
  471. align-items: center;
  472. margin-bottom: 24rpx;
  473. .name {
  474. color: rgba(51, 51, 51, 1);
  475. font-size: 32rpx;
  476. }
  477. .state {
  478. color: rgba(0, 81, 255, 1);
  479. }
  480. }
  481. .infos {
  482. margin-top: 16rpx;
  483. display: flex;
  484. color: #777777;
  485. font-size: 24rpx;
  486. .infos-1 {
  487. margin-right: 68rpx;
  488. }
  489. .infos-item {
  490. display: flex;
  491. margin-bottom: 8rpx;
  492. }
  493. }
  494. }
  495. }
  496. // 流程
  497. .process {
  498. background-color: #fff;
  499. margin-top: 24rpx;
  500. padding: 24rpx 32rpx;
  501. .title {
  502. color: rgba(51, 51, 51, 1);
  503. font-size: 32rpx;
  504. }
  505. .u-time-axis-item{
  506. //margin-bottom: 76rpx;
  507. }
  508. .u-time-axis {
  509. //padding: 18rpx 40rpx;
  510. }
  511. .u-node {
  512. width: 18rpx;
  513. height: 18rpx;
  514. border-radius: 100rpx !important;
  515. display: flex;
  516. justify-content: center;
  517. align-items: center;
  518. background: #d0d0d0;
  519. }
  520. .u-order{
  521. margin-bottom: 32rpx;
  522. }
  523. .u-order-title {
  524. color: #333333;
  525. font-weight: bold;
  526. font-size: 32rpx;
  527. }
  528. .u-order-desc {
  529. margin-bottom: 16rpx;
  530. display: flex;
  531. justify-content: space-between;
  532. align-items: center;
  533. .level {
  534. color: #333333;
  535. font-size: 32rpx;
  536. font-weight: bold;
  537. }
  538. .date {
  539. color: rgba(119, 119, 119, 1);
  540. }
  541. .state {
  542. color: rgba(255, 121, 0, 1);
  543. }
  544. }
  545. .u-order-time {
  546. width: 90rpx;
  547. color: #777777;
  548. font-size: 28rpx;
  549. margin-top: 16rpx;
  550. display: flex;
  551. flex-direction: column;
  552. align-items: center;
  553. .photo {
  554. width: 56rpx;
  555. height: 56rpx;
  556. border-radius: 100px;
  557. margin-bottom: 4rpx;
  558. img {
  559. width: 100%;
  560. height: 100%;
  561. overflow: hidden;
  562. position: relative;
  563. }
  564. }
  565. .confirm {
  566. position: absolute;
  567. top: 46rpx;
  568. left: 56rpx;
  569. }
  570. .name {
  571. color: rgba(51, 51, 51, 1);
  572. font-size: 24rpx;
  573. }
  574. }
  575. }
  576. // .u-time-axis{
  577. // .u-time-axis-item:last-of-type{
  578. // margin-bottom: 0;
  579. // }
  580. // }
  581. // 确认出库
  582. .bottom{
  583. background-color: #fff;
  584. margin-top: 44rpx;
  585. padding: 16rpx 32rpx;
  586. z-index: 999;
  587. position: fixed;
  588. left: 0;
  589. right: 0;
  590. bottom: 0;
  591. uni-button{
  592. border-radius: 8px;
  593. background: linear-gradient(180deg, rgba(22,119,255,1) 0%,rgba(16,98,213,1) 100%);
  594. color: rgba(255, 255, 255, 1);
  595. font-size: 32rpx;
  596. line-height: 88rpx;
  597. }
  598. }
  599. </style>