deliveryFrom.vue 13 KB

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