cloud.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. const util = require('../../utils/util.js');
  2. const app = getApp()
  3. Page({
  4. data: {
  5. userType: wx.getStorageSync('userInfo').type,
  6. current: wx.getStorageSync('userInfo').type=='C'?'tab1':'tab2',
  7. money: 0.00,
  8. addflag:true, //判断是否显示搜索框右侧部分
  9. searchstr:'',
  10. date: util.formatMonth(new Date()),
  11. index:0,
  12. array: ["全部状态","未支付","未签署","已签署","已拒绝","已退款"],
  13. arrayCode: ["0","NOT_PAY","NOT_SIGN","ALREADY_SIGN","ALREADY_REJECT","ALREADY_REFUND"],
  14. list: [],
  15. pageNum: 1,
  16. allPage: 0,
  17. isHide: true,
  18. loadHide: true,
  19. showList: true,
  20. scrollViewHeith: 400,
  21. timer: null,
  22. scrollTop: 5
  23. },
  24. onLoad: function () {
  25. var that = this;
  26. that.setData({
  27. pageNum: 1,
  28. isHide: true,
  29. loadHide: true,
  30. userType: wx.getStorageSync('userInfo').type,
  31. current: wx.getStorageSync('userInfo').type=='C'?'tab1':'tab2'
  32. })
  33. that.getCloudList();
  34. wx.showShareMenu({
  35. withShareTicket: true
  36. })
  37. // wx.startPullDownRefresh({
  38. // success: function(res){
  39. // console.log(res)
  40. // },
  41. // fail: function(res){
  42. // console.log(res)
  43. // }
  44. // })
  45. },
  46. onReady: function(){
  47. var that = this;
  48. wx.getSystemInfo({
  49. success: function (res) {
  50. if(that.data.userType == "C"){
  51. var scrollViewHeith = res.windowHeight - 140
  52. } else {
  53. var scrollViewHeith = res.windowHeight - 95
  54. }
  55. that.setData({
  56. scrollViewHeith: scrollViewHeith
  57. })
  58. },
  59. })
  60. },
  61. getCloudList: function(){
  62. var that = this;
  63. var data = {
  64. openId: wx.getStorageSync("openId"),//"oiX-X0fKWkoOgkUjHUjbLpw8IwZo",
  65. pageNum:this.data.pageNum
  66. }
  67. if(this.data.pageNum == 1){
  68. that.setData({
  69. list: []
  70. })
  71. }
  72. if (that.data.searchstr != null && that.data. searchstr != '') {
  73. data.keyword = that.data.searchstr;
  74. }
  75. if (that.data.index != 0) {
  76. data.status = that.data.arrayCode[that.data.index];
  77. }
  78. if(that.data.userType == "C"){
  79. data.time = that.data.date;
  80. }
  81. if(that.data.current == "tab1"){
  82. data.myProve = 0;
  83. } else {
  84. data.myProve = 1;
  85. }
  86. wx.request({
  87. url: app.globalData.serverUrl + '/cloudcard/list',
  88. data: data,
  89. success(res) {
  90. if (res.data.data != null) {
  91. if(res.data.code == "ok"){
  92. if(res.data.data.rows.length != 0){
  93. var alllist = that.data.list , list = res.data.data.rows;
  94. for (var i=0;i<list.length; i++) {
  95. if (list[i].orderStatus == 'NOT_PAY') {
  96. list[i].statusName = '未支付';
  97. } else if (list[i].orderStatus == 'NOT_SIGN') {
  98. list[i].statusName = '未签署';
  99. } else if (list[i].orderStatus == 'ALREADY_SIGN') {
  100. list[i].statusName = '已签署';
  101. } else if (list[i].orderStatus == 'ALREADY_REJECT') {
  102. list[i].statusName = '已拒绝';
  103. } else if (list[i].orderStatus == 'ALREADY_FAILURE') {
  104. list[i].statusName = '已失效';
  105. } else if (list[i].orderStatus == 'ALREADY_REFUND') {
  106. if(list[i].initiatorId != wx.getStorageSync('userInfo').id) {
  107. list[i].statusName = '已失效';
  108. } else {
  109. list[i].statusName = '已退款';
  110. }
  111. } else {
  112. list[i].statusName = '未知';
  113. }
  114. alllist.push(list[i]);
  115. }
  116. that.setData({
  117. list:alllist,
  118. allPage: res.data.data.totalPage,
  119. showList: true,
  120. money: res.data.data.lawyerTotalFee
  121. });
  122. }
  123. } else {
  124. setTimeout(function() {
  125. wx.reLaunch({
  126. url: '../index/index'
  127. })
  128. }, 200)
  129. }
  130. } else {
  131. that.setData({
  132. showList: false
  133. })
  134. }
  135. wx.stopPullDownRefresh();
  136. wx.hideNavigationBarLoading();
  137. },
  138. fail: function (res) {
  139. that.setData({
  140. showList: false
  141. })
  142. wx.stopPullDownRefresh();
  143. wx.hideNavigationBarLoading();
  144. }
  145. })
  146. },
  147. //分页加载更多
  148. next(){
  149. var page = this.data.pageNum;
  150. page++ ;
  151. this.setData({
  152. pageNum: page
  153. })
  154. if(this.data.allPage < page){
  155. this.setData({
  156. isHide: false
  157. })
  158. } else {
  159. this.getCloudList();
  160. }
  161. },
  162. refresh(){
  163. var that = this;
  164. wx.startPullDownRefresh({
  165. success(errMsg) {
  166. console.log('开始下拉刷新', errMsg)
  167. },
  168. complete() {
  169. console.log('下拉刷新完毕')
  170. that.onLoad();
  171. }
  172. })
  173. },
  174. reload(e){
  175. clearTimeout(this.data.timer)
  176. if (e.detail.scrollTop < this.data.scrollTop) {
  177. this.data.timer = setTimeout( () => {
  178. wx.showNavigationBarLoading();
  179. this.onLoad()
  180. }, 1000)
  181. }
  182. },
  183. onPullDownRefresh(){
  184. var that = this;
  185. wx.showNavigationBarLoading();
  186. that.onLoad();
  187. // wx.startPullDownRefresh({
  188. // success(errMsg) {
  189. // console.log('开始下拉刷新', errMsg)
  190. // },
  191. // complete() {
  192. // console.log('下拉刷新完毕')
  193. // wx.stopPullDownRefresh();
  194. // return false
  195. // }
  196. // })
  197. },
  198. //查看详情
  199. viewDetail(e){
  200. var id = e.currentTarget.dataset.id;
  201. wx.navigateTo({
  202. url: '../detail/detail?id='+id
  203. })
  204. },
  205. //创建云证
  206. create(){
  207. wx.navigateTo({
  208. url: '../initCloud/initCloud'
  209. })
  210. },
  211. bindPickerChange(e) {
  212. this.setData({
  213. index: e.detail.value
  214. })
  215. //重新加载数据
  216. this.getCloudList();
  217. },
  218. // 搜索框右侧 事件
  219. addhandle(e) {
  220. this.getCloudList();
  221. },
  222. //搜索框输入时触发
  223. searchList(ev) {
  224. let e = ev.detail;
  225. this.setData({
  226. searchstr: e.detail.value
  227. })
  228. },
  229. //搜索回调
  230. endsearchList(e) {
  231. },
  232. // 取消搜索
  233. cancelsearch() {
  234. this.setData({
  235. searchstr: ''
  236. })
  237. },
  238. //清空搜索框
  239. activity_clear(e) {
  240. this.setData({
  241. searchstr: ''
  242. })
  243. },
  244. handleChange ({ detail }) {
  245. this.setData({
  246. current: detail.key
  247. });
  248. this.getCloudList();
  249. },
  250. bindTimeChange(e){
  251. this.setData({
  252. date: e.detail.value
  253. });
  254. this.getCloudList();
  255. }
  256. })