list.vue 9.1 KB

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