zengh
2021-11-04 9049307d41c2ff9623bb2905457109e9ae8bebb4
Merge remote-tracking branch 'origin/master'
2 files added
709 ■■■■■ changed files
pages/grabOrders/feedback copy.vue 411 ●●●●● patch | view | raw | blame | history
pages/grabOrders/grabOrders - 副本.vue 298 ●●●●● patch | view | raw | blame | history
pages/grabOrders/feedback copy.vue
New file
@@ -0,0 +1,411 @@
<template>
    <view class="mapJQtijiao">
        <!-- <view class="head">
            <u-navbar :is-fixed="false" :border-bottom="false" :is-back="false" title=""
                :background="{ background: '#0cd7e5' }">
                <div>
                    处理结果
                </div>
            </u-navbar>
        </view> -->
        <view class="mapJQtijiaomain">
            <view class="title" style="padding-top: 0.5rem;">请输入活动心得:</view>
            <view class="f">
                <view class="main" style="margin:0 1rem;">
                    <textarea rows="9" cols="27" placeholder="请输入活动心得。" v-model="longInputD"></textarea>
                </view>
            </view>
            <view class="title" style="padding-top: 0.5rem;">请输入我的意见:</view>
            <view class="f">
                <view class="main" style="margin:0 1rem;">
                    <textarea rows="9" cols="27" placeholder="请输入我的意见。" v-model="longInputD1"></textarea>
                </view>
            </view>
            <view class="title">照片上传:</view>
            <view class="t">
                <view class="main">
                    <image @tap="takePhoto" src="../../static/JQimg/xiangji.png" mode=""></image>
                </view>
                <view class="mains">
                    <seeImgs class="seeImgs" :imgs="imgs" :videos="[]" @del="delImg" :type="'imgs'"></seeImgs>
                </view>
            </view>
            <view class="title">视频上传:</view>
            <view class="s">
                <view class="main">
                    <image @tap="takeVideo" src="../../xcxMapJQ/img/shiping.png" mode=""></image>
                </view>
                <view class="mains">
                    <seeImgs class="seeImgsVideo" :imgs="[]" :videos="videos" @del="delVideo" :type="'videos'">
                    </seeImgs>
                </view>
            </view>
            <view class="butb">
                <u-button class="custom-style" type="primary" @click="inits()">我反馈</u-button>
            </view>
        </view>
    </view>
