addEvaluate.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="container">
  3. <form @submit="submitComment" report-submit="true">
  4. <block v-if="orderDetail.technical">
  5. <tui-list-cell :hover="false">
  6. <view class="tui-goods__box">
  7. <image :src="orderDetail.technical.touxiang" class="tui-goods__img" mode="widthFix">
  8. </image>
  9. <view class="tui-rate__box">
  10. <view class="tui-rate__text">{{orderDetail.technical.title}}</view>
  11. </view>
  12. </view>
  13. </tui-list-cell>
  14. </block>
  15. <block v-if="orderDetail.orderInfo.cat_id">
  16. <tui-list-cell :hover="false">
  17. <view class="tui-goods__box">
  18. <image :src="orderDetail.orderInfo.cateMap.image" class="tui-goods__img" mode="widthFix">
  19. </image>
  20. <view class="tui-rate__box">
  21. <view class="tui-rate__text">{{orderDetail.orderInfo.pay_subject}}</view>
  22. </view>
  23. </view>
  24. </tui-list-cell>
  25. <tui-list-cell :hover="false">
  26. <view class="tui-rate__text">评分</view>
  27. <tui-rate :current="orderDetail.cateComment.level" @change="catechange"></tui-rate>
  28. </tui-list-cell>
  29. <tui-list-cell :hover="false" padding="0">
  30. <textarea v-model="orderDetail.cateComment.content" class="tui-textarea" placeholder="说说本次消费的感受吧..."
  31. maxlength="200"></textarea>
  32. </tui-list-cell>
  33. <!--<tui-list-cell :hover="false">
  34. <view class="tui-img__title">添加图片</view>
  35. <tui-upload></tui-upload>
  36. </tui-list-cell>-->
  37. </block>
  38. <block v-else>
  39. <block v-for="(item, index) in orderDetail.goods" :key="index">
  40. <tui-list-cell :hover="false">
  41. <view class="tui-goods__box">
  42. <image :src="item.image" class="tui-goods__img" mode="widthFix"></image>
  43. <view class="tui-rate__box">
  44. <view class="tui-rate__text">{{item.name}}</view>
  45. </view>
  46. </view>
  47. </tui-list-cell>
  48. <tui-list-cell :hover="false">
  49. <view class="tui-rate__text">评分</view>
  50. <tui-rate :current="item.level" :params="index" @change="change"></tui-rate>
  51. </tui-list-cell>
  52. <tui-list-cell :hover="false" padding="0">
  53. <textarea v-model="item.content" class="tui-textarea" placeholder="说说本次消费的感受吧..."
  54. maxlength="200"></textarea>
  55. </tui-list-cell>
  56. <!--<tui-list-cell :hover="false">
  57. <view class="tui-img__title">添加图片</view>
  58. <tui-upload></tui-upload>
  59. </tui-list-cell>-->
  60. </block>
  61. </block>
  62. <!--<view class="tui-check__box">
  63. <checkbox-group>
  64. <label class="tui-checkbox">
  65. <checkbox color="#fff"></checkbox>
  66. <text class="tui-cb__text">匿名评价</text>
  67. </label>
  68. </checkbox-group>
  69. </view>-->
  70. <view class="tui-btn__box">
  71. <tui-button form-type="submit" type="danger" height="88rpx" shape="circle">提交评价</tui-button>
  72. </view>
  73. </form>
  74. </view>
  75. </template>
  76. <script>
  77. export default {
  78. data() {
  79. return {
  80. orderDetail: [],
  81. }
  82. },
  83. onLoad: function(options) {
  84. let _this = this
  85. _this.$request.get('comment.getorder', {
  86. samkey: (new Date()).valueOf(),
  87. id: options.id
  88. }).then(function(res) {
  89. if (res.errno != 0) {
  90. uni.showModal({
  91. title: '错误',
  92. content: res.msg,
  93. showCancel: false
  94. })
  95. return;
  96. }
  97. _this.orderDetail = res.data;
  98. });
  99. },
  100. methods: {
  101. change(e) {
  102. this.orderDetail.goods[e.params].level = e.index;
  103. },
  104. catechange(e) {
  105. this.orderDetail.cateComment.level = e.index;
  106. },
  107. submitComment: function(e) {
  108. let _this = this;
  109. _this.$request.post('comment.add', {
  110. postJsonString: JSON.stringify(_this.orderDetail)
  111. }).then(function(res) {
  112. if (res.errno == 0) {
  113. uni.showModal({
  114. title: '提示',
  115. content: res.msg,
  116. showCancel: false,
  117. //是否显示取消按钮
  118. success: function(res) {
  119. if (res.cancel) { //点击取消,默认隐藏弹框
  120. } else {
  121. uni.reLaunch({
  122. url: "/pages/login/success?ptype=" + _this.ptype
  123. });
  124. }
  125. }
  126. });
  127. }
  128. });
  129. }
  130. },
  131. /**
  132. * 页面相关事件处理函数--监听用户下拉动作
  133. */
  134. onPullDownRefresh: function() {
  135. setTimeout(() => {
  136. uni.stopPullDownRefresh()
  137. }, 200);
  138. },
  139. }
  140. </script>
  141. <style>
  142. .container {
  143. padding: 20rpx 0;
  144. }
  145. .tui-goods__box {
  146. width: 100%;
  147. display: flex;
  148. align-items: center;
  149. }
  150. .tui-goods__img {
  151. width: 130rpx;
  152. height: 130rpx;
  153. }
  154. .tui-rate__box {
  155. flex: 1;
  156. height: 100%;
  157. padding-left: 20rpx;
  158. font-size: 26rpx;
  159. }
  160. .tui-rate__text {
  161. margin-bottom: 16rpx;
  162. }
  163. .tui-textarea {
  164. width: 100%;
  165. height: 300rpx;
  166. font-size: 28rpx;
  167. padding: 20rpx 30rpx;
  168. box-sizing: border-box;
  169. background-color: #fff;
  170. }
  171. .tui-img__title {
  172. padding-bottom: 24rpx;
  173. }
  174. .tui-check__box {
  175. padding: 25rpx 30rpx;
  176. }
  177. .tui-checkbox {
  178. min-width: 70rpx;
  179. height: 45rpx;
  180. display: flex;
  181. align-items: center;
  182. }
  183. /* #ifdef MP-WEIXIN */
  184. .tui-checkbox .wx-checkbox-input {
  185. width: 40rpx;
  186. height: 40rpx;
  187. margin-right: 0 !important;
  188. border-radius: 50% !important;
  189. transform: scale(0.8);
  190. transform-origin: center 30%;
  191. border-color: #d1d1d1 !important;
  192. }
  193. .tui-checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  194. background: #eb0909;
  195. width: 44rpx !important;
  196. height: 44rpx !important;
  197. border: none;
  198. }
  199. /* #endif */
  200. /* #ifndef MP-WEIXIN */
  201. >>>.tui-checkbox .uni-checkbox-input {
  202. width: 40rpx;
  203. height: 40rpx;
  204. margin-right: 0 !important;
  205. border-radius: 50% !important;
  206. transform: scale(0.8);
  207. border-color: #d1d1d1 !important;
  208. }
  209. >>>.tui-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
  210. background: #eb0909;
  211. width: 45rpx !important;
  212. height: 45rpx !important;
  213. border: none;
  214. }
  215. /* #endif */
  216. .tui-cb__text {
  217. font-size: 28rpx;
  218. padding-left: 8rpx;
  219. color: #999;
  220. }
  221. .tui-btn__box {
  222. width: 100%;
  223. padding: 40rpx 30rpx;
  224. box-sizing: border-box;
  225. }
  226. </style>