微信小程序
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
3 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. var sendData = {
  108. pageNum:'1',
  109. pageSize:'100',
  110. accountName:'',
  111. bankAccountNumber:'',
  112. status:'N',
  113. method:'GET',
  114. accountType:102
  115. }
  116. var sendData2 = {
  117. pageNum:'1',
  118. pageSize:'100',
  119. accountName:'',
  120. bankAccountNumber:'',
  121. status:'N',
  122. method:'GET',
  123. accountType:101
  124. }
  125. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  126. success: (res) => {
  127. this.setData({
  128. bankTypeOptions:res.data
  129. });
  130. }
  131. })
  132. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  133. success: (res) => {
  134. if (res.code == API.SUCCESS_CODE) {
  135. this.setData({bookName:res.user.bookName})
  136. }
  137. }
  138. })
  139. UTIL.httpRequest(API.URL_GET_APPROVALITEMSLIST, {method:'GET',dataType:'1'}, {
  140. success: (res) => {
  141. if (res.code == API.SUCCESS_CODE) {
  142. that.setData({
  143. approvalItemsOptions : res.rows
  144. })
  145. }
  146. }
  147. })
  148. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData,{
  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. res.rows[i].balance = parseFloat(res.rows[i].balance).toFixed(2);
  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. }
  161. })
  162. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData2,{
  163. success: (res) => {
  164. for (let i = 0; i < res.rows.length; i++) {
  165. if(res.rows[i].bankAccountNumber==null){continue;}
  166. res.rows[i].bankAccountNumber = res.rows[i].bankAccountNumber.replace(/(\d{4})(?=\d)/g, "$1 ")
  167. }
  168. console.log(res.rows)
  169. that.setData({
  170. accountListXJ:res.rows
  171. })
  172. }
  173. })
  174. },
  175. delete(e){
  176. console.log(e);
  177. var that = this;
  178. UTIL.httpRequest(API.URL_GET_REMOVEAPPROVAL + e.currentTarget.dataset.id, {method:'GET'},{
  179. success: (res) => {
  180. if (res.code == API.SUCCESS_CODE) {
  181. that.data.approvalItemsOptions.splice(e.currentTarget.dataset.index, 1);
  182. wx.showToast({
  183. title: '删除成功!',
  184. icon: 'success',
  185. duration: 2000
  186. })
  187. that.setData({
  188. approvalItemsOptions : that.data.approvalItemsOptions
  189. })
  190. }
  191. }
  192. })
  193. },
  194. getMr(e){
  195. var that = this;
  196. UTIL.httpRequest(API.URL_GET_GETSETDEFAULTVALUES + e.currentTarget.dataset.id, {method:'GET'},{
  197. success: (res) => {
  198. if (res.code == API.SUCCESS_CODE) {
  199. UTIL.httpRequest(API.URL_GET_APPROVALITEMSLIST, {method:'GET',dataType:'1'}, {
  200. success: (res) => {
  201. if (res.code == API.SUCCESS_CODE) {
  202. wx.showToast({
  203. title: '设置成功!',
  204. icon: 'success',
  205. duration: 2000
  206. })
  207. that.setData({
  208. approvalItemsOptions : res.rows
  209. })
  210. }
  211. }
  212. })
  213. }
  214. }
  215. })
  216. },
  217. showDialog(e){
  218. var that = this ;
  219. that.setData({showDialog:true,projectId:e.currentTarget.dataset.id})
  220. },
  221. //支付口令修改
  222. edit(e){
  223. var that = this ;
  224. var zz = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{6,}$/;
  225. if(!(zz.test(that.data.password))){
  226. wx.showToast({
  227. title: '请根据提示修改',
  228. icon: 'error',
  229. duration: 2000,
  230. })
  231. return;
  232. }
  233. let data = {
  234. id: that.data.projectId ,
  235. accountPassword: that.data.password,
  236. method:'POST'
  237. }
  238. UTIL.httpRequest(API.URL_GET_PASSWORDEDIT, data,{
  239. success: (res) => {
  240. if (res.code == API.SUCCESS_CODE) {
  241. wx.showToast({
  242. title: '设置成功!',
  243. icon: 'success',
  244. duration: 2000
  245. })
  246. that.setData({
  247. showDialog : false,
  248. id: '' ,
  249. accountPassword: '',
  250. })
  251. }else if(res.code == "403"){
  252. wx.showToast({
  253. title: "无修改权限",
  254. icon: 'error',
  255. duration: 2000
  256. })
  257. }else{
  258. wx.showToast({
  259. title: "系统错误",
  260. icon: 'error',
  261. duration: 2000
  262. })
  263. }
  264. }
  265. })
  266. },
  267. bindNameInput(e){
  268. var that = this ;
  269. console.log(e);
  270. that.setData({password:e.detail.value});
  271. },
  272. /**
  273. * 生命周期函数--监听页面隐藏
  274. */
  275. onHide: function () {
  276. },
  277. /**
  278. * 生命周期函数--监听页面卸载
  279. */
  280. onUnload: function () {
  281. },
  282. /**
  283. * 页面相关事件处理函数--监听用户下拉动作
  284. */
  285. onPullDownRefresh: function () {
  286. },
  287. /**
  288. * 页面上拉触底事件的处理函数
  289. */
  290. onReachBottom: function () {
  291. },
  292. navigate(even){
  293. wx.navigateTo({
  294. url: even.currentTarget.dataset.url,
  295. })
  296. },
  297. /**
  298. * 用户点击右上角分享
  299. */
  300. onShareAppMessage: function () {
  301. }
  302. })