qingyiay
2023-08-08 40a7d8db73f81ad10de03684dc9f6720e18cc315
称重异常修改
13个文件已修改
1个文件已添加
2558 ■■■■■ 已修改文件
api/globalApi.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/customer-page/customer-index/fayunPlanDetails/fayunPlanMore/fayunPlanMore.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue 203 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/loadUnload-page/loadUnload-page.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/login/PrivacyAgreementText/PrivacyAgreementText.vue 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/login/login.vue 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue 164 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/public-page/forward/forward.vue 1174 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/register/register.vue 809 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/globalApi.js
@@ -379,7 +379,7 @@
    /**
     * @description 装卸员查看所有煤种类型 */
    getCoalNameAll: {
        url: '/wrzs/tmtaskcoal/getCoalNameAll',
        url: '/wrzs/jccoalbunker/getCoalNameAll',
        method: 'GET'
    },
    /**
@@ -405,5 +405,11 @@
    tmAbnormalTextAdd: {
        url: '/wrzs/tmtaskcoal/tmAbnormalTextAdd',
        method: 'POST'
    }
    },
    /**
     * @description 获取appid和secret */
    getAppidAndSercet: {
        url: '/wrzs/wx/getAppidAndSercet',
        method: 'GET'
    },
}
manifest.json
@@ -50,7 +50,7 @@
    "quickapp": {},
    /* 小程序特有相关 */
    "mp-weixin": {
        "appid": "wx4a62fc1684c429a9",
        "appid": "wxa48d51c9d0e23458",
        "permission": {
            "scope.userFuzzyLocation": {
                "desc": "你的位置信息将用于小程序定位"
@@ -62,9 +62,7 @@
        "optimization": {
            "subPackages": true
        },
        "requiredPrivateInfos": [
            "getFuzzyLocation"
        ],
        "requiredPrivateInfos": ["getFuzzyLocation"],
        "setting": {
            "urlCheck": false,
            "es6": true,
@@ -86,4 +84,4 @@
        "enable": false
    },
    "vueVersion": "2"
}
}
pages.json
@@ -233,7 +233,16 @@
            }
        }
    ],
        ,{
            "path" : "pages/login/PrivacyAgreementText/PrivacyAgreementText",
            "style" :
            {
                "navigationBarTitleText": "",
                "enablePullDownRefresh": false
            }
        }
    ],
    "subPackages": [{
            "root": "pages/register",
            "pages": [{
pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue
@@ -123,7 +123,7 @@
                orderCode: null,
                orderPlanDetail: {},
                coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请',
                    '进入场院'
                    '进入场院', '异常审核中'
                ],
                yyDailyList: [],
                // 领取数量
pages/customer-page/customer-index/fayunPlanDetails/fayunPlanMore/fayunPlanMore.vue
@@ -102,7 +102,7 @@
                yyDailyList: {},
                orderPlanDetail: {},
                coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请',
                    '进入场院'
                    '进入场院', '异常审核中'
                ],
                index: ''
            };
pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue
@@ -330,7 +330,7 @@
                faYunDetailobj: {},
                modalShow: false,
                coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请',
                    '进入场院'
                    '进入场院', '异常审核中'
                ]
            };
        },
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
@@ -175,7 +175,7 @@
                    openName: ''
                },
                coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请',
                    '进入场院'
                    '进入场院', '异常审核中'
                ], // 状态
                weighHouseCode: '',
                // 放空弹窗控制变量
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
@@ -101,6 +101,47 @@
        </view>
        <view v-else
            style="width: 100%;height: 40rpx;"></view>
        <view class="history-utils">
            <view class="history-utils_item">
                平均皮重:{{avgSkin}}
            </view>
            <view class="history-utils_item btn">
                <u-button plain
                    type="primary"
                    :text="historyShow?'隐藏历史称重':'显示历史称重'"
                    @click="historyShow=!historyShow"></u-button>
            </view>
        </view>
        <Transition name="slide-fade">
            <view class="history-skin"
                v-show="historyShow">
                <view class="table-title">
                    <view class="table-title_item time">
                        称重时间
                    </view>
                    <view class="table-title_item coal-name">
                        煤种名称
                    </view>
                    <view class="table-title_item skin">
                        皮重重量
                    </view>
                </view>
                <view class="history-skin_item"
                    v-for="item in tmTaskCoalList">
                    <view class="item createTime">
                        {{item.createTime}}
                    </view>
                    <view class="item">
                        {{item.coalName}}
                    </view>
                    <view class="item skin">
                        <view class="">
                            {{item.skin}}
                        </view>
                    </view>
                </view>
            </view>
        </Transition>
        <view class="bottom-block">
            <view class="block-main">
                <view class="main-information"
@@ -175,8 +216,7 @@
                :disabled="realTimeWeigh == 0 || globalinfraredStatus || isweigh || !isInputOrigin"
                :loading="isConfirmWeighLoading"
                loadingText="确认"
                @click="confirmWeigh"
                v-if="!historyBtn"></u-button>
                @click="confirmWeigh"></u-button>
            <u-button type="primary"
                text="返回加减吨"
                :disabled="addAndSubtractCoalDisabled"
@@ -184,29 +224,6 @@
                class="jiajian"
                v-if="outBuy"></u-button>
        </view>
        <view style="width: 200rpx;margin: auto;position: relative;"
            v-if="historyBtn"><u-button type="primary"
                text="显示历史皮重"
                @click.stop="displayHistory"></u-button></view>
        <Transition name="slide-fade">
            <view class="history-skin"
                v-if="historyShow">
                <view class="history-skin_item"
                    v-for="item in tmTaskCoalList">
                    <view class="createTime">
                        日期:{{item.createTime.slice(0,10)}}
                    </view>
                    <view class="skin">
                        <view class="">
                            皮重:
                        </view>
                        <view class="">
                            {{item.skin}}
                        </view>
                    </view>
                </view>
            </view>
        </Transition>
        <!-- 放空弹窗 -->
        <view class="evacuationModal">
            <u-modal :show="evacuationModalShow"
