scanCodeList.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <template>
  2. <view class="mainBox">
  3. <view class="main">
  4. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" right-icon="scan" title="扫码列表" @clickLeft="backAdd" @clickRight="HandlScanCode"></uni-nav-bar>
  5. <view class="wrapper">
  6. <u-list class="listContent">
  7. <checkbox-group v-for="(item, index) in listData" :key="index" @change.stop="e => selectVal(e, item, index)">
  8. <label>
  9. <view class="listBox">
  10. <view class="listBox-sel">
  11. <checkbox :value="item.code" color="#fff" :disabled="item.disabled" :checked="item.checked" />
  12. </view>
  13. <view class="listBox-con">
  14. <view class="listBox-top">
  15. <view class="listBox-name">
  16. {{ item.categoryName }}
  17. </view>
  18. </view>
  19. <view class="listBox-top">
  20. <view class="listBox-code">
  21. {{ item.categoryCode }}
  22. </view>
  23. </view>
  24. <view class="listBox-bottom">
  25. <view>牌号:{{ item.brandNum }}</view>
  26. <view>型号:{{ item.modelType }}</view>
  27. <view>规格:{{ item.specification }}</view>
  28. <view>批次号:{{ item.batchNo }}</view>
  29. <view>计量数量:{{ item.measureQuantity }}({{ item.measureUnit }})</view>
  30. <view class="w100">包装编码:{{ item.packageNo }}</view>
  31. <view>包装数量:{{ item.packingQuantity }}({{ item.packingUnit }})</view>
  32. <view>重量:{{ item.weight }}({{ item.weightUnit }})</view>
  33. <view>发货条码:{{ item.barcodes }}</view>
  34. <view>物料代号:{{ item.materielDesignation }}</view>
  35. <view>客户代号:{{ item.clientCode }}</view>
  36. <view>刻码:{{ item.engrave }}</view>
  37. <view class="w100">仓库:{{ item.warehouseName }}</view>
  38. <view class="w100">区域:{{ getLocation(item) }}</view>
  39. </view>
  40. </view>
  41. </view>
  42. </label>
  43. </checkbox-group>
  44. <u-empty class="noDate" style="margin-top: 20vh" v-if="!listData.length"></u-empty>
  45. </u-list>
  46. </view>
  47. <view class="footer">
  48. <view class="bottom">
  49. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  50. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选</checkbox>
  51. </view>
  52. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
  53. <view class="selBtn">选择( {{ checkListLen }} )</view>
  54. </u-button>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import { outInGoodsPackingList } from '@/api/warehouseManagement'
  61. import { sceneState, outputSceneState } from '../common'
  62. export default {
  63. data() {
  64. return {
  65. type: null,
  66. statusOpt: ['待处理', '已处理', '已撤销'],
  67. curItem: null, //当前选中项
  68. page: 1,
  69. size: 20,
  70. sceneState,
  71. seletedAll: false, //全选状态
  72. outputSceneState,
  73. isEnd: true,
  74. searchVal: '',
  75. listData: [] //列表数据
  76. }
  77. },
  78. //选择的列表长度
  79. computed: {
  80. checkListLen() {
  81. return this.listData.filter(el => el.checked).length
  82. }
  83. },
  84. onLoad({ type }) {
  85. this.type = type
  86. },
  87. onShow() {
  88. // this.getList()
  89. },
  90. methods: {
  91. getLocation(item) {
  92. if (item.areaName && item.goodsShelfName && item.goodsAllocationName) {
  93. return item.areaName + '/' + item.goodsShelfName + '/' + item.goodsAllocationName
  94. } else if (item.areaName && item.goodsShelfName) {
  95. return item.areaName + '/' + item.goodsShelfName
  96. } else if (item.areaName) {
  97. return item.areaName
  98. } else {
  99. return ''
  100. }
  101. },
  102. // 相机扫码
  103. HandlScanCode() {
  104. uni.scanCode({
  105. success: res => {
  106. console.log('res------------------------')
  107. let arr = res.result.split('/')
  108. let params = { packingNo: [arr[0]] }
  109. console.log(params)
  110. if (this.listData.find(item => item.packageNo == arr[0])) {
  111. uni.showToast({
  112. title: '请勿重复扫码!',
  113. icon: 'none'
  114. })
  115. return
  116. }
  117. outInGoodsPackingList(params).then(res => {
  118. console.log(res)
  119. this.listData = this.listData.concat(res)
  120. })
  121. }
  122. })
  123. },
  124. //勾选
  125. selectVal(e, val, index) {
  126. this.$set(this.listData[index], 'checked', !this.listData[index].checked)
  127. this.seletedAll = !this.listData.some(item => !item.checked)
  128. },
  129. //全选按钮
  130. _seletedAll() {
  131. if (!this.seletedAll) {
  132. this.seletedAll = true
  133. this.listData.map(item => {
  134. this.$set(item, 'checked', true)
  135. })
  136. } else {
  137. this.seletedAll = false
  138. //this.checkListLen = 0;
  139. this.listData.map(item => {
  140. this.$set(item, 'checked', false)
  141. })
  142. }
  143. },
  144. //跳转回添加页面
  145. async jumpAdd() {
  146. uni.$emit(
  147. 'setSelectList',
  148. this.listData.filter(item => item.checked)
  149. )
  150. uni.navigateBack()
  151. },
  152. //返回添加页
  153. backAdd() {
  154. uni.navigateBack()
  155. }
  156. }
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. .mainBox {
  161. height: 100vh;
  162. .main {
  163. height: 100%;
  164. display: flex;
  165. flex-direction: column;
  166. }
  167. .wrapper {
  168. flex: 1;
  169. overflow: hidden;
  170. }
  171. .searchBox {
  172. padding: 10rpx 0;
  173. box-sizing: border-box;
  174. background-color: #dedede;
  175. height: 90rpx;
  176. width: 100%;
  177. line-height: 90rpx;
  178. display: flex;
  179. justify-content: space-around;
  180. align-items: center;
  181. input {
  182. height: 78rpx;
  183. width: 65%;
  184. background: #f9f9f9 !important;
  185. margin: 0 10rpx;
  186. padding: 0 10rpx;
  187. box-sizing: border-box;
  188. border-radius: 5rpx;
  189. }
  190. .searchBtn {
  191. height: 80rpx;
  192. background: #f9f9f9 !important;
  193. color: #676767;
  194. font-size: 28rpx;
  195. padding: 0 42rpx;
  196. box-sizing: border-box;
  197. outline: none;
  198. border: none;
  199. width: 260rpx;
  200. .icon-sousuo {
  201. font-size: 22px;
  202. }
  203. .text {
  204. font-size: 16px;
  205. margin-left: 10px;
  206. }
  207. }
  208. .search-icon {
  209. display: flex;
  210. align-items: center;
  211. justify-content: space-around;
  212. font-size: 28rpx;
  213. white-space: nowrap;
  214. margin-left: 10rpx;
  215. image {
  216. width: 30rpx;
  217. height: 30rpx;
  218. }
  219. }
  220. }
  221. .tab-title {
  222. position: fixed;
  223. top: 190rpx;
  224. z-index: 99;
  225. width: 100%;
  226. display: flex;
  227. justify-content: space-between;
  228. align-items: center;
  229. height: $tab-height;
  230. line-height: $tab-height;
  231. background-color: #ffffff;
  232. border-bottom: 2rpx solid #f2f2f2;
  233. box-sizing: border-box;
  234. .tab-item {
  235. width: 25%;
  236. text-align: center;
  237. font-size: 32rpx;
  238. color: $uni-text-color-grey;
  239. }
  240. .tab-item.active {
  241. color: $j-primary-border-green;
  242. border-bottom: 1px solid $j-primary-border-green;
  243. font-weight: bold;
  244. }
  245. .tab-item.filter {
  246. flex: 1;
  247. padding: 0px 30rpx;
  248. .uni-icons {
  249. display: flex;
  250. padding-top: 5px;
  251. }
  252. }
  253. .screenIcon {
  254. display: flex;
  255. width: 80px;
  256. justify-content: center;
  257. .screenText {
  258. font-size: 32rpx;
  259. color: $uni-text-color-grey;
  260. }
  261. }
  262. }
  263. .listContent {
  264. height: 100% !important;
  265. .listBox {
  266. display: flex;
  267. // height: 180rpx;
  268. padding: 20rpx 0;
  269. border-bottom: 2rpx solid #e5e5e5;
  270. .listBox-sel {
  271. height: 90rpx;
  272. width: 80rpx;
  273. // line-height: 90rpx;
  274. text-align: center;
  275. checkbox {
  276. transform: scale(1.2);
  277. }
  278. }
  279. .listBox-con {
  280. width: 100%;
  281. // display: flex;
  282. // flex-wrap: wrap;
  283. // justify-content: space-between;
  284. align-items: center;
  285. padding: 0 18rpx 0 0;
  286. .listBox-top {
  287. width: 100%;
  288. display: flex;
  289. justify-content: space-between;
  290. padding-bottom: 10rpx;
  291. .listBox-name,
  292. .listBox-code {
  293. display: inline-block;
  294. font-size: $uni-font-size-sm;
  295. font-weight: bold;
  296. }
  297. }
  298. .listBox-bottom {
  299. width: 100%;
  300. display: flex;
  301. justify-content: space-between;
  302. font-size: $uni-font-size-sm;
  303. flex-wrap: wrap;
  304. > view {
  305. width: 50%;
  306. overflow: hidden;
  307. white-space: nowrap;
  308. text-overflow: ellipsis;
  309. }
  310. .input_view {
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. .u-input {
  315. height: 36rpx;
  316. padding: 0 !important;
  317. margin-right: 10rpx;
  318. border: 1px solid #ddd;
  319. }
  320. }
  321. .w100 {
  322. width: 100%;
  323. }
  324. }
  325. }
  326. }
  327. .noDate {
  328. height: 100%;
  329. }
  330. }
  331. //底部按钮
  332. .footer {
  333. height: 90rpx;
  334. position: relative;
  335. display: flex;
  336. justify-content: space-between;
  337. align-items: center;
  338. bottom: 0;
  339. width: 100%;
  340. height: 100rpx;
  341. border-top: 1rpx solid #eeecec;
  342. background-color: #ffffff;
  343. z-index: 999;
  344. .bottom {
  345. margin-left: 10rpx;
  346. }
  347. .u-reset-button {
  348. position: absolute;
  349. right: 10rpx;
  350. top: 20rpx;
  351. width: 150rpx;
  352. }
  353. }
  354. .search-container {
  355. width: 70vw;
  356. padding: 30rpx 36rpx;
  357. .footer {
  358. position: absolute;
  359. bottom: 0;
  360. left: 0;
  361. width: 100%;
  362. display: flex;
  363. box-shadow: 0 10rpx 30rpx 0 #000;
  364. .btn {
  365. width: 50%;
  366. height: 80rpx;
  367. border-radius: 0 !important;
  368. flex: 1;
  369. display: flex;
  370. justify-content: center;
  371. align-items: center;
  372. &.reset {
  373. color: $j-primary-border-green;
  374. }
  375. }
  376. }
  377. }
  378. .title {
  379. font-weight: bold;
  380. font-size: 30rpx;
  381. }
  382. .status-wrapper {
  383. display: flex;
  384. align-items: center;
  385. justify-content: space-between;
  386. view {
  387. background-color: rgba(242, 242, 242, 1);
  388. height: 60rpx;
  389. border-radius: 30rpx;
  390. line-height: 60rpx;
  391. text-align: center;
  392. width: 160rpx;
  393. border: 1rpx solid rgba(242, 242, 242, 1);
  394. &.active {
  395. color: #157a2c;
  396. border-color: rgba(21, 122, 44, 1);
  397. }
  398. }
  399. }
  400. /deep/.uni-date {
  401. .uni-icons {
  402. display: none;
  403. }
  404. .uni-date-x {
  405. padding: 0;
  406. view {
  407. margin: 0 20rpx;
  408. }
  409. }
  410. }
  411. /deep/.uni-date__x-input,
  412. /deep/.uni-easyinput__content-input {
  413. height: 60rpx;
  414. border-radius: 30rpx;
  415. overflow: hidden;
  416. background-color: rgba(242, 242, 242, 1);
  417. }
  418. }
  419. </style>