OrderEvaluate.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view class="div container">
  3. <!-- header -->
  4. <view class="div common-header-wrap">
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="评价订单" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <!-- body -->
  14. <view class="div body">
  15. <view
  16. class="div order-comment-body"
  17. >
  18. <view class="div body-list">
  19. <view class="div image">
  20. <image mode="aspectFit" class="img"
  21. v-bind:src="orderItem.goods_image_url"
  22. />
  23. </view>
  24. <view class="div comment">
  25. <text class="span">{{ orderItem.goods_name }}</text>
  26. <uni-rate v-if="result.goods[orderItem.goods_id]" :size="18" v-model="result.goods[orderItem.goods_id].score"/>
  27. </view>
  28. </view>
  29. <view class="div enter">
  30. <textarea
  31. placeholder="请在此输入评价"
  32. v-model="comment"
  33. ></textarea>
  34. </view>
  35. <view class="div common-btn ds-button-large" @click="submit(orderItem.goods_id,comment)">提交</view>
  36. </view>
  37. </view>
  38. </view></member-base>
  39. </template>
  40. <script>
  41. import {getFontSize} from '@/util/common'
  42. import TitleHeader from '../../TitleHeader'
  43. import MemberBase from '../MemberBase'
  44. import { getOrderEvaluateInfo, saveOrderEvaluate } from '../../../api/memberVrOrder'
  45. export default {
  46. mounted(){
  47. // #ifdef MP-WEIXIN
  48. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  49. // #endif
  50. },
  51. computed:{
  52. fontSize(){
  53. return getFontSize()
  54. },
  55. },
  56. data(){
  57. return {
  58. navHeight: 0,
  59. order_id:0,
  60. orderItem: {},
  61. result: { goods: {} },
  62. comment: '',
  63. score: 5
  64. }
  65. },
  66. components:{
  67. TitleHeader,
  68. MemberBase,
  69. },
  70. onLoad: function (option) {
  71. this.order_id=option.order_id
  72. if (this.order_id) {
  73. getOrderEvaluateInfo(this.order_id).then(res => {
  74. this.orderItem = res.result.order_info
  75. this.result.goods[this.orderItem.goods_id] = { comment: '', score: 5 }
  76. }).catch(function (error) {
  77. uni.showToast({icon:'none',title: error.message})
  78. })
  79. }
  80. },
  81. methods:{
  82. goBack(){uni.navigateBack({delta:1})},
  83. submit (goods_id,comment) {
  84. this.result.goods[goods_id].comment = comment
  85. saveOrderEvaluate(this.order_id, this.result).then(res => {
  86. uni.navigateBack({delta:1})
  87. }).catch(function (error) {
  88. uni.showToast({icon:'none',title: error.message})
  89. })
  90. },
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .common-score-wrapper .back{display: block}
  96. .container {
  97. display: flex;
  98. flex-direction: column;
  99. justify-content: flex-start;
  100. align-items: stretch;
  101. .body {
  102. top:2.2rem;
  103. width: 100%;
  104. .order-comment-body {
  105. background: rgba(255, 255, 255, 1);
  106. padding:0.75rem;
  107. .body-list {
  108. display: flex;
  109. justify-content: left;
  110. align-content: center;
  111. align-items: center;
  112. }
  113. .image {
  114. width:2.7rem;
  115. height:2.7rem;
  116. flex-shrink: 0;
  117. .img {
  118. width: 100%;
  119. height: 100%;
  120. }
  121. }
  122. .comment {
  123. flex-basis: 100%;
  124. padding-left:0.75rem;
  125. .span {
  126. font-size:$h2;
  127. color: #7c7f88;
  128. text-align: left;
  129. display: block;
  130. }
  131. .ul {
  132. display: flex;
  133. justify-content: space-between;
  134. align-content: center;
  135. align-items: center;
  136. margin-top: 1.2rem;
  137. .li {
  138. .img {
  139. width:1rem;
  140. height:1rem;
  141. flex-shrink: 0;
  142. }
  143. label {
  144. font-size:$subFontSize;
  145. color: rgba(78, 84, 93, 1);
  146. font-weight: normal;
  147. }
  148. }
  149. }
  150. }
  151. .enter {
  152. padding-top:0.75rem;
  153. textarea {
  154. width: 100%;
  155. height:6rem;
  156. background: rgba(247, 249, 250, 1);
  157. border: 1px solid #f7f9fa;
  158. box-sizing: border-box;
  159. padding:0.5rem 0 0 0.5rem;
  160. font-size:$subFontSize;
  161. -webkit-appearance: none;
  162. outline: none;
  163. }
  164. }
  165. }
  166. }
  167. }
  168. </style>