Browse Source

静态页面

xcx 4 years ago
parent
commit
07e197dacb

+ 44
- 12
src/pages/FuLi/ShangPinDuiHuan/index.jsx View File

@@ -1,35 +1,67 @@
1
-import React, { useState } from 'react'
2
-import { Current } from '@tarojs/taro'
1
+import React, { useState, useEffect } from 'react'
2
+import Taro, { Current } from '@tarojs/taro'
3
+import request, { apis } from '@/utils/request'
4
+import { useModel } from '@/store'
3 5
 import { Input } from '@tarojs/components'
4 6
 import '@/assets/css/reset.less'
5 7
 import '@/assets/css/iconfont.less'
6 8
 import './index.less'
7 9
 
8
-export default function ShangPinDuiHuan (props) {
10
+export default function ShangPinDuiHuan () {
9 11
 
10
-  const CurrnetId = Current.router.params.id
12
+  const { user } = useModel('user')
13
+  const [CurrnetId] = useState(Current.router.params.id) // 当前id
14
+  const [GoodsDetail, setGoodsDetail] = useState(null) // 商品详情
15
+  const [DataLock, setDataLock] = useState(false) // 数据锁
16
+  const [Count, setCount] = useState(1) // 商品兑换数量
17
+
18
+  useEffect(() => {
19
+    Init()
20
+  }, [])
21
+
22
+  const Init = () => {
23
+    request({ ...apis.getGoodsDetail, args: { id: CurrnetId } }).then((res) => {
24
+      setGoodsDetail(res)
25
+    })
26
+  }
27
+
28
+  const CountChange = (e) => {
29
+    setCount(e.detail.value)
30
+  }
31
+
32
+  const Submit = () => { // 兑换商品
33
+    if (DataLock) return
34
+    setDataLock(true)
35
+    request({ ...apis.exchangeGoods, args: { id: CurrnetId } }).then(() => {
36
+      Taro.showToast({ title: `兑换成功`, icon: 'none' })
37
+      setDataLock(false)
38
+    }).catch((res) => {
39
+      Taro.showToast({ title: res, icon: 'none' })
40
+      setDataLock(false)
41
+    })
42
+  }
11 43
 
12 44
   return (
13 45
     <view className='ShangPinDuiHuan'>
14 46
       <view className='Info'>
15 47
         <view className='Item flex-h'>
16 48
           <view className='Img'>
17
-            <image mode='aspectFill' src={null} className='centerLabel'></image>
49
+            <image mode='aspectFill' src={GoodsDetail === null ? null : GoodsDetail.imgUrl} className='centerLabel'></image>
18 50
           </view>
19 51
           <view className='flex-item'>
20
-            <text>沙发垫欧式轻奢</text>
52
+            <text>{GoodsDetail === null ? '' : GoodsDetail.goodsName}</text>
21 53
             <view className='Num'>
22
-              <text>78</text>
54
+              <text>{GoodsDetail === null ? '' : GoodsDetail.totalNum}</text>
23 55
               <text>人已兑换</text>
24 56
             </view>
25 57
             <view className='flex-h'>
26
-              <text>80000</text>
58
+              <text>{GoodsDetail === null ? '' : GoodsDetail.pointPrice}</text>
27 59
               <text>积分</text>
28 60
               <view className='flex-item'></view>
29 61
               <view className='EditNum flex-h'>
30
-                <text className='iconfont iconjian'></text>
31
-                <Input></Input>
32
-                <text className='iconfont iconjia1'></text>
62
+                <text className='iconfont iconjian' onClick={() => { setCount(Count > 1 ? Count - 1 : 1) }}></text>
63
+                <Input type='number' value={Count} onInput={CountChange}></Input>
64
+                <text className='iconfont iconjia1' onClick={() => { setCount(Count - 0 + 1) }}></text>
33 65
               </view>
34 66
             </view>
35 67
           </view>
@@ -37,7 +69,7 @@ export default function ShangPinDuiHuan (props) {
37 69
         <view className='InfoBottom'></view>
38 70
       </view>
39 71
       <view className='BottomBtn'>
40
-        <text className='active'>确认兑换</text>
72
+        <text className={DataLock ? '' : 'active'} onClick={Submit}>{DataLock ? '正在提交...' : '确认兑换'}</text>
41 73
       </view>
42 74
     </view>
43 75
   )

+ 23
- 8
src/pages/FuLi/ShangPinXiangQing/index.jsx View File

@@ -1,36 +1,51 @@
1
-import React, { useState } from 'react'
1
+import React, { useState, useEffect } from 'react'
2 2
 import Taro, { Current } from '@tarojs/taro'
3
+import request, { apis } from '@/utils/request'
4
+import { useModel } from '@/store'
3 5
 import '@/assets/css/reset.less'
4 6
 import '@/assets/css/iconfont.less'
5 7
 import './index.less'
6 8
 
7
-export default function ShangPinXiangQing (props) {
9
+export default function ShangPinXiangQing () {
8 10
 
9
-  const CurrnetId = Current.router.params.id
11
+  const { user } = useModel('user')
12
+  const [CurrnetId] = useState(Current.router.params.id) // 当前id
13
+  const [GoodsDetail, setGoodsDetail] = useState(null) // 商品详情
14
+
15
+  useEffect(() => {
16
+    Init()
17
+  }, [])
18
+
19
+  const Init = () => {
20
+    request({ ...apis.getGoodsDetail, args: { id: CurrnetId } }).then((res) => {
21
+      setGoodsDetail(res)
22
+    })
23
+  }
10 24
 
11 25
   return (
12 26
     <view className='ShangPinXiangQing'>
13 27
       <view className='Info'>
14 28
         <view className='Img'>
15
-          <image mode='aspectFill' src={null} className='centerLabel'></image>
29
+          <image mode='aspectFill' src={GoodsDetail === null ? null : GoodsDetail.imgUrl} className='centerLabel'></image>
16 30
         </view>
17 31
         <view className='Title'>
18
-          <text>筷子置物架收纳盒</text>
32
+          <text>{GoodsDetail === null ? '' : GoodsDetail.goodsName}</text>
19 33
         </view>
20 34
         <view className='flex-h'>
21
-          <text>3000</text>
35
+          <text>{GoodsDetail === null ? '' : GoodsDetail.pointPrice}</text>
22 36
           <text className='flex-item'>积分</text>
23 37
           <text>剩余数量</text>
24
-          <text>22</text>
38
+          <text>{GoodsDetail === null ? '' : GoodsDetail.inventory}</text>
25 39
         </view>
26 40
       </view>
27 41
       <view className='Detail'>
28 42
         <view className='Title'>
29 43
           <view className='Line'></view>
30 44
           <text>产品详情</text>
45
+          <image mode='widthFix' src={GoodsDetail === null ? null : GoodsDetail.detailImgUrl} style={{width: `100%`}}></image>
31 46
         </view>
32 47
         <view className='BottomBtn'>
33
-          <text className='active' onClick={() => { Taro.navigateTo({ url: `/pages/FuLi/ShangPinDuiHuan/index` }) }}>立即兑换</text>
48
+          <text className='active' onClick={() => { Taro.navigateTo({ url: `/pages/FuLi/ShangPinDuiHuan/index?id=${CurrnetId}` }) }}>立即兑换</text>
34 49
         </view>
35 50
       </view>
36 51
     </view>

+ 15
- 5
src/pages/ShouYe/index.jsx View File

@@ -20,10 +20,10 @@ export default function Index (props) {
20 20
   const [ShowAdvLayer, setShowAdvLayer] = useState(false)
21 21
   const [IsPull, setIsPull] = useState(false)
22 22
   const [OwnerList] = useState([
23
-    { icon: 'iconjiaofei', name: '物业缴费', id: 1 },
24
-    { icon: 'icontongzhi', name: '物业通知', id: 2 },
25
-    { icon: 'iconbaoxiu', name: '物业报修', id: 3 },
26
-    { icon: 'iconrenzheng', name: '业主认证', id: 4 }
23
+    { icon: 'iconjiaofei', name: '物业缴费', id: 1, router: '/pages/WuYe/index', isTab: true },
24
+    { icon: 'icontongzhi', name: '物业通知', id: 2, router: '/pages/WuYe/index', isTab: true },
25
+    { icon: 'iconbaoxiu', name: '物业报修', id: 3, router: '/pages/WuYe/index', isTab: true },
26
+    { icon: 'iconrenzheng', name: '业主认证', id: 4, router: '/pages/WoDe/YeZhuRenZheng/index', isTab: false }
27 27
   ])
28 28
   const [NavList] = useState([
29 29
     { icon: 'iconhuodong1', name: '活动', id: 1, router: '/pages/ShouYe/HuoDong/index', isTab: false },
@@ -124,6 +124,16 @@ export default function Index (props) {
124 124
     // console.log(111)
125 125
   }
126 126
 
127
+  const OwnerClick = (item) => {
128
+    return () => {
129
+      if (item.isTab) {
130
+        Taro.switchTab({ url: item.router })
131
+      } else {
132
+        Taro.navigateTo({ url: item.router })
133
+      }
134
+    }
135
+  }
136
+
127 137
   return (
128 138
     <Page>
129 139
       <view className='ShouYe flex-v'>
@@ -211,7 +221,7 @@ export default function Index (props) {
211 221
                       <view className='OwnerList flex-h'>
212 222
                         {
213 223
                           OwnerList.map((item, index) => (
214
-                            <view className='flex-item' key={`Owners-${index}`}>
224
+                            <view className='flex-item' key={`Owners-${index}`} onClick={OwnerClick(item)}>
215 225
                               <Text className={`iconfont ${item.icon}`}></Text>
216 226
                               <Text>{item.name}</Text>
217 227
                             </view>

+ 2
- 0
src/pages/WoDe/YeZhuRenZheng/index.css View File

@@ -39,6 +39,8 @@
39 39
 .YeZhuRenZheng > .Form > .flex-h > input {
40 40
   font-size: 28px;
41 41
   color: #333;
42
+  line-height: 100px;
43
+  height: 100px;
42 44
 }
43 45
 .YeZhuRenZheng > .BottomBtn {
44 46
   padding: 0 30px;

+ 62
- 9
src/pages/WoDe/YeZhuRenZheng/index.jsx View File

@@ -1,25 +1,67 @@
1
-import React, { useState } from 'react'
2
-import { Input } from '@tarojs/components'
1
+import React, { useState, useEffect } from 'react'
2
+import { Picker } from '@tarojs/components'
3
+import request, { apis } from '@/utils/request'
4
+import { useModel } from '@/store'
3 5
 import '@/assets/css/reset.less'
4 6
 import '@/assets/css/iconfont.less'
5 7
 import './index.less'
6 8
 
7
-export default function YeZhuRenZheng (props) {
9
+export default function YeZhuRenZheng () {
10
+
11
+  const { user } = useModel('user')
12
+  const [Level1Value] = useState(user.orgId)
13
+  const [Level2Value, setLevel2Value] = useState(null)
14
+  const [Level2List, setLevel2List] = useState([])
15
+  const [Level3Value, setLevel3Value] = useState(null)
16
+  const [Level3List, setLevel3List] = useState([])
17
+  const [Level4Value, setLevel4Value] = useState(null)
18
+  const [Level4List, setLevel4List] = useState([])
19
+  const [Level5Value, setLevel5Value] = useState(null)
20
+  const [Level5List, setLevel5List] = useState([])
21
+
22
+  useEffect(() => {
23
+    GetLevel2List()
24
+  }, [Level1Value])
25
+
26
+  useEffect(() => {
27
+    GetLevel3List()
28
+  }, [Level2Value])
29
+
30
+  const GetLevel2List = () => {
31
+    request({ ...apis.getRenZhengAddressList, params: { orgId: user.orgId } }).then((res) => {
32
+      setLevel2List(res || [])
33
+      if (res !== null && res.length > 0) {
34
+        setLevel2Value(0)
35
+      }
36
+    })
37
+  }
38
+
39
+  const GetLevel3List = () => {
40
+    if (Level2Value !== null) {
41
+      request({ ...apis.getRenZhengAddressList, params: { phaseId: Level2List[Level2Value].id } }).then((res) => {
42
+        setLevel3List(res || [])
43
+        if (res !== null && res.length > 0) {
44
+          setLevel3Value(0)
45
+        }
46
+      })
47
+    }
48
+  }
8 49
 
9 50
   return (
10 51
     <view className='YeZhuRenZheng'>
11 52
       <view className='Form'>
12
-        <view className='flex-h'>
53
+        <Picker mode='selector' value={Level1Value}></Picker>
54
+        {/* <view className='flex-h'>
13 55
           <text className='iconfont iconxingming'></text>
14
-          <Input className='flex-item' placeholder='请输入您的姓名'></Input>
56
+          <Input className='flex-item' placeholder='请输入您的姓名' value={FormData.RealName} onInput={(e) => { setFormData({ ...FormData, RealName: e.detail.value }) }}></Input>
15 57
         </view>
16 58
         <view className='flex-h'>
17 59
           <text className='iconfont iconshenfenzheng'></text>
18
-          <Input type='idcard' className='flex-item' placeholder='请输入您的身份证号码'></Input>
60
+          <Input type='idcard' className='flex-item' placeholder='请输入您的身份证号码' value={FormData.IdCard} onInput={(e) => { setFormData({ ...FormData, IdCard: e.detail.value }) }}></Input>
19 61
         </view>
20 62
         <view className='flex-h'>
21 63
           <text className='iconfont iconshouji'></text>
22
-          <Input type='idcard' className='flex-item' placeholder='请输入您的手机号码'></Input>
64
+          <Input type='idcard' className='flex-item' placeholder='请输入您的手机号码' value={FormData.Phone} onInput={(e) => { setFormData({ ...FormData, Phone: e.detail.value }) }}></Input>
23 65
         </view>
24 66
         <view className='flex-h'>
25 67
           <text className='iconfont iconyanzhengma'></text>
@@ -27,9 +69,20 @@ export default function YeZhuRenZheng (props) {
27 69
           <text className='active'>获取验证码</text>
28 70
         </view>
29 71
         <view className='flex-h'>
30
-          <text className='iconfont iconmenpaihao'></text>
31
-          <Input className='flex-item' placeholder='请输入小区楼栋单元门牌号'></Input>
72
+          <Input className='flex-item' placeholder='请输入小区名称' value={FormData.OrgName} onInput={(e) => { setFormData({ ...FormData, OrgName: e.detail.value }) }}></Input>
32 73
         </view>
74
+        <view className='flex-h'>
75
+          <Input className='flex-item' placeholder='请输入期号' value={FormData.Stages} onInput={(e) => { setFormData({ ...FormData, Stages: e.detail.value }) }}></Input>
76
+        </view>
77
+        <view className='flex-h'>
78
+          <Input className='flex-item' placeholder='请输入楼栋号' value={FormData.BuildingNum} onInput={(e) => { setFormData({ ...FormData, BuildingNum: e.detail.value }) }}></Input>
79
+        </view>
80
+        <view className='flex-h'>
81
+          <Input className='flex-item' placeholder='请输入单元号' value={FormData.UnitNum} onInput={(e) => { setFormData({ ...FormData, UnitNum: e.detail.value }) }}></Input>
82
+        </view>
83
+        <view className='flex-h'>
84
+          <Input className='flex-item' placeholder='请输入户号' value={FormData.RoomNum} onInput={(e) => { setFormData({ ...FormData, RoomNum: e.detail.value }) }}></Input>
85
+        </view> */}
33 86
       </view>
34 87
       <view className='BottomBtn'>
35 88
         <text>提交</text>

+ 2
- 0
src/pages/WoDe/YeZhuRenZheng/index.less View File

@@ -43,6 +43,8 @@
43 43
       >input {
44 44
         font-size: 28px;
45 45
         color: #333;
46
+        line-height: 100px;
47
+        height: 100px;
46 48
       }
47 49
     }
48 50
   }

+ 16
- 1
src/pages/WuYe/BaoXiuDetail/index.jsx View File

@@ -1,12 +1,27 @@
1
-import React, { useState } from 'react'
1
+import React, { useState, useEffect } from 'react'
2 2
 import Taro, { Current } from '@tarojs/taro'
3
+import request, { apis } from '@/utils/request'
4
+import { useModel } from '@/store'
3 5
 import '@/assets/css/reset.less'
4 6
 import '@/assets/css/iconfont.less'
5 7
 import './index.less'
6 8
 
7 9
 export default function BaoXiuDetail () {
8 10
 
11
+  const { user } = useModel('user')
9 12
   const CurrnetBaoXiuId = Current.router.params.id
13
+  const [DetailInfo, setDetailInfo] = useState(null)
14
+
15
+  useEffect(() => {
16
+    Init()
17
+  }, [])
18
+
19
+  const Init = () => {
20
+    request({ ...apis.getGongDanDetail, args: { orgId: user.orgId }, params: { ticketId: CurrnetBaoXiuId } }).then((res) => {
21
+      console.log(JSON.stringify(res))
22
+      setDetailInfo(res)
23
+    })
24
+  }
10 25
 
11 26
   return (
12 27
     <view className='BaoXiuDetail'>

+ 1
- 1
src/pages/WuYe/BaoXiuQuYu/index.jsx View File

@@ -17,7 +17,7 @@ export default function WuYeBaoXiuQuYu () {
17 17
       {
18 18
         TypeList.map((item, index) => (
19 19
           <view key={`WuYeBaoXiuQuYu-${index}`}>
20
-            <view onClick={() => { Taro.navigateTo({ url: `/pages/WuYe/TianJiaBaoXiu/index?type=${item.id}` }) }}>
20
+            <view onClick={() => { Taro.redirectTo({ url: `/pages/WuYe/TianJiaBaoXiu/index?type=${item.id}` }) }}>
21 21
               <view>
22 22
                 <text className={`iconfont ${item.icon}`}></text>
23 23
                 <text>{item.name}</text>

+ 22
- 24
src/pages/WuYe/GongGaoDetail/index.jsx View File

@@ -1,33 +1,31 @@
1
-import React, { Component } from 'react'
2
-import '../../../assets/css/reset.less'
3
-import '../../../assets/css/iconfont.less'
1
+import React, { useState, useEffect } from 'react'
2
+import Taro, { Current } from '@tarojs/taro'
3
+import request, { apis } from '@/utils/request'
4
+import { useModel } from '@/store'
5
+import '@/assets/css/reset.less'
6
+import '@/assets/css/iconfont.less'
4 7
 import './index.less'
5 8
 
6
-export default class WuYeGongGaoDetail extends Component {
9
+export default function WuYeGongGaoDetail () {
7 10
 
8
-  state = {
9
-  }
10
-
11
-  componentWillMount () {
12
-  }
11
+  const { user } = useModel('user')
12
+  const CurrnetId = Current.router.params.id
13
+  const [DetailInfo, setDetailInfo] = useState(null)
13 14
 
14
-  componentDidMount () { }
15
+  useEffect(() => {
16
+    Init()
17
+  }, [])
15 18
 
16
-  componentWillUnmount () { }
17
-  
18
-  onLoad (opt) {
19
-    console.log(opt.id)
19
+  const Init = () => {
20
+    request({ ...apis.getGongGaoDetail, args: { orgId: user.orgId }, params: { id: CurrnetId } }).then((res) => {
21
+      console.log(JSON.stringify(res))
22
+      setDetailInfo(res)
23
+    })
20 24
   }
21 25
 
22
-  componentDidShow () { }
26
+  return (
27
+    <view className='WuYeGongGaoDetail'>
23 28
 
24
-  componentDidHide () { }
25
-
26
-  render () {
27
-    return (
28
-      <view className='WuYeGongGaoDetail'>
29
-
30
-      </view>
31
-    )
32
-  }
29
+    </view>
30
+  )
33 31
 }

+ 17
- 3
src/pages/WuYe/TianJiaBaoXiu/index.jsx View File

@@ -21,8 +21,20 @@ export default function WuYeTianJiaBaoXiu () {
21 21
     setDesc(e.detail.value)
22 22
   }
23 23
 
24
-  const Send = () => {
25
-    if (DataLock) return
24
+  const CheckForm = () => { // 校验报修单
25
+    if (Title === '') {
26
+      Taro.showToast({ title: `报修标题不能为空`, icon: 'none' })
27
+      return false
28
+    }
29
+    if (Desc === '') {
30
+      Taro.showToast({ title: `报修描述不能为空`, icon: 'none' })
31
+      return false
32
+    }
33
+    return true
34
+  }
35
+
36
+  const Send = () => { // 提交报修
37
+    if (DataLock || !CheckForm()) return
26 38
     setDataLock(true)
27 39
     request({
28 40
       ...apis.AddGongDan,
@@ -32,7 +44,9 @@ export default function WuYeTianJiaBaoXiu () {
32 44
         type: 2,
33 45
         repairType: CurrnetBaoXiuType - 0
34 46
       }
35
-    }).then(() => {
47
+    }).then((res) => {
48
+      Taro.showToast({ title: '报修提交成功', icon: 'none' })
49
+      Taro.redirectTo({ url: `/pages/WuYe/BaoXiuDetail/index?id=${res.id}` })
36 50
       setDataLock(false)
37 51
     }).catch((res) => {
38 52
       Taro.showToast({ title: res, icon: 'none' })

+ 20
- 0
src/utils/api.js View File

@@ -1,6 +1,10 @@
1 1
 const prefix = `${HOST}/api/wx`
2 2
 
3 3
 const $api = {
4
+  getRenZhengAddressList: { // 获取认证业主房产选择联动列表
5
+    method: 'get',
6
+    url: `${prefix}/building/select/address`
7
+  },
4 8
   getJiaoFeiList: { // 获取缴费列表
5 9
     method: 'get',
6 10
     url: `${prefix}/bills/current_user/:type`
@@ -13,10 +17,18 @@ const $api = {
13 17
     method: 'post',
14 18
     url: `${prefix}/addtpTicket`
15 19
   },
20
+  getGongDanDetail: { // 获取工单详情
21
+    method: 'get',
22
+    url: `${prefix}/ticket/schedule/:orgId`
23
+  },
16 24
   getGongGaoList: { // 获取小区公告列表
17 25
     method: 'get',
18 26
     url: `${prefix}/announcements/:orgId`
19 27
   },
28
+  getGongGaoDetail: { // 获取小区公告详情
29
+    method: 'get',
30
+    url: `${prefix}/announcement/:orgId`
31
+  },
20 32
   getUserPhone: { // 获取用户手机号
21 33
     method: 'post',
22 34
     url: `${prefix}/userPhone`
@@ -45,6 +57,14 @@ const $api = {
45 57
     method: 'get',
46 58
     url: `${prefix}/goods`
47 59
   },
60
+  getGoodsDetail: { // 获取商品详情
61
+    method: 'get',
62
+    url: `${prefix}/goods/:id`
63
+  },
64
+  exchangeGoods: { // 兑换商品
65
+    method: 'post',
66
+    url: `${prefix}/goods/exchange/:id`
67
+  },
48 68
   getNewsList: { // 获取资讯列表
49 69
     method: 'get',
50 70
     url: `${prefix}/taNews`