xuqiang 4 rokov pred
rodič
commit
1431d598f5
6 zmenil súbory, kde vykonal 342 pridanie a 47 odobranie
  1. 1 1
      src/App.vue
  2. 2 0
      src/main.js
  3. 235 0
      src/pages/cleanReport.vue
  4. 44 15
      src/pages/complaint.vue
  5. 1 1
      src/pages/my.vue
  6. 59 30
      src/pages/repairReport.vue

+ 1 - 1
src/App.vue

@@ -4,7 +4,7 @@ export default {
         wx.login({
             success: res => {
                 this.$http.setToken(
-                    'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ4cTEyMzQiLCJleHAiOjE2Mzg5NjEwOTcsImlhdCI6MTYzODk1NzQ5N30.jBlJLfOAaR5e-zpp9WeS6zDHOmOWnZswuJib2WlP9Nd2JRL9Z_z-2Bmy_abUlxNYxntcTh-RQQVUIljrOblfZg'
+                    'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ4cTEyMzQiLCJleHAiOjE2MzkwMzE3OTksImlhdCI6MTYzOTAyODE5OX0.gDoUBmQWg4FsBDnUkf-msC9s0BoCUCiGCBPa5P-Ej3Vyhau0gU912nQiu6Z0tslrM09D9frChoazrMg6-NhhZg'
                 );
                 this.$store.dispatch('updateUserInfo');
                 // this.$http

+ 2 - 0
src/main.js

@@ -26,6 +26,8 @@ export default {
         // pages 的首个页面会被编译成首页
         pages: [
             'pages/my',
+            'pages/cleanReport',
+
             'pages/without',
             'pages/home',
             'pages/login',

+ 235 - 0
src/pages/cleanReport.vue

@@ -0,0 +1,235 @@
+<config>
+{
+    "navigationBarTitleText": "申请打扫",
+}
+</config>
+<template>
+    <div class="container">
+        <div class="content">
+            <div class="box-bottom">
+                <van-field :border="false" label="申请打扫" readonly> </van-field>
+                <van-field
+                    :value="content"
+                    @input="content = $event.detail"
+                    :border="false"
+                    rows="1"
+                    autosize
+                    type="textarea"
+                    placeholder="填写备注"
+                />
+            </div>
+            <div class="num">{{ content.length }}/200</div>
+            <div class="box-bottom">
+                <van-field label="打扫图片" :border="false" readonly> </van-field>
+                <van-uploader max-count="5" :file-list="images" :after-read="afterRead" @delete="deleteImg" />
+            </div>
+        </div>
+        <div class="btn-list">
+            <van-button :disabled="!canSubmit" type="default" @click="submit">提交</van-button>
+        </div>
+    </div>
+</template>
+<script>
+import { mapState } from 'vuex';
+export default {
+    name: 'repairReport',
+    metaInfo: {
+        title: '申请打扫'
+    },
+    data() {
+        return {
+            content: '',
+            imagesBox: [],
+            images: [],
+            image: []
+        };
+    },
+    computed: {
+        ...mapState(['roomInfo']),
+        canSubmit() {
+            if (this.content && this.images.length != 0) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+    },
+    methods: {
+        // afterRead(file) {
+        //     this.showLoading();
+        //     this.$http
+        //         .uploadFile(file.path)
+        //         .then(res => {
+        //             this.imgBox = false;
+        //             this.hideLoading();
+        //             this.image = [
+        //                 {
+        //                     url: res
+        //                 }
+        //             ];
+        //             this.imagesBox.push(this.image);
+        //             this.imagesBox.map(item => {
+        //                 this.images = item.map(i => {
+        //                     // console.log(i.url);
+        //                     return i.url;
+        //                 });
+        //             });
+        //             console.log(this.images);
+        //         })
+
+        //         .catch(e => {
+        //             this.hideLoading();
+        //             wx.showToast({
+        //                 icon: 'none',
+        //                 title: e.error
+        //             });
+        //         });
+        // },
+        afterRead(file) {
+            this.showLoading();
+            this.$http
+                .uploadFile(file.path)
+                .then(res => {
+                    this.imgBox = false;
+                    this.hideLoading();
+                    this.images = [
+                        {
+                            url: res
+                        }
+                    ];
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
+        },
+        deleteImg(e) {
+            let list = [...this.images];
+            list.splice(e.detail.index, 1);
+            this.images = list;
+        },
+        submit() {
+            if (!this.content) {
+                wx.showToast({
+                    icon: 'none',
+                    title: '请填写申请描述'
+                });
+                return;
+            }
+            this.$http
+                .post('/cleaningInfo/create', {
+                    targetId: this.roomInfo.roomId,
+                    cleaningType: 'ROOM',
+                    images: this.images[0].url
+                })
+                .then(res => {
+                    console.log(res);
+                    // this.$router.replace({
+                    //     name: 'result',
+                    //     params: {
+                    //         title: '提交成功',
+                    //         type: 'success',
+                    //         desc: '您已成功提交申请打扫服务',
+                    //         showBack: true
+                    //     }
+                    // });
+                })
+                .catch(e => {
+                    this.hideLoading();
+                    wx.showToast({
+                        icon: 'none',
+                        title: e.error
+                    });
+                });
+        }
+    }
+};
+</script>
+<style lang="less" scoped>
+.container {
+    .content {
+        width: calc(100vw - 30px);
+        height: 150px;
+        display: block;
+        margin: 20px auto 0 auto;
+        // background: #f2f4f5;
+        border-radius: 5px;
+        textarea {
+            width: 100%;
+            height: calc(100% - 30px);
+            padding: 15px;
+            resize: none;
+            border: none;
+            outline: none;
+            background: #f2f4f5;
+            font-size: 13px;
+            color: black;
+            line-height: 22px;
+        }
+        .num {
+            font-size: 13px;
+            color: #aaacad;
+            padding-right: 15px;
+            line-height: 18px;
+            text-align: right;
+        }
+    }
+    /deep/ .van-uploader {
+        padding-left: 14px;
+    }
+    /deep/.form {
+        position: relative;
+        .van-cell {
+            --cell-vertical-padding: 18px;
+            --cell-horizontal-padding: 18px;
+            --field-label-color: #000000;
+            --cell-text-color: #000;
+            .van-field__label,
+            .van-cell__title {
+                font-weight: bold !important;
+                font-size: 14px !important;
+            }
+
+            .van-cell__value {
+                // text-align: left;
+            }
+            &::after {
+                left: 100px !important;
+            }
+        }
+    }
+    .box-bottom {
+        /deep/ .van-field__label {
+            margin: 10px 0 0 2px;
+            font-weight: bold;
+            color: #000;
+            /deep/ .van-field__body {
+                margin-left: 3px !important;
+            }
+        }
+    }
+    .btn-list {
+        position: fixed;
+        width: 100%;
+        bottom: 0;
+        background: #ffffff;
+        padding-left: 43px;
+        z-index: 999;
+        .bottom();
+        /deep/.van-button {
+            width: 290px;
+            height: 48px;
+            background: @prim;
+            border-radius: 12px;
+            line-height: 48px;
+            text-align: center;
+            font-size: 16px;
+            font-weight: normal;
+            color: #ffffff;
+        }
+    }
+}
+</style>

+ 44 - 15
src/pages/complaint.vue

@@ -5,18 +5,22 @@
 </config>
 <template>
     <div class="container">
-        <div class="box-bottom">
-            <van-field :border="false" label="投诉/建议" readonly> </van-field>
-            <van-field
-                :value="form.description"
-                @input="form.description = $event.detail"
-                :border="false"
-                rows="1"
-                autosize
-                type="textarea"
-                placeholder="请输入你的投诉信息或建议信息"
-            />
+        <div class="content">
+            <div class="box-bottom">
+                <van-field :border="false" label="投诉/建议" readonly> </van-field>
+                <van-field
+                    :value="content"
+                    @input="content = $event.detail"
+                    :border="false"
+                    rows="1"
+                    autosize
+                    type="textarea"
+                    placeholder="请输入你的投诉信息或建议信息"
+                />
+                <div class="num">{{ content.length }}/200</div>
+            </div>
         </div>
+
         <div class="btn-list">
             <van-button :disabled="!canSubmit" type="default" @click="submit">提交</van-button>
         </div>
@@ -26,14 +30,12 @@
 export default {
     data() {
         return {
-            form: {
-                description: ''
-            }
+            content: ''
         };
     },
     computed: {
         canSubmit() {
-            if (this.form.description) {
+            if (this.content) {
                 return true;
             } else {
                 return false;
@@ -47,6 +49,33 @@ export default {
 </script>
 <style lang="scss" scoped>
 .container {
+    .content {
+        width: calc(100vw - 30px);
+        height: 150px;
+        display: block;
+        margin: 20px auto 0 auto;
+        // background: #f2f4f5;
+        border-radius: 5px;
+        textarea {
+            width: 100%;
+            height: calc(100% - 30px);
+            padding: 15px;
+            resize: none;
+            border: none;
+            outline: none;
+            background: #f2f4f5;
+            font-size: 13px;
+            color: black;
+            line-height: 22px;
+        }
+        .num {
+            font-size: 13px;
+            color: #aaacad;
+            padding-right: 15px;
+            line-height: 18px;
+            text-align: right;
+        }
+    }
     .box-bottom {
         /deep/ .van-field__label {
             margin: 10px 0 0 2px;

+ 1 - 1
src/pages/my.vue

@@ -60,7 +60,7 @@
                     <img class="tit-img" src="../native/tabbar/wode_icon_baoxiu@3x.png" alt="" />
                     <div class="text">保修申请</div>
                 </div>
-                <div class="div">
+                <div class="div" @click="navigateTo('/pages/cleanReport')">
                     <img class="tit-img" src="../native/tabbar/wode_icon_dasao@3x.png" alt="" />
                     <div class="text">打扫申请</div>
                 </div>

+ 59 - 30
src/pages/repairReport.vue

@@ -5,31 +5,34 @@
 </config>
 <template>
     <div class="container">
-        <van-cell-group :border="false" class="form">
-            <van-field label="报修人" :value="form.name" @input="form.name = $event.detail" placeholder="请输入报修人">
-            </van-field>
-            <van-field
-                label="联系方式"
-                type="digit"
-                :value="form.phone"
-                @input="form.phone = $event.detail"
-                placeholder="请输入联系方式"
-            >
-            </van-field>
-            <van-field label="故障图片" :border="false" readonly> </van-field>
-            <van-uploader :file-list="images" :after-read="afterRead" @delete="deleteImg" />
-        </van-cell-group>
-        <div class="box-bottom">
-            <van-field :border="false" label="故障描述" readonly> </van-field>
-            <van-field
-                :value="form.description"
-                @input="form.description = $event.detail"
-                :border="false"
-                rows="1"
-                autosize
-                type="textarea"
-                placeholder="请描述房间内需要描述事项"
-            />
+        <div class="content">
+            <van-cell-group :border="false" class="form">
+                <van-field label="报修人" :value="name" @input="name = $event.detail" placeholder="请输入报修人">
+                </van-field>
+                <van-field
+                    label="联系方式"
+                    type="digit"
+                    :value="phone"
+                    @input="phone = $event.detail"
+                    placeholder="请输入联系方式"
+                >
+                </van-field>
+                <van-field label="故障图片" :border="false" readonly> </van-field>
+                <van-uploader :file-list="images" :after-read="afterRead" @delete="deleteImg" />
+            </van-cell-group>
+            <div class="box-bottom">
+                <van-field :border="false" label="故障描述" readonly> </van-field>
+                <van-field
+                    :value="content"
+                    @input="content = $event.detail"
+                    :border="false"
+                    rows="1"
+                    autosize
+                    type="textarea"
+                    placeholder="请描述房间内需要描述事项"
+                />
+                <div class="num">{{ content.length }}/200</div>
+            </div>
         </div>
         <div class="btn-list">
             <van-button :disabled="!canSubmit" type="default" @click="submit">提交</van-button>
@@ -45,10 +48,9 @@ export default {
     },
     data() {
         return {
-            form: {
-                phone: '',
-                name: ''
-            },
+            phone: '',
+            name: '',
+            content: '',
             images: [],
             imgBox: true
         };
@@ -56,7 +58,7 @@ export default {
     computed: {
         ...mapState(['roomInfo']),
         canSubmit() {
-            if (this.form.phone && this.form.name && this.images.length != 0) {
+            if (this.phone && this.name && this.images.length != 0) {
                 return true;
             } else {
                 return false;
@@ -96,6 +98,33 @@ export default {
 </script>
 <style lang="less" scoped>
 .container {
+    .content {
+        width: calc(100vw - 30px);
+        height: 150px;
+        display: block;
+        margin: 20px auto 0 auto;
+        // background: #f2f4f5;
+        border-radius: 5px;
+        textarea {
+            width: 100%;
+            height: calc(100% - 30px);
+            padding: 15px;
+            resize: none;
+            border: none;
+            outline: none;
+            background: #f2f4f5;
+            font-size: 13px;
+            color: black;
+            line-height: 22px;
+        }
+        .num {
+            font-size: 13px;
+            color: #aaacad;
+            padding-right: 15px;
+            line-height: 18px;
+            text-align: right;
+        }
+    }
     /deep/ .van-uploader {
         padding-left: 18px;
     }