checkDtl.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="checkDtl">
  3. <view class="dtl">
  4. <view class="">
  5. 物料编码:{{option.materialCode}}
  6. </view>
  7. <view class="">
  8. 物料名称:{{option.materialName}}
  9. </view>
  10. <view class="">
  11. 供应商:{{option.supplierName || '暂无'}}
  12. </view>
  13. <view class="">
  14. 合同编号:{{option.purchaseBillNo}} <span style="margin-left:30rpx;">批次号:{{option.batchNo}}</span>
  15. </view>
  16. <view class="" >
  17. 待质检:{{option.notCheckNum}} <span style="margin-left:30rpx;color:#C280FF">已质检:{{checkListData.length}}</span>
  18. </view>
  19. </view>
  20. <view class="commons-title" style="margin: 0 30rpx;">
  21. 质检明细
  22. </view>
  23. <view class="addQrcode-list" v-for="(i,index) in checkListData" :key="index" @click="toRouter(index)">
  24. <view class="fl" >
  25. <view class="code" style="font-size: 24rpx;">
  26. <view class="">
  27. 二维码编号:{{i.qrCode}}
  28. </view>
  29. <view class="">
  30. 绑定数量:{{i.quantity}}
  31. </view>
  32. <view class="">
  33. 称重结果:{{i.weighingResults + 'kg' || '暂无'}}
  34. </view>
  35. <view class="">
  36. 换算数量:{{i.conversionQuantity || '暂无'}}
  37. </view>
  38. </view>
  39. </view>
  40. <view class="fr">
  41. <uni-icons type="forward" size="30"></uni-icons>
  42. </view>
  43. </view>
  44. <view style="padding: 0 30rpx;" class="" v-if="dtlData.inStockNum < option.notCheckNum && dtlData.inStockNum == checkListData.length">
  45. <uni-forms ref="baseForm" :modelValue="formData" label-position="top">
  46. <view class="commons-title">
  47. 免检申请
  48. </view>
  49. <uni-forms-item label="申请原因">
  50. <uni-easyinput v-model="formData.remark" type="number" placeholder="请输入申请原因" />
  51. </uni-forms-item>
  52. </uni-forms>
  53. </view>
  54. <button size="mini" type="default" style="width: 500rpx;margin: 30rpx auto;display: block;"
  55. @click="scanCode(true)">
  56. + 扫码添加
  57. </button>
  58. <view class="submit-box"
  59. v-if="option.notCheckNum <= checkListData.length ||
  60. dtlData.inStockNum == checkListData.length">
  61. <view v-if="dtlData.inStockNum < option.notCheckNum">
  62. <p>当前批次剩余数量小于应质检数量</p>
  63. <p>完成剩余质检并填写免检原因</p>
  64. </view>
  65. <button v-if="checkListData.length == dtlData.inStockNum" @click="exemptInspection" style="background: #0066CC;color:#fff;margin-bottom: 30rpx;">免检提交</button>
  66. <button v-else @click="checkSubmit" style="background: #0066CC;color:#fff;margin-bottom: 30rpx;">提交</button>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. getInfo
  73. } from "@/util/api.js";
  74. export default {
  75. data() {
  76. return {
  77. dtlData:{},
  78. req:{
  79. keyword:null,
  80. materialId:null
  81. },
  82. option:{},
  83. checkListData:[],
  84. formData:{},
  85. }
  86. },
  87. onLoad(option) {
  88. const v = this
  89. v.option = JSON.parse(decodeURIComponent(option.data))
  90. console.log(v.option)
  91. v.req.id = v.option.id
  92. v.getData()
  93. },
  94. methods: {
  95. exemptInspection(){
  96. const v = this
  97. v.formData.quantitycheckId = v.option.id
  98. v.$post('/wx/check/exemptInspection',v.formData).then(res=>{
  99. if(res.code == 200){
  100. uni.showToast({
  101. title:'提交成功,跳转中!'
  102. })
  103. setTimeout(()=>{
  104. wx.reLaunch({
  105. url: '/pages/home'
  106. })
  107. },2000)
  108. }
  109. })
  110. },
  111. checkSubmit(){
  112. const v = this
  113. v.$post('/wx/check/weighSubmit',v.checkListData).then(res=>{
  114. if(res.code == 200){
  115. uni.showToast({
  116. title:'提交成功,跳转中!'
  117. })
  118. setTimeout(()=>{
  119. wx.reLaunch({
  120. url: '/pages/home'
  121. })
  122. },2000)
  123. }
  124. })
  125. },
  126. scanCode(_isReload) {
  127. const v = this
  128. uni.scanCode({
  129. onlyFromCamera: true,
  130. success: function(res1) {
  131. uni.showToast({
  132. icon: "loading",
  133. title: '加载中',
  134. duration: 1500
  135. });
  136. v.$post('/wx/common/gerMaterialInfoByQrcode', {
  137. qrCode: res1.result
  138. }).then(res => {
  139. if(!res.data){
  140. uni.showToast({
  141. icon: "error",
  142. title: '无效二维码',
  143. duration: 2000
  144. });
  145. return
  146. }
  147. for (var i = 0; i < v.checkListData.length; i++) {
  148. if(v.checkListData[i].qrCode == res.data.qrCode){
  149. uni.showToast({
  150. icon: "error",
  151. title: '二维码已扫描',
  152. duration: 2000
  153. });
  154. return
  155. }
  156. }
  157. if(res.data.batchNo == v.option.batchNo && res.data.purchaseBillNo == v.option.purchaseBillNo){
  158. v.option.quantity = res.data.quantity
  159. v.option.qrCode = res1.result
  160. uni.navigateTo({
  161. url: '/pages/weigh/checkSubmit?data=' + encodeURIComponent(JSON.stringify(v.option))
  162. })
  163. }else{
  164. uni.showToast({
  165. icon: "none",
  166. title: '此物料不在此批次!',
  167. duration: 2000
  168. });
  169. return
  170. v.qrCodeList.push(res.data)
  171. v.quantitytol =+ res.data.quantity
  172. }
  173. })
  174. }
  175. });
  176. },
  177. reload(){
  178. this.req.keyword = null
  179. this.getData()
  180. },
  181. getData(){
  182. const v = this
  183. v.$post('/wx/check/weighDetails',v.req).then(res=>{
  184. v.dtlData = res.data
  185. v.checkListData = res.data.list
  186. })
  187. },
  188. toRouter(i){
  189. const v = this
  190. v.$post('/wx/check/weighDetails',v.req).then(res=>{
  191. for (var j = 0; j < res.data.list.length; j++) {
  192. if(res.data.list[j].id == v.checkListData[i].id){
  193. v.checkListData[i].id2 = res.data.list[j].id
  194. const msg = JSON.parse(JSON.stringify(res.data.list[j]))
  195. v.option.unitWeight = res.data.list[j].unitWeight
  196. v.option.weighingResults = res.data.list[j].weighingResults
  197. v.option.id2 = res.data.list[j].id
  198. v.option = Object.assign(res.data.list[j],v.option)
  199. console.log(v.option,12312312312)
  200. v.option.id = v.option.id
  201. uni.navigateTo({
  202. url: '/pages/weigh/checkSubmit?data=' + encodeURIComponent(JSON.stringify(v.option))
  203. })
  204. }
  205. }
  206. })
  207. },
  208. },
  209. }
  210. </script>
  211. <style lang="less">
  212. .checkDtl {
  213. .submit-box {
  214. position: fixed;
  215. left: 0;
  216. right: 0;
  217. bottom: 30rpx;
  218. padding: 0 30rpx;
  219. p{
  220. line-height: 50rpx;
  221. text-align: center;
  222. }
  223. }
  224. font-size: 28rpx;
  225. .dtl{
  226. padding: 30rpx;
  227. border-bottom: 1rpx solid #dcdcdc;
  228. }
  229. .addQrcode-list {
  230. height: 140rpx;
  231. display: flex;
  232. justify-content: space-between;
  233. padding: 15rpx;
  234. border-bottom: 1rpx solid #dcdcdc;
  235. .fl {
  236. display: flex;
  237. padding-left: 20rpx;
  238. .code {
  239. margin-right: 20rpx;
  240. }
  241. }
  242. .fr {
  243. line-height: 120rpx;
  244. }
  245. }
  246. }
  247. </style>