微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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. showDialog:false,
  16. projectId:'',
  17. beforeClose(action) {
  18. return new Promise((resolve) => {
  19. setTimeout(() => {
  20. if (action === 'confirm') {
  21. // 拦截确认操作
  22. resolve(false);
  23. } else {
  24. resolve(true);
  25. }
  26. }, 0);
  27. });
  28. }
  29. },
  30. /**
  31. * 生命周期函数--监听页面加载
  32. */
  33. onLoad: function (options) {
  34. },
  35. //跳转支出申请
  36. swichPaymentApply:function(e){
  37. console.log(e.currentTarget.dataset.current);
  38. // let cur = e.currentTarget.dataset.current;
  39. // if (this.data.currentTaB == cur) {
  40. // return false;
  41. // }else{
  42. // wx.navigateTo({
  43. // url: '../inCome/index?id=' + id,
  44. // })
  45. // }
  46. wx.navigateTo({
  47. url: '/pages/apply/paymentTemplate/add/add',
  48. })
  49. },
  50. openBox:function(){
  51. var that = this ;
  52. that.setData({
  53. show: true,
  54. })
  55. },
  56. closeBox:function(){
  57. var that = this ;
  58. that.setData({
  59. show: false,
  60. })
  61. },
  62. goTemplate:function(e){
  63. wx.navigateTo({
  64. url: 'paymentTemplate/add/add?id='+e.currentTarget.dataset.id+'&type=template'
  65. })
  66. },
  67. updateMoney:function(e){
  68. UTIL.showLoadingHaveMask('正在查询');
  69. UTIL.httpRequest(API.URL_GET_GETBALANCEENQUIRY+e.currentTarget.dataset.id, {method:'GET'}, {
  70. success: (res) => {
  71. if (res.code == API.SUCCESS_CODE) {
  72. this.setData({
  73. ["accountList["+e.currentTarget.dataset.index+"].balance"]:res.msg
  74. })
  75. UTIL.hideLoadingHaveMask();
  76. wx.showToast({
  77. title: '查询成功',
  78. icon: 'success',
  79. duration: 2000,
  80. })
  81. }else{
  82. UTIL.hideLoadingHaveMask();
  83. wx.showToast({
  84. title: '查询失败',
  85. icon: 'error',
  86. duration: 2000,
  87. })
  88. }
  89. }
  90. })
  91. },
  92. back:function(){
  93. wx.navigateBack({
  94. delta: 1
  95. })
  96. },
  97. /**
  98. * 生命周期函数--监听页面初次渲染完成
  99. */
  100. onReady: function () {
  101. },
  102. /**
  103. * 生命周期函数--监听页面显示
  104. */
  105. onShow: function () {
  106. var that = this;
  107. wx.showLoading({
  108. title: '正在加载账户',
  109. mask:true
  110. })
  111. var sendData = {
  112. pageNum:'1',
  113. pageSize:'100',
  114. accountName:'',
  115. bankAccountNumber:'',
  116. status:'N',
  117. method:'GET',
  118. accountType:102
  119. }
  120. var sendData2 = {
  121. pageNum:'1',
  122. pageSize:'100',
  123. accountName:'',
  124. bankAccountNumber:'',
  125. status:'N',
  126. method:'GET',
  127. accountType:101
  128. }
  129. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  130. success: (res) => {
  131. this.setData({
  132. bankTypeOptions:res.data
  133. });
  134. }
  135. })
  136. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  137. success: (res) => {
  138. if (res.code == API.SUCCESS_CODE) {
  139. this.setData({bookName:res.user.bookName})
  140. }
  141. }
  142. })
  143. UTIL.httpRequest(API.URL_GET_APPROVALITEMSLIST, {method:'GET',dataType:'1'}, {
  144. success: (res) => {
  145. if (res.code == API.SUCCESS_CODE) {
  146. that.setData({
  147. approvalItemsOptions : res.rows
  148. })
  149. }
  150. }
  151. })
  152. setTimeout(function(){
  153. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData,{
  154. success: (res) => {
  155. for (let i = 0; i < res.rows.length; i++) {
  156. if(res.rows[i].bankAccountNumber==null){continue;}
  157. res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 ");
  158. res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  159. return $1 + ","; }).replace(/\.$/, "");
  160. res.rows[i].bankTypeText = UTIL.getTransform(res.rows[i].bankType,that.data.bankTypeOptions);
  161. }
  162. console.log(res.rows)
  163. that.setData({
  164. accountList:res.rows
  165. })
  166. wx.hideLoading();
  167. }
  168. })
  169. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData2,{
  170. success: (res) => {
  171. for (let i = 0; i < res.rows.length; i++) {
  172. res.rows[i].balance = Number(res.rows[i].balance).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  173. return $1 + ","; }).replace(/\.$/, "");
  174. }
  175. console.log(res.rows)
  176. that.setData({
  177. accountListXJ:res.rows
  178. })
  179. }
  180. })
  181. },1000)
  182. },
  183. delete(e){
  184. console.log(e);
  185. var that = this;
  186. UTIL.httpRequest(API.URL_GET_REMOVEAPPROVAL + e.currentTarget.dataset.id, {method:'GET'},{
  187. success: (res) => {
  188. if (res.code == API.SUCCESS_CODE) {
  189. that.data.approvalItemsOptions.splice(e.currentTarget.dataset.index, 1);
  190. wx.showToast({
  191. title: '删除成功!',
  192. icon: 'success',
  193. duration: 2000
  194. })
  195. that.setData({
  196. approvalItemsOptions : that.data.approvalItemsOptions
  197. })
  198. }
  199. }
  200. })
  201. },
  202. getMr(e){
  203. var that = this;
  204. UTIL.httpRequest(API.URL_GET_GETSETDEFAULTVALUES + e.currentTarget.dataset.id, {method:'GET'},{
  205. success: (res) => {
  206. if (res.code == API.SUCCESS_CODE) {
  207. UTIL.httpRequest(API.URL_GET_APPROVALITEMSLIST, {method:'GET',dataType:'1'}, {
  208. success: (res) => {
  209. if (res.code == API.SUCCESS_CODE) {
  210. wx.showToast({
  211. title: '设置成功!',
  212. icon: 'success',
  213. duration: 2000
  214. })
  215. that.setData({
  216. approvalItemsOptions : res.rows
  217. })
  218. }
  219. }
  220. })
  221. }
  222. }
  223. })
  224. },
  225. showDialog(e){
  226. var that = this ;
  227. that.setData({showDialog:true,projectId:e.currentTarget.dataset.id})
  228. },
  229. //支付口令修改
  230. edit(e){
  231. var that = this ;
  232. var zz = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{6,}$/;
  233. if(!(zz.test(that.data.password))){
  234. wx.showToast({
  235. title: '请根据提示修改',
  236. icon: 'error',
  237. duration: 2000,
  238. })
  239. return;
  240. }
  241. let data = {
  242. id: that.data.projectId ,
  243. accountPassword: that.data.password,
  244. method:'POST'
  245. }
  246. UTIL.httpRequest(API.URL_GET_PASSWORDEDIT, data,{
  247. success: (res) => {
  248. if (res.code == API.SUCCESS_CODE) {
  249. wx.showToast({
  250. title: '设置成功!',
  251. icon: 'success',
  252. duration: 2000
  253. })
  254. that.setData({
  255. showDialog : false,
  256. id: '' ,
  257. accountPassword: '',
  258. })
  259. }else if(res.code == "403"){
  260. wx.showToast({
  261. title: "无修改权限",
  262. icon: 'error',
  263. duration: 2000
  264. })
  265. }else{
  266. wx.showToast({
  267. title: "系统错误",
  268. icon: 'error',
  269. duration: 2000
  270. })
  271. }
  272. }
  273. })
  274. },
  275. bindNameInput(e){
  276. var that = this ;
  277. console.log(e);
  278. that.setData({password:e.detail.value});
  279. },
  280. /**
  281. * 生命周期函数--监听页面隐藏
  282. */
  283. onHide: function () {
  284. },
  285. /**
  286. * 生命周期函数--监听页面卸载
  287. */
  288. onUnload: function () {
  289. },
  290. /**
  291. * 页面相关事件处理函数--监听用户下拉动作
  292. */
  293. onPullDownRefresh: function () {
  294. },
  295. /**
  296. * 页面上拉触底事件的处理函数
  297. */
  298. onReachBottom: function () {
  299. },
  300. navigate(even){
  301. wx.navigateTo({
  302. url: even.currentTarget.dataset.url,
  303. })
  304. },
  305. /**
  306. * 用户点击右上角分享
  307. */
  308. onShareAppMessage: function () {
  309. }
  310. })