微信小程序
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

282 satır
7.1 KiB

  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/addNew/addNew',
  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. var sendData3 = {
  123. pageNum:'1',
  124. pageSize:'100',
  125. payeeType:'4',
  126. status:'0',
  127. method:'GET',
  128. }
  129. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  130. success: (res) => {
  131. if (res.code == API.SUCCESS_CODE) {
  132. this.setData({bookName:res.user.bookName})
  133. }
  134. }
  135. })
  136. UTIL.httpRequest(API.URL_GET_GETTEMPLATELIST, {method:'GET'}, {
  137. success: (res) => {
  138. if (res.code == API.SUCCESS_CODE) {
  139. that.setData({
  140. approvalItemsOptions : res.rows
  141. })
  142. }
  143. }
  144. })
  145. setTimeout(function(){
  146. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData,{
  147. success: (res) => {
  148. if(res.rows){
  149. for (let i = 0; i < res.rows.length; i++) {
  150. if(res.rows[i].bankAccountNumber==null){continue;}
  151. res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 ");
  152. res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  153. return $1 + ","; }).replace(/\.$/, "");
  154. res.rows[i].bankTypeText = UTIL.getTransform(res.rows[i].bankType,that.data.bankTypeOptions);
  155. }
  156. console.log(res.rows)
  157. that.setData({
  158. accountList:res.rows
  159. })
  160. wx.hideLoading();
  161. }else{
  162. wx.hideLoading();
  163. }
  164. }
  165. })
  166. },1000)
  167. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData2,{
  168. success: (res) => {
  169. if(res.rows){
  170. for (let i = 0; i < res.rows.length; i++) {
  171. // if(res.rows[i].bankAccountNumber==null){continue;}
  172. // res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 ");
  173. res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  174. return $1 + ","; }).replace(/\.$/, "");;
  175. console.log(res.rows[i].balance)
  176. }
  177. that.setData({
  178. accountListXJ:res.rows
  179. })
  180. }
  181. }
  182. })
  183. UTIL.httpRequest(API.URL_GET_SELECTLIST, sendData3,{
  184. success: (res) => {
  185. if(res.rows){
  186. for (let i = 0; i < res.rows.length; i++) {
  187. res.rows[i].payeeAccount = res.rows[i].payeeAccount.replace(/(\d{4})(?=\d)/g, "$1 ");
  188. res.rows[i].payeePaymentLines = Number(res.rows[i].payeePaymentLines).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  189. return $1 + ","; }).replace(/\.$/, "");
  190. }
  191. that.setData({
  192. accountListGWK:res.rows
  193. })
  194. }
  195. }
  196. })
  197. },
  198. delete(e){
  199. console.log(e);
  200. var that = this;
  201. UTIL.httpRequest(API.URL_GET_GETTEMPLATEREMOVE + e.currentTarget.dataset.id, {method:'GET'},{
  202. success: (res) => {
  203. if (res.code == API.SUCCESS_CODE) {
  204. that.data.approvalItemsOptions.splice(e.currentTarget.dataset.index, 1);
  205. wx.showToast({
  206. title: '删除成功!',
  207. icon: 'success',
  208. duration: 2000
  209. })
  210. that.setData({
  211. approvalItemsOptions : that.data.approvalItemsOptions
  212. })
  213. }
  214. }
  215. })
  216. },
  217. getMr(e){
  218. var that = this;
  219. UTIL.httpRequest(API.URL_GET_GETTEMPLATERESETDEFAULT + e.currentTarget.dataset.id, {method:'GET'},{
  220. success: (res) => {
  221. if (res.code == API.SUCCESS_CODE) {
  222. UTIL.httpRequest(API.URL_GET_GETTEMPLATELIST, {method:'GET'}, {
  223. success: (res) => {
  224. if (res.code == API.SUCCESS_CODE) {
  225. wx.showToast({
  226. title: '设置成功!',
  227. icon: 'success',
  228. duration: 2000
  229. })
  230. that.setData({
  231. approvalItemsOptions : res.rows
  232. })
  233. }
  234. }
  235. })
  236. }
  237. }
  238. })
  239. },
  240. /**
  241. * 生命周期函数--监听页面隐藏
  242. */
  243. onHide: function () {
  244. },
  245. /**
  246. * 生命周期函数--监听页面卸载
  247. */
  248. onUnload: function () {
  249. },
  250. /**
  251. * 页面相关事件处理函数--监听用户下拉动作
  252. */
  253. onPullDownRefresh: function () {
  254. },
  255. /**
  256. * 页面上拉触底事件的处理函数
  257. */
  258. onReachBottom: function () {
  259. },
  260. /**
  261. * 用户点击右上角分享
  262. */
  263. onShareAppMessage: function () {
  264. }
  265. })