index.vue 7.5 KB

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