Browse Source

Merge branch 'master' of http://git.ycjcjy.com/ershoufang/mp-agent into master

zlisen 4 years ago
parent
commit
1bfc46dcee

+ 4
- 4
src/components/XLoading/index.vue View File

12
 </template>
12
 </template>
13
 
13
 
14
 <script>
14
 <script>
15
-import { computed } from "vue"
16
-import { Loading } from "vant"
17
-import { useModel } from "@zjxpcyc/vue-tiny-store"
15
+import { computed } from 'vue'
16
+import { Loading } from 'vant'
17
+import { useModel } from '@zjxpcyc/vue-tiny-store'
18
 // import store from '../../store'
18
 // import store from '../../store'
19
 
19
 
20
 export default {
20
 export default {
27
     xId: String,
27
     xId: String,
28
   },
28
   },
29
   setup(props) {
29
   setup(props) {
30
-    const { loading } = useModel("loading")
30
+    const { loading } = useModel('loading')
31
 
31
 
32
     const show = computed(() => loading[props.xId])
32
     const show = computed(() => loading[props.xId])
33
 
33
 

+ 54
- 43
src/components/detailCompents/swiper/index.vue View File

1
 <template>
1
 <template>
2
   <div class="swiper">
2
   <div class="swiper">
3
     <van-swipe :autoplay="3000" @change="onChange" ref="swipe">
3
     <van-swipe :autoplay="3000" @change="onChange" ref="swipe">
4
-      <van-swipe-item v-for="(image, index) in images" :key="index">
5
-        <van-image height="300" :src="image.image" @click="onPerView(index)" />
4
+      <van-swipe-item v-for="(item, index) in imageList" :key="index">
5
+        <van-image height="300" :src="item.image" @click="onPerView(index)" />
6
       </van-swipe-item>
6
       </van-swipe-item>
7
+      <template #indicator>
8
+        <div class="swiper-indicator" ref="indicator">
9
+          <span
10
+            v-for="(item, index) in imageList"
11
+            :key="index"
12
+            :class="{ active: current === index }"
13
+          >
14
+            {{ item.text }}
15
+          </span>
16
+        </div>
17
+      </template>
7
     </van-swipe>
18
     </van-swipe>
8
-    <div class="swiper-tabs">
9
-      <van-tabs
10
-        v-model:active="current"
11
-        background="rgba(0, 0, 0, 0.69)"
12
-        line-width="0"
13
-        color="#fff"
14
-        title-active-color="#d75e3a"
15
-        @click="onClickTab"
16
-      >
17
-        <van-tab
18
-          v-for="(image, index) in images"
19
-          :key="index"
20
-          :title="image?.text"
21
-        >
22
-        </van-tab>
23
-      </van-tabs>
24
-    </div>
25
   </div>
19
   </div>
26
 </template>
20
 </template>
27
 
21
 
28
 <script>
22
 <script>
29
-import { ref } from 'vue'
30
-import {
31
-  Swipe,
32
-  SwipeItem,
33
-  Image as VanImage,
34
-  ImagePreview,
35
-  Tabs,
36
-  Tab,
37
-} from 'vant'
23
+import { computed, ref } from 'vue'
24
+import { Swipe, SwipeItem, Image as VanImage, ImagePreview } from 'vant'
38
 
25
 
39
 export default {
26
 export default {
40
   name: 'swiper',
27
   name: 'swiper',
42
     [Swipe.name]: Swipe,
29
     [Swipe.name]: Swipe,
43
     [SwipeItem.name]: SwipeItem,
30
     [SwipeItem.name]: SwipeItem,
44
     [VanImage.name]: VanImage,
31
     [VanImage.name]: VanImage,
45
-    [Tabs.name]: Tabs,
46
-    [Tab.name]: Tab,
47
   },
32
   },
48
   props: {
33
   props: {
49
     images: {
34
     images: {
50
       type: Array,
35
       type: Array,
51
-      default: () => [
52
-        {
53
-          image: '',
54
-          text: '暂无',
55
-        },
56
-      ],
36
+      default: () => [],
57
     },
37
     },
58
   },
38
   },
59
 
39
 
60
   setup(props) {
40
   setup(props) {
61
     const current = ref(0)
41
     const current = ref(0)
62
     const swipe = ref()
42
     const swipe = ref()
43
+    const indicator = ref()
44
+
45
+    const imageList = computed(() => {
46
+      const list = (props.image || []).filter(Boolean)
47
+      return list.length
48
+        ? list
49
+        : [
50
+            {
51
+              image: 'https://img01.yzcdn.cn/vant/custom-empty-image.png',
52
+              text: '暂无图片',
53
+            },
54
+          ]
55
+    })
63
 
56
 
64
     const onChange = (index) => {
57
     const onChange = (index) => {
65
       current.value = index
58
       current.value = index
59
+      // indicator.value.scrollTo({ left: 1000 })
66
     }
60
     }
67
     const onPerView = (index) => {
61
     const onPerView = (index) => {
68
       ImagePreview({
62
       ImagePreview({
79
     }
73
     }
80
 
74
 
81
     // refs.checkbox.toggle();
75
     // refs.checkbox.toggle();
82
-    onPerView
76
+
83
     return {
77
     return {
84
       swipe,
78
       swipe,
85
       current,
79
       current,
80
+      indicator,
81
+      imageList,
86
       onChange,
82
       onChange,
87
       onPerView,
83
       onPerView,
88
       onClickTab,
84
       onClickTab,
106
     width: 100%;
102
     width: 100%;
107
   }
103
   }
108
 }
104
 }
109
-.swiper .van-swipe-item {
110
-  /* color: #fff;
111
-  font-size: 20px;
112
-  line-height: 150px;
113
-  text-align: center;
114
-  background-color: #39a9ed; */
105
+
106
+.swiper-indicator {
107
+  position: absolute;
108
+  bottom: 0;
109
+  left: 0;
110
+  background: rgba(0, 0, 0, 0.69);
111
+  color: #aaa;
112
+  display: flex;
113
+  flex-wrap: nowrap;
114
+  font-size: 0.85em;
115
+  min-width: 100vw;
116
+
117
+  span {
118
+    display: inline-block;
119
+    padding: 0.8em;
120
+    flex: none;
121
+
122
+    &.active {
123
+      color: #d75e3a;
124
+    }
125
+  }
115
 }
126
 }
116
 </style>
127
 </style>

+ 0
- 1
src/view/secondhand/detail/components/Follow.vue View File

17
       block
17
       block
18
       size="small"
18
       size="small"
19
       type="warning"
19
       type="warning"
20
-      v-if="roomInfo.status === '0'"
21
       v-shiro="'room:info:addFollow'"
20
       v-shiro="'room:info:addFollow'"
22
       @click="goToAddFollow"
21
       @click="goToAddFollow"
23
     >
22
     >

+ 4
- 8
src/view/secondhand/detail/components/Profile.vue View File

138
 
138
 
139
               // 有跟进权限
139
               // 有跟进权限
140
               if (hasFollowPermission.value) {
140
               if (hasFollowPermission.value) {
141
-                confirm({
141
+                confirm(`您存在未跟进的房源,房源编号: ${followRoom.id}`, {
142
                   title: '去跟进',
142
                   title: '去跟进',
143
-                  message: `您存在未跟进的房源,房源编号: ${followRoom.id}`,
144
                 }).then(() => {
143
                 }).then(() => {
145
                   router.push({
144
                   router.push({
146
-                    name: 'secondhand.detail',
147
-                    query: { roomId: followRoom.id },
145
+                    name: 'followup',
146
+                    query: { roomId: followRoom.id, type: 'room' },
148
                   })
147
                   })
149
                 })
148
                 })
150
               } else {
149
               } else {
151
-                alert({
152
-                  title: '去跟进',
153
-                  message: `您存在未跟进的房源,房源编号: ${followRoom.id}`,
154
-                })
150
+                alert(`您存在未跟进的房源,房源编号: ${followRoom.id}`)
155
               }
151
               }
156
             } else {
152
             } else {
157
               showDanger('查看敏感信息失败')
153
               showDanger('查看敏感信息失败')

+ 12
- 12
src/view/secondhand/detail/index.vue View File

16
 
16
 
17
       <van-cell-group title="房源信息">
17
       <van-cell-group title="房源信息">
18
         <RoomProfile
18
         <RoomProfile
19
-          :room-info="roomInfo"
20
-          :building="building"
19
+          :room-info="detail.roomInfo"
20
+          :building="detail.building"
21
           :other-data="roomOtherData"
21
           :other-data="roomOtherData"
22
         />
22
         />
23
       </van-cell-group>
23
       </van-cell-group>
95
 </template>
95
 </template>
96
 
96
 
97
 <script>
97
 <script>
98
-import { ref, onMounted, computed, watch } from 'vue'
98
+import { ref, onMounted, computed } from 'vue'
99
 import { useRouter } from 'vue-router'
99
 import { useRouter } from 'vue-router'
100
 import { Swiper } from '@/components/detailCompents'
100
 import { Swiper } from '@/components/detailCompents'
101
 import {
101
 import {
169
 
169
 
170
     const { detail, getDetail } = useModel('room')
170
     const { detail, getDetail } = useModel('room')
171
 
171
 
172
-    const roomInfo = ref({})
173
-    const building = ref({})
174
-    watch(detail, (nw) => {
175
-      roomInfo.value = nw.roomInfo
176
-      building.value = nw.building
177
-      // console.log('--------->', nw.building)
178
-    })
179
-    // const roomInfo = computed(() => detail.roomInfo || {})
180
-    // const building = computed(() => detail.building || {})
172
+    // const roomInfo = ref({})
173
+    // const building = ref({})
174
+    // watch(detail, (nw) => {
175
+    //   roomInfo.value = nw.roomInfo
176
+    //   building.value = nw.building
177
+    //   // console.log('--------->', nw.building)
178
+    // })
179
+    const roomInfo = computed(() => detail.roomInfo || {})
180
+    const building = computed(() => detail.building || {})
181
 
181
 
182
     const isNormalStatus = computed(() => {
182
     const isNormalStatus = computed(() => {
183
       return detail.roomInfo?.status === '0'
183
       return detail.roomInfo?.status === '0'

+ 13
- 19
src/view/secondhand/edithouse/index.vue View File

11
 </template>
11
 </template>
12
 
12
 
13
 <script>
13
 <script>
14
-import { watch } from "vue"
15
-import { useModel } from "@zjxpcyc/vue-tiny-store"
16
-import { useRoute, useRouter } from "vue-router"
17
-import { alert, showDanger } from "@/utils"
18
-import RoomBasic from "./components/Basic"
19
-import RoomForm from "./components/Form"
14
+import { onMounted } from 'vue'
15
+import { useModel } from '@zjxpcyc/vue-tiny-store'
16
+import { useRoute, useRouter } from 'vue-router'
17
+import { alert, showDanger } from '@/utils'
18
+import RoomBasic from './components/Basic'
19
+import RoomForm from './components/Form'
20
 
20
 
21
 export default {
21
 export default {
22
-  name: "secondhanddetail",
22
+  name: 'secondhanddetail',
23
   components: {
23
   components: {
24
     RoomBasic,
24
     RoomBasic,
25
     RoomForm,
25
     RoomForm,
28
   setup() {
28
   setup() {
29
     const route = useRoute()
29
     const route = useRoute()
30
     const router = useRouter()
30
     const router = useRouter()
31
-    const { detail, getDetail, houseEdit } = useModel("room")
32
-
33
-    watch(
34
-      () => route.query.roomId,
35
-      (nw, od) => {
36
-        if (nw != od && nw) {
37
-          getDetail(nw)
38
-        }
39
-      },
40
-      { immediate: true }
41
-    )
31
+    const { detail, getDetail, houseEdit } = useModel('room')
42
 
32
 
43
     const handleSumbit = (values) => {
33
     const handleSumbit = (values) => {
44
       houseEdit(values)
34
       houseEdit(values)
45
         .then(() => {
35
         .then(() => {
46
-          alert("编辑成功").then(() => {
36
+          alert('编辑成功').then(() => {
47
             router.go(-1)
37
             router.go(-1)
48
           })
38
           })
49
         })
39
         })
52
         })
42
         })
53
     }
43
     }
54
 
44
 
45
+    onMounted(() => {
46
+      getDetail(route.query.roomId)
47
+    })
48
+
55
     return {
49
     return {
56
       handleSumbit,
50
       handleSumbit,
57
       detail,
51
       detail,