detail.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. loading: true,
  4. data: {
  5. tabsActive: 2,
  6. sa_invoiceapplyid: "",
  7. tabsList: [{
  8. label: "详细信息",
  9. icon: "icon-tabchanpin"
  10. }, {
  11. label: "开票单位",
  12. icon: "icon-tabchanpin"
  13. }, {
  14. label: "开票明细",
  15. icon: "icon-tabchanpin",
  16. model: "#DetailLine"
  17. }, {
  18. label: "发票",
  19. icon: "icon-tabchanpin",
  20. model: "#InvoiceList"
  21. }]
  22. },
  23. onLoad(options) {
  24. this.setData({
  25. sa_invoiceapplyid: options.id
  26. });
  27. this.getDetail();
  28. },
  29. getDetail() {
  30. _Http.basic({
  31. "id": "20221216143003",
  32. "version": 1,
  33. "content": {
  34. "sa_invoiceapplyid": this.data.sa_invoiceapplyid
  35. }
  36. }).then(res => {
  37. console.log("开票单详情", res)
  38. if (res.msg != '成功') return wx.showToast({
  39. title: res.msg,
  40. icon: "none"
  41. })
  42. this.setData({
  43. detail: res.data,
  44. loading: false
  45. });
  46. this.setPreview();
  47. this.partialRenewal();
  48. })
  49. },
  50. /* 设置显示信息 */
  51. setPreview() {
  52. let item = this.data.detail;
  53. let list1 = [{
  54. label: "申请单号",
  55. value: item.billno
  56. }, {
  57. label: "发票限额",
  58. value: item.quota
  59. }, {
  60. label: "是否手工单",
  61. value: item.byhand ? '是' : '否'
  62. }, {
  63. label: "发票种类",
  64. value: item.invoiceline
  65. }, {
  66. label: "发票收款人",
  67. value: item.invoicepayee
  68. }, {
  69. label: "开票员",
  70. value: item.invoiceclerk
  71. }, {
  72. label: "发票复核人",
  73. value: item.invoicechecker
  74. }, {
  75. label: "提交人",
  76. value: item.submitby
  77. }, {
  78. label: "提交日期",
  79. value: item.submitdate
  80. }, {
  81. label: "备注",
  82. value: item.remarks
  83. }];
  84. let list2 = [{
  85. label: "状态",
  86. value: item.status
  87. }, {
  88. label: "创建人",
  89. value: item.createby
  90. }, {
  91. label: "创建时间",
  92. value: item.createdate
  93. }, {
  94. label: "审核人",
  95. value: item.checkby
  96. }, {
  97. label: "审核时间",
  98. value: item.checkdate
  99. }, {
  100. label: "修改人",
  101. value: item.changeby
  102. }, {
  103. label: "修改时间",
  104. value: item.changedate
  105. }, ];
  106. let riseLine = [{
  107. label: "抬头",
  108. value: item.enterprisename
  109. }, {
  110. label: "税号",
  111. value: item.taxno
  112. }, {
  113. label: "开户行",
  114. value: item.bank
  115. }, {
  116. label: "开户账号",
  117. value: item.bankcardno
  118. }, {
  119. label: "开票地址",
  120. value: item.address
  121. }, {
  122. label: "联系方式",
  123. value: item.phonenumber
  124. }];
  125. this.setData({
  126. list1,
  127. list2,
  128. riseLine
  129. })
  130. },
  131. //tabs 切换
  132. tabsChange({
  133. detail
  134. }) {
  135. this.setData({
  136. tabsActive: detail
  137. });
  138. this.partialRenewal();
  139. },
  140. //局部数据更新 tabs
  141. partialRenewal(init = false) {
  142. let model = this.data.tabsList[this.data.tabsActive].model;
  143. if (model) {
  144. let Component = this.selectComponent(model),
  145. {
  146. total,
  147. pageNumber,
  148. pageTotal
  149. } = Component.data.content,
  150. id = this.data.sa_invoiceapplyid;
  151. if (total == null || init) {
  152. Component.getList(id, init);
  153. } else if (pageNumber < pageTotal) {
  154. Component.getList(id, false);
  155. }
  156. }
  157. },
  158. submit() {
  159. if (this.selectComponent("#DetailLine").data.list.length == 0) {
  160. wx.showToast({
  161. title: '还未添加开票订单行不可提交!',
  162. icon: "none"
  163. });
  164. this.setData({
  165. tabsActive: 2
  166. })
  167. } else {
  168. let that = this;
  169. wx.showModal({
  170. title: '提示',
  171. content: '是否确认提交该申请单?',
  172. complete: ({
  173. confirm
  174. }) => {
  175. if (confirm) _Http.basic({
  176. "id": "20221219133803",
  177. "version": 1,
  178. "content": {
  179. "sa_invoiceapplyid": that.data.sa_invoiceapplyid
  180. }
  181. }).then(res => {
  182. console.log("提交申请单", res);
  183. if (res.msg != '成功') return wx.showToast({
  184. title: res.msg,
  185. icon: "none"
  186. });
  187. that.getDetail();
  188. })
  189. }
  190. })
  191. }
  192. },
  193. onReachBottom() {
  194. this.partialRenewal();
  195. },
  196. onUnload() {
  197. let page = getCurrentPages().find(v => v.__route__ == 'packageA/invoice/index');
  198. let content = JSON.parse(JSON.stringify(page.data.content));
  199. content.pageNumber = 1;
  200. content.pageSize = page.data.list.length;
  201. _Http.basic({
  202. "id": 20221219133703,
  203. "version": 1,
  204. content
  205. }).then(res => {
  206. console.log("开票列表", res)
  207. page.setData({
  208. list: res.data
  209. })
  210. })
  211. },
  212. })