index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="p-content">
  3. <view class="p-head" v-if="baseData">
  4. <view>
  5. <text>采购单号:</text>
  6. <text style="color: crimson;">{{baseData[0].purchaseBillNo}}</text>
  7. </view>
  8. <view>
  9. <text>发货单号:</text>
  10. <text style="color: crimson;">{{baseData[0].sendBillNo}}</text>
  11. </view>
  12. <view>
  13. <text>条码:</text>
  14. <view>
  15. <input
  16. @blur="queryProduct"
  17. style="width: 100%;text-align: left;"
  18. class="uni-input"
  19. placeholder="扫描或输入条码"
  20. border="surround"
  21. v-model="code">
  22. </view>
  23. </view>
  24. <view style="justify-content: flex-start;flex-wrap: wrap;" v-for="(item,bindex) in baseData" :key="item.id">
  25. <view>总款数:{{ item.totalPutCategory }}</view>
  26. <view>本次发货数量合计: {{ item.totalPutQty }}</view>
  27. <view>本次发货金额合计: {{ item.totalPutAmount?toThousands(item.totalPutAmount,2):'0.00' }}</view>
  28. <view>本次入库数量合计: {{ item && (item.totalRealPutQty || item.totalRealPutQty==0) ? item.totalRealPutQty : '--' }}</view>
  29. <view>本次入库金额合计: {{ item && (item.totalRealPutAmount || item.totalRealPutAmount==0) ? toThousands(item.totalRealPutAmount, 2) : '--' }}</view>
  30. </view>
  31. </view>
  32. <view class="p-body">
  33. <uni-table style="width: 100%;" border emptyText="暂无数据" :loading="loading" >
  34. <!-- 表头行 -->
  35. <uni-tr>
  36. <uni-td align="center">产品编码</uni-td>
  37. <uni-td align="center">产品分类</uni-td>
  38. <uni-td align="center">入库/发货数量</uni-td>
  39. <uni-td align="center">入库金额</uni-td>
  40. </uni-tr>
  41. <!-- 表格数据行 -->
  42. <uni-tr v-for="item in detailList" :key="item.id" :checkedRow="curProduct&&curProduct.qrCode == item.qrCode">
  43. <uni-td width="30%" align="center">{{item.dealerProductEntity.code}}</uni-td>
  44. <uni-td width="30%" align="center">{{item.dealerProductEntity.productTypeName2}}</uni-td>
  45. <uni-td width="25%" align="center"><text style="color: red;">{{item.realPutQty}}</text>/{{item.putQty}}</uni-td>
  46. <uni-td width="15%" align="center">
  47. {{item.realPutAmount}}
  48. </uni-td>
  49. </uni-tr>
  50. </uni-table>
  51. </view>
  52. <view class="p-footer">
  53. <button :disabled="loading" size="mini" type="primary" @click="toOut"> 入库 <text class="iconfont icon-icon-test43"></text></button>
  54. </view>
  55. <scanCode></scanCode>
  56. </view>
  57. </template>
  58. <script>
  59. import scanCode from '@/libs/scan-code.vue';
  60. import { purchaseWriteStockIn, receivingQuery, receivingDetail, purchaseUpdateWarehouse, updateRealPutQty } from '@/config/api.js'
  61. import { playAudio, toThousands } from '@/libs/tools.js'
  62. export default {
  63. components: { scanCode },
  64. data() {
  65. return {
  66. loading: false,
  67. baseData: null,
  68. detailList:[],
  69. code:'',
  70. receivingBillSn: null,
  71. salesId: null,
  72. curProduct: null,
  73. toThousands
  74. };
  75. },
  76. onLoad(opts) {
  77. var _this = this
  78. this.receivingBillSn = opts.receivingBillSn
  79. this.salesId = opts.id
  80. this.getDetail()
  81. this.getDetailList()
  82. uni.$on('scancodedate', function(content) {
  83. console.log("扫描到的内容为:", content)
  84. _this.code = content||''
  85. _this.queryProduct()
  86. })
  87. },
  88. onShow() {
  89. this.hideKeyborder()
  90. },
  91. onUnload() {
  92. uni.$off('scancodedate')
  93. },
  94. methods: {
  95. hideKeyborder(){
  96. uni.hideKeyboard()
  97. },
  98. //检货
  99. queryProduct(){
  100. if(this.code==''){return}
  101. this.loading = true
  102. salesPick({receivingBillSn: this.receivingBillSn, productQrCode: this.code}).then(res => {
  103. console.log(res)
  104. if(res.status == 200){
  105. if(res.data){
  106. this.getDetailList()
  107. }else{
  108. uni.$u.toast("此商品不存在")
  109. playAudio('error')
  110. }
  111. }
  112. this.loading = false
  113. })
  114. },
  115. // 详情
  116. getDetail(){
  117. receivingQuery({receivingBillSn: this.receivingBillSn}).then(res => {
  118. console.log(res,'详情')
  119. if(res.status == 200){
  120. this.baseData = res.data
  121. }
  122. })
  123. },
  124. // 产品明细列表
  125. getDetailList(){
  126. receivingDetail({pageNo:1,pageSize:1000,receivingBillSn:this.receivingBillSn}).then(res => {
  127. if(res.status == 200){
  128. this.detailList = res.data.list
  129. const curProduct = this.detailList.find(item => item.qrCode == this.code)
  130. this.curProduct = curProduct || null
  131. }
  132. })
  133. },
  134. // 入库
  135. async toOut(){
  136. const ret = await salesWriteStockOut({receivingBillSn: this.receivingBillSn})
  137. if(ret.status == 200){
  138. this.$store.state.vuex_isRefash = true
  139. uni.navigateBack()
  140. }
  141. }
  142. },
  143. }
  144. </script>
  145. <style lang="scss">
  146. .p-content{
  147. .p-head{
  148. font-size: 32upx;
  149. color: $uni-text-color;
  150. >view{
  151. display: flex;
  152. align-items: center;
  153. padding: 10upx 20upx;
  154. border-bottom: 1px solid #eee;
  155. > view{
  156. display: flex;
  157. padding: 0 10upx;
  158. align-items: center;
  159. }
  160. }
  161. .uni-input{
  162. border: 1px solid #eee;
  163. width: 150upx;
  164. text-align: center;
  165. padding: 8upx;
  166. }
  167. }
  168. .p-body{
  169. overflow: auto;
  170. flex-grow: 1;
  171. height: 50%;
  172. }
  173. .p-footer{
  174. padding:30upx;
  175. display: flex;
  176. > button{
  177. width: 40%;
  178. }
  179. }
  180. }
  181. </style>