index.vue 5.1 KB

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