张延森 4 年之前
父節點
當前提交
68ca7849be

+ 3
- 0
src/app.config.js 查看文件

29
     'scope.userLocation': {
29
     'scope.userLocation': {
30
       'desc': '你的位置信息将用于房源信息定位'
30
       'desc': '你的位置信息将用于房源信息定位'
31
     }
31
     }
32
+  },
33
+  useExtendedLib: {
34
+    weui: true
32
   }
35
   }
33
 }
36
 }

+ 0
- 4
src/compents/tab/index.jsx 查看文件

18
 
18
 
19
 
19
 
20
 const tab = (props) => {
20
 const tab = (props) => {
21
-
22
     const user = useSelector(state => state.user)
21
     const user = useSelector(state => state.user)
23
 
22
 
24
     const { value, openType, pageState, formType, color, styleType='', ...prop } = props
23
     const { value, openType, pageState, formType, color, styleType='', ...prop } = props
25
 
24
 
26
     const [state, setState] = useState(1)
25
     const [state, setState] = useState(1)
27
-    useEffect(() => {
28
-
29
-    }, [])
30
     
26
     
31
     //  &-on{
27
     //  &-on{
32
     //     color: #fed12f;
28
     //     color: #fed12f;

+ 2
- 2
src/pages/customer/index.js 查看文件

73
     })
73
     })
74
 
74
 
75
   }, [props.houseId, props.orderId, regUnFinished])
75
   }, [props.houseId, props.orderId, regUnFinished])
76
- 
76
+
77
   return (
77
   return (
78
     <View className='index' >
78
     <View className='index' >
79
 
79
 
80
-<NavCustom houseInfo={houseInfo}></NavCustom>
80
+      <NavCustom houseInfo={houseInfo}></NavCustom>
81
       {pageState=='1'&&<Register oderId={orderId} dataSource={orderInfo} onFinished={handleRegisterFinished}></Register>}
81
       {pageState=='1'&&<Register oderId={orderId} dataSource={orderInfo} onFinished={handleRegisterFinished}></Register>}
82
 
82
 
83
       {pageState!='1'&&<Layout type='custom'>
83
       {pageState!='1'&&<Layout type='custom'>

+ 19
- 17
src/pages/customer/register/index.jsx 查看文件

161
     setList([...list]);
161
     setList([...list]);
162
   };
162
   };
163
   const { personNum } = props.dataSource?.houseSetting || {};
163
   const { personNum } = props.dataSource?.houseSetting || {};
164
+
164
   return (
165
   return (
165
      <View className="register">
166
      <View className="register">
166
-      {personNum>0&& <View>
167
+      {personNum>0&& 
168
+      <View>
167
          <Layout>
169
          <Layout>
168
-        {list.map((x, index) => {
169
-          let inx = index;
170
-          return (
171
-            <InputGroup
172
-              key={inx}
173
-              index={index}
174
-              dataSource={x}
175
-              onChange={onChangeList(inx)}
176
-            />
177
-          );
178
-        })}
179
-      </Layout>
180
-
181
-      <Tab value={["开启旅程"]} onClick={e => onClick(e)}></Tab>
182
-       </View>}
183
-      
170
+          {list.map((x, index) => {
171
+            let inx = index;
172
+            return (
173
+              <InputGroup
174
+                key={inx}
175
+                index={index}
176
+                dataSource={x}
177
+                onChange={onChangeList(inx)}
178
+              />
179
+            );
180
+          })}
181
+        </Layout>
182
+
183
+        <Tab value={["开启旅程"]} onClick={e => onClick(e)}></Tab>
184
+      </View>
185
+      }
184
     </View>
186
     </View>
185
   );
187
   );
186
 };
188
 };

+ 35
- 30
src/pages/guide/index.jsx 查看文件

165
               )}
165
               )}
166
             </ContainerLayout>
166
             </ContainerLayout>
167
           </View>
167
           </View>
