Assess.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div>
  3. <div class="card">
  4. <h3 > 交换成功!写一封感谢信送给ta吧~
  5. </h3>
  6. <van-cell-group>
  7. <van-field
  8. type="textarea"
  9. placeholder="请输入你想写给ta的感谢信..."
  10. rows="5"
  11. autosize
  12. v-model="substance"
  13. :error="assessError"
  14. @click="assessError=false"
  15. required
  16. maxlength="300"
  17. />
  18. </van-cell-group>
  19. <div>
  20. <van-rate
  21. v-model="value"
  22. icon="like"
  23. void-icon="like-o"
  24. />
  25. <van-button round type="primary" class='assess' @click="Assess">送出感谢信</van-button>
  26. </div>
  27. </div>
  28. <div style="position: relative;">
  29. <img :src="Assessimage" style="max-width: 100%; position: relative;"/>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import {
  35. CellGroup, Field,
  36. Rate,
  37. Button,
  38. Toast
  39. } from 'vant'
  40. import {BasicFunction} from "../connector/basic-service";
  41. // import { wx } from "http://res2.wx.qq.com/open/js/jweixin-1.4.0.js";
  42. export default {
  43. name: "Assess",
  44. components: {
  45. [CellGroup.name]: CellGroup, [Field.name]: Field,
  46. [Rate.name]: Rate, [Button.name]: Button,
  47. },
  48. data() {
  49. return {
  50. value:0,
  51. substance: '',
  52. assessError: false,
  53. assessDo:{},
  54. active: 0,
  55. Assessimage: require('../assets/thanks.png'),
  56. }
  57. },
  58. methods: {
  59. assessPresent : function () {
  60. // 检验输入
  61. if (this.substance.length <= 15) {
  62. this.assessError = true;
  63. Toast.fail('请输入至少15个字的礼物评价!');
  64. return;
  65. }
  66. else if(this.substance.length > 300) {
  67. this.assessError = true;
  68. Toast.fail('最多输入300个字的礼物评价!');
  69. return;
  70. }
  71. if (!localStorage.getItem('frontend-userid')) {
  72. this.$router.push('login');
  73. return;
  74. }
  75. this.assessDo.content=this.substance;
  76. this.assessDo.ratingMajor=this.value;
  77. let orderId=BasicFunction.utils_get_param("orderId");
  78. // assess_present()
  79. console.log(present);
  80. BasicFunction.get_data("smartOrderFeedback/saveBatch?orderId="+orderId, function (response) {
  81. console.log("------ Data Rcvd in assessPersent --------");
  82. console.log(response);
  83. if(response.ret === "10000"){
  84. Toast.success("上传成功");
  85. } else {
  86. // 评价失败的处理
  87. Toast.fail("上传失败,请检查网络");
  88. }
  89. }, [this.assessDo]
  90. );
  91. // this.$router.push('index');
  92. },
  93. Assess() {
  94. this.$router.push('index');
  95. },
  96. },
  97. created: function () {
  98. if (!localStorage.getItem('frontend-userid')) {
  99. this.$router.push('login');
  100. return;
  101. }
  102. let that=this;
  103. let orderId=BasicFunction.utils_get_param("orderId");
  104. BasicFunction.get_data("smartOrderFeedback/list?orderId="+orderId, function (response) {
  105. console.log("------ Data Rcvd in assessPersent --------");
  106. console.log(response);
  107. if(response.ret === "10000"){
  108. var t=response.model.list;
  109. that.assessDo=t[0];
  110. } else {
  111. // 评价失败的处理
  112. Toast.fail("读取失败,请检查网络");
  113. }
  114. }, [{}]
  115. );
  116. }
  117. }
  118. </script>
  119. <style scoped>
  120. h3 {
  121. color: #fd6740;
  122. text-align: left;
  123. padding: 5px;
  124. border-bottom: solid 1px #e4e4e4;
  125. }
  126. .assess {
  127. }
  128. .card {
  129. background-color: white;
  130. margin: 20px 20px;
  131. border: solid 1px #e4e4e4;
  132. padding: 15px;
  133. }
  134. .van-button {
  135. background-color: red;
  136. border-color: red;
  137. margin: auto;
  138. width: 50%;
  139. }
  140. .van-rate{
  141. margin: auto;
  142. }
  143. p{
  144. margin: auto;
  145. size: 5px;
  146. }
  147. </style>