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,7 +387,7 @@ Page({ | ||
387 | if(fir_com){ | 387 | if(fir_com){ |
388 | for(var ind in fir_com){ | 388 | for(var ind in fir_com){ |
389 | if(fir_com[ind].head_pic=="") fir_com[ind].head_pic= ee.data.iurl+"/miniapp/images/hui_hear_pic.png"; | 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 +8,8 @@ Page({ | ||
8 | resourceUrl: a.resourceUrl, | 8 | resourceUrl: a.resourceUrl, |
9 | iurl: a.imghost, | 9 | iurl: a.imghost, |
10 | defaultPhoto: a.resourceUrl + "/static/images/camera.png", | 10 | defaultPhoto: a.resourceUrl + "/static/images/camera.png", |
11 | - filePaths: [], | ||
12 | - uploadPath: [], | 11 | + |
12 | + uploadPath: [], //上传后文件路径 | ||
13 | maxWord: 0, | 13 | maxWord: 0, |
14 | is_anonymous: !1, | 14 | is_anonymous: !1, |
15 | goods_rank: 0, | 15 | goods_rank: 0, |
@@ -19,7 +19,7 @@ Page({ | @@ -19,7 +19,7 @@ Page({ | ||
19 | options: null, | 19 | options: null, |
20 | isLongPress: !1, | 20 | isLongPress: !1, |
21 | userinfo: null, | 21 | userinfo: null, |
22 | - imgs: [], | 22 | + imgs: [], //本地文件再上传时的路径 |
23 | lenMore:0 | 23 | lenMore:0 |
24 | }, | 24 | }, |
25 | onLoad: async function (a) { | 25 | onLoad: async function (a) { |
@@ -85,24 +85,33 @@ Page({ | @@ -85,24 +85,33 @@ Page({ | ||
85 | var a = this; | 85 | var a = this; |
86 | if (!a.data.service_rank || !a.data.goods_rank || !a.data.deliver_rank) | 86 | if (!a.data.service_rank || !a.data.goods_rank || !a.data.deliver_rank) |
87 | return getApp().my_warnning("请先打分",0,a); | 87 | return getApp().my_warnning("请先打分",0,a); |
88 | + if(a.data.content=="") | ||
89 | + return getApp().my_warnning("请填写评价内容",0,a); | ||
88 | 90 | ||
89 | this.uploadPhotos(function () { | 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 | e.post("/api/weshop/comment/savecomment", { | 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 | success: function (a) { | 115 | success: function (a) { |
107 | wx.setStorageSync("user:comment:update", !0), t.showSuccess("评论成功", function () { | 116 | wx.setStorageSync("user:comment:update", !0), t.showSuccess("评论成功", function () { |
108 | wx.navigateBack(); | 117 | wx.navigateBack(); |
@@ -114,14 +123,17 @@ Page({ | @@ -114,14 +123,17 @@ Page({ | ||
114 | 123 | ||
115 | 124 | ||
116 | uploadPhotos: function (t, a) { | 125 | uploadPhotos: function (t, a) { |
117 | - if (0 == this.data.filePaths.length) return t(); | 126 | + if (0 == this.data.imgs.length) return t(); |
118 | if ("number" != typeof a) a = 0; else if (a >= this.data.imgs.length) return t(); | 127 | if ("number" != typeof a) a = 0; else if (a >= this.data.imgs.length) return t(); |
119 | var s = this; | 128 | var s = this; |
120 | - e.uploadFile("api/weshop/comment/uploadCommentImg", { | 129 | + e.uploadFile("/api/weshop/comment/uploadCommentImg", { |
121 | filePath: s.data.imgs[a], | 130 | filePath: s.data.imgs[a], |
122 | - name: "img_file", | 131 | + name: "file", |
123 | success: function (e) { | 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,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 | \ No newline at end of file | 215 | \ No newline at end of file |
pages/user/add_comment/add_comment.wxml
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | <view class='commodity'> | 54 | <view class='commodity'> |
55 | <!-- 商品信息 --> | 55 | <!-- 商品信息 --> |
56 | <view class='information flex-vertical'> | 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 | <view class="goods_name xc-black"> | 58 | <view class="goods_name xc-black"> |
59 | <!-- 商品名称 --> | 59 | <!-- 商品名称 --> |
60 | <view class='ellipsis-2 fs32'>{{options.goods_name}}我弄饭v的v哦女v绝我弄饭v的v哦女v绝望愤怒冻死我弄饭v的v哦女v绝望愤怒冻死望愤怒冻死</view> | 60 | <view class='ellipsis-2 fs32'>{{options.goods_name}}我弄饭v的v哦女v绝我弄饭v的v哦女v绝望愤怒冻死我弄饭v的v哦女v绝望愤怒冻死望愤怒冻死</view> |
@@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
63 | <!-- 价格 --> | 63 | <!-- 价格 --> |
64 | <view class='flex-vertical balin'> | 64 | <view class='flex-vertical balin'> |
65 | <view class="fs24">¥</view> | 65 | <view class="fs24">¥</view> |
66 | - <view class="fs35">{{options.price}}3333.00</view> | 66 | + <view class="fs35">{{options.price}}</view> |
67 | </view> | 67 | </view> |
68 | 68 | ||
69 | <!-- 商品数量 --> | 69 | <!-- 商品数量 --> |
@@ -81,7 +81,9 @@ | @@ -81,7 +81,9 @@ | ||
81 | 81 | ||
82 | <!-- 商品评价信息 --> | 82 | <!-- 商品评价信息 --> |
83 | <view class="addComment"> | 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 | <view class="flex addimages"> | 87 | <view class="flex addimages"> |
86 | <!-- 评论图片集合 --> | 88 | <!-- 评论图片集合 --> |
87 | <view class="images"> | 89 | <view class="images"> |
@@ -130,7 +132,6 @@ | @@ -130,7 +132,6 @@ | ||
130 | <view class="stars flex-vertical"> | 132 | <view class="stars flex-vertical"> |
131 | <image bindtap="checkDeliverRank" data-i="{{index}}" src="{{index<deliver_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}" | 133 | <image bindtap="checkDeliverRank" data-i="{{index}}" src="{{index<deliver_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}" |
132 | wx:for="{{5}}" wx:key="{{index}}"></image> | 134 | wx:for="{{5}}" wx:key="{{index}}"></image> |
133 | - | ||
134 | </view> | 135 | </view> |
135 | </view> | 136 | </view> |
136 | <view class="score-item flex-vertical"> | 137 | <view class="score-item flex-vertical"> |
@@ -138,8 +139,6 @@ | @@ -138,8 +139,6 @@ | ||
138 | <view class="stars flex-vertical"> | 139 | <view class="stars flex-vertical"> |
139 | <image src="{{index<service_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}" | 140 | <image src="{{index<service_rank?iurl+'/miniapp/images/StarsredCk.png':iurl+'/miniapp/images/StarswhiteUnCk.png'}}" |
140 | bindtap="checkServiceRank" data-i="{{index}}" wx:for="{{5}}" wx:key="{{index}}"></image> | 141 | bindtap="checkServiceRank" data-i="{{index}}" wx:for="{{5}}" wx:key="{{index}}"></image> |
141 | - | ||
142 | - | ||
143 | </view> | 142 | </view> |
144 | 143 | ||
145 | </view> | 144 | </view> |
@@ -153,7 +152,7 @@ | @@ -153,7 +152,7 @@ | ||
153 | <view class=" Whether "> | 152 | <view class=" Whether "> |
154 | <!-- 选择是否匿名 --> | 153 | <!-- 选择是否匿名 --> |
155 | <view class="allClick flex-right-vertical" bindtap="checkAnonymous"> | 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 | <view class="fs24 ">匿名评价</view> | 156 | <view class="fs24 ">匿名评价</view> |
158 | </view> | 157 | </view> |
159 | 158 |
pages/user/order_list/order_list.wxml
@@ -84,10 +84,16 @@ | @@ -84,10 +84,16 @@ | ||
84 | 84 | ||
85 | 85 | ||
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> | 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 | <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> | 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 | </view> | 98 | </view> |
93 | 99 |
utils/request.js
@@ -43,7 +43,10 @@ module.exports = { | @@ -43,7 +43,10 @@ module.exports = { | ||
43 | filePath: e.filePath, | 43 | filePath: e.filePath, |
44 | name: e.name, | 44 | name: e.name, |
45 | success: function(t) { | 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 | i.doSuccess(e, t); | 50 | i.doSuccess(e, t); |
48 | }, | 51 | }, |
49 | fail: function(t) { | 52 | fail: function(t) { |