Commit 513e48008db77d608581e93156a4179d9ea317c8
1 parent
bd067e17
商品详情页,评价,订单列表,util
Showing
5 changed files
with
60 additions
and
34 deletions
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -387,7 +387,7 @@ Page({ |
387 | 387 | if(fir_com){ |
388 | 388 | for(var ind in fir_com){ |
389 | 389 | if(fir_com[ind].head_pic=="") fir_com[ind].head_pic= ee.data.iurl+"/miniapp/images/hui_hear_pic.png"; |
390 | - if (fir_com[ind].img) fir_com[ind].img = ut.unserialize(fir_com[ind].img); | |
390 | + if (fir_com[ind].img) fir_com[ind].img = ut.unserialize(fir_com[ind].img); | |
391 | 391 | } |
392 | 392 | } |
393 | 393 | ... | ... |
pages/user/add_comment/add_comment.js
... | ... | @@ -8,8 +8,8 @@ Page({ |
8 | 8 | resourceUrl: a.resourceUrl, |
9 | 9 | iurl: a.imghost, |
10 | 10 | defaultPhoto: a.resourceUrl + "/static/images/camera.png", |
11 | - filePaths: [], | |
12 | - uploadPath: [], | |
11 | + | |
12 | + uploadPath: [], //上传后文件路径 | |
13 | 13 | maxWord: 0, |
14 | 14 | is_anonymous: !1, |
15 | 15 | goods_rank: 0, |
... | ... | @@ -19,7 +19,7 @@ Page({ |
19 | 19 | options: null, |
20 | 20 | isLongPress: !1, |
21 | 21 | userinfo: null, |
22 | - imgs: [], | |
22 | + imgs: [], //本地文件再上传时的路径 | |
23 | 23 | lenMore:0 |
24 | 24 | }, |
25 | 25 | onLoad: async function (a) { |
... | ... | @@ -85,24 +85,33 @@ Page({ |
85 | 85 | var a = this; |
86 | 86 | if (!a.data.service_rank || !a.data.goods_rank || !a.data.deliver_rank) |
87 | 87 | return getApp().my_warnning("请先打分",0,a); |
88 | + if(a.data.content=="") | |
89 | + return getApp().my_warnning("请填写评价内容",0,a); | |
88 | 90 | |
89 | 91 | this.uploadPhotos(function () { |
90 | - console.log("submitComment"); | |
91 | - console.log(a.data.uploadPath); | |
92 | + var p_data= { | |
93 | + email: ' ', | |
94 | + is_show: 1, | |
95 | + goods_rank: a.data.goods_rank, | |
96 | + service_rank: a.data.service_rank, | |
97 | + deliver_rank: a.data.deliver_rank, | |
98 | + content: a.data.content, | |
99 | + goods_id: a.data.options.goods_id, | |
100 | + order_id: a.data.options.order_id, | |
101 | + user_id: oo.user_id, | |
102 | + store_id: os.stoid, | |
103 | + username: a.data.userinfo.nickname, | |
104 | + source_type:1 | |
105 | + } | |
106 | + if(a.data.uploadPath){ | |
107 | + p_data['weapp_img']=JSON.stringify(a.data.uploadPath); | |
108 | + } | |
109 | + if(a.data.is_anonymous){ | |
110 | + p_data['is_anonymous']=1; | |
111 | + } | |
112 | + | |
92 | 113 | e.post("/api/weshop/comment/savecomment", { |
93 | - data: { | |
94 | - email: ' ', | |
95 | - is_show: 1, | |
96 | - goods_rank: a.data.goods_rank, | |
97 | - service_rank: a.data.service_rank, | |
98 | - deliver_rank: a.data.deliver_rank, | |
99 | - content: a.data.content, | |
100 | - goods_id: a.data.options.goods_id, | |
101 | - order_id: a.data.options.order_id, | |
102 | - user_id: oo.user_id, | |
103 | - store_id: os.stoid, | |
104 | - username: a.data.userinfo.nickname | |
105 | - }, | |
114 | + data:p_data, | |
106 | 115 | success: function (a) { |
107 | 116 | wx.setStorageSync("user:comment:update", !0), t.showSuccess("评论成功", function () { |
108 | 117 | wx.navigateBack(); |
... | ... | @@ -114,14 +123,17 @@ Page({ |
114 | 123 | |
115 | 124 | |
116 | 125 | uploadPhotos: function (t, a) { |
117 | - if (0 == this.data.filePaths.length) return t(); | |
126 | + if (0 == this.data.imgs.length) return t(); | |
118 | 127 | if ("number" != typeof a) a = 0; else if (a >= this.data.imgs.length) return t(); |
119 | 128 | var s = this; |
120 | - e.uploadFile("api/weshop/comment/uploadCommentImg", { | |
129 | + e.uploadFile("/api/weshop/comment/uploadCommentImg", { | |
121 | 130 | filePath: s.data.imgs[a], |
122 | - name: "img_file", | |
131 | + name: "file", | |
123 | 132 | success: function (e) { |
124 | - s.data.uploadPath[a] = e.data.result, s.uploadPhotos(t, a + 1); | |
133 | + console.log("uploadPhotos"); | |
134 | + console.log(e.data); | |
135 | + if(e.data.code==0) | |
136 | + s.data.uploadPath[a] = e.data.data, s.uploadPhotos(t, a + 1); | |
125 | 137 | } |
126 | 138 | }); |
127 | 139 | }, |
... | ... | @@ -192,5 +204,11 @@ Page({ |
192 | 204 | }) |
193 | 205 | }, |
194 | 206 | |
207 | + txtInpt:function (e) { | |
208 | + this.setData({ | |
209 | + content: e.detail.value | |
210 | + }) | |
211 | + } | |
212 | + | |
195 | 213 | |
196 | 214 | }); |
197 | 215 | \ No newline at end of file | ... | ... |
pages/user/add_comment/add_comment.wxml
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | <view class='commodity'> |
55 | 55 | <!-- 商品信息 --> |
56 | 56 | <view class='information flex-vertical'> |
57 | - <image src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3117916781,836883337&fm=26&gp=0.jpg"></image> | |
57 | + <image src="{{options.img}}" binderror="bind_bnerr2" data-errorimg="options.img"></image> | |
58 | 58 | <view class="goods_name xc-black"> |
59 | 59 | <!-- 商品名称 --> |
60 | 60 | <view class='ellipsis-2 fs32'>{{options.goods_name}}我弄饭v的v哦女v绝我弄饭v的v哦女v绝望愤怒冻死我弄饭v的v哦女v绝望愤怒冻死望愤怒冻死</view> |
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | <!-- 价格 --> |
64 | 64 | <view class='flex-vertical balin'> |
65 | 65 | <view class="fs24">¥</view> |
66 | - <view class="fs35">{{options.price}}3333.00</view> | |
66 | + <view class="fs35">{{options.price}}</view> | |
67 | 67 | </view> |
68 | 68 | |
69 | 69 | <!-- 商品数量 --> |
... | ... | @@ -81,7 +81,9 @@ |
81 | 81 | |
82 | 82 | <!-- 商品评价信息 --> |
83 | 83 | <view class="addComment"> |
84 | - <textarea class="fs24" placeholder="已经收到商品,快跟大家分享一下宝贝吧!" placeholder-class="fs24" maxlength="500"></textarea> | |
84 | + <textarea class="fs24" placeholder="已经收到商品,快跟大家分享一下宝贝吧!" | |
85 | + bindinput="txtInpt" | |
86 | + placeholder-class="fs24" maxlength="500" value="{{content}}"></textarea> | |
85 | 87 | <view class="flex addimages"> |
86 | 88 | <!-- 评论图片集合 --> |
87 | 89 | <view class="images"> |
... | ... | @@ -130,7 +132,6 @@ |
130 | 132 | <view class="stars flex-vertical"> |
131 | 133 | <image bindtap="checkDeliverRank" data-i="{{index}}" src="{{index<deliver_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}" |
132 | 134 | wx:for="{{5}}" wx:key="{{index}}"></image> |
133 | - | |
134 | 135 | </view> |
135 | 136 | </view> |
136 | 137 | <view class="score-item flex-vertical"> |
... | ... | @@ -138,8 +139,6 @@ |
138 | 139 | <view class="stars flex-vertical"> |
139 | 140 | <image src="{{index<service_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}" |
140 | 141 | bindtap="checkServiceRank" data-i="{{index}}" wx:for="{{5}}" wx:key="{{index}}"></image> |
141 | - | |
142 | - | |
143 | 142 | </view> |
144 | 143 | |
145 | 144 | </view> |
... | ... | @@ -153,7 +152,7 @@ |
153 | 152 | <view class=" Whether "> |
154 | 153 | <!-- 选择是否匿名 --> |
155 | 154 | <view class="allClick flex-right-vertical" bindtap="checkAnonymous"> |
156 | - <icon class="radio" size="15" type="success" color="{{is_anonymous?'red':'gainsboro'}}"></icon> | |
155 | + <icon class="radio" size="15" type="success" color="{{is_anonymous?'red':'gainsboro'}}"></icon> | |
157 | 156 | <view class="fs24 ">匿名评价</view> |
158 | 157 | </view> |
159 | 158 | ... | ... |
pages/user/order_list/order_list.wxml
... | ... | @@ -84,10 +84,16 @@ |
84 | 84 | |
85 | 85 | |
86 | 86 | <view bindtap="confirmOrder" data-zsorder="{{item.is_zsorder}}" class="order-btn white red-b" data-id="{{item.order_id}}" hidden="{{!(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">确认收货</view> |
87 | - <view bindtap="confirmOrder" data-zsorder="{{item.is_zsorder}}" class="order-btn white red-b" data-id="{{item.order_id}}" hidden="{{!(item.order_status==1&&item.pay_status==1&&item.shipping_status==2)}}">确认收货</view> | |
88 | - <navigator redirect class="order-btn white red-b" hidden="{{!(item.order_status==2)}}" url="/pages/user/comment/comment?status=0">评价</navigator> | |
87 | + <view bindtap="confirmOrder" data-zsorder="{{item.is_zsorder}}" class="order-btn white red-b" data-id="{{item.order_id}}" hidden="{{!(item.order_status==1&&item.pay_status==1&&item.shipping_status==2)}}">确认收货</view> | |
88 | + | |
89 | + <navigator wx:if="{{item.order_goods.length>1}}" redirect class="order-btn white red-b" hidden="{{!(item.order_status==2)}}" | |
90 | + url="/pages/user/comment/comment?status=0&order_id={{item.order_id}}">评价</navigator> | |
91 | + <navigator wx:else redirect class="order-btn white red-b" hidden="{{!(item.order_status==2)}}" | |
92 | + url="/pages/user/add_comment/add_comment?goods_id={{item.order_goods[0].goods_id}}&order_id={{item.order_id}}&price={{item.order_goods[0].goods_price}}">评价</navigator> | |
93 | + | |
94 | + | |
89 | 95 | <navigator class="order-btn" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==1)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator> |
90 | - <navigator class="order-btn" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==2)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator> | |
96 | + <navigator class="order-btn" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==2)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator> | |
91 | 97 | |
92 | 98 | </view> |
93 | 99 | ... | ... |
utils/request.js
... | ... | @@ -43,7 +43,10 @@ module.exports = { |
43 | 43 | filePath: e.filePath, |
44 | 44 | name: e.name, |
45 | 45 | success: function(t) { |
46 | - i.hideLoading(), console.log("app.request", t), t.data = JSON.parse(i.filterJsonData(t.data)), | |
46 | + i.hideLoading(); | |
47 | + if(t.statusCode==200) | |
48 | + t.data = JSON.parse(i.filterJsonData(t.data)); | |
49 | + else { t={code:-1,msg:'调用接口失败'};} | |
47 | 50 | i.doSuccess(e, t); |
48 | 51 | }, |
49 | 52 | fail: function(t) { | ... | ... |