index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view :data-theme="theme">
  3. <form @submit="formSubmit" report-submit='true'>
  4. <view class='evaluate-con borderPad'>
  5. <view class='score borRadius14'>
  6. <view class='item acea-row row-middle' v-for="(item,indexw) in scoreList" :key="indexw">
  7. <view>{{item.name}}</view>
  8. <view class='starsList'>
  9. <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>
  10. </view>
  11. <text class='evaluate'>{{item.index === -1 ? "" : item.index + 1 + "分"}}</text>
  12. </view>
  13. <view class='textarea'>
  14. <textarea placeholder='商品满足你的期待么?说说你的想法,分享给想买的他们吧~' name="comment" placeholder-class='placeholder'></textarea>
  15. <view class='list acea-row row-middle'>
  16. <view class='pictrue' v-for="(item,index) in picsPath" :key="index">
  17. <image :src='item'></image>
  18. <text class='iconfont icon-guanbi1' @click='DelPic(index)'></text>
  19. </view>
  20. <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic' v-if="picsPath.length < 8">
  21. <text class='iconfont icon-icon25201'></text>
  22. <view>上传图片</view>
  23. </view>
  24. </view>
  25. </view>
  26. <button class='evaluateBnt bg_color' formType="submit">立即评价</button>
  27. </view>
  28. </view>
  29. </form>
  30. </view>
  31. </template>
  32. <script>
  33. // +----------------------------------------------------------------------
  34. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  35. // +----------------------------------------------------------------------
  36. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  37. // +----------------------------------------------------------------------
  38. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  39. // +----------------------------------------------------------------------
  40. // | Author: CRMEB Team <admin@crmeb.com>
  41. // +----------------------------------------------------------------------
  42. import {
  43. orderComment
  44. } from '@/api/order.js';
  45. import {toLogin} from '@/libs/login.js';
  46. import {mapGetters} from "vuex";
  47. import {Debounce} from '@/utils/validate.js'
  48. let app = getApp();
  49. export default {
  50. data() {
  51. return {
  52. pics: [],
  53. picsPath: [],
  54. scoreList: [{
  55. name: "商品质量",
  56. stars: ["", "", "", "", ""],
  57. index: -1
  58. },
  59. {
  60. name: "服务态度",
  61. stars: ["", "", "", "", ""],
  62. index: -1
  63. }
  64. ],
  65. orderNo: '',//订单编号
  66. evaluateId: 0, //订单id
  67. unique: '',
  68. cart_num: 0,
  69. theme:app.globalData.theme,
  70. };
  71. },
  72. computed: mapGetters(['isLogin']),
  73. onLoad(options) {
  74. if (!options.orderNo ) return this.$util.Tips({
  75. title: '缺少参数'
  76. }, {
  77. tab: 3,
  78. url: 1
  79. });
  80. this.orderNo = options.orderNo || 0;
  81. this.evaluateId = Number(options.id) || 0;
  82. if (!this.isLogin) {
  83. toLogin();
  84. }
  85. },
  86. methods: {
  87. stars: function(indexn, indexw) {
  88. this.scoreList[indexw].index = indexn;
  89. },
  90. /**
  91. * 删除图片
  92. *
  93. */
  94. DelPic: function(index) {
  95. let that = this,
  96. pic = this.picsPath[index];
  97. that.picsPath.splice(index, 1);
  98. that.pics.splice(index, 1);
  99. },
  100. /**
  101. * 上传文件
  102. *
  103. */
  104. uploadpic: function() {
  105. let that = this;
  106. that.$util.uploadImageOne({
  107. url: 'upload/image',
  108. name: 'multipart',
  109. model: "product",
  110. pid: 1
  111. }, function(res) {
  112. that.pics.push(res);
  113. that.picsPath.push(res);
  114. that.$set(that, 'pics', that.pics);
  115. that.$set(that, 'picsPath', that.picsPath);
  116. });
  117. },
  118. /**
  119. * 立即评价
  120. */
  121. formSubmit: Debounce(function(e) {
  122. let formId = e.detail.formId,
  123. value = e.detail.value,
  124. that = this,
  125. product_score = that.scoreList[0].index + 1 === 0 ? "" : that.scoreList[0].index + 1;
  126. // if (!value.comment) return that.$util.Tips({
  127. // title: this.$t(`page.users.goodsCommentCon.tipsWrite`)
  128. // });
  129. value.star = product_score;
  130. value.pics = that.pics;
  131. value.orderDetailId = that.evaluateId;
  132. value.orderNo = that.orderNo;
  133. uni.showLoading({
  134. title: "正在发布评论……"
  135. });
  136. orderComment(value).then(res => {
  137. uni.hideLoading();
  138. return that.$util.Tips({
  139. title: '感谢您的评价!',
  140. icon: 'success'
  141. }, '/pages/goods/evaluation_list/index');
  142. }).catch(err => {
  143. uni.hideLoading();
  144. return that.$util.Tips({
  145. title: err
  146. });
  147. });
  148. })
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .goodsStyle .text .name, .attr{
  154. //width: 496rpx;
  155. }
  156. .font_sm{
  157. font-size: 24rpx;
  158. color: #999;
  159. padding-top: 10rpx;
  160. }
  161. .icon-shitixing{
  162. color: #FFBB00 !important;
  163. }
  164. .evaluate-con .score {
  165. background-color: #fff;
  166. // border-top: 1rpx solid #f5f5f5;
  167. margin-top: 20rpx;
  168. font-size: 28rpx;
  169. color: #282828;
  170. padding: 46rpx 24rpx;
  171. }
  172. .evaluate-con .score .item~.item {
  173. margin-top: 36rpx;
  174. }
  175. .evaluate-con .score .item .starsList {
  176. padding: 0 35rpx 0 40rpx;
  177. }
  178. .evaluate-con .score .item .starsList .iconfont {
  179. font-size: 40rpx;
  180. color: #aaa;
  181. }
  182. .evaluate-con .score .item .starsList .iconfont~.iconfont {
  183. margin-left: 20rpx;
  184. }
  185. .evaluate-con .score .item .evaluate {
  186. color: #aaa;
  187. font-size: 24rpx;
  188. }
  189. .evaluate-con .score .textarea {
  190. width: 100%;
  191. background-color: #F5F5F5;
  192. border-radius: 14rpx;
  193. margin-top: 55rpx;
  194. }
  195. .evaluate-con .score .textarea textarea {
  196. font-size: 28rpx;
  197. padding: 38rpx 30rpx 0 30rpx;
  198. width: 100%;
  199. box-sizing: border-box;
  200. height: 160rpx;
  201. width: auto !important;
  202. }
  203. .evaluate-con .score .textarea .placeholder {
  204. color: #bbb;
  205. }
  206. .evaluate-con .score .textarea .list {
  207. margin-top: 25rpx;
  208. padding-left: 5rpx;
  209. }
  210. .evaluate-con .score .textarea .list .pictrue {
  211. width: 140rpx;
  212. height: 140rpx;
  213. margin: 0 0 35rpx 20rpx;
  214. position: relative;
  215. font-size: 22rpx;
  216. color: #bbb;
  217. border-radius: 14rpx;
  218. }
  219. .evaluate-con .score .textarea .list .pictrue:nth-last-child(1) {
  220. border: 1rpx solid #ddd;
  221. box-sizing: border-box;
  222. }
  223. .evaluate-con .score .textarea .list .pictrue image {
  224. width: 100%;
  225. height: 100%;
  226. border-radius: 14rpx;
  227. }
  228. .evaluate-con .score .textarea .list .pictrue .icon-guanbi1 {
  229. font-size: 45rpx;
  230. position: absolute;
  231. top: -20rpx;
  232. right: -20rpx;
  233. }
  234. .evaluate-con .score .textarea .list .pictrue .icon-icon25201 {
  235. color: #bfbfbf;
  236. font-size: 50rpx;
  237. }
  238. .evaluate-con .score .evaluateBnt {
  239. font-size: 30rpx;
  240. color: #fff;
  241. width: 100%;
  242. height: 86rpx;
  243. border-radius: 43rpx;
  244. text-align: center;
  245. line-height: 86rpx;
  246. margin-top: 45rpx;
  247. }
  248. .bg_color{
  249. @include main_bg_color(theme);
  250. }
  251. </style>