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. uni.showToast({
  133. title: "发布评价成功",
  134. duration: 2000,
  135. icon: "none",
  136. success: () => {
  137. setTimeout(() => {
  138. uni.navigateBack();
  139. }, 1000);
  140. },
  141. });
  142. });
  143. },
  144. /**
  145. * 图片成功后回调
  146. */
  147. onUploaded(lists) {
  148. let images = [];
  149. lists.forEach((item) => {
  150. images.push(item.response.result);
  151. });
  152. this.form.images = images;
  153. },
  154. },
  155. };
  156. </script>
  157. <style lang="scss" scoped>
  158. page,
  159. .content {
  160. background: $page-color-base;
  161. height: 100%;
  162. margin-bottom: 100rpx;
  163. }
  164. .onSubmit {
  165. width: 80%;
  166. margin: 0 auto;
  167. text-align: center;
  168. color: #fff;
  169. background: $aider-light-color;
  170. height: 80rpx;
  171. line-height: 80rpx;
  172. border-radius: 100px;
  173. }
  174. .after-sales-goods-detail-view {
  175. background-color: #f4f4f5;
  176. padding: 10rpx 0rpx;
  177. .header {
  178. display: flex;
  179. flex-direction: row;
  180. align-items: center;
  181. justify-content: center;
  182. padding-bottom: 20rpx;
  183. .header-text {
  184. background-color: #f4f4f5;
  185. padding: 10rpx 30rpx;
  186. border-radius: 50rpx;
  187. .seller-name {
  188. color: $main-color;
  189. font-weight: 600;
  190. }
  191. }
  192. }
  193. .goods-item-view {
  194. display: flex;
  195. flex-direction: row;
  196. padding: 10rpx 30rpx;
  197. background-color: #eef1f2;
  198. .goods-img {
  199. }
  200. .goods-info {
  201. padding-left: 30rpx;
  202. flex: 1;
  203. .goods-title {
  204. margin-bottom: 10rpx;
  205. color: $font-color-dark;
  206. }
  207. .goods-specs {
  208. font-size: 24rpx;
  209. margin-bottom: 10rpx;
  210. color: #cccccc;
  211. }
  212. .goods-price {
  213. font-size: 28rpx;
  214. margin-bottom: 10rpx;
  215. color: $light-color;
  216. }
  217. }
  218. .goods-num {
  219. width: 60rpx;
  220. color: $main-color;
  221. }
  222. }
  223. .after-num {
  224. margin: 0rpx 30rpx;
  225. display: flex;
  226. flex-direction: row;
  227. align-items: center;
  228. justify-content: space-between;
  229. height: 80rpx;
  230. }
  231. }
  232. .goods-evaluate-view {
  233. margin-top: 8rpx;
  234. padding: 20rpx;
  235. margin-bottom: 5rpx;
  236. background-color: #fff;
  237. display: flex;
  238. flex-direction: row;
  239. align-items: center;
  240. .goods-view {
  241. width: 250rpx;
  242. font-size: 28rpx;
  243. color: #333333;
  244. .sub-title {
  245. font-size: 22rpx;
  246. color: #cccccc;
  247. }
  248. }
  249. .rate-view {
  250. color: #333333;
  251. display: flex;
  252. flex-direction: row;
  253. align-items: center;
  254. .rate-btn {
  255. margin: 0rpx 20rpx;
  256. display: flex;
  257. align-items: center;
  258. justify-content: center;
  259. text {
  260. margin-left: 10rpx;
  261. }
  262. }
  263. }
  264. }
  265. .info-evaluate-view {
  266. margin-top: 8rpx;
  267. padding: 20rpx;
  268. background-color: #fff;
  269. align-items: center;
  270. font-size: 24rpx;
  271. .input-view {
  272. width: 100%;
  273. }
  274. .input-num {
  275. color: #cccccc;
  276. text-align: right;
  277. }
  278. .images-view {
  279. display: flex;
  280. flex-direction: row;
  281. align-items: center;
  282. flex-wrap: wrap;
  283. }
  284. .info-header {
  285. font-size: 28rpx;
  286. color: #333333;
  287. margin-bottom: 30rpx;
  288. }
  289. .seller-rate-view {
  290. display: flex;
  291. flex-direction: row;
  292. align-items: center;
  293. .rate-title {
  294. line-height: 70rpx;
  295. width: 150rpx;
  296. font-size: 26rpx;
  297. color: #333333;
  298. }
  299. }
  300. }
  301. .submit-view {
  302. position: fixed;
  303. z-index: 999;
  304. bottom: 0px;
  305. left: 0px;
  306. margin-top: 100rpx;
  307. border: solid 2rpx #f2f2f2;
  308. background-color: #ffffff;
  309. height: 100rpx;
  310. width: 750rpx;
  311. align-items: center;
  312. padding: 0rpx 20rpx;
  313. }
  314. </style>