releaseEvaluate.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <view>
  3. <!-- 遍历出评价商品 -->
  4. <view v-for="(sku, index) in order.orderItems" :key="index">
  5. <view class="after-sales-goods-detail-view">
  6. <view>
  7. <view class="goods-item-view">
  8. <view class="goods-img">
  9. <u-image border-radius="6" width="131rpx" height="131rpx" :src="sku.image" />
  10. </view>
  11. <view class="goods-info">
  12. <view class="goods-title u-line-2">{{ sku.name }}</view>
  13. <view class="goods-price">
  14. <view>x{{ sku.num }}</view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="goods-evaluate-view">
  21. <view class="goods-view">
  22. <view>商品评价</view>
  23. <view class="sub-title">满意请打好评哦</view>
  24. </view>
  25. <view class="rate-view">
  26. <view class="rate-btn" @click="onGrade('GOOD', index)">
  27. <view style="font-size: 42rpx" :style="{ color: form.grade === 'GOOD' ? 'red' : '#CCCCCC' }" class="alifont icon-haoping1"></view>
  28. <text>好评</text>
  29. </view>
  30. <view class="rate-btn" @click="onGrade('MODERATE', index)">
  31. <view style="font-size: 42rpx" :style="{ color: form.grade === 'MODERATE' ? 'red' : '#CCCCCC' }" class="alifont icon-zhongping1"></view>
  32. <text>中评</text>
  33. </view>
  34. <view class="rate-btn" @click="onGrade('WORSE', index)">
  35. <view style="font-size: 42rpx" :style="{ color: form.grade === 'WORSE' ? 'red' : '#CCCCCC' }" class="alifont icon-chaping"></view>
  36. <text>差评</text>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="info-evaluate-view">
  41. <view class="input-view">
  42. <u-input v-model="form.content" height="200" placeholder-style="font-size:12px;color:#CCCCCC" :type="type" :border="border" :maxlength="maxlength" :placeholder="placeholder" />
  43. </view>
  44. <view class="input-num">
  45. <text>{{ form.content.length }}/{{ maxlength }}</text>
  46. </view>
  47. </view>
  48. <view class="info-evaluate-view">
  49. <view class="images-view">
  50. <u-upload :header=" { accessToken: storage.getAccessToken() }" :action="action" width="150" @on-uploaded="onUploaded" :max-count="5" :show-progress="false"></u-upload>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="info-evaluate-view" style="margin-bottom: 150rpx">
  55. <view class="info-header">店铺评分</view>
  56. <view>
  57. <view class="seller-rate-view">
  58. <view class="rate-title">描述相符</view>
  59. <view>
  60. <u-rate count="count" gutter="20" active-color="#FFC71C" v-model="form.descriptionScore" :size="40"></u-rate>
  61. </view>
  62. </view>
  63. <view class="seller-rate-view">
  64. <view class="rate-title">服务态度</view>
  65. <view>
  66. <u-rate count="count" gutter="20" active-color="#FFC71C" v-model="form.serviceScore" :size="40"></u-rate>
  67. </view>
  68. </view>
  69. <view class="seller-rate-view">
  70. <view class="rate-title">物流服务</view>
  71. <view>
  72. <u-rate count="count" gutter="20" active-color="#FFC71C" v-model="form.deliveryScore" :size="40"></u-rate>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="onSubmit" @click="onSubmit"> 提交申请</view>
  78. <u-toast ref="uToast" />
  79. </view>
  80. </template>
  81. <script>
  82. import storage from "@/utils/storage.js";
  83. import { commentsMemberOrder } from "@/api/members.js";
  84. import { upload } from "@/api/common.js";
  85. export default {
  86. data() {
  87. return {
  88. storage,
  89. type: "textarea", //输入框状态为 textarea
  90. border: false, //没有border
  91. maxlength: 500, //评价最大字数为500字
  92. placeholder:
  93. "宝贝满足您的期待吗?说说它的优点和美中不足的地方吧。您的评价会帮助更多的人",
  94. order: {}, //订单信息
  95. form: {
  96. content: "", //评价详情
  97. goodsId: "", //商品id
  98. grade: "GOOD", //默认为好评
  99. orderItemSn: "", //商品的sn
  100. skuId: "", //商品skuId
  101. descriptionScore: 5, //默认描述得分为5分
  102. serviceScore: 5, //默认服务得分为5分
  103. deliveryScore: 5, //默认物流得分为5分
  104. },
  105. action: upload, //图片上传地址
  106. };
  107. },
  108. onLoad(options) {
  109. // 获取上一级传过来的数据进行解析
  110. this.form.orderItemSn = options.sn;
  111. this.order = JSON.parse(decodeURIComponent(options.order));
  112. this.form.goodsId = this.order.orderItems[0].goodsId;
  113. this.form.orderItemSn = this.order.orderItems[0].sn;
  114. this.form.skuId = this.order.orderItems[0].skuId;
  115. },
  116. methods: {
  117. /**
  118. * 点击评价
  119. */
  120. onGrade(grade) {
  121. this.form.grade = grade;
  122. },
  123. /**
  124. * 提交评价
  125. */
  126. onSubmit() {
  127. uni.showLoading({
  128. title: "加载中",
  129. });
  130. commentsMemberOrder(this.form).then((res) => {
  131. uni.hideLoading();
  132. if (res.data.success) {
  133. uni.showToast({
  134. title: "发布评价成功",
  135. duration: 2000,
  136. icon: "none",
  137. success: () => {
  138. setTimeout(() => {
  139. uni.navigateBack();
  140. }, 2000);
  141. },
  142. });
  143. }
  144. });
  145. },
  146. /**
  147. * 图片成功后回调
  148. */
  149. onUploaded(lists) {
  150. let images = [];
  151. lists.forEach((item) => {
  152. images.push(item.response.result);
  153. });
  154. this.form.images = images;
  155. },
  156. },
  157. };
  158. </script>
  159. <style lang="scss" scoped>
  160. page,
  161. .content {
  162. background: $page-color-base;
  163. height: 100%;
  164. margin-bottom: 100rpx;
  165. }
  166. .onSubmit {
  167. width: 80%;
  168. margin: 0 auto;
  169. text-align: center;
  170. color: #fff;
  171. background: $aider-light-color;
  172. height: 80rpx;
  173. line-height: 80rpx;
  174. border-radius: 100px;
  175. }
  176. .after-sales-goods-detail-view {
  177. background-color: #f4f4f5;
  178. padding: 10rpx 0rpx;
  179. .header {
  180. display: flex;
  181. flex-direction: row;
  182. align-items: center;
  183. justify-content: center;
  184. padding-bottom: 20rpx;
  185. .header-text {
  186. background-color: #f4f4f5;
  187. padding: 10rpx 30rpx;
  188. border-radius: 50rpx;
  189. .seller-name {
  190. color: $main-color;
  191. font-weight: 600;
  192. }
  193. }
  194. }
  195. .goods-item-view {
  196. display: flex;
  197. flex-direction: row;
  198. padding: 10rpx 30rpx;
  199. background-color: #eef1f2;
  200. .goods-img {
  201. }
  202. .goods-info {
  203. padding-left: 30rpx;
  204. flex: 1;
  205. .goods-title {
  206. margin-bottom: 10rpx;
  207. color: $font-color-dark;
  208. }
  209. .goods-specs {
  210. font-size: 24rpx;
  211. margin-bottom: 10rpx;
  212. color: #cccccc;
  213. }
  214. .goods-price {
  215. font-size: 28rpx;
  216. margin-bottom: 10rpx;
  217. color: $light-color;
  218. }
  219. }
  220. .goods-num {
  221. width: 60rpx;
  222. color: $main-color;
  223. }
  224. }
  225. .after-num {
  226. margin: 0rpx 30rpx;
  227. display: flex;
  228. flex-direction: row;
  229. align-items: center;
  230. justify-content: space-between;
  231. height: 80rpx;
  232. }
  233. }
  234. .goods-evaluate-view {
  235. margin-top: 8rpx;
  236. padding: 20rpx;
  237. margin-bottom: 5rpx;
  238. background-color: #fff;
  239. display: flex;
  240. flex-direction: row;
  241. align-items: center;
  242. .goods-view {
  243. width: 250rpx;
  244. font-size: 28rpx;
  245. color: #333333;
  246. .sub-title {
  247. font-size: 22rpx;
  248. color: #cccccc;
  249. }
  250. }
  251. .rate-view {
  252. color: #333333;
  253. display: flex;
  254. flex-direction: row;
  255. align-items: center;
  256. .rate-btn {
  257. margin: 0rpx 20rpx;
  258. display: flex;
  259. align-items: center;
  260. justify-content: center;
  261. text {
  262. margin-left: 10rpx;
  263. }
  264. }
  265. }
  266. }
  267. .info-evaluate-view {
  268. margin-top: 8rpx;
  269. padding: 20rpx;
  270. background-color: #fff;
  271. align-items: center;
  272. font-size: 24rpx;
  273. .input-view {
  274. width: 100%;
  275. }
  276. .input-num {
  277. color: #cccccc;
  278. text-align: right;
  279. }
  280. .images-view {
  281. display: flex;
  282. flex-direction: row;
  283. align-items: center;
  284. flex-wrap: wrap;
  285. }
  286. .info-header {
  287. font-size: 28rpx;
  288. color: #333333;
  289. margin-bottom: 30rpx;
  290. }
  291. .seller-rate-view {
  292. display: flex;
  293. flex-direction: row;
  294. align-items: center;
  295. .rate-title {
  296. line-height: 70rpx;
  297. width: 150rpx;
  298. font-size: 26rpx;
  299. color: #333333;
  300. }
  301. }
  302. }
  303. .submit-view {
  304. position: fixed;
  305. z-index: 999;
  306. bottom: 0px;
  307. left: 0px;
  308. margin-top: 100rpx;
  309. border: solid 2rpx #f2f2f2;
  310. background-color: #ffffff;
  311. height: 100rpx;
  312. width: 750rpx;
  313. align-items: center;
  314. padding: 0rpx 20rpx;
  315. }
  316. </style>