</template>
<script>
    import seeImgs from '../../components/seeImges/seeImges.vue'
    export default {
        components: {
            seeImgs
        },
        data() {
            return {
                datas: '',
                longInputD: '',//心得
                longInputD1: '',//意见
                imgs: [],
                videos: [],
                data:{}
            }
        },
        methods: {
            onLoad: function(option) {
                var b;
                if (option.data == undefined) {
                    this.data = {
                        rname: '无数据',
                        content: '无数据',
                        district: '无数据',
                        place: '无数据',
                        time: '无数据',
                        num: "无数据",
                        ourNum: "无数据",
                        inNum: "无数据",
                        infor: "无数据"
                    }
                    return;
                }
                try {
                    b = JSON.parse(option.data);
                } catch (e) {
                    //TODO handle the exception
                }
                // console.log(b);
                this.data = b;
            },
            upData() {
                console.log('开始上传');
                var dataList = {
                    jid: this.datas.id,
                    sname: this.$store.state.puserName,
                    phone: this.$store.state.puserIphone,
                    snumber: this.$store.state.puserID,
                    result: this.longInputD,
                    status: 0,
                    tpaddress: '',
                    spaddress: ''
                };
                if (this.imgs.length > 0) {
                    var i = this.imgs;
                    for (var k in i) {
                        // console.log(i[k].src)
                        dataList.tpaddress += i[k].src + ','
                    }
                }
                if (this.videos.length > 0) {
                    var i = this.videos;
                    for (var k in i) {
                        // console.log(i[k].src)
                        dataList.spaddress += i[k].src + ','
                    }
                }
                // console.log(dataList)
                wx.showLoading({
                    title: "提交中...",
                    mask: true
                })
                // console.log(dataList);
                wx.request({
                    url: that.$store.state.piAPI + '/feedback/feedback/saves', //仅为示例,并非真实接口地址。
                    data: dataList,
                    method: 'POST',
                    header: {
                        "Content-Type": "application/x-www-form-urlencoded"
                    },
                    success: (res) => {
                        if (res.data.code == 200) {
                            wx.showToast({
                                title: '提交成功!',
                                duration: 1000
                            });
                            var time = setTimeout(() => {
                                clearTimeout(time);
                                time = null;
                                uni.redirectTo({
                                    url: '/pages/alarm_list/alarm_list'
                                });
                            }, 1500)
                        }
                    }
                });
            },
            takePhoto() {
                var that = this;
                wx.chooseImage({
                    count: 4, //可选择数量,默认9
                    sizeType: ['compressed', 'original'], //上传压缩图,原图
                    sourceType: ['album', 'camera'], //从相册选择或从使用相机
                    success: async (res) => {
                        for (var i = 0; i < res.tempFiles.length; i++) {
                            if (res.tempFiles[i].size > 10 * 1024 * 1000) { //上传图片大小限制
                                uni.showToast({
                                    title: "照片大小不能10MB",
                                    icon: "none"
                                })
                                return
                            }
                        }
                        var tempFilePath = res.tempFilePaths;
                        // try {
                        wx.showLoading({
                            title: "上传中...",
                            mask: true
                        })
                        var that = this;
                        // 循环调用uni.uploadFile ,因微信小程序只支持单文件上传
                        for (var i = 0; i < tempFilePath.length; i++) {
                            wx.uploadFile({
                                // url: 'https://web.byisf.com/api/depl/put-depl', //仅为示例,非真实的接口地址
                                url: 'http://web.byisf.com:82/blade-jfpts/depl/put-depl',
                                filePath: tempFilePath[i],
                                name: 'file',
                                formData: {
                                    'user': 'test' // 上传附带参数
                                },
                                success: (data) => {
                                    wx.showToast({
                                        title: '上传图片成功!',
                                        duration: 1000
                                    });
                                    // 根据接口具体返回格式   赋值具体对应url
                                    that.imgs.push({
                                        id: i,
                                        src: JSON.parse(data.data).data
                                    })
                                }
                            });
                        }
                        // } catch (e) {
                        //     console.log(e);
                        //     wx.showToast({
                        //         title: '上传图片失败!',
                        //         duration: 2000
                        //     });
                        // } finally {
                        //     wx.hideLoading();
                        // }
                    }
                });
            },
            delImg(index) {
                this.imgs.splice(index, 1);
                // console.log(this.imgs)
            },
            takeVideo() {
                var that = this;
                wx.chooseVideo({
                    sourceType: ['album', 'camera'],
                    maxDuration: 60,
                    camera: 'back',
                    success(res) {
                        var tempFilePath = res.tempFilePath;
                        // try {
                        wx.showLoading({
                            title: "上传中...",
                            mask: true
                        })
                        wx.uploadFile({
                            // url: 'https://web.byisf.com/api/depl/put-depl', //仅为示例,非真实的接口地址
                            url: 'http://web.byisf.com:82/blade-jfpts/depl/put-depl',
                            filePath: tempFilePath,
                            name: 'file',
                            formData: {
                                'user': 'test' // 上传附带参数
                            },
                            success: (data) => {
                                wx.showToast({
                                    title: '上传视频成功!',
                                    duration: 1000
                                });
                                //         // 根据接口具体返回格式   赋值具体对应url
                                that.videos.push({
                                    id: that.videos.length,
                                    src: JSON.parse(data.data).data
                                })
                                // console.log(JSON.parse(data.data).data)
                            }
                        });
                        // } catch (e) {
                        // console.log(e);
                        // wx.showToast({
                        //     title: '上传视频失败!',
                        //     duration: 2000
                        // });
                        // } finally {
                        // wx.hideLoading();
                        // }
                    }
                })
            },
            delVideo(index) {
                this.videos.splice(index, 1);
                // console.log(this.imgs)
            },
        },
        onLoad(e) {
            if (e.id == undefined) {
                e = {
                    id: 422
                }
            }
            // console.log(e);
            this.datas = e;
        },
        inits(){
            console.log(123)
        }
        // onLoad: function(option) {
        //     var b;
        //     if (option.data == undefined) {
        //         this.data = {
        //             alarmType: '无数据',
        //             bz: '无数据',
        //             district: '无数据',
        //             place: '无数据',
        //             alarmTime: '无数据',
        //             num: "无数据",
        //             ourNum: "无数据",
        //             inNum: "无数据",
        //             infor: "无数据"
        //         }
        //         return;
        //     }
        //     try {
        //         b = JSON.parse(option.data)
        //     } catch (e) {
        //         //TODO handle the exception
        //     }
        //     console.log(b);
        //     this.data = b;
        // }
    }
