index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="领料" background-color="#157A2C" color="#fff"
  4. @clickLeft="back" right-icon="scan" @clickRight="HandlScanCode">
  5. </uni-nav-bar>
  6. <view class="top-wrapper">
  7. <!-- <view class="tab_box rx-sc">
  8. <view class="tab_item" :class="{active: tabType == 1}" @click="handTab(1)">生产工单列表</view>
  9. <view class="tab_item" :class="{active: tabType == 2}" @click="handTab(2)">领料工单列表</view>
  10. </view> -->
  11. <view class="nav_box rx-sc">
  12. <view class="nav_item " :class="{active: pickStatus == 0}" @click="handNav(0)">未领料({{navObj.unclaimedQuantity}})</view>
  13. <view class="nav_item" :class="{active: pickStatus == 1}" @click="handNav(1)">已领料({{navObj.claimedQuantity}})</view>
  14. <view class="nav_item" :class="{active: pickStatus == 2}" @click="handNav(2)">已出库(0)</view>
  15. </view>
  16. </view>
  17. <view class="list_box">
  18. <u-list @scrolltolower="scrolltolower">
  19. <pickCard v-if='dataList.length' :list="dataList"> </pickCard>
  20. <view v-else style='margin-top: 20vh;'>
  21. <u-empty iconSize='150' textSize='32' text='暂无工单'>
  22. </u-empty>
  23. </view>
  24. </u-list>
  25. </view>
  26. <view class="bottom-wrapper rx-bc" v-if='pickStatus == 0'>
  27. <view>
  28. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  29. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  30. </checkbox>
  31. </view>
  32. <view>
  33. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
  34. <view> 选择( {{ checkListLen }} ) </view>
  35. </u-button>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import pickCard from '../components/pickCard.vue'
  42. import {
  43. workorderPage
  44. } from '@/api/pda/workOrder.js'
  45. import { pickStatistics } from '@/api/pda/picking.js'
  46. let [isEnd] = [false]
  47. export default {
  48. components: {
  49. pickCard
  50. },
  51. data() {
  52. return {
  53. tabType: 1,
  54. pickStatus: 0,
  55. navObj: {
  56. unclaimedQuantity: 0,
  57. claimedQuantity: 0
  58. },
  59. page: 1,
  60. size: 5,
  61. dataList: [],
  62. seletedAll: false, //全选状态
  63. }
  64. },
  65. //选择的列表长度
  66. computed: {
  67. checkListLen() {
  68. let _fitArr = this.dataList.filter(f => f.checked)
  69. return _fitArr.length
  70. }
  71. },
  72. onLoad(option) {
  73. this.pickStatus = option.pickStatus || 0
  74. },
  75. onShow() {
  76. this.page = 1
  77. // this.dataList = []
  78. this.getList()
  79. this.getpickTics()
  80. },
  81. methods: {
  82. async getList() {
  83. let params = {
  84. pageNum: this.page,
  85. size: this.size,
  86. pickStatus: this.pickStatus,
  87. }
  88. isEnd = false
  89. const res = await workorderPage(params)
  90. if (params.page === 1) {
  91. this.dataList = []
  92. }
  93. let _list = res.list.map(m => {
  94. return {
  95. checked: false,
  96. ...m
  97. }
  98. })
  99. this.dataList.push(..._list)
  100. isEnd = this.dataList.length >= res.count
  101. },
  102. getpickTics() {
  103. pickStatistics().then(res => {
  104. this.navObj = res
  105. })
  106. },
  107. handTab(type) {
  108. if (type != this.tabType) {
  109. this.tabType = type
  110. }
  111. },
  112. handNav(type) {
  113. if (type != this.pickStatus) {
  114. this.pickStatus = type
  115. this.page = 1
  116. this.dataList = []
  117. this.getList()
  118. }
  119. },
  120. scrolltolower() {
  121. if (isEnd) return
  122. this.page++
  123. this.getList()
  124. },
  125. _seletedAll() {
  126. if (!this.seletedAll) {
  127. this.seletedAll = true
  128. this.dataList.forEach(e => {
  129. e.checked = true
  130. })
  131. } else {
  132. this.seletedAll = false
  133. this.dataList.forEach(e => {
  134. e.checked = false
  135. })
  136. }
  137. },
  138. jumpAdd() {
  139. let url
  140. url = '/pages/pda/picking/details'
  141. let arr = []
  142. this.dataList.forEach(e => {
  143. if(e.checked) {
  144. arr.push(e.id)
  145. }
  146. })
  147. let _arr = JSON.stringify(arr)
  148. url += `?arr=${encodeURIComponent(_arr)}`
  149. uni.navigateTo({
  150. url
  151. })
  152. },
  153. // 相机扫码
  154. HandlScanCode() {
  155. let _this = this
  156. uni.scanCode({
  157. success: function(res) {
  158. console.log(res)
  159. }
  160. })
  161. //_this.Scancodedate('res')
  162. },
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .content-box {
  168. height: 100vh;
  169. overflow: hidden;
  170. display: flex;
  171. flex-direction: column;
  172. background-color: $page-bg;
  173. }
  174. .tab_box {
  175. width: 100%;
  176. height: 68rpx;
  177. background: #fff;
  178. .tab_item {
  179. height: 68rpx;
  180. line-height: 68rpx;
  181. padding: 0 20rpx;
  182. font-size: 32rpx;
  183. color: #979C9E;
  184. }
  185. .active {
  186. box-sizing: border-box;
  187. border-bottom: 6rpx solid $theme-color;
  188. color: $theme-color;
  189. }
  190. }
  191. .nav_box {
  192. padding: 6rpx 32rpx;
  193. .nav_item {
  194. font-size: 28rpx;
  195. font-weight: 400;
  196. color: $theme-color;
  197. background: #F0F8F2;
  198. margin-right: 16rpx;
  199. padding: 4rpx 16rpx;
  200. border-radius: 8rpx;
  201. border: 2rpx solid #ACD4B5;
  202. }
  203. .active {
  204. background: $theme-color;
  205. border: 2rpx solid $theme-color;
  206. color: #FFF;
  207. }
  208. }
  209. .list_box {
  210. flex: 1;
  211. overflow: hidden;
  212. padding: 4rpx 0;
  213. .u-list {
  214. height: 100% !important;
  215. }
  216. }
  217. .bottom-wrapper {
  218. height: 80rpx;
  219. background: #fff;
  220. padding: 0 32rpx;
  221. /deep/ .uni-checkbox-input-checked {
  222. background-color: $theme-color !important;
  223. border-color: $theme-color !important;
  224. }
  225. }
  226. .load-more{
  227. height: 100%;
  228. }
  229. </style>