1002884655 před 4 roky
rodič
revize
4ed2991bf3

+ 44
- 1
src/pages/WuYe/BaoXiuDetail/index.jsx Zobrazit soubor

@@ -21,7 +21,10 @@ export default function BaoXiuDetail () {
21 21
   const [ShowPingJiaPopup, setShowPingJiaPopup] = useState(false)
22 22
   const [StarIndex, setStarIndex] = useState(0)
23 23
   const [Comment, setComment] = useState(null)
24
+  const [ReplyContent, setReplyContent] = useState(null)
24 25
   const [DataLock, setDataLock] = useState(false)
26
+  const [ShowReplyPopup, setShowReplyPopup] = useState(false)
27
+  const [CurrentReplyId, setCurrentReplyId] = useState(null)
25 28
 
26 29
   Taro.useShareAppMessage(() => {
27 30
     return getShareObject({
@@ -35,6 +38,13 @@ export default function BaoXiuDetail () {
35 38
     Init()
36 39
   }, [])
37 40
 
41
+  useEffect(() => {
42
+    if (CurrentReplyId !== null) {
43
+      setReplyContent(null)
44
+      setShowReplyPopup(true)
45
+    }
46
+  }, [CurrentReplyId])
47
+
38 48
   const Init = () => {
39 49
     request({ ...apis.getGongDanDetail, args: { orgId: user.orgId }, params: { ticketId: CurrnetBaoXiuId } }).then((res) => { // 获取工单详情
40 50
       setDetailInfo(res)
@@ -50,10 +60,28 @@ export default function BaoXiuDetail () {
50 60
     }
51 61
   }
52 62
 
63
+  const ReplyChange = (e) => {
64
+    setReplyContent(e.detail.value)
65
+  }
66
+
53 67
   const CommentChange = (e) => {
54 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 85
   const ToPingJia = () => {
58 86
     if (DataLock) return
59 87
     setDataLock(true)
@@ -68,6 +96,14 @@ export default function BaoXiuDetail () {
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 107
   return (
72 108
     <Page>
73 109
       <view className='BaoXiuDetail'>
@@ -100,7 +136,7 @@ export default function BaoXiuDetail () {
100 136
                 {
101 137
                   DetailInfo !== null && DetailInfo.ticketRecordList !== null &&
102 138
                   DetailInfo.ticketRecordList.map((item, index) => (
103
-                    <view className='StepList' key={`StepList-${index}`}>
139
+                    <view className='StepList' key={`StepList-${index}`} onClick={StepClick(item)}>
104 140
                       <view className='Title flex-h'>
105 141
                         <text className='flex-item Red'>{item.ticketStatusName}</text>
106 142
                         <text>{toolclass.FormatDate(item.createDate)}</text>
@@ -144,6 +180,13 @@ export default function BaoXiuDetail () {
144 180
           </view>
145 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 190
         <SlidePopup Close={() => { setShowPingJiaPopup(false) }} Show={ShowPingJiaPopup}>
148 191
           <view className='PinJiaPopup'>
149 192
             <text className='Title'>请对此次服务进行评分</text>

+ 2
- 1
src/pages/WuYe/BaoXiuDetail/index.less Zobrazit soubor

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

+ 4
- 0
src/utils/api.js Zobrazit soubor

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