浏览代码

新增添加评论

梁沛聪 6 年前
父节点
当前提交
b1c43255ee

+ 6
- 4
miniapp/app/pages/addComment/index.js 查看文件

6
     },
6
     },
7
     onLoad(e) {
7
     onLoad(e) {
8
         const id = e.id || '';
8
         const id = e.id || '';
9
+        const type = e.type || '';
9
         this.setData({
10
         this.setData({
10
-            id
11
+            id,
12
+            type
11
         });
13
         });
12
     },
14
     },
13
     inputComment(e) {
15
     inputComment(e) {
18
     submit() {
20
     submit() {
19
         const {
21
         const {
20
             id,
22
             id,
23
+            type,
21
             comment
24
             comment
22
         } = this.data;
25
         } = this.data;
23
         if (!id) return;
26
         if (!id) return;
29
         $.wx.showToast({
32
         $.wx.showToast({
30
             title: '加载中'
33
             title: '加载中'
31
         }, 'loading');
34
         }, 'loading');
32
-        $.request('systemController/feedback', 'POST', {
33
-            comment,
34
-            id
35
+        $.request(`${type}/${id}/comment`, 'POST', {
36
+            content: comment
35
         }).then(res => {
37
         }).then(res => {
36
             $.wx.showToast({
38
             $.wx.showToast({
37
                 title: '提交成功'
39
                 title: '提交成功'

+ 1
- 1
miniapp/app/pages/introduce/index.js 查看文件

7
         const name = options.name || '';
7
         const name = options.name || '';
8
         if (id) {
8
         if (id) {
9
             $.request(`server_info/${id}`, 'GET', {}, true).then((res) => {
9
             $.request(`server_info/${id}`, 'GET', {}, true).then((res) => {
10
-                var article = res.data.content || '';
10
+                var article = res.data && res.data.content || '';
11
                 /**
11
                 /**
12
                  * WxParse.wxParse(bindName , type, data, target,imagePadding)
12
                  * WxParse.wxParse(bindName , type, data, target,imagePadding)
13
                  * 1.bindName绑定的数据名(必填)
13
                  * 1.bindName绑定的数据名(必填)

+ 7
- 2
miniapp/app/pages/order/index.js 查看文件

77
     },
77
     },
78
     addComment(e) {
78
     addComment(e) {
79
         const {
79
         const {
80
-            id
80
+            id,
81
+            type
81
         } = e.target.dataset;
82
         } = e.target.dataset;
82
         if (id) {
83
         if (id) {
83
             $.router.goto({
84
             $.router.goto({
84
-                path: '/pages/addComment/index'
85
+                path: '/pages/addComment/index',
86
+                query: {
87
+                    id,
88
+                    type
89
+                }
85
             });
90
             });
86
         }
91
         }
87
     }
92
     }

+ 6
- 3
miniapp/app/pages/order/index.wxml 查看文件

15
                     <view class="right">
15
                     <view class="right">
16
                         <view class="text-top">{{item.orderText}}</view>
16
                         <view class="text-top">{{item.orderText}}</view>
17
                         <view class="text-bottom" wx:if="{{item.status != 0}}">¥{{item.price}}</view>
17
                         <view class="text-bottom" wx:if="{{item.status != 0}}">¥{{item.price}}</view>
18
-                        <view class="btn-blue" bindtap="toPay" data-id="{{item.id}}" data-type="{{item.order_type}}" wx:if="{{item.status == 1}}">立即付款</view>
19
-                        <view class="btn-blue" bindtap="addComment" data-id="{{item.id}}" wx:if="{{item.status == 2 && !item.comment}}">添加评价</view>
18
+                        <view class="btn-blue" bindtap="toPay" data-id="{{item.id}}" data-type="{{item.order_type}}"
19
+                            wx:if="{{item.status == 1}}">立即付款</view>
20
+                        <view class="btn-blue" bindtap="addComment" data-id="{{item.id}}" data-type="{{item.order_type}}"
21
+                            wx:if="{{item.status == 2 && !item.comment}}">添加评价</view>
20
                     </view>
22
                     </view>
21
                 </view>
23
                 </view>
22
                 <!-- <view class="cell">
24
                 <!-- <view class="cell">
49
                     <view class="right">
51
                     <view class="right">
50
                         <view class="text-top">{{item.orderText}}</view>
52
                         <view class="text-top">{{item.orderText}}</view>
51
                         <view class="text-bottom">¥{{item.price}}</view>
53
                         <view class="text-bottom">¥{{item.price}}</view>
52
-                        <view class="btn-blue" bindtap="toPay" data-id="{{item.id}}" data-type="{{item.order_type}}" wx:if="{{item.status == 0}}">立即付款</view>
54
+                        <view class="btn-blue" bindtap="toPay" data-id="{{item.id}}" data-type="{{item.order_type}}"
55
+                            wx:if="{{item.status == 0}}">立即付款</view>
53
                     </view>
56
                     </view>
54
                 </view>
57
                 </view>
55
             </view>
58
             </view>

Loading…
取消
保存