popup.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <view>
  3. <!-- 弹窗 -->
  4. <view class="bgbox" @click="getClose" v-if="type"></view>
  5. <!-- 建议回复 -->
  6. <view v-if="type=='reply'" class="assignbox pra">
  7. <view class="assbox">
  8. <view class="asstit">回复</view>
  9. <uni-easyinput maxlength='200' type="textarea" autoHeight v-model="datainfo.companyIntroduction" :inputBorder='false' placeholder="请输入回复内容,最多不超过200字…" />
  10. <view class="voice mb20">
  11. <view class="flexc">
  12. <image :src="voice"></image>
  13. 语音输入
  14. </view>
  15. </view>
  16. <view class="fjtxt mb18 flexcj">附件信息
  17. <lsj-upload ref="lsjUpload" childId="upload1" :loanApplicationId="loanApplicationId" :width="width" :height="height" :option="option" :size="size" :formats="formats" :debug="debug" :instantly="instantly"
  18. @progress="" @uploadEnd="onuploadEnd" fileName="123" fileVal='dbxmhfhgb' bigType="c">
  19. <view class="fjbtns co02" :style="{width: width,height: height}">上传附件</view>
  20. </lsj-upload>
  21. </view>
  22. <view class="fjlists" v-for="(fite,fidx) in filelist" :key='fidx'>
  23. <view class="flext" @click="getDown(fite.url)">
  24. <view class="imgl"><image :src="filico" ></image></view>
  25. <view class="tit">{{fite.name}}</view>
  26. </view>
  27. <view class="delimg flex0" @click.stop="getDelFj(fidx)">
  28. <image :src="fdelimg"></image>
  29. </view>
  30. </view>
  31. <view class="rhbtn mt40" @click="getSure">确定</view>
  32. </view>
  33. <image :src="closeimg" class="closeimg" @click="getClose"></image>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import config from '@/config'
  39. const baseUrl = config.baseUrl
  40. import { getToken } from '@/utils/auth'
  41. import {uploadmore} from '@/utils/common.js'
  42. export default{
  43. components:{},
  44. props:{
  45. type: {
  46. type: String,
  47. default () {
  48. return ''
  49. }
  50. },
  51. finshtype:{
  52. type: [String,Number],
  53. default () {
  54. return ''
  55. }
  56. }
  57. },
  58. data(){
  59. return{
  60. //附件
  61. option: {
  62. // 上传服务器地址,需要替换为你的接口地址
  63. url: baseUrl+'/common/uploadNew', // 该地址非真实路径,需替换为你项目自己的接口地址
  64. // 上传附件的key
  65. name: 'file',
  66. // 根据你接口需求自定义请求头,默认不要写content-type,让浏览器自适配
  67. header: {
  68. // 示例参数可删除
  69. 'Authorization': 'Bearer ' + getToken(),
  70. },
  71. // 根据你接口需求自定义body参数
  72. formData: {
  73. loanApplicationNumber:'',
  74. loanApplicationId:'',
  75. }
  76. },
  77. // 借据上传
  78. jjoption: {
  79. // 上传服务器地址,需要替换为你的接口地址
  80. url: baseUrl+'/common/uploadNewOcr', // 该地址非真实路径,需替换为你项目自己的接口地址
  81. // 上传附件的key
  82. name: 'file',
  83. // 根据你接口需求自定义请求头,默认不要写content-type,让浏览器自适配
  84. header: {
  85. // 示例参数可删除
  86. 'Authorization': 'Bearer ' + getToken(),
  87. },
  88. // 根据你接口需求自定义body参数
  89. formData: {
  90. loanApplicationNumber:'',
  91. loanApplicationId:'',
  92. }
  93. },
  94. // 选择文件后是否立即自动上传,true=选择后立即上传
  95. instantly: true,
  96. // 必传宽高且宽高应与slot宽高保持一致
  97. width: '',
  98. height: '40rpx',
  99. // 限制允许上传的格式,空串=不限制,默认为空
  100. formats: 'doc,docx,xls,xlsx,ppt,txt,pdf,zip,rar,word,png,jpg,jpeg',
  101. // 文件上传大小限制
  102. size: 100,
  103. // 文件数量限制 默认10
  104. count: 5,
  105. // 文件回显列表
  106. files: new Map(),
  107. // 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道
  108. wxFiles: [],
  109. // 是否打印日志
  110. debug: false,
  111. filelist:[],
  112. filico:require('@/work/static/filico.png'),
  113. fdelimg:require('@/work/static/fjdel.png'),
  114. baseUrl:config.baseUrl,
  115. closeimg:require("@/work/static/close.png"),
  116. rimg: require('@/work/static/people/rimg.png'),
  117. headbg: require('@/work/static/service/headbg.png'),
  118. addpho: require('@/work/static/service/addpho.png'),
  119. rdelimg: require('@/work/static/service/rdel.png'),
  120. voice: require('@/work/static/service/voice.png'),
  121. syqxidx:'',
  122. datainfo:{
  123. iszc:""
  124. },
  125. sexs: [{
  126. text: '男',
  127. value: 1
  128. }, {
  129. text: '女',
  130. value: 2
  131. }],
  132. peoval:0,
  133. peolist:[]
  134. }
  135. },
  136. mounted() {
  137. this.baseUrl=baseUrl
  138. },
  139. watch:{
  140. loanApplicationNumber(val){
  141. this.option.formData.loanApplicationNumber=val
  142. this.jjoption.formData.loanApplicationNumber=val
  143. },
  144. loanApplicationId(val){
  145. this.option.formData.loanApplicationId=val
  146. this.jjoption.formData.loanApplicationId=val
  147. },
  148. type(val){
  149. // this.filelist=[];
  150. // this.shtext='';
  151. // this.isty='2';
  152. // this.phofile=[];
  153. }
  154. },
  155. methods:{
  156. bindDateChange(){
  157. var val=e.detail.value;
  158. },
  159. getClose(){
  160. this.$emit('getClose')
  161. },
  162. getSure(){
  163. this.$emit('getSure')
  164. },
  165. getChose(val){
  166. this.peoval=val
  167. },
  168. getPreviewImage(arr,idx){
  169. var newArr=[];
  170. arr.forEach(ite=>{
  171. var ds=this.baseUrl+ite
  172. newArr.push(ds)
  173. })
  174. uni.previewImage({
  175. urls: newArr,
  176. current:idx,
  177. success: function(data) {
  178. },
  179. fail: function(err) {
  180. }
  181. });
  182. },
  183. // 上传
  184. onuploadEnd(item,fileVal,bigType) {
  185. var newobj={}
  186. var responseText=JSON.parse(item.responseText)
  187. if(responseText.code==200){
  188. if(fileVal=='qtfj'){
  189. newobj.name=responseText.originalFilename;
  190. }else{
  191. newobj.name=responseText.newFileName;
  192. }
  193. newobj.oldName=responseText.originalFilename;
  194. newobj.url=responseText.fileName;
  195. newobj.type=fileVal;
  196. newobj.bigType=bigType;
  197. newobj.loanApplicationId=this.loanApplicationId;
  198. newobj.loanApplicationNumber=this.loanApplicationNumber;
  199. this.filelist.push(newobj)
  200. }else{
  201. this.$toast(responseText.msg)
  202. }
  203. },
  204. getDelFj(idx){
  205. var that=this;
  206. uni.showModal({
  207. title: '确认删除',
  208. content: "是否确认删除",
  209. cancelText: '取消',
  210. confirmText: '确认',
  211. success: function(res) {
  212. if (res.confirm) {
  213. that.filelist.splice(idx,1)
  214. } else if (res.cancel) {
  215. }
  216. }
  217. });
  218. },
  219. getDown(path,name){
  220. console.log(path,name)
  221. // #ifdef APP-PLUS
  222. self.getFilePermissions(function(res){
  223. if(res==1){
  224. uni.showLoading({
  225. title: '加载中'
  226. });
  227. var url = baseUrl + path;
  228. let dtask = plus.downloader.createDownload(url, {
  229. filename: 'file://storage/emulated/0/'+baseName+'/' + name
  230. }, (d, status) => {
  231. //d为下载的文件对象
  232. if (status == 200) {
  233. uni.hideLoading();
  234. uni.showToast({
  235. icon: 'none',
  236. mask: true,
  237. title: '已保存到文件夹:/'+baseName+'/'+ name, //保存路径
  238. duration: 3000,
  239. });
  240. //下载成功,d.filename是文件在保存在本地的相对路径,使用下面的API可转为平台绝对路径
  241. let fileSaveUrl = plus.io.convertLocalFileSystemURL(d.filename);
  242. setTimeout(() => {
  243. plus.runtime.openFile(d.filename); //选择软件打开文件
  244. }, 1500)
  245. } else {
  246. //下载失败
  247. uni.hideLoading();
  248. plus.downloader.clear(); //清除下载任务
  249. uni.showToast({
  250. icon: 'none',
  251. mask: true,
  252. title: '下载失败,请稍后重试',
  253. });
  254. }
  255. })
  256. dtask.start();
  257. }else{
  258. uni.hideLoading();
  259. uni.showToast({
  260. title: '无法获取权限,文件下载将出错!',
  261. icon: 'none',
  262. })
  263. }
  264. })
  265. // #endif
  266. // #ifndef APP-PLUS
  267. this.getDownloader(path)
  268. // #endif
  269. },
  270. getDownloader(e){
  271. uni.showLoading({
  272. title: '加载中'
  273. });
  274. var url=baseUrl+e;
  275. let index1 = e.lastIndexOf("."); // 得到一个索引值
  276. let index2 = e.length;
  277. let type = e.substring(index1, index2);
  278. if ((type.indexOf('jpg') > -1 || type.indexOf('jpeg') > -1 || type.indexOf('png') > -1)) {
  279. uni.previewImage({
  280. current: 0,
  281. urls: [url],
  282. // background: '#ffffff'
  283. });
  284. uni.hideLoading();
  285. } else {
  286. uni.downloadFile({
  287. url: url,//文件的下载路径
  288. success(result) {
  289. uni.hideLoading()
  290. var filePath = result.tempFilePath;
  291. uni.openDocument({
  292. filePath: filePath,
  293. showMenu: true,
  294. success: function (res) {
  295. // console.log('打开文档成功');
  296. }
  297. });
  298. },
  299. fail(res) {uni.hideLoading()}
  300. })
  301. }
  302. },
  303. getDelFn(){
  304. var that=this;
  305. uni.showModal({
  306. title: '确认删除',
  307. content: "是否确认删除",
  308. cancelText: '取消',
  309. confirmText: '确认',
  310. success: function(res) {
  311. if (res.confirm) {
  312. // that.filelist.splice(idx,1)
  313. } else if (res.cancel) {
  314. }
  315. }
  316. });
  317. },
  318. getaddImage(e){
  319. let that = this;
  320. let file =[],count=9
  321. uni.chooseImage({
  322. count: 1,
  323. success:function(res){
  324. let img= res.tempFilePaths;
  325. if(img.length + file.length > count){
  326. uni.showToast({
  327. title: '最多上传'+count+'张图片',
  328. icon: 'none',
  329. duration: 2000
  330. })
  331. }else{
  332. let imglen = res.tempFilePaths.length;
  333. var fuwufile = [];
  334. uploadmore('/common/upload',img,0,0,0,imglen,fuwufile,function(rs){
  335. var resurl=rs[0];
  336. // if(e=='front'){
  337. // that.datainfo.front=resurl.fileName;
  338. // }else{
  339. // that.datainfo.back=resurl.fileName;
  340. // }
  341. })
  342. }
  343. }
  344. });
  345. },
  346. }
  347. }
  348. </script>
  349. <style lang="scss" scoped>
  350. // 指派
  351. .assignbox{background: #FFFFFF;border-radius: 20rpx;position: fixed;left:56rpx;right:54rpx;z-index: 10;top: 50%;transform: translateY(-50%);padding: 32rpx 38rpx 36rpx;
  352. .assbox{max-height: calc(100vh - 300rpx);overflow: auto;}
  353. .asstit{font-weight: bold;font-size: 30rpx;color: #272727;text-align: center;padding-left: 16rpx;margin-bottom: 28rpx;}
  354. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  355. image{width: 100%;height: 100%;}
  356. }
  357. .asline{border-bottom: 2rpx solid #E5E5E5;padding: 30rpx 0;margin-bottom: 40rpx;}
  358. .tabtit{font-weight: bold;font-size: 26rpx;color: #272727;line-height: 36rpx;margin-bottom: 24rpx;padding-left: 14rpx;}
  359. .asslists{display: flex;flex-wrap: wrap;
  360. .asslist{width: 252rpx;height: 76rpx;border-radius: 20rpx;border: 2rpx solid #DADADA;position: relative;display: flex;align-items: center;box-sizing: border-box;padding: 0 22rpx;margin: 0 14rpx 24rpx 14rpx;overflow: hidden;
  361. &.act{border-color: #0256FD;
  362. .altit{color: #0256FD;}
  363. }
  364. image{position: absolute;right: -2rpx;bottom: -2rpx;width: 34rpx;height: 32rpx;}
  365. .altit{font-weight: bold;font-size: 26rpx;color: #666666;flex: 1;}
  366. .altxt{font-weight: bold;font-size: 22rpx;flex: 0 0 auto;}
  367. }
  368. }
  369. // 上传图片
  370. &.pra{left: 100rpx;right: 100rpx;}
  371. .assadd{display: flex;flex-direction: column;align-items: center;justify-content: center;border-radius: 10rpx;height: 192rpx;
  372. border: 2rpx dashed #A7A7A7;box-sizing: border-box;margin-bottom: 32rpx;
  373. image{width:48rpx;height: 40rpx;margin-bottom: 16rpx;}
  374. view{font-weight: bold;font-size: 26rpx;color: #272727;}
  375. }
  376. .assimgs{display: flex;align-items: center;flex-wrap: wrap;margin-bottom: 8rpx;
  377. .assimg{width: 140rpx;height: 140rpx;position: relative;overflow: hidden;margin: 0 24rpx 24rpx 0;
  378. &:nth-of-type(3n){margin-right: 0;}
  379. .img{width: 100%;height: 100%;}
  380. .delimg{width: 24rpx;height: 24rpx;position: absolute;right: 0;top: 0;}
  381. }
  382. }
  383. }
  384. .voice{font-weight: 500;display: flex;justify-content:flex-end;align-items: center;margin-top: 40rpx;
  385. font-size: 24rpx;
  386. color: #45CB99;
  387. image{width: 24rpx;height: 24rpx;margin-right: 8rpx;}
  388. }
  389. // 附件
  390. .fjlists {display: flex;align-items: flex-start;justify-content: space-between;margin-bottom: 20rpx;
  391. &:last-child{margin-bottom: 0;}
  392. .imgl{width: 40rpx;height: 40rpx;display: flex;align-items: center;flex: 0 0 auto;
  393. image{width: 26rpx;height: 24rpx;}
  394. }
  395. .tit{font-size: 26rpx;color: #222327;font-weight: 500;margin-top: 4rpx;word-break: break-all;}
  396. .delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center;flex: 0 0 auto;
  397. image{width: 24rpx;height: 24rpx;}
  398. }
  399. .txta{color: #28C529;font-weight: 500;line-height: 40rpx;flex: 0 0 auto;margin-left: 18rpx;padding: 0 6rpx;}
  400. }
  401. .closeimg{width: 32rpx;height: 32rpx;position: absolute;bottom: -62rpx;left: 50%;margin-left: -16rpx;}
  402. </style>