chenhaozhe
2026-02-02 c7f9e6ca5d8c38412a73e0f496fa09f04651d6bd
Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev
3个文件已添加
3个文件已修改
2623 ■■■■■ 已修改文件
pages.json 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/CustomerComplaintsBill/CustomerComplaintsBillDetail.vue 742 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/CustomerComplaintsBill/CustomerComplaintsBillEdit.vue 1093 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/CustomerComplaintsBill/CustomerComplaintsBillList.vue 618 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/tab4.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tiaomachaima/tiaomachaimaCopy_HK.vue 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json
@@ -1736,7 +1736,28 @@
            {
                "navigationBarTitleText" : "销售出库单(验证)"
            }
        }
        },
        {
            "path" : "pages/CustomerComplaintsBill/CustomerComplaintsBillList",
            "style" :
            {
                "navigationBarTitleText" : "客诉单列表"
            }
        },
        {
            "path" : "pages/CustomerComplaintsBill/CustomerComplaintsBillDetail",
            "style" :
            {
                "navigationBarTitleText" : "客诉单"
            }
        },
        {
            "path" : "pages/CustomerComplaintsBill/CustomerComplaintsBillEdit",
            "style" :
            {
                "navigationBarTitleText" : "客诉单编辑"
            }
        }
        
pages/CustomerComplaintsBill/CustomerComplaintsBillDetail.vue
New file
@@ -0,0 +1,742 @@
<template>
    <view class="container">
        <view class="header">
            <view class="title">客诉处理单明细</view>
            <view class="sub-title">{{ HBillNo }}</view>
        </view>
        <!-- Tab切换 -->
        <view class="tab-container">
            <view class="tabs">
                <view
                    class="tab-item"
                    :class="{'active': currentTab === 0}"
                    @click="switchTab(0)"
                >
                    基本信息
                </view>
                <view
                    class="tab-item"
                    :class="{'active': currentTab === 1}"
                    @click="switchTab(1)"
                >
                    审核信息
                </view>
                <!-- <view
                    class="tab-item"
                    :class="{'active': currentTab === 2}"
                    @click="switchTab(2)"
                >
                    物料信息
                </view> -->
            </view>
            <view class="tab-indicator" :style="indicatorStyle"></view>
        </view>
        <scroll-view
            scroll-y
            class="content"
            :style="{height: scrollHeight + 'px'}"
        >
            <!-- Tab 0: 基本信息 -->
            <view v-if="currentTab === 0" class="tab-content">
                <view class="info-card">
                    <view class="card-title">订单基本信息</view>
                    <view class="info-grid">
                        <view class="info-item" v-if="orderInfo.日期">
                            <text class="label">日期:</text>
                            <text class="value">{{ orderInfo.日期 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.单据号">
                            <text class="label">单据号:</text>
                            <text class="value">{{ orderInfo.单据号 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.单据状态">
                            <text class="label">单据状态:</text>
                            <text class="value">{{ orderInfo.单据状态 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.主题">
                            <text class="label">主题:</text>
                            <text class="value">{{ orderInfo.主题 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.订单号">
                            <text class="label">订单号:</text>
                            <text class="value">{{ orderInfo.订单号 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.主导人">
                            <text class="label">主导人:</text>
                            <text class="value">{{ orderInfo.主导人 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.客服">
                            <text class="label">客服:</text>
                            <text class="value">{{ orderInfo.客服 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.客户">
                            <text class="label">客户:</text>
                            <text class="value">{{ orderInfo.客户 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.客户联系人">
                            <text class="label">客户联系人:</text>
                            <text class="value">{{ orderInfo.客户联系人 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.投诉分类">
                            <text class="label">投诉分类:</text>
                            <text class="value">{{ orderInfo.投诉分类 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.投诉时间">
                            <text class="label">投诉时间:</text>
                            <text class="value">{{ orderInfo.投诉时间 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.发生时间">
                            <text class="label">发生时间:</text>
                            <text class="value">{{ orderInfo.发生时间 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.紧急程度">
                            <text class="label">紧急程度:</text>
                            <text class="value">{{ orderInfo.紧急程度 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.车间">
                            <text class="label">车间:</text>
                            <text class="value">{{ orderInfo.车间 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.完成数量">
                            <text class="label">完成数量:</text>
                            <text class="value">{{ orderInfo.完成数量 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.不良数量">
                            <text class="label">不良数量:</text>
                            <text class="value">{{ orderInfo.不良数量 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.不良原因">
                            <text class="label">不良原因:</text>
                            <text class="value">{{ orderInfo.不良原因 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.问题来源">
                            <text class="label">问题来源:</text>
                            <text class="value">{{ orderInfo.问题来源 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.发生工序">
                            <text class="label">发生工序:</text>
                            <text class="value">{{ orderInfo.发生工序 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.处理结果">
                            <text class="label">处理结果:</text>
                            <text class="value">{{ orderInfo.处理结果 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.是否停线">
                            <text class="label">是否停线:</text>
                            <text class="value">{{ orderInfo.是否停线 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.是否重复发生">
                            <text class="label">是否重复发生:</text>
                            <text class="value">{{ orderInfo.是否重复发生 }}</text>
                        </view>
                        <view class="info-item full-width" v-if="orderInfo.是否涉及物料">
                            <text class="label">是否涉及物料:</text>
                            <text class="value">{{ orderInfo.是否涉及物料 }}</text>
                        </view>
                    </view>
                </view>
            </view>
            <!-- Tab 1: 审核信息 -->
            <view v-if="currentTab === 1" class="tab-content">
                <view class="info-card">
                    <view class="card-title">审批流程信息</view>
                    <view class="info-grid">
                        <view class="info-item" v-if="orderInfo.制单人">
                            <text class="label">制单人:</text>
                            <text class="value">{{ orderInfo.制单人 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.制单日期">
                            <text class="label">制单日期:</text>
                            <text class="value">{{ formatDate(orderInfo.制单日期) }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.审核人">
                            <text class="label">审核人:</text>
                            <text class="value">{{ orderInfo.审核人 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.审核日期">
                            <text class="label">审核日期:</text>
                            <text class="value">{{ formatDate(orderInfo.审核日期) }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.修改人">
                            <text class="label">修改人:</text>
                            <text class="value">{{ orderInfo.修改人 }}</text>
                        </view>
                        <view class="info-item" v-if="orderInfo.修改日期">
                            <text class="label">修改日期:</text>
                            <text class="value">{{ formatDate(orderInfo.修改日期) }}</text>
                        </view>
                    </view>
                </view>
            </view>
            <!-- Tab 2: 物料信息 -->
            <view v-if="currentTab === 2" class="tab-content">
                <view class="material-list">
                    <view
                        v-for="(item, index) in materialList"
                        :key="index"
                        class="material-card"
                    >
                        <view class="material-header">
                            <text class="material-code">{{ item.物料编码 || '物料' + (index + 1) }}</text>
                            <text class="material-name">{{ item.物料名称 }}</text>
                        </view>
                        <view class="material-info">
                            <view class="info-row">
                                <view class="info-col" v-if="item.规格型号">
                                    <text class="label">规格型号:</text>
                                    <text class="value">{{ item.规格型号 }}</text>
                                </view>
                                <view class="info-col" v-if="item.计量单位代码">
                                    <text class="label">单位代码:</text>
                                    <text class="value">{{ item.计量单位代码 }}</text>
                                </view>
                                <view class="info-col" v-if="item.计量单位名称">
                                    <text class="label">计量单位名称:</text>
                                    <text class="value">{{ item.计量单位名称 }}</text>
                                </view>
                                <view class="info-col" v-if="item.物料料号">
                                    <text class="label">物料料号:</text>
                                    <text class="value">{{ item.物料料号 }}</text>
                                </view>
                                <view class="info-col" v-if="item.不良品SN码">
                                    <text class="label">不良品SN码:</text>
                                    <text class="value">{{ item.不良品SN码 }}</text>
                                </view>
                                <view class="info-col" v-if="问题现象简述">
                                    <text class="label">问题现象简述:</text>
                                    <text class="value">{{ item.问题现象简述 }}</text>
                                </view>
                                <view class="info-col" v-if="问题详细描述">
                                    <text class="label">问题详细描述:</text>
                                    <text class="value">{{ item.问题详细描述 }}</text>
                                </view>
                            </view>
                            <view class="info-row">
                                <view class="info-col" v-if="item.批号">
                                    <text class="label">批号:</text>
                                    <text class="value">{{ item.批号 }}</text>
                                </view>
                                <view class="info-col" v-if="item.数量">
                                    <text class="label">数量:</text>
                                    <text class="value">{{ item.数量 }}</text>
                                </view>
                                <view class="info-col" v-if="item.生产入库数量">
                                    <text class="label">生产入库数量:</text>
                                    <text class="value">{{ item.生产入库数量 }}</text>
                                </view>
                                <view class="info-col" v-if="item.开票数量">
                                    <text class="label">开票数量:</text>
                                    <text class="value">{{ item.开票数量 }}</text>
                                </view>
                            </view>
                            <view class="info-row">
                                <view class="info-col" v-if="item.关联数量">
                                    <text class="label">关联数量:</text>
                                    <text class="value">{{ item.关联数量 }}</text>
                                </view>
                                <view class="info-col" v-if="item.未关联数量">
                                    <text class="label">未关联数量:</text>
                                    <text class="value">{{ item.未关联数量 }}</text>
                                </view>
                            </view>
                            <view class="info-row">
                                <view class="info-col" v-if="item.含税单价">
                                    <text class="label">含税单价:</text>
                                    <text class="value">{{ item.含税单价 }}</text>
                                </view>
                                <view class="info-col" v-if="item.折扣率">
                                    <text class="label">折扣率:</text>
                                    <text class="value">{{ item.折扣率 }}</text>
                                </view>
                                <view class="info-col" v-if="item.实际含税单价">
                                    <text class="label">实际单价:</text>
                                    <text class="value">{{ item.实际含税单价 }}</text>
                                </view>
                            </view>
                            <view class="info-row">
                                <view class="info-col" v-if="item.单价">
                                    <text class="label">单价:</text>
                                    <text class="value">{{ item.单价 }}</text>
                                </view>
                                <view class="info-col" v-if="item.金额">
                                    <text class="label">金额:</text>
                                    <text class="value">{{ item.金额 }}</text>
                                </view>
                                <view class="info-col" v-if="item.销售出库审核金额">
                                    <text class="label">销售出库审核金额:</text>
                                    <text class="value">{{ item.销售出库审核金额 }}</text>
                                </view>
                                <view class="info-col" v-if="item.销售出库审核金额">
                                    <text class="label">销售出库审核金额:</text>
                                    <text class="value">{{ item.销售出库审核金额 }}</text>
                                </view>
                                <view class="info-col" v-if="item.销售退库数量">
                                    <text class="label">销售退库数量:</text>
                                    <text class="value">{{ item.销售退库数量 }}</text>
                                </view>
                                <view class="info-col" v-if="item.销售退库审核数量">
                                    <text class="label">销售退库审核数量:</text>
                                    <text class="value">{{ item.销售退库审核数量 }}</text>
                                </view>
                                <view class="info-col" v-if="item.是否下推生产订单">
                                    <text class="label">是否下推生产订单:</text>
                                    <text class="value">{{ item.是否下推生产订单 }}</text>
                                </view>
                            </view>
                            <view class="info-row">
                                <view class="info-col" v-if="item.客户物料编码">
                                    <text class="label">客户物料编码:</text>
                                    <text class="value">{{ item.客户物料编码 }}%</text>
                                </view>
                                <view class="info-col" v-if="item.客户规格型号">
                                    <text class="label">客户规格型号:</text>
                                    <text class="value">{{ item.客户规格型号 }}%</text>
                                </view>
                                <view class="info-col" v-if="item.客户物料名称">
                                    <text class="label">客户物料名称:</text>
                                    <text class="value">{{ item.客户物料名称 }}%</text>
                                </view>
                                <view class="info-col" v-if="item.是否取库存">
                                    <text class="label">是否取库存:</text>
                                    <text class="value">{{ item.是否取库存 }}%</text>
                                </view>
                                <view class="info-col" v-if="item.剩余订金">
                                    <text class="label">剩余订金:</text>
                                    <text class="value">{{ item.剩余订金 }}%</text>
                                </view>
                                <view class="info-col" v-if="item.报废数量">
                                    <text class="label">报废数量:</text>
                                    <text class="value">{{ item.报废数量 }}%</text>
                                </view>
                                <view class="info-col" v-if="item.生产入库数量">
                                    <text class="label">生产入库数量:</text>
                                    <text class="value">{{ item.生产入库数量 }}%</text>
                                </view>
                                <!-- -->
                                <view class="info-col" v-if="item.税率">
                                    <text class="label">税率:</text>
                                    <text class="value">{{ item.税率 }}%</text>
                                </view>
                                <view class="info-col" v-if="item.税额">
                                    <text class="label">税额:</text>
                                    <text class="value">{{ item.税额 }}</text>
                                </view>
                                <view class="info-col" v-if="item.价税合计">
                                    <text class="label">价税合计:</text>
                                    <text class="value">{{ item.价税合计 }}</text>
                                </view>
                            </view>
                            <view class="info-row" v-if="item.交货日期">
                                <view class="info-col full-width">
                                    <text class="label">交货日期:</text>
                                    <text class="value">{{ item.交货日期 }}</text>
                                </view>
                            </view>
                            <view class="info-row" v-if="item.投料">
                                <view class="info-col full-width">
                                    <text class="label">投料:</text>
                                    <text class="value">{{ item.投料 }}</text>
                                </view>
                            </view>
                            <view class="info-row" v-if="item.深加工">
                                <view class="info-col full-width">
                                    <text class="label">深加工:</text>
                                    <text class="value">{{ item.深加工 }}</text>
                                </view>
                            </view>
                        </view>
                    </view>
                    <view v-if="materialList.length === 0" class="empty-state">
                        <uni-icons type="list" size="50" color="#ccc"></uni-icons>
                        <text class="empty-text">暂无物料信息</text>
                    </view>
                </view>
            </view>
        </scroll-view>
        <view class="footer">
            <button class="back-btn" @click="goBack">返回</button>
        </view>
        <uni-load-more v-if="loading" status="loading" :content-text="loadingText"></uni-load-more>
    </view>
</template>
<script>
    import { CommonUtils } from '@/utils/common.js'
    import { getUserInfo } from "../../utils/auth";
    export default {
        data() {
            return {
                // 参数
                linterid: '',
                HBillNo: '',
                currentTab: 0,
                scrollHeight: 0,
                loading: false,
                loadingText: {
                    contentdown: '上拉显示更多',
                    contentrefresh: '正在加载...',
                    contentnomore: '没有更多数据了'
                },
                orderInfo: {},
                materialList: [],
                allData: [],
            }
        },
        computed: {
            indicatorStyle() {
                const tabWidth = 100 / 3;
                return {
                    width: tabWidth + '%',
                    transform: `translateX(${this.currentTab * 100}%)`
                };
            }
        },
        onLoad(options) {
            if (options.linterid && options.HBillNo) {
                this.linterid = options.linterid;
                this.HBillNo = options.HBillNo;
                this.loadOrderDetail();
            } else {
                uni.showToast({
                    title: '参数错误',
                    icon: 'error'
                });
                setTimeout(() => {
                    uni.navigateBack();
                }, 1500);
            }
            // 计算滚动区域高度
            this.calcScrollHeight();
        },
        onReady() {
            uni.onWindowResize(() => {
                this.calcScrollHeight();
            });
        },
        methods: {
            calcScrollHeight() {
                const systemInfo = uni.getSystemInfoSync();
                const windowHeight = systemInfo.windowHeight;
                const query = uni.createSelectorQuery().in(this);
                query.select('.header').boundingClientRect();
                query.select('.tab-container').boundingClientRect();
                query.select('.footer').boundingClientRect();
                query.exec((res) => {
                    if (res[0] && res[1] && res[2]) {
                        const headerHeight = res[0].height;
                        const tabHeight = res[1].height;
                        const footerHeight = res[2].height;
                        const margin = 5; // 安全边距
                        this.scrollHeight = windowHeight - headerHeight - tabHeight - footerHeight - margin;
                    }
                });
            },
            switchTab(index) {
                this.currentTab = index;
            },
            loadOrderDetail() {
                this.loading = true;
                const sWhere = ` and HInterID = '${this.linterid}'`;
                CommonUtils.doRequest2({
                    url: '/Crm_CustomerAppealBill/list',
                    data: {
                        sWhere: sWhere,
                        user: getUserInfo()["Czymc"],
                        // Organization:getUserInfo()["Organization"],
                        // page:1,
                        // size:50
                    },
                    resFunction: (res) => {
                        this.loading = false;
                        if (res.data.Message === "无查看权限!") {
                            uni.showToast({
                                icon: 'none',
                                title: res.data.Message
                            });
                            return;
                        }
                        if (res.data.code === "1" && res.data.data && res.data.data.length > 0) {
                            this.allData = res.data.data;
                            this.orderInfo = { ...this.allData[0] };
                            this.materialList = this.allData;
                            if (!this.orderInfo.单据号 && this.HBillNo) {
                                this.orderInfo.单据号 = this.HBillNo;
                            }
                        } else {
                            uni.showToast({
                                title: '未找到订单信息',
                                icon: 'none'
                            });
                        }
                    },
                    errFunction: (err) => {
                        this.loading = false;
                        uni.showToast({
                            title: '加载失败',
                            icon: 'error'
                        });
                        console.error('加载订单详情失败:', err);
                    }
                });
            },
            formatDate(dateStr) {
                if (!dateStr) return '';
                if (dateStr.length >= 10) {
                    return dateStr.substr(0, 10);
                }
                return dateStr;
            },
            // 返回上一页
            goBack() {
                uni.navigateBack();
            }
        }
    }
</script>
<style lang="scss" scoped>
    .container {
        display: flex;
        flex-direction: column;
        height: 100vh;
        background-color: #f5f5f5;
    }
    .header {
        padding: 30rpx;
        background: linear-gradient(135deg, #3a78ff 0%, #5a9cff 100%);
        color: white;
        text-align: center;
        .title {
            font-size: 36rpx;
            font-weight: bold;
            margin-bottom: 10rpx;
        }
        .sub-title {
            font-size: 28rpx;
            opacity: 0.9;
        }
    }
    .tab-container {
        background-color: white;
        position: relative;
        box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
        .tabs {
            display: flex;
            .tab-item {
                flex: 1;
                text-align: center;
                padding: 25rpx 0;
                font-size: 30rpx;
                color: #666;
                transition: all 0.3s;
                &.active {
                    color: #3a78ff;
                    font-weight: bold;
                }
            }
        }
        .tab-indicator {
            height: 4rpx;
            background-color: #3a78ff;
            transition: transform 0.3s ease;
        }
    }
    .content {
        flex: 1;
    }
    .tab-content {
        padding: 20rpx;
    }
    .info-card {
        background-color: white;
        border-radius: 16rpx;
        padding: 30rpx;
        margin-bottom: 20rpx;
        box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
        .card-title {
            font-size: 32rpx;
            font-weight: bold;
            color: #333;
            margin-bottom: 30rpx;
            padding-bottom: 15rpx;
            border-bottom: 1rpx solid #eee;
        }
        .info-grid {
            display: flex;
            flex-wrap: wrap;
            .info-item {
                width: 50%;
                margin-bottom: 25rpx;
                &.full-width {
                    width: 100%;
                }
                .label {
                    color: #666;
                    font-size: 28rpx;
                    margin-right: 10rpx;
                }
                .value {
                    color: #333;
                    font-size: 28rpx;
                    font-weight: 500;
                    word-break: break-all;
                }
            }
        }
    }
    .material-list {
        .material-card {
            background-color: white;
            border-radius: 16rpx;
            margin-bottom: 20rpx;
            padding: 30rpx;
            box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
            .material-header {
                display: flex;
                align-items: center;
                margin-bottom: 25rpx;
                padding-bottom: 15rpx;
                border-bottom: 1rpx solid #eee;
                .material-code {
                    font-size: 30rpx;
                    font-weight: bold;
                    color: #3a78ff;
                    margin-right: 20rpx;
                    background-color: #f0f7ff;
                    padding: 5rpx 15rpx;
                    border-radius: 8rpx;
                }
                .material-name {
                    font-size: 28rpx;
                    color: #333;
                    flex: 1;
                }
            }
            .material-info {
                .info-row {
                    display: flex;
                    flex-wrap: wrap;
                    margin-bottom: 15rpx;
                    &:last-child {
                        margin-bottom: 0;
                    }
                    .info-col {
                        width: 50%;
                        margin-bottom: 10rpx;
                        &.full-width {
                            width: 100%;
                        }
                        .label {
                            color: #888;
                            font-size: 26rpx;
                            margin-right: 8rpx;
                        }
                        .value {
                            color: #333;
                            font-size: 26rpx;
                            font-weight: 500;
                        }
                    }
                }
            }
        }
    }
    .empty-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 100rpx 0;
        .empty-text {
            color: #999;
            font-size: 28rpx;
            margin-top: 20rpx;
        }
    }
    .footer {
        padding: 20rpx 30rpx;
        background-color: white;
        border-top: 1rpx solid #eee;
        .back-btn {
            background-color: #3a78ff;
            color: white;
            border-radius: 50rpx;
            height: 80rpx;
            line-height: 80rpx;
            font-size: 32rpx;
            &:active {
                background-color: #2c5fcc;
            }
        }
    }
</style>
pages/CustomerComplaintsBill/CustomerComplaintsBillEdit.vue
New file
@@ -0,0 +1,1093 @@
<template>
    <view>
        <view class="form">
            <view class="tabs">
                <view :class="tabs == 0 ? 'on':''" @tap="() => { tabs = 0;  }">单据信息</view>
                <view :class="tabs == 1 ? 'on':''" @tap="() => { tabs = 1; }">其他信息</view>
                <view :class="tabs == 2 ? 'on':''" @tap="() => { tabs = 2;  }">制单信息</view>
            </view>
            <!-- 单据信息 -->
            <view v-if="tabs == 0">
                <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">主题:</view>
                    <view class="righton">
                        <input name="HContext"  v-model="hform.HContext" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">订单号:</view>
                    <view class="righton">
                        <input name="HOrderBillNo"  v-model="hform.HOrderBillNo" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title"><text>*</text>主导人:</view>
                    <view class="right">
                        <uni-combox :candidates="arrayHEmpName" placeholder="请选择主导人" v-model="hform.HManagerName"
                            @input="HManagerNameChange"></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.HServiceManName"
                            @input="HEmpNameChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">产品代码</view>
                    <view class="righton disabled">
                        <input type="text" disabled :value="hform.HMaterNumber" />
                    </view>
                    <view class="icon-wrapper-big">
                        <uni-icons type="search" size="20" @click="showSelectorModule(hform, 1)"></uni-icons>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">产品名称</view>
                    <view class="righton disabled">
                        <input type="text" disabled :value="hform.HMaterName" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">客户联系人:</view>
                    <view class="righton">
                        <input name="HLinkMan"  v-model="hform.HLinkMan" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">投诉分类:</view>
                    <view class="righton">
                        <uni-combox :candidates="roleOptions" placeholder="请选择源单类型" v-model="hform.HAppealType"
                            @input="arrayOptionChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">投诉日期:</view>
                    <view class="right">
                        <picker mode="date" v-model="hform.HAppealTime" @change="HDateChangeappeal">
                            <input  v-model="hform.HAppealTime" placeholder="请选择日期" />
                        </picker>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">发生日期:</view>
                    <view class="right">
                        <picker mode="date" v-model="hform.HHappenTime" @change="HDateChangeHappened">
                            <input  v-model="hform.HHappenTime" placeholder="请选择日期" />
                        </picker>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">紧急程度:</view>
                    <view class="righton">
                        <uni-combox :candidates="roleOptions_em" placeholder="请选择" v-model="hform.HLevel"
                            @input="arrayOptionChange_em"></uni-combox>
                    </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>
            <view v-if="tabs == 1">
                <view class="form-item">
                    <view class="title"><text>*</text>车间:</view>
                    <view class="right">
                        <uni-combox :candidates="arrayHDeptName" placeholder="请选择车间" v-model="hform.HWorkShopName"
                            @input="HDeptNameChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">计量单位:</view>
                    <view class="righton">
                        <input v-model="hform.HUnitName" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">产品类型:</view>
                    <view class="righton">
                        <input v-model="hform.HMaterType"  />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">完成数量:</view>
                    <view class="righton">
                        <input v-model="hform.HQty" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">不良数量:</view>
                    <view class="righton">
                        <input v-model="hform.HBadQty" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">不良率:</view>
                    <view class="righton">
                        <input v-model="hform.HBadRate" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">问题来源    :</view>
                    <view class="righton">
                        <input v-model="hform.HBadSource"  />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">发生工序:</view>
                    <view class="right">
                        <uni-combox :candidates="arrayHProcName" placeholder="请选择工序" v-model="hform.HProcName"
                            @input="HProcNameChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">处理结果:</view>
                    <view class="right">
                        <uni-combox :candidates="roleOptions_dealresult" placeholder="请选择处理结果" v-model="hform.HWorkedResult"
                            @input="HWorkedResultChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">是否停线:</view>
                    <view class="right">
                        <uni-data-select v-model="hform.HIsStopLine" :localdata="arrayCheck" placeholder="请选择" @change="onChange">
                        </uni-data-select>
                        <!-- <uni-combox :candidates="roleOptions_check" placeholder="请选择" v-model="hform.HIsStopLine"
                            @input="HWorkedResultChange">
                            </uni-combox> -->
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">是否重复发生:</view>
                    <view class="right">
                        <uni-data-select v-model="hform.HIsRepeat" :localdata="arrayCheck" placeholder="请选择" @change="onChange">
                        </uni-data-select>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">是否涉及物料:</view>
                    <view class="right">
                        <uni-data-select v-model="hform.HIsMater" :localdata="arrayCheck" placeholder="请选择" @change="onChange">
                        </uni-data-select>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">不良品SN码:</view>
                    <view class="righton">
                        <input v-model="hform.HBarCode"  />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">问题现象简述:</view>
                    <view class="righton">
                        <input v-model="hform.HBadNote"  />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">问题详细描述:</view>
                    <view class="righton">
                        <input v-model="hform.HBadRemark"  />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">备注:</view>
                    <view class="righton">
                        <input v-model="hform.HRemark"  />
                    </view>
                </view>
            </view>
            <view v-if="tabs == 2">
                <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="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>
        <MaterialPopupVue v-if="enablePopupModule == PopupModuleNameList[1]" ref="listPopup" @update="MaterComplete"
        :bindKey="0">
        </MaterialPopupVue>
    </view>
</template>
<script>
    import dayjs from "dayjs";
    import {
        CommonUtils
    } from "@/utils/common";
    import getDateTime from '@/utils/getdateTime.js';
    import MaterialPopupVue from "@/components/ZLGL/MaterialPopup.vue";
    import {
        getUserInfo
    } from "@/utils/auth.js";
    export default {
        components: {
            MaterialPopupVue,
        },
        data() {
          return {
              calcTimer: null,
            operationType: 1,
            // 控制当前显示的弹窗模块
            enablePopupModule: "",
            PopupModuleNameList: [
              "",
              "Material",
              "Process",
            ],
            // 计算列表高度
            bottomBtnTop: 0,
            listTableTop: 0,
            tabs: 0,
            userInfo: getUserInfo(),
            serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
            linterid: '',
            HBillNo: '',
            btnType: 1, //1新增,3修改
            showmore: false,
            HBarCodeFocus: false,
            arrayHDeptName: [], //部门
            HDeptNameList: [],
            arrayHEmpName: [], //发现人/负责人
            HEmpNameList: [],
            arrayHSourceName: [], //生产资源
            HSourceNameList: [],
            //下拉框
            roleOptions: ['产品投诉','服务投诉','客户意见','其它'], // 下拉框选项
            arrayOption:{产品投诉:"产品投诉",服务投诉:'服务投诉',客户意见:'客户意见',其它:'其它'},
            roleOptions_em:['普通','紧急','非常紧急'],
            arrayOption_em:{普通:"普通",紧急:'紧急',非常紧急:'非常紧急'},
            roleOptions_dealresult:['未处理','处理中','处理完成'],
            arrayOption_dealresult:{未处理:"未处理",处理中:'处理中',处理完成:'处理完成'},
            arrayCheck:[{value:'是',text:'是'},{value:'否',text:'否'}],
            isEdit: false,
            listOption: [], // 列表选项
            listData: [], // 表格数据
            selectedRows: [], // 表格选中的数据
            arrayHProcName: [], //工序
            HProcNameList: [],
            hform: {
              HContext: '', // 主题
              HOrderBillNo: '', // 订单号
              HLinkMan: '', // 客户联系人
              HHappenTime: '', // 发生日期
              HProcName: '', // 发生工序名称
              HProcID: '', // 发生工序ID
              HUnitName: '', // 计量单位
              HMaterType: '', // 产品类型
              HQty: '', // 完成数量
              HBadQty: '', // 不良数量
              HBadRate: '', // 不良率
              HBadSource: '', // 问题来源
              HWorkedResult: '', // 处理结果
              HIsStopLine: '', // 是否停线
              HIsRepeat: '', // 是否重复发生
              HIsMater: '', // 是否涉及物料
              HBarCode: '', // 不良品SN码
              HBadNote: '', // 问题现象简述
              HBadRemark: '', // 问题详细描述
              HUpdater: '', // 修改人
              HUpDateDate: '', // 修改日期
              // 原有属性
              HAppealTime: '',
              HAppealType: '',
              HLevel: '',
              HInterID: '',
              HBillNo: '',
              HDate: getDateTime.dateTimeStr('y-m-d'),
              HWorkShopName: uni.getStorageSync('HDeptName'),
              HWorkShopID: uni.getStorageSync('HDeptID'),
              HServiceManName: uni.getStorageSync('HEmpName'),
              HServiceMan: uni.getStorageSync('HEmpID'),
              HManagerName: uni.getStorageSync('HMangerName'),
              HMangerID: uni.getStorageSync('HMangerID'),
              HSourceName: '',
              HSourceID: '0',
              HScanDate: getDateTime.dateTimeStr('y-m-d h:i:s'),
              HMaterID: '0',
              HMaterNumber: '',
              HMaterName: '',
              HICMOBillNo: '',
              HICMOInterID: '0',
              HICMOEntryID: '0',
              HProcExchBillNo: '',
              HProcExchInterID: '0',
              HProcExchEntryID: '0',
              HOrgID: uni.getStorageSync('OrganizationID'),
              HMaker: '',
              HMakeDate: '',
              // HUpDater: '', // 已在上方添加为HUpdater
              // HUpDateDate: '', // 已在上方添加
              HChecker: '',
              HCheckDate: '',
              HCloseMan: '',
              HCloseDate: '',
              HDeleteMan: '',
              HDeleteDate: '',
              HRemark: '', // 备注
              eventType: 'Add'
            }
          }
        },
        onLoad(e) {
            this.HBarCodeFocus = true
            this.getHDeptList()
            this.getHEmpList()
            this.getHProcList()
            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)
                this.getMouldDetailData(e.linterid, e.HBillNo);
            } else {
                this.getNewData()
            }
            this.tabs = 0
        },
        // ==================== 计算属性 ====================
        computed: {
            // 计算表格高度
            listTableHeight: {
                get() {
                    return this.bottomBtnTop - this.listTableTop - 10
                }
            },
        },
        watch: {
          // 监听完成数量的变化
          'hform.HQty': {
            handler(newVal, oldVal) {
              if (newVal !== oldVal) {
                // 延迟计算,避免频繁计算
                clearTimeout(this.calcTimer);
                this.calcTimer = setTimeout(() => {
                  this.calcBadRate();
                }, 300);
              }
            },
            immediate: true // 初始化时也计算一次
          },
          // 监听不良数量的变化
          'hform.HBadQty': {
            handler(newVal, oldVal) {
              if (newVal !== oldVal) {
                // 延迟计算,避免频繁计算
                clearTimeout(this.calcTimer);
                this.calcTimer = setTimeout(() => {
                  this.calcBadRate();
                }, 300);
              }
            },
            immediate: true // 初始化时也计算一次
          }
        },
        methods: {
            calcBadRate() {
              try {
                const completeQty = parseFloat(this.hform.HQty) || 0;
                const badQty = parseFloat(this.hform.HBadQty) || 0;
                if (completeQty > 0) {
                  // 计算不良率百分比,保留两位小数
                  const badRate = (badQty / completeQty * 100).toFixed(2);
                  this.hform.HBadRate = `${badRate}%`;
                } else {
                  this.hform.HBadRate = '0%';
                }
              } catch (error) {
                console.error('计算不良率出错:', error);
                this.hform.HBadRate = '0%';
              }
            },
            onChange(e){
                console.log("this",this.hform.HIsStopLine)
                console.log("this",this.hform.HIsRepeat)
            },
            arrayOptionChange(e) {
                console.log('选中的角色:', this.hform.HAppealType);
                this.hform.HAppealType=this.arrayOption[this.hform.HAppealType]
            },
            arrayOptionChange_em(e)
            {
                this.hform.HLevel=this.arrayOption_em[this.hform.HLevel]
            },
            HWorkedResultChange(d)
            {
                this.hform.HWorkedResult=this.arrayOption_dealresult[this.hform.HWorkedResult]
            },
            //日期
            HDateChange(e) {
                console.log(e.detail.value)
                this.hform.HDate = e.detail.value
            },
            HDateChangeappeal(e)
            {
                this.hform.HAppealTime = e.detail.value
            },
            HDateChangeHappened(e)
            {
                this.hform.HHappenTime=e.detail.value
            },
            //获取使用部门数据
            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.HWorkShopID = 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.HServiceMan = 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: " and HUSEORGID = " + uni.getStorageSync('OrganizationID') + ""
                    },
                    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'
            },
            // 显示弹窗
            async showSelectorModule(item, index) {
               // this.currentChechItemIDCache = item.num || 0; // 0 表示没有任何子表被选中
                this.enablePopupModule = this.PopupModuleNameList[index];
                console.log("this.$refs: ", this.$refs);
                console.log('listPopup是否存在:', !!this.$refs.listPopup);
                await this.$nextTick();
                this.$refs.listPopup.showPopup();
            },
            // 产品代码返回
            async MaterComplete(e) {
                console.log("MaterRet: ", e);
                for (var key in e["retVal"]) {
                    let data = e["retVal"][key];
                    Object.assign(this.hform, {
                        HMaterNumber: data["物料代码"],
                        HMaterName: data["物料名称"],
                        HMaterID: data["HItemID"],
                    });
                    await this.$nextTick();
                    this.$refs.listPopup.exit();
                    // 确保在弹窗结束后,再将页面上挂在的组件置空
                    await this.$nextTick();
                    this.enablePopupModule = this.PopupModuleNameList[0];
                }
            },
            //工序
            async getHProcList() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Gy_Process/list',
                        data: {
                            sWhere: '',
                            user: getUserInfo()['Czymc'] || '',
                        },
                    })
                    console.log('工序res: ', res);
                    if (res.data.count > 0) {
                        console.log('工序res.data.data: ', res.data.data);
                        this.HProcNameList = res.data.data
                        this.arrayHProcName = res.data.data.map(item => item.工序名称)
                        this.$forceUpdate();
                    } else {
                        uni.showToast({
                            title: res.data.Message,
                            icon: 'none'
                        })
                    }
                } catch (err) {
                    uni.showToast({
                        title: err,
                        icon: 'none'
                    })
                }
            },
            //选择Proc
            HProcNameChange(e) {
                for (var i = 0; i < this.HProcNameList.length; i++) {
                    if (this.HProcNameList[i].工序名称 == e) {
                        this.hform.HProcID = this.HProcNameList[i].HItemID
                    }
                }
            },
            //编辑回显
            getEditData(linterid, HBillNo) {
                //主表
                uni.request({
                    url: this.serverUrl + '/Crm_CustomerAppealBill/editInit',
                    data: {
                        HInterID: linterid,
                        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.HInterID
                            this.hform.HBillNo = data.单据号
                            this.hform.HDate = data.日期 ? data.日期.substr(0, 10) : ''
                            this.hform.HContext = data.主题 || ''
                            this.hform.HOrderBillNo = data.订单号 || ''
                            this.hform.HMaterID = data.HMaterID || '0'
                            this.hform.HMaterNumber = data.物料编码 || ''
                            this.hform.HMaterName = data.物料名称 || ''
                            this.hform.HUnitName = data.计量单位名称 || ''
                            this.hform.HMaterType = data.物料类型 || ''
                            this.hform.HManagerName = data.主导人 || ''
                            this.hform.HMangerID = data.HManager || '0'
                            this.hform.HServiceManName = data.客服 || ''
                            this.hform.HServiceMan = data.HServiceMan || '0'
                            this.hform.HLinkMan = data.客户联系人 || ''
                            this.hform.HAppealType = data.投诉分类 || ''
                            this.hform.HAppealTime = data.投诉时间 ? data.投诉时间.substr(0, 10) : ''
                            this.hform.HHappenTime = data.发生时间 ? data.发生时间.substr(0, 10) : ''
                            this.hform.HLevel = data.紧急程度 || ''
                            this.hform.HWorkShopName = data.车间 || ''
                            this.hform.HWorkShopID = data.HWorkShopID || '0'
                            this.hform.HQty = data.完成数量 || '0'
                            this.hform.HBadQty = data.不良数量 || '0'
                            this.hform.HBadSource = data.问题来源 || ''
                            this.hform.HProcName = data.发生工序 || ''
                            this.hform.HProcID = data.HProcID || '0'
                            this.hform.HWorkedResult = data.处理结果 || ''
                            this.hform.HIsStopLine = data.是否停线 || ''
                            this.hform.HIsRepeat = data.是否重复发生 || ''
                            this.hform.HIsMater = data.是否涉及物料 || ''
                            this.hform.HBarCode = data.不良品SN码 || ''
                            this.hform.HBadNote = data.问题现象简述 || ''
                            this.hform.HBadRemark = data.问题详细描述 || ''
                            this.hform.HRemark = data.备注 || ''
                            // 计算不良率
                            this.calcBadRate();
                            // 系统字段
                            this.hform.HMaker = data.制单人 || ''
                            this.hform.HMakeDate = data.制单时间 || ''
                            this.hform.HUpdater = data.修改人 || ''
                            this.hform.HUpDateDate = data.修改时间 || ''
                            this.hform.HChecker = data.审核人 || ''
                            this.hform.HCheckDate = 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.hform.HMakeDate = getDateTime.dateTimeStr('y-m-d')
                            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.HServiceManName) {
                    uni.showToast({
                        title: '请选择客服',
                        icon: 'none'
                    })
                } else if (!this.hform.HManagerName) {
                    uni.showToast({
                        title: '请选择负责人',
                        icon: 'none'
                    })
                } else if (!this.hform.HMaterNumber) {
                    uni.showToast({
                        title: '请选择产品',
                        icon: 'none'
                    })
                } else {
                    uni.showLoading({
                        title: '请稍候'
                    })
                    // ========== 第一步:构建主表数据 ==========
                  const mainData = {
                    // 单据基本信息
                    HBillNo: this.hform.HBillNo,
                    HInterID: this.hform.HInterID,
                    HDate: this.hform.HDate,
                    HContext: this.hform.HContext || "", // 主题
                    HOrderBillNo: this.hform.HOrderBillNo || "", // 订单号
                    HRemark: this.hform.HRemark || "", // 备注
                    // 人员信息
                    HManagerName: this.hform.HManagerName || "",
                    HMangerID: this.hform.HMangerID || "",
                    HServiceManName: this.hform.HServiceManName || "",
                    HServiceMan: this.hform.HServiceMan || "",
                    HLinkMan: this.hform.HLinkMan || "", // 客户联系人
                    // 产品信息
                    HMaterID: this.hform.HMaterID || "0",
                    HMaterNumber: this.hform.HMaterNumber || "",
                    HMaterName: this.hform.HMaterName || "",
                    HMaterType: this.hform.HMaterType || "", // 产品类型
                    HUnitName: this.hform.HUnitName || "", // 计量单位
                    // 投诉/问题信息
                    HAppealType: this.hform.HAppealType || "", // 投诉分类
                    HAppealTime: this.hform.HAppealTime || "", // 投诉日期
                    HHappenTime: this.hform.HHappenTime || "", // 发生日期
                    HLevel: this.hform.HLevel || "", // 紧急程度
                    // 车间/工序信息
                    HWorkShopName: this.hform.HWorkShopName || "",
                    HWorkShopID: this.hform.HWorkShopID || "",
                    HProcName: this.hform.HProcName || "", // 发生工序
                    HProcID: this.hform.HProcID || "", // 发生工序ID
                    // 数量信息
                    HQty: this.hform.HQty || "0", // 完成数量
                    HBadQty: this.hform.HBadQty || "0", // 不良数量
                    HBadRate: this.hform.HBadRate || "0", // 不良率
                    // 问题详情
                    HBadSource: this.hform.HBadSource || "", // 问题来源
                    HWorkedResult: this.hform.HWorkedResult || "", // 处理结果
                    HIsStopLine: this.hform.HIsStopLine || "", // 是否停线
                    HIsRepeat: this.hform.HIsRepeat || "", // 是否重复发生
                    HIsMater: this.hform.HIsMater || "", // 是否涉及物料
                    HBarCode: this.hform.HBarCode || "", // 不良品SN码
                    HBadNote: this.hform.HBadNote || "", // 问题现象简述
                    HBadRemark: this.hform.HBadRemark || "", // 问题详细描述
                    // 组织信息
                    HOrgID: this.hform.HOrgID || uni.getStorageSync('OrganizationID'),
                    // 系统字段
                    HMaker: this.hform.HMaker || uni.getStorageSync('HUserName'),
                    HMakeDate: this.hform.HMakeDate || getDateTime.dateTimeStr('y-m-d'),
                    HUpdater: this.hform.HUpdater || uni.getStorageSync('HUserName'), // 修改人
                    HUpDateDate: this.hform.HUpDateDate || getDateTime.dateTimeStr('y-m-d'), // 修改日期
                    HChecker: this.hform.HChecker || "", // 审核人
                    HCheckDate: this.hform.HCheckDate || "", // 审核日期
                    // HCloseMan: this.hform.HCloseMan || "", // 关闭人
                    // HCloseDate: this.hform.HCloseDate || "", // 关闭日期
                    // HDeleteMan: this.hform.HDeleteMan || "", // 作废人
                    // HDeleteDate: this.hform.HDeleteDate || "", // 作废日期
                    eventType: this.hform.eventType || 'Add'
                  };
                    // ========== 第三步:拼接完整数据 ==========
                    const submitStr = JSON.stringify(mainData) + ";" + this.btnType +
                        ";" + uni.getStorageSync('HUserName');
                    console.log(submitStr);
                    uni.request({
                        url: this.serverUrl + '/Crm_CustomerAppealBill/SaveCustomerAppealBill',
                        method: 'POST',
                        dataType: "json",
                        data: {
                            msg: submitStr
                        },
                        success: (res) => {
                            console.log(1, res);
                            uni.hideLoading()
                            if (res.data.count == 1) {
                                let pages = getCurrentPages();
                                let prePage = pages[pages.length - 2];
                                if (this.isEdit) {
                                    setTimeout(() => {
                                        uni.redirectTo({
                                            url: '/pages/shangmudan/MouldUpperBill?linterid=' +
                                                this.linterid + '&HBillNo=' + this.HBillNo
                                        })
                                    }, 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: #FFA500;
            color: #fff;
            position: absolute;
            right: 120rpx;
        }
        .btn-d {
            background-color: #ff8901;
            color: #fff;
        }
    }
    .tabs {
        width: 100%;
        display: flex;
        border-bottom: 1px solid #ddd;
        margin: 20rpx 0;
        view {
            width: 25%;
            font-size: 30rpx;
            color: #555;
            text-align: center;
            padding: 16rpx 0;
        }
        .on {
            color: #3a78ff;
            font-weight: bold;
            border-bottom: 3px solid #3a78ff;
        }
    }
</style>
pages/CustomerComplaintsBill/CustomerComplaintsBillList.vue
New file
@@ -0,0 +1,618 @@
<template>
    <view>
        <view class="page-header">
            <view class="search-item">
                <view class="left">日期间隔</view>
                <view class="right">
                    <picker mode="selector" :value="curDateGap" :range="dateRangePicker"
                        @change="onDateRangePickerChangeHandler">
                        <input disabled v-model="curDateGap" placeholder="请选择日期间隔" />
                        <view class="picker-overlay"></view>
                    </picker>
                </view>
            </view>
            <view class="search-item">
                <view class="left">开始日期</view>
                <view class="right">
                    <uni-datetime-picker :clear-icon="false" type="date" v-model="startDate"
                        :disabled="!enableCustomDateRange">
                        <view class="datetime-picker-inner"
                            :class="enableCustomDateRange?'font__enable':'font__disable'">
                            <text>{{ startDate }}</text>
                        </view>
                    </uni-datetime-picker>
                </view>
            </view>
            <view class="search-item">
                <view class="left">结束日期</view>
                <view class="right">
                    <uni-datetime-picker :clear-icon="false" type="date" v-model="endDate"
                        :disabled="!enableCustomDateRange">
                        <view class="datetime-picker-inner"
                            :class="enableCustomDateRange?'font__enable':'font__disable'">{{ endDate }}</view>
                    </uni-datetime-picker>
                </view>
            </view>
            <view class="search-item">
                <view class="left">单据号</view>
                <view class="right">
                    <input type="text" auto-focus v-model="HBillNo" />
                </view>
            </view>
            <view class="button-groups">
                <button type="default" size="mini" class="btn-b" @tap.stop="onAddClickHandler">新增</button>
                <button type="default" size="mini" class="btn-c" @tap.stop="onSearchClickHandler">查询</button>
                <button type="default" size="mini" class="btn-a" @tap.stop="onResetClickHandler">重置</button>
            </view>
        </view>
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <scroll-view id="pageContent" scroll-y class="page-content" :style="{height: pageContentHeight + 'px'}">
            <view v-for="(item,index) in listData" :key="index">
                <uni-card :title="item.订单号" :extra="item.单据号" 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.计量单位名称}}
                        </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.HServiceMan">
                            <text>HServiceMan:</text>{{item.HServiceMan}}
                        </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.发生时间}}
                        </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.发生工序}}
                        </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 class="detail" v-if="item.作废日期">
                            <text>作废日期:</text>{{item.作废日期.substr(0,10)}}
                        </view>
                    </view>
                    <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="op6" size="mini" plain @tap.stop="Browse(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>
        </scroll-view>
        <!-- 分页器 -->
        <view class="page-footer">
            <uni-pagination id="pagination" title="标题文字" v-model="pageMeta.curPage" :pageSize="pageMeta.size"
                :total="pageMeta.total" @change="onPageChangeHandler"></uni-pagination>
        </view>
    </view>
</template>
<script>
    import dayjs from 'dayjs'
    import {
        CommonUtils
    } from '@/utils/common.js'
    import {
        getUserInfo
    } from "../../utils/auth";
    export default {
        data() {
            return {
                // 计算卡片列表高度
                pagination_top: 0,
                pageContent_top: 0,
                // 分页控制
                pageMeta: {
                    curPage: 1,
                    size: 50,
                    total: 0,
                },
                // 滚动控制
                scrollTop: 0,
                old: {
                    scrollTop: 0
                },
                dateRangePicker: ["任意间隔", "今天", "近两天", "近三天", "近四天", "近五天", "近六天", "近七天", "近30天"],
                curDateGap: "近七天",
                enableCustomDateRange: false,
                startDate: dayjs(new Date()).subtract(7, 'day').format('YYYY-MM-DD'),
                endDate: dayjs(new Date()).format('YYYY-MM-DD'),
                HBillNo: '',
                listData: [],
                showDetail: -1,
                operations: -1,
            }
        },
        computed: {
            pageContentHeight: {
                get() {
                    return (this.pagination_top - this.pageContent_top)
                }
            },
        },
        onLoad() {
            this.onSearchClickHandler()
        },
        onPullDownRefresh() {
            this.onSearchClickHandler()
        },
        async onReady() {
            // #ifndef MP-WEIXIN
            let query = uni.createSelectorQuery().in(this)
            query.select("#pagination")
                .boundingClientRect((data) => {
                    if (data) {
                        this.pagination_top = data.top
                    } else {
                        console.log("未找到#pagination节点");
                    }
                })
                .exec();
            query.select("#pageContent")
                .boundingClientRect((data) => {
                    if (data) {
                        this.pageContent_top = data.top
                    } else {
                        console.log("未找到#pageContent节点");
                    }
                })
                .exec();
            // #endif
        },
        methods: {
            goTop: function(e) {
                // 解决view层不同步的问题
                this.scrollTop = this.old.scrollTop
                this.$nextTick(function() {
                    this.scrollTop = 0
                });
            },
            onDateRangePickerChangeHandler({
                detail
            }) {
                this.enableCustomDateRange = false
                this.curDateGap = this.dateRangePicker[detail.value]
                let date = new Date()
                switch (this.curDateGap) {
                    case "今天":
                        this.startDate = dayjs(date).format("YYYY-MM-DD")
                        break;
                    case "近一天":
                        this.startDate = dayjs(date).subtract(1, 'day').format("YYYY-MM-DD")
                        break;
                    case "近两天":
                        this.startDate = dayjs(date).subtract(2, 'day').format("YYYY-MM-DD")
                        break;
                    case "近三天":
                        this.startDate = dayjs(date).subtract(3, 'day').format("YYYY-MM-DD")
                        break;
                    case "近四天":
                        this.startDate = dayjs(date).subtract(4, 'day').format("YYYY-MM-DD")
                        break;
                    case "近五天":
                        this.startDate = dayjs(date).subtract(5, 'day').format("YYYY-MM-DD")
                        break;
                    case "近六天":
                        this.startDate = dayjs(date).subtract(6, 'day').format("YYYY-MM-DD")
                        break;
                    case "近七天":
                        this.startDate = dayjs(date).subtract(7, 'day').format("YYYY-MM-DD")
                        break;
                    case "近30天":
                        this.startDate = dayjs(date).subtract(30, 'day').format("YYYY-MM-DD")
                        break;
                }
                if (this.curDateGap == '任意间隔') {
                    this.enableCustomDateRange = true
                }
            },
            onSearchClickHandler() {
                let sWhere = ""
                if (this.startDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.startDate + "'";
                }
                if (this.endDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + this.endDate + "'";
                }
                if (this.HBillNo) {
                    sWhere += " and 单据号 like '%" + this.HBillNo + "%'";
                }
                this.get_DisplayPage(sWhere);
            },
            clear() {
                this.curDateGap = "近七天"
                this.enableCustomDateRange = false
                this.startDate = dayjs(new Date()).subtract(7, 'day').format('YYYY-MM-DD')
                this.endDate = dayjs(new Date()).format('YYYY-MM-DD')
                this.HBillNo = ''
            },
            async onResetClickHandler() {
                this.clear()
                await this.$nextTick()
                this.onSearchClickHandler()
            },
            get_DisplayPage(sWhere) {
                CommonUtils.doRequest2({
                    url: '/Crm_CustomerAppealBill/list',
                    data: {
                        "sWhere": sWhere,
                        "user": getUserInfo()["Czymc"],
                    },
                    resFunction: (res) => {
                        let {
                            data,
                            Message,
                            count
                        } = res.data
                        console.log('res.data: ', res.data.data);
                        if(res.data.Message=="无查看权限!")
                        {
                            uni.showToast({
                                icon: 'none',
                                title: res.data.Message
                            })
                            return;
                        }
                        this.listData = res.data.data;
                        this.pageMeta.total = count
                        uni.stopPullDownRefresh()
                    }
                })
            },
            onPageChangeHandler() {
                this.onSearchClickHandler()
                this.goTop()
            },
            // 新增
            onAddClickHandler() {
                uni.navigateTo({
                    url: "/pages/CustomerComplaintsBill/CustomerComplaintsBillEdit?btnType=1"
                })
            },
            //删除点检记录单
            del(item) {
                console.log(item);
                uni.showModal({
                    title: '删除确认',
                    content: '确认要删除吗,删除后不能恢复',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            CommonUtils.doRequest2({
                                url: '/Crm_CustomerAppealBill/delete',
                                data: {
                                    HInterID: item['HInterID'],
                                    user: getUserInfo()['Czymc']
                                },
                                resFunction: (res) => {
                                    let {
                                        data,
                                        count,
                                        Message
                                    } = res.data
                                    if (count == 1) {
                                        uni.showToast({
                                            icon: count === 1 ? 'success' : 'error',
                                            title: Message,
                                            duration: 2000
                                        });
                                        // 等待提示显示完成再刷新
                                        setTimeout(() => {
                                            this.onSearchClickHandler();
                                        }, 2000);
                                    } else {
                                        uni.showToast({
                                            icon: 'none',
                                            title: Message
                                        })
                                    }
                                }
                            })
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            },
            Browse(item)
            {
                console.log(item.HInterID)
                uni.navigateTo({
                    url: '/pages/CustomerComplaintsBill/CustomerComplaintsBillDetail?linterid=' + item.HInterID + '&HBillNo=' + item.单据号
                })
            },
            edit(item)
            {
                console.log(item)
                uni.navigateTo({
                    url: '/pages/CustomerComplaintsBill/CustomerComplaintsBillEdit?linterid=' + item.HInterID + '&btnType=' + 3
                })
            }
        },
    }
</script>
<style lang="scss">
    .page-header {
        display: flex;
        box-sizing: border-box;
        padding: 20rpx;
        flex-direction: column;
        gap: 10rpx;
        font-size: 32rpx;
        .search-item {
            display: flex;
            flex-direction: row;
            gap: 10rpx;
            justify-content: center;
            align-items: center;
            .left {
                width: 4em;
            }
            .right {
                flex: 1;
                position: relative;
                border-radius: 22rpx;
                border: 1px solid #acacac;
                display: flex;
                padding: 4rpx 10rpx;
                picker {
                    width: 100%;
                }
            }
        }
        input {
            width: inherit;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
        .datetime-picker-inner {
            padding: 8rpx 20rpx;
            font-size: 30rpx;
            display: flex;
            align-items: center;
        }
        .font__enable {
            color: #000;
        }
        .font__disable {
            color: #cccccc;
        }
    }
    .button-groups {
        box-sizing: border-box;
        padding: 10rpx 0 0 0;
        display: flex;
        flex-direction: row;
        gap: 10rpx;
        justify-content: space-between;
        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;
        }
    }
    .page-content {
        // height: 40vh;
        box-sizing: border-box;
        padding: 10rpx 0;
        .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;
            }
        }
    }
    .page-footer {
        position: fixed;
        bottom: 0;
        width: 100%;
        box-sizing: border-box;
        padding: 32rpx 40rpx;
    }
</style>
pages/index/tab4.vue
@@ -210,6 +210,13 @@
                        "id": 23,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon15.png",
                        "text": "客诉处理单列表",
                        "url": "/pages/CustomerComplaintsBill/CustomerComplaintsBillList",
                        "id": 23,
                        "hidden": false
                    },
                ]
            }
        },
pages/tiaomachaima/tiaomachaimaCopy_HK.vue
@@ -191,9 +191,7 @@
            
            },
            printerLabel() {
                console.log('测试打印');
                const formatDate = (date = new Date()) =>
                  date.toISOString().split('T')[0];
                const formatDate = new Date().toISOString().split('T')[0];
                printer.setLineSpacing({
                    spacing: 1.2
                });
@@ -258,7 +256,7 @@
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '打印日期:'+this.formatDate()+'\r\n'
                    content: '打印日期:'+formatDate+'\r\n'
                });
                printer.printQR2({
                    text: this.barCodeInfo['条码编号'],
@@ -325,7 +323,7 @@
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '打印日期:'+this.formatDate()+'\r\n'
                    content: '打印日期:'+formatDate+'\r\n'
                });
                printer.printQR2({
                    text: this.barCodeSplitInfo[0]['HBarCode'],
@@ -336,24 +334,96 @@
                    line_length: 5
                });
                printer.printGoToNextMark();
                console.log('测试打印QR结束');
            },
            printerLabel2() {
                console.log('测试打印');
                const formatDate = (date = new Date()) =>
                  date.toISOString().split('T')[0];
                const formatDate =new Date().toISOString().split('T')[0];
                console.log(formatDate)
                CommonUtils.showTips({
                    message:'母标签\r\n'+'供应商名称:'+this.barCodeInfo['供应商']+'\r\n'+'物料代码:'+this.barCodeInfo['物料代码']+'\r\n'+'物料简称:'+this.barCodeInfo['物料简称']+'\r\n'
                    +'数量:'+this.barCodeInfo['剩余数量']+'\r\n'+'工号:'+this.barCodeInfo['工号']+'\r\n'+'生产日期:'+this.barCodeInfo['生产日期']+'\r\n'+'流水号:'+this.barCodeInfo['流水号']+'\r\n'
                    +'打印日期:'+formatDate()+'\r\n'+this.barCodeInfo['条码编号']+'\r\n'
                    +'打印日期:'+formatDate+'\r\n'+this.barCodeInfo['条码编号']+'\r\n'
                    +'子标签\r\n'+'供应商名称:'+this.barCodeInfo['供应商']+'\r\n'+'物料代码:'+this.barCodeInfo['物料代码']+'\r\n'+'物料简称:'+this.barCodeInfo['物料简称']+'\r\n'
                    +'数量:'+this.barCodeSplitInfo[0]['HSplitNum']+'\r\n'+'工号:'+this.barCodeInfo['工号']+'\r\n'+'生产日期:'+this.barCodeInfo['生产日期']+'\r\n'+'流水号:'+this.barCodeInfo['流水号']+'\r\n'
                    +'打印日期:'+formatDate()+'\r\n'+this.barCodeSplitInfo[0]['HBarCode']+'\r\n'
                    +'打印日期:'+formatDate+'\r\n'+this.barCodeSplitInfo[0]['HBarCode']+'\r\n'
                    
                    ,
                })
                printer.setLineSpacing({
                    spacing: 1.2
                });
                
                printer.setUnwindPaperLen({ length: 60 });
                printer.setFontSize({
                    fontSize: 1
                });
                //打印母标签
                printer.printText2({
                    offset: 1,
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '供应商名称:'+this.barCodeInfo['供应商']+'\r\n'
                });
                printer.printText2({
                    offset: 1,
                    fontSize:2,
                    isBold: false,
                    isUnderLine: false,
                    content: '物料代码:'+this.barCodeInfo['物料代码']+'\r\n'
                });
                printer.printText2({
                    offset: 1,
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '物料简称:'+this.barCodeInfo['物料简称']+'\r\n'
                });
                printer.printText2({
                    offset: 1,
                    fontSize:2,
                    isBold: false,
                    isUnderLine: false,
                    content: '数量:'+this.barCodeInfo['剩余数量']+'\r\n'
                });
                printer.printText2({
                    offset: 1,
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '工号:'+this.barCodeInfo['工号']+'\r\n'
                });
                printer.printText2({
                    offset: 1,
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '生产日期:'+this.barCodeInfo['生产日期']+'\r\n'
                });
                printer.printText2({
                    offset: 1,
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '流水号:'+this.barCodeInfo['流水号']+'\r\n'
                });
                printer.printText2({
                    offset: 1,
                    fontSize: 2,
                    isBold: false,
                    isUnderLine: false,
                    content: '打印日期:'+formatDate+'\r\n'
                });
                printer.printQR2({
                    text: this.barCodeInfo['条码编号'],
                    height: 120,
                    offset: 3
                });
                printer.printLine({
                    line_length: 5
                });
                printer.printGoToNextMark();
                console.log('测试打印QR结束');
            },
            doRequest(url, data, resFunction, errFunction, method) {
@@ -465,7 +535,7 @@
                        title: '拆分数量不得为空!'
                    });
                }
                if (parseFloat(this.barCodeInfoMeta.splitNum) > parseFloat(this.barCodeInfo['数量'])) {
                if (parseFloat(this.barCodeInfoMeta.splitNum) > parseFloat(this.barCodeInfo['条码剩余数量'])) {
                    return uni.showToast({
                        icon: 'none',
                        title: '拆分数量不能大于条码原数量!'
@@ -498,7 +568,7 @@
                            });
                            //更新原先条码数量
                            this.barCodeInfo['剩余数量'] = this.barCodeInfo['数量'] - this.barCodeInfoMeta.splitNum;
                            this.barCodeInfo['剩余数量'] = this.barCodeInfo['条码剩余数量'] - this.barCodeInfoMeta.splitNum;
                            // 拆码成功,禁用拆码按钮,放开生成按钮
                            this.cantSplit = true;
@@ -528,7 +598,7 @@
                    return acc + obj["HSplitNum"]
                }, 0)
                if (sum > this.barCodeInfo["HQty"]) {
                if (sum > this.barCodeInfo["条码剩余数量"]) {
                    return uni.showToast({
                        icon: 'none',
                        title: '拆码数量和不得大于条码数量'
@@ -580,52 +650,12 @@
                    });
                    return;
                }
                this.isPrinting = true;
                try {
                    let HBarCodeNoStr = `${this.barCodeSplitInfo[0]['HBarCode']}`;
                    console.log('获取数据', HBarCodeNoStr);
                    // 显示打印中状态
                    uni.showLoading({
                        title: '打印中...',
                        mask: true
                    });
                    // 获取打印数据
                    const printData = await new Promise((resolve, reject) => {
                        uni.request({
                            url: this.serverUrl + '/Sc_BarCode/GetSplitBarCode_SubList',
                            data: {
                                HBarCodeNo: HBarCodeNoStr
                            },
                            success: (res) => {
                                if (res.data.count == 1) {
                                    resolve(res.data.data[0]);
                                } else {
                                    reject(new Error(res.data.Message || '未找到打印数据'));
                                }
                            },
                            fail: (err) => {
                                reject(new Error('接口请求失败'));
                            }
                        });
                    });
                    const item = printData;
                    // 等待打印组件更新
                    await this.$nextTick();
                    // 打印成功后重置状态
                    uni.hideLoading();
                    this.printerLabel();//打印
                    this.isPrinting = false;
                } catch (error) {
                    console.error('打印失败:', error);
                    uni.hideLoading();
                    this.isPrinting = false;
                    uni.showToast({
@@ -677,10 +707,10 @@
                            duration: 2000
                        });
                        //成功后设置状态
                        //self.isPrinting = false;
                        self.isPrinting = false;
                        //this.resetButtonState();
                    } else if (e.key == 3) {
                        //self.isPrinting = false;
                        self.isPrinting = false;
                        uni.showToast({
                            title: '缺纸',
                            duration: 2000