付延余
2023-03-21 d36eb757af8867278125c6999fcaa5bdb902151c
司机称重页面,签到页面
11个文件已修改
236 ■■■■ 已修改文件
api/globalApi.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/publicInterface.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/request.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/customer-page/customer-index/customer-index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/appointment/appointment.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/login/userPassword.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/util.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/globalApi.js
@@ -126,7 +126,6 @@
        method: "GET"
    },
    //    用户
    // 获取用户信息
    getUserEntity: {
@@ -235,10 +234,15 @@
        url: "/wrzs/userOperation/weighList",
        method: 'GET'
    },
    // 获取所在磅房
    getWeighHouse:{
        url:"/wrzs/jccoalweighhouse/getWeighHouse",
        method:'GET'
    },
    // 提煤单日志查询
    coalDayPage: {
        url: "/wrzs/tmtaskcoallog/page",
        url: "/wrzs/tmtaskcoallog/getTmId",
        method: 'GET'
    }
}
api/publicInterface.js
@@ -4,7 +4,7 @@
// const BaseUrl = "http://192.168.3.159:9999/";
import {BaseUrl as wrBaseUrl} from '@/api/request.js'
// const BaseUrl = "http://192.168.0.120:9999"
const BaseUrl = "http://192.168.0.130:9999"
const BaseUrl = "http://192.168.3.130:9999"
// 登录
// function apiLogin({
api/request.js
@@ -80,8 +80,8 @@
// const BaseUrl = "http://192.168.0.120:9997"
// const webSocketUrl = "ws://192.168.0.120:9997/wrzs/ws/info"
const BaseUrl = "http://192.168.0.130:9997";
const webSocketUrl = "ws://192.168.0.130:9997/wrzs/ws/info"
const BaseUrl = "http://192.168.3.130:9997";
const webSocketUrl = "ws://192.168.3.130:9997/wrzs/ws/info"
// 请求拦截
const fetch = (url, opt) => {
pages.json
@@ -147,17 +147,15 @@
                "enablePullDownRefresh": false
            }
        }, {
            "path": "pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock",
            "style": {
                "navigationBarTitleText": "矿场签到",
                "enablePullDownRefresh": false
            }
        }
        ,{
            "path" : "pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock",
            "style" :
            {
                "navigationBarTitleText": "",
                "enablePullDownRefresh": false
            }
        }
    ],
    ],
    "tabBar": {
        // "color": "#999794",
        // "selectedColor": "#007AFF",
pages/customer-page/customer-index/customer-index.vue
@@ -61,7 +61,6 @@
<script>
import card from '@/components/card/card.vue';
import { customerId } from '@/utils/status';
import { todayDate } from '@/utils/util.js';
export default {
    components: {
        card
pages/driver-page/appointment/appointment.vue
@@ -22,7 +22,6 @@
<script>
import combinedTitle from '@/components/combined-title/combined-title.vue';
import { BigNumber } from 'bignumber.js';
export default {
    components: {
        combinedTitle
@@ -95,6 +94,9 @@
            this.$reqPost('yuYue', { takeCoalId: this.yuYuePostParams.takeCoalId, yuYueId: this.yuYuePostParams.yuYueId }, 'params').then(res => {
                if (res.code == 0) {
                    this.$u.toast('预约成功!');
                    uni.navigateBack({
                        delta: 1
                    })
                } else {
                    this.$u.toast(res.data ? res.data : '预约失败');
                }
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
@@ -11,7 +11,7 @@
                <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>
@@ -30,29 +30,52 @@
        return {
            orderPlanId: null,
            yyId: null,
            dayRZ: []
            dayRZ: [],
            coalDetailsData: {}, // 提煤单详情
            getWeightHouseObj: {
                // 获取所在磅房
                deptId: '',
                filedId: '',
                tmId: '',
                tmCode: '',
                carNo: ''
            }
        };
    },
    onShow() {
        this.init();
    },
    computed:{
        userName(){
            return uni.getStorageSync('username')
    computed: {
        userName() {
            return uni.getStorageSync('username');
        },
        openid(){
            return uni.getStorageSync('openid')
        openid() {
            return uni.getStorageSync('openid');
        }
    },
    methods: {
        init() {
            this.coalDayPage();
            this.getTakeCoal();
        },
        // 获取提煤单详情
        getTakeCoal() {
            this.$reqGet('getTakeCoal', { takeCoalId: this.orderPlanId }).then(res => {
                if (res.code == 0) {
                    this.coalDetailsData = res.data[0];
                    this.getWeightHouseObj.deptId = this.coalDetailsData.deptId;
                    this.getWeightHouseObj.filedId = this.coalDetailsData.filedId;
                    this.getWeightHouseObj.tmId = this.coalDetailsData.id;
                    this.getWeightHouseObj.tmCode = this.coalDetailsData.code;
                    this.getWeightHouseObj.carNo = this.coalDetailsData.carNo;
                }
            });
        },
        // 日志查询
        coalDayPage() {
            this.$reqGet('coalDayPage').then(res => {
            this.$reqGet('coalDayPage', { id: this.orderPlanId }).then(res => {
                if (res.code == 0) {
                    this.dayRZ = res.data.records;
                    this.dayRZ = res.data;
                }
            });
        },
@@ -64,8 +87,8 @@
        },
        // 签到
        arriveClick() {
            this.$reqPost('arrive', { id: this.orderPlanId }, 'params').then(res => {
                console.log(res, '签到');
            uni.navigateTo({
                url: `/pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock?orderPlanId=${this.orderPlanId}`
            });
        },
        // 入场申请
@@ -75,9 +98,9 @@
            });
        },
        // 呼叫客服
        callCustomerService(){
        callCustomerService() {
            wx.join1v1Chat({
                caller: { nickname:this.userName , openid: this.openid },
                caller: { nickname: this.userName, openid: this.openid },
                listener: { nickname: '客服', openid: 'orutI5YT0yEvARVngdsTmBpisWmw' }, // 这里的openid是fyy的,充当固定的客服openid
                backgroundType: 2,
                roomType: 'voice'
@@ -85,13 +108,17 @@
        },
        // 称重
        cengZhongClick() {
            uni.navigateTo({
                url:`/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}`
            })
            this.$reqGet('getWeighHouse', this.getWeightHouseObj).then(res => {
                console.log(res, '获取磅房');
                if(res.code == 0){
                    uni.navigateTo({
                        url: `/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}&sceneId=${res.data.id}&gateCameraId=${res.data.gateCameraId}&gateCameraCode=${res.data.gateCameraCode}&weighCode=${res.data.weighCode}`
                    });
                }else{
                    this.$u.toast('未在磅房,请前往磅房后再试!!')
                }
            });
        }
        /**
         * @desc 等待取煤单接口
         * */
    }
};
</script>
@@ -127,8 +154,8 @@
        padding: vww(20);
        box-sizing: border-box;
        overflow-y: overlay; //行为与 auto 相同,但是滚动条绘制在内容之上,而不是占据空间。
        .u-text{
            margin-bottom: vww(5)!important;
        .u-text {
            margin-bottom: vww(5) !important;
        }
    }
    .utilsBox {
pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue
@@ -3,40 +3,80 @@
    <view class="punchTheClock">
        <!-- 打卡按钮 -->
        <view class="punchTheClock_container">
            <view class="punchTheClock_btn">签到/打卡</view>
            <view class="punchTheClock_text"><text>未进入考勤区域</text></view>
            <view class="punchTheClock_btn">
                <view class="">
                    <p>签到/打卡</p>
                    <p>{{ nowTime }}</p>
                </view>
            </view>
            <view class="punchTheClock_text">
                <u-icon name="map" color="#51e30d" size="30"></u-icon>
                <text>未进入矿场区域</text>
            </view>
        </view>
    </view>
</template>
<script>
import { todayDate } from '@/utils/util.js';
export default {
    data() {
        return {};
    onLoad(params){
        if(params.orderPlanId){
            this.orderPlanId = params.orderPlanId
        }
    },
    methods: {}
    data() {
        return {
            nowTime: '',
            orderPlanId:null
        };
    },
    onShow() {
        this.todayDate();
    },
    methods: {
        todayDate() {
            setInterval(() => {
                this.nowTime = todayDate('hms');
            }, 1000);
        },
        // 签到
        arrive(){
            this.$reqPost('arrive', { id: this.orderPlanId }, 'params').then(res => {
                console.log(res, '签到');
            });
        }
    }
};
</script>
<style lang="scss" scoped>
.punchTheClock{
    display:flex;
.punchTheClock {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    .punchTheClock_container{
        .punchTheClock_btn{
            width:vww(240);
            height:vww(240);
    .punchTheClock_container {
        .punchTheClock_btn {
            width: vww(240);
            height: vww(240);
            color: #ffffff;
            font-size: vww(20);
            border-radius: 50%;
            background-color: #ffd63e;
            display:flex;
            background-color: #36d4e5;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .punchTheClock_text{
        .punchTheClock_text {
            display:flex;
            justify-content: center;
            margin-top: vww(20);
            color: #b8b8b8;
            .text{
                margin-left:vww(5);
            }
        }
    }
}
</style>
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
@@ -2,7 +2,9 @@
    <view class="weighingDevice">
        <view class="one">
            <view class="top">
                <view class="top_left"><text>41.5</text></view>
                <view class="top_left">
                    <text>{{ realTimeWeigh }}</text>
                </view>
                <view class="top_right">
                    <view class="">
                        称重:
@@ -42,12 +44,28 @@
import { webSocketUrl } from '@/api/request.js';
export default {
    onLoad(params) {
        console.log('称重页面', params);
        this.takeCoalId = params.takeCoalId;
        this.weighData.sceneId = params.sceneId;
        this.weighData.gateCameraId = params.gateCameraId;
        this.weighData.equipmentCode = params.gateCameraCode;
        this.weighCode = params.weighCode;
    },
    data() {
        return {
            weighData: {
                //确认称重接口参数
                deptId: '',
                tmId: '',
                sceneId: '',
                carNo: '',
                gateCameraId: '',
                equipmentCode: '',
                weigh: '',
                tmCode: ''
            },
            takeCoalId: null,
            weighCode: '',
            realTimeWeigh: '',
            weighList: {},
            webSocket: null // webSocket实例
            // lockReconnect: false, // 重连锁,避免多次重连
@@ -78,6 +96,10 @@
                console.log(res, '获取称重信息');
                if (res.code == 0) {
                    this.weighList = res.data;
                    this.weighData.deptId = res.data.deptId;
                    this.weighData.tmId = res.data.id;
                    this.weighData.carNo = res.data.carNo;
                    this.weighData.tmCode = res.data.code;
                }
            });
        },
@@ -85,16 +107,17 @@
         * @确认称重等待后端提供实时称重接口,获取皮重,毛重
         */
        confirmWeigh() {
            // this.$reqPost('saveWeigh',{id:this.takeCoalId,skin:'',hair:''}).then(res=>{
            //     console.log(res,"确认称重");
            // })
            console.log('确认称重', this.weighData);
            this.$reqPost('saveWeigh',this.weighData,'json').then(res=>{
                console.log(res,"确认称重");
            })
        },
        /**
         * 初始化 weoSocket
         */
        initWebSocket() {
            // let wsUrl = `wss://192.168.0.120:9997/wrzs/ws/info?access_token=${this.token}`;
            let wsUrl = `${webSocketUrl}?access_token=c954c7f5-f34b-453e-8c9d-e291747b401f`;
            let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}`;
            socket = uni.connectSocket({
                url: wsUrl,
                header: {
@@ -108,7 +131,12 @@
                console.log('onOpen');
            });
            socket.onMessage(res => {
                console.log(res, '服务器返回的数据');
                console.log('socketWeigh', res);
                let nowWeigh = JSON.parse(res.data.slice(7)).weigh;
                // if (nowWeigh.eqCode == this.weighCode) {
                //     this.weighData.weigh = this.realTimeWeigh = nowWeigh;
                // }
                this.weighData.weigh = this.realTimeWeigh = nowWeigh;
            }); // 获取服务器传来的数据,做相应处理
            socket.onClose(() => {
                console.log('close');
pages/login/userPassword.vue
@@ -43,8 +43,9 @@
    },
    data() {
        return {
            username: 'appuser',// 客户
            // username: '12222222222',// 客户
            // username: '18805080506',// 王楠(司机)
            username: '13333333332',// driver
            password: '123456',
            remember: true,
            baseUrl: ''
utils/util.js
@@ -1,7 +1,16 @@
export function todayDate(){
export function todayDate(arg){
    let date = new Date()
    let year = date.getFullYear()
    let month = date.getMonth() + 1;
    let day = date.getDate()
    return year + '-' + month + '-' + day
    let hour = date.getHours()
    let minutes = date.getMinutes()
    let seconds = date.getSeconds()
    console.log(arg,'时间');
    if(arg == 'hms'){
        hour = hour < 10 ? '0' + hour : hour
        minutes = minutes < 10 ? '0' + minutes : minutes
        seconds = seconds < 10 ? '0' + seconds : seconds
        return hour+':'+minutes+':' + seconds
    }
}