168
-          <View className="guide-view">
169
-            <Text className="guide-view-info">停车位置</Text>
170
-            <ContainerLayout
171
-              className="guide-view-layout"
172
-              style={{ display: "flex", justifyContent: "space-between" }}
173
-              onClick={() => onToMap("park")}
174
-            >
175
-              <View>
176
-                <View className="guide-view-layout-text1">
177
-                  {detail.shortParking}
178
-                </View>
179
-                <View className="guide-view-layout-text2">
180
-                  {detail.parking}
181
-                </View>
182
-              </View>
183
-              {user.role == userRloe.customer && (
184
-                <View
185
-                  style={{
186
-                    float: "right",
187
-                    display: "flex",
188
-                    justifyContent: "center",
189
-                    flexDirection: "column"
190
-                  }}
191
-                  onClick={() => onOpenLocation(detail.parkLngLat)}
168
+          {
169
+            detail.parking &&
170
+            (
171
+              <View className="guide-view">
172
+                <Text className="guide-view-info">停车位置</Text>
173
+                <ContainerLayout
174
+                  className="guide-view-layout"
175
+                  style={{ display: "flex", justifyContent: "space-between" }}
176
+                  onClick={() => onToMap("park")}
192
                 >
177
                 >
193
-                  <Image className="icon" src={icon} />
194
-                  <View className="icontext">去这里</View>
195
-                </View>
196
-              )}
197
-            </ContainerLayout>
198
-          </View>
178
+                  <View>
179
+                    <View className="guide-view-layout-text1">
180
+                      {detail.shortParking}
181
+                    </View>
182
+                    <View className="guide-view-layout-text2">
183
+                      {detail.parking}
184
+                    </View>
185
+                  </View>
186
+                  {user.role == userRloe.customer && (
187
+                    <View
188
+                      style={{
189
+                        float: "right",
190
+                        display: "flex",
191
+                        justifyContent: "center",
192
+                        flexDirection: "column"
193
+                      }}
194
+                      onClick={() => onOpenLocation(detail.parkLngLat)}
195
+                    >
196
+                      <Image className="icon" src={icon} />
197
+                      <View className="icontext">去这里</View>
198
+                    </View>
199
+                  )}
200
+                </ContainerLayout>
201
+              </View>
202
+            )
203
+          }
199
           <View className="guide-view">
204
           <View className="guide-view">
200
             <Text className="guide-view-info">wifi信息</Text>
205
             <Text className="guide-view-info">wifi信息</Text>
201
             <ContainerLayout
206
             <ContainerLayout

+ 0
- 3
src/pages/house/add/index.jsx 查看文件

45
     <ScrollView scrollY style={{ height: 'calc(100vh - 180rpx)' }} >
45
     <ScrollView scrollY style={{ height: 'calc(100vh - 180rpx)' }} >
46
     <View className='page-container' >
46
     <View className='page-container' >
47
         <View className='house-add'>
47
         <View className='house-add'>
48
-        
49
-
50
-
51
             <View>
48
             <View>
52
               {userRole == 'guide' && <Guide userRole={userRole} />}
49
               {userRole == 'guide' && <Guide userRole={userRole} />}
53
               {userRole == 'recommend' && <Recommend userRole={userRole} />}
50
               {userRole == 'recommend' && <Recommend userRole={userRole} />}

+ 1
- 3
src/pages/house/addnewhouse/index.jsx 查看文件

70
         const value = e.detail.value
70
         const value = e.detail.value
71
         const data = {
71
         const data = {
72
             ...value,
72
             ...value,
73
-            // address: `${value.address}____${value.addressdetail}`,
74
-            // parking: `${value.parking}____${value.parkingdetail}`,
75
             lngLat: `${address.latitude || ''},${address.longitude || ''}`,
73
             lngLat: `${address.latitude || ''},${address.longitude || ''}`,
76
             parkLngLat: `${parking.latitude || ''},${parking.longitude || ''}`,
74
             parkLngLat: `${parking.latitude || ''},${parking.longitude || ''}`,
77
-            
75
+            shopId: user.shopId,
78
             desc:imgUrl,
76
             desc:imgUrl,
79
         }
77
         }
80
         console.log(data,e.detail.value,'formSubmit')
78
         console.log(data,e.detail.value,'formSubmit')

+ 13
- 8
src/pages/house/list/index.jsx 查看文件

6
   useImperativeHandle
6
   useImperativeHandle
7
 } from "react";
7
 } from "react";
8
 import Taro, { useDidShow } from "@tarojs/taro";
8
 import Taro, { useDidShow } from "@tarojs/taro";
9
+import { useSelector } from 'react-redux'
9
 import "./index.scss";
10
 import "./index.scss";
10
 import { View, Text, Input, Image } from "@tarojs/components";
11
 import { View, Text, Input, Image } from "@tarojs/components";
11
 import ContainerLayout from "../../../compents/container/index";
12
 import ContainerLayout from "../../../compents/container/index";
14
 import RecycleList from "@/compents/RecycleList";
