index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="p-content">
  3. <view class="p-head" v-if="baseData">
  4. <view>
  5. <view>
  6. <text>店内调出单号:</text>
  7. <text style="color: crimson;">{{baseData.storeCallOutNo}}</text>
  8. </view>
  9. <view>
  10. <button :disabled="loading" size="mini" type="primary" @click="toOut"> 出库 <text class="iconfont icon-icon-test43"></text></button>
  11. </view>
  12. </view>
  13. <view>
  14. <text>条形码:</text>
  15. <view>
  16. <input
  17. @blur="addQty(true)"
  18. style="width: 100%;text-align: left;"
  19. class="uni-input"
  20. placeholder="扫描或输入条形码"
  21. border="surround"
  22. v-model="code">
  23. </view>
  24. </view>
  25. <view>
  26. <text>产品编码:</text>
  27. <view>
  28. <input
  29. @blur="addQty(true)"
  30. style="width: 100%;text-align: left;"
  31. class="uni-input"
  32. placeholder="请输入产品编码"
  33. border="surround"
  34. v-model="productCode">
  35. </view>
  36. </view>
  37. <view style="justify-content: flex-start;flex-wrap: wrap;">
  38. <view>已拣款数: <text style="color: red;">{{baseData.pickCategory||0}}</text>/{{baseData.productTotalCategory}}</view>
  39. <view>已拣数量: <text style="color: red;">{{baseData.pickQty||0}}</text>/{{baseData.productTotalQty}}</view>
  40. </view>
  41. </view>
  42. <view class="p-body">
  43. <uni-table style="width: 100%;" border emptyText="暂无数据" :loading="loading" >
  44. <!-- 表头行 -->
  45. <uni-tr>
  46. <uni-td align="center">产品编码</uni-td>
  47. <uni-td align="center">产品分类</uni-td>
  48. <uni-td align="center">已拣/总数</uni-td>
  49. <uni-td align="center">拣货</uni-td>
  50. </uni-tr>
  51. <!-- 表格数据行 -->
  52. <uni-tr
  53. v-for="item in detailList"
  54. :key="item.id"
  55. :checkedRow="curProduct&&(item.productCode == curProduct.productCode)">
  56. <uni-td width="30%" align="center">
  57. <view @click="copyText(item.productCode)">{{item.productCode}}</view>
  58. </uni-td>
  59. <uni-td width="30%" align="center">{{item.productTypeName3||'--'}}</uni-td>
  60. <uni-td width="25%" align="center"><text style="color: red;">{{item.pickQty||0}}</text>/{{item.outQty}}</uni-td>
  61. <uni-td width="15%" align="center">
  62. <view style="display: flex;justify-content: center;">
  63. <u-icon v-if="item.pickFlag==0" name="close-circle-fill" color="red" size="22"></u-icon>
  64. <u-icon v-if="item.pickFlag==1" name="checkmark-circle-fill" color="green" size="22"></u-icon>
  65. <u-icon v-if="item.pickFlag==2" name="info-circle-fill" color="#ffaa00" size="22"></u-icon>
  66. </view>
  67. </uni-td>
  68. </uni-tr>
  69. </uni-table>
  70. </view>
  71. <view class="p-footer">
  72. <button size="mini" type="warn" @click="addQty(false)"> <text class="iconfont icon-reduce-btn"> 减 </text></button>
  73. <button size="mini" type="primary" @click="addQty(true)"> <text class="iconfont icon-add-btn"> 加 </text></button>
  74. </view>
  75. <scanCode></scanCode>
  76. </view>
  77. </template>
  78. <script>
  79. import scanCode from '@/libs/scan-code.vue';
  80. import { storeCallOutDetail, storeCallOutDetailList, storeCallOutPick, storeCallOutOut } from '@/config/api.js'
  81. import { playAudio } from '@/libs/tools.js'
  82. import clipboard from "@/js_sdk/dc-clipboard/clipboard.js"
  83. export default {
  84. components: { scanCode },
  85. data() {
  86. return {
  87. loading: false,
  88. baseData: null,
  89. detailList:[],
  90. code:'',
  91. productCode: '',
  92. storeCallOutSn: null,
  93. storeCallOutId: null,
  94. curProduct: null
  95. };
  96. },
  97. onLoad(opts) {
  98. var _this = this
  99. this.storeCallOutSn = opts.storeCallOutSn
  100. this.storeCallOutId = opts.id
  101. this.getDetail()
  102. this.getDetailList()
  103. uni.$on('scancodedate', function(content) {
  104. console.log("扫描到的内容为:", content)
  105. _this.code = content||''
  106. _this.addQty(true)
  107. })
  108. },
  109. onUnload() {
  110. uni.$off('scancodedate')
  111. },
  112. onShow() {
  113. this.hideKeyborder()
  114. },
  115. methods: {
  116. hideKeyborder(){
  117. uni.hideKeyboard()
  118. },
  119. // 复制
  120. copyText(text){
  121. clipboard.setText(text);
  122. uni.showToast({
  123. icon: 'none',
  124. title: '编码已复制成功'
  125. })
  126. },
  127. getCurProduct(){
  128. const curProduct = this.detailList.find(item => item.productQrCode == this.code || item.productCode == this.productCode)
  129. this.curProduct = curProduct || null
  130. return curProduct || null
  131. },
  132. addQty(flag){
  133. const curProduct = this.getCurProduct()
  134. if(curProduct){
  135. if(curProduct.pickFlag != 1 || !flag){
  136. this.queryProduct((curProduct.pickQty||0)+1*(flag?1:-1))
  137. }else{
  138. uni.$u.toast("此商品已全部拣货")
  139. playAudio('warn')
  140. }
  141. }else{
  142. if(this.code == '' && this.productCode == ''){
  143. uni.$u.toast("请扫描条形码或输入编码")
  144. }else{
  145. uni.$u.toast("此商品不存在")
  146. }
  147. playAudio('warn')
  148. }
  149. },
  150. //拣货
  151. queryProduct(pickQty){
  152. this.loading = true
  153. const params = {
  154. storeCallOutSn: this.storeCallOutSn,
  155. productQrCode: this.code,
  156. productCode: this.productCode,
  157. pickQty: pickQty
  158. }
  159. console.log(params)
  160. storeCallOutPick(params).then(res => {
  161. console.log(res)
  162. if(res.status == 200){
  163. if(res.data){
  164. this.getDetail()
  165. this.getDetailList()
  166. }else{
  167. uni.$u.toast("此商品不存在")
  168. playAudio('error')
  169. }
  170. }
  171. this.loading = false
  172. })
  173. },
  174. // 详情
  175. getDetail(){
  176. storeCallOutDetail({sn: this.storeCallOutSn}).then(res => {
  177. console.log(res,'详情')
  178. if(res.status == 200){
  179. this.baseData = res.data
  180. }
  181. })
  182. },
  183. // 产品明细列表
  184. getDetailList(){
  185. storeCallOutDetailList({pageNo:1,pageSize:1000,storeCallOutSn:this.storeCallOutSn}).then(res => {
  186. console.log(res)
  187. if(res.status == 200){
  188. this.detailList = res.data.list
  189. this.getCurProduct()
  190. }
  191. })
  192. },
  193. // 出库
  194. async toOut(){
  195. const ret = await storeCallOutOut({storeCallOutSn: this.storeCallOutSn})
  196. if(ret.status == 200){
  197. this.$store.state.vuex_isRefash = true
  198. uni.navigateBack()
  199. }
  200. }
  201. },
  202. }
  203. </script>
  204. <style lang="scss">
  205. .p-content{
  206. .p-head{
  207. font-size: 32upx;
  208. color: $uni-text-color;
  209. >view{
  210. display: flex;
  211. align-items: center;
  212. padding: 10upx 20upx;
  213. border-bottom: 1px solid #eee;
  214. justify-content: space-between;
  215. > view{
  216. display: flex;
  217. padding: 0 10upx;
  218. align-items: center;
  219. }
  220. }
  221. .uni-input{
  222. border: 1px solid #eee;
  223. width: 150upx;
  224. text-align: center;
  225. padding: 8upx;
  226. }
  227. }
  228. .p-body{
  229. overflow: auto;
  230. flex-grow: 1;
  231. height: 50%;
  232. }
  233. .p-footer{
  234. padding:20upx 30upx;
  235. display: flex;
  236. > button{
  237. width: 30%;
  238. }
  239. }
  240. }
  241. </style>