turnoverPopup.vue 7.5 KB

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