qq_41295110
2025-07-15 8e4ba2b3027b50ee953933ef9ae7cbdba987deb4
Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev
4个文件已添加
2个文件已修改
2095 ■■■■■ 已修改文件
pages.json 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/MJGL/shangmudan/form.vue 752 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/MJGL/shangmudan/table.vue 594 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/caigoudingdan/caigoudingdan.vue 246 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/caigoudingdan/generate.vue 483 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json
@@ -462,6 +462,20 @@
                    "style": {
                        "navigationBarTitleText": "来料条码打印"
                    }
                },
                {
                    "path" : "pages/MJGL/shangmudan/table",
                    "style" :
                    {
                        "navigationBarTitleText" : "上模单"
                    }
                },
                {
                    "path" : "pages/MJGL/shangmudan/form",
                    "style" :
                    {
                        "navigationBarTitleText" : "上模单"
                    }
                }
    ],
    "tabBar": {
pages/MJGL/shangmudan/form.vue
New file
@@ -0,0 +1,752 @@
<template>
    <view>
        <view class="form">
            <view class="form-item">
                <view class="title"><text>*</text>条形码:</view>
                <view class="right" style="width: 380rpx;">
                    <input v-model="hform.HBarCode" disabled placeholder="请扫描条码"/>
                </view>
                <uni-icons type="scan" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20" @click="toScanCode"></uni-icons>
            </view>
            <view class="form-item">
                <view class="title">单据号:</view>
                <view class="righton">
                    <input name="HBillNo" disabled v-model="hform.HBillNo" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">单据日期:</view>
                <view class="right">
                    <picker mode="date" v-model="hform.HDate" @change="HDateChange">
                        <input disabled v-model="hform.HDate" placeholder="请选择日期" />
                    </picker>
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>使用部门:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHDeptName" placeholder="请选择部门" v-model="hform.HDeptName" @input="HDeptNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>操作员:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHEmpName" placeholder="请选择操作员" v-model="hform.HEmpName" @input="HEmpNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>负责人:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHEmpName" placeholder="请选择负责人" v-model="hform.HMangerName" @input="HManagerNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title">生产资源:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHSourceName" placeholder="请选择生产资源" v-model="hform.HSourceName" @input="HSourceNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title">器具编码:</view>
                <view class="righton">
                    <input name="HMouldNumber" v-model="hform.HMouldNumber" disabled placeholder="请输入器具编码" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">器具名称:</view>
                <view class="righton">
                    <input name="HMouldName" v-model="hform.HMouldName" disabled placeholder="请输入器具名称" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">器具型号:</view>
                <view class="righton">
                    <input name="HMouldModel" v-model="hform.HMouldModel" disabled placeholder="请输入器具型号" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">数量:</view>
                <view class="righton">
                    <input name="HQty" v-model="hform.HQty" disabled placeholder="请输入数量" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">上模时间:</view>
                <view class="righton">
                    <input name="HScanDate" disabled v-model="hform.HScanDate" placeholder="请选择" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">生产订单:</view>
                <view class="righton">
                    <input name="HICMOBillNo" disabled v-model="hform.HICMOBillNo" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">流转卡:</view>
                <view class="righton">
                    <input disabled v-model="hform.HProcExchBillNo" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">备注:</view>
                <view class="right">
                    <textarea name="HRemark" v-model="hform.HRemark" auto-height placeholder="请输入备注"></textarea>
                </view>
            </view>
            <view class="tab_area"></view>
            <view v-if="showmore">
                <view class="form-item">
                    <view class="title">制单人:</view>
                    <view class="righton">
                        <input v-model="hform.HMaker" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">制单日期:</view>
                    <view class="righton">
                        <input v-if="hform.HMakeDate" v-model="hform.HMakeDate.substr(0,10)" disabled/>
                        <input v-else v-model="hform.HMakeDate" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">修改人:</view>
                    <view class="righton">
                        <input v-model="hform.HUpDater" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">修改日期:</view>
                    <view class="righton">
                        <input v-if="hform.HUpDateDate" v-model="hform.HUpDateDate.substr(0,10)" disabled/>
                        <input v-else v-model="hform.HUpDateDate" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">审核人:</view>
                    <view class="righton">
                        <input v-model="hform.HChecker" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">审核日期:</view>
                    <view class="righton">
                        <input v-if="hform.HCheckDate" v-model="hform.HCheckDate.substr(0,10)" disabled/>
                        <input v-else v-model="hform.HCheckDate" disabled/>
                    </view>
                </view>
            </view>
            <view class="other">
                <view v-if="!showmore" @tap="showmore = true">
                    展开其他信息<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons>
                </view>
                <view v-if="showmore" @tap="showmore = false">
                    折叠其他信息<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="top"></uni-icons>
                </view>
            </view>
            <view class="tab_area"></view>
            <view class="bottom-btn">
                <button v-if="btnType == 1 && !isEdit" class="btn-a" size="mini" @tap="submit">提交</button>
                <button v-if="btnType != 1 && !isEdit" class="btn-a" size="mini" @tap="ifEdit">修改</button>
                <button v-if="btnType != 1 && isEdit" class="btn-a" size="mini" @tap="submit">提交</button>
                <button class="btn-c" size="mini" @tap="goBack">退出</button>
            </view>
        </view>
    </view>
</template>
<script>
    import getDateTime from '@/utils/getdateTime.js';
    import { getUserInfo } from "@/utils/auth.js";
    export default {
        data() {
            return {
                userInfo:getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
                linterid:'',
                HBillNo:'',
                btnType:1,//1新增,3修改
                showmore: false,
                arrayHDeptName:[],//部门
                HDeptNameList:[],
                arrayHEmpName:[],//发现人/负责人
                HEmpNameList:[],
                arrayHSourceName:[],//生产资源
                HSourceNameList:[],
                isEdit: false,
                hform:{
                    HInterID:'',
                    HBillNo:'',
                    HDate:getDateTime.dateTimeStr('y-m-d'),
                    HBarCode:'',
                    HDeptName:'',
                    HDeptID:'',
                    HEmpName:'',
                    HEmpID:'',
                    HMangerName:'',
                    HMangerID:'',
                    HSourceName:'',
                    HSourceID:'',
                    HMouldNumber:'',
                    HMouldID:'',
                    HMouldName:'',
                    HMouldModel:'',
                    HQty:'',
                    HScanDate:getDateTime.dateTimeStr('y-m-d h:i:s'),
                    HICMOBillNo:'',
                    HICMOInterID:'',
                    HICMOEntryID:'',
                    HProcExchBillNo:'',
                    HProcExchInterID:'',
                    HProcExchEntryID:'',
                    HOrgID:uni.getStorageSync('OrganizationID'),
                    HMaker:'',
                    HMakeDate:'',
                    HUpDater:'',
                    HUpDateDate:'',
                    HChecker:'',
                    HCheckDate:'',
                    HCloseMan:'',
                    HCloseDate:'',
                    HDeleteMan:'',
                    HDeleteDate:'',
                    eventType:'Add'
                }
            }
        },
        onLoad(e) {
            this.hform.HMaker = uni.getStorageSync('HUserName')
            console.log(e,this.userInfo)
            if(e.linterid){
                this.btnType = 3
                this.linterid = e.linterid
                this.HBillNo = e.HBillNo
                this.getEditData(e.linterid, e.HBillNo)
            }else{
                this.getNewData()
            }
            this.getHDeptList()
            this.getHEmpList()
            this.getHSourceList()
        },
        methods: {
            //扫码
            toScanCode(){
                uni.scanCode({
                    onlyFromCamera: true,
                    success: (res) => {
                        console.log('条码内容:' + res.result);
                        this.hform.HBarCode = res.result
                        this.getHBarCodeData(res.result)
                    }
                });
            },
            //日期
            HDateChange(e){
                console.log(e.detail.value)
                this.hform.HDate = e.detail.value
            },
            getHBarCodeData(HBarCode) {
                if(!this.hform.HSourceName){
                    uni.showToast({
                        title:'请先选择生产资源',
                        icon:'none'
                    });
                    return;
                }
                var HBillType = "";
                var barNo = "";
                if (HBarCode.length < 22) {
                    barNo = HBarCode.substr(0, 4);
                    switch (barNo) {
                        case "GXLX":
                        HBillType = "3772";
                            break;
                    }
                }
                if (HBarCode.length > 22) {
                    barNo = HBarCode.substr(0, 22);
                    switch (barNo) {
                        case "https://qr61.cn/omM1Cj":
                            HBillType = "3899";
                            break;
                        case "https://qr61.cn/oAhaGh":
                            HBillType = "3308";
                            break;
                        case "https://www.aliwork.com":
                            HBillType = "3308";
                            break;
                    }
                }
                uni.request({
                    url: this.serverUrl + '/Sc_MouldUpperBill/txtHBarCode_KeyDown',
                    data: {
                        HBarCode: this.hform.HBarCode,
                        HSourceID:this.hform.HSourceID,
                        UserID:uni.getStorageSync('Czybm'),
                        HBillType:HBillType
                    },
                    success: (res) => {
                        console.log(2, res.data);
                        if (res.data.code == 1) {
                            var data = res.data.data[0];
                            console.log(3, data);
                            var num=data.Num;
                            console.log(4, num);
                            switch (num) {
                                case 1:
                                    this.hform.HSourceID = data.HItemID;
                                    this.hform.HSourceName = data.HName;
                                break;
                                case 2:
                                    this.hform.HICMOBillNo = data.单据号;
                                    this.hform.HICMOInterID = data.hmainid;
                                    this.hform.HICMOEntryID = data.HEntryID;
                                break;
                                case 3:
                                    this.hform.HMouldID = data.hmainid;
                                    this.hform.HMouldNumber = data.模具编号;
                                    this.hform.HMouldName = data.模具名称;
                                    this.hform.HMouldModel = data.模具型号;
                                    this.hform.HQty = 1;
                                break;
                                case 4:
                                    this.hform.HProcExchBillNo = data.单据号;
                                    this.hform.HProcExchInterID = data.hmainid;
                                    this.hform.HProcExchEntryID = data.HEntryID;
                                    this.hform.HICMOBillNo = data.任务单号;
                                    this.hform.HICMOInterID = data.hicmointerid;
                                    this.hform.HICMOEntryID = data.HICMOEntryID;
                                break;
                                default:
                                    uni.showToast({
                                        title: '未知的返回类型',
                                        icon: 'none',
                                    });
                                break;
                            }
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            },
            //获取使用部门数据
            getHDeptList(){
                uni.request({
                    url: this.serverUrl + '/PublicPageMethod/DeptList',
                    data: { sWhere: "where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + uni.getStorageSync('OrganizationID') + "" },
                    success: (res) => {
                        if(res.data.count == 1){
                            this.HDeptNameList = res.data.data
                            for(var i=0;i<res.data.data.length;i++){
                                this.arrayHDeptName[i] = res.data.data[i].HName
                            }
                            this.$forceUpdate();
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            //选择使用部门
            HDeptNameChange(e){
                for(var i=0;i<this.HDeptNameList.length;i++){
                    if(this.HDeptNameList[i].HName == e){
                        this.hform.HDeptID = this.HDeptNameList[i].HItemID
                    }
                }
            },
            //操作员、负责人
            getHEmpList(){
                uni.request({
                    url: this.serverUrl + '/Web/GetEmployeeList_Json',
                    data: { Employee: '',HGroupID:0 },
                    success: (res) => {
                        if(res.data.count == 1){
                            this.HEmpNameList = res.data.data
                            for(var i=0;i<res.data.data.length;i++){
                                this.arrayHEmpName[i] = res.data.data[i].HName
                            }
                            this.$forceUpdate();
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            //选择操作员
            HEmpNameChange(e){
                for(var i=0;i<this.HEmpNameList.length;i++){
                    if(this.HEmpNameList[i].HName == e){
                        this.hform.HEmpID = this.HEmpNameList[i].HItemID
                    }
                }
            },
            //选择负责人
            HManagerNameChange(e){
                for(var i=0;i<this.HEmpNameList.length;i++){
                    if(this.HEmpNameList[i].HName == e){
                        this.hform.HMangerID = this.HEmpNameList[i].HItemID
                    }
                }
            },
            //生产资源
            getHSourceList(){
                uni.request({
                    url: this.serverUrl + '/api/newBill/getSourceList',
                    data: { sWhere: '' },
                    success: (res) => {
                        if(res.data.code == 1){
                            this.HSourceNameList = res.data.data.Gy_Source
                            for(var i=0;i<res.data.data.Gy_Source.length;i++){
                                this.arrayHSourceName[i] = res.data.data.Gy_Source[i].生产资源
                            }
                            this.$forceUpdate();
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            //选择生产资源
            HSourceNameChange(e){
                for(var i=0;i<this.HSourceNameList.length;i++){
                    if(this.HSourceNameList[i].生产资源 == e){
                        this.hform.HSourceID = this.HSourceNameList[i].HItemID
                    }
                }
            },
            ifEdit(){
                this.isEdit = true
                this.hform.eventType = 'Modify'
            },
            //编辑回显
            getEditData(linterid,HBillNo){
                //主表
                var sWhere = " and hmainid='" + linterid + "'";
                uni.request({
                    url: this.serverUrl + '/Sc_MouldUpperBill/Sc_MouldUpperBillList',
                    data: { sWhere: sWhere,user: uni.getStorageSync('HUserName') },
                    success: (res) => {
                        console.log(1,res.data.data[0]);
                        if(res.data.code == 1){
                            var data = res.data.data[0]
                            this.btnType=3
                            this.hform.HInterID= data.hmainid
                            this.hform.HBillNo= data.单据号
                            this.hform.HBarCode= data.条形码
                            this.hform.HDeptID= data.HDeptID
                            this.hform.HDeptName= data.部门
                            this.hform.HEmpID= data.HEmpID
                            this.hform.HEmpName= data.操作员
                            this.hform.HMangerID= data.HMangerID
                            this.hform.HMangerName= data.负责人
                            this.hform.HRemark= data.表头备注
                            this.hform.HDate = data.日期.substr(0,10)
                            this.hform.HSourceID=data.HSourceID,
                            this.hform.HSourceName=data.生产资源,
                            this.hform.HMouldID=data.HMouldID,
                            this.hform.HMouldNumber=data.模具编码,
                            this.hform.HMouldName=data.模具名称,
                            this.hform.HMouldModel=data.模具规格,
                            this.hform.HQty=data.数量,
                            this.hform.HScanDate=data.上模扫码时间,
                            this.hform.HICMOBillNo=data.HICMOBillNo,
                            this.hform.HICMOInterID=data.HICMOInterID,
                            this.hform.HICMOEntryID=data.HICMOEntryID,
                            this.hform.HProcExchBillNo=data.HProcExchBillNo,
                            this.hform.HProcExchInterID=data.HProcExchInterID,
                            this.hform.HProcExchEntryID=data.HProcExchEntryID,
                            this.hform.HOrgID=data.HOrgID,
                            this.hform.HMaker= data.制单人
                            this.hform.HMakeDate= data.制单日期
                            this.hform.HUpDater= data.修改人
                            this.hform.HUpDateDate= data.修改日期
                            this.hform.HChecker= data.审核人
                            this.hform.HCheckDate= data.审核日期
                            this.hform.HDeleteMan= data.作废人
                            this.hform.HDeleteDate= data.作废日期
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            //新增
            getNewData(){
                uni.request({
                    url: this.serverUrl + '/Web/GetMAXNum',
                    data: { HBillType: '3846' },
                    success: (res) => {
                        console.log(res.data)
                        if(res.data.count == 1){
                            this.hform.HInterID = res.data.data[0].HInterID
                            this.hform.HBillNo = res.data.data[0].HBillNo
                            this.btnType=1
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            submit() {
                if(!this.hform.HBarCode){
                    uni.showToast({
                        title:'请扫描模具条形码',
                        icon:'none'
                    })
                }else if(!this.hform.HSourceName){
                    uni.showToast({
                        title:'请选择生产资源',
                        icon:'none'
                    })
                }else if(!this.hform.HMouldName){
                    uni.showToast({
                        title:'模具不能为空',
                        icon:'none'
                    })
                }else if(!this.hform.HEmpName){
                    uni.showToast({
                        title:'请选择操作员',
                        icon:'none'
                    })
                }else if(!this.hform.HMangerName){
                    uni.showToast({
                        title:'请选择负责人',
                        icon:'none'
                    })
                }else{
                    uni.showLoading({
                        title:'请稍候'
                    })
                    var sMainStr = JSON.stringify(this.hform);
                    var sMainSub = sMainStr + ";" + uni.getStorageSync('HUserName')+";"+this.btnType;
                    console.log(sMainSub);
                    uni.request({
                        url: this.serverUrl + '/Sc_MouldUpperBill/AddSc_MouldUpperBill_PDA',
                        method:'POST',
                        dataType:"json",
                        data:{ oMain: sMainSub },
                        success: (res) => {
                            console.log(1,res);
                            uni.hideLoading()
                            if(res.data.count == 1){
                                let pages = getCurrentPages();
                                let prePage = pages[pages.length - 2];
                                prePage.$vm.getList()
                                if(this.isEdit){
                                    setTimeout(()=>{
                                        uni.redirectTo({
                                            url:'/pages/weiwaigxIn/form?linterid=' + this.linterid + '&HBillNo=' + this.linterid
                                        })
                                    },1000)
                                }else{
                                    setTimeout(()=>{
                                        uni.navigateBack()
                                    },1000)
                                }
                            }
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        },
                        fail: (res) => {
                            console.log(res);
                            uni.showToast({
                                title:'接口请求失败',
                                icon:'none'
                            })
                        },
                    });
                }
            },
            goBack(){
                uni.showModal({
                    title: '提示',
                    content: '确认要退出当前页面吗?',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            uni.navigateBack()
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            }
        }
    }
</script>
<style lang="scss" scoped>
    .form{
        width: 668rpx;
        margin: 20rpx auto;
        padding-bottom: 240rpx;
    }
    .tab_area{
        width: 100%;
        height: 50rpx;
    }
    .other{
        margin-top: 8rpx;
        text-align: center;
        font-size: 28rpx;
        padding: 4rpx 18rpx;
        color: #1890FF;
    }
    .form-item{
        display: flex;
        align-items: center;
        font-size: 30rpx;
        padding: 6rpx 0;
        .title{
            width: 208rpx;
            text{
                color: red;
                font-weight: bold;
            }
        }
        .right{
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #acacac;
        }
        .righton{
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
        }
        input{
            width: 100%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
        textarea{
            width: 98%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
    }
    .bottom-btn{
        width: 100%;
        // height: 120rpx;
        position: fixed;
        bottom: 0;
        left: 0;
        background-color: #fff;
        box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
        padding: 30rpx 40rpx 40rpx 40rpx;
        button{
            border-radius: 50rpx;
            width: 180rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a{
            background-color: #3A78FF;
            color: #fff;
        }
        .btn-b{
            background-color: #41a863;
            color: #fff;
        }
        .btn-c{
            background-color: #acacac;
            color: #fff;
            position: absolute;
            right: 120rpx;
        }
        .btn-d{
            background-color: #ff8901;
            color: #fff;
        }
    }
</style>
pages/MJGL/shangmudan/table.vue
New file
@@ -0,0 +1,594 @@
<template>
    <view class="content">
        <view class="form">
            <view class="form-item">
                <view class="title">状态:</view>
                <view class="right">
                    <picker :range="arrayStatus" :value="hform.HStatus" @change="HStatusChange">
                        <input name="HStatus" disabled :value="hform.HStatus" placeholder="请选择状态" />
                    </picker>
                </view>
            </view>
            <view class="form-item">
                <view class="title">开始时间:</view>
                <view class="right">
                    <picker mode="date" :value="hform.HBeginDate" @change="HBeginDateChange">
                        <input name="HBeginDate" disabled :value="hform.HBeginDate" placeholder="请选择" />
                    </picker>
                </view>
            </view>
            <view class="form-item">
                <view class="title">结束时间:</view>
                <view class="right">
                    <picker mode="date" :value="hform.HEndDate" @change="HEndDateChange">
                        <input name="HEndDate" disabled :value="hform.HEndDate" placeholder="请选择" />
                    </picker>
                </view>
            </view>
            <view v-if="showmore">
                <view class="form-item">
                    <view class="title">任务单号:</view>
                    <view class="right">
                        <input v-model="hform.HICMOBillNo" placeholder="请输入任务单号" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">单据号:</view>
                    <view class="right">
                        <input v-model="hform.HBillNo" placeholder="请输入单据号" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">流转卡号:</view>
                    <view class="right">
                        <input v-model="hform.HProcExchBillNo" placeholder="请输入工序流转卡号" />
                    </view>
                </view>
            </view>
            <view class="other">
                <view v-if="!showmore" @tap="showmore = true">
                    展开其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons>
                </view>
                <view v-if="showmore" @tap="showmore = false">
                    折叠其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="top"></uni-icons>
                </view>
            </view>
            <view class="buttons">
                <button class="btn-a" size="mini" type="default" @tap="clear">重置</button>
                <button class="btn-b" size="mini" type="default" @tap="creat">新增</button>
                <button class="btn-c" size="mini" type="default" @tap="search">查询</button>
            </view>
        </view>
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <view class="list" v-for="(item,index) in showList" :key="index">
            <uni-card :title="item.HProcExchBillNo" :extra="item.单据号" style="margin: 10px;"
                @tap="showDetail = showDetail==index?-1:index">
                <!-- #ifndef MP-WEIXIN-->
                <view class="card-detail">
                    <view class="detail" v-if="item.部门">
                        <text>部门:</text>{{item.部门}}
                    </view>
                    <view class="detail" v-if="item.负责人">
                        <text>负责人:</text>{{item.负责人}}
                    </view>
                    <view class="detail" v-if="item.模具编码">
                        <text>模具编码:</text>{{item.模具编码}}
                    </view>
                    <view class="detail" v-if="item.模具名称">
                        <text>模具名称:</text>{{item.模具名称}}
                    </view>
                    <view class="detail" v-if="item.模具规格">
                        <text>模具规格:</text>{{item.模具规格}}
                    </view>
                    <view class="detail" v-if="item.生产资源">
                        <text>生产资源:</text>{{item.生产资源}}
                    </view>
                    <view class="detail" v-if="item.上模扫码时间">
                        <text>上模时间:</text>{{item.上模扫码时间.substr(0,10)}}
                    </view>
                </view>
                <view class="card-detail" v-if="showDetail == index">
                    <view class="detail" v-if="item.制单人">
                        <text>制单人:</text>{{item.制单人}}
                    </view>
                    <view class="detail" v-if="item.制单日期">
                        <text>制单日期:</text>{{item.制单日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.修改人">
                        <text>修改人:</text>{{item.修改人}}
                    </view>
                    <view class="detail" v-if="item.修改日期">
                        <text>修改日期:</text>{{item.修改日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.审核人">
                        <text>审核人:</text>{{item.审核人}}
                    </view>
                    <view class="detail" v-if="item.审核日期">
                        <text>审核日期:</text>{{item.审核日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.关闭人">
                        <text>关闭人:</text>{{item.关闭人}}
                    </view>
                    <view class="detail" v-if="item.关闭日期">
                        <text>关闭日期:</text>{{item.关闭日期.substr(0,10)}}
                    </view>
                    <view class="detail" v-if="item.备注">
                        <text>备注:</text>{{item.备注}}
                    </view>
                </view>
                <!-- #endif -->
                <!-- #ifdef MP-WEIXIN -->
                <uni-card style="margin: 10px;" @tap="showDetail = showDetail==index?-1:index">
                    <view class="card-detail">
                        <view class="detail" v-if="item['部门']">
                            <text>部门:</text>{{item['部门']}}
                        </view>
                        <view class="detail" v-if="item['操作员']">
                            <text>操作员:</text>{{item['操作员']}}
                        </view>
                        <view class="detail" v-if="item['负责人']">
                            <text>负责人:</text>{{item['负责人']}}
                        </view>
                        <view class="detail" v-if="item['模具编码']">
                            <text>模具编码:</text>{{item['模具编码']}}
                        </view>
                        <view class="detail" v-if="item['模具名称']">
                            <text>模具名称:</text>{{item['模具名称']}}
                        </view>
                        <view class="detail" v-if="item['模具规格']">
                            <text>模具规格:</text>{{item['模具规格']}}
                        </view>
                        <view class="detail" v-if="item['上模扫码时间']">
                            <text>上模扫码时间:</text>{{item['上模扫码时间'].substr(0,19)}}
                        </view>
                    </view>
                    <view class="card-detail" v-if="showDetail == index">
                        <view class="detail" v-if="item['数量']">
                            <text>数量:</text>{{item['数量']}}
                        </view>
                        <view class="detail" v-if="item['生产订单']">
                            <text>生产订单:</text>{{item['HICMOBillNo']}}
                        </view>
                        <view class="detail" v-if="item['流转卡号']">
                            <text>流转卡号:</text>{{item['HProcExchBillNo']}}
                        </view>
                        <view class="detail" v-if="item['制单人']">
                            <text>制单人:</text>{{item['制单人']}}
                        </view>
                        <view class="detail" v-if="item['制单日期']">
                            <text>制单日期:</text>{{item['制单日期'].substr(0,10)}}
                        </view>
                        <view class="detail" v-if="item['修改人']">
                            <text>修改人:</text>{{item['修改人']}}
                        </view>
                        <view class="detail" v-if="item['修改日期']">
                            <text>修改日期:</text>{{item['修改日期'].substr(0,10)}}
                        </view>
                        <view class="detail" v-if="item['审核人']">
                            <text>审核人:</text>{{item['审核人']}}
                        </view>
                        <view class="detail" v-if="item['审核日期']">
                            <text>审核日期:</text>{{item['审核日期'].substr(0,10)}}
                        </view>
                        <view class="detail" v-if="item['关闭人']">
                            <text>关闭人:</text>{{item['关闭人']}}
                        </view>
                        <view class="detail" v-if="item['关闭日期']">
                            <text>关闭日期:</text>{{item['关闭日期'].substr(0,10)}}
                        </view>
                        <view class="detail" v-if="item['备注']">
                            <text>备注:</text>{{item['备注']}}
                        </view>
                    </view>
                    <!-- #endif -->
                    <view class="more" v-if="showDetail == index && operations != index">
                        <view class="part" style="border-right: 1px solid #eee;">
                            <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>收起
                        </view>
                        <view class="part" @tap.stop="operations = operations==index?-1:index">
                            <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
                                size="14"></uni-icons>操作
                        </view>
                    </view>
                    <view class="more" v-if="showDetail != index && operations != index">
                        <view class="part" style="border-right: 1px solid #eee;">
                            <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
                        </view>
                        <view class="part" @tap.stop="operations = operations==index?-1:index">
                            <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
                                size="14"></uni-icons>操作
                        </view>
                    </view>
                    <view class="op" v-if="operations == index">
                        <button class="op3" size="mini" plain @tap.stop="edit(item)">编辑</button>
                        <button class="op4" size="mini" plain @tap.stop="del(item)">删除</button>
                        <button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
                    </view>
                </uni-card>
        </view>
        <view class="over" v-if="listData.length == 0">暂无数据</view>
        <view class="over" v-if="listData.length != 0 && listData.length != showList.length">加载中...</view>
        <view class="over" v-if="listData.length != 0 && listData.length == showList.length">已到底</view>
    </view>
</template>
<script>
    import {
        getUserInfo
    } from "@/utils/auth.js";
    export default {
        data() {
            return {
                userInfo: getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                showmore: false,
                arrayStatus: ['全部', '未审核', '已审核', '已关闭'],
                hform: {
                    HStatus: '全部',
                    HBeginDate: '',
                    HEndDate: '',
                    HICMOBillNo: '',
                    HBillNo: '',
                    HProcExchBillNo: '',
                },
                sWhere: '',
                listData: [],
                showList: [],
                showDetail: -1,
                operations: -1,
                page: 1,
            }
        },
        onLoad() {
            this.getList()
        },
        onReachBottom: function() {
            this.page++
            setTimeout(() => {
                this.showList = this.showList.concat(this.getPage(this.page, this.listData))
            }, 100)
        },
        onPullDownRefresh: function() {
            this.clear()
            setTimeout(() => {
                uni.stopPullDownRefresh();
            }, 1000);
        },
        methods: {
            getPage(page, list) {
                let sindex = (parseInt(page) - 1) * 20
                let eindex = parseInt(page) * 20
                let newList = list.slice(sindex, eindex)
                return newList
            },
            getList() {
                uni.showLoading({
                    title: '加载中...'
                })
                uni.request({
                    url: this.serverUrl + '/Sc_MouldUpperBill/Sc_MouldUpperBillList',
                    data: {
                        sWhere: this.sWhere,
                        user: uni.getStorageSync('HUserName')
                    },
                    success: (res) => {
                        console.log(1, res.data.data);
                        if (res.data.count == 1) {
                            this.listData = res.data.data
                            this.showList = this.getPage(this.page, this.listData)
                            setTimeout(() => {
                                uni.hideLoading()
                            }, 1000)
                        } else {
                            uni.hideLoading()
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.hideLoading()
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            },
            //状态
            HStatusChange(e) {
                console.log(e.detail.value)
                this.hform.HStatus = this.arrayStatus[e.detail.value]
            },
            //选择单据日期
            HBeginDateChange(e) {
                console.log(e.detail.value)
                this.hform.HBeginDate = e.detail.value
            },
            //选择单据日期
            HEndDateChange(e) {
                console.log(e.detail.value)
                this.hform.HEndDate = e.detail.value
            },
            //搜索
            search() {
                this.sWhere = ''
                this.listData = []
                this.page = 1
                this.showList = []
                console.log(this.hform)
                if (this.hform.HStatus) {
                    if (this.hform.HStatus == '全部') {
                        this.sWhere += "";
                    } else if (this.hform.HStatus == '未审核') {
                        this.sWhere += " and 审核人=''";
                    } else if (this.hform.HStatus == '已审核') {
                        this.sWhere += " and 审核人<>''";
                    } else if (this.hform.HStatus == '已关闭') {
                        this.sWhere += " and 关闭人<>''";
                    }
                }
                if (this.hform.BenginHCreateDate) {
                    this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.BenginHCreateDate + "'";
                }
                if (this.hform.EndHCreateDate) {
                    this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.hform.EndHCreateDate + "'";
                }
                if (this.hform.HBillNo) {
                    this.sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'";
                }
                if (this.hform.HICMOBillNo) {
                    this.sWhere += " and 生产订单号 like '%" + this.hform.HICMOBillNo + "%'";
                }
                if (this.hform.HProcExchBillNo) {
                    this.sWhere += " and 流转卡号 like '%" + this.hform.HProcExchBillNo + "%'";
                }
                this.getList()
            },
            //新增
            creat() {
                uni.navigateTo({
                    url: '/pages/MJGL/shangmudan/form'
                })
            },
            //重置
            clear() {
                this.listData = []
                this.page = 1
                this.showList = []
                this.showmore = false
                this.sWhere = ''
                this.showDetail = -1,
                    this.operations = -1,
                    this.hform = {
                        HStatus: '全部',
                        HBeginDate: '',
                        HEndDate: '',
                        HICMOBillNo: '',
                        HBillNo: '',
                        HProcExchBillNo: '',
                    }
                this.getList()
            },
            //编辑
            edit(item) {
                console.log(item)
                uni.navigateTo({
                    url: '/pages/MJGL/shangmudan/form?linterid=' + item.hmainid + '&HBillNo=' + item.单据号
                })
            },
            //删除
            del(item) {
                console.log(item)
                uni.showModal({
                    title: '提示',
                    content: '确认要删除吗,删除后不能恢复',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            uni.request({
                                url: this.serverUrl +'/Sc_MouldUpperBill/DeltetSc_MouldUpperBill',
                                data: {
                                    HInterID: item.hmainid + "_" + item.hsubid,
                                    HPRDORGID: uni.getStorageSync('OrganizationID'),
                                    user: uni.getStorageSync('HUserName')
                                },
                                success: (res) => {
                                    console.log(1, res);
                                    if (res.data.count == 1) {
                                        this.clear()
                                    }
                                    uni.showToast({
                                        title: res.data.Message,
                                        icon: 'none'
                                    })
                                },
                                fail: (res) => {
                                    console.log(res);
                                    uni.showToast({
                                        title: '接口请求失败',
                                        icon: 'none'
                                    })
                                },
                            });
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            }
        }
    }
</script>
<style lang="scss" scoped>
    .form {
        width: 640rpx;
        margin: 20rpx auto;
    }
    .other {
        margin-top: 8rpx;
        text-align: center;
        font-size: 28rpx;
        padding: 4rpx 18rpx;
        color: #1890FF;
    }
    .form-item {
        display: flex;
        align-items: center;
        font-size: 28rpx;
        padding: 6rpx 0;
        .title {
            width: 180rpx;
            text {
                color: red;
                font-weight: bold;
            }
        }
        .right {
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #acacac;
        }
        .righton {
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
        }
        input {
            width: 100%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
    }
    .buttons {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 20rpx;
        button {
            border-radius: 50rpx;
            width: 180rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a {
            background-color: #acacac;
            color: #fff;
        }
        .btn-b {
            background-color: #41a863;
            color: #fff;
        }
        .btn-c {
            background-color: #3a78ff;
            color: #fff;
        }
    }
    .list {
        width: 100%;
        .card-detail {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            line-height: 120%;
            .detail {
                // width: 50%;
                font-size: 26rpx;
                margin-bottom: 12rpx;
                color: #555;
                margin-right: 20rpx;
                text {
                    color: #999;
                    font-size: 26rpx;
                }
            }
        }
        .more {
            color: #888;
            font-size: 24rpx;
            display: flex;
            border-top: 1px solid #eee;
            padding-top: 20rpx;
            .part {
                width: 50%;
                text-align: center;
            }
        }
        .op {
            display: flex;
            justify-content: space-around;
            margin-top: 20rpx;
            button {
                padding: 0;
                width: 150rpx;
                font-size: 25rpx;
            }
            .op1 {
                border: 1px solid #41a863;
                color: #41a863;
            }
            .op2 {
                border: 1px solid #d98d00;
                color: #d98d00;
            }
            .op3 {
                border: 1px solid #3a78ff;
                color: #3a78ff;
            }
            .op4 {
                border: 1px solid #da0000;
                color: #da0000;
            }
            .op5 {
                border: 1px solid #888;
                color: #888;
            }
        }
    }
</style>
pages/caigoudingdan/caigoudingdan.vue
New file
@@ -0,0 +1,246 @@
<template>
    <view class="content">
        <view class="form">
            <view class="form-item">
                <view class="title"><text>*</text>条码:</view>
                <view class="right" style="width: 380rpx;">
                    <input v-model="HBarCode" placeholder="请扫描(或输入)条码" @confirm="getCode(HBarCode)" />
                </view>
                <uni-icons type="scan"
                    style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
                    size="20" @click="toScanCode"></uni-icons>
            </view>
            <view class="form-item">
                <view class="title">单据号:</view>
                <view class="righton">
                    <input v-model="baseInfo.HBillNo" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">供应商:</view>
                <view class="righton">
                    <input v-model="baseInfo.HSupName" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">部门:</view>
                <view class="righton">
                    <input v-model="baseInfo.HDeptName" disabled />
                </view>
            </view>
        </view>
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <view class="list" v-for="(item,index) in listData" :key="index" @tap="toSon(item)">
            <uni-card :title="item.物料代码" :extra="'No. ' + Number(index+1)" style="margin: 10px;">
                <view class="card-detail">
                    <view class="detail">
                        <text>物料名称:</text>{{item.物料名称}}
                    </view>
                    <view class="detail">
                        <text>规格型号:</text>{{item.规格型号}}
                    </view>
                    <view class="detail">
                        <text>订单数量:</text>{{item.数量}}
                    </view>
                </view>
            </uni-card>
        </view>
        <view class="over" v-if="listData.length == 0">暂无数据</view>
        <view class="over" v-if="listData.length != 0">已到底</view>
    </view>
</template>
<script>
    import {
        getUserInfo
    } from "@/utils/auth.js";
    import {
        CommonUtils
    } from "../../utils/common";
    export default {
        data() {
            return {
                userInfo: getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                HBarCode: '',
                baseInfo: {
                    HBillNo: '',
                    HSupName: '',
                    HDeptName: '',
                    HInterID: '',
                },
                sWhere: '',
                listData: [],
            }
        },
        onLoad() {},
        methods: {
            //扫码
            toScanCode() {
                uni.scanCode({
                    onlyFromCamera: true,
                    success: (res) => {
                        console.log('条码内容:' + res.result);
                        this.HBarCode = res.result
                        this.getCode(this.HBarCode)
                    }
                });
            },
            //扫条码处理
            getCode(HBarCode) {
                if (!HBarCode) {
                    uni.showToast({
                        title: '条码不能为空',
                        icon: 'none'
                    })
                } else {
                    CommonUtils.doRequest(
                        "/Cg_POOrderBill/list", {
                            sWhere: ` and 单据号 = '${HBarCode}'`,
                            user: this.userInfo.Czymc
                        },
                        (res) => {
                            console.log('采购订单: ', res)
                            let {data, count} = res.data
                            if(count > 0){
                                this.baseInfo = {
                                    HBillNo: data[0].单据号,
                                    HSupName: data[0].供应商,
                                    HDeptName: data[0].部门,
                                    HInterID: data[0].hmainid,
                                }
                                this.listData = data
                            } else {
                                uni.showToast({
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                            }
                        }
                    )
                }
            },
            toSon(item) {
                uni.navigateTo({
                    url: `./generate?OperationType=1&closeType=1&linterid=${this.baseInfo.HInterID}&hmaterid=${item["HMaterID"]}`
                })
            }
        }
    }
</script>
<style lang="scss" scoped>
    .form {
        width: 640rpx;
        margin: 20rpx auto;
    }
    .form-item {
        display: flex;
        align-items: center;
        font-size: 28rpx;
        padding: 6rpx 0;
        .title {
            width: 180rpx;
            text {
                color: red;
                font-weight: bold;
            }
        }
        .right {
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #acacac;
        }
        .righton {
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
        }
        input {
            width: 100%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
    }
    .buttons {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 20rpx;
        button {
            border-radius: 50rpx;
            width: 180rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a {
            background-color: #acacac;
            color: #fff;
        }
        .btn-b {
            background-color: #41a863;
            color: #fff;
        }
        .btn-c {
            background-color: #3a78ff;
            color: #fff;
        }
    }
    .list {
        width: 100%;
        .card-detail {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            line-height: 120%;
            .detail {
                // width: 50%;
                font-size: 26rpx;
                margin-bottom: 12rpx;
                color: #555;
                margin-right: 20rpx;
                text {
                    color: #999;
                    font-size: 26rpx;
                }
            }
        }
        .more {
            color: #888;
            font-size: 24rpx;
            display: flex;
            border-top: 1px solid #eee;
            padding-top: 20rpx;
            .part {
                width: 50%;
                text-align: center;
            }
        }
    }
</style>
pages/caigoudingdan/generate.vue
New file
@@ -0,0 +1,483 @@
<template>
    <view class="content">
        <view class="form">
            <view class="form-item">
                <view class="title">物料编码:</view>
                <view class="righton">
                    <input v-model="baseInfo.HMaterNumber" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">物料名称:</view>
                <view class="righton">
                    <input v-model="baseInfo.HMaterName" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">规格型号:</view>
                <view class="righton">
                    <input v-model="baseInfo.HMaterModel" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">批次:</view>
                <view class="righton">
                    <input v-model="baseInfo.HBatchNo" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">收料数量:</view>
                <view class="righton">
                    <input v-model="baseInfo.HQty" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">MTO号:</view>
                <view class="righton">
                    <input v-model="baseInfo.HMTONo" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">每箱数量:</view>
                <view class="right">
                    <input v-model="baseInfo.HMinQty" type="number" placeholder="请输入数量" @confirm="getNum()"
                        @blur="getNum()" />
                </view>
            </view>
            <view class="buttons">
                <button class="btn-b" size="mini" type="default" @tap="getList()">条码生成</button>
                <button class="btn-c" size="mini" type="default" @tap="search">打印</button>
            </view>
        </view>
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <view class="list" v-for="(item,index) in listData" :key="index" @tap="toSon(item)">
            <uni-card :title="item.物料代码" :extra="'No. ' + Number(index+1)" style="margin: 10px;">
                <view class="card-detail">
                    <view class="detail">
                        <text>物料名称:</text>{{item.物料名称}}
                    </view>
                    <view class="detail">
                        <text>规格型号:</text>{{item.规格型号}}
                    </view>
                    <view class="detail">
                        <text>数量:</text>{{item.数量}}
                    </view>
                    <view class="detail" style="width: 100%;">
                        <text>条码编号:</text>{{item.条码编号}}
                    </view>
                </view>
            </uni-card>
        </view>
        <labelPrinterComponentVue ref="labelPrinter" :printInfo="printInfo" :printMode="'cpcl'">
        </labelPrinterComponentVue>
        <view class="over" v-if="listData.length == 0">暂无数据</view>
        <view class="over" v-if="listData.length != 0">已到底</view>
    </view>
</template>
<script>
    import {
        getUserInfo
    } from "@/utils/auth.js";
    import {
        CommonUtils
    } from "../../utils/common";
    export default {
        data() {
            return {
                printInfo: "",
                userInfo: getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                OperationType: 1, //数据类型  1添加 保存  2复制  3 编辑
                linterid: '',
                HEntryID: '',
                hmaterid: '',
                baseInfo: {
                    HBillNo: '',
                    HMainID: '',
                    HSubID: '',
                    HOrderBillNo: '',
                    HMaterID: '',
                    HMaterNumber: '',
                    HMaterName: '',
                    HMaterModel: '',
                    HQty: '',
                    HMTONo: '',
                    HQty: '',
                    HMinQty: '',
                    HBQty: '',
                },
                sWhere: '',
                listData: [],
            }
        },
        onLoad(e) {
            console.log(e)
            this.OperationType = e.OperationType
            this.linterid = e.linterid
            this.hmaterid = e.hmaterid
            this.getData()
        },
        methods: {
            getData() {
                CommonUtils.doRequest(
                    "/Cg_POOrderBill/list", {
                        sWhere: ` and hmainid = ${this.linterid} and HMaterID  = ${this.hmaterid}`
                        ,user: this.userInfo.Czymc
                    },
                    (res) => {
                        console.log('采购订单: ', res)
                        let {
                            data,
                            count
                        } = res.data
                        if (count > 0) {
                            this.baseInfo = {
                                HMainID: data[0]['hmainid'],
                                HSubID: data[0]['HEntryID'],
                                HBillNo: data[0]['单据号'],
                                HMaterID: data[0]['HMaterID'],
                                HMaterNumber: data[0]['物料代码'],
                                HMaterName: data[0]['物料名称'],
                                HMaterModel: data[0]['规格型号'],
                                HQty: data[0]['数量'],
                                HMTONo: data[0]['计划跟踪号']
                            }
                            this.listData = data
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    }
                )
            },
            getNum(e) {
                if (this.baseInfo.HMinQty && this.baseInfo.HMinQty > 0) {
                    var a = Number(this.baseInfo.HQty) / Number(this.baseInfo.HMinQty)
                    this.baseInfo.HBQty = Math.ceil(Number(this.baseInfo.HQty) / Number(this.baseInfo.HMinQty))
                    this.$forceUpdate()
                } else {
                    uni.showToast({
                        title: '请输入大于0的合理数量',
                        icon: "none"
                    })
                }
            },
            async search() {
                if (this.$printer.isConnected() === false) {
                    this.$refs.labelPrinter.openPopup()
                } else {
                    // this.printInfo = async () => {
                    //     let cpcl = await this.$printer.cpcl().clear()
                    //         .page(new CPage({
                    //             width: 608,
                    //             height: 400
                    //         }))
                    //         .qrcode(new CQRCode({
                    //             x: 500,
                    //             y: 30,
                    //             width: 3,
                    //             content: this.generatedBarCode,
                    //             codeRotation: CCodeRotation.ROTATION_0,
                    //             level: CCorrectLevel.L
                    //         }))
                    //         .text(new CText({
                    //             x: 30,
                    //             y: 30,
                    //             content: "供应商: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .text(new CText({
                    //             x: 30,
                    //             y: 80,
                    //             content: "供应商料号: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .text(new CText({
                    //             x: 30,
                    //             y: 130,
                    //             content: "物料编码: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .text(new CText({
                    //             x: 30,
                    //             y: 180,
                    //             content: "物料分组: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .text(new CText({
                    //             x: 300,
                    //             y: 180,
                    //             content: "规格型号: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .text(new CText({
                    //             x: 30,
                    //             y: 230,
                    //             content: "数量: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .text(new CText({
                    //             x: 300,
                    //             y: 230,
                    //             content: "日期: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .text(new CText({
                    //             x: 30,
                    //             y: 280,
                    //             content: "检验员: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .text(new CText({
                    //             x: 300,
                    //             y: 280,
                    //             content: "计划跟踪号: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .text(new CText({
                    //             x: 30,
                    //             y: 330,
                    //             content: "检验结果: ",
                    //             font: CFont.TSS24
                    //         }))
                    //         .box(new CBox({
                    //             topLeftX: 260,
                    //             topLeftY: 320,
                    //             bottomRightX: 280,
                    //             bottomRightY: 340,
                    //             lineWidth: 4,
                    //         }))
                    //         .text(new CText({
                    //             x: 290,
                    //             y: 320,
                    //             content: "合格",
                    //             font: CFont.TSS24
                    //         }))
                    //         .box(new CBox({
                    //             topLeftX: 360,
                    //             topLeftY: 320,
                    //             bottomRightX: 380,
                    //             bottomRightY: 340,
                    //             lineWidth: 4,
                    //         }))
                    //         .text(new CText({
                    //             x: 390,
                    //             y: 320,
                    //             content: "不合格",
                    //             font: CFont.TSS24
                    //         }))
                    //         .box(new CBox({
                    //             topLeftX: 480,
                    //             topLeftY: 320,
                    //             bottomRightX: 500,
                    //             bottomRightY: 340,
                    //             lineWidth: 4,
                    //         }))
                    //         .text(new CText({
                    //             x: 510,
                    //             y: 320,
                    //             content: "特采",
                    //             font: CFont.TSS24
                    //         }))
                    //         .form(new CForm())
                    //         .print();
                    //     console.log(cpcl.command().string())
                    //     return cpcl.command().binary()
                    // }
                    // await this.$nextTick(() => {
                    //     this.$refs.labelPrinter.execPrint()
                    // })
                    this.printInfo = `! 0 200 200 400 1
PAGE-WIDTH 608
SETQRVER 3
B QR 500 30 M 2 U 3
LA,${this.generatedBarCode}
ENDQR
T 24 0 30 30 供应商:
T 24 0 30 80 供应商料号:
T 24 0 30 130 物料编码:
T 24 0 30 180 物料分组:
T 24 0 300 180 规格型号:
T 24 0 30 230 数量:
T 24 0 300 230 日期:
T 24 0 30 280 检验员:
T 24 0 300 280 计划跟踪号:
T 24 0 30 330 检验结果:
BOX 260 330 280 350 4
T 24 0 290 330 合格
BOX 360 330 380 350 4
T 24 0 390 330 不合格
BOX 480 330 500 350 4
T 24 0 510 330 特采
FORM
PRINT`
                    await this.$nextTick(() => {
                        this.$refs.labelPrinter.execPrint()
                    })
                }
            },
            getList() {
                var sMain = []
                sMain[0] = this.baseInfo
                var sMainStr = JSON.stringify(sMain);
                //获取选择的组织
                var HOrgType = uni.getStorageSync('Organization');
                //获取选择的工厂代码
                var CampanyName = "xxx";
                //获取选择的源单类型
                var HSourceBillType = "收料通知单";
                //获取选择的条码类型
                var HSelectBarCodeType = "唯一条码";
                //获取当前登录人员
                var UserName = uni.getStorageSync('HUserName');
                var sMainSub = sMainStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' +
                    CampanyName + ';' + UserName;
                uni.request({
                    url: this.serverUrl + '/Sc_BarCode/Sub_SaveBill',
                    method: 'POST',
                    data: {
                        msg: sMainSub,
                        CampanyName: CampanyName
                    },
                    success: (res) => {
                        if (res.data.count == 1) {
                            this.listData = res.data.data
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            }
        }
    }
</script>
<style lang="scss" scoped>
    .form {
        width: 640rpx;
        margin: 20rpx auto;
    }
    .form-item {
        display: flex;
        align-items: center;
        font-size: 28rpx;
        padding: 6rpx 0;
        .title {
            width: 180rpx;
            text {
                color: red;
                font-weight: bold;
            }
        }
        .right {
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #acacac;
        }
        .righton {
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
        }
        input {
            width: 100%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
    }
    .buttons {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 20rpx;
        button {
            border-radius: 50rpx;
            width: 220rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a {
            background-color: #acacac;
            color: #fff;
        }
        .btn-b {
            background-color: #41a863;
            color: #fff;
        }
        .btn-c {
            background-color: #3a78ff;
            color: #fff;
        }
    }
    .list {
        width: 100%;
        .card-detail {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            line-height: 120%;
            .detail {
                // width: 50%;
                font-size: 26rpx;
                margin-bottom: 12rpx;
                color: #555;
                margin-right: 20rpx;
                text {
                    color: #999;
                    font-size: 26rpx;
                }
            }
        }
        .more {
            color: #888;
            font-size: 24rpx;
            display: flex;
            border-top: 1px solid #eee;
            padding-top: 20rpx;
            .part {
                width: 50%;
                text-align: center;
            }
        }
    }
</style>
pages/index/index.vue
@@ -169,6 +169,12 @@
                        text: '条码打印',
                        url: '/pages/tiaomadaying/tiaomadaying',
                        id: 28,
                    },
                    {
                        img: '../../static/icon/icon16.png',
                        text: '上模单',
                        url: '/pages/MJGL/shangmudan/table',
                        id: 29,
                    }
                ]
            }