123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- const util = require('../../utils/util.js');
- const app = getApp()
- Page({
- data: {
- userType: wx.getStorageSync('userInfo').type,
- current: wx.getStorageSync('userInfo').type=='C'?'tab1':'tab2',
- money: 0.00,
- addflag:true, //判断是否显示搜索框右侧部分
- searchstr:'',
- date: util.formatMonth(new Date()),
- index:0,
- array: ["全部状态","未支付","未签署","已签署","已拒绝","已退款"],
- arrayCode: ["0","NOT_PAY","NOT_SIGN","ALREADY_SIGN","ALREADY_REJECT","ALREADY_REFUND"],
- list: [],
- pageNum: 1,
- allPage: 0,
- isHide: true,
- loadHide: true,
- showList: true,
- scrollViewHeith: 400,
- timer: null,
- scrollTop: 5
- },
- onLoad: function () {
- var that = this;
- that.setData({
- pageNum: 1,
- isHide: true,
- loadHide: true,
- userType: wx.getStorageSync('userInfo').type,
- current: wx.getStorageSync('userInfo').type=='C'?'tab1':'tab2'
- })
- that.getCloudList();
- wx.showShareMenu({
- withShareTicket: true
- })
- // wx.startPullDownRefresh({
- // success: function(res){
- // console.log(res)
- // },
- // fail: function(res){
- // console.log(res)
- // }
- // })
- },
- onReady: function(){
- var that = this;
- wx.getSystemInfo({
- success: function (res) {
- if(that.data.userType == "C"){
- var scrollViewHeith = res.windowHeight - 140
- } else {
- var scrollViewHeith = res.windowHeight - 95
- }
- that.setData({
- scrollViewHeith: scrollViewHeith
- })
- },
- })
- },
- getCloudList: function(){
- var that = this;
- var data = {
- openId: wx.getStorageSync("openId"),//"oiX-X0fKWkoOgkUjHUjbLpw8IwZo",
- pageNum:this.data.pageNum
- }
- if(this.data.pageNum == 1){
- that.setData({
- list: []
- })
- }
- if (that.data.searchstr != null && that.data. searchstr != '') {
- data.keyword = that.data.searchstr;
- }
- if (that.data.index != 0) {
- data.status = that.data.arrayCode[that.data.index];
- }
- if(that.data.userType == "C"){
- data.time = that.data.date;
- }
- if(that.data.current == "tab1"){
- data.myProve = 0;
- } else {
- data.myProve = 1;
- }
- wx.request({
- url: app.globalData.serverUrl + '/cloudcard/list',
- data: data,
- success(res) {
- if (res.data.data != null) {
- if(res.data.code == "ok"){
- if(res.data.data.rows.length != 0){
- var alllist = that.data.list , list = res.data.data.rows;
- for (var i=0;i<list.length; i++) {
- if (list[i].orderStatus == 'NOT_PAY') {
- list[i].statusName = '未支付';
- } else if (list[i].orderStatus == 'NOT_SIGN') {
- list[i].statusName = '未签署';
- } else if (list[i].orderStatus == 'ALREADY_SIGN') {
- list[i].statusName = '已签署';
- } else if (list[i].orderStatus == 'ALREADY_REJECT') {
- list[i].statusName = '已拒绝';
- } else if (list[i].orderStatus == 'ALREADY_FAILURE') {
- list[i].statusName = '已失效';
- } else if (list[i].orderStatus == 'ALREADY_REFUND') {
- if(list[i].initiatorId != wx.getStorageSync('userInfo').id) {
- list[i].statusName = '已失效';
- } else {
- list[i].statusName = '已退款';
- }
- } else {
- list[i].statusName = '未知';
- }
- alllist.push(list[i]);
- }
- that.setData({
- list:alllist,
- allPage: res.data.data.totalPage,
- showList: true,
- money: res.data.data.lawyerTotalFee
- });
- }
- } else {
- setTimeout(function() {
- wx.reLaunch({
- url: '../index/index'
- })
- }, 200)
- }
- } else {
- that.setData({
- showList: false
- })
- }
- wx.stopPullDownRefresh();
- wx.hideNavigationBarLoading();
- },
- fail: function (res) {
- that.setData({
- showList: false
- })
- wx.stopPullDownRefresh();
- wx.hideNavigationBarLoading();
- }
- })
- },
- //分页加载更多
- next(){
- var page = this.data.pageNum;
- page++ ;
- this.setData({
- pageNum: page
- })
- if(this.data.allPage < page){
- this.setData({
- isHide: false
- })
- } else {
- this.getCloudList();
- }
- },
- refresh(){
- var that = this;
- wx.startPullDownRefresh({
- success(errMsg) {
- console.log('开始下拉刷新', errMsg)
- },
- complete() {
- console.log('下拉刷新完毕')
- that.onLoad();
- }
- })
- },
- reload(e){
- clearTimeout(this.data.timer)
- if (e.detail.scrollTop < this.data.scrollTop) {
- this.data.timer = setTimeout( () => {
- wx.showNavigationBarLoading();
- this.onLoad()
- }, 1000)
- }
- },
- onPullDownRefresh(){
- var that = this;
- wx.showNavigationBarLoading();
- that.onLoad();
- // wx.startPullDownRefresh({
- // success(errMsg) {
- // console.log('开始下拉刷新', errMsg)
- // },
- // complete() {
- // console.log('下拉刷新完毕')
-
- // wx.stopPullDownRefresh();
- // return false
- // }
- // })
- },
- //查看详情
- viewDetail(e){
- var id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '../detail/detail?id='+id
- })
- },
- //创建云证
- create(){
- wx.navigateTo({
- url: '../initCloud/initCloud'
- })
- },
- bindPickerChange(e) {
- this.setData({
- index: e.detail.value
- })
- //重新加载数据
- this.getCloudList();
- },
- // 搜索框右侧 事件
- addhandle(e) {
- this.getCloudList();
- },
- //搜索框输入时触发
- searchList(ev) {
- let e = ev.detail;
- this.setData({
- searchstr: e.detail.value
- })
- },
- //搜索回调
- endsearchList(e) {
- },
- // 取消搜索
- cancelsearch() {
- this.setData({
- searchstr: ''
- })
- },
- //清空搜索框
- activity_clear(e) {
- this.setData({
- searchstr: ''
- })
- },
- handleChange ({ detail }) {
- this.setData({
- current: detail.key
- });
- this.getCloudList();
- },
- bindTimeChange(e){
- this.setData({
- date: e.detail.value
- });
- this.getCloudList();
- }
- })
|