15
 import RecycleList from "@/compents/RecycleList";
15
 
16
 
16
 let house = (props, ref) => {
17
 let house = (props, ref) => {
18
+  const user = useSelector(state => state.user)
17
   const [list, setList] = useState([]);
19
   const [list, setList] = useState([]);
18
   const [radioHouse, setRadioHouse] = useState();
20
   const [radioHouse, setRadioHouse] = useState();
19
   const [width, setWidth] = useState();
21
   const [width, setWidth] = useState();
20
   const [height, setHeight] = useState();
22
   const [height, setHeight] = useState();
21
-  const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 });
23
+  const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10, shopId: user.shopId });
22
   const [total, setTotal] = useState(0);
24
   const [total, setTotal] = useState(0);
23
 
25
 
24
   useImperativeHandle(ref, () => ({
26
   useImperativeHandle(ref, () => ({
31
   const radioHouseState = useMemo(() => props.radioHouseState, [
33
   const radioHouseState = useMemo(() => props.radioHouseState, [
32
     props.radioHouseState
34
     props.radioHouseState
33
   ]);
35
   ]);
34
-
35
-  wx.setNavigationBarTitle({
36
-    title: "民宿房源管理"
37
-  });
36
+  
38
 
37
 
39
   const getHouseList = () => {
38
   const getHouseList = () => {
39
+    if (!queryParams.shopId) return
40
+
40
     request({
41
     request({
41
       url: "/taHouse",
42
       url: "/taHouse",
42
       params: queryParams
43
       params: queryParams
81
   }
82
   }
82
 
83
 
83
   useEffect(() => {
84
   useEffect(() => {
84
-    
85
+    wx.setNavigationBarTitle({
86
+      title: "民宿房源管理"
87
+    });
85
 
88
 
86
     Taro.nextTick(() => {
89
     Taro.nextTick(() => {
87
       Taro.createSelectorQuery()
90
       Taro.createSelectorQuery()
133
     getHouseList();
136
     getHouseList();
134
   }, [queryParams]);
137
   }, [queryParams]);
135
 
138
 
139
+  useEffect(() => {
140
+      setQueryParams({ ...queryParams, shopId: user.shopId })
141
+  }, [user.shopId])
142
+
136
   // useDidShow(() => {
143
   // useDidShow(() => {
137
   //   setQueryParams({ ...queryParams })
144
   //   setQueryParams({ ...queryParams })
138
   // })
145
   // })
139
  
146
  
140
   return (
147
   return (
141
     <View className="houselist">
148
     <View className="houselist">
142
-     
143
-
144
       {(!list || !list.length) && <View className="nodata"> 暂无数据</View>}
149
       {(!list || !list.length) && <View className="nodata"> 暂无数据</View>}
145
       <RecycleList
150
       <RecycleList
146
         height={height}
151
         height={height}

+ 4
- 1
src/pages/index/index.config.js 查看文件

1
 export default {
1
 export default {
2
   // navigationBarTitleText: '首页',
2
   // navigationBarTitleText: '首页',
3
   navigationStyle: "custom",
3
   navigationStyle: "custom",
4
-  enableShareAppMessage: true
4
+  enableShareAppMessage: true,
5
+  usingComponents: {
6
+    "mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet"
7
+  }
5
 }
8
 }

+ 14
- 2
src/pages/index/index.jsx 查看文件

15
   const { houseId, orderId } = router.params;
15
   const { houseId, orderId } = router.params;
16
   const user = useSelector(state => state.user);
16
   const user = useSelector(state => state.user);
17
 
17
 
18
-  console.log(user);
19
-
20
   const dispatch = useDispatch();
18
   const dispatch = useDispatch();
21
 
19
 
20
+  const shopList = (user.shopList || []).map(x => ({text: x.name, value: x.shopId}))
21
+
22
   useEffect(() => {
22
   useEffect(() => {
23
     if (user.role == roleList.landlord) {
23
     if (user.role == roleList.landlord) {
24
       wx.setNavigationBarTitle({
24
       wx.setNavigationBarTitle({
51
     setShowAuthPhone(false);
51
     setShowAuthPhone(false);
52
   };
52
   };
53
 
53
 
54
+  const handleSelectShop = e => {
55
+    const shopId = e.detail.value
56
+    dispatch({ type: "SET_SHOP", shopId });
57
+  }
58
+
54
   return (
59
   return (
55
     <View className="index">
60
     <View className="index">
56
       {user.personId && (
61
       {user.personId && (
86
       {/* </View>
91
       {/* </View>
87
     </ScrollView>
92
     </ScrollView>
88
     <Tab value={userRole} onClick={(e) => onTabClick(e)}></Tab> */}
93
     <Tab value={userRole} onClick={(e) => onTabClick(e)}></Tab> */}
94
+      {
95
+        shopList.length > 0 && !user.shopId &&
96
+        (
97
+          <mp-actionSheet show actions={shopList} title="请选择店铺" showCancel={false} onActiontap={handleSelectShop}>
98
+          </mp-actionSheet>
99
+        )
100
+      }
89
     </View>
101
     </View>
90
   );
102
   );
91
 };
103
 };

+ 4
- 12
src/pages/share/index.jsx 查看文件

10
 import './index.scss'
10
 import './index.scss'
11
 import request from '../../util/request';
11
 import request from '../../util/request';
12
 
12
 
13
-// Page({
14
-//     data: {
15
-//         text: 'init data',
16
-//         array: [{ msg: '1' }, { msg: '2' }]
17
-//     }
18
-// })
19
 const defaultImgUrl= 'https://zhiyun-image.oss-cn-shanghai.aliyuncs.com/shigongli/shigongli_share_default-min.jpg'
13
 const defaultImgUrl= 'https://zhiyun-image.oss-cn-shanghai.aliyuncs.com/shigongli/shigongli_share_default-min.jpg'
20
 
14
 
21
 const Index = () => {
15
 const Index = () => {
24
     const user = useSelector(state => state.user)
18
     const user = useSelector(state => state.user)
25
 
19
 
26
     const now = new Date()
20
     const now = new Date()
27
-    const today = now.toJSON().substring(0, 10)
21
+    const nextDate = new Date()
22
+    nextDate.setDate(nextDate.getDate() + 1)
28
 
23
 
29
     const [personNum, setPersonNum] = useState(0)
24
     const [personNum, setPersonNum] = useState(0)
30
-    const [startTime, setStartTime] = useState(today)
31
-    const [endTime, setEndTime] = useState(today)
25
+    const [startTime, setStartTime] = useState(now.toJSON().substring(0, 10))
26
+    const [endTime, setEndTime] = useState(nextDate.toJSON().substring(0, 10))
32
     // const [data,setData] = useState({})
27
     // const [data,setData] = useState({})
33
     const [shareObj, setShareObj] = useState()
28
     const [shareObj, setShareObj] = useState()
34
     const [showShareModal, setShowShareModal] = useState(false)
29
     const [showShareModal, setShowShareModal] = useState(false)
73
     }  
68
     }  
74
 
69
 
75
     const handleShareReady = () => {
70
     const handleShareReady = () => {
76
-
77
-
78
-
79
         const data = {
71
         const data = {
80
             houseId,
72
             houseId,
81
             personNum,
73
             personNum,

+ 29
- 0
src/reducers/user.js 查看文件

40
           wx.setNavigationBarTitle({
40
           wx.setNavigationBarTitle({
41
             title: '民宿房源管理'
41
             title: '民宿房源管理'
42
           })
42
           })
43
+
44
+        const shopList = action.user.shopKeeperList.reduce((acc, item) => {
45
+          const shop = item.taShop
46
+          if (!shop) return acc
47
+
48
+          const exist = !!acc.filter(x => x.shopId === shop.shopId)[0]
49
+          if (!exist) {
50
+            acc.push(shop)
51
+          }
52
+
53
+          return acc
54
+        }, [])
55
+
56
+        // 默认当前的, 但是如果有多个, 则需要用户来确定
57
+        const shopId = shopList.length > 1 ? undefined : shopList[0]
58
+
43
         return {
59
         return {
44
           ...state,
60
           ...state,
45
           ...action.user,
61
           ...action.user,
46
           role: 'landlord',
62
           role: 'landlord',
63
+          shopList,
64
+          shopId,
47
           // role: 'customer',
65
           // role: 'customer',
48
         }
66
         }
49
       } else {
67
       } else {
60
     case 'phone': {
78
     case 'phone': {
61
       return state
79
       return state
62
     }
80
     }
81
+    case 'SET_SHOP': {
82
+      const shopId = action.shopId
83
+      if (!shopId) {
84
+        return state
85
+      }
86
+
87
+      return {
88
+        ...state,
89
+        shopId
90
+      }
91
+    }
63
 
92
 
64
     default:
93
     default:
65
       return state
94
       return state