Browse Source

静态页面

1002884655 4 years ago
parent
commit
4ed2991bf3

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

21
   const [ShowPingJiaPopup, setShowPingJiaPopup] = useState(false)
21
   const [ShowPingJiaPopup, setShowPingJiaPopup] = useState(false)
22
   const [StarIndex, setStarIndex] = useState(0)
22
   const [StarIndex, setStarIndex] = useState(0)
23
   const [Comment, setComment] = useState(null)
23
   const [Comment, setComment] = useState(null)
24
+  const [ReplyContent, setReplyContent] = useState(null)
24
   const [DataLock, setDataLock] = useState(false)
25
   const [DataLock, setDataLock] = useState(false)
26
+  const [ShowReplyPopup, setShowReplyPopup] = useState(false)
27
+  const [CurrentReplyId, setCurrentReplyId] = useState(null)
25
 
28
 
26
   Taro.useShareAppMessage(() => {
29
   Taro.useShareAppMessage(() => {
27
     return getShareObject({
30
     return getShareObject({
35
     Init()
38
     Init()
36
   }, [])
39
   }, [])
37
 
40
 
41
+  useEffect(() => {
42
+    if (CurrentReplyId !== null) {
43
+      setReplyContent(null)
44
+      setShowReplyPopup(true)
45
+    }
46
+  }, [CurrentReplyId])
47
+
38
   const Init = () => {
48
   const Init = () => {
39
     request({ ...apis.getGongDanDetail, args: { orgId: user.orgId }, params: { ticketId: CurrnetBaoXiuId } }).then((res) => { // 获取工单详情
49
     request({ ...apis.getGongDanDetail, args: { orgId: user.orgId }, params: { ticketId: CurrnetBaoXiuId } }).then((res) => { // 获取工单详情
40
       setDetailInfo(res)
50
       setDetailInfo(res)
50
     }
60
     }
51
   }
61
   }
52
 
62
 
63
+  const ReplyChange = (e) => {
64
+    setReplyContent(e.detail.value)
65
+  }
66
+
53
   const CommentChange = (e) => {
67
   const CommentChange = (e) => {
54
     setComment(e.detail.value)
68
     setComment(e.detail.value)
55
   }
69
   }
56
 
70
 
71
+  const ToReply = () => {
72
+    if (DataLock) return
73
+    setDataLock(true)
74
+    request({ ...apis.ReplyTicket, args: { orgId: user.orgId }, data: { ticketId: CurrnetBaoXiuId, content: ReplyContent, ticketRecordCommentId: CurrentReplyId } }).then((res) => { // 获取工单详情
75
+      Taro.showToast({ title: '回复成功', icon: 'none' })
76
+      Init()
77
+      setDataLock(false)
78
+      setShowReplyPopup(false)
79
+    }).catch((res) => {
80
+      Taro.showToast({ title: res, icon: 'none' })
81
+      setDataLock(false)
82
+    })
83
+  }
84
+
57
   const ToPingJia = () => {
85
   const ToPingJia = () => {
58
     if (DataLock) return
86
     if (DataLock) return
59
     setDataLock(true)
87
     setDataLock(true)
68
     })
96
     })
69
   }
97
   }
70
 
98
 
99
+  const StepClick = (item) => {
100
+    return () => {
101
+      if (DetailInfo.status - 0 < 4) {
102
+        setCurrentReplyId(item.id)
103
+      }
104
+    }
105
+  }
106
+
71
   return (
107
   return (
72
     <Page>
108
     <Page>
73
       <view className='BaoXiuDetail'>
109
       <view className='BaoXiuDetail'>
100
                 {
136
                 {
101
                   DetailInfo !== null && DetailInfo.ticketRecordList !== null &&
137
                   DetailInfo !== null && DetailInfo.ticketRecordList !== null &&
102
                   DetailInfo.ticketRecordList.map((item, index) => (
138
                   DetailInfo.ticketRecordList.map((item, index) => (
103
-                    <view className='StepList' key={`StepList-${index}`}>
139
+                    <view className='StepList' key={`StepList-${index}`} onClick={StepClick(item)}>
104
                       <view className='Title flex-h'>
140
                       <view className='Title flex-h'>
105
                         <text className='flex-item Red'>{item.ticketStatusName}</text>
141
                         <text className='flex-item Red'>{item.ticketStatusName}</text>
106
                         <text>{toolclass.FormatDate(item.createDate)}</text>
142
                         <text>{toolclass.FormatDate(item.createDate)}</text>
144
           </view>
180
           </view>
145
         </view>
181
         </view>
146
 
182
 
183
+        <SlidePopup Close={() => { setShowReplyPopup(false) }} Show={ShowReplyPopup}>
184
+          <view className='ReplyPopup'>
185
+            <Textarea placeholder='请输入您的回复' onInput={ReplyChange} value={ReplyContent}></Textarea>
186
+            <text className='Btn' onClick={ToReply}>回复</text>
187
+          </view>
188
+        </SlidePopup>
189
+
147
         <SlidePopup Close={() => { setShowPingJiaPopup(false) }} Show={ShowPingJiaPopup}>
190
         <SlidePopup Close={() => { setShowPingJiaPopup(false) }} Show={ShowPingJiaPopup}>
148
           <view className='PinJiaPopup'>
191
           <view className='PinJiaPopup'>
149
             <text className='Title'>请对此次服务进行评分</text>
192
             <text className='Title'>请对此次服务进行评分</text>

+ 2
- 1
src/pages/WuYe/BaoXiuDetail/index.less View File

249
       }
249
       }
250
     }
250
     }
251
   }
251
   }
252
-  .PinJiaPopup {
252
+  .PinJiaPopup,
253
+  .ReplyPopup {
253
     padding: 0 30px;
254
     padding: 0 30px;
254
     position: relative;
255
     position: relative;
255
     overflow: hidden;
256
     overflow: hidden;

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

1
 const prefix = `${HOST}/api/wx`
1
 const prefix = `${HOST}/api/wx`
2
 
2
 
3
 const $api = {
3
 const $api = {
4
+  ReplyTicket: { // 工单回复
5
+    method: 'post',
6
+    url: `${prefix}/ticket/reply/:orgId`
7
+  },
4
   PostGongDanPingJia: { // 工单评价
8
   PostGongDanPingJia: { // 工单评价
5
     method: 'post',
9
     method: 'post',
6
     url: `${prefix}/accessTicket/:orgId`
10
     url: `${prefix}/accessTicket/:orgId`