123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <view class="checkDtl">
-
- <view class="dtl">
- <view class="">
- 物料编码:{{option.materialCode}}
- </view>
- <view class="">
- 物料名称:{{option.materialName}}
- </view>
- <view class="">
- 供应商:{{option.supplierName}}
- </view>
- <view class="">
- 合同编号:{{option.purchaseBillNo}} <span style="margin-left:30rpx;">批次号:{{option.batchNo}}</span>
- </view>
- <view class="" >
- 待质检:{{option.notCheckNum}} <span style="margin-left:30rpx;color:#C280FF">已质检:{{checkListData.length}}</span>
- </view>
- </view>
- <view class="commons-title" style="margin: 0 30rpx;">
- 质检明细
- </view>
- <view class="addQrcode-list" v-for="(i,index) in checkListData" :key="index" @click="toRouter(index)">
- <view class="fl" >
- <view class="code" style="font-size: 24rpx;">
- <view class="">
- 二维码编号:{{i.qrCode}}
- </view>
- <view class="">
- 绑定数量:{{i.quantity}}
- </view>
- <view :style="i.checkJudgment == 1 ? 'color:rgb(112, 182, 3)' : 'color:rgb(112, 182, 3)'">
- 质检结论:{{i.checkJudgment == 1 ? '合格' : '不合格'}}
- </view>
- </view>
- </view>
- <view class="fr">
- <uni-icons type="forward" size="30"></uni-icons>
- </view>
- </view>
- <view style="padding: 0 30rpx;" class="" v-if="dtlData.inStockNum < option.notCheckNum && dtlData.inStockNum == checkListData.length">
- <uni-forms ref="baseForm" :modelValue="formData" label-position="top">
- <view class="commons-title">
- 免检申请
- </view>
- <uni-forms-item label="申请原因">
- <uni-easyinput v-model="formData.remark" type="number" placeholder="请输入申请原因" />
- </uni-forms-item>
- </uni-forms>
- </view>
- <button size="mini" type="default" style="width: 500rpx;margin: 30rpx auto;display: block;"
- @click="scanCode(true)">
- + 扫码添加
- </button>
-
-
- <view class="submit-box"
- v-if="option.notCheckNum <= checkListData.length ||
- dtlData.inStockNum == checkListData.length">
- <view v-if="dtlData.inStockNum < option.notCheckNum">
- <p>当前批次剩余数量小于应质检数量</p>
- <p>完成剩余质检并填写免检原因</p>
- </view>
- <button v-if="checkListData.length == dtlData.inStockNum" @click="exemptInspection" style="background: #0066CC;color:#fff;margin-bottom: 30rpx;">免检提交</button>
- <button v-else @click="checkSubmit" style="background: #0066CC;color:#fff;margin-bottom: 30rpx;">提交</button>
- </view>
-
- </view>
- </template>
- <script>
- import {
- getInfo
- } from "@/util/api.js";
- export default {
- data() {
- return {
- dtlData:{},
- req:{
- keyword:null,
- materialId:null
- },
- option:{},
- checkListData:[],
- formData:{},
- }
- },
- onLoad(option) {
- const v = this
- v.option = JSON.parse(decodeURIComponent(option.data))
- console.log(v.option)
- v.req.id = v.option.id
-
- v.getData()
-
- },
- methods: {
- exemptInspection(){
- const v = this
- v.formData.quantitycheckId = v.option.id
- v.$post('/wx/check/exemptInspection',v.formData).then(res=>{
- if(res.code == 200){
- uni.showToast({
- title:'提交成功,跳转中!'
- })
- setTimeout(()=>{
- wx.reLaunch({
- url: '/pages/home'
- })
- },2000)
- }
- })
- },
- checkSubmit(){
- const v = this
- v.$post('/wx/check/submit',v.checkListData).then(res=>{
- if(res.code == 200){
- uni.showToast({
- title:'提交成功,跳转中!'
- })
- setTimeout(()=>{
- wx.reLaunch({
- url: '/pages/home'
- })
- },2000)
- }
- })
- },
- scanCode(_isReload) {
- const v = this
- uni.scanCode({
- onlyFromCamera: true,
- success: function(res1) {
- uni.showToast({
- icon: "loading",
- title: '加载中',
- duration: 1500
- });
- v.$post('/wx/common/gerMaterialInfoByQrcode', {
- qrCode: res1.result
- }).then(res => {
- if(!res.data){
- uni.showToast({
- icon: "error",
- title: '无效二维码',
- duration: 2000
- });
- return
- }
- for (var i = 0; i < v.checkListData.length; i++) {
- if(v.checkListData[i].qrCode == res.data.qrCode){
- uni.showToast({
- icon: "error",
- title: '二维码已扫描',
- duration: 2000
- });
- return
- }
- }
- if(res.data.batchNo == v.option.batchNo && res.data.purchaseBillNo == v.option.purchaseBillNo){
- v.option.quantity = res.data.quantity
- v.option.qrCode = res1.result
- uni.navigateTo({
- url: '/pages/check/checkSubmit?data=' + encodeURIComponent(JSON.stringify(v.option))
- })
- }else{
- uni.showToast({
- icon: "none",
- title: '此物料不在此批次!',
- duration: 2000
- });
-
- return
- v.qrCodeList.push(res.data)
- v.quantitytol =+ res.data.quantity
-
-
- }
- })
- }
- });
- },
- reload(){
- this.req.keyword = null
- this.getData()
- },
- getData(){
- const v = this
- v.$post('/wx/check/detail',v.req).then(res=>{
- v.dtlData = res.data
- v.checkListData = res.data.list
- })
- },
- toRouter(i){
- const v = this
- v.checkListData[i].id2 = v.checkListData[i].id
- v.option = Object.assign(v.checkListData[i],v.option)
- v.option.id = v.option.id
-
- uni.navigateTo({
- url: '/pages/check/checkSubmit?data=' + encodeURIComponent(JSON.stringify(v.option))
- })
- // uni.navigateTo({
- // url: '/pages/addQrcode/selectQrcode?id=' + i.materialId
- // })
- },
- },
- }
- </script>
- <style lang="less">
- .checkDtl {
- .submit-box {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 30rpx;
- padding: 0 30rpx;
- p{
- line-height: 50rpx;
- text-align: center;
- }
- }
- font-size: 28rpx;
- .dtl{
- padding: 30rpx;
- border-bottom: 1rpx solid #dcdcdc;
- }
- .addQrcode-list {
- height: 120rpx;
- display: flex;
- justify-content: space-between;
- padding: 15rpx;
- border-bottom: 1rpx solid #dcdcdc;
-
- .fl {
- display: flex;
- padding-left: 20rpx;
- .code {
- margin-right: 20rpx;
- }
- }
-
- .fr {
- line-height: 120rpx;
- }
- }
- }
- </style>
|