deliveryFrom.vue 13 KB

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