tousu.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view class="container">
  3. <cu-custom bgColor="bg-gradual-pink" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content">客户投诉</block>
  6. </cu-custom>
  7. <!-- <view class="cu-form-group margin-top">
  8. <view class="title">时间:</view>
  9. <my-date style="padding: 0rpx;" placeholder="请选择" fields="day"
  10. label=""></my-date>
  11. </view> -->
  12. <view class="cu-form-group">
  13. <view class="title" >被调查部门:</view>
  14. <app-select placeholder="请选择调查部门" v-model="beiTouSuBuMen" :dict="buMenList" space ></app-select>
  15. </view>
  16. <!-- <view class="cu-form-group">
  17. <view class="title" style="width: 100px;">投诉方式:</view>
  18. <app-select placeholder="请选择投诉方式" :dict="touSuFangShiList" space ></app-select>
  19. </view> -->
  20. <uni-section title="投诉内容" type="line" padding>
  21. <textarea maxlength="-1" v-model="content" placeholder="投诉内容"></textarea>
  22. </uni-section>
  23. <uni-section title="上传附件" type="line">
  24. <view class="example-body">
  25. <uni-file-picker limit="5"
  26. file-mediatype="all"
  27. @select="select"
  28. @progress="progress"
  29. @success="success"
  30. @fail="fail"
  31. @delete="deleteMe"
  32. :auto-upload="false"
  33. ref="uploadMe"
  34. ></uni-file-picker>
  35. </view>
  36. </uni-section>
  37. <view class="padding flex flex-direction">
  38. <button class="cu-btn bg-blue lg" @click="onSubmit">提交</button>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import appSelect from '@/components/my-componets/appSelect.vue'
  44. import myDate from '@/components/my-componets/my-date.vue'
  45. export default {
  46. components: {
  47. myDate,
  48. appSelect,
  49. },
  50. data() {
  51. return {
  52. buMenList:[],
  53. beiTouSuBuMen:'',
  54. content:'',
  55. fuJianShangChuanArray:[],
  56. fuJianShangChuan:'',
  57. }
  58. },
  59. onLoad() {
  60. let that = this
  61. this.$http.post("/ibps/business/v3/common/queryBuMenList", "466555896126767104").then(res => {
  62. if (res.data.state == 200 && res.data.data) {
  63. this.buMenList=[]
  64. for(let ind in res.data.data){
  65. this.buMenList.push({value:res.data.data[ind].id,text:res.data.data[ind].buMenMingChengs})
  66. }
  67. }
  68. });
  69. },
  70. methods: {
  71. // 获取上传状态
  72. select(file){
  73. //读取文件大小
  74. var fileSize=file.size;
  75. if(fileSize>1048576){
  76. that.$message({
  77. type:'error',
  78. showClose:true,
  79. duration:3000,
  80. message:'文件大于1M!'
  81. });
  82. return false;
  83. }
  84. let that = this
  85. for(let e in file.tempFilePaths){
  86. console.log("000",file.tempFiles[e].file)
  87. var extName=file.tempFiles[e].file.name.substring(file.tempFiles[e].file.name.lastIndexOf('.'));
  88. const path = file.tempFilePaths[e];
  89. uni.uploadFile({
  90. url: 'https://www.szjyxt.com/ibps/platform/v3/file/upload/mobile', //仅为示例,非真实的接口地址
  91. filePath: path,
  92. name: 'file',
  93. formData: {
  94. 'ext': '.jpg'
  95. },
  96. success: (uploadFileRes) => {
  97. let data = JSON.parse(uploadFileRes.data)
  98. that.fuJianShangChuanArray.push({fileid:file.tempFiles[e].file.uuid,uploadid:data.data.id})
  99. }
  100. });
  101. }
  102. return true;
  103. console.log('选择文件:')
  104. },
  105. // 删除
  106. deleteMe(file){
  107. for(let e in this.fuJianShangChuanArray){
  108. if(this.fuJianShangChuanArray[e].fileid==file.tempFile.uuid){
  109. this.fuJianShangChuanArray.splice(e,1)
  110. }
  111. }
  112. console.log('删除:',file)
  113. console.log('删除2:',this.fuJianShangChuanArray)
  114. },
  115. // 获取上传进度
  116. progress(e){
  117. console.log('上传进度:',e)
  118. },
  119. // 上传成功
  120. success(file){
  121. console.log('上传成功',file)
  122. },
  123. // 上传失败
  124. fail(e){
  125. console.log('上传失败:',e)
  126. },
  127. onSubmit(){
  128. let tmpArray = []
  129. for(let e in this.fuJianShangChuanArray){
  130. tmpArray.push(this.fuJianShangChuanArray[e].uploadid)
  131. }
  132. let para={
  133. beiTouSuBuMen:this.beiTouSuBuMen,
  134. content:this.content,
  135. fuJianShangChuan:tmpArray.join(",")
  136. }
  137. console.log(",,,",para.fuJianShangChuan)
  138. let that=this;
  139. this.$http.post("ibps/business/v3/sh/tousudengji/add",para).then(res =>{
  140. if (res.data.state == 200) {
  141. this.$tip.success("提交成功!")
  142. this.$Router.replace({name:'index'})
  143. }else if (res.data.state == 400) {
  144. this.$tip.success("用户未登录!")
  145. this.$Router.replace({name:'login'})
  146. }else{
  147. this.$tip.error("请求错误: "+res.data.message)
  148. }
  149. }).catch((err) => {
  150. let msg = ((err.response || {}).data || {}).message || err.data.message || "请求出现错误,请稍后再试"
  151. this.$tip.error(msg);
  152. });
  153. },
  154. onChange(e) {
  155. }
  156. }
  157. }
  158. </script>
  159. <style>
  160. .cu-form-group .title {
  161. min-width: calc(8em + 25px);
  162. }
  163. .uni-file-pickerheight {
  164. box-sizing: border-box;
  165. overflow: hidden;
  166. }
  167. .uni-file-picker__container {
  168. display: flex;
  169. box-sizing: border-box;
  170. flex-wrap: wrap;
  171. margin: -5px;
  172. }
  173. .file-picker__box {
  174. height: 0px;
  175. width: 33.3%;
  176. }
  177. .file-picker__box {
  178. position: relative;
  179. width: 33.3%;
  180. height: 0;
  181. padding-top: 33.33%;
  182. box-sizing: border-box;
  183. }
  184. .file-picker__box-content {
  185. border-width: 1px;
  186. border-style: solid;
  187. border-color: rgb(238, 238, 238);
  188. border-radius: 3px;
  189. }
  190. .is-add {
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. }
  195. .file-picker__box-content {
  196. position: absolute;
  197. top: 0;
  198. right: 0;
  199. bottom: 0;
  200. left: 0;
  201. margin: 5px;
  202. border: 1px #eee solid;
  203. border-radius: 5px;
  204. overflow: hidden;
  205. }
  206. .is-addheight {
  207. display: flex;
  208. align-items: center;
  209. justify-content: center;
  210. }
  211. .icon-addheight {
  212. width: 50px;
  213. height: 5px;
  214. background-color: #f1f1f1;
  215. border-radius: 2px;
  216. }
  217. .rotateheight {
  218. position: absolute;
  219. -webkit-transform: rotate(90deg);
  220. transform: rotate(90deg);
  221. }
  222. .example-body {
  223. padding:10px;
  224. padding-top: 0;
  225. }
  226. .custom-image-box {
  227. /* #ifndef APP-NVUE */
  228. display: flex;
  229. /* #endif */
  230. flex-direction: row;
  231. justify-content: space-between;
  232. align-items: center;
  233. }
  234. .text {
  235. font-size: 14px;
  236. color: #333;
  237. }
  238. </style>