list.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view class="listbox">
  3. <view class="fixedt">
  4. <!-- 选择器 -->
  5. <view class="flexc checkbox">
  6. <picker mode="date" fields="year" @change='bindDateChangea'>
  7. <view class="chekt">
  8. <view>{{sbsj|| "申报时间"}}</view>
  9. <image :src="upimg"></image>
  10. </view>
  11. </picker>
  12. <!-- <picker range-key='label' :value="shidx" :range="shlist" @change='bindDateChangeb'>
  13. <view class="chekt">
  14. <view>{{shzt || "申贷次数"}}</view>
  15. <image :src="upimg"></image>
  16. </view>
  17. </picker> -->
  18. <view class="reset" @click="getResetFn">
  19. <image :src="resetimg"></image>
  20. </view>
  21. <view class="topc flexc">
  22. <image :src="secimg"></image>
  23. <input placeholder="请输入企业名称" confirm-type="search" v-model="usename" @confirm="getConfirm"/>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 列表 -->
  28. <view class="plr18">
  29. <bus-list :datalist="list" :wtdt="wtdt" :type="type" @getXzFn="getXzFn"></bus-list>
  30. </view>
  31. <view style="height: 100rpx;"></view>
  32. <view class="scanbox flexcc" @click='getScanFn'>
  33. <image :src="scanimg"></image>
  34. 扫码查看
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import config from '@/config'
  40. const baseUrl = config.baseUrl
  41. const baseName = config.baseName
  42. import self from '@/utils/location.js';
  43. import busList from "@/work/components/business/list.vue"
  44. import {getListOss,getEwmList} from "@/api/common.js"
  45. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  46. export default{
  47. components:{busList},
  48. data(){
  49. return{
  50. secimg:require("@/static/images/home/hsearch.png"),
  51. upimg:require('@/work/static/images/sup.png'),
  52. resetimg:require('@/work/static/images/reset.png'),
  53. scanimg:require('@/work/static/images/scan.png'),
  54. list:[],
  55. pageSize: 10,
  56. pageNum: 1,
  57. reachflag: true,
  58. wtdt:'',
  59. // limit:''
  60. type:'nfiles',//file 老版, nfiles新版
  61. sbsj:'',
  62. usename:'',
  63. // type:'//file ',
  64. }
  65. },
  66. // 上拉触底加载更多触发事件
  67. onReachBottom() {
  68. if (this.reachflag) {
  69. this.pageNum++
  70. this.getDataFn()
  71. }
  72. },
  73. onLoad() {
  74. this.getDataFn()
  75. },
  76. methods:{
  77. checkPermi, checkRole,
  78. getDetail(e){
  79. this.$tab.navigateTo("/work/pages/file/wjdetails?id="+e)
  80. },
  81. getScanFn(){
  82. // 扫码识别
  83. var that = this;
  84. uni.scanCode({
  85. onlyFromCamera: true,
  86. autoZoom:false,
  87. scanType: ['qrCode'],
  88. success: function(red) {
  89. let result = red.result;
  90. var a=JSON.parse(result)
  91. // console.log(a)
  92. if (typeof result == 'string') {
  93. try {
  94. //type1,认证,2 文件
  95. if(a.type==1){
  96. that.$tab.navigateTo(`/work/pages/prove/index`)
  97. }else if(a.type==2){
  98. // {"type":"2","loanApplicationNumber":"RZDB202405281425037292766","bigType":"c","fileType":"dbyxh"},
  99. var params={
  100. loanApplicationNumber:a.loanApplicationNumber,
  101. bigType:a.bigType,
  102. type:a.fileType,
  103. }
  104. getEwmList(params).then(res=>{
  105. if(res.code==200){
  106. var data=res.data;
  107. if(data.url){
  108. that.getDown(data.url)
  109. }
  110. }
  111. })
  112. }else{
  113. }
  114. } catch (e) {
  115. uni.navigateBack({
  116. delta: 1
  117. })
  118. uni.showToast({
  119. title: '扫码查询失败,请检查二维码是否正确',
  120. icon: "none"
  121. })
  122. return
  123. }
  124. }
  125. },
  126. fail: function(e) {
  127. if (e && e.errMsg && e.errMsg.indexOf('scanCode:fail cancel') != -1) {
  128. return;
  129. }
  130. uni.showToast({
  131. title: '扫码失败',
  132. icon: "none"
  133. })
  134. },
  135. });
  136. },
  137. getDown(e){
  138. uni.showLoading({
  139. title: '加载中'
  140. });
  141. var url=baseUrl+e;
  142. let index1 = e.lastIndexOf("."); // 得到一个索引值
  143. let index2 = e.length;
  144. let type = e.substring(index1, index2);
  145. if ((type.indexOf('jpg') > -1 || type.indexOf('jpeg') > -1 || type.indexOf('png') > -1)) {
  146. uni.previewImage({
  147. current: 0,
  148. urls: [url],
  149. // background: '#ffffff'
  150. });
  151. uni.hideLoading();
  152. } else {
  153. uni.downloadFile({
  154. url: url,//文件的下载路径
  155. success(result) {
  156. uni.hideLoading()
  157. var filePath = result.tempFilePath;
  158. uni.openDocument({
  159. filePath: filePath,
  160. showMenu: true,
  161. success: function (res) {
  162. // console.log('打开文档成功');
  163. }
  164. });
  165. },
  166. fail(res) {uni.hideLoading()}
  167. })
  168. }
  169. },
  170. getConfirm(){
  171. this.getrefreshData()
  172. },
  173. getTabFn(val){
  174. this.tabval=val
  175. },
  176. bindDateChangea(e){
  177. var val=e.detail.value;
  178. this.sbsj=val;
  179. this.getrefreshData()
  180. },
  181. bindDateChangeb(e){
  182. var val=e.detail.value;
  183. this.shzt=this.shlist[val].label;
  184. this.shztid=this.shlist[val].value;
  185. this.getrefreshData()
  186. },
  187. getResetFn(){
  188. // 重置
  189. this.sbsj='';
  190. this.usename='';
  191. this.getrefreshData()
  192. },
  193. getrefreshData(){
  194. this.pageNum=1;
  195. this.list=[];
  196. this.reachflag=true;
  197. this.getDataFn()
  198. },
  199. getDownloader(path,name){
  200. // #ifdef APP-PLUS
  201. self.getFilePermissions(function(res){
  202. if(res==1){
  203. uni.showLoading({
  204. title: '加载中'
  205. });
  206. var url = baseUrl + path;
  207. let dtask = plus.downloader.createDownload(url, {
  208. filename: 'file://storage/emulated/0/'+baseName+'/' + name
  209. }, (d, status) => {
  210. //d为下载的文件对象
  211. if (status == 200) {
  212. uni.hideLoading();
  213. uni.showToast({
  214. icon: 'none',
  215. mask: true,
  216. title: '已保存到文件夹:/'+baseName+'/'+ name, //保存路径
  217. duration: 3000,
  218. });
  219. //下载成功,d.filename是文件在保存在本地的相对路径,使用下面的API可转为平台绝对路径
  220. // let fileSaveUrl = plus.io.convertLocalFileSystemURL(d.filename);
  221. // setTimeout(() => {
  222. // plus.runtime.openFile(d.filename); //选择软件打开文件
  223. // }, 1500)
  224. } else {
  225. //下载失败
  226. uni.hideLoading();
  227. plus.downloader.clear(); //清除下载任务
  228. uni.showToast({
  229. icon: 'none',
  230. mask: true,
  231. title: '下载失败,请稍后重试',
  232. });
  233. }
  234. })
  235. dtask.start();
  236. }else{
  237. uni.hideLoading();
  238. uni.showToast({
  239. title: '无法获取权限,文件下载将出错!',
  240. icon: 'none',
  241. })
  242. }
  243. })
  244. // #endif
  245. },
  246. getXzFn(ite){
  247. // 本地路径开头使用file://,跟上手机文件本地目录storage/emulated/0,
  248. // 后缀是用于文件命名和格式修改,大家可以使用变量。
  249. var url =ite.url;
  250. var name=ite.name;
  251. this.getDownloader(url,name)
  252. },
  253. getDataFn(){
  254. var params={
  255. pageSize:this.pageSize,
  256. pageNum: this.pageNum,
  257. // loanApplicationType:4,
  258. }
  259. if(this.sbsj){
  260. params['params[beginTime]']=this.sbsj
  261. }
  262. if(this.usename){
  263. params.enterpriseName=this.usename
  264. }
  265. getListOss(params).then(res=>{
  266. if(res.code==200){
  267. if (res.rows.length < this.pageSize) {
  268. this.reachflag = false
  269. this.wtdt = '到底了~';
  270. } else {
  271. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  272. if (num < res.total) {
  273. this.reachflag = true
  274. this.wtdt = ''
  275. } else {
  276. this.reachflag = false
  277. this.wtdt = '到底了~';
  278. }
  279. }
  280. if (this.pageNum == 1) {
  281. this.list = res.rows;
  282. } else {
  283. this.list = this.list.concat(res.rows)
  284. }
  285. }else{
  286. this.$toast(res.msg)
  287. }
  288. })
  289. },
  290. },
  291. }
  292. </script>
  293. <style lang="scss" scoped>
  294. .fixedt{position: fixed;left: 0;right: 0;top: 0;z-index: 2;}
  295. // .fixedt /deep/ uni-picker{flex: 1;}
  296. .checkbox{padding:16rpx 32rpx;background-color: #efefef;
  297. .chekt{display: flex;align-items: center;margin-right: 12rpx;height:88rpx;
  298. view{text-align: center;
  299. font-weight: bold;font-size: 26rpx;color: #374B61;width: 136rpx;word-break: break-all;text-overflow: ellipsis;overflow: hidden;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;white-space: normal;}
  300. image{width: 16rpx;height: 12rpx;flex: 0 0 auto;margin-left: 4rpx;}
  301. }
  302. }
  303. .reset{width:56rpx; height: 88rpx;display: flex;align-items: center;justify-content: center;
  304. image{width: 26rpx;height: 30rpx;}
  305. }
  306. .topc{border-radius: 34rpx;height:68rpx;box-sizing: border-box;padding:0 28rpx;position: relative;flex:1;background-color:rgba(90, 135, 186, 0.2);width: 260rpx;
  307. margin-left: 20rpx;
  308. input{font-weight: 500;font-size: 26rpx;color: #222327;}
  309. image{width: 30rpx;height: 30rpx;margin-right: 16rpx;flex: 0 0 auto;}
  310. }
  311. // .listbox{padding-top: 120rpx;padding-bottom: 100rpx;}
  312. .listbox{padding-top: 120rpx;}
  313. .scanbox{position: fixed;left: 0;right: 0;bottom: 0;height: 100rpx;
  314. background: #00A9F0;font-weight: bold;font-size: 30rpx;color: #FFFFFF;
  315. image{width: 26rpx;height: 26rpx;margin-right: 24rpx;}
  316. }
  317. </style>