微信小程序
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.

преди 2 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. // pages/transaction/transactionDetail/transactionDetail.js
  2. import * as UTIL from '../../../utils/util.js';
  3. import * as API from '../../../utils/API.js';
  4. let EVN_CONFIG = require('../../../env/env');
  5. const app = getApp();
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. isIPX: app.globalData.isIPX,
  12. bankTypeOptions:[],
  13. form:{}
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad(options) {
  19. var that = this;
  20. var array = JSON.parse(options.options);
  21. console.log(array);
  22. UTIL.showLoadingHaveMask();
  23. // 所属银行 字典查询
  24. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  25. success: (res) => {
  26. that.setData({
  27. bankTypeOptions:res.data,
  28. })
  29. }
  30. })
  31. // 账户分类 字典查询
  32. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'town_account_type', {method:'GET'}, {
  33. success: (res) => {
  34. that.setData({
  35. townAccountTypeOptions:res.data,
  36. })
  37. }
  38. })
  39. // 管控类型 字典查询
  40. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'cashier_account_management_control_type', {method:'GET'}, {
  41. success: (res) => {
  42. that.setData({
  43. managementControlTypeOptions:res.data,
  44. })
  45. array.managementControlTypeText = UTIL.getTransform(array.managementControlType,res.data);
  46. }
  47. })
  48. //开户行查询
  49. UTIL.httpRequest(API.URL_GET_DEPOSITLIST, {method:'GET',bankType:array.bankType,status:array.status}, {
  50. success: (res2) => {
  51. that.setData({
  52. depositOptions:res2.rows,
  53. })
  54. }
  55. })
  56. if (array.townAccountType == 1 && array.managementControlType == 2) {
  57. //中心账套查询
  58. UTIL.httpRequest(API.URL_GET_GETTACCOUNTCENTRAL, {method:'GET'}, {
  59. success: (res2) => {
  60. array.centralBookIdText = res2.data.filter(function (e) { return e.id == array.centralBookId; })[0].bookName;
  61. that.setData({
  62. centralBookIdOptions:res2.data,
  63. })
  64. }
  65. })
  66. }
  67. if (array.managementControlType == 2) {
  68. //会计科目查询
  69. UTIL.httpRequest(API.URL_GET_GETACCOUNTCENTRAL, {method:'GET',bookId:array.centralBookId}, {
  70. success: (res2) => {
  71. array.centralSubjectIdText = res2.data.filter(function (e) { return e.subjectId == array.centralSubjectId; })[0].subjectName;
  72. that.setData({
  73. centralSubjectIdOptions:res2.data,
  74. })
  75. }
  76. })
  77. }
  78. setTimeout(function(){
  79. that.setData({
  80. form:array
  81. })
  82. wx.hideLoading();
  83. },3000)
  84. },
  85. /**
  86. * 显示弹窗
  87. */
  88. showPopup(e){
  89. var that = this ;
  90. that.setData({
  91. [e.currentTarget.dataset.name]:true
  92. })
  93. },
  94. /**
  95. * 隐藏弹窗
  96. */
  97. closePopup(e){
  98. var that = this ;
  99. that.setData({
  100. [e.currentTarget.dataset.name]:false
  101. })
  102. },
  103. /**
  104. * 弹窗选择
  105. */
  106. onConfirm(e){
  107. console.log(e);
  108. var that = this ;
  109. that.setData({
  110. [e.currentTarget.dataset.formname]:e.detail.value.dictValue,
  111. [e.currentTarget.dataset.formname+'Text']:e.detail.value.dictLabel,
  112. [e.currentTarget.dataset.name]:false
  113. })
  114. },
  115. onConfirmBank(e){
  116. console.log(e);
  117. var that = this ;
  118. that.setData({
  119. [e.currentTarget.dataset.formname]:e.detail.value.dictValue,
  120. [e.currentTarget.dataset.formname+'Text']:e.detail.value.dictLabel,
  121. [e.currentTarget.dataset.name]:false,
  122. ["form.bankDeposit"]:'',
  123. ["form.payeePaymentLines"]:'',
  124. })
  125. //开户行查询
  126. UTIL.httpRequest(API.URL_GET_DEPOSITLIST, {method:'GET',bankType:e.detail.value.dictValue,status:'0'}, {
  127. success: (res2) => {
  128. that.setData({
  129. depositOptions:res2.rows,
  130. })
  131. }
  132. })
  133. },
  134. onConfirmaDeposit(e){
  135. console.log(e);
  136. var that = this ;
  137. that.setData({
  138. [e.currentTarget.dataset.formname]:e.detail.value.bankDeposit,
  139. [e.currentTarget.dataset.name]:false,
  140. ["form.payeePaymentLines"]:e.detail.value.payeePaymentLines
  141. })
  142. },
  143. /**
  144. * 中心账套弹窗选择
  145. */
  146. onConfirmBook(e){
  147. console.log(e);
  148. var that = this ;
  149. that.setData({
  150. [e.currentTarget.dataset.formname]:e.detail.value.id,
  151. [e.currentTarget.dataset.formname+'Text']:e.detail.value.bookName,
  152. [e.currentTarget.dataset.name]:false
  153. })
  154. //会计科目查询
  155. UTIL.httpRequest(API.URL_GET_GETACCOUNTCENTRAL, {method:'GET',bookId:e.detail.value.id}, {
  156. success: (res2) => {
  157. that.setData({
  158. centralSubjectIdOptions:res2.data,
  159. })
  160. }
  161. })
  162. },
  163. /**
  164. * 会计科目弹窗选择
  165. */
  166. onConfirmSubjectId(e){
  167. console.log(e);
  168. var that = this ;
  169. that.setData({
  170. [e.currentTarget.dataset.formname]:e.detail.value.subjectId,
  171. [e.currentTarget.dataset.formname+'Text']:e.detail.value.subjectName,
  172. [e.currentTarget.dataset.name]:false
  173. })
  174. },
  175. /**
  176. * 输入框change
  177. */
  178. inputChange(e){
  179. var that = this ;
  180. that.setData({
  181. [e.currentTarget.dataset.formname]:e.detail
  182. })
  183. },
  184. /**
  185. * 提交修改
  186. */
  187. goSubmit(e){
  188. var that = this ;
  189. console.log(that.data.form);
  190. that.data.form.method = 'POST';
  191. //中心账套查询
  192. UTIL.httpRequest(API.URL_GET_GETTACCOUNTEDIT, that.data.form, {
  193. success: (res) => {
  194. console.log(res);
  195. if (res.code == API.SUCCESS_CODE) {
  196. wx.showToast({
  197. title: "修改成功!",
  198. duration: 2000,
  199. icon:"success",
  200. mask:true
  201. })
  202. setTimeout(function(){
  203. that.back()
  204. },2000)
  205. }
  206. }
  207. })
  208. },
  209. onChange(even){
  210. console.log(even);
  211. this.setData({
  212. [even.currentTarget.dataset.formname]:even.detail
  213. })
  214. },
  215. back:function(){
  216. wx.navigateBack({
  217. delta: 1
  218. })
  219. },
  220. /**
  221. * 生命周期函数--监听页面初次渲染完成
  222. */
  223. onReady() {
  224. },
  225. /**
  226. * 生命周期函数--监听页面显示
  227. */
  228. onShow() {
  229. },
  230. /**
  231. * 生命周期函数--监听页面隐藏
  232. */
  233. onHide() {
  234. },
  235. /**
  236. * 生命周期函数--监听页面卸载
  237. */
  238. onUnload() {
  239. },
  240. /**
  241. * 页面相关事件处理函数--监听用户下拉动作
  242. */
  243. onPullDownRefresh() {
  244. },
  245. /**
  246. * 页面上拉触底事件的处理函数
  247. */
  248. onReachBottom() {
  249. },
  250. /**
  251. * 用户点击右上角分享
  252. */
  253. onShareAppMessage() {
  254. }
  255. })