feedback.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view>
  3. <view class="cn">
  4. <view class="info">
  5. <view class="form_group hr">
  6. <view class="lable">标题名称</view>
  7. <input type="text" placeholder="请输入标题名称" v-model="item.title" />
  8. </view>
  9. <view class="form_group"><view class="lable">投诉内容</view></view>
  10. <textarea placeholder="请输入投诉内容(500字以内)" v-model="item.content" maxlength="500" style="height: 150px;" />
  11. <view class="form_group">
  12. <view class="lable">投诉图片</view>
  13. <view class="text">最多上传5张图片</view>
  14. </view>
  15. <view class="pl5">
  16. <u-upload
  17. :ip="ip"
  18. :action="upload.action"
  19. :header="upload.header"
  20. :size-type="upload.size"
  21. :max-count="upload.count"
  22. :name="upload.name"
  23. :file-list="item.showPictures"
  24. :deletable="item.auditFlag != 1"
  25. :show-progress="item.auditFlag != 1"
  26. :custom-btn="item.auditFlag == 1"
  27. ref="uUpload"
  28. width="140"
  29. height="140"
  30. ></u-upload>
  31. </view>
  32. <view class="form_group">
  33. <view class="lable">手机号码</view>
  34. <input type="text" placeholder="(选填),以便将处理结果反馈给你" v-model="item.phone" />
  35. </view>
  36. </view>
  37. <button class="btn" @click="up()">提交投诉</button>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. ip: this.$http.urls.ip,
  46. item: { pic: [] },
  47. upload: {
  48. header: { apiToken: this.$getUser().apiToken },
  49. name: 'img',
  50. action: this.$http.urls.uploadImg,
  51. size_type: 'compressed ',
  52. count: 5
  53. }
  54. };
  55. },
  56. onLoad(e) {},
  57. methods: {
  58. up() {
  59. this.item.pic = [];
  60. let files = this.$refs.uUpload.lists.filter(val => {
  61. return val.progress == 100;
  62. });
  63. //投诉图片
  64. files.forEach(item => {
  65. if (item.response) {
  66. this.item.pic.push(item.response.fileName); //获取上传成功的网络地址
  67. } else {
  68. this.item.pic.push(item.url); //原来的地址
  69. }
  70. });
  71. let rule = [
  72. { name: 'title', checkType: 'notnull', errorMsg: '请输入标题名称' },
  73. { name: 'content', checkType: 'notnull', errorMsg: '请输入投诉内容' },
  74. { name: 'pic', checkType: 'notnull', errorMsg: '请上传营业执照' }
  75. ];
  76. if (!this.$verify.check(this.item, rule)) {
  77. uni.showModal({ content: this.$verify.error, showCancel: false });
  78. return;
  79. }
  80. this.item.pic = this.item.pic.toString();
  81. this.$http.request({
  82. method: 'POST',
  83. url: this.$http.urls.feedback,
  84. data: this.item,
  85. success: res => {
  86. uni.showToast({ title: '提交成功' });
  87. setTimeout(() => {
  88. uni.$emit('shop');
  89. uni.navigateBack();
  90. }, 700);
  91. }
  92. });
  93. }
  94. }
  95. };
  96. </script>
  97. <style lang="scss">
  98. .steps {
  99. text-align: center;
  100. margin-top: 20px;
  101. }
  102. .u-subsection {
  103. margin-top: 20px;
  104. }
  105. .cn {
  106. padding: 15px;
  107. .info {
  108. background-color: white;
  109. border-radius: 5px;
  110. margin-top: 10px;
  111. padding-bottom: 10px;
  112. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  113. .dw {
  114. top: 11px;
  115. font-size: 19px;
  116. right: 9px;
  117. position: absolute;
  118. }
  119. }
  120. textarea {
  121. margin-left: 17px;
  122. font-size: 14px;
  123. padding: 10px;
  124. width: 85%;
  125. height: 85px;
  126. border: 1px solid #f1f1f1;
  127. border-radius: 5px;
  128. }
  129. .btn {
  130. margin-top: 25px;
  131. }
  132. }
  133. .text {
  134. font-size: 11px;
  135. font-weight: normal;
  136. color: $dar;
  137. flex: 0.8;
  138. text-align: right;
  139. }
  140. </style>