InventorySubmit.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <view class="InventorySubmit">
  3. <uni-search-bar @confirm="getData" v-model="req.keyword" @cancel="reload">
  4. </uni-search-bar>
  5. <view class="dtl" style="font-size: 24rpx;">
  6. <view class="">
  7. 物料编码:{{option.materialCode}}
  8. </view>
  9. <view class="">
  10. 物料名称:{{option.materialName}}
  11. </view>
  12. <view class="">
  13. 库存件数:{{option.materialCount}} <span style="margin-left:30rpx;">库存数量:{{option.materialSum}}</span>
  14. </view>
  15. <view class="" style="color:#0066CC">
  16. 已盘件数:{{option.handleMaterialCount}} <span
  17. style="margin-left:30rpx;">已盘数量:{{option.handleMaterialSum}}</span>
  18. </view>
  19. </view>
  20. <view class="commons-title">
  21. 盘点明细
  22. </view>
  23. <view class="addQrcode-list" v-for="(i,index) in listData" :key="i.qrCode" @click="operation(i)">
  24. <view class="fl">
  25. <view class="" style="color: #aaaaaa;">
  26. 二维码编号:{{i.qrCode}}
  27. </view>
  28. <view class="">
  29. 绑定数量:{{i.quantity}}
  30. </view>
  31. </view>
  32. <view class="fr" style="width:200rpx;text-align: right;">
  33. <uni-icons v-if="i.checkTagState == 0" type="checkbox-filled" color="#0066CC" size="30"></uni-icons>
  34. <uni-icons v-if="i.checkTagState == 1" type="checkbox-filled" color="red" size="30"></uni-icons>
  35. <uni-icons v-if="i.checkTagState == 2" type="checkbox-filled" color="#dcdcdc" size="30"></uni-icons>
  36. <span style="position: relative;top:-10rpx">
  37. {{i.checkTagState == 0 ? '正常' : i.checkTagState == 1 ? ' 不在库存' : ' 未扫描'}}
  38. </span>
  39. </view>
  40. </view>
  41. <view class="submit-box" style="margin-top:30rpx">
  42. <button @click="scanCode">继续盘点</button>
  43. </view>
  44. <view class="submit-box" style="margin-top:30rpx">
  45. <button @click="recordSubmit" style="background: #0066CC;color:#fff;">提 交</button>
  46. </view>
  47. <uni-popup ref="popup" type="center" background-color="#fff">
  48. <view class="popup-content" >
  49. <h3>异常处置</h3>
  50. <view class="">
  51. 物料编码:{{qrCodeData.materialCode}}
  52. </view>
  53. <view class="">
  54. 物料名称:{{qrCodeData.materialName}}
  55. </view>
  56. <view class="">
  57. 二维码编号:{{qrCodeData.qrCode}}
  58. </view>
  59. <view class="" style="display: flex;justify-content: space-between;">
  60. <view class="" >
  61. 绑定数量:{{qrCodeData.quantity}}
  62. </view>
  63. <view style="display: flex;justify-content: space-between;">
  64. <uni-icons v-if="qrCodeData.checkTagState == 0" type="checkbox-filled" color="#0066CC" size="30"></uni-icons>
  65. <uni-icons v-if="qrCodeData.checkTagState == 1" type="checkbox-filled" color="red" size="30"></uni-icons>
  66. <uni-icons v-if="qrCodeData.checkTagState == 2" type="checkbox-filled" color="#dcdcdc" size="30"></uni-icons>
  67. <span>
  68. {{qrCodeData.checkTagState == 0 ? '正常' : qrCodeData.checkTagState == 1 ? ' 不在库存' : ' 未扫描'}}
  69. </span>
  70. </view>
  71. </view>
  72. <view class="">
  73. <view class="commons-title" style="font-size: 24rpx;">
  74. <span style="color: red;">*</span>请选择处置类型:
  75. </view>
  76. <picker @change="bindPickerChange" :range="tagDealTypeData" range-key="title">
  77. <view class="" style="text-align: right;display: flex;justify-content: space-between;">
  78. <view class="">
  79. {{formData.tagDealTypeName || '请选择处置类型'}}
  80. </view>
  81. <uni-icons type="forward" size="20"></uni-icons>
  82. </view>
  83. </picker>
  84. <picker @change="bindPickerChange2" :range="userList" v-if="formData.tagDealType === 21" range-key="nickName">
  85. <view class="" style="text-align: right;display: flex;justify-content: space-between;">
  86. <view class="">
  87. {{formData.operUserName || '请选择人员'}}
  88. </view>
  89. <uni-icons type="forward" size="20"></uni-icons>
  90. </view>
  91. </picker>
  92. </view>
  93. <view class="">
  94. <p>备注:</p>
  95. <input v-model="formData.remark" type="text" value="" />
  96. </view>
  97. </view>
  98. <view style="text-align: center;">
  99. <button @click="$refs.popup.close()" size="mini" type="default" style="margin-right: 20rpx;width: 140rpx;">取消</button>
  100. <button @click="addOrEditTag" size="mini" type="default" style="width: 140rpx;background: #0066CC;color: #fff;">确定</button>
  101. </view>
  102. </uni-popup>
  103. <uni-popup ref="popup2" type="center" background-color="#fff">
  104. <view class="popup-content" >
  105. <h3>盘点结果</h3>
  106. <view class="">
  107. 物料类型:{{qrCodeData.categoryName}}
  108. </view>
  109. <view class="">
  110. 物料编码:{{qrCodeData.materialCode}}
  111. </view>
  112. <view class="">
  113. 物料名称:{{qrCodeData.materialName}}
  114. </view>
  115. <view class="">
  116. 所在仓库:{{qrCodeData.stockHouseName}}
  117. </view>
  118. <view class="" style="display: flex;justify-content: space-between;">
  119. <view class="">
  120. 库存件数:{{option.materialCount}}
  121. </view>
  122. <view >
  123. 扫描件数:{{option.handleMaterialCount}}
  124. </view>
  125. </view>
  126. <view style="color:red">
  127. 异常件数:{{option.materialCount - option.handleMaterialCount + errorNum}}
  128. </view>
  129. <view class="">
  130. <p><span style="color: red;">*</span>实物件数:</p>
  131. <input v-model="req.handTagCount" type="number" value="" />
  132. </view>
  133. </view>
  134. <view style="text-align: center;">
  135. <button @click="$refs.popup2.close()" size="mini" type="default" style="margin-right: 20rpx;width: 140rpx;">取消</button>
  136. <button @click="addOrEditTag2" size="mini" type="default" style="width: 140rpx;background: #0066CC;color: #fff;">确定</button>
  137. </view>
  138. </uni-popup>
  139. </view>
  140. </template>
  141. <script>
  142. import {
  143. getInfo
  144. } from "@/util/api.js";
  145. import {
  146. dateFormat,
  147. getTime
  148. } from '../../util/uitl.js'
  149. export default {
  150. data() {
  151. return {
  152. listData: [],
  153. listDataDtl:{},
  154. req: {
  155. keyword: null,
  156. handTagCount:0,
  157. },
  158. option: {
  159. handleMaterialCount: 0,
  160. handleMaterialSum: 0,
  161. },
  162. formData:{
  163. tagDealType:null,
  164. operUserName:null,
  165. },
  166. qrCodeData: {
  167. stockHouseName:null,
  168. },
  169. userList:[],
  170. tagDealTypeData:[],
  171. errorNum:0,
  172. }
  173. },
  174. onLoad(option) {
  175. const v = this
  176. v.option = JSON.parse(decodeURIComponent(option.data))
  177. v.option.handleMaterialCount = 0
  178. v.option.handleMaterialSum = 0
  179. console.log(v.option)
  180. v.req.recordDetailsId = v.option.recordDetailsId
  181. v.$post('/wx/common/getUser',{}).then(res=>{
  182. v.userList = res.data
  183. })
  184. v.getData()
  185. },
  186. methods: {
  187. addOrEditTag2(){
  188. const v = this
  189. v.$post('/wx/record/submit',v.req).then(res=>{
  190. if(res.code == 200){
  191. uni.showToast({
  192. title: '提交成功'
  193. })
  194. setTimeout(()=>{
  195. wx.reLaunch({
  196. url: '/pages/home'
  197. })
  198. },2000)
  199. }
  200. })
  201. },
  202. recordSubmit(){
  203. const v = this
  204. v.$refs.popup2.open()
  205. },
  206. addOrEditTag(){
  207. const v = this
  208. v.formData.tagDealType = 0
  209. v.formData.checkTagState = 0
  210. v.formData.recordId = v.option.recordDetailsId
  211. v.formData.recordDetailsId = v.option.recordDetailsId
  212. v.formData = Object.assign(v.formData,v.qrCodeData)
  213. delete v.formData.createTime
  214. uni.showToast({
  215. icon: "loading",
  216. title: '加载中',
  217. duration: 1500
  218. });
  219. v.$post('/wx/record/addOrEditTag',v.formData).then(res=>{
  220. if(res.code == 200){
  221. uni.showToast({
  222. title: '提交成功'
  223. })
  224. v.$refs.popup.close()
  225. v.formData = {
  226. tagDealType:null,
  227. operUserName:null,
  228. }
  229. }
  230. })
  231. console.log(v.formData)
  232. },
  233. bindPickerChange2(e){
  234. const v = this
  235. console.log(v.userList[e.detail.value])
  236. v.formData.operUserName = v.userList[e.detail.value].nickName
  237. v.formData.checkUser = v.userList[e.detail.value].userId
  238. },
  239. bindPickerChange(e) {
  240. const v = this
  241. v.formData.tagDealType = v.tagDealTypeData[e.detail.value].type
  242. v.formData.tagDealTypeName = v.tagDealTypeData[e.detail.value].title
  243. },
  244. operation(i,_type) {
  245. const v = this
  246. v.$post('/wx/common/gerMaterialInfoByQrcode', {
  247. qrCode: i.qrCode
  248. }).then(res => {
  249. v.qrCodeData = Object.assign(res.data,i)
  250. if(_type) return
  251. if(i.checkTagState == 1){
  252. v.tagDealTypeData = [{title:"盘盈",type:11},{title:"补入库",type:13}]
  253. v.$refs.popup.open()
  254. }
  255. if(i.checkTagState == 2){
  256. v.tagDealTypeData = [{title:"盘亏",type:21},{title:"补出库",type:23},{title:"绑定错误",type:24}]
  257. v.$refs.popup.open()
  258. }
  259. })
  260. },
  261. scanCode(_isReload) {
  262. const v = this
  263. uni.scanCode({
  264. onlyFromCamera: true,
  265. success: function(res1) {
  266. uni.showToast({
  267. icon: "loading",
  268. title: '加载中',
  269. duration: 1500
  270. });
  271. v.$post('/wx/common/gerMaterialInfoByQrcode', {
  272. qrCode: res1.result
  273. }).then(res => {
  274. v.qrCodeData = res.data
  275. var isExistence = false
  276. for (var i = 0; i < v.listData.length; i++) {
  277. if (v.listData[i].qrCode == res1.result) {
  278. if(v.listData[i].checkTagState == 0) return
  279. v.listData[i].checkTagState = 0
  280. v.option.handleMaterialCount++
  281. v.option.handleMaterialSum += res.data.quantity
  282. isExistence = true
  283. v.formData.tagDealType = 0
  284. v.formData.checkTagState = 0
  285. v.formData.recordId = v.option.recordDetailsId
  286. v.formData.recordDetailsId = v.option.recordDetailsId
  287. v.formData = Object.assign(v.formData,v.qrCodeData,v.listData[i])
  288. delete v.formData.createTime
  289. v.$post('/wx/record/addOrEditTag',v.formData).then(res=>{
  290. })
  291. }
  292. }
  293. if(!isExistence){
  294. const msg = res.data
  295. msg.checkTagState = 1
  296. v.errorNum ++
  297. v.listData.push(msg)
  298. }
  299. })
  300. }
  301. });
  302. },
  303. reload() {
  304. this.req.keyword = null
  305. this.getData()
  306. },
  307. getData() {
  308. const v = this
  309. v.$post('/wx/record/getTagList', v.req).then(res => {
  310. v.listData = res.data
  311. if(v.listData.length > 0){
  312. v.operation(v.listData[0],true)
  313. }
  314. for (var i = 0; i < res.data.length; i++) {
  315. if (res.data[i].checkTagState == 0) {
  316. v.option.handleMaterialCount ++
  317. v.option.handleMaterialSum += res.data[i].quantity
  318. }
  319. }
  320. })
  321. },
  322. },
  323. }
  324. </script>
  325. <style lang="less">
  326. .InventorySubmit {
  327. padding: 0 30rpx;
  328. .popup-content{
  329. width: 500rpx;
  330. font-size: 24rpx;
  331. border-radius: 10rpx;
  332. padding: 0 40rpx 40rpx;
  333. line-height: 60rpx;
  334. h3{
  335. text-align: center;
  336. height: 80rpx;
  337. line-height: 80rpx;
  338. font-size: 34rpx;
  339. }
  340. input{
  341. border:1px solid #dcdcdc;
  342. }
  343. }
  344. .addQrcode-list {
  345. height: 80rpx;
  346. display: flex;
  347. justify-content: space-between;
  348. padding: 15rpx;
  349. border-bottom: 1rpx solid #dcdcdc;
  350. font-size: 24rpx;
  351. .fr {
  352. line-height: 80rpx;
  353. color: #0066CC;
  354. }
  355. }
  356. }
  357. </style>