微信小程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
3 лет назад
3 лет назад
3 лет назад
3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  112. success: (res) => {
  113. this.setData({
  114. bankTypeOptions:res.data
  115. });
  116. }
  117. })
  118. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  119. success: (res) => {
  120. if (res.code == API.SUCCESS_CODE) {
  121. this.setData({bookName:res.user.bookName})
  122. }
  123. }
  124. })
  125. UTIL.httpRequest(API.URL_GET_APPROVALITEMSLIST, {method:'GET',dataType:'1'}, {
  126. success: (res) => {
  127. if (res.code == API.SUCCESS_CODE) {
  128. that.setData({
  129. approvalItemsOptions : res.rows
  130. })
  131. }
  132. }
  133. })
  134. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData,{
  135. success: (res) => {
  136. for (let i = 0; i < res.rows.length; i++) {
  137. if(res.rows[i].bankAccountNumber==null){continue;}
  138. res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 ");
  139. res.rows[i].balance = parseFloat(res.rows[i].balance).toFixed(2);
  140. res.rows[i].bankTypeText = UTIL.getTransform(res.rows[i].bankType,that.data.bankTypeOptions);
  141. }
  142. console.log(res.rows)
  143. that.setData({
  144. accountList:res.rows
  145. })
  146. }
  147. })
  148. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData2,{
  149. success: (res) => {
  150. for (let i = 0; i < res.rows.length; i++) {
  151. if(res.rows[i].bankAccountNumber==null){continue;}
  152. res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 ")
  153. }
  154. console.log(res.rows)
  155. that.setData({
  156. accountListXJ:res.rows
  157. })
  158. }
  159. })
  160. },
  161. delete(e){
  162. console.log(e);
  163. var that = this;
  164. UTIL.httpRequest(API.URL_GET_REMOVEAPPROVAL + e.currentTarget.dataset.id, {method:'GET'},{
  165. success: (res) => {
  166. if (res.code == API.SUCCESS_CODE) {
  167. that.data.approvalItemsOptions.splice(e.currentTarget.dataset.index, 1);
  168. wx.showToast({
  169. title: '删除成功!',
  170. icon: 'success',
  171. duration: 2000
  172. })
  173. that.setData({
  174. approvalItemsOptions : that.data.approvalItemsOptions
  175. })
  176. }
  177. }
  178. })
  179. },
  180. getMr(e){
  181. var that = this;
  182. UTIL.httpRequest(API.URL_GET_GETSETDEFAULTVALUES + e.currentTarget.dataset.id, {method:'GET'},{
  183. success: (res) => {
  184. if (res.code == API.SUCCESS_CODE) {
  185. UTIL.httpRequest(API.URL_GET_APPROVALITEMSLIST, {method:'GET',dataType:'1'}, {
  186. success: (res) => {
  187. if (res.code == API.SUCCESS_CODE) {
  188. wx.showToast({
  189. title: '设置成功!',
  190. icon: 'success',
  191. duration: 2000
  192. })
  193. that.setData({
  194. approvalItemsOptions : res.rows
  195. })
  196. }
  197. }
  198. })
  199. }
  200. }
  201. })
  202. },
  203. /**
  204. * 生命周期函数--监听页面隐藏
  205. */
  206. onHide: function () {
  207. },
  208. /**
  209. * 生命周期函数--监听页面卸载
  210. */
  211. onUnload: function () {
  212. },
  213. /**
  214. * 页面相关事件处理函数--监听用户下拉动作
  215. */
  216. onPullDownRefresh: function () {
  217. },
  218. /**
  219. * 页面上拉触底事件的处理函数
  220. */
  221. onReachBottom: function () {
  222. },
  223. navigate(even){
  224. wx.navigateTo({
  225. url: even.currentTarget.dataset.url,
  226. })
  227. },
  228. /**
  229. * 用户点击右上角分享
  230. */
  231. onShareAppMessage: function () {
  232. }
  233. })