Jacob
2026-10-13 683ba718efa29097c12f1e588839145417ae487f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<template>
   <view>
       <form @submit="formSubmit" report-submit='true'>
           <view class='evaluate-con pad30'>
               <view class='goodsStyle acea-row row-between borRadius14'>
                   <view class='pictrue'>
                       <image :src='productInfo.image'></image>
                   </view>
                   <view class='text acea-row row-between'>
                       <view>
                           <view class='name line2'>{{productInfo.storeName}}</view>
                           <view class='attr line1' v-if="productInfo.sku">{{productInfo.sku}}</view>
                       </view>
                       <view class='money'>
                           <view>¥{{productInfo.truePrice}}</view>
                           <view class='num'>x{{productInfo.cartNum}}</view>
                       </view>
                   </view>
               </view>
               <view class='score borRadius14'>
                   <view class='item acea-row row-middle' v-for="(item,indexw) in scoreList" :key="indexw">
                       <view>{{item.name}}</view>
                       <view class='starsList'>
                           <text @click="stars(indexn, indexw)" v-for="(itemn, indexn) in item.stars" :key="indexn" class='iconfont' :class="item.index >= indexn? 'icon-shitixing':'icon-kongxinxing'"></text>
                       </view>
                       <text class='evaluate'>{{item.index === -1 ? "" : item.index + 1 + "分"}}</text>
                   </view>
                   <view class='textarea'>
                       <textarea placeholder='商品满足你的期待么?说说你的想法,分享给想买的他们吧~' name="comment" placeholder-class='placeholder'></textarea>
                       <view class='list acea-row row-middle'>
                           <view class='pictrue' v-for="(item,index) in picsPath" :key="index">
                               <image :src='item'></image>
                               <text class='iconfont icon-guanbi1' @click='DelPic(index)'></text>
                           </view>
                           <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic' v-if="picsPath.length < 8">
                               <text class='iconfont icon-icon25201'></text>
                               <view>上传图片</view>
                           </view>
                       </view>
                   </view>
                   <button class='evaluateBnt bg-color' formType="submit">立即评价</button>
               </view>
           </view>
       </form>
       <!-- #ifdef MP -->
       <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
       <!-- #endif -->
   </view>
</template>
 
<script>
   import {
       orderProduct,
       orderComment
   } from '@/api/order.js';
   import {
       toLogin
   } from '@/libs/login.js';
   import {
       mapGetters
   } from "vuex";
   export default {
       components: {
       },
       data() {
           return {
               pics: [],
               picsPath: [],
               scoreList: [{
                       name: "商品质量",
                       stars: ["", "", "", "", ""],
                       index: -1
                   },
                   {
                       name: "服务态度",
                       stars: ["", "", "", "", ""],
                       index: -1
                   }
               ],
               orderId: '',
               productId: 0, //产品id
               evaluateId: 0, //评价id
               unique: '',
               productInfo: {},
               cart_num: 0,
               isAuto: false, //没有授权的不会自动授权
               isShowAuth: false, //是否隐藏授权
               id: 0//订单id
           };
       },
       computed: mapGetters(['isLogin']),
       watch: {
           isLogin: {
               handler: function(newV, oldV) {
                   if (newV) {
                       this.getOrderProduct();
                   }
               },
               deep: true
           }
       },
       onLoad(options) {
           if (!options.unique || !options.orderId ) return this.$util.Tips({
               title: '缺少参数'
           }, {
               tab: 3,
               url: 1
           });
           this.unique =  Number(options.unique) || 0;
           this.orderId = options.orderId || 0;
           this.evaluateId = Number(options.id) || 0;
           if (this.isLogin) {
               this.getOrderProduct();
           } else {
               toLogin(this);
           }
       },
       methods: {
           onLoadFun() {
               this.getOrderProduct();
           },
           // 授权关闭
           authColse: function(e) {
               this.isShowAuth = e
           },
           /**
            * 获取某个产品详情
            * 
            */
           getOrderProduct: function() {
               let that = this;
               orderProduct({
                   orderId: that.evaluateId,
                   uni: that.unique
               }).then(res => {
                   that.$set(that, 'productInfo', res.data);
                   // that.$set(that, 'cart_num', res.data.cartNum);
                   // that.$set(that, 'productId', res.data.productId);
               });
           },
           stars: function(indexn, indexw) {
               this.scoreList[indexw].index = indexn;
           },
           /**
            * 删除图片
            * 
            */
           DelPic: function(index) {
               let that = this,
                   pic = this.picsPath[index];
               that.picsPath.splice(index, 1);
               that.pics.splice(index, 1);
           },
 
           /**
            * 上传文件
            * 
            */
           uploadpic: function() {
               let that = this;
               that.$util.uploadImageOne({
                   url: 'user/upload/image',
                   name: 'multipart',
                   model: "product",
                   pid: 1
               }, function(res) {
                   that.pics.push(res.data.url);
                   that.picsPath.push(res.data.localPath);
                   that.$set(that, 'pics', that.pics);
                   that.$set(that, 'picsPath', that.picsPath);
               });
           },
 
           /**
            * 立即评价
            */
           formSubmit: function(e) {
               let formId = e.detail.formId,
                   value = e.detail.value,
                   that = this,
                   product_score = that.scoreList[0].index + 1 === 0 ? "" : that.scoreList[0].index + 1,
                   service_score = that.scoreList[1].index + 1 === 0 ? "" : that.scoreList[1].index + 1;
               if (!value.comment) return that.$util.Tips({
                   title: '请填写你对宝贝的心得!'
               });
               value.productScore = product_score;
               value.serviceScore = service_score;
               value.pics = that.pics.length>0?JSON.stringify(that.pics):'';
               value.productId = that.productInfo.productId;
               value.orderNo = that.orderId;
               value.unique = that.unique;
               value.sku = that.productInfo.sku;
               uni.showLoading({
                   title: "正在发布评论……"
               });
               orderComment(value).then(res => {
                   uni.hideLoading();
                   return that.$util.Tips({
                       title: '感谢您的评价!',
                       icon: 'success'
                   }, '/pages/order_details/index?order_id=' + that.orderId);
               }).catch(err => {
                   uni.hideLoading();
                   return that.$util.Tips({
                       title: (err&&err.message)?err.message:err
                   });
               });
           }
       }
   }
