微信小程序
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
2 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
2 anos atrás
3 anos atrás
3 anos atrás
2 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. // pages/payee/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. list: {},
  12. result: "",
  13. bankTypeOptions:[],
  14. pageNum:1,
  15. scrollHeight:'',
  16. searchName:''
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad(options) {
  22. console.log(options)
  23. // 可优化:数据请求放到 onload中 新增后在子页面修改父页面数据
  24. var that = this;
  25. that.setData({
  26. index:options.index,
  27. scrollHeight:wx.getSystemInfoSync().windowHeight
  28. })
  29. var that = this;
  30. // 获取收款账号列表
  31. let prames = {
  32. pageNum:1,
  33. pageSize:10,
  34. orderByColumn:'id',
  35. isAsc:'desc',
  36. status:'0',
  37. method:'GET'
  38. }
  39. console.log(prames);
  40. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type_all', {method:'GET'}, {
  41. success: (res2) => {
  42. that.setData({
  43. bankTypeOptions:res2.data,
  44. })
  45. UTIL.httpRequest(API.URL_GET_SELECTLIST , prames, {
  46. success: (res) => {
  47. let array = res.rows ;
  48. var list = [];
  49. res.rows.map(res3=>{
  50. // .replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2")
  51. res3.payeeAccountText = res3.payeeAccount;
  52. res3.bankTypeText = UTIL.getTransform(res3.bankType,that.data.bankTypeOptions);
  53. list.push(res3)
  54. })
  55. console.log(list);
  56. that.setData({
  57. list:list,
  58. })
  59. }
  60. })
  61. }
  62. })
  63. },
  64. goAdd(){
  65. wx.navigateTo({
  66. url: '../add/add',
  67. })
  68. },
  69. goSearch(e){
  70. var that = this;
  71. that.setData({
  72. searchName:e.detail,
  73. })
  74. // 获取收款账号列表
  75. let prames = {
  76. pageNum:1,
  77. pageSize:10,
  78. orderByColumn:'id',
  79. isAsc:'asc',
  80. // isPeers:that.data.isPeers,//是否同行
  81. // bankType:that.data.bankType,//所属银行
  82. // accountType:that.data.accountType,//账户类型
  83. // payeeType:that.data.payeeType,//申请转帐类型
  84. status:'0',
  85. name:e.detail,
  86. method:'GET'
  87. }
  88. console.log(prames);
  89. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  90. success: (res) => {
  91. that.setData({
  92. bankTypeOptions:res.data,
  93. })
  94. }
  95. })
  96. UTIL.httpRequest(API.URL_GET_PAYEESELECTLIST , prames, {
  97. success: (res) => {
  98. let array = res.rows ;
  99. var payeeType = that.data.payeeType;
  100. var list = [];
  101. array.map(res=>{
  102. // .replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2")
  103. res.payeeAccountText = res.payeeAccount;
  104. res.bankTypeText = (that.data.bankTypeOptions.filter(function (e) { return e.dictValue == res.bankType; }))[0].dictLabel;
  105. list.push(res)
  106. })
  107. that.setData({
  108. list:list,
  109. })
  110. }
  111. })
  112. },
  113. paging(){
  114. console.log('aaa')
  115. var that = this;
  116. that.setData({
  117. pageNum:that.data.pageNum+1,
  118. })
  119. // 获取收款账号列表
  120. let prames = {
  121. pageNum:that.data.pageNum,
  122. pageSize:10,
  123. orderByColumn:'id',
  124. isAsc:'desc',
  125. status:'0',
  126. method:'GET',
  127. name:that.data.searchName,
  128. }
  129. UTIL.httpRequest(API.URL_GET_SELECTLIST , prames, {
  130. success: (res) => {
  131. let array = res.rows ;
  132. var payeeType = that.data.payeeType;
  133. var list = that.data.list;
  134. var pagecount = res.total/10
  135. if(that.data.pageNum>pagecount){
  136. return;
  137. }
  138. array.map(res=>{
  139. // .replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2")
  140. res.payeeAccountText = res.payeeAccount;
  141. console.log(that.data.bankTypeOptions);
  142. res.bankTypeText = (that.data.bankTypeOptions.filter(function (e) { return e.dictValue == res.bankType; }))[0].dictLabel;
  143. console.log(res);
  144. list.push(res)
  145. })
  146. that.setData({
  147. list:list,
  148. })
  149. }
  150. })
  151. },
  152. /**
  153. * 生命周期函数--监听页面初次渲染完成
  154. */
  155. onReady() {
  156. },
  157. delete(e){
  158. var that = this;
  159. wx.showModal({
  160. title: '提示',
  161. content: '确认删除?',
  162. success (res) {
  163. if (res.confirm) {
  164. UTIL.httpRequest(API.URL_GET_PAYEEREMOVE + e.currentTarget.dataset.id, {method:'GET'},{
  165. success: (res) => {
  166. if (res.code == API.SUCCESS_CODE) {
  167. that.data.list.splice(e.currentTarget.dataset.index, 1);
  168. wx.showToast({
  169. title: '删除成功!',
  170. icon: 'success',
  171. duration: 2000
  172. })
  173. that.setData({
  174. list : that.data.list,
  175. })
  176. }
  177. }
  178. })
  179. } else if (res.cancel) {
  180. console.log('用户点击取消')
  181. }
  182. }
  183. })
  184. },
  185. goEdit(e){
  186. wx.navigateTo({
  187. url: '/pages/payee/add/add?id='+e.currentTarget.dataset.id,
  188. })
  189. },
  190. /**
  191. * 生命周期函数--监听页面显示
  192. */
  193. onShow() {
  194. },
  195. onChange(event) {
  196. this.setData({
  197. result: event.detail,
  198. });
  199. },
  200. toggle(event) {
  201. const { index } = event.currentTarget.dataset;
  202. const checkbox = this.selectComponent(`.checkboxes-${index}`);
  203. checkbox.toggle();
  204. },
  205. back:function(){
  206. wx.navigateBack({
  207. delta: 1
  208. })
  209. },
  210. noop() {},
  211. goSubmit(){
  212. var that = this;
  213. if(that.data.result == ''){
  214. UTIL.showToastNoneIcon('请选择一个收款人!');
  215. return;
  216. }
  217. let array = that.data.list.filter(function (e) { return e.id == that.data.result; });
  218. array[0].incomeAmount = that.data.money;
  219. let pages = getCurrentPages();
  220. let currentPage = null; //当前页面
  221. let prevPage = null; //上一个页面
  222. currentPage = pages[pages.length - 1]; //获取当前页面,将其赋值
  223. prevPage = pages[pages.length - 2]; //获取上一个页面,将其赋值
  224. if (prevPage) {
  225. prevPage.setData({
  226. ["form.transfers["+that.data.index+"].payeeList[0]"]: array[0]//将想要传的信息赋值给上一个页面data中的值
  227. })
  228. that.back()
  229. }
  230. },
  231. /**
  232. * 生命周期函数--监听页面隐藏
  233. */
  234. onHide() {
  235. },
  236. /**
  237. * 生命周期函数--监听页面卸载
  238. */
  239. onUnload() {
  240. },
  241. /**
  242. * 页面相关事件处理函数--监听用户下拉动作
  243. */
  244. onPullDownRefresh() {
  245. },
  246. /**
  247. * 页面上拉触底事件的处理函数
  248. */
  249. onReachBottom() {
  250. },
  251. /**
  252. * 用户点击右上角分享
  253. */
  254. onShareAppMessage() {
  255. }
  256. })