turnoverPopup.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <view>
  3. <u-popup :show="show" mode='center' v-if='show' :closeOnClickOverlay='false'>
  4. <view class="popup_box">
  5. <view class="title_box rx-bc">
  6. <view class="name">周转车 </view>
  7. <view>数量: {{sum - count || 0}} </view>
  8. </view>
  9. <u-list @scrolltolower="scrolltolower" class="list_box">
  10. <view v-for="(item, index) in newTurnover" :key='index'>
  11. <view class="content_table">
  12. <view class="item rx-sc">
  13. <view class="rx ww50 ">
  14. <view class="lable ww80 rx-cc ">编号</view>
  15. <view class="content rx-sc">
  16. <view>{{item.code}}</view>
  17. </view>
  18. </view>
  19. <view class="rx ww50">
  20. <view class="lable rx-cc ww80">名称</view>
  21. <view class="content rx-sc">
  22. <view>{{item.name}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="content_table2">
  28. <view class="head row rx-sc">
  29. <view class="item ww10">货位</view>
  30. <view class="item ww30">工单编号</view>
  31. <view class="item ww35">产品编码</view>
  32. <view class="item ww25">数量</view>
  33. </view>
  34. <view class="table">
  35. <u-list @scrolltolower="scrolltolower" class="z_list">
  36. <view class="tr row rx-sc" v-for="(it, idx) in item.extInfo.positionList"
  37. :key='idx'>
  38. <view class="item ww10">{{it.code}}</view>
  39. <view class="item ww30"
  40. :class="{'color157': it.workOrderCode === wordItem.code}">
  41. {{ it.workOrderCode }}
  42. </view>
  43. <view class="item ww35"
  44. :class="{'color157': it.categoryCode === wordItem.productCode}">
  45. {{it.categoryCode}}
  46. </view>
  47. <view class="item ww25 content_num">
  48. <input class="uni-input" v-if='it.isFull == 0'
  49. @input="quantInt(index, idx, it)" v-model="it.quantity"
  50. type="digit"></input>
  51. <text v-else>{{it.quantity}}</text>
  52. </view>
  53. </view>
  54. </u-list>
  55. </view>
  56. </view>
  57. </view>
  58. </u-list>
  59. <view class="operate_box rx-sc">
  60. <u-button size="small" class="u-reset-button" @click="cancel">取消</u-button>
  61. <u-button size="small" class="u-reset-button" type="success" @click="save">确定</u-button>
  62. </view>
  63. </view>
  64. </u-popup>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. scanLedger,
  70. } from '@/api/pda/workOrder.js'
  71. export default {
  72. props: {
  73. },
  74. data() {
  75. return {
  76. show: false,
  77. wordInfo: {},
  78. wordItem: {},
  79. newTurnover: [],
  80. idx: null,
  81. sum: 0,
  82. count: 0,
  83. }
  84. },
  85. methods: {
  86. scrolltolower() {},
  87. open(result, wordInfo, newList, wordItem, index) {
  88. this.wordInfo = wordInfo
  89. this.wordItem = wordItem
  90. this.idx = index
  91. this.count = 0
  92. this.sum = 0;
  93. newList[0].extInfo.positionList.forEach(e => {
  94. if (e.check) {
  95. this.sum += Number(e.newQuantity);
  96. }
  97. })
  98. let isFals = newList.some(m => m.code == result && m.isOld == 1)
  99. if (isFals) {
  100. uni.showToast({
  101. title: '周转车已存在',
  102. icon: 'none'
  103. })
  104. return false
  105. }
  106. scanLedger(result).then(res => {
  107. this.newTurnover = res
  108. this.show = true
  109. })
  110. },
  111. quantInt(index, idx, it) {
  112. if (it.quantity >= 1) {
  113. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'workOrderCode', this.wordInfo
  114. .workOrderCode)
  115. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'categoryCode', this.wordInfo
  116. .categoryCode)
  117. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'numAdd', true)
  118. this.countFn()
  119. } else {
  120. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'workOrderCode', '')
  121. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'categoryCode', '')
  122. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'quantity', 0)
  123. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'numAdd', false)
  124. this.countFn()
  125. }
  126. },
  127. countFn() {
  128. this.count = 0;
  129. this.newTurnover[0].extInfo.positionList.forEach(e => {
  130. if (e.numAdd) {
  131. this.count += Number(e.quantity);
  132. }
  133. })
  134. },
  135. cancel() {
  136. this.show = false
  137. },
  138. save() {
  139. if (this.sum - this.count != 0) {
  140. uni.showToast({
  141. title: '转移数量对应不上',
  142. icon: 'none'
  143. })
  144. return
  145. }
  146. this.$emit('saveTurn', this.idx, this.newTurnover)
  147. this.show = false
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .popup_box {
  154. width: 98vw;
  155. min-height: 60vh;
  156. max-height: 80vh;
  157. padding: 16rpx;
  158. box-sizing: border-box;
  159. overflow: hidden;
  160. display: flex;
  161. flex-direction: column;
  162. }
  163. .title_box {
  164. margin-top: 20rpx;
  165. .name {
  166. font-size: 28rpx;
  167. font-style: normal;
  168. font-weight: 400;
  169. color: $theme-color;
  170. padding-left: 20rpx;
  171. position: relative;
  172. &:before {
  173. position: absolute;
  174. content: '';
  175. left: 0rpx;
  176. top: 0rpx;
  177. bottom: 0rpx;
  178. width: 4rpx;
  179. height: 28rpx;
  180. background: $theme-color;
  181. margin: auto;
  182. }
  183. }
  184. .left {
  185. width: 40rpx;
  186. }
  187. .btn_box {
  188. padding: 0 18rpx;
  189. height: 60rpx;
  190. background: $theme-color;
  191. font-size: 26rpx;
  192. font-style: normal;
  193. font-weight: 400;
  194. font-size: 24rpx;
  195. color: #fff;
  196. border-radius: 4rpx;
  197. .scan {
  198. width: 34rpx;
  199. height: 34rpx;
  200. margin-right: 12rpx;
  201. }
  202. }
  203. }
  204. .content_table {
  205. margin-top: 8rpx;
  206. width: 100%;
  207. border: 2rpx solid $border-color;
  208. .item {
  209. display: flex;
  210. border-bottom: 2rpx solid $border-color;
  211. .lable {
  212. width: 132rpx;
  213. text-align: center;
  214. background-color: #F7F9FA;
  215. font-size: 26rpx;
  216. border-right: 2rpx solid $border-color;
  217. flex-shrink: 0;
  218. }
  219. .ww80 {
  220. width: 80rpx;
  221. }
  222. .ww50 {
  223. width: 50%;
  224. }
  225. .content {
  226. width: 518rpx;
  227. min-height: 64rpx;
  228. font-size: 28rpx;
  229. line-height: 28rpx;
  230. font-style: normal;
  231. font-weight: 400;
  232. padding: 2rpx 8rpx;
  233. box-sizing: border-box;
  234. word-wrap: break-word;
  235. flex-grow: 1 !important;
  236. font-size: 24rpx;
  237. }
  238. &:last-child {
  239. border-bottom: none;
  240. }
  241. }
  242. }
  243. .content_table2 {
  244. width: 100%;
  245. .row {
  246. width: 100%;
  247. .item {
  248. color: #404446;
  249. font-size: 28rpx;
  250. padding-left: 12rpx;
  251. }
  252. .color157 {
  253. color: $theme-color;
  254. }
  255. .ww20 {
  256. width: 20%;
  257. }
  258. .ww35 {
  259. width: 35%;
  260. }
  261. .ww15 {
  262. width: 15%;
  263. }
  264. .ww25 {
  265. width: 25%;
  266. }
  267. .ww30 {
  268. width: 30%;
  269. }
  270. .ww15 {
  271. width: 15%;
  272. }
  273. .ww10 {
  274. width: 10%;
  275. }
  276. }
  277. .head {
  278. height: 64rpx;
  279. background: #F7F9FA;
  280. border-top: 2rpx solid #E3E5E5;
  281. border-left: 2rpx solid #E3E5E5;
  282. .item {
  283. height: 64rpx;
  284. line-height: 64rpx;
  285. border-right: 2rpx solid #E3E5E5;
  286. box-sizing: border-box;
  287. }
  288. }
  289. .tr {
  290. border-top: 2rpx solid #E3E5E5;
  291. border-left: 2rpx solid #E3E5E5;
  292. .item {
  293. font-size: 24rpx;
  294. min-height: 64rpx;
  295. display: flex;
  296. align-items: center;
  297. border-right: 2rpx solid #E3E5E5;
  298. box-sizing: border-box;
  299. white-space: normal;
  300. word-break: break-all;
  301. }
  302. &:last-child {
  303. border-bottom: 2rpx solid #E3E5E5;
  304. }
  305. }
  306. }
  307. .content_num {
  308. display: flex;
  309. align-items: center;
  310. padding: 0 4rpx;
  311. /deep/ .uni-input-input {
  312. border: 2rpx solid #F0F8F2;
  313. background: #F0F8F2;
  314. color: $theme-color;
  315. }
  316. }
  317. .check {
  318. width: 40rpx;
  319. height: 40rpx;
  320. }
  321. .isend {
  322. text-decoration: line-through;
  323. }
  324. .list_box {
  325. flex: 1;
  326. overflow: hidden;
  327. }
  328. .operate_box {
  329. padding: 10rpx 160rpx;
  330. /deep/ .u-button {
  331. width: 160rpx;
  332. }
  333. }
  334. .z_list {
  335. max-height: 500rpx;
  336. }
  337. </style>