123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538 |
- // pages/market/index.js
- const request = require('../../utils/request.js');
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- nvabarData: {
- showCapsule: 1, //是否显示左上角图标,消息中心 1表示显示 0表示不显示
- showBack: 0, //返回
- title: '金融超市', //导航栏 中间的标题
- // 此页面 页面内容距最顶部的距离
- height: app.globalData.height * 2 + 20,
- },
- active: 2,
- icon: {
- normal: '/pages/images/home.png',
- active: '/pages/images/home_fill.png',
- bankNormal: '/pages/images/duijie.png',
- bankActive: '/pages/images/duijie_fill.png',
- marketNormal: '/pages/images/recharge.png',
- marketActive: '/pages/images/recharge_fill.png',
- policyNormal: '/pages/images/news_hot.png',
- policyActive: '/pages/images/news_hot_fill.png',
- myNormal: '/pages/images/people.png',
- myActive: '/pages/images/people_fill.png'
- },
- tabActive: 0,
- currentTab: 0,
- idx: '0',
- applyList: [{
- id: "0",
- name: "全部"
- }, {
- id: "1",
- name: "最低利率"
- },
- // {
- // id: "2",
- // name: "成功率"
- // }
- ],
- // 判断状态 0为默认不展开 1为展开
- _num:0,
- // 筛选-单选按钮选中内容 默认为a
- // checked: false,
- checked1:false,
- show: false,
- showView: false,
- successNum: '1000',
- // 全部-视频列表
- marketOneVideoList: [],
- //全部-无视频列表
- marketOneNovideoList: [],
- rzqxList: [{
- code: '3',
- name: '3个月及以下',
- },
- {
- code: '6',
- name: '6个月及以下',
- },
- {
- code: '9',
- name: '9个月及以下'
- },
- {
- code: '12',
- name: '12个月及以下'
- },
- {
- code: '13',
- name: '12个月及以上'
- },
- ],
- dbfsList: [],
- rzedList: [{
- code: '100',
- name: '100万及以下',
- },
- {
- code: '200',
- name: '200万及以下',
- },
- {
- code: '500',
- name: '500万及以下'
- },
- {
- code: '1000',
- name: '1000万及以下'
- },
- {
- code: '1001',
- name: '1000万及以上'
- },
- ],
- rzqdList: [],
- title: '',
- name: '',
- formData: {
- skip: 0,
- limit: 5,
- mongey_min_rate: '', // 最低利率排序
- title: '', //请输入金融产品名称
- name: '', // 银行
- claims_max_money: "", //筛选钱
- claims_max_term: "", //筛选期限
- ensure_id: "", // 融资方式
- cplx_id: '', // 抗疫贷 科技贷 全部
- uid: '', // 融资渠道
- },
- total: 0,
- pageSize: 1,
- showMore: false, //更多
- },
- // 更多
- listToggle: function () {
- this.setData({
- showMore: !this.data.showMore
- })
- },
- // 搜索按钮
- radioChange: function (e) {
- console.log(e,"e")
- console.log('radio发生change事件,携带value值为:', e.detail.value)
- },
- // 筛选提交
- formSubmit: function (e) {
- console.log('form发生了submit事件,携带数据为:', e.detail.value)
- this.setData({
- show: false,
- _num: 0
- });
- var claims_max_money = 'formData.claims_max_money'
- var claims_max_term = 'formData.claims_max_term'
- var skip = 'formData.skip'
- var ensure_id = 'formData.ensure_id'
- var uid = 'formData.uid'
- var that = this;
- that.setData({
- [claims_max_money]: e.detail.value.claims_max_money,
- [claims_max_term]: e.detail.value.claims_max_term,
- [ensure_id]: e.detail.value.code,
- [uid]: e.detail.value.uid,
- marketOneVideoList: [],
- marketOneNovideoList: [],
- [skip]: 0,
- pageSize: 1
- })
- this.all();
- },
- formReset: function (e) {
-
- console.log('form发生了reset事件')
- console.log(e);
-
- },
- // 有id跳转
- marketOneVideoDetail: function (e) {
- console.log(e)
- let pid = e.currentTarget.dataset.pid;
- let img = e.currentTarget.dataset.img;
- let joincount = e.currentTarget.dataset.joincount;
- let code = e.currentTarget.dataset.code;
- let uid = e.currentTarget.dataset.uid;
- if (wx.getStorageSync('user') == "") {
- wx.redirectTo({
- url: '/pages/login/index'
- })
- } else {
- if (wx.getStorageSync('user').roles != "0") {
- wx.navigateTo({
- url: '/pages/loanDetailapply/index?id=' + pid + '&uid=' + uid + '&num=' + joincount + '&ecode=' + code + '&img=' + img // 希望跳转过去的页面
- })
- } else {
- wx.showToast({
- title: '您的企业正在审核中,暂不能申请',
- icon: "none"
- })
- }
- }
- },
- //
- marketOneVideoNoDetail(e) {
- let claimid = e.currentTarget.dataset.claimid;
- let img = e.currentTarget.dataset.img;
- wx.navigateTo({
- url: '/pages/marketLoanDetail/index?claimid=' + claimid + '&img=' + img,
- })
- },
- // 上下效果
- onChangeShowState: function () {
- var that = this;
- that.setData({
- showView: (!that.data.showView)
- })
- },
- showPopup() {
- console.log('showPopup');
- this.setData({
- show: true,
- _num: 1
- });
- },
- onClose() {
- this.setData({
- show: true,
- _num: 0
- });
- },
- // 切换标签
- onChangeTab(event) {
- // this.setData({
- // marketOneNovideoList : [],
- // marketOnevideoList : []
- // });
- // console.log(this.data.marketOnevideoList,"切换时候为空么?");
- var cplx_id = 'formData.cplx_id'
- var skip = 'formData.skip'
- var that = this
- if (event.detail.index == 0) {
- console.log("1");
- that.setData({
- [cplx_id]: '',
- [skip]: 0,
- marketOneVideoList: [],
- marketOneNovideoList: [],
- pageSize: 1
- })
- } else if (event.detail.index == 1) {
- that.setData({
- [cplx_id]: '2401',
- [skip]: 0,
- marketOneVideoList: [],
- marketOneNovideoList: [],
- pageSize: 1
- })
- } else if (event.detail.index == 2) {
- that.setData({
- [cplx_id]: '2402',
- [skip]: 0,
- marketOneVideoList: [],
- marketOneNovideoList: [],
- pageSize: 1
- })
- }
- this.all();
- // wx.showToast({
- // title: `切换到标签 ${event.detail.title}`,
- // });
- },
- // 筛选
- selectApply: function (e) {
- let id = e.target.dataset.id
- console.log(id)
- var skip = 'formData.skip'
- this.setData({
- idx: id
- })
- if (id == '0') {
- var mongey_min_rate = 'formData.mongey_min_rate'
- var that = this
- that.setData({
- [mongey_min_rate]: '',
- marketOneVideoList: [],
- marketOneNovideoList: [],
- pageSize: 1,
- [skip]: 0,
- })
- } else if (id == '1') {
- var mongey_min_rate = 'formData.mongey_min_rate'
- var that = this
- that.setData({
- [mongey_min_rate]: '1',
- marketOneVideoList: [],
- marketOneNovideoList: [],
- pageSize: 1,
- [skip]: 0,
- })
- }
- this.all();
- },
- //搜索input 金融产品
- titleInput(e) {
- this.setData({
- title: e.detail.value
- })
- },
- // 搜索 金融产品
- clickSearch(e) {
- var title = 'formData.title'
- var skip = 'formData.skip'
- var that = this
- that.setData({
- [title]: this.data.title,
- marketOneVideoList: [],
- marketOneNovideoList: [],
- [skip]: 0,
- pageSize: 1
- })
- this.all();
- },
- //搜索input 银行
- titleInput1(e) {
- this.setData({
- name: e.detail.value
- })
- },
- // 搜索 银行
- clickSearch1(e) {
- var name = 'formData.name'
- var that = this
- that.setData({
- [name]: this.data.name
- })
- this.all();
- },
- // 切换菜单
- onChange(event) {
- console.log(event.detail)
- this.setData({
- active: event.detail
- });
- if (event.detail == 0) {
- wx.redirectTo({
- url: '/pages/home/index'
- })
- } else if (event.detail == 1) {
- wx.redirectTo({
- url: '/pages/bank/index'
- })
- } else if (event.detail == 2) {
- wx.redirectTo({
- url: '/pages/market/index'
- })
- } else if (event.detail == 3) {
- wx.redirectTo({
- url: '/pages/policy/index'
- })
- } else if (event.detail == 4) {
- wx.redirectTo({
- url: '/pages/my/index'
- })
- }
- },
- // 查询列表
- all() {
- wx.showLoading({
- title: '加载中',
- })
- var that = this;
- wx.request({
- method: "POST",
- url: app.globalData.publicUrl + 'api/financial/searchauto/financeclaims',
- data: this.data.formData,
- success: (e) => {
- if (e.data.data.length !== 0) {
- for (const val1 of that.data.dbfsList) {
- for (const val of e.data.data) {
- if (val1.code == val.ensure_id) {
- val.ensure_name = val1.name
- }
- }
- }
- if (that.data.marketOneVideoList.isEmpty) {
- that.setData({ // 设置页面列表的内容
- marketOneVideoList: e.data.data,
- marketOneNovideoList: e.data.data,
- })
- } else {
- console.log(e.data.data);
- that.setData({ // 设置页面列表的内容
- marketOneVideoList: that.data.marketOneVideoList.concat(e.data.data),
- marketOneNovideoList: that.data.marketOneNovideoList.concat(e.data.data),
- total: e.data.total
- })
- }
- } else {
- // that.setData({ // 设置页面列表的内容
- // marketOneVideoList: e.data.data,
- // marketOneNovideoList: e.data.data,
- // })
- wx.showToast({
- title: "沒有更多数据",
- duration: 1000,
- icon: 'none',
- mask: true
- })
- }
- },
- complete: function () {
- wx.hideLoading();
- wx.hideNavigationBarLoading() //完成停止加载
- wx.stopPullDownRefresh() //停止下拉刷新
- }
- })
- },
- // 字典表
- dictory(code) {
- wx.request({
- method: "get",
- url: app.globalData.publicUrl + 'api/financial/dictionary',
- data: {
- type: code
- },
- success: (e) => {
- if (e.data.errcode == 0) {
- this.setData({
- dbfsList: e.data.data,
- })
- } else {
- wx.showToast({
- title: e.data.details ? e.data.details : e.data.errmsg,
- icon: 'none',
- duration: 1500
- })
- }
- }
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.dictory('db');
- wx.request({
- method: "get",
- url: app.globalData.publicUrl + 'api/financial/institution',
- success: (e) => {
- if (e.data.errcode == 0) {
- this.setData({
- rzqdList: e.data.data,
- })
- } else {
- wx.showToast({
- title: e.data.details ? e.data.details : e.data.errmsg,
- icon: 'none',
- duration: 1500
- })
- }
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- this.all();
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function (e) {
- console.log(this.data._num,"我是判断是否展开")
- if(this.data._num==1){
- return false
- }else{
- wx.showNavigationBarLoading() //在标题栏中显示加载
- this.data.formData.skip = 0
- this.data.pageSize = 1
- this.data.marketOneVideoList = []
- this.data.marketOneNovideoList = []
- wx.showLoading({
- title: '正在刷新数据',
- })
- this.all()
- wx.stopPullDownRefresh();
- }
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- let newPageSize = this.data.pageSize + 1;
- const pageNum = newPageSize;
- const _pagenum = Math.ceil(this.data.total / this.data.formData.limit);
- console.log('下拉+1', newPageSize);
- console.log('已用', pageNum);
- console.log('skip', _pagenum);
- if (newPageSize <= _pagenum) {
- var skip = 'formData.skip'
- var that = this
- that.setData({
- [skip]: (newPageSize - 1) * this.data.formData.limit,
- pageSize: newPageSize
- })
- this.all()
- } else {
- wx.showToast({
- title: '没有更多数据了',
- })
- }
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- console.log("dayin")
- },
- // checkedTap:function(e){
- // console.log(e,"woshi ")
- // }
- })
|