feedBack.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="home">
  3. <view class="putWarp dffd">
  4. <view @click="showfeadAction" class="putin dfsb">
  5. <text class="fontbase flex1">请选择反馈类型</text>
  6. <text class="textgrey fontssm">{{ title.text }}</text>
  7. <u-icon name="arrow-right"></u-icon>
  8. </view>
  9. </view>
  10. <view class="putWarp dffd">
  11. <view class="putin spec ">
  12. <text class="fontbase flex1">请描述你要反馈的问题</text>
  13. <textarea
  14. class="lyCon"
  15. maxlength="-1"
  16. v-model="content"
  17. placeholder="如:对我们的商品或者服务有那些意见?你希望我们在哪些地方进行完善,你有哪些好的建议请及时的进行反馈,我们会及时进行处理的..."
  18. />
  19. </view>
  20. </view>
  21. <view class="putWarp dffd">
  22. <view class="putin spec">
  23. <text class="fontbase flex1">请上传图片、问题截图等文件 (选填)</text>
  24. <view class="imgWarp dffs">
  25. <view class="pre-box dffs">
  26. <view class="pre-item dffs" v-for="(item, index) in uUpload" :key="index">
  27. <image class="pre-item-image" :src="item.lists" mode="widthFix"></image>
  28. <view class="u-delete-icon dfsb" @tap.stop="deleteItem(item.id)"><u-icon name="close" size="16" color="#ffffff"></u-icon></view>
  29. </view>
  30. </view>
  31. <view @tap="choose" class="imgBox dfsb"><u-icon name="plus" size="30" color="#DEDEDE"></u-icon></view>
  32. </view>
  33. </view>
  34. <!-- <view class="imgBox dffs">
  35. <view class="pre-box">
  36. <view class="pre-item dffs" v-for="(item, index) in newsInfo.img" :key="index">
  37. <image @click="preview(newsInfo.img, index)" class="pre-item-image" :src="item" mode="aspectFill"></image>
  38. </view>
  39. </view>
  40. </view> -->
  41. </view>
  42. <view class="putWarp dffd">
  43. <view class="putin spec ">
  44. <text class="fontbase flex1">联系方式(选填,便于我们与你联系)</text>
  45. <input class="mt20" type="number" v-model="phone" placeholder="请输入手机号码" />
  46. </view>
  47. </view>
  48. <u-button color="#ED742F" @click="clickHandle" throttleTime="2000" class="custom-style" text="提交"></u-button>
  49. <y-action-sheet ref="yActionSheet" @onConfirm="refund"></y-action-sheet>
  50. </view>
  51. </template>
  52. <script>
  53. import { pathToBase64 } from '@/common/tool/pathToBase64.js';
  54. export default {
  55. data() {
  56. return {
  57. title: '',
  58. content: '',
  59. phone: '',
  60. uUpload: [] // 组件实例
  61. };
  62. },
  63. onLoad(opt) {},
  64. onShow() {},
  65. methods: {
  66. //申请退款选择原因
  67. showfeadAction(data) {
  68. this.$refs.yActionSheet.open({
  69. title: '反馈类型',
  70. list: [
  71. {
  72. text: '型号拍错'
  73. },
  74. {
  75. text: '买多了'
  76. },
  77. {
  78. text: '不想要了'
  79. },
  80. {
  81. text: '数量选择错误'
  82. },
  83. {
  84. text: '其他'
  85. }
  86. ]
  87. });
  88. },
  89. //申请退款提交
  90. async refund(reason) {
  91. this.title = reason;
  92. },
  93. clickHandle() {
  94. if (!this.title.text) {
  95. return this.$api.toast('请选择反馈类型', 1000);
  96. }
  97. if (!this.content) {
  98. return this.$api.toast('请输入反馈内容', 1000);
  99. }
  100. let arr = [];
  101. this.uUpload.forEach(item => {
  102. arr.push(item.id);
  103. });
  104. this.$api
  105. .request('user/setFeedback', {
  106. title: this.title.text,
  107. content: this.content,
  108. phone: this.phone || '',
  109. image: arr.toString() || ''
  110. })
  111. .then(data => {
  112. if (data.code == '200') {
  113. this.$api.toast(data.msg);
  114. setTimeout(res => {
  115. uni.navigateBack({
  116. delta: 1
  117. });
  118. }, 300);
  119. } else {
  120. this.$api.toast(data.msg);
  121. }
  122. });
  123. },
  124. deleteItem(id) {
  125. this.uUpload.forEach((item, ind) => {
  126. console.log(item);
  127. if (item.id == id) {
  128. this.uUpload.splice(ind, 1);
  129. }
  130. });
  131. },
  132. choose() {
  133. let that = this;
  134. uni.chooseImage({
  135. count: 1, //默认9
  136. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  137. success: function(res) {
  138. console.log(res);
  139. var imageSrc = res.tempFilePaths[0];
  140. pathToBase64(imageSrc).then(base64 => {
  141. that.$api
  142. .request('common/doupload', {
  143. imgdata: base64
  144. })
  145. .then(res => {
  146. that.uUpload.push({ lists: res.data.imgurl, id: res.data.img_id });
  147. })
  148. .catch(res => {});
  149. });
  150. }
  151. });
  152. }
  153. }
  154. };
  155. </script>
  156. <style lang="scss">
  157. .home {
  158. padding: 20rpx 0rpx 0;
  159. //yanzhengma
  160. .u-hairline-border[data-v-3bf2dba7]:after {
  161. border: 0;
  162. }
  163. .tips {
  164. padding: 0;
  165. color: $promain;
  166. font-size: 28rpx;
  167. line-height: 40rpx;
  168. height: 40rpx;
  169. }
  170. .putWarp {
  171. background-color: #fff;
  172. padding: 0rpx 32rpx;
  173. align-items: center;
  174. margin-bottom: 20rpx;
  175. .priceDan {
  176. color: #333;
  177. }
  178. .putin {
  179. width: 100%;
  180. padding: 30rpx 0;
  181. }
  182. .spec {
  183. .lyCon {
  184. width: 100%;
  185. height: 80rpx;
  186. padding: 24rpx 0;
  187. font-size: 24rpx;
  188. }
  189. }
  190. }
  191. .custom-style {
  192. background: linear-gradient(90deg, #ffac4c 0%, #ff8a00 100%);
  193. color: #fff;
  194. width: 690rpx;
  195. margin-top: 200rpx;
  196. border-radius: 11rpx;
  197. }
  198. .imgWarp {
  199. width: 100%;
  200. margin-top: 30rpx;
  201. flex-wrap: wrap;
  202. .imgBox {
  203. background-color: #fff;
  204. border: 1px solid #f3f3f3;
  205. justify-content: center;
  206. width: 120rpx;
  207. height: 120rpx;
  208. }
  209. .pre-box {
  210. flex-wrap: wrap;
  211. }
  212. .pre-item {
  213. margin-right: 60rpx;
  214. margin-bottom: 20rpx;
  215. width: 120rpx;
  216. position: relative;
  217. flex-wrap: wrap;
  218. &:nth-of-type(4n) {
  219. margin-right: 0;
  220. }
  221. }
  222. .pre-item-image {
  223. width: 120rpx;
  224. height: auto;
  225. }
  226. .u-delete-icon {
  227. position: absolute;
  228. top: -10rpx;
  229. right: -10rpx;
  230. z-index: 10;
  231. background-color: #333;
  232. border-radius: 100rpx;
  233. width: 30rpx;
  234. height: 30rpx;
  235. }
  236. }
  237. }
  238. </style>