(微信一键登录,登录界面完善)(注册,司机上传图片接口)(提煤单详情页的优化,呼叫客服测试环境完成)(称重详情的页面,以及接口对接)
10个文件已修改
1个文件已添加
473 ■■■■ 已修改文件
README.md 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/globalApi.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/index.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/appointment/appointment.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/login/login.vue 160 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/register/register.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabbar-page/index-tabbar/index-tabbar.vue 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md
@@ -1,4 +0,0 @@
## unattended-app
无人值守微信小程序
api/globalApi.js
@@ -170,7 +170,7 @@
    //删除司机
    deleteSiJi: {
        url: "/wrzs/wx/deleteSiJi",
        method: "POST"
        method: "POST",
    },
api/index.js
@@ -45,6 +45,7 @@
        opt.header = typeObj['headerPOST'];
    } else if (urlType == 'json') {
        opt.header = typeObj['jsonPOST'];
        opt.data = params;
    } else {
        opt.data = params;
        opt.header = typeObj['headerPOST'];
pages.json
@@ -136,6 +136,15 @@
            }
            
        }
        ,{
            "path" : "pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice",
            "style" :
            {
                "navigationBarTitleText": "称重",
                "enablePullDownRefresh": false
            }
        }
    ],
    "tabBar": {
        // "color": "#999794",
pages/driver-page/appointment/appointment.vue
@@ -97,7 +97,6 @@
            this.rcsqData.yyId = value.id;
            this.rcsqData.deptId = value.deptId;
            this.rcsqData.filedId = value.filedId;
            console.log(this.rcsqData, '入场申请请求');
            this.$reqPost('saveRCSQ', this.rcsqData, 'json').then(res => {
                if (res.code == 0) {
                    this.$u.toast('新建入场申请成功。');
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
@@ -1,15 +1,17 @@
<template>
    <view class="bill-of-lading-details">
        <view class="bangDanMessage"><text>磅单信息</text></view>
        <view class="timeLine" style="font-size: 16rpx;"><u-text v-for="(item, index) in dayRZ" :key="index" :text="item.taskStatusDes"></u-text></view>
        <view class="timeLine" style="font-size: 16rpx;">
            <u--text type="primary" size="30" plain text="主色" v-for="(item, index) in dayRZ" :key="index" :text="item.taskStatusDes"></u--text>
        </view>
        <view class="utilsBox">
            <view class="utils_chil utils_chilTop">
                <u-button text="签到" type="primary" @click="arriveClick"></u-button>
                <u-button text="入场申请" type="primary" @click="rcsqClick"></u-button>
                <u-button text="放空" type="primary"></u-button>
                <u-button text="呼叫客服" type="primary"></u-button>
                <u-button text="签到" type="primary" plain @click="arriveClick"></u-button>
                <u-button text="入场申请" type="primary" plain @click="rcsqClick"></u-button>
                <u-button text="放空" type="primary" plain></u-button>
                <u-button text="呼叫客服" type="primary" plain></u-button>
            </view>
            <view class="utils_chil"><u-button text="展示提煤单" @click="showCaolPickUpBill" type="primary"></u-button></view>
            <view class="utils_chil"><u-button text="展示提煤单" @click="showCaolPickUpBill" type="primary" ></u-button></view>
            <view class="utils_chil"><u-button text="上磅计量" @click="cengZhongClick" type="primary"></u-button></view>
        </view>
    </view>
@@ -34,6 +36,14 @@
    onShow() {
        this.init();
    },
    computed:{
        userName(){
            return uni.getStorageSync('username')
        },
        openid(){
            return uni.getStorageSync('openid')
        }
    },
    methods: {
        init() {
            this.coalDayPage();
@@ -46,6 +56,7 @@
                }
            });
        },
        // 展示提煤单详情
        showCaolPickUpBill() {
            uni.navigateTo({
                url: `/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill?orderPlanId=${this.orderPlanId}`
@@ -57,12 +68,27 @@
                console.log(res, '签到');
            });
        },
        // 入场申请
        rcsqClick() {
            uni.navigateTo({
                url: `/pages/driver-page/appointment/appointment?takeCoalId=${this.orderPlanId}&type=入场申请&yyId=${this.yyId}`
            });
        },
        cengZhongClick() {}
        // 呼叫客服
        callCustomerService(){
            wx.join1v1Chat({
                caller: { nickname:this.userName , openid: this.openid },
                listener: { nickname: '客服', openid: 'orutI5YT0yEvARVngdsTmBpisWmw' }, // 这里的openid是fyy的,充当固定的客服openid
                backgroundType: 2,
                roomType: 'voice'
            });
        },
        // 称重
        cengZhongClick() {
            uni.navigateTo({
                url:`/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}`
            })
        }
        /**
         * @desc 等待取煤单接口
         * */
@@ -81,7 +107,7 @@
    .bangDanMessage {
        font-size: vww(20);
        font-weight: 500;
        border: vww(1) solid #dddddd;
        border: vww(2) solid #dddddd;
        border-radius: vww(20);
        margin: vww(20);
        margin-bottom: vww(10);
@@ -92,12 +118,18 @@
        justify-content: center;
    }
    .timeLine {
        height: 45%;
        margin: vww(20);
        margin-top: vww(10);
        margin-bottom: vww(10);
        border: vww(1) solid #dddddd;
        border: vww(2) solid #dddddd;
        border-radius: vww(20);
        flex: 2;
        padding: vww(20);
        box-sizing: border-box;
        overflow-y: overlay; //行为与 auto 相同,但是滚动条绘制在内容之上,而不是占据空间。
        .u-text{
            margin-bottom: vww(5)!important;
        }
    }
    .utilsBox {
        padding: vww(20);
pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue
@@ -3,13 +3,13 @@
        <view class="driver" style="background:url(../../../../../static/image/coalBackgroud/coal-background.png) no-repeat;background-size:100% 100%;">
            <view class="driver-coalOne">电子提煤单</view>
            <view class="driver-coalTwo">
                <view class="">东庞矿北井</view>
                <view class="">1/3焦</view>
                <view class="">冀A37U98</view>
                <view class="">{{ coalData.deptName || '暂无所属矿' }}</view>
                <view class="">{{ coalData.coalName || '暂无煤种' }}</view>
                <view class="">{{ coalData.carNo || '暂无车牌' }}</view>
            </view>
            <view class="driver-coalThree">
                <view class="">旭阳焦化有限责任公司</view>
                <view class="">2022年8月28日 15:00:56</view>
                <view class="">{{ coalData.customerName || '暂无单位' }}</view>
                <view class="">{{ coalData.yuYueTime || '暂无时间' }}</view>
            </view>
            <view class="driver-coalFour"><image src="@/static/logo.gif" mode=""></image></view>
        </view>
@@ -17,36 +17,40 @@
</template>
<script>
    export default {
        onLoad(value) {
            console.log('页面加载', value);
            if (value.orderPlanId) {
                this.orderPlanId = value.orderPlanId;
            }
        },
        data() {
            return {
                orderPlanId: null
            };
        },
        onShow() {
            this.init();
        },
        methods: {
            init() {
                this.getTakeCoal();
            },
            // 获取提煤单详情
            getTakeCoal() {
                this.$reqGet('getTakeCoal', { takeCoalId: this.orderPlanId }).then(res => {
                    console.log('获取提煤单详情', res);
                });
            }
            /**
             * @desc 等待取煤单接口
             * */
export default {
    onLoad(value) {
        console.log('页面加载', value);
        if (value.orderPlanId) {
            this.orderPlanId = value.orderPlanId;
        }
    },
    data() {
        return {
            orderPlanId: null,
            coalData: {}
        };
    },
    onShow() {
        this.init();
    },
    methods: {
        init() {
            this.getTakeCoal();
        },
        // 获取提煤单详情
        getTakeCoal() {
            this.$reqGet('getTakeCoal', { takeCoalId: this.orderPlanId }).then(res => {
                console.log('获取提煤单详情', res);
                if (res.code == 0) {
                    this.coalData = res.data[0];
                }
            });
        }
        /**
         * @desc 等待取煤单接口
         * */
    }
};
</script>
<style lang="scss" scoped>
@@ -103,4 +107,3 @@
    }
}
</style>
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
New file
@@ -0,0 +1,132 @@
<template>
    <view class="weighingDevice">
        <view class="one">
            <view class="top">
                <view class="top_left"><text>41.5</text></view>
                <view class="top_right">
                    <view class="">称重: <u--text type="success" text="正常" size="34"></u--text></view>
                    <view class="">红外: <u--text type="success" text="正常" size="34"></u--text></view>
                    <view class="">雷达: <u--text type="success" text="正常" size="34"></u--text></view>
                </view>
            </view>
            <view class="bottom"><text>TIP:当前状态正常可以称重</text></view>
        </view>
        <view class="two">
            <p>订单编号:{{ weighList.code || '' }}</p>
            <p>订单类型:{{ weighList.orderTye || '' }}</p>
            <p>订单余量:{{ weighList.allowance }}</p>
            <p>皮重:{{ weighList.skin || '' }}</p>
            <p>毛重:{{ weighList.hair || '' }}</p>
            <p>净重:{{ weighList.clean || '' }}</p>
        </view>
        <view class="three">
            <!-- 外销订单成皮时,返回加减吨按钮置灰。称毛时可用.外购订单,不出现返回加减吨的按钮 -->
            <u-button type="primary" text="确定称重" @click="confirmWeigh"></u-button>
            <u-button type="primary" text="返回加减吨"></u-button>
        </view>
        <view class="four">如您需要调整装载货品吨数,请点击返回加减吨</view>
    </view>
</template>
<script>
export default {
    onLoad(params) {
        console.log('称重页面', params);
        this.takeCoalId = params.takeCoalId;
    },
    data() {
        return {
            takeCoalId: null,
            weighList: {}
        };
    },
    onShow() {
        this.init();
    },
    methods: {
        init() {
            // 获取称重信息
            this.$reqGet('weighList', { id: this.takeCoalId }).then(res => {
                console.log(res, '获取称重信息');
                if (res.code == 0) {
                    this.weighList = res.data;
                }
            });
        },
        /**
         * @确认称重等待后端提供实时称重接口,获取皮重,毛重
         */
        confirmWeigh(){
            // this.$reqPost('saveWeigh',{id:this.takeCoalId,skin:'',hair:''}).then(res=>{
            //     console.log(res,"确认称重");
            // })
        }
    }
};
</script>
<style lang="scss" scoped>
::v-deep.weighingDevice {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    .one {
        flex: 2;
        border: vww(1) solid #dddddd;
        margin: vww(20) vww(20) 0 vww(20);
        border-radius: vww(15);
        .top {
            height: 80%;
            display: flex;
            .top_left {
                flex: 3;
                font-size: vww(50);
                display:flex;
                align-items: center;
                justify-content: center;
            }
            .top_right {
                display:flex;
                flex-direction: column;
                justify-content: center;
                flex: 2;
                view{
                    display: flex;
                }
            }
        }
        .bottom {
            text-align: center;
        }
    }
    .two {
        flex: 4;
        border: vww(1) solid #dddddd;
        margin: vww(20);
        border-radius: vww(10);
        padding: vww(20);
        p {
            text-align: center;
            font-size: vww(20);
            font-weight: 500;
            margin-top: vww(5);
        }
    }
    .three {
        margin: 0 auto vww(20);
        flex: 0.7;
        display: flex;
        color: #939393;
        .u-button {
            &:nth-of-type(2) {
                margin-left: vww(10);
            }
        }
    }
    .four {
        margin: vww(10) auto;
        flex: 0.5;
    }
}
</style>
pages/login/login.vue
@@ -1,25 +1,29 @@
<template>
    <view class="login">
        <!-- <view class="loginBtn">
      <u-button text="微信一键登录" type="success" shape="circle" icon="weixin-fill" @click="apiLogin"></u-button>
    </view> -->
        <!--国际化-->
        <js-lang title="login.title" :showBtn="false"></js-lang>
        <view class="logo">无人值守</view>
        <!-- 租户列表 -->
        <!-- <view class="tenantList">
            <u-input v-model="tenantId" placeholder="请输入内容" type="select" border="true" @click="show = true" />
            <u-action-sheet :list="tenantList" v-model="show" @click="selectTenant"></u-action-sheet>
        </view> -->
        <!--用户名密码登录-->
        <user-password />
        <!-- #ifdef MP -->
        <view class="loginBtn"><u-button class="button" @click.stop="getUserProfile" :disabled="btnLoading" :loading="btnLoading" type="primary" text="微信一键登录"></u-button></view>
        <!-- 微信openid登录 -->
        <view class="loginBtn">
            <u-button class="button" @click.stop="beforeLoginEvent" :disabled="btnLoading" :loading="btnLoading" type="primary" text="微信一键登录"></u-button>
        </view>
        <view class="register" @click="registerClick"><text>注册</text></view>
        <!-- #endif -->
        <view class="login-bottom-box"><view class="copyright">2023冀中能源无人值守微信小程序</view></view>
        <view class="login-bottom-box">
            <view class="copyright">冀中能源无人值守微信小程序</view>
            <view class="copyright">小程序仅供已拥有系统账号特定内部人员使用</view>
        </view>
        <!-- 微信授权前的弹框 -->
        <view class="loginPopup">
            <u-popup :show="loginPopupShow" mode="bottom" @close="closePopup" @open="openPopup" round="10" :safeAreaInsetBottom="true">
                <view class="popup-warp">
                    <view class="body"><text>本小程序,仅供已拥有系统账号特定内部人员登录使用,点击同意即表示您已同意相应信息授权。</text></view>
                    <view class="btn">
                        <u-button @click="loginPopupShow = false" type="error" text="不同意" shape="circle" :plain="true"></u-button>
                        <u-button @click="wxLogin" type="error" text="同意" throttleTime="3000" shape="circle"></u-button>
                    </view>
                </view>
            </u-popup>
        </view>
    </view>
</template>
@@ -31,19 +35,9 @@
export default {
    data() {
        return {
            // wxcode: '31363631363534303739323636', // 客户
            // wxcode: '31363631363534303700000000', // 货代1
            // wxcode: '31363631363534303700000004', // 货代2
            wxcode: '31363631363534303700000001', // 司机1
            // wxcode: '31363631363534303700000005', // 司机2
            // wxcode: '', // 客户
            openid: '',
            roleId: 0,
            tenantId: undefined,
            wxcode: '', // 司机1
            btnLoading: false,
            show: false,
            tenantList: []
            loginPopupShow: false
        };
    },
    components: {
@@ -52,51 +46,76 @@
    methods: {
        ...mapMutations(['setUserTabbar']),
        // 访问wx.login,获取code
        login() {
            // let _this = this;
        beforeLoginEvent() {
            this.loginPopupShow = true;
        },
        wxLogin() {
            // 获取登录用户code
            uni.login({
                success: res => {
                    console.log('登录loginRes', res);
                    if (res.code) {
                        this.wxcode = res.code;
                        this.apiLogin();
                    } else {
                        uni.showToast({
                            title: '微信登录失败!',
                            duration: 2000
                        });
                    }
                    // this.apiLogin();
                }
            });
        },
        // 登录接口
        apiLogin() {
            // console.log(this.$uStoreKey.roleType);
            apiLogin2({ code: this.wxcode })
                .then(res => {
                    console.log('请求登录', res);
                    if (res.msg == '需绑定') {
                        uni.navigateTo({
                            url: `/pages/register/register?code=${res.data}`
                        });
                    }
                    if (res.msg == '登录成功') {
                        uni.setStorageSync('userInfo', res.data);
                        this.setUserTabbar(res.data.type);
                        uni.switchTab({
                            url: '/pages/tabbar-page/index-tabbar/index-tabbar'
                        });
                    }
                })
                .catch(err => {
                    console.log('错误', err);
                });
            // apiLogin2({ code: this.wxcode })
            //     .then(res => {
            //         console.log('请求登录', res);
            //         if (res.msg == '需绑定') {
            //             uni.navigateTo({
            //                 url: `/pages/register/register?code=${res.data}`
            //             });
            //         }
            //         if (res.msg == '登录成功') {
            //             uni.setStorageSync('userInfo', res.data);
            //             this.setUserTabbar(res.data.type);
            //             uni.switchTab({
            //                 url: '/pages/tabbar-page/index-tabbar/index-tabbar'
            //             });
            //         }
            //     })
            //     .catch(err => {
            //         console.log('错误', err);
            //     });
            /**
             * @openid
             * 获取微信用户openid,微信一键登录暂无相关接口,用于测试呼叫客服功能
             */
            wx.request({
                url: `https://api.weixin.qq.com/sns/jscode2session?appid=wx30f254cbb0b90b3c&secret=938a068410796cda21e5e03b9435cdbf&js_code=${this.wxcode}&grant_type=authorization_code`,
                success(res) {
                    let id = res.data.openid;
                    uni.setStorageSync('openid', id);
                    uni.showToast({
                        title: '成功获取测试openid',
                        icon: 'none'
                    });
                }
            });
            this.loginPopupShow = false
        },
        registerClick(){
        // 弹出层时间
        closePopup() {
            this.loginPopupShow = false;
        },
        openPopup() {
            console.log('打开了');
        },
        registerClick() {
            uni.navigateTo({
                url:"/pages/register/register"
            })
                url: '/pages/register/register'
            });
        }
    }
};
@@ -135,7 +154,7 @@
        width: 80%;
        font-size: 64rpx;
        color: #497bff;
        margin: 50rpx auto 0;
        margin: vww(100) auto 0;
        text-align: center;
    }
@@ -204,12 +223,29 @@
        padding: 0 70rpx;
    }
    .tenantList {
        font-size: 32rpx;
        width: 80%;
        height: 80rpx;
        text-align: center;
        margin: 50rpx auto 0;
    // 弹出框
    .loginPopup {
        .u-popup {
            .u-transition {
                .u-popup__content {
                    .popup-warp {
                        height: vww(200);
                        padding: vww(10) vww(20);
                        .body {
                            width: 100%;
                            height: 70%;
                        }
                        .btn {
                            display: flex;
                            justify-content: space-between;
                            .u-button {
                                width: 40%;
                            }
                        }
                    }
                }
            }
        }
    }
}
</style>
pages/register/register.vue
@@ -305,7 +305,7 @@
        uploadFilePromise(url) {
            return new Promise((resolve, reject) => {
                let a = uni.uploadFile({
                    url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
                    url: 'http://192.168.0.120:9999/admin/sys-file/uploadUnToken', // 仅为示例,非真实的接口地址
                    filePath: url,
                    name: 'file',
                    formData: {
pages/tabbar-page/index-tabbar/index-tabbar.vue
@@ -25,11 +25,11 @@
    },
    onShow() {
        this.init();
        this.userAuthorization();
    },
    methods: {
        init() {
            this.roleType = uni.getStorageSync('roleType');
            console.log(this.roleType, 'indexTabbar');
            switch (this.roleType) {
                case 1:
                    console.log('customerIndexRef');
@@ -52,6 +52,43 @@
                default:
                    break;
            }
        },
        // 要求用户授权相机/麦克风权限
        userAuthorization() {
            wx.getSetting({
                success(res) {
                    wx.startRecord();
                    console.log('success');
                    if (!res.authSetting['scope.record'] || !res.authSetting['scope.camera']) {
                        if (!res.authSetting['scope.camera']) {
                            wx.authorize({
                                scope: 'scope.camera',
                                success() {
                                    // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
                                    console.log('授权成功');
                                },
                                fail() {
                                    console.log('授权失败');
                                }
                            });
                        } else if (!res.authSetting['scope.record']) {
                            wx.authorize({
                                scope: 'scope.record',
                                success() {
                                    // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
                                    console.log('授权成功');
                                },
                                fail: () => {
                                    console.log('授权失败');
                                }
                            });
                        }
                    }
                },
                fail() {
                    console.log('获取失败');
                }
            });
        }
    }
};