checkDtl.vue 6.1 KB

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