</script>
<style lang="scss">
    page {
        width: 100%;
        height: 100%;
    }
    .mapJQtijiao {
        width: 100%;
        height: 100%;
        margin: 0 auto;
        // .head {
        //     position: relative;
        //     top: 0;
        //     left: 0;
        //     z-index: 1;
        //     font-size: 16px;
        //     font-weight: 600;
        //     text-align: center;
        //     div {
        //         width: 100%;
        //         border: 1px solid rgba($color: #000000, $alpha: 0);
        //     }
        // }
        .mapJQtijiaomain {
            width: 100%;
            height: 100%;
            // border: 1px solid #000000;
            box-sizing: border-box;
            background-color: #F7F7F7;
            .title {
                margin-left: 1rem;
                margin-bottom: 0.5rem;
            }
        }
        .f {
            background-color: #fff;
            padding: 0.5rem 0 0.5rem 0;
            margin-bottom: 0.5rem;
            .main {
                margin: 0.5rem;
                border: 1px solid rgba($color: #000000, $alpha: 0.5);
                height: 8rem;
            }
        }
        .t,
        .s {
            background-color: #fff;
            padding: 0.5rem 0 0.5rem 0;
            // margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            // border: 1px solid green;
            height: 95px;
            width: 100%;
            .main {
                // border: 1px solid red;
                image {
                    width: 3rem;
                    height: 3rem;
                    margin-left: 1rem;
                }
            }
            .mains {
                // border: 1px solid red;
                width: calc(100% - 3rem);
                height: 75px;
            }
        }
        .butb {
            margin: 1rem auto;
            width: 6rem;
            height: 3rem;
            // // border: 1px solid rgb(46, 118, 228);
            // border-radius: 1rem;
            // display: flex;
            // font-size: 18px;
            // align-items: cent1er;
            // justify-con1tent: center;
            // color: #fff;
            // background-image: linear-gradient(to right, #4adeff, #55ffff);
        }
    }
    // .seeImgs{
    //     width: 80%;
    //     position:absolute ;
    //     top: 13.3rem;
    //     right: 0;
    // }
    // .seeImgsVideo{
    //     width: 80%;
    //     position:absolute ;
    //     top: 19.8rem;
    //     right: 0;
    // }
    .custom-style {
        background-image: linear-gradient(to right, #08EFF6, #0693FD);
        border-radius: 20px;
    }
</style>
pages/grabOrders/grabOrders - 副本.vue
New file
@@ -0,0 +1,298 @@
<template>
    <view class="grabOrders">
        <view>
            <u-tabs-swiper ref="uTabs" :list="list" :current="current" @change="tabsChange" :is-scroll="false"
                swiperWidth="750"></u-tabs-swiper>
        </view>
        <swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"
            style="height: calc(100% - 40px);width: 100%;">
            <swiper-item class="swiper-item" v-for="(item, index) in list" :key="index"
                style="height: 100%;width: 100%;">
                <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="onreachBottom">
                    <!-- <page0 :listData="listData0" :swiperCurrent="0" v-if="item.name == '正在进行'"
                        @openOnce="openOnce" @getOrders="getOrders"></page0>
                    <page1 :listData="listData1" :swiperCurrent="1" v-if="item.name == '抢单池'"
                        @openOnce="openOnce" @getOrders="getOrders"></page1> -->
                        <view class="a">
                            {{listData0}}
                        </view>
                        <view class="b">
                            {{listData1}}
                        </view>
                </scroll-view>
            </swiper-item>
        </swiper>
    </view>
</template>
<script>
    import page0 from "./inPage/page0.vue"
    import page1 from "./inPage/page1.vue"
    export default {
        components: {
            page0,
            page1
        },
        data() {
            return {
                list: [{
                    name: '正在进行'
                }, {
                    name: '抢单池'
                }],
                // 因为内部的滑动机制限制,请将tabs组件和swiper组件的current用不同变量赋值
                current: 0, // tabs组件的current值,表示当前活动的tab选项
                swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
                listData0: [],
                listData1: [],
            };
        },
        watch: {
            current() {
                // console.log(this.current)
                this.getGrabOrders(this.swiperCurrent);
            },
            change() {
                this.getGrabOrders(this.swiperCurrent);
            }
        },
        mounted() {
            this.getGrabOrders();
        },
        computed: {
            change() {
                return this.$store.state.gotuGrabOrders;
            }
        },
        methods: {
            // tabs通知swiper切换
            tabsChange(index) {
                this.swiperCurrent = index;
                console.log(index)
            },
            // swiper-item左右移动,通知tabs的滑块跟随移动
            transition(e) {
                let dx = e.detail.dx;
                this.$refs.uTabs.setDx(dx);
            },
            // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
            // swiper滑动结束,分别设置tabs和swiper的状态
            animationfinish(e) {
                let current = e.detail.current;
                this.$refs.uTabs.setFinishCurrent(current);
                this.swiperCurrent = current;
                this.current = current;
            },
            // scroll-view到底部加载更多
            onreachBottom() {
            },
            openOnce(val) {
                // console.log(this.swiperCurrent)
                val['type'] = this.swiperCurrent;
                val['serid'] = uni.getStorageSync('ids') + ",";
                val['appenUrl'] = this.$store.state.piAPI;
                // val['apendurl'] = this.swiperCurrent;
                // if (this.swiperCurrent == 1) {
                //     uni.navigateTo({
                //         url: './task?data=' + JSON.stringify(val),
                //     });
                // } else {
                //     uni.navigateTo({
                //         url: './task?data=' + JSON.stringify(val),
                //     });
                // }
                //打开地图
                uni.navigateTo({
                    url: './map?data=' + JSON.stringify(val)
                })
            },
            getGrabOrders(val = 0) {
                //获取全部的数据
                // console.log("beggggg")
                // this["listData" + val] = [];
                let that = this,
                    d = {
                        serid: uni.getStorageSync('ids'),
                        type: val + '',
                    };
                uni.request({
                    url: this.$store.state.piAPI + "/taskqd/selectLi",
                    method: "POST",
                    data: d,
                    header: {
                        "content-type": "application/x-www-form-urlencoded"
                    },
                    success(res) {
                        const data = res.data.data;
                console.log(val)
                        console.log(data)
                        if (val == 0) {
                            that.listData0 = data;
                        } {
                            // that.listData1 = data;
                        }
                        console.log(that.listData0,that.listData1)
                    }
                })
            },
            getOrders(b) {
                let val = b.val,
                    item = b.item;
                console.log(val, item)
                let that = this;
                if (val != 0) { //接单
                    //
                    // let d = {
                    //     city:item.city,
                    //     city:item.city,
                    //     city:item.city,
                    //     city:item.city,
                    //     city:item.city,
                    //     city:item.city,
                    //     city:item.city,
                    // }
                    item['serid'] = uni.getStorageSync('ids') + ",";
                    // console.log(item)
                    // return;
                    uni.request({
                        url: this.$store.state.piAPI + "/taskqd/Graborder",
                        method: "POST",
                        // data: {
                        //     securityId: this.$store.state.puserID,
                        //     status: tab
                        // },
                        header: {
                            'content-type': "application/json"
                        },
                        data: item,
                        success(res) {
                            const data = res.data.msg;
                            console.log(data)
                            if (data == "抢单成功") {
                                uni.showToast({
                                    title: data,
                                    duration: 2000
                                });
                            }
                            // that.listData = data;
                            // that.getGrabOrders(this.);
                            that.$store.commit("changegotuGrabOrders");
                        }
                    })
                } else { //反馈
                    //
                    uni.navigateTo({
                        url: './feedback?data=' + JSON.stringify(item)
                        // url: "./feedback"
                    })
                }
            }
        }
    };
</script>
<style scoped lang="scss">
    page .grabOrders {
        height: 100%;
        width: 100%;
    }
    // .once {
    //     width: calc(100% - 10px);
    //     height: 100px;
    //     border: 1px solid #d0d0d0;
    //     padding: 8px;
    //     box-sizing: border-box;
    //     margin: 5px;
    //     border-radius: 8px;
    //     display: flex;
    //     align-items: center;
    //     justify-content: center;
    //     .onve-left {
    //         width: 75%;
    //         display: flex;
    //         align-items: center;
    //         justify-content: center;
    //         .o-l-img {
    //             width: 80px;
    //             height: 80px;
    //             background-color: #d0d0d0;
    //             margin-right: 5px;
    //             border-radius: 7px;
    //             image {
    //                 width: 100%;
    //                 height: 100%;
    //                 border-radius: 7px;
    //             }
    //         }
    //         .o-l-main {
    //             width: calc(100% - 85px);
    //             height: 80px;
    //             display: flex;
    //             // align-items: center;
    //             justify-content: center;
    //             flex-direction: column;
    //             .o-l-m-up {
    //                 height: 30px;
    //                 font-size: 16px;
    //             }
    //         }
    //     }
    //     .onve-right {
    //         width: 25%;
    //         display: flex;
    //         align-items: center;
    //         justify-content: center;
    //         flex-direction: column;
    //         view {
    //             margin-top: 10px;
    //         }
    //     }
    //     // .onceUp {
    //     //     width: 100%;
    //     //     height: 25%;
    //     //     padding-bottom: 5px !important;
    //     //     border-bottom: 1px solid #d0d0d0;
    //     // }
    //     // .onceMain {
    //     //     width: 100%;
    //     //     height: 80%;
    //     //     display: flex;
    //     //     align-items: center;
    //     //     justify-content: center;
    //     //     .o-m-left {
    //     //         width: 80%;
    //     //         height: 100%;
    //     //         border: 1 solid #d0d0d0;
    //     //         display: flex;
    //     //         // align-items: center;
    //     //         justify-content: center;
    //     //         flex-direction: column;
    //     //         view {
    //     //             margin-top: 2.5px;
    //     //             padding-bottom: 2.5px;
    //     //         }
    //     //     }
    //     // }
    // }
    // .orange {
    //     color: orange;
    // }
    // .green {
    //     color: #00ba15;
    // }
</style>