feedback.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="question">
  3. <u-form :model="form" ref="uForm" label-position="top">
  4. <u-form-item label="问题反馈" prop="content">
  5. <u-input height="200" class="u-input" v-model="form.content" placeholder="请输入问题描述" type="textarea" />
  6. <view class="cu-form-group" style="padding: 0;">
  7. <view class="grid col-4 grid-square flex-sub">
  8. <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage"
  9. :data-url="imgList[index]">
  10. <image :src="imgList[index]" mode="aspectFill"></image>
  11. <view class="cu-tag bg-red" style="width: 50rpx;height: 50rpx;" @tap.stop="DelImg" :data-index="index">
  12. <text class='cuIcon-close'></text>
  13. </view>
  14. </view>
  15. <view class="solids" @tap="chooseImage" v-if="imgList.length<4">
  16. <text class='cuIcon-cameraadd'></text>
  17. </view>
  18. </view>
  19. </view>
  20. </u-form-item>
  21. <u-form-item label="联系方式" prop="phone">
  22. <u-input height="100" class="u-input" v-model="form.phone" placeholder="请留下您的联系方式" type="number" />
  23. </u-form-item>
  24. <u-button :custom-style="customStyle" @click="submit">提 交</u-button>
  25. </u-form>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. form: {
  33. content: '',
  34. phone: ''
  35. },
  36. imgList:[],
  37. customStyle: {
  38. backgroundColor: '#FF9447',
  39. marginTop: '80rpx',
  40. color: '#fff'
  41. }
  42. }
  43. },
  44. methods: {
  45. ViewImage(e) {
  46. uni.previewImage({
  47. urls: this.imgList,
  48. current: e.currentTarget.dataset.url
  49. });
  50. },
  51. DelImg(e) {
  52. uni.showModal({
  53. title: '提示',
  54. content: '确定要删除吗?',
  55. success: res => {
  56. if (res.confirm) {
  57. this.imgList.splice(e.currentTarget.dataset.index, 1)
  58. }
  59. }
  60. })
  61. },
  62. async chooseImage(){
  63. let res=await this.$mpi.chooseImage()
  64. this.$api.uploadFile(res[0]).then(res=>{
  65. this.imgList.push(res.data.link)
  66. })
  67. },
  68. async submit() {
  69. if (!this.form.content) {
  70. this.$u.toast('请输入反馈内容')
  71. return
  72. }
  73. let p = {
  74. type: 2,
  75. userId: this.vuex_shopId,
  76. content: this.form.content,
  77. pics: this.imgList.length > 0 ? this.imgList.join(",") : '',
  78. phone: this.form.phone,
  79. handleStatus: 0
  80. }
  81. let res = await this.$api.shop.feedback(p)
  82. this.$dialog.showModalAndBack("提交成功")
  83. }
  84. }
  85. }
  86. </script>
  87. <style scoped lang="scss">
  88. .question {
  89. padding: 32rpx;
  90. background-color: #fff;
  91. min-height: 100vh;
  92. }
  93. </style>