微信小程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

240 řádky
5.5 KiB

  1. import * as UTIL from '../../utils/util.js';
  2. import * as API from '../../utils/API.js';
  3. const app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. isIPX: app.globalData.isIPX,
  10. show:false,
  11. accountList:[],
  12. approvalItemsOptions:[],
  13. bookName:'',
  14. accountListXJ:[]
  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'
  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. var sendData = {
  94. pageNum:'1',
  95. pageSize:'100',
  96. accountName:'',
  97. bankAccountNumber:'',
  98. status:'N',
  99. method:'GET',
  100. accountType:102
  101. }
  102. var sendData2 = {
  103. pageNum:'1',
  104. pageSize:'100',
  105. accountName:'',
  106. bankAccountNumber:'',
  107. status:'N',
  108. method:'GET',
  109. accountType:101
  110. }
  111. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  112. success: (res) => {
  113. if (res.code == API.SUCCESS_CODE) {
  114. this.setData({bookName:res.user.bookName})
  115. }
  116. }
  117. })
  118. UTIL.httpRequest(API.URL_GET_APPROVALITEMSLIST, {method:'GET',dataType:'1'}, {
  119. success: (res) => {
  120. if (res.code == API.SUCCESS_CODE) {
  121. that.setData({
  122. approvalItemsOptions : res.rows
  123. })
  124. }
  125. }
  126. })
  127. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData,{
  128. success: (res) => {
  129. for (let i = 0; i < res.rows.length; i++) {
  130. if(res.rows[i].bankAccountNumber==null){continue;}
  131. res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 ")
  132. }
  133. console.log(res.rows)
  134. that.setData({
  135. accountList:res.rows
  136. })
  137. }
  138. })
  139. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData2,{
  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. }
  145. console.log(res.rows)
  146. that.setData({
  147. accountListXJ:res.rows
  148. })
  149. }
  150. })
  151. },
  152. delete(e){
  153. console.log(e);
  154. var that = this;
  155. UTIL.httpRequest(API.URL_GET_REMOVEAPPROVAL + e.currentTarget.dataset.id, {method:'GET'},{
  156. success: (res) => {
  157. if (res.code == API.SUCCESS_CODE) {
  158. that.data.approvalItemsOptions.splice(e.currentTarget.dataset.index, 1);
  159. wx.showToast({
  160. title: '删除成功!',
  161. icon: 'success',
  162. duration: 2000
  163. })
  164. that.setData({
  165. approvalItemsOptions : that.data.approvalItemsOptions
  166. })
  167. }
  168. }
  169. })
  170. },
  171. getMr(e){
  172. var that = this;
  173. UTIL.httpRequest(API.URL_GET_GETSETDEFAULTVALUES + e.currentTarget.dataset.id, {method:'GET'},{
  174. success: (res) => {
  175. if (res.code == API.SUCCESS_CODE) {
  176. UTIL.httpRequest(API.URL_GET_APPROVALITEMSLIST, {method:'GET',dataType:'1'}, {
  177. success: (res) => {
  178. if (res.code == API.SUCCESS_CODE) {
  179. wx.showToast({
  180. title: '设置成功!',
  181. icon: 'success',
  182. duration: 2000
  183. })
  184. that.setData({
  185. approvalItemsOptions : res.rows
  186. })
  187. }
  188. }
  189. })
  190. }
  191. }
  192. })
  193. },
  194. /**
  195. * 生命周期函数--监听页面隐藏
  196. */
  197. onHide: function () {
  198. },
  199. /**
  200. * 生命周期函数--监听页面卸载
  201. */
  202. onUnload: function () {
  203. },
  204. /**
  205. * 页面相关事件处理函数--监听用户下拉动作
  206. */
  207. onPullDownRefresh: function () {
  208. },
  209. /**
  210. * 页面上拉触底事件的处理函数
  211. */
  212. onReachBottom: function () {
  213. },
  214. navigate(even){
  215. wx.navigateTo({
  216. url: even.currentTarget.dataset.url,
  217. })
  218. },
  219. /**
  220. * 用户点击右上角分享
  221. */
  222. onShareAppMessage: function () {
  223. }
  224. })