popup.vue 15 KB

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