deliveryFrom.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  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">
  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. <!-- 出库设备清单 -->
  28. <view class="list">
  29. <view class="list-head">
  30. <view class="title">
  31. 出库设备清单
  32. </view>
  33. <view class="amount" @click="gotoscan('')">
  34. <u-icon name="scan" color="#0051ff" ></u-icon>扫码识别
  35. </view>
  36. </view>
  37. <!-- 清单信息 -->
  38. <view class="list-infos" v-for="(item,i) in scanList" :key="i" >
  39. <view class="infos-head">
  40. <view class="name">
  41. {{item.title}}
  42. </view>
  43. <view class="state" @click="delOutListMethod(i)">
  44. <u-icon name="trash-fill" color="#777777" ></u-icon>
  45. </view>
  46. </view>
  47. <view class="infos">
  48. <view class="infos-1">
  49. <view class="infos-item">
  50. <view class="item-name">
  51. 编号:
  52. </view>
  53. <view class="item-value">
  54. {{item.code}}
  55. </view>
  56. </view>
  57. <view class="infos-item">
  58. <view class="item-name">
  59. 单位:
  60. </view>
  61. <view class="item-value">
  62. {{item.unit}}
  63. </view>
  64. </view>
  65. </view>
  66. <view class="infos-2">
  67. <view class="infos-item">
  68. <view class="item-name">
  69. 规格:
  70. </view>
  71. <view class="item-value">
  72. {{item.specifications}}
  73. </view>
  74. </view>
  75. <view class="infos-item">
  76. <view class="item-name">
  77. 型号:
  78. </view>
  79. <view class="item-value">
  80. {{item.model}}
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <!-- 确认出库 -->
  88. <view class="bottom" @click="gotoOut()" >
  89. <button>确认出库</button>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. import * as API from '@/apis/pagejs/projectDepartment.js'
  95. export default {
  96. data() {
  97. return {
  98. address:"",
  99. form:{
  100. projectName:"",
  101. addressId:"",
  102. recordId:"",
  103. deviceIds:"",
  104. },
  105. scanList:[],
  106. }
  107. },
  108. methods: {
  109. delOutListMethod(c) {
  110. if (c > -1) {
  111. this.scanList.splice(c, 1)
  112. uni.showToast({
  113. title: "删除成功",
  114. icon: "none"
  115. })
  116. }
  117. },
  118. gotoOut() {
  119. if(!this.form.projectName){
  120. uni.showToast({
  121. title: "请输入项目名称",
  122. icon: "none"
  123. })
  124. return
  125. }
  126. if(this.scanList.length==0){
  127. uni.showToast({
  128. title: "请扫码添加出库设备",
  129. icon: "none"
  130. })
  131. return
  132. }
  133. var _this=this;
  134. uni.showModal({
  135. title: '提示',
  136. content:"确认清单无误",
  137. //content: '这是一个模态弹窗',
  138. success: function(res) {
  139. if (res.confirm) {
  140. _this.gotoOutMethod(res.content)
  141. } else if (res.cancel) {
  142. console.log('用户点击取消');
  143. }
  144. }
  145. });
  146. },
  147. gotoOutMethod() {
  148. //recordData
  149. uni.showLoading({
  150. title: "加载中",
  151. mask: true,
  152. })
  153. var list=this.scanList.map(item=>{
  154. return item.id
  155. });
  156. this.form.deviceIds=list.join()
  157. API.saveInRecord(this.form).then((res) => {
  158. uni.hideLoading();
  159. const eventChannel = this.getOpenerEventChannel();
  160. eventChannel.emit('refreshData');
  161. uni.hideLoading()
  162. uni.showModal({
  163. title: '提示',
  164. content: '操作成功',
  165. showCancel:false,
  166. success: function (res) {
  167. if (res.confirm) {
  168. uni.navigateBack()
  169. } else if (res.cancel) {
  170. console.log('用户点击取消');
  171. }
  172. }
  173. });
  174. }).catch(error => {
  175. uni.showToast({
  176. title: error,
  177. icon: "none"
  178. })
  179. })
  180. },
  181. getscan(val) {
  182. uni.showLoading({
  183. title: "加载中",
  184. mask: true,
  185. })
  186. API.queryDeviceByCode({
  187. code: val,
  188. }).then((res) => {
  189. uni.hideLoading();
  190. if (res.data.deviceInfo) {
  191. console.log(res.data.deviceInfo)
  192. var c = this.scanList.find(item => {
  193. return item.id == res.data.deviceInfo.id
  194. })
  195. if (c) {
  196. uni.showToast({
  197. title: "已存在,添加失败",
  198. icon: "none"
  199. })
  200. } else {
  201. this.scanList.push(res.data.deviceInfo)
  202. uni.showToast({
  203. title: "添加成功",
  204. icon: "none"
  205. })
  206. }
  207. } else {
  208. uni.showToast({
  209. title: "二维码无效",
  210. icon: "none"
  211. })
  212. }
  213. }).catch(error => {
  214. uni.showToast({
  215. title: error,
  216. icon: "none"
  217. })
  218. })
  219. },
  220. gotoscan(val) {
  221. console.log('111')
  222. var _this = this;
  223. uni.showModal({
  224. title: '提示',
  225. editable: true,
  226. //content: '这是一个模态弹窗',
  227. success: function(res) {
  228. if (res.confirm) {
  229. _this.getscan(res.content)
  230. } else if (res.cancel) {
  231. console.log('用户点击取消');
  232. }
  233. }
  234. });
  235. },
  236. }
  237. }
  238. </script>
  239. <style scoped lang="scss">
  240. page {
  241. padding-bottom: 200rpx;
  242. }
  243. // 出库单状态
  244. .head {
  245. background-color: #fff;
  246. padding: 24rpx 32rpx;
  247. display: flex;
  248. align-items: center;
  249. color: #101010;
  250. font-size: 32rpx;
  251. .photo {
  252. width: 84rpx;
  253. height: 84rpx;
  254. border-radius: 100rpx;
  255. img {
  256. width: 100%;
  257. height: 100%;
  258. overflow: hidden;
  259. }
  260. }
  261. .name {
  262. color: #101010;
  263. font-size: 32rpx;
  264. margin-right: 8rpx;
  265. margin-left: 24rpx;
  266. }
  267. .submit {
  268. text {
  269. color: #3385FF;
  270. }
  271. }
  272. .state {
  273. line-height: 48rpx;
  274. padding: 0 24rpx;
  275. border-radius: 50px;
  276. background-color: rgba(255, 255, 255, 1);
  277. color: rgba(51, 133, 255, 1);
  278. font-size: 12px;
  279. text-align: center;
  280. font-family: Arial;
  281. border: 1px solid rgba(51, 133, 255, 1);
  282. margin-left: auto;
  283. }
  284. }
  285. // 出库单详情
  286. .details {
  287. background-color: #fff;
  288. margin-top: 24rpx;
  289. padding: 0 32rpx;
  290. .item {
  291. display: flex;
  292. justify-content: space-between;
  293. padding: 22rpx 0;
  294. border-bottom: 1px solid rgba(244, 244, 244, 1);
  295. .name {
  296. color: rgba(119, 119, 119, 1);
  297. }
  298. .value {
  299. color: #101010;
  300. }
  301. }
  302. }
  303. // 出库单列表
  304. .list {
  305. background-color: #fff;
  306. margin-top: 24rpx;
  307. padding: 22rpx 32rpx;
  308. .list-head {
  309. display: flex;
  310. justify-content: space-between;
  311. align-items: center;
  312. .title {
  313. color: #333333;
  314. font-size: 32rpx
  315. }
  316. .amount {
  317. color: #777777;
  318. font-size: 24rpx;
  319. text {
  320. color: #3385FF;
  321. }
  322. /deep/.u-icon--right {
  323. margin-left: 8rpx;
  324. }
  325. }
  326. }
  327. // 清单信息
  328. .list-infos {
  329. border-radius: 8px;
  330. background-color: #F5F6F9;
  331. margin-top: 24rpx;
  332. padding: 24rpx;
  333. .infos-head {
  334. display: flex;
  335. justify-content: space-between;
  336. align-items: center;
  337. margin-bottom: 24rpx;
  338. .name {
  339. color: rgba(51, 51, 51, 1);
  340. font-size: 32rpx;
  341. }
  342. .state {
  343. color: rgba(0, 81, 255, 1);
  344. }
  345. }
  346. .infos {
  347. margin-top: 16rpx;
  348. display: flex;
  349. color: #777777;
  350. font-size: 24rpx;
  351. .infos-1 {
  352. margin-right: 68rpx;
  353. }
  354. .infos-item {
  355. display: flex;
  356. margin-bottom: 8rpx;
  357. }
  358. }
  359. }
  360. }
  361. // 流程
  362. .process {
  363. background-color: #fff;
  364. margin-top: 24rpx;
  365. padding: 24rpx 32rpx;
  366. .title {
  367. color: rgba(51, 51, 51, 1);
  368. font-size: 32rpx;
  369. }
  370. .u-time-axis-item{
  371. //margin-bottom: 76rpx;
  372. }
  373. .u-time-axis {
  374. //padding: 18rpx 40rpx;
  375. }
  376. .u-node {
  377. width: 18rpx;
  378. height: 18rpx;
  379. border-radius: 100rpx !important;
  380. display: flex;
  381. justify-content: center;
  382. align-items: center;
  383. background: #d0d0d0;
  384. }
  385. .u-order{
  386. margin-bottom: 32rpx;
  387. }
  388. .u-order-title {
  389. color: #333333;
  390. font-weight: bold;
  391. font-size: 32rpx;
  392. }
  393. .u-order-desc {
  394. margin-bottom: 16rpx;
  395. display: flex;
  396. justify-content: space-between;
  397. align-items: center;
  398. .level {
  399. color: #333333;
  400. font-size: 32rpx;
  401. font-weight: bold;
  402. }
  403. .date {
  404. color: rgba(119, 119, 119, 1);
  405. }
  406. .state {
  407. color: rgba(255, 121, 0, 1);
  408. }
  409. }
  410. .u-order-time {
  411. width: 90rpx;
  412. color: #777777;
  413. font-size: 28rpx;
  414. margin-top: 16rpx;
  415. display: flex;
  416. flex-direction: column;
  417. align-items: center;
  418. .photo {
  419. width: 56rpx;
  420. height: 56rpx;
  421. border-radius: 100px;
  422. margin-bottom: 4rpx;
  423. img {
  424. width: 100%;
  425. height: 100%;
  426. overflow: hidden;
  427. position: relative;
  428. }
  429. }
  430. .confirm {
  431. position: absolute;
  432. top: 46rpx;
  433. left: 56rpx;
  434. }
  435. .name {
  436. color: rgba(51, 51, 51, 1);
  437. font-size: 24rpx;
  438. }
  439. }
  440. }
  441. // .u-time-axis{
  442. // .u-time-axis-item:last-of-type{
  443. // margin-bottom: 0;
  444. // }
  445. // }
  446. // 确认出库
  447. .bottom{
  448. background-color: #fff;
  449. margin-top: 44rpx;
  450. padding: 16rpx 32rpx;
  451. z-index: 999;
  452. position: fixed;
  453. left: 0;
  454. right: 0;
  455. bottom: 0;
  456. uni-button{
  457. border-radius: 8px;
  458. background: linear-gradient(180deg, rgba(22,119,255,1) 0%,rgba(16,98,213,1) 100%);
  459. color: rgba(255, 255, 255, 1);
  460. font-size: 32rpx;
  461. line-height: 88rpx;
  462. }
  463. }
  464. </style>