index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view class="p-l-r-30 p-b-t-40 k-parse height-100 width-100" style="box-sizing: border-box;">
  3. <u-button @click="show = true">{{feedbackTitle?feedbackTitle:'请选择反馈类型'}}</u-button>
  4. <u-picker :show="show" :columns="columns" @confirm="confirm"></u-picker>
  5. <textarea class="feedback-content" v-model="feedback" auto-focus maxlength="500"
  6. placeholder="请输入您需要反馈的内容"></textarea>
  7. <view class="submit-btn" @click="submit">提交反馈</view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. mixins: [],
  13. data() {
  14. return {
  15. show: false,
  16. columns: [
  17. ['资讯', '专业风采', '名店', '名点', '名菜']
  18. ],
  19. feedbackTitle: '',
  20. feedbackType: '',
  21. feedback: '',
  22. submitting: false,
  23. }
  24. },
  25. computed: {},
  26. methods: {
  27. confirm(e) {
  28. // INFORMATION("information", "资讯"),
  29. // PROFESSIONAL_STYLE("professional_style", "风采"),
  30. // DISH("dish", "名菜"),
  31. // SNACKS("snacks", "名点"),
  32. // RESTAURANT("restaurant", "名店");
  33. switch (e.indexs[0]) {
  34. case 0:
  35. this.feedbackType = 'information';
  36. break;
  37. case 1:
  38. this.feedbackType = 'professional_style';
  39. break;
  40. case 2:
  41. this.feedbackType = 'famous_restaurant';
  42. break;
  43. case 3:
  44. this.feedbackType = 'famous_dish';
  45. break;
  46. case 4:
  47. this.feedbackType = 'famous_snacks';
  48. break;
  49. case 0:
  50. this.feedbackType = e.indexs[0];
  51. break;
  52. }
  53. //
  54. this.feedbackTitle = '反馈类型:' + e.value[0]
  55. this.show = false
  56. },
  57. submit() {
  58. if (!this.feedbackType || !this.feedback) {
  59. uni.showToast({
  60. icon: "none",
  61. title: "请完善反馈内容后再试"
  62. })
  63. return;
  64. }
  65. if (this.submitting) {
  66. return;
  67. }
  68. this.submitting = true;
  69. wx.showLoading();
  70. this.$u.api.submitFeedback(this.feedbackType, this.feedback).then(res => {
  71. uni.showToast({
  72. icon: "none",
  73. title: "反馈成功"
  74. })
  75. uni.navigateBack({
  76. delta: -1
  77. })
  78. }).catch(e=> {
  79. wx.hideLoading();
  80. this.submitting = false;
  81. })
  82. }
  83. },
  84. }
  85. </script>
  86. <style scoped>
  87. .feedback-content {
  88. border: 1px solid #999999;
  89. padding: 10px;
  90. width: 100%;
  91. height: calc(100% - 100px);
  92. box-sizing: border-box;
  93. }
  94. .submit-btn {
  95. text-align: center;
  96. width: 80%;
  97. line-height: 40px;
  98. color: white;
  99. background-color: #65371b;
  100. margin: 10px auto auto auto;
  101. }
  102. </style>