微信小程序
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 6.1 KiB

3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. // pages/apply/index.js
  2. import * as UTIL from '../../utils/util.js';
  3. import * as API from '../../utils/API.js';
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. isIPX: app.globalData.isIPX,
  11. show:false,
  12. accountList:[],
  13. approvalItemsOptions:[],
  14. bookName:''
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (options) {
  20. },
  21. //跳转支出申请
  22. swichPaymentApply:function(e){
  23. console.log(e.currentTarget.dataset.current);
  24. // let cur = e.currentTarget.dataset.current;
  25. // if (this.data.currentTaB == cur) {
  26. // return false;
  27. // }else{
  28. // wx.navigateTo({
  29. // url: '../inCome/index?id=' + id,
  30. // })
  31. // }
  32. wx.navigateTo({
  33. url: '/pages/apply/paymentTemplate/add/add',
  34. })
  35. },
  36. openBox:function(){
  37. var that = this ;
  38. that.setData({
  39. show: true,
  40. })
  41. },
  42. closeBox:function(){
  43. var that = this ;
  44. that.setData({
  45. show: false,
  46. })
  47. },
  48. goTemplate:function(e){
  49. wx.navigateTo({
  50. url: 'paymentTemplate/add/add?id='+e.currentTarget.dataset.id+'&type=template&option='+e.currentTarget.dataset.options
  51. })
  52. },
  53. updateMoney:function(e){
  54. UTIL.showLoadingHaveMask('正在查询');
  55. UTIL.httpRequest(API.URL_GET_GETBALANCEENQUIRY+e.currentTarget.dataset.id, {method:'GET'}, {
  56. success: (res) => {
  57. if (res.code == API.SUCCESS_CODE) {
  58. this.setData({
  59. ["accountList["+e.currentTarget.dataset.index+"].balance"]:res.msg
  60. })
  61. UTIL.hideLoadingHaveMask();
  62. wx.showToast({
  63. title: '查询成功',
  64. icon: 'success',
  65. duration: 2000,
  66. })
  67. }else{
  68. UTIL.hideLoadingHaveMask();
  69. wx.showToast({
  70. title: '查询失败',
  71. icon: 'error',
  72. duration: 2000,
  73. })
  74. }
  75. }
  76. })
  77. },
  78. back:function(){
  79. wx.navigateBack({
  80. delta: 1
  81. })
  82. },
  83. /**
  84. * 生命周期函数--监听页面初次渲染完成
  85. */
  86. onReady: function () {
  87. },
  88. /**
  89. * 生命周期函数--监听页面显示
  90. */
  91. onShow: function () {
  92. var that = this;
  93. wx.showLoading({
  94. title: '正在加载账户列表',
  95. mask:true
  96. })
  97. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  98. success: (res) => {
  99. this.setData({
  100. bankTypeOptions:res.data
  101. });
  102. }
  103. })
  104. var sendData = {
  105. pageNum:'1',
  106. pageSize:'100',
  107. accountName:'',
  108. bankAccountNumber:'',
  109. status:'N',
  110. method:'GET',
  111. accountType:102
  112. }
  113. var sendData2 = {
  114. pageNum:'1',
  115. pageSize:'100',
  116. accountName:'',
  117. bankAccountNumber:'',
  118. status:'N',
  119. method:'GET',
  120. accountType:101
  121. }
  122. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  123. success: (res) => {
  124. if (res.code == API.SUCCESS_CODE) {
  125. this.setData({bookName:res.user.bookName})
  126. }
  127. }
  128. })
  129. UTIL.httpRequest(API.URL_GET_GETTEMPLATELIST, {method:'GET'}, {
  130. success: (res) => {
  131. if (res.code == API.SUCCESS_CODE) {
  132. that.setData({
  133. approvalItemsOptions : res.rows
  134. })
  135. }
  136. }
  137. })
  138. setTimeout(function(){
  139. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData,{
  140. success: (res) => {
  141. for (let i = 0; i < res.rows.length; i++) {
  142. if(res.rows[i].bankAccountNumber==null){continue;}
  143. res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 ");
  144. res.rows[i].balance = parseFloat(res.rows[i].balance).toFixed(2);
  145. res.rows[i].bankTypeText = UTIL.getTransform(res.rows[i].bankType,that.data.bankTypeOptions);
  146. }
  147. console.log(res.rows)
  148. that.setData({
  149. accountList:res.rows
  150. })
  151. wx.hideLoading();
  152. }
  153. })
  154. },1000)
  155. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData2,{
  156. success: (res) => {
  157. for (let i = 0; i < res.rows.length; i++) {
  158. // if(res.rows[i].bankAccountNumber==null){continue;}
  159. // res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 ");
  160. res.rows[i].balance = parseFloat(res.rows[i].balance).toFixed(2);
  161. console.log(res.rows[i].balance)
  162. }
  163. that.setData({
  164. accountListXJ:res.rows
  165. })
  166. }
  167. })
  168. },
  169. delete(e){
  170. console.log(e);
  171. var that = this;
  172. UTIL.httpRequest(API.URL_GET_GETTEMPLATEREMOVE + e.currentTarget.dataset.id, {method:'GET'},{
  173. success: (res) => {
  174. if (res.code == API.SUCCESS_CODE) {
  175. that.data.approvalItemsOptions.splice(e.currentTarget.dataset.index, 1);
  176. wx.showToast({
  177. title: '删除成功!',
  178. icon: 'success',
  179. duration: 2000
  180. })
  181. that.setData({
  182. approvalItemsOptions : that.data.approvalItemsOptions
  183. })
  184. }
  185. }
  186. })
  187. },
  188. getMr(e){
  189. var that = this;
  190. UTIL.httpRequest(API.URL_GET_GETTEMPLATERESETDEFAULT + e.currentTarget.dataset.id, {method:'GET'},{
  191. success: (res) => {
  192. if (res.code == API.SUCCESS_CODE) {
  193. UTIL.httpRequest(API.URL_GET_GETTEMPLATELIST, {method:'GET'}, {
  194. success: (res) => {
  195. if (res.code == API.SUCCESS_CODE) {
  196. wx.showToast({
  197. title: '设置成功!',
  198. icon: 'success',
  199. duration: 2000
  200. })
  201. that.setData({
  202. approvalItemsOptions : res.rows
  203. })
  204. }
  205. }
  206. })
  207. }
  208. }
  209. })
  210. },
  211. /**
  212. * 生命周期函数--监听页面隐藏
  213. */
  214. onHide: function () {
  215. },
  216. /**
  217. * 生命周期函数--监听页面卸载
  218. */
  219. onUnload: function () {
  220. },
  221. /**
  222. * 页面相关事件处理函数--监听用户下拉动作
  223. */
  224. onPullDownRefresh: function () {
  225. },
  226. /**
  227. * 页面上拉触底事件的处理函数
  228. */
  229. onReachBottom: function () {
  230. },
  231. /**
  232. * 用户点击右上角分享
  233. */
  234. onShareAppMessage: function () {
  235. }
  236. })