XuChengxiang 4 lat temu
rodzic
commit
006d2249f3

+ 27
- 2
src/pages/WuYe/BaoXiuDetail/index.jsx Wyświetl plik

4
 import { useModel } from '@/store'
4
 import { useModel } from '@/store'
5
 import toolclass from '@/utils/toolclass.js'
5
 import toolclass from '@/utils/toolclass.js'
6
 import SlidePopup from '@/components/SlidePopup/index'
6
 import SlidePopup from '@/components/SlidePopup/index'
7
+import { Textarea } from '@tarojs/components'
7
 import Page from '@/layouts'
8
 import Page from '@/layouts'
8
 import { getShareObject } from '@/utils/share.js'
9
 import { getShareObject } from '@/utils/share.js'
9
 import '@/assets/css/reset.less'
10
 import '@/assets/css/reset.less'
19
   const [ShowPopup, setShowPopup] = useState(false)
20
   const [ShowPopup, setShowPopup] = useState(false)
20
   const [ShowPingJiaPopup, setShowPingJiaPopup] = useState(false)
21
   const [ShowPingJiaPopup, setShowPingJiaPopup] = useState(false)
21
   const [StarIndex, setStarIndex] = useState(0)
22
   const [StarIndex, setStarIndex] = useState(0)
23
+  const [Comment, setComment] = useState(null)
24
+  const [DataLock, setDataLock] = useState(false)
22
 
25
 
23
   Taro.useShareAppMessage(() => {
26
   Taro.useShareAppMessage(() => {
24
     return getShareObject({
27
     return getShareObject({
47
     }
50
     }
48
   }
51
   }
49
 
52
 
53
+  const CommentChange = (e) => {
54
+    setComment(e.detail.value)
55
+  }
56
+
57
+  const ToPingJia = () => {
58
+    if (DataLock) return
59
+    setDataLock(true)
60
+    request({ ...apis.PostGongDanPingJia, args: { orgId: user.orgId }, params: { ticketId: CurrnetBaoXiuId }, data: { score: StarIndex - 0 + 1, comment: Comment } }).then((res) => { // 获取工单详情
61
+      Taro.showToast({ title: '评价成功', icon: 'none' })
62
+      setDetailInfo({ ...DetailInfo, status: 5 })
63
+      setDataLock(false)
64
+      setShowPingJiaPopup(false)
65
+    }).catch((res) => {
66
+      Taro.showToast({ title: res, icon: 'none' })
67
+      setDataLock(false)
68
+    })
69
+  }
70
+
50
   return (
71
   return (
51
     <Page>
72
     <Page>
52
       <view className='BaoXiuDetail'>
73
       <view className='BaoXiuDetail'>
111
 
132
 
112
           {/* 更多操作 */}
133
           {/* 更多操作 */}
113
           <view className='BottomBtn active'>
134
           <view className='BottomBtn active'>
114
-            <text onClick={() => { setShowPingJiaPopup(true) }}>评价</text>
135
+            {
136
+              DetailInfo !== null && DetailInfo.status - 0 === 4 &&
137
+              <text onClick={() => { setShowPingJiaPopup(true) }}>评价</text>
138
+            }
115
           </view>
139
           </view>
116
 
140
 
117
           {/* 更多操作 */}
141
           {/* 更多操作 */}
130
                 ))
154
                 ))
131
               }
155
               }
132
             </view>
156
             </view>
133
-            <text className='Btn'>提交</text>
157
+            <Textarea placeholder='请输入您的评价' onInput={CommentChange} value={Comment}></Textarea>
158
+            <text className='Btn' onClick={ToPingJia}>提交</text>
134
           </view>
159
           </view>
135
         </SlidePopup>
160
         </SlidePopup>
136
 
161
 

+ 9
- 0
src/pages/WuYe/BaoXiuDetail/index.less Wyświetl plik

259
       color: #666;
259
       color: #666;
260
       line-height: 40px;
260
       line-height: 40px;
261
     }
261
     }
262
+    textarea {
263
+      font-size: 26px;
264
+      line-height: 40px;
265
+      width: 100%;
266
+      display: block;
267
+      box-sizing: border-box;
268
+      border: 2px solid rgba(0, 0, 0, 0.08);
269
+      margin-top: 60px;
270
+    }
262
     >.StarLine {
271
     >.StarLine {
263
       font-size: 0;
272
       font-size: 0;
264
       white-space: nowrap;
273
       white-space: nowrap;

+ 4
- 0
src/utils/api.js Wyświetl plik

1
 const prefix = `${HOST}/api/wx`
1
 const prefix = `${HOST}/api/wx`
2
 
2
 
3
 const $api = {
3
 const $api = {
4
+  PostGongDanPingJia: { // 工单评价
5
+    method: 'post',
6
+    url: `${prefix}/accessTicket/:orgId`
7
+  },
4
   getGuanJiaGongDanList:{ // 获取管家工单列表
8
   getGuanJiaGongDanList:{ // 获取管家工单列表
5
     method: 'get',
9
     method: 'get',
6
     url: `${prefix}/life/ticket/list`
10
     url: `${prefix}/life/ticket/list`