manualPrint.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="replenishment-manualPrint-wrap">
  3. <view class="replenishment-manualPrint-body">
  4. <view class="part-list">
  5. <!-- 补货产品 -->
  6. <partList :list="partList" title="补货产品" model="checkbox" fromPage="manualPrint" ref="partList" noDataText="暂无产品" @allChecked="allCheckedCallback"></partList>
  7. </view>
  8. </view>
  9. <view class="replenishment-manualPrint-footer">
  10. <view>
  11. <u-checkbox size="40" @change="allCheckeChange" v-model="allChecked" shape="circle">{{allChecked?'取消全选':'全选'}}</u-checkbox>
  12. </view>
  13. <view>
  14. <u-button @click="handleSubmit" shape="circle" :custom-style="{background:$config('primaryColor')}" type="primary">开始打印</u-button>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import { shelfReplenishDetail, shelfReplenishDetailList, shelfReplenishPrintSign } from '@/api/shelfReplenish'
  21. import partList from '@/pages/common/partList.vue'
  22. export default {
  23. components: { partList },
  24. data() {
  25. return {
  26. replenishBillSn: '',
  27. basicInfoData:null,
  28. partList: [],
  29. allChecked: false,
  30. }
  31. },
  32. onReady() {
  33. uni.setNavigationBarColor({
  34. frontColor: '#ffffff',
  35. backgroundColor: this.$config('primaryColor')
  36. })
  37. },
  38. onLoad(option) {
  39. this.replenishBillSn = option.sn
  40. this.getDetail()
  41. this.getPartList()
  42. },
  43. methods: {
  44. // 查询详情
  45. getDetail(){
  46. shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
  47. if(res.status == 200){
  48. this.basicInfoData = res.data || null
  49. }else{
  50. this.basicInfoData = null
  51. }
  52. })
  53. },
  54. // 查询列表
  55. getPartList(){
  56. const _this = this
  57. shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
  58. if(res.status == 200 && res.data){
  59. res.data.map(item =>{
  60. item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
  61. item.printQty = item.confirmQty ? Number(item.confirmQty) : 0
  62. })
  63. this.partList = res.data || []
  64. }else{
  65. this.partList = []
  66. }
  67. })
  68. },
  69. // 开始打印
  70. handleSubmit(){
  71. const result =this.$refs.partList.getAllChecked()
  72. if(result.length){
  73. const arr = []
  74. result.map((item, index) => {
  75. if (item.printQty || item.printQty == 0) {
  76. arr.push({ productSn: item.productSn, printQty: item.printQty })
  77. }
  78. })
  79. const params = {
  80. replenishBillSn: this.replenishBillSn,
  81. detailList: arr
  82. }
  83. shelfReplenishPrintSign(params).then(res => {
  84. if(res.status == 200){
  85. uni.$emit("refreshBL")
  86. uni.navigateBack()
  87. }
  88. this.toashMsg(res.message)
  89. })
  90. }else{
  91. this.toashMsg("请选择产品!")
  92. }
  93. },
  94. // 全选
  95. allCheckeChange(e){
  96. this.$refs.partList.allSelect(e.value)
  97. },
  98. allCheckedCallback(val){
  99. this.allChecked = val
  100. },
  101. }
  102. }
  103. </script>
  104. <style lang="less">
  105. .replenishment-manualPrint-wrap{
  106. position: relative;
  107. width: 100%;
  108. height: 100%;
  109. overflow: hidden;
  110. padding-bottom: 102upx;
  111. .replenishment-manualPrint-body{
  112. > view{
  113. padding: 10rpx 25rpx;
  114. background-color: #fff;
  115. margin-bottom: 20rpx;
  116. border-radius: 25rpx;
  117. box-shadow: 2rpx 3rpx 5rpx #eee;
  118. }
  119. }
  120. .replenishment-manualPrint-footer{
  121. padding: 10upx 32upx 12upx;
  122. background-color: #fff;
  123. position: fixed;
  124. left: 0;
  125. bottom: 0;
  126. width: 100%;
  127. box-shadow: 3px 1px 7px #eee;
  128. display: flex;
  129. align-items: center;
  130. justify-content: space-between;
  131. }
  132. }
  133. </style>