</script>
 
<style lang="scss" scoped>
   .goodsStyle .text .name, .attr{
       //width: 496rpx;
   }
   .icon-shitixing{
       color: #FFBB00 !important;
   }
   .evaluate-con .score {
       background-color: #fff;
       // border-top: 1rpx solid #f5f5f5;
       margin-top: 20rpx;
       font-size: 28rpx;
       color: #282828;
       padding: 46rpx 24rpx;
   }
 
   .evaluate-con .score .item~.item {
       margin-top: 36rpx;
   }
 
   .evaluate-con .score .item .starsList {
       padding: 0 35rpx 0 40rpx;
   }
 
   .evaluate-con .score .item .starsList .iconfont {
       font-size: 40rpx;
       color: #aaa;
   }
 
   .evaluate-con .score .item .starsList .iconfont~.iconfont {
       margin-left: 20rpx;
   }
 
   .evaluate-con .score .item .evaluate {
       color: #aaa;
       font-size: 24rpx;
   }
 
   .evaluate-con .score .textarea {
       width: 100%;
       background-color: #F5F5F5;
       border-radius: 14rpx;
       margin-top: 55rpx;
   }
 
   .evaluate-con .score .textarea textarea {
       font-size: 28rpx;
       padding: 38rpx 30rpx 0 30rpx;
       width: 100%;
       box-sizing: border-box;
       height: 160rpx;
       width: auto !important;
   }
 
   .evaluate-con .score .textarea .placeholder {
       color: #bbb;
   }
 
   .evaluate-con .score .textarea .list {
       margin-top: 25rpx;
       padding-left: 5rpx;
   }
 
   .evaluate-con .score .textarea .list .pictrue {
       width: 140rpx;
       height: 140rpx;
       margin: 0 0 35rpx 25rpx;
       position: relative;
       font-size: 22rpx;
       color: #bbb;
       border-radius: 14rpx;
   }
 
   .evaluate-con .score .textarea .list .pictrue:nth-last-child(1) {
       border: 1rpx solid #ddd;
       box-sizing: border-box;
   }
 
   .evaluate-con .score .textarea .list .pictrue image {
       width: 100%;
       height: 100%;
       border-radius: 14rpx;
   }
 
   .evaluate-con .score .textarea .list .pictrue .icon-guanbi1 {
       font-size: 45rpx;
       position: absolute;
       top: -20rpx;
       right: -20rpx;
   }
 
   .evaluate-con .score .textarea .list .pictrue .icon-icon25201 {
       color: #bfbfbf;
       font-size: 50rpx;
   }
 
   .evaluate-con .score .evaluateBnt {
       font-size: 30rpx;
       color: #fff;
       width: 100%;
       height: 86rpx;
       border-radius: 43rpx;
       text-align: center;
       line-height: 86rpx;
       margin-top: 45rpx;
   }
</style>