@@ -263,6 +280,9 @@
                this.weighData.overTmWaixiao = 1
            }
            this.changeweighHouseCode(params.weighHouseCode);
            this.init();
            this.changeWeigh('')
            this.realTimeWeigh = 0
        },
        components: {
            combinedTitle
@@ -321,11 +341,13 @@
                outBuy: true,
                // 皮重异常相关
                abnormalContent: '',
                avgSkin: null, // 平均皮重
                avgSkin: '', // 平均皮重
                tmTaskCoalList: [],
                abnormalModalShow: false,
                historyBtn: false,
                historyShow: false
                historyShow: true,
                // 是否在称皮重,点击确定称重判断是否异常
                isSkinWeigh: false
            };
        },
        watch: {
@@ -341,9 +363,10 @@
                        .orderType ==
                        '转出') {
                        if (this.weighList.skin == 0) {
                            this.isSkinWeigh = true
                            this.temporaryWeighObj.skin = newV;
                            this.getAverageSkin(newV)
                        } else {
                            this.isSkinWeigh = false;
                            this.temporaryWeighObj.hair = newV;
                            this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed(
                                2);
@@ -354,10 +377,11 @@
                    } else if (this.weighList.orderType == '外购' || this.weighList.orderType == '内购' || this.weighList
                        .orderType == '转入') {
                        if (this.weighList.hair == 0) {
                            this.isSkinWeigh = false;
                            this.temporaryWeighObj.hair = newV;
                        } else {
                            this.isSkinWeigh = true;
                            this.temporaryWeighObj.skin = newV;
                            this.getAverageSkin(newV)
                            this.temporaryWeighObj.clean = (this.weighList.hair - this.temporaryWeighObj.skin).toFixed(
                                2);
                            this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this
@@ -367,14 +391,6 @@
                    }
                }
            }
        },
        onShow() {
            this.init();
            this.changeisLogin(true)
            this.realTimeWeigh = 0
        },
        onHide() {
        },
        computed: {
            ...mapState(['globalweigh', 'globalinfraredStatus']),
@@ -406,7 +422,7 @@
            }
        },
        methods: {
            ...mapMutations(['changeweighHouseCode', 'changeisLogin']),
            ...mapMutations(['changeweighHouseCode', 'changeisLogin', 'changeWeigh']),
            init() {
                uni.showLoading({
                    title: "加载中"
@@ -440,7 +456,9 @@
                        uni.hideLoading()
                        this.$u.toast('加载失败')
                    }
                });
                }).then(() => {
                    this.getAverageSkin()
                })
            },
            /**
             * @确认称重等待后端提供实时称重接口,获取皮重,毛重
@@ -449,16 +467,28 @@
                if (this.isConfirmWeighLoading == false) {
                    this.isConfirmWeighLoading = true;
                    if (this.weighData.weigh != 0) {
                        if (this.weighList.orderType == '外销') {
                            if (this.weighList.skin ? (this.weighList.skin < this.realTimeWeigh ? true : false) : true) {
                                this.saveWeigh();
                        if (this.isSkinWeigh) {
                            let xx = new BigNumber(this.avgSkin)
                            let yy = new BigNumber(this.globalweigh)
                            if (xx.minus(yy).toNumber() > 0.2) {
                                this.abnormalModalShow = true
                            } else {
                                this.$u.toast('毛重不能小于皮重');
                                this.isConfirmWeighLoading = false;
                                this.abnormalModalShow = false
                                this.saveWeigh();
                            }
                        } else {
                            this.saveWeigh();
                        }
                        // if (this.weighList.orderType == '外销') {
                        //     if (this.weighList.skin ? (this.weighList.skin < this.realTimeWeigh ? true : false) : true) {
                        //         this.saveWeigh();
                        //     } else {
                        //         this.$u.toast('毛重不能小于皮重');
                        //         this.isConfirmWeighLoading = false;
                        //     }
                        // } else {
                        //     this.saveWeigh();
                        // }
                    } else {
                        this.$u.toast('未能获取地磅重量');
                        this.isConfirmWeighLoading = false;
@@ -548,7 +578,7 @@
                    this.isInputOrigin = true;
                }
            },
            getAverageSkin(weigh) {
            getAverageSkin() {
                uni.showLoading({
                    title: "加载中"
                })
@@ -557,13 +587,13 @@
                        uni.hideLoading()
                        this.avgSkin = res.data.avgSkin
                        this.tmTaskCoalList = res.data.tmTaskCoalList
                        let xx = new BigNumber(this.avgSkin)
                        let yy = new BigNumber(weigh)
                        console.log(weigh, this.avgSkin, yy.minus(xx).toNumber());
                        if (xx.minus(yy).toNumber() <= 0.2) {
                            this.abnormalModalShow = true
                            this.historyBtn = true
                        }
                        // let xx = new BigNumber(this.avgSkin)
                        // let yy = new BigNumber(weigh)
                        // console.log(weigh, this.avgSkin, yy.minus(xx).toNumber());
                        // if (xx.minus(yy).toNumber() <= 0.2) {
                        //     this.abnormalModalShow = true
                        //     this.historyBtn = true
                        // }
                    } else {
                        uni.hideLoading()
                        this.$u.toast('加载失败')
@@ -572,6 +602,7 @@
            },
            abnormalCancel() {
                this.abnormalModalShow = false
                this.isConfirmWeighLoading = false;
            },
            // 提交异常原因
            abnormalConfirm() {
@@ -585,17 +616,21 @@
                            uni.hideLoading()
                            this.$u.toast('提交成功')
                            this.abnormalModalShow = false
                            this.isConfirmWeighLoading = false
                            setTimeout(() => {
                                uni.navigateBack({
                                    delta: 1
                                });
                            }, 1000);
                        } else {
                            uni.hideLoading()
                            this.$u.toast('提交失败')
                            this.abnormalModalShow = true
                            this.isConfirmWeighLoading = false
                        }
                    })
            },
            displayHistory() {
                this.historyShow = true
            }
        }
    };
</script>
@@ -617,6 +652,31 @@
        .slot-content {
            width: 96%;
            border: 1rpx solid rgb(220, 223, 230);
        }
        .table-title {
            width: 96%;
            @include flex;
            position: absolute;
            top: 8rpx;
            color: #9e9399;
            &_item {
                width: 33.3%;
                text-align: center;
            }
            .time {
                padding-left: 20rpx;
            }
            .coal-name {
                padding-left: 70rpx;
            }
            .skin {
                padding-left: 10rpx;
            }
        }
        .one {
@@ -817,7 +877,7 @@
        }
        .three {
            margin: 0 auto vww(20);
            margin: 0 auto vww(30);
            flex: 0.7;
            display: flex;
            color: #939393;
@@ -843,23 +903,43 @@
            transition: all 0.3s ease-out;
        }
        .history-utils {
            width: 96%;
            margin: vww(10) auto;
            @include flex;
            justify-content: space-around;
            &_item {
                width: 50%;
            }
            .btn {
                width: 180rpx;
            }
        }
        .history-skin {
            width: 96%;
            height: vww(300);
            margin: vww(50) auto;
            margin: auto;
            margin-top: vww(10);
            background: #ffffff;
            box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
            border-radius: 20rpx;
            overflow: scroll;
            color: #000;
            position: relative;
            .history-skin_item {
                width: 80%;
                width: 96%;
                height: vww(30);
                @include flex;
                margin: vww(10) auto;
                margin: vww(40) auto;
                .item {
                    width: 33.3%;
                    text-align: center;
                }
                .createTime {
                    color: rgb(60, 156, 255);
@@ -867,7 +947,6 @@
                .skin {
                    color: #f81414;
                    @include flex;
                    width: 180rpx;
                    height: vww(30);
                }
pages/loadUnload-page/loadUnload-page.vue
@@ -18,13 +18,13 @@
                        :key="index">
                        <view class="first-line">
                            <view class="dispatch-receive">
                                <view class="dispatch">煤种名称:{{ item.coalName }}</view>
                                <view class="dispatch">煤种名称:{{ item }}</view>
                            </view>
                            <view class="">
                                <u-button type="primary"
                                    plain
                                    text="选择"
                                    @click.stop="loadUnloadHandle(item.coalName)"></u-button>
                                    @click.stop="loadUnloadHandle(item)"></u-button>
                            </view>
                        </view>
                    </view>
pages/login/PrivacyAgreementText/PrivacyAgreementText.vue
New file
@@ -0,0 +1,117 @@
<template>
    <view class="main">
        <view class="title">
            隐私协议
        </view>
        <view class="illustrate">
            欢迎使用无人值守小程序。我们非常重视您的隐私,因此制定了以下隐私政策,以明确说明我
            们如何收集、使用和保护您的个人信息。请您在使用我们的应用程序前仔细阅读和理解以下
            隐私政策:
        </view>
        <view class="">
            <h2 class="section">1.个人信息的收集和使用</h2>
            <p class="section-detail">
                当您使用我们的应用程序时,我们需要收集您的一些个人信息,包括但不限于以下内容</p>
            <ul class="section-detail">
                <li style="color: rgb(84, 84, 84);font-weight: bold;">
                    1.1&nbsp;&nbsp;用户账户信息:用于用户注册、登录和个人信息管理,包括用户名、密码、和电话号码等。</li>
                <li>1.2&nbsp;&nbsp;用户的个人信息:包括但不限于用户的<text
                        style="color: rgb(84, 84, 84);font-weight: bold;">姓名、地址、出生日期、性别、身份证号码
                    </text>等,这些信息可以帮助我们更好地提供商品和服务</li>
                <li>1.3&nbsp;&nbsp;设备信息:我们需要访问您的设备信息,包括设备型号、操作系统版本、唯一设备
                    标识符等,以便我们更好地为您提供服务。</li>
                <li>1.4&nbsp;&nbsp;位置信息:我们需要获取您的位置信息,以便我们可以更好地为您提供服务</li>
                <li>1.5&nbsp;&nbsp;网络信息:我们需要收集一些与您的互联网连接有关的信息,<text
                        style="color: rgb(84, 84, 84);font-weight: bold;">包括但不限于您的IP
                        地址、浏览器类型、ISP等</text></li>
                <li>1.6&nbsp;&nbsp;相机和相册权限:我们需要访问您的相机和相册权限,以便您可以拍照、上传照片
                    等,以便我们更好地为您提供服务。</li>
            </ul>
        </view>
        <view class="">
            <h2 class="section">2.个人信息的使用和分享</h2>
            <p class="section-detail">
                2.1&nbsp;&nbsp;我们收集您的个人信息主要是为了向您提供更好的服务和优化您的使用体验。我们会严格保护您的个人信息,并不会将您的个人信息出售给第三方。我们可能会将您的个人信息分享给我们的关联公司或服务提供商,以便为您提供更好的服务。除非法律法规另有规定,否则我们不会将您的个人信息用于任何其他用途,也不会将您的个人信息透露给任何第三方。
            </p>
        </view>
        <view class="">
            <h2 class="section">3.个人信息的安全保护</h2>
            <view class="section-detail">
                <p>3.1&nbsp;&nbsp;我们会采取一定的安全措施来保护您的个人信息不被未经授权的访问、使用或泄露。我们将
                    使用技术措施和管理措施来确保您的个人信息的安全性。</p>
                <p>3.2&nbsp;&nbsp;我们会采取以下安全措施来保护您的个人信息:</p>
                <p>3.3&nbsp;&nbsp;我们会对您的个人信息进行加密处理,以保障信息的安全性</p>
                <p>3.4&nbsp;&nbsp;我们会定期检查我们的系统,以确保您的个人信息不会遭到未经授权的访问、使用或泄露。</p>
                <p>3.5&nbsp;&nbsp;我们会限制访问您个人信息的人员范围,并要求这些人员遵守保密义务</p>
                <p>我们会采用防火墙、反病毒软件和其他安全措施,以保护我们的系统和您的个人信息不受到
                    恶意攻击和病毒感染。</p>
                <p>3.6&nbsp;&nbsp;尽管我们已经采取了相应的安全措施来保护您的个人信息,但由于技术限制和风险,我们不能保证您的个人信息不会被未经授权的访问、使用或泄露。在发生此类事件时,我们将采取适当的措施来减少损失。
                </p>
            </view>
        </view>
        <view class="">
            <h2 class="section">4.年龄限制</h2>
            <p class="section-detail">
                4.1&nbsp;&nbsp;我们的应用程序只适用于年满18岁的用户。如果您未满18岁,请不要使用我们的应用程序。
                如果我们发现您是未满18岁的用户,我们将立即删除您的个人信息。
            </p>
        </view>
        <view class="">
            <h2 class="section">5.隐私政策的修改</h2>
            <p class="section-detail">
                5.1&nbsp;&nbsp;我们可能会根据需要更新或修改本隐私政策。如果我们对本隐私政策进行了重大更改,我们将在应用程序中发布通知或以其他方式通知您。在我们发布修改通知后,您继续使用我们的应用程序,即表示您同意接受修改后的隐私政策
            </p>
        </view>
        <view class="">
            <h2 class="section">6.联系我们</h2>
            <p class="section-detail">
                6.1&nbsp;&nbsp;如果您对本隐私政策有任何疑问或意见,请通过应用程序内的联系方式与我们联系。我们将尽快回复您并解决您的问题。
            </p>
        </view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
            }
        },
        methods: {
        }
    }
</script>
<style lang="scss"
    scoped>
    .main {
        margin: 18rpx;
        padding-bottom: 30rpx;
        letter-spacing: 4rpx;
        .title {
            width: 100%;
            text-align: center;
            margin: 0 auto;
            font-size: 56rpx;
            font-weight: bold;
            color: rgb(84, 84, 84);
        }
        .illustrate {
            margin-bottom: 20rpx;
        }
        .section {
            font-size: 40rpx;
            color: rgb(84, 84, 84);
            font-weight: bold;
        }
        .section-detail {
            color: rgb(83, 83, 83);
        }
    }
</style>
pages/login/login.vue
@@ -57,6 +57,21 @@
                @confirm="bindWxConfirm"
                @cancel="bindWxCancel"></u-modal>
        </view>
        <!-- 注册同意获取隐私信息 -->
        <view class="privacy">
            <u-modal :show="privacyShow"
                :title="privacyTitle"
                showCancelButton
                @confirm="privacyConfirm"
                @cancel="privacyCancel"
                confirmText="同意"
                cancelText="不同意">
                <view class="slot-content"
                    @click="PrivacyAgreementHandle">
                    <rich-text :nodes="PrivacyAgreement"></rich-text>
                </view>
            </u-modal>
        </view>
    </view>
</template>
@@ -73,7 +88,12 @@
                // 绑定微信模态框
                bindWxModelShow: false,
                bindWxModelTitle: '提示',
                bindWxContent: '如果已拥有系统账号,可以直接跳转绑定微信页面'
                bindWxContent: '如果已拥有系统账号,可以直接跳转绑定微信页面',
                appid: "",
                secret: "",
                privacyShow: false,
                privacyTitle: "注意",
                PrivacyAgreement: `<p>注册即代表您同意我们用户隐私协议</p><p  class='PrivacyAgreement'>点击查看用户隐私协议</p>`
            };
        },
        components: {
@@ -81,9 +101,16 @@
        },
        methods: {
            ...mapMutations(['setUserTabbar', 'changeisLogin']),
            getAppidAndSercet() {
                this.$reqGet('getAppidAndSercet').then(res => {
                    this.appid = res.data.appid;
                    this.secret = res.data.secret
                })
            },
            // 访问wx.login,获取code
            beforeLoginEvent() {
                this.loginPopupShow = true;
                this.getAppidAndSercet();
            },
            wxLogin() {
                // 获取登录用户code
@@ -108,7 +135,7 @@
                    title: '加载中...'
                });
                wx.request({
                    url: `https://api.weixin.qq.com/sns/jscode2session?appid=wx4a62fc1684c429a9&secret=ee90afe376cdcec2fdd947c0a4db961a&js_code=${code}&grant_type=authorization_code`,
                    url: `https://api.weixin.qq.com/sns/jscode2session?appid=${this.appid}&secret=${this.secret}&js_code=${code}&grant_type=authorization_code`,
                    success(res) {
                        uni.setStorageSync('openid', res.data.openid);
                        // uni.showToast({
@@ -161,12 +188,23 @@
            openPopup() {
                console.log('打开了');
            },
            registerClick() {
            privacyConfirm() {
                uni.navigateTo({
                    url: '/pages/register/register'
                });
            },
            // 此方法只进行绑定测试,后期通过扫码解决
            privacyCancel() {
                this.privacyShow = false
            },
            registerClick() {
                this.privacyShow = true
            },
            PrivacyAgreementHandle() {
                uni.navigateTo({
                    url: '/pages/login/PrivacyAgreementText/PrivacyAgreementText'
                })
            },
            // 此方法只进行绑定测试,后期已通过扫码解决
            jumpBindBack() {
                uni.navigateTo({
                    url: '/pages/bindBackground/bindBackground'
@@ -179,6 +217,10 @@
<style lang="scss">
    @import 'index.scss';
    .PrivacyAgreement {
        color: rgb(60, 156, 255)
    }
    .login {
        // height: 100vh;
        // display: flex;
pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
@@ -57,7 +57,8 @@
                    </view>
                </view>
            </view>
            <view class="origin-info" v-if="faYunDetailobj.orderType == '外购' || faYunDetailobj.orderType == '内购' || faYunDetailobj.orderType == '转出'">
            <view class="origin-info"
                v-if="faYunDetailobj.orderType == '外购' || faYunDetailobj.orderType == '内购' || faYunDetailobj.orderType == '转出'">
                <combined-title title="原发信息"></combined-title>
                <view class="body-container">
                    <view class="container-block">
@@ -83,92 +84,103 @@
</template>
<script>
import combinedTitle from '@/components/combined-title/combined-title.vue';
export default {
    components: {
        combinedTitle
    },
    data() {
        return {
            id: '',
            faYunDetailobj: {},
            coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请', '进入场院']
        };
    },
    methods: {},
    onLoad(params) {
        this.id = params.id;
    },
    onShow() {
        this.$reqGet('getTakeCoal', { takeCoalId: this.id }).then(res => {
            if (res.code == 0) {
                this.faYunDetailobj = res.data;
            } else {
                this.$u.toast('获取数据失败');
            }
        });
    }
};
    import combinedTitle from '@/components/combined-title/combined-title.vue';
    export default {
        components: {
            combinedTitle
        },
        data() {
            return {
                id: '',
                faYunDetailobj: {},
                coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请',
                    '进入场院', '异常审核中'
                ]
            };
        },
        methods: {},
        onLoad(params) {
            this.id = params.id;
        },
        onShow() {
            this.$reqGet('getTakeCoal', { takeCoalId: this.id }).then(res => {
                if (res.code == 0) {
                    this.faYunDetailobj = res.data;
                } else {
                    this.$u.toast('获取数据失败');
                }
            });
        }
    };
</script>
<style scoped lang="scss">
@mixin flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.main {
    width: 100%;
    margin-top: vww(10);
    @include flex;
    flex-direction: column;
    .main-body {
        width: 690rpx;
        height: 1062rpx;
        background: #ffffff;
        box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
        border-radius: 20rpx;
<style scoped
    lang="scss">
    @mixin flex {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .main {
        width: 100%;
        margin-top: vww(10);
        @include flex;
        flex-direction: column;
        align-items: flex-start;
        .body-container {
            width: 100%;
            height: vww(56);
            border-bottom: vww(1) solid #d6d6d6;
        .main-body {
            width: 690rpx;
            height: 1062rpx;
            background: #ffffff;
            box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
            border-radius: 20rpx;
            @include flex;
            justify-content: center;
            .container-block {
                width: 96%;
            flex-direction: column;
            align-items: flex-start;
            .body-container {
                width: 100%;
                height: vww(56);
                border-bottom: vww(1) solid #d6d6d6;
                @include flex;
                justify-content: center;
                .container-block {
                    width: 96%;
                    height: vww(56);
                    @include flex;
                }
            }
            .last {
                border-bottom: none;
            }
        }
        .last {
            border-bottom: none;
        }
    }
    .origin-info {
        width: 690rpx;
        min-height: 300rpx;
        margin-top: 20rpx;
        margin-bottom: 20rpx;
        background: #ffffff;
        box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
        border-radius: 20rpx;
        @include flex;
        flex-direction: column;
        align-items: flex-start;
        .body-container {
            width: 100%;
            height: vww(56);
            border-bottom: vww(1) solid #d6d6d6;
        .origin-info {
            width: 690rpx;
            min-height: 300rpx;
            margin-top: 20rpx;
            margin-bottom: 20rpx;
            background: #ffffff;
            box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
            border-radius: 20rpx;
            @include flex;
            justify-content: center;
            .container-block {
                width: 94%;
            flex-direction: column;
            align-items: flex-start;
            .body-container {
                width: 100%;
                height: vww(56);
                border-bottom: vww(1) solid #d6d6d6;
                @include flex;
                justify-content: center;
                .container-block {
                    width: 94%;
                    @include flex;
                }
            }
        }
    }
}
</style>
</style>
pages/public-page/forward/forward.vue
@@ -3,49 +3,67 @@
    <view class="forward">
        <view class="forward-banner">
            <view class="banner-block">
                <view class="arrow-left" @click="back"><u-icon name="arrow-left" size="40" color="#ffffff"></u-icon></view>
                <view class="arrow-left"
                    @click="back"><u-icon name="arrow-left"
                        size="40"
                        color="#ffffff"></u-icon></view>
                <view class="forward-text">转发</view>
            </view>
        </view>
        <view v-if="roleType == 1" class="notice-bar">
            <u-notice-bar :text="text" :fontSize="30"></u-notice-bar>
            <view
                class="notice-icon"
                style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/notice.png') no-repeat;background-size: cover; width: 42rpx;height: 42rpx;"
            ></view>
        <view v-if="roleType == 1"
            class="notice-bar">
            <u-notice-bar :text="text"
                :fontSize="30"></u-notice-bar>
            <view class="notice-icon"
                style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/notice.png') no-repeat;background-size: cover; width: 42rpx;height: 42rpx;">
            </view>
        </view>
        <view v-else-if="roleType == 2" class="notice-bar"><u-notice-bar :text="text1" :fontSize="30"></u-notice-bar></view>
        <view v-else-if="roleType == 2"
            class="notice-bar"><u-notice-bar :text="text1"
                :fontSize="30"></u-notice-bar></view>
        <view class="card-main">
            <view class="card-block">
                <u-swipe-action>
                    <u-swipe-action-item :options="options1" v-for="(val, index) in jhOrderPlanForwardList" :key="val.vid" :name="val.vid" @click="deleteGroup(index, val)">
                    <u-swipe-action-item :options="options1"
                        v-for="(val, index) in jhOrderPlanForwardList"
                        :key="val.vid"
                        :name="val.vid"
                        @click="deleteGroup(index, val)">
                        <view class="forward-card">
                            <view class="card-content">
                                <u--form labelPosition="left" :model="forwardForm" ref="form1">
                                    <u-form-item label="转发对象" labelWidth="21%" ref="item1" @click="forwardObjectClick(index)">
                                        <u--input v-model="val.name" placeholder="点击选择转发对象" :readonly="true" border="bottom"></u--input>
                                <u--form labelPosition="left"
                                    :model="forwardForm"
                                    ref="form1">
                                    <u-form-item label="转发对象"
                                        labelWidth="21%"
                                        ref="item1"
                                        @click="forwardObjectClick(index)">
                                        <u--input v-model="val.name"
                                            placeholder="点击选择转发对象"
                                            :readonly="true"
                                            border="bottom"></u--input>
                                    </u-form-item>
                                    <u-form-item label="输入数量" ref="item2" labelWidth="21%">
                                    <u-form-item label="输入数量"
                                        ref="item2"
                                        labelWidth="21%">
                                        <view class="forward-card-amount">
                                            <view class="forward-card-amount-input">
                                                <u--input
                                                    v-model="val.carNum"
                                                <u--input v-model="val.carNum"
                                                    placeholder="请输入转发数量"
                                                    @input="debouncecarNumInput(index, val.carNum)"
                                                    @blur="blurInput(index, val.carNum)"
                                                    border="bottom"
                                                ></u--input>
                                                    border="bottom"></u--input>
                                            </view>
                                            <u-checkbox-group v-model="val.checkboxValue1" placement="column" @change="v => checkboxChange(v, index, val)">
                                                <u-checkbox
                                                    size="30"
                                            <u-checkbox-group v-model="val.checkboxValue1"
                                                placement="column"
                                                @change="v => checkboxChange(v, index, val)">
                                                <u-checkbox size="30"
                                                    shape="circle"
                                                    labelSize="30"
                                                    label="全部转发"
                                                    name="全部转发"
                                                    :disabled="val.ischecked"
                                                    :checked="val.isSelected"
                                                ></u-checkbox>
                                                    :checked="val.isSelected"></u-checkbox>
                                            </u-checkbox-group>
                                        </view>
                                    </u-form-item>
@@ -59,31 +77,56 @@
        <view class="utils-buttonGroup">
            <!-- 添加按钮 -->
            <view class="AdddBtn"><u-button text="添加" :hairline="false" @click.stop="addForm" :disabled="whetherClick"></u-button></view>
            <view class="AdddBtn"><u-button text="添加"
                    :hairline="false"
                    @click.stop="addForm"
                    :disabled="whetherClick"></u-button></view>
            <!-- 提交按钮 -->
            <view class="forwardBtn"><u-button text="提交" :hairline="false" type="warning" @click.stop="submitForm" :disabled="whetherClick1"></u-button></view>
            <view class="forwardBtn"><u-button text="提交"
                    :hairline="false"
                    type="warning"
                    @click.stop="submitForm"
                    :disabled="whetherClick1"></u-button></view>
        </view>
        <!-- 增加按钮 -->
        <!-- 选择货代或车队弹出框 -->
        <view class="selectHuoDaiOrFleet-container">
            <u-popup :show="selectPopupShow" mode="bottom" @close="selectPopupClose" @open="selectPopupOpen">
            <u-popup :show="selectPopupShow"
                mode="bottom"
                @close="selectPopupClose"
                @open="selectPopupOpen">
                <view class="selectHuoDaiOrFleet-container-box">
                    <u-tabs :list="list1" @click="tabClick"></u-tabs>
                    <view class="" v-if="!tabHuoDai">
                    <u-tabs :list="list1"
                        @click="tabClick"></u-tabs>
                    <view class=""
                        v-if="!tabHuoDai">
                        <u-cell-group>
                            <u-cell v-for="(item, index) in fleetData" :key="index" :title="item.name">
                                <view class="cell-util" slot="value">
                                    <u-button @click="forwardFleetObjectSelect(item, index)" text="选择" type="primary" size="mini"></u-button>
                            <u-cell v-for="(item, index) in fleetData"
                                :key="index"
                                :title="item.name">
                                <view class="cell-util"
                                    slot="value">
                                    <u-button @click="forwardFleetObjectSelect(item, index)"
                                        text="选择"
                                        type="primary"
                                        size="mini"></u-button>
                                </view>
                            </u-cell>
                        </u-cell-group>
                    </view>
                    <view class="" v-else-if="tabHuoDai">
                    <view class=""
                        v-else-if="tabHuoDai">
                        <u-cell-group>
                            <u-cell v-for="(item, index) in huoDaiData" :key="index" :title="item.name">
                                <view class="cell-util" slot="value">
                                    <u-button @click="forwardHuoDaiObjectSelect(item, index)" text="选择" type="primary" size="mini"></u-button>
                            <u-cell v-for="(item, index) in huoDaiData"
                                :key="index"
                                :title="item.name">
                                <view class="cell-util"
                                    slot="value">
                                    <u-button @click="forwardHuoDaiObjectSelect(item, index)"
                                        text="选择"
                                        type="primary"
                                        size="mini"></u-button>
                                </view>
                            </u-cell>
                        </u-cell-group>
@@ -95,69 +138,68 @@
</template>
<script>
import { customerId } from '@/utils/status';
import toast from '../../../uni_modules/uview-ui/libs/config/props/toast';
    import { customerId } from '@/utils/status';
    import toast from '../../../uni_modules/uview-ui/libs/config/props/toast';
export default {
    onLoad(params) {
        console.log(params, '转发页面的参数');
        // 客户
        this.cars2 = Number(params.cars2);
        this.tempcarNumSurplus1 = this.carNumSurplus1 = Number(params.carNumSurplus1);
        // 货代
        this.carNum = Number(params.carNum);
        this.carNumSurplusHuodai = this.forwardSurplus = Number(params.carNumSurplusHuodai);
        this.orderPlanId = params.orderPlanId;
        this.$reqGet('forwardList', { OrderPlanId: params.orderPlanId }).then(res => {
            if (res.data.length !== 0 && this.roleType == 1) {
                this.jhOrderPlanForwardList = res.data.map((item, index) => {
                    return {
                        id: item.id,
                        orderPlanId: item.orderPlanId,
                        name: item.xsUserName === null ? item.fleetName : item.xsUserName,
                        carNum: item.carNum,
                        xsUserId: item.xsUserId === null ? 0 : item.xsUserId,
                        fleetId: item.fleetId === null ? 0 : item.fleetId,
                        checkboxValue1: '',
                        vid: `${new Date().getTime()}${index}${item.id}`
                    };
                });
            } else if (res.data.length !== 0 && this.roleType == 2) {
                this.jhOrderPlanForwardList = res.data.map((item, index) => {
                    return {
                        id: item.id,
                        orderPlanId: item.orderPlanId,
                        name: item.fleetName,
                        carNum: item.carNum,
                        xsUserId: item.xsUserId === null ? 0 : item.xsUserId,
                        fleetId: item.fleetId === null ? 0 : item.fleetId,
                        checkboxValue1: '',
                        vid: `${new Date().getTime()}${index}${item.id}`
                    };
                });
            } else {
                this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map((item, index) => {
                    if (!item.orderPlanId) {
    export default {
        onLoad(params) {
            console.log(params, '转发页面的参数');
            // 客户
            this.cars2 = Number(params.cars2);
            this.tempcarNumSurplus1 = this.carNumSurplus1 = Number(params.carNumSurplus1);
            // 货代
            this.carNum = Number(params.carNum);
            this.carNumSurplusHuodai = this.forwardSurplus = Number(params.carNumSurplusHuodai);
            this.orderPlanId = params.orderPlanId;
            this.$reqGet('forwardList', { OrderPlanId: params.orderPlanId }).then(res => {
                if (res.data.length !== 0 && this.roleType == 1) {
                    this.jhOrderPlanForwardList = res.data.map((item, index) => {
                        return {
                            ...item,
                            orderPlanId: params.orderPlanId,
                            id: item.id,
                            orderPlanId: item.orderPlanId,
                            name: item.xsUserName === '' ? item.fleetName : item.xsUserName,
                            carNum: item.carNum,
                            xsUserId: item.xsUserId === '' ? 0 : item.xsUserId,
                            fleetId: item.fleetId === '' ? 0 : item.fleetId,
                            checkboxValue1: '',
                            vid: `${new Date().getTime()}${index}${item.id}`
                        };
                    }
                });
            }
        });
    },
    data() {
        return {
            forwardSurplus: 0,
            paramsName: {},
            huoDaiData: [],
            fleetData: [],
            // 日计划id
            orderPlanId: '',
            jhOrderPlanForwardList: [
                {
                    });
                } else if (res.data.length !== 0 && this.roleType == 2) {
                    this.jhOrderPlanForwardList = res.data.map((item, index) => {
                        return {
                            id: item.id,
                            orderPlanId: item.orderPlanId,
                            name: item.fleetName,
                            carNum: item.carNum,
                            xsUserId: item.xsUserId === '' ? 0 : item.xsUserId,
                            fleetId: item.fleetId === '' ? 0 : item.fleetId,
                            checkboxValue1: '',
                            vid: `${new Date().getTime()}${index}${item.id}`
                        };
                    });
                } else {
                    this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map((item, index) => {
                        if (!item.orderPlanId) {
                            return {
                                ...item,
                                orderPlanId: params.orderPlanId,
                                vid: `${new Date().getTime()}${index}${item.id}`
                            };
                        }
                    });
                }
            });
        },
        data() {
            return {
                forwardSurplus: 0,
                paramsName: {},
                huoDaiData: [],
                fleetData: [],
                // 日计划id
                orderPlanId: '',
                jhOrderPlanForwardList: [{
                    orderPlanId: '',
                    name: '',
                    carNum: null,
@@ -165,447 +207,468 @@
                    fleetId: 0,
                    checkboxValue1: '',
                    isSelected: false
                }
            ],
            // 索引,利用索引正确显示
            index: '',
            checkboxValue1: '',
            selectPopupShow: false,
            list1: [{ name: '车队' }, { name: '货代' }],
            tabHuoDai: false,
            carNumSurplus1: '',
            tempcarNumSurplus1: '',
            cars2: '',
            carNum: '',
            carNumSurplusHuodai: '',
            formNum: 1,
            // 个人转发数据
            personalForward: {},
            whetherClick: false,
            whetherClick1: false,
            // 滑动单元格配置
            options1: [
                {
                }],
                // 索引,利用索引正确显示
                index: '',
                checkboxValue1: '',
                selectPopupShow: false,
                list1: [{ name: '车队' }, { name: '货代' }],
                tabHuoDai: false,
                carNumSurplus1: '',
                tempcarNumSurplus1: '',
                cars2: '',
                carNum: '',
                carNumSurplusHuodai: '',
                formNum: 1,
                // 个人转发数据
                personalForward: {},
                whetherClick: false,
                whetherClick1: false,
                // 滑动单元格配置
                options1: [{
                    text: '删除',
                    style: {
                        backgroundColor: '#FB0101'
                    }
                }
            ]
        };
    },
    onShow() {
        this.init();
        if (this.roleType == 2) {
            this.list1.splice(1, 1);
            this.tabHuoDai = false;
        }
    },
    computed: {
        roleType() {
            return uni.getStorageSync('roleType');
                }]
            };
        },
        text() {
            return `已领取${this.cars2}张提煤单,剩余${this.carNumSurplus1}张提煤单`;
        },
        text1() {
            return `已拥有${this.carNum}张提煤单,剩余${this.carNumSurplusHuodai}张提煤单`;
        }
    },
    methods: {
        // 返回上一页
        back() {
            uni.navigateBack({
                delta: 1
            });
        },
        init() {
            switch (this.roleType) {
                case 1:
                    this.getAllHuoDaiByCustomerId();
                    this.getFleet();
                    break;
                case 2:
                    this.getFleet();
                    break;
                default:
                    break;
            }
        },
        allrelay(x, y) {
            let a = 0;
            if (y != 0) {
                a = Number(x) + Number(y);
                return a;
            } else {
                return Number(x);
            }
        },
        allrelayto(x, y) {
            let a = 0;
            if (y != 0) {
                a = Number(x) - Number(y);
                return a;
            } else {
                return Number(x);
            }
        },
        checkboxChange(value, index, v) {
            this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map(v => {
                return {
                    ...v,
                    ischecked: false
                };
            });
            if (value.length != 0) {
                if (this.roleType == 1) {
                    this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.carNumSurplus1, this.jhOrderPlanForwardList[index].carNum);
                    this.calculate(this.jhOrderPlanForwardList);
                }
                if (this.roleType == 2) {
                    this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.carNumSurplusHuodai, this.jhOrderPlanForwardList[index].carNum);
                    this.calculate(this.jhOrderPlanForwardList);
                }
                // 选择一个后其余禁止复选
                this.jhOrderPlanForwardList.forEach((v, i) => {
                    if (i !== index) {
                        v.ischecked = true;
                    }
                });
                this.whetherClick = true;
            } else {
                this.jhOrderPlanForwardList[index].carNum = null;
                this.calculate(this.jhOrderPlanForwardList);
            }
        },
        // 获取货代列表
        getAllHuoDaiByCustomerId() {
            this.$reqGet('getAllHuoDaiByCustomerId').then(res => {
                this.huoDaiData = res.data;
            });
        },
        // 获取车队列表
        getFleet() {
            this.$reqGet('getFleet').then(res => {
                this.fleetData = res.data;
            });
        },
        // 转发
        forwardObjectClick(index) {
            this.selectPopupShow = true;
            this.index = index;
        },
        selectPopupClose() {
            this.selectPopupShow = false;
        },
        selectPopupOpen() {},
        // 转发选择货代
        forwardHuoDaiObjectSelect(item, index) {
            this.$nextTick(() => {
                let isableAdd = this.jhOrderPlanForwardList.filter(v => item.name === v.name);
                if (isableAdd.length > 0) {
                    this.$u.toast('存在重复添加');
                    this.selectPopupShow = true;
                } else {
                    this.selectPopupShow = false;
                    this.jhOrderPlanForwardList[this.index].xsUserId = item.userId;
                    this.jhOrderPlanForwardList[this.index].name = item.name;
                    this.jhOrderPlanForwardList[this.index].fleetId = 0;
                }
            });
        },
        // 转发选择车队
        forwardFleetObjectSelect(item, index) {
            this.$nextTick(() => {
                let isableAdd = this.jhOrderPlanForwardList.filter(v => item.name === v.name);
                if (isableAdd.length > 0) {
                    this.$u.toast('存在重复添加');
                    this.selectPopupShow = true;
                } else {
                    this.selectPopupShow = false;
                    this.jhOrderPlanForwardList[this.index].fleetId = item.id;
                    this.jhOrderPlanForwardList[this.index].name = item.name;
                    this.jhOrderPlanForwardList[this.index].xsUserId = 0;
                }
            });
        },
        // 计算提煤单数量,添加或删除时调用
        calculate(arr) {
            let total = arr.reduce((prev, cur) => {
                return cur.carNum + prev;
            }, 0);
            console.log(total, '提煤单一共的数据');
            if (this.roleType == 1) {
                if (Number(this.cars2) >= total) {
                    this.carNumSurplus1 = Number(this.cars2) - total;
                    this.whetherClick = false;
                    this.whetherClick1 = false;
                } else {
                    this.carNumSurplus1 = 0;
                    this.$u.toast('剩余提煤单数量不足');
                    this.whetherClick = true;
                    this.whetherClick1 = true;
                }
            }
        onShow() {
            this.init();
            if (this.roleType == 2) {
                if (Number(this.carNum) >= total) {
                    this.carNumSurplusHuodai = Number(this.carNum) - total;
                    this.whetherClick = false;
                    this.whetherClick1 = false;
                } else {
                    this.carNumSurplusHuodai = 0;
                    this.$u.toast('剩余提煤单数量不足');
                    this.whetherClick = true;
                    this.whetherClick1 = true;
                }
            }
        },
        debouncecarNumInput(index, value) {
            let time;
            let that = this;
            that.$set(that.jhOrderPlanForwardList[index], 'carNum', Number(value));
            return (function() {
                if (!time) {
                    time = setTimeout(() => {
                        that.calculate(that.jhOrderPlanForwardList);
                        if (that.roleType == 1) {
                            if (that.jhOrderPlanForwardList[index].carNum < Number(that.carNumSurplus1)) {
                                that.$set(that.jhOrderPlanForwardList[index], 'checkboxValue1', '');
                                that.jhOrderPlanForwardList.forEach((v, i) => {
                                    if (index != i) {
                                        v.ischecked = false;
                                    }
                                });
                            }
                        }
                        if (that.roleType == 2) {
                            if (that.jhOrderPlanForwardList[index].carNum < Number(that.carNumSurplusHuodai)) {
                                that.$set(that.jhOrderPlanForwardList[index], 'checkboxValue1', '');
                                that.jhOrderPlanForwardList.forEach((v, i) => {
                                    if (index != i) {
                                        v.ischecked = false;
                                    }
                                });
                            }
                        }
                        time = null;
                    }, 800);
                }
            })();
        },
        blurInput(index, value) {
            this.$set(this.jhOrderPlanForwardList[index], 'carNum', Number(value));
            this.calculate(this.jhOrderPlanForwardList);
        },
        // 添加一组表单
        addForm() {
            // 判断是否有一个复选,如果有则禁止新加的复选,没有则不禁止
            let ischeck = this.jhOrderPlanForwardList.some(v => v.ischecked == true);
            if (!ischeck) {
                this.jhOrderPlanForwardList.push({
                    orderPlanId: this.orderPlanId,
                    name: '',
                    carNum: null,
                    xsUserId: 0,
                    fleetId: 0,
                    checkboxValue1: '',
                    ischecked: false,
                    vid: new Date().getTime(),
                    isSelected: false
                });
            } else {
                this.jhOrderPlanForwardList.push({
                    orderPlanId: this.orderPlanId,
                    name: '',
                    carNum: null,
                    xsUserId: 0,
                    fleetId: 0,
                    checkboxValue1: '',
                    ischecked: true,
                    vid: new Date().getTime(),
                    isSelected: false
                });
            }
            this.calculate(this.jhOrderPlanForwardList);
        },
        // 删除一组表单
        deleteGroup(index, v) {
            let tempcarNum = v.carNum;
            if (v.id) {
                this.$reqPost('deleteForward', { id: v.id }, 'params').then(res => {
                    if (res.code === 0) {
                        this.jhOrderPlanForwardList.splice(index, 1);
                        this.calculate(this.jhOrderPlanForwardList);
                        this.$u.toast('删除成功');
                    } else if (res.code === 1) {
                        this.$u.toast(res.msg);
                    }
                });
            } else {
                this.jhOrderPlanForwardList.splice(index, 1);
                this.calculate(this.jhOrderPlanForwardList);
                this.$u.toast('删除成功');
            }
        },
        // 提交
        submitForm() {
            let isPass = false;
            if (this.jhOrderPlanForwardList.length === 0) {
                this.$u.toast('请至少选择一组转发对象');
            }
            let reg = /^[1-9]\d*$/;
            this.jhOrderPlanForwardList.forEach(v => {
                if (!reg.test(v.carNum) || Number(v.carNum) <= 0) {
                    this.$u.toast('请输入合法数字');
                    isPass = false;
                    return isPass;
                } else {
                    isPass = true;
                    return isPass;
                }
            });
            if (isPass) {
                this.$reqPost('forward', this.jhOrderPlanForwardList, 'json').then(res => {
                    console.log(res, 'zh');
                    if (res.code == 0) {
                        this.$u.toast('提交成功');
                        setTimeout(() => {
                            uni.navigateBack({ delta: 1 });
                        }, 1000);
                    } else {
                        this.$u.toast(res.msg);
                    }
                });
            }
        },
        tabClick(item) {
            if (item.name == '货代') {
                this.tabHuoDai = true;
            } else {
                this.list1.splice(1, 1);
                this.tabHuoDai = false;
            }
        },
        computed: {
            roleType() {
                return uni.getStorageSync('roleType');
            },
            text() {
                return `已领取${this.cars2}张提煤单,剩余${this.carNumSurplus1}张提煤单`;
            },
            text1() {
                return `已拥有${this.carNum}张提煤单,剩余${this.carNumSurplusHuodai}张提煤单`;
            }
        },
        methods: {
            // 返回上一页
            back() {
                uni.navigateBack({
                    delta: 1
                });
            },
            init() {
                switch (this.roleType) {
                    case 1:
                        this.getAllHuoDaiByCustomerId();
                        this.getFleet();
                        break;
                    case 2:
                        this.getFleet();
                        break;
                    default:
                        break;
                }
            },
            allrelay(x, y) {
                let a = 0;
                if (y != 0) {
                    a = Number(x) + Number(y);
                    return a;
                } else {
                    return Number(x);
                }
            },
            allrelayto(x, y) {
                let a = 0;
                if (y != 0) {
                    a = Number(x) - Number(y);
                    return a;
                } else {
                    return Number(x);
                }
            },
            checkboxChange(value, index, v) {
                this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map(v => {
                    return {
                        ...v,
                        ischecked: false
                    };
                });
                if (value.length != 0) {
                    if (this.roleType == 1) {
                        this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.carNumSurplus1, this
                            .jhOrderPlanForwardList[index].carNum);
                        this.calculate(this.jhOrderPlanForwardList);
                    }
                    if (this.roleType == 2) {
                        this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.carNumSurplusHuodai, this
                            .jhOrderPlanForwardList[index].carNum);
                        this.calculate(this.jhOrderPlanForwardList);
                    }
                    // 选择一个后其余禁止复选
                    this.jhOrderPlanForwardList.forEach((v, i) => {
                        if (i !== index) {
                            v.ischecked = true;
                        }
                    });
                    this.whetherClick = true;
                } else {
                    this.jhOrderPlanForwardList[index].carNum = null;
                    this.calculate(this.jhOrderPlanForwardList);
                }
            },
            // 获取货代列表
            getAllHuoDaiByCustomerId() {
                this.$reqGet('getAllHuoDaiByCustomerId').then(res => {
                    this.huoDaiData = res.data;
                });
            },
            // 获取车队列表
            getFleet() {
                this.$reqGet('getFleet').then(res => {
                    this.fleetData = res.data;
                });
            },
            // 转发
            forwardObjectClick(index) {
                this.selectPopupShow = true;
                this.index = index;
            },
            selectPopupClose() {
                this.selectPopupShow = false;
            },
            selectPopupOpen() {},
            // 转发选择货代
            forwardHuoDaiObjectSelect(item, index) {
                this.$nextTick(() => {
                    let isableAdd = this.jhOrderPlanForwardList.filter(v => item.name === v.name);
                    if (isableAdd.length > 0) {
                        this.$u.toast('存在重复添加');
                        this.selectPopupShow = true;
                    } else {
                        this.selectPopupShow = false;
                        this.jhOrderPlanForwardList[this.index].xsUserId = item.userId;
                        this.jhOrderPlanForwardList[this.index].name = item.name;
                        this.jhOrderPlanForwardList[this.index].fleetId = 0;
                    }
                });
            },
            // 转发选择车队
            forwardFleetObjectSelect(item, index) {
                this.$nextTick(() => {
                    let isableAdd = this.jhOrderPlanForwardList.filter(v => item.name === v.name);
                    if (isableAdd.length > 0) {
                        this.$u.toast('存在重复添加');
                        this.selectPopupShow = true;
                    } else {
                        this.selectPopupShow = false;
                        this.jhOrderPlanForwardList[this.index].fleetId = item.id;
                        this.jhOrderPlanForwardList[this.index].name = item.name;
                        this.jhOrderPlanForwardList[this.index].xsUserId = 0;
                    }
                });
            },
            // 计算提煤单数量,添加或删除时调用
            calculate(arr) {
                let total = arr.reduce((prev, cur) => {
                    return cur.carNum + prev;
                }, 0);
                console.log(total, '提煤单一共的数据');
                if (this.roleType == 1) {
                    if (Number(this.cars2) >= total) {
                        this.carNumSurplus1 = Number(this.cars2) - total;
                        this.whetherClick = false;
                        this.whetherClick1 = false;
                    } else {
                        this.carNumSurplus1 = 0;
                        this.$u.toast('剩余提煤单数量不足');
                        this.whetherClick = true;
                        this.whetherClick1 = true;
                    }
                }
                if (this.roleType == 2) {
                    if (Number(this.carNum) >= total) {
                        this.carNumSurplusHuodai = Number(this.carNum) - total;
                        this.whetherClick = false;
                        this.whetherClick1 = false;
                    } else {
                        this.carNumSurplusHuodai = 0;
                        this.$u.toast('剩余提煤单数量不足');
                        this.whetherClick = true;
                        this.whetherClick1 = true;
                    }
                }
            },
            debouncecarNumInput(index, value) {
                let time;
                let that = this;
                that.$set(that.jhOrderPlanForwardList[index], 'carNum', Number(value));
                return (function() {
                    if (!time) {
                        time = setTimeout(() => {
                            that.calculate(that.jhOrderPlanForwardList);
                            if (that.roleType == 1) {
                                if (that.jhOrderPlanForwardList[index].carNum < Number(that
                                    .carNumSurplus1)) {
                                    that.$set(that.jhOrderPlanForwardList[index], 'checkboxValue1', '');
                                    that.jhOrderPlanForwardList.forEach((v, i) => {
                                        if (index != i) {
                                            v.ischecked = false;
                                        }
                                    });
                                }
                            }
                            if (that.roleType == 2) {
                                if (that.jhOrderPlanForwardList[index].carNum < Number(that
                                        .carNumSurplusHuodai)) {
                                    that.$set(that.jhOrderPlanForwardList[index], 'checkboxValue1', '');
                                    that.jhOrderPlanForwardList.forEach((v, i) => {
                                        if (index != i) {
                                            v.ischecked = false;
                                        }
                                    });
                                }
                            }
                            time = null;
                        }, 800);
                    }
                })();
            },
            blurInput(index, value) {
                this.$set(this.jhOrderPlanForwardList[index], 'carNum', Number(value));
                this.calculate(this.jhOrderPlanForwardList);
            },
            // 添加一组表单
            addForm() {
                // 判断是否有一个复选,如果有则禁止新加的复选,没有则不禁止
                let ischeck = this.jhOrderPlanForwardList.some(v => v.ischecked == true);
                if (!ischeck) {
                    this.jhOrderPlanForwardList.push({
                        orderPlanId: this.orderPlanId,
                        name: '',
                        carNum: null,
                        xsUserId: 0,
                        fleetId: 0,
                        checkboxValue1: '',
                        ischecked: false,
                        vid: new Date().getTime(),
                        isSelected: false
                    });
                } else {
                    this.jhOrderPlanForwardList.push({
                        orderPlanId: this.orderPlanId,
                        name: '',
                        carNum: null,
                        xsUserId: 0,
                        fleetId: 0,
                        checkboxValue1: '',
                        ischecked: true,
                        vid: new Date().getTime(),
                        isSelected: false
                    });
                }
                this.calculate(this.jhOrderPlanForwardList);
            },
            // 删除一组表单
            deleteGroup(index, v) {
                let tempcarNum = v.carNum;
                if (v.id) {
                    this.$reqPost('deleteForward', { id: v.id }, 'params').then(res => {
                        if (res.code === 0) {
                            this.jhOrderPlanForwardList.splice(index, 1);
                            this.calculate(this.jhOrderPlanForwardList);
                            this.$u.toast('删除成功');
                        } else if (res.code === 1) {
                            this.$u.toast(res.msg);
                        }
                    });
                } else {
                    this.jhOrderPlanForwardList.splice(index, 1);
                    this.calculate(this.jhOrderPlanForwardList);
                    this.$u.toast('删除成功');
                }
            },
            // 提交
            submitForm() {
                let isPass = false;
                if (this.jhOrderPlanForwardList.length === 0) {
                    this.$u.toast('请至少选择一组转发对象');
                }
                let reg = /^[1-9]\d*$/;
                this.jhOrderPlanForwardList.forEach(v => {
                    if (!reg.test(v.carNum) || Number(v.carNum) <= 0) {
                        this.$u.toast('请输入合法数字');
                        isPass = false;
                        return isPass;
                    } else {
                        isPass = true;
                        return isPass;
                    }
                });
                if (isPass) {
                    this.$reqPost('forward', this.jhOrderPlanForwardList, 'json').then(res => {
                        console.log(res, 'zh');
                        if (res.code == 0) {
                            this.$u.toast('提交成功');
                            setTimeout(() => {
                                uni.navigateBack({ delta: 1 });
                            }, 1000);
                        } else {
                            this.$u.toast(res.msg);
                        }
                    });
                }
            },
            tabClick(item) {
                if (item.name == '货代') {
                    this.tabHuoDai = true;
                } else {
                    this.tabHuoDai = false;
                }
            }
        }
    }
};
    };
</script>
<style lang="scss" scoped>
@mixin flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/deep/ .u-notice-bar {
    background: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0rpx 0rpx 5rpx 0rpx rgba(27, 103, 255, 0);
    border-radius: 28rpx;
    .u-notice__content {
        text {
            text-shadow: 3rpx 3rpx 8rpx #4784fe;
            font-size: 24rpx;
            color: #fd1446 !important;
            font-weight: 400;
        }
<style lang="scss"
    scoped>
    @mixin flex {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
}
/deep/ .u-input {
    border-bottom: 1px solid #c4c4c4;
    width: 458rpx;
}
::v-deep.forward {
    width: 100%;
    margin: 0 auto;
    .forward-banner {
        width: 100%;
        height: 430rpx;
        background: linear-gradient(0deg, #ffffff 0%, #0055fe 100%);
        @include flex;
        justify-content: flex-start;
        overflow: hidden;
        .banner-block {
            width: 50%;
            @include flex;
            position: relative;
            top: -75rpx;
            left: 32rpx;
            .forward-text {
                width: 80rpx;
                font-size: 40rpx;
    /deep/ .u-notice-bar {
        background: rgba(255, 255, 255, 0.3) !important;
        box-shadow: 0rpx 0rpx 5rpx 0rpx rgba(27, 103, 255, 0);
        border-radius: 28rpx;
        .u-notice__content {
            text {
                text-shadow: 3rpx 3rpx 8rpx #4784fe;
                font-size: 24rpx;
                color: #fd1446 !important;
                font-weight: 400;
                color: #ffffff;
                line-height: 69rpx;
            }
        }
    }
    .notice-bar {
        width: 688rpx;
        height: 56rpx;
        margin: 0 auto;
        position: relative;
        top: -200rpx;
        background: transparent;
        .notice-icon {
            position: absolute;
            top: 21rpx;
            left: 7rpx;
        }
    /deep/ .u-input {
        border-bottom: 1px solid #c4c4c4;
        width: 458rpx;
    }
    .card-main {
    ::v-deep.forward {
        width: 100%;
        @include flex;
        justify-content: center;
        position: relative;
        top: -100rpx;
        z-index: 1;
        margin-bottom: vww(40);
        .card-block {
            width: 690rpx;
        margin: 0 auto;
        .forward-banner {
            width: 100%;
            height: 430rpx;
            background: linear-gradient(0deg, #ffffff 0%, #0055fe 100%);
            @include flex;
            flex-direction: column;
            .forward-card {
                margin-top: vww(10);
            justify-content: flex-start;
            overflow: hidden;
            .banner-block {
                width: 50%;
                @include flex;
                position: relative;
                top: -75rpx;
                left: 32rpx;
                .forward-text {
                    width: 80rpx;
                    font-size: 40rpx;
                    font-weight: 400;
                    color: #ffffff;
                    line-height: 69rpx;
                }
            }
        }
        .notice-bar {
            width: 688rpx;
            height: 56rpx;
            margin: 0 auto;
            position: relative;
            top: -200rpx;
            background: transparent;
            .notice-icon {
                position: absolute;
                top: 21rpx;
                left: 7rpx;
            }
        }
        .card-main {
            width: 100%;
            @include flex;
            justify-content: center;
            position: relative;
            top: -100rpx;
            z-index: 1;
            margin-bottom: vww(40);
            .card-block {
                width: 690rpx;
                height: 275rpx;
                background: #ffffff;
                box-shadow: 4rpx 6rpx 25rpx 0rpx rgba(73, 120, 240, 0.15);
                border-radius: 20rpx;
                .card-content {
                    width: 612rpx;
                    margin-left: 48rpx;
                    margin-top: 24rpx;
                    // margin: 56rpx 30rpx 70rpx 48rpx;
                    .u-form {
                        .u-form-item {
                            .u-form-item__body {
                                .u-form-item__body__left {
                                    .u-form-item__body__left__content {
                                        .u-form-item__body__left__content__label {
                                            font-weight: 400 !important;
                                            color: #898989 !important;
                                            font-size: 30rpx !important;
                @include flex;
                flex-direction: column;
                .forward-card {
                    margin-top: vww(10);
                    width: 690rpx;
                    height: 275rpx;
                    background: #ffffff;
                    box-shadow: 4rpx 6rpx 25rpx 0rpx rgba(73, 120, 240, 0.15);
                    border-radius: 20rpx;
                    .card-content {
                        width: 612rpx;
                        margin-left: 48rpx;
                        margin-top: 24rpx;
                        // margin: 56rpx 30rpx 70rpx 48rpx;
                        .u-form {
                            .u-form-item {
                                .u-form-item__body {
                                    .u-form-item__body__left {
                                        .u-form-item__body__left__content {
                                            .u-form-item__body__left__content__label {
                                                font-weight: 400 !important;
                                                color: #898989 !important;
                                                font-size: 30rpx !important;
                                            }
                                        }
                                    }
                                }
                                .u-form-item__body__right {
                                    .u-form-item__body__right__content {
                                        .u-form-item__body__right__content__slot {
                                            .forward-card-amount {
                                                display: flex;
                                                justify-content: space-between;
                                                align-items: flex-end;
                                                .forward-card-amount-input {
                                                    .u-input {
                                                        width: 263rpx;
                                    .u-form-item__body__right {
                                        .u-form-item__body__right__content {
                                            .u-form-item__body__right__content__slot {
                                                .forward-card-amount {
                                                    display: flex;
                                                    justify-content: space-between;
                                                    align-items: flex-end;
                                                    .forward-card-amount-input {
                                                        .u-input {
                                                            width: 263rpx;
                                                        }
                                                    }
                                                }
                                                .u-checkbox-group {
                                                    position: relative;
                                                    top: vww(8);
                                                    left: vww(4);
                                                    .u-checkbox {
                                                        .u-checkbox__icon-wrap {
                                                            border-color: rgba(42, 97, 255, 1) !important;
                                                    .u-checkbox-group {
                                                        position: relative;
                                                        top: vww(8);
                                                        left: vww(4);
                                                        .u-checkbox {
                                                            .u-checkbox__icon-wrap {
                                                                border-color: rgba(42, 97, 255, 1) !important;
                                                            }
                                                        }
                                                    }
                                                }
@@ -619,51 +682,56 @@
                }
            }
        }
    }
    .utils-buttonGroup {
        width: 610rpx;
        @include flex;
        position: fixed;
        bottom: vww(30);
        left: vww(30);
        z-index: 3;
        .AdddBtn,
        .forwardBtn {
            width: 290rpx;
        }
        .AdddBtn {
            .u-button {
                height: 74rpx;
                border: 1px solid #3b56eb;
                border-radius: 37rpx 37rpx 37rpx 37rpx;
                background: transparent;
                color: #3b56eb;
            }
        }
        .forwardBtn {
            .u-button {
                height: 74rpx;
                color: #ffffff;
                background: rgba(73, 123, 251, 1);
                border: 0;
                border-radius: 37rpx 37rpx 37rpx 37rpx;
            }
        }
    }
    .selectHuoDaiOrFleet-container {
        .u-popup {
            .u-transition {
                height: 80%;
                .u-popup__content {
                    overflow: scroll !important;
                    .selectHuoDaiOrFleet-container-box {
                        width: 90%;
                        margin: 0 auto;
        .utils-buttonGroup {
            width: 610rpx;
            @include flex;
            position: fixed;
            bottom: vww(30);
            left: vww(30);
            z-index: 3;
            .AdddBtn,
            .forwardBtn {
                width: 290rpx;
            }
            .AdddBtn {
                .u-button {
                    height: 74rpx;
                    border: 1px solid #3b56eb;
                    border-radius: 37rpx 37rpx 37rpx 37rpx;
                    background: transparent;
                    color: #3b56eb;
                }
            }
            .forwardBtn {
                .u-button {
                    height: 74rpx;
                    color: #ffffff;
                    background: rgba(73, 123, 251, 1);
                    border: 0;
                    border-radius: 37rpx 37rpx 37rpx 37rpx;
                }
            }
        }
        .selectHuoDaiOrFleet-container {
            .u-popup {
                .u-transition {
                    height: 80%;
                    .u-popup__content {
                        overflow: scroll !important;
                        .selectHuoDaiOrFleet-container-box {
                            width: 90%;
                            margin: 0 auto;
                        }
                    }
                }
            }
        }
    }
}
</style>
</style>
pages/register/register.vue
@@ -1,42 +1,96 @@
<template>
    <view class="register">
        <view class="registerForm">
            <u--form :rules="rules" :model="registerFormModel" ref="regesterFormRef">
                <u-form-item labelWidth="20%" label="选择身份" borderBottom ref="roleRef" required>
                    <u-radio-group v-model="radiovalue1" placement="row" @change="groupChange" size="30" shape="circle" iconSize="20">
                        <u-radio
                            labelSize="14px"
            <u--form :rules="rules"
                :model="registerFormModel"
                ref="regesterFormRef">
                <u-form-item labelWidth="20%"
                    label="选择身份"
                    borderBottom
                    ref="roleRef"
                    required>
                    <u-radio-group v-model="radiovalue1"
                        placement="row"
                        @change="groupChange"
                        size="30"
                        shape="circle"
                        iconSize="20">
                        <u-radio labelSize="14px"
                            size="20px"
                            :customStyle="{ marginBottom: '8px' }"
                            v-for="(item, index) in radiolist1"
                            :key="index"
                            :label="item.name"
                            :name="item.name"
                            @change="radioChange"
                        ></u-radio>
                            @change="radioChange"></u-radio>
                    </u-radio-group>
                </u-form-item>
                <u-form-item prop="name" label="姓名" labelWidth="20%" borderBottom required>
                    <u--input v-model="registerFormModel.name" placeholder="请输入内容" clearable></u--input>
                <u-form-item prop="name"
                    label="姓名"
                    labelWidth="20%"
                    borderBottom
                    required>
                    <u--input v-model="registerFormModel.name"
                        placeholder="请输入内容"
                        clearable></u--input>
                </u-form-item>
                <u-form-item prop="idCard" label="身份证" labelWidth="20%" borderBottom required>
                    <u--input v-model="registerFormModel.idCard" placeholder="请输入内容" clearable></u--input>
                <u-form-item prop="idCard"
                    label="身份证"
                    labelWidth="20%"
                    borderBottom
                    required>
                    <u--input v-model="registerFormModel.idCard"
                        placeholder="请输入内容"
                        clearable></u--input>
                </u-form-item>
                <u-form-item prop="phone" label="手机号" labelWidth="20%" borderBottom required>
                    <u--input v-model="registerFormModel.phone" placeholder="请输入内容" clearable></u--input>
                <u-form-item prop="phone"
                    label="手机号"
                    labelWidth="20%"
                    borderBottom
                    required>
                    <u--input v-model="registerFormModel.phone"
                        placeholder="请输入内容"
                        clearable></u--input>
                </u-form-item>
                <u-form-item prop="password" label="密码" labelWidth="20%" borderBottom required>
                    <u--input v-model="registerFormModel.password" placeholder="请输入内容" password clearable></u--input>
                <u-form-item prop="password"
                    label="密码"
                    labelWidth="20%"
                    borderBottom
                    required>
                    <u--input v-model="registerFormModel.password"
                        placeholder="请输入内容"
                        password
                        clearable></u--input>
                </u-form-item>
                <u-form-item prop="confirmPassword" label="确认密码" labelWidth="20%" borderBottom required>
                    <u--input v-model="registerFormModel.confirmPassword" placeholder="请输入内容" password clearable @blur="jiaoYanPassword"></u--input>
                <u-form-item prop="confirmPassword"
                    label="确认密码"
                    labelWidth="20%"
                    borderBottom
                    required>
                    <u--input v-model="registerFormModel.confirmPassword"
                        placeholder="请输入内容"
                        password
                        clearable
                        @blur="jiaoYanPassword"></u--input>
                </u-form-item>
                <u-form-item prop="carNo" label="车牌号" labelWidth="20%" borderBottom v-if="radiovalue1 == '司机'" required>
                    <u--input v-model="registerFormModel.carNo" placeholder="请输入内容" clearable></u--input>
                <u-form-item prop="carNo"
                    label="车牌号"
                    labelWidth="20%"
                    borderBottom
                    v-if="radiovalue1 == '司机'"
                    required>
                    <u--input v-model="registerFormModel.carNo"
                        placeholder="请输入内容"
                        clearable></u--input>
                </u-form-item>
                <u-form-item prop="carImg" label="车辆照片" labelWidth="20%" borderBottom v-if="radiovalue1 == '司机'" required @click="beforeRead">
                    <u-upload
                        :fileList="fileList1"
                <u-form-item prop="carImg"
                    label="车辆照片"
                    labelWidth="20%"
                    borderBottom
                    v-if="radiovalue1 == '司机'"
                    required
                    @click="beforeRead">
                    <u-upload :fileList="fileList1"
                        deletable
                        @afterRead="afterRead"
                        @delete="deletePic"
@@ -45,15 +99,19 @@
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true"
                    >
                        :previewFullImage="true">
                        <!-- <image src="https://cdn.uviewui.com/uview/demo/upload/positive.png"
                        mode="widthFix" style="width: 250px;height: 150px;"></image> -->
                    </u-upload>
                </u-form-item>
                <u-form-item prop="drivingImg" label="行驶证" labelWidth="20%" borderBottom v-if="radiovalue1 == '司机'" required @click="beforeRead">
                    <u-upload
                        :fileList="fileList2"
                <u-form-item prop="drivingImg"
                    label="行驶证"
                    labelWidth="20%"
                    borderBottom
                    v-if="radiovalue1 == '司机'"
                    required
                    @click="beforeRead">
                    <u-upload :fileList="fileList2"
                        deletable
                        @afterRead="afterRead"
                        @delete="deletePic"
@@ -62,21 +120,31 @@
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true"
                    >
                        :previewFullImage="true">
                        <!-- <image src="https://cdn.uviewui.com/uview/demo/upload/positive.png"
                        mode="widthFix" style="width: 250px;height: 150px;"></image> -->
                    </u-upload>
                </u-form-item>
                <u-form-item label="推荐人账号" labelWidth="25%" borderBottom>
                    <u--input v-model="registerFormModel.tuiJianMa" placeholder="请输入内容" clearable></u--input>
                <u-form-item label="推荐人账号"
                    labelWidth="25%"
                    borderBottom>
                    <u--input v-model="registerFormModel.tuiJianMa"
                        placeholder="请输入内容"
                        clearable></u--input>
                </u-form-item>
            </u--form>
        </view>
        <view class="roleModel">
            <u-modal :show="editRoleModelShow" :title="title" :content="content" :showCancelButton="true" @confirm="roleConfirm" @cancel="roleCancel"></u-modal>
            <u-modal :show="editRoleModelShow"
                :title="title"
                :content="content"
                :showCancelButton="true"
                @confirm="roleConfirm"
                @cancel="roleCancel"></u-modal>
        </view>
        <view class="registerBtn"><u-button text="注册" type="primary" @click="registerClick"></u-button></view>
        <view class="registerBtn"><u-button text="注册"
                type="primary"
                @click="registerClick"></u-button></view>
        <!-- 图片预览弹出框 -->
        <!-- <view class="previewImage-container">
            <u-popup :show="previewImageShow" mode="center" @close="previewImageClose" @open="previewImageOpen">
@@ -87,358 +155,359 @@
</template>
<script>
import { apiRegister } from '@/api/publicInterface.js';
import { BaseUrl } from '@/api/publicInterface.js';
import { mapMutations } from 'vuex';
export default {
    // onLoad: function() {
    //   // 查看是否授权
    //   wx.getSetting({
    //     success (res){
    //       if (res.authSetting['scope.userInfo']) {
    //         // 已经授权,可以直接调用 getUserInfo 获取头像昵称
    //         wx.getUserInfo({
    //           success: function(res) {
    //             console.log('res.userInfo',res.userInfo)
    //           }
    //         })
    //       }
    //     }
    //   })
    // },
    // 监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
    onReady() {
        this.$refs.regesterFormRef.setRules(this.rules);
        // this.$refs.regesterFormRef.validate().then(res => {}).catch(err => {
        //   console.log(err);
        // })
    },
    onLoad(params) {
        if (params) {
            this.registerFormModel.openId = params.code;
            console.log('页面加载', this.registerFormModel.openId);
        }
    },
    data() {
        return {
            // 车牌号键盘控制
            carNumShow: false,
            keyValue: '',
            registerFormModel: {
                phone: '',
                password: '',
                name: '',
                username: '',
                openId: '',
                type: 2,
                idCard: '',
                carNo: '',
                carImg: '',
                drivingImg: '',
                tuiJianMa: '',
                confirmPassword: ''
            },
            fileList1: [],
            fileList2: [],
            rules: {
                name: {
                    type: 'string',
                    required: true,
                    message: '请填写姓名',
                    trigger: ['blur', 'change']
    import { apiRegister } from '@/api/publicInterface.js';
    import { BaseUrl } from '@/api/publicInterface.js';
    import { mapMutations } from 'vuex';
    export default {
        // onLoad: function() {
        //   // 查看是否授权
        //   wx.getSetting({
        //     success (res){
        //       if (res.authSetting['scope.userInfo']) {
        //         // 已经授权,可以直接调用 getUserInfo 获取头像昵称
        //         wx.getUserInfo({
        //           success: function(res) {
        //             console.log('res.userInfo',res.userInfo)
        //           }
        //         })
        //       }
        //     }
        //   })
        // },
        // 监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
        onReady() {
            this.$refs.regesterFormRef.setRules(this.rules);
            // this.$refs.regesterFormRef.validate().then(res => {}).catch(err => {
            //   console.log(err);
            // })
        },
        onLoad(params) {
            if (params) {
                this.registerFormModel.openId = params.code;
                console.log('页面加载', this.registerFormModel.openId);
            }
        },
        data() {
            return {
                // 车牌号键盘控制
                carNumShow: false,
                keyValue: '',
                registerFormModel: {
                    phone: '',
                    password: '',
                    name: '',
                    username: '',
                    openId: '',
                    type: 2,
                    idCard: '',
                    carNo: '',
                    carImg: '',
                    drivingImg: '',
                    tuiJianMa: '',
                    confirmPassword: ''
                },
                idCard: [
                    {
                fileList1: [],
                fileList2: [],
                rules: {
                    name: {
                        type: 'string',
                        required: true,
                        message: '请输入身份证号',
                        message: '请填写姓名',
                        trigger: ['blur', 'change']
                    },
                    {
                        pattern: /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
                        message: '身份证号格式不正确'
                    }
                ],
                phone: [
                    {
                        required: true,
                        message: '此项为必填项',
                        // blur和change事件触发检验
                        trigger: ['blur', 'change']
                    },
                    {
                        min: 11,
                        max: 11,
                        message: '请输入合法手机号'
                    },
                    {
                        validator: (rule, value, callback) => {
                            return uni.$u.test.mobile(value);
                    idCard: [{
                            type: 'string',
                            required: true,
                            message: '请输入身份证号',
                            trigger: ['blur', 'change']
                        },
                        message: '手机号码不正确',
                        trigger: ['change', 'blur']
                    }
                ],
                password: [
                    {
                        required: true,
                        message: '请设置初始密码',
                        trigger: ['blur', 'change']
                    },
                    {
                        min: 6,
                        max: 12,
                        message: '长度在6-12个字符之间'
                    }
                ],
                confirmPassword: [
                    {
                        required: true,
                        message: '请设置初始密码',
                        trigger: ['blur', 'change']
                    },
                    {
                        min: 6,
                        max: 12,
                        message: '长度在6-12个字符之间'
                    }
                ],
                carNo: [
                    {
                        type: 'string',
                        required: true,
                        message: '请输入车牌号',
                        trigger: ['blur', 'change']
                    },
                    {
                        transform(value) {
                            return String(value);
                        },
                        validator: (rule, value, callback) => {
                            return uni.$u.test.carNo(value);
                        },
                        message: '请输入正确的车牌号',
                        trigger: ['change', 'blur']
                    }
                ],
                carImg: {
                    type: 'string',
                    required: true,
                    message: '请上传车辆图片',
                    trigger: ['blur', 'change']
                },
                drivingImg: {
                    type: 'string',
                    required: true,
                    message: '请上传行驶证照片',
                    trigger: ['blur', 'change']
                }
            },
            // 基本案列数据
            radiolist1: [
                {
                    name: '货代',
                    disabled: false
                },
                {
                    name: '司机',
                    disabled: false
                }
            ],
            // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
            radiovalue1: '货代',
            beforeChangeValue: '',
            // 更换角色弹框
            editRoleModelShow: false,
            title: '提示',
            content: '当前填入信息,切换角色后,即清除,是否切换?',
            wxcode: '',
            openid: ''
        };
    },
    watch: {
        radiovalue1(newV) {
            if (this.registerFormModel.name || this.registerFormModel.idCard || this.registerFormModel.phone || this.registerFormModel.carNo || this.registerFormModel.password) {
                if (this.editRoleModelShow == true) {
                    this.editRoleModelShow = false;
                } else {
                    this.editRoleModelShow = true;
                }
            }
            switch (newV) {
                case '货代':
                    this.registerFormModel.type = 2;
                    break;
                case '司机':
                    this.registerFormModel.type = 3;
                    break;
                default:
                    break;
            }
            return;
        }
    },
    methods: {
        ...mapMutations(['changeisUploadimg']),
        registerClick() {
            if (this.registerFormModel.password == this.registerFormModel.confirmPassword) {
                this.$refs.regesterFormRef
                    .validate()
                    .then(res => {
                        console.log(this.registerFormModel);
                        this.registerFormModel.username = this.registerFormModel.phone;
                        apiRegister(this.registerFormModel)
                            .then(res => {
                                if (res.data.code == 0) {
                                    uni.showToast({
                                        title: '注册成功,即将返回登录页',
                                        icon: 'none',
                                        duration: 1000
                                    });
                                    setTimeout(() => {
                                        uni.redirectTo({ url: '/pages/login/login' });
                                    }, 1000);
                                } else {
                                    this.$u.toast(res.msg ? res.msg : '添加失败');
                                }
                            })
                            .catch(err => {
                                console.log('错误', err);
                            });
                    })
                    .catch(err => {
                        console.log('err', err);
                        this.$u.toast('请规范输入内容');
                    });
            } else {
                this.$u.toast('两次密码不一致');
            }
        },
        // 单选框事件
        groupChange(e) {},
        radioChange(e) {
            if (
                this.registerFormModel.name == '' &&
                this.registerFormModel.idCard == '' &&
                this.registerFormModel.phone == '' &&
                this.registerFormModel.carNo == '' &&
                this.registerFormModel.password == ''
            ) {
                this.$refs.regesterFormRef.clearValidate();
                this.beforeChangeValue = e;
            }
        },
        jiaoYanPassword() {
            if (this.registerFormModel.password != this.registerFormModel.confirmPassword) {
                this.$u.toast('两次密码不一致');
            }
        },
        // 上传图片方法
        beforeRead() {
            this.changeisUploadimg(true);
        },
        // 删除图片
        deletePic(event) {
            this.changeisUploadimg(true);
            this[`fileList${event.name}`].splice(event.index, 1);
        },
        // 新增图片
        async afterRead(event) {
            // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
            let lists = [].concat(event.file);
            let fileListLen = this[`fileList${event.name}`].length;
            lists.map(item => {
                this[`fileList${event.name}`].push({
                    ...item,
                    status: 'uploading',
                    message: '上传中'
                });
            });
            for (let i = 0; i < lists.length; i++) {
                const result = await this.uploadFilePromise(lists[i].url, event.name);
                let item = this[`fileList${event.name}`][fileListLen];
                this[`fileList${event.name}`].splice(
                    fileListLen,
                    1,
                    Object.assign(item, {
                        status: 'success',
                        message: '上传成功',
                        url: result
                    })
                );
                fileListLen++;
            }
        },
        uploadFilePromise(url, num) {
            return new Promise((resolve, reject) => {
                let a = uni.uploadFile({
                    url: BaseUrl + '/admin/sys-file/uploadUnToken',
                    filePath: url,
                    name: 'file',
                    formData: {
                        // user: ''
                    },
                    success: res => {
                        if (num == 1) {
                            this.registerFormModel.carImg = JSON.parse(res.data).data.url;
                            resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                        } else if (num == 2) {
                            this.registerFormModel.drivingImg = JSON.parse(res.data).data.url;
                            resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                        {
                            pattern: /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
                            message: '身份证号格式不正确'
                        }
                    ],
                    phone: [{
                            required: true,
                            message: '此项为必填项',
                            // blur和change事件触发检验
                            trigger: ['blur', 'change']
                        },
                        {
                            min: 11,
                            max: 11,
                            message: '请输入合法手机号'
                        },
                        {
                            validator: (rule, value, callback) => {
                                return uni.$u.test.mobile(value);
                            },
                            message: '手机号码不正确',
                            trigger: ['change', 'blur']
                        }
                    ],
                    password: [{
                            required: true,
                            message: '请设置初始密码',
                            trigger: ['blur', 'change']
                        },
                        {
                            min: 6,
                            max: 12,
                            message: '长度在6-12个字符之间'
                        }
                    ],
                    confirmPassword: [{
                            required: true,
                            message: '请设置初始密码',
                            trigger: ['blur', 'change']
                        },
                        {
                            min: 6,
                            max: 12,
                            message: '长度在6-12个字符之间'
                        }
                    ],
                    carNo: [{
                            type: 'string',
                            required: true,
                            message: '请输入车牌号',
                            trigger: ['blur', 'change']
                        },
                        {
                            transform(value) {
                                return String(value);
                            },
                            validator: (rule, value, callback) => {
                                return uni.$u.test.carNo(value);
                            },
                            message: '请输入正确的车牌号',
                            trigger: ['change', 'blur']
                        }
                    ],
                    carImg: {
                        type: 'string',
                        required: true,
                        message: '请上传车辆图片',
                        trigger: ['blur', 'change']
                    },
                    drivingImg: {
                        type: 'string',
                        required: true,
                        message: '请上传行驶证照片',
                        trigger: ['blur', 'change']
                    }
                },
                // 基本案列数据
                radiolist1: [{
                        name: '货代',
                        disabled: false
                    },
                    {
                        name: '司机',
                        disabled: false
                    }
                ],
                // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
                radiovalue1: '货代',
                beforeChangeValue: '',
                // 更换角色弹框
                editRoleModelShow: false,
                title: '提示',
                content: '当前填入信息,切换角色后,即清除,是否切换?',
                wxcode: '',
                openid: ''
            };
        },
        watch: {
            radiovalue1(newV) {
                if (this.registerFormModel.name || this.registerFormModel.idCard || this.registerFormModel.phone || this
                    .registerFormModel.carNo || this.registerFormModel.password) {
                    if (this.editRoleModelShow == true) {
                        this.editRoleModelShow = false;
                    } else {
                        this.editRoleModelShow = true;
                    }
                }
                switch (newV) {
                    case '货代':
                        this.registerFormModel.type = 2;
                        break;
                    case '司机':
                        this.registerFormModel.type = 3;
                        break;
                    default:
                        break;
                }
                return;
            }
        },
        methods: {
            ...mapMutations(['changeisUploadimg']),
            registerClick() {
                if (this.registerFormModel.password == this.registerFormModel.confirmPassword) {
                    this.$refs.regesterFormRef
                        .validate()
                        .then(res => {
                            console.log(this.registerFormModel);
                            this.registerFormModel.username = this.registerFormModel.phone;
                            apiRegister(this.registerFormModel)
                                .then(res => {
                                    if (res.data.code == 0) {
                                        uni.showToast({
                                            title: '注册成功,即将返回登录页',
                                            icon: 'none',
                                            duration: 1000
                                        });
                                        setTimeout(() => {
                                            uni.redirectTo({ url: '/pages/login/login' });
                                        }, 1000);
                                    } else {
                                        this.$u.toast(res.data.msg ? res.data.msg : '添加失败');
                                    }
                                })
                                .catch(err => {
                                    console.log('错误', err);
                                });
                        })
                        .catch(err => {
                            console.log('err', err);
                            this.$u.toast('请规范输入内容');
                        });
                } else {
                    this.$u.toast('两次密码不一致');
                }
            },
            // 单选框事件
            groupChange(e) {},
            radioChange(e) {
                if (
                    this.registerFormModel.name == '' &&
                    this.registerFormModel.idCard == '' &&
                    this.registerFormModel.phone == '' &&
                    this.registerFormModel.carNo == '' &&
                    this.registerFormModel.password == ''
                ) {
                    this.$refs.regesterFormRef.clearValidate();
                    this.beforeChangeValue = e;
                }
            },
            jiaoYanPassword() {
                if (this.registerFormModel.password != this.registerFormModel.confirmPassword) {
                    this.$u.toast('两次密码不一致');
                }
            },
            // 上传图片方法
            beforeRead() {
                this.changeisUploadimg(true);
            },
            // 删除图片
            deletePic(event) {
                this.changeisUploadimg(true);
                this[`fileList${event.name}`].splice(event.index, 1);
            },
            // 新增图片
            async afterRead(event) {
                // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
                let lists = [].concat(event.file);
                let fileListLen = this[`fileList${event.name}`].length;
                lists.map(item => {
                    this[`fileList${event.name}`].push({
                        ...item,
                        status: 'uploading',
                        message: '上传中'
                    });
                });
                for (let i = 0; i < lists.length; i++) {
                    const result = await this.uploadFilePromise(lists[i].url, event.name);
                    let item = this[`fileList${event.name}`][fileListLen];
                    this[`fileList${event.name}`].splice(
                        fileListLen,
                        1,
                        Object.assign(item, {
                            status: 'success',
                            message: '上传成功',
                            url: result
                        })
                    );
                    fileListLen++;
                }
            },
            uploadFilePromise(url, num) {
                return new Promise((resolve, reject) => {
                    let a = uni.uploadFile({
                        url: BaseUrl + '/admin/sys-file/uploadUnToken',
                        filePath: url,
                        name: 'file',
                        formData: {
                            // user: ''
                        },
                        success: res => {
                            if (num == 1) {
                                this.registerFormModel.carImg = JSON.parse(res.data).data.url;
                                resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                            } else if (num == 2) {
                                this.registerFormModel.drivingImg = JSON.parse(res.data).data.url;
                                resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                            }
                        }
                    });
                });
            },
            // 更换角色弹出框
            roleConfirm() {
                console.log('遍历对象', Object.keys(this.registerFormModel));
                Object.keys(this.registerFormModel).forEach(item => {
                    if (item !== 'type') {
                        if (this.registerFormModel[item]) this.registerFormModel[item] = '';
                    }
                });
            });
        },
        // 更换角色弹出框
        roleConfirm() {
            console.log('遍历对象', Object.keys(this.registerFormModel));
            Object.keys(this.registerFormModel).forEach(item => {
                if (item !== 'type') {
                    if (this.registerFormModel[item]) this.registerFormModel[item] = '';
                }
            });
            /**
             * @resetFields 不管用时候用上边的代替
             */
            this.$refs.regesterFormRef.resetFields();
            this.editRoleModelShow = false;
        },
        roleCancel() {
            this.radiovalue1 = this.beforeChangeValue;
            this.$nextTick(() => {
                /**
                 * @resetFields 不管用时候用上边的代替
                 */
                this.$refs.regesterFormRef.resetFields();
                this.editRoleModelShow = false;
            });
            },
            roleCancel() {
                this.radiovalue1 = this.beforeChangeValue;
                this.$nextTick(() => {
                    this.editRoleModelShow = false;
                });
            }
        }
    }
};
    };
</script>
<style lang="scss" scoped>
::v-deep.register {
    width: 94%;
    padding: 0 0 vww(20) 0;
    margin: 0 auto;
    .registerForm {
<style lang="scss"
    scoped>
    ::v-deep.register {
        width: 94%;
        padding: 0 0 vww(20) 0;
        margin: 0 auto;
        font-size: 16px !important;
        .u-form {
            .u-radio {
                width: 33%;
        .registerForm {
            width: 94%;
            margin: 0 auto;
            font-size: 16px !important;
            .u-form {
                .u-radio {
                    width: 33%;
                }
            }
        }
        .registerBtn {
            width: 94%;
            margin: vww(50) auto 0;
        }
        .utils {
            line-height: vww(30);
            text-align: center;
            text:nth-of-type(1) {
                margin-right: vww(10);
            }
        }
    }
    .registerBtn {
        width: 94%;
        margin: vww(50) auto 0;
    }
    .utils {
        line-height: vww(30);
        text-align: center;
        text:nth-of-type(1) {
            margin-right: vww(10);
        }
    }
}
</style>
</style>