微信小程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 2 roky
před 3 roky
před 2 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
před 3 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. // pages/payee/add/add.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. form:{
  12. payee:'',
  13. payeeAccount:'',
  14. bankType:'',
  15. bankDeposit:'',
  16. accountType:'2',
  17. payeeType:'1',
  18. payeeTypeText:'收款方',
  19. payeePaymentLines:'',
  20. status:'0',
  21. },
  22. showBankType:false,
  23. showAccountType:false,
  24. bankTypeOptions:[],
  25. bankTypeText:'',
  26. accountTypeOptions:[],
  27. payeeTypeOptions:[],
  28. accountTypeText:'',
  29. },
  30. /**
  31. * 生命周期函数--监听页面加载
  32. */
  33. onLoad(options) {
  34. var that = this ;
  35. that.setData({
  36. projectId:options.id
  37. })
  38. var that = this;
  39. // 所属银行字典查询
  40. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type_all', {method:'GET'}, {
  41. success: (res) => {
  42. // let array = res.data.filter(function (e) { return e.dictValue == event.detail.value.bankType; });
  43. this.setData({
  44. bankTypeOptions:res.data
  45. });
  46. }
  47. })
  48. // 付款方式类型字典查询
  49. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'account_type', {method:'GET'}, {
  50. success: (res) => {
  51. that.setData({
  52. accountTypeOptions:res.data,
  53. })
  54. }
  55. })
  56. // 付款方式类型字典查询
  57. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'payee_type', {method:'GET'}, {
  58. success: (res) => {
  59. that.setData({
  60. payeeTypeOptions:res.data,
  61. })
  62. }
  63. })
  64. if(options.id){
  65. UTIL.httpRequest(API.URL_GET_PAYEEGET + options.id, {method:'GET'}, {
  66. success: (res) => {
  67. UTIL.httpRequest(API.URL_GET_DEPOSITLIST, {method:'GET',bankType:res.data.bankType,status:'0'}, {
  68. success: (res2) => {
  69. that.setData({
  70. depositOptions:res2.rows,
  71. })
  72. console.log(res.data.bankType)
  73. console.log(res2.rows)
  74. res.data.payeeTypeText = UTIL.getTransform(res.data.payeeType,that.data.payeeTypeOptions);
  75. res.data.bankTypeText = UTIL.getTransform(res.data.bankType,that.data.bankTypeOptions);
  76. that.setData({
  77. form:res.data,
  78. })
  79. }
  80. })
  81. }
  82. })
  83. }
  84. },
  85. /**
  86. * 生命周期函数--监听页面初次渲染完成
  87. */
  88. onReady() {
  89. },
  90. bindKeyInput(e){
  91. console.log(e.detail);
  92. var that = this;
  93. var str = e.detail.value;
  94. var numArr = str.match(/\d+/g)
  95. var nameArr = str.match(/[\u4e00-\u9fa5]/g).join("")
  96. if (numArr) {
  97. numArr.map(rr=>{
  98. if (rr.length>16) {
  99. console.log(rr);
  100. console.log(UTIL.isBankCard(rr));
  101. const carId = UTIL.isBankCard(rr);
  102. if (carId) {
  103. that.setData({
  104. ["form.payee"]:nameArr,
  105. ["form.payeeAccount"]:rr
  106. })
  107. }
  108. }
  109. })
  110. }
  111. },
  112. /**
  113. * 生命周期函数--监听页面显示
  114. */
  115. onShow() {
  116. //6217002190007972186庞东旭,,,,, 山东省威海市文登区XXXXXX
  117. },
  118. back:function(){
  119. wx.navigateBack({
  120. delta: 1
  121. })
  122. },
  123. openBox(even){
  124. console.log(even);
  125. var that = this ;
  126. if(even.currentTarget.dataset.name == "showDeposit"){
  127. if(that.data.form.bankType == ''){
  128. UTIL.showToastNoneIcon('请先选择所属银行!');
  129. that.setData({
  130. [even.currentTarget.dataset.name]:false,
  131. })
  132. return;
  133. }
  134. }
  135. this.setData({
  136. [even.currentTarget.dataset.name]:true
  137. })
  138. },
  139. onConfirm(even){
  140. console.log(even);
  141. var that = this ;
  142. if(even.currentTarget.dataset.name == "showBankType"){
  143. this.setData({
  144. ['form.bankDeposit']:'',
  145. ["form.payeePaymentLines"]:'',
  146. })
  147. }
  148. this.setData({
  149. [even.currentTarget.dataset.value]:even.detail.value.dictValue,
  150. [even.currentTarget.dataset.value+"Text"]:even.detail.value.dictLabel,
  151. [even.currentTarget.dataset.name]:false,
  152. })
  153. },
  154. onConfirmDeposit(even){
  155. console.log(even);
  156. this.setData({
  157. [even.currentTarget.dataset.value]:even.detail.value.bankDeposit,
  158. [even.currentTarget.dataset.value+"Text"]:even.detail.value.bankDeposit,
  159. [even.currentTarget.dataset.name]:false,
  160. ["form.payeePaymentLines"]:even.detail.value.payeePaymentLines
  161. })
  162. },
  163. closeBox(even){
  164. console.log(even.currentTarget.dataset.name);
  165. this.setData({
  166. [even.currentTarget.dataset.name]:false
  167. })
  168. },
  169. goSubmit(){
  170. console.log(this.data.form);
  171. var that = this;
  172. wx.showLoading({
  173. title: '正在保存',
  174. mask:true
  175. })
  176. if(that.data.form.payee == ''){
  177. wx.hideLoading();
  178. UTIL.showToastNoneIcon('请填写收款方!');
  179. return;
  180. }
  181. if(that.data.form.payeeAccount == ''){
  182. wx.hideLoading();
  183. UTIL.showToastNoneIcon('请填写收款账号!');
  184. return;
  185. }
  186. if(that.data.form.payeeType == ''){
  187. wx.hideLoading();
  188. UTIL.showToastNoneIcon('请选择收款人类型!');
  189. return;
  190. }
  191. if(that.data.form.accountType == ''){
  192. wx.hideLoading();
  193. UTIL.showToastNoneIcon('请选择账户类型!');
  194. return;
  195. }
  196. if(that.data.form.bankType == ''){
  197. wx.hideLoading();
  198. UTIL.showToastNoneIcon('请选择所属银行!');
  199. return;
  200. }
  201. if(that.data.form.bankDeposit == ''){
  202. wx.hideLoading();
  203. UTIL.showToastNoneIcon('请选择开户行!');
  204. return;
  205. }
  206. if(that.data.form.payeePaymentLines == ''){
  207. wx.hideLoading();
  208. UTIL.showToastNoneIcon('请输入联行号!');
  209. return;
  210. }
  211. that.setData({
  212. ['form.method']:'POST'
  213. })
  214. let url = '';
  215. if(this.data.projectId){
  216. url = API.URL_GET_PAYEEEDIT;
  217. console.log("修改");
  218. }else{
  219. url = API.URL_GET_PAYEEADD;
  220. console.log("新增");
  221. }
  222. UTIL.httpRequest(url, that.data.form, {
  223. success: (res) => {
  224. if (res.code == API.SUCCESS_CODE) {
  225. wx.showToast({
  226. title: "提交成功!",
  227. duration: 2000,
  228. icon:"success",
  229. mask:true
  230. })
  231. let pages = getCurrentPages();
  232. let currentPage = null; //当前页面
  233. let prevPage = null; //上一个页面
  234. currentPage = pages[pages.length - 1]; //获取当前页面,将其赋值
  235. prevPage = pages[pages.length - 2]; //获取上一个页面,将其赋值
  236. prevPage.onLoad(prevPage.options)
  237. setTimeout(function(){
  238. wx.navigateBack({
  239. delta:1
  240. })
  241. wx.hideLoading();
  242. },2000)
  243. }else{
  244. wx.hideLoading();
  245. wx.showToast({
  246. title: "提交失败!",
  247. duration: 2000,
  248. icon:"error"
  249. })
  250. }
  251. }
  252. })
  253. },
  254. onChange(even){
  255. console.log(even);
  256. this.setData({
  257. [even.currentTarget.dataset.formname]:even.detail
  258. })
  259. },
  260. goBank(){
  261. var that = this ;
  262. if (that.data.form.bankType == '') {
  263. UTIL.showToastNoneIcon('请先选择所属银行!');
  264. return;
  265. }
  266. wx.navigateTo({
  267. url: '/pages/bank/bankList?banktype='+that.data.form.bankType,
  268. })
  269. },
  270. /**
  271. * 生命周期函数--监听页面隐藏
  272. */
  273. onHide() {
  274. },
  275. /**
  276. * 生命周期函数--监听页面卸载
  277. */
  278. onUnload() {
  279. },
  280. /**
  281. * 页面相关事件处理函数--监听用户下拉动作
  282. */
  283. onPullDownRefresh() {
  284. },
  285. /**
  286. * 页面上拉触底事件的处理函数
  287. */
  288. onReachBottom() {
  289. },
  290. /**
  291. * 用户点击右上角分享
  292. */
  293. onShareAppMessage() {
  294. }
  295. })