detail.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. // pages/ticketBuy/qrcode.js
  2. const utils = require('../../utils/util.js')
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. recordId: '',
  9. proList: [], //项目明细
  10. seller: '', //销方信息
  11. buyer: { //购方信息
  12. address: '',
  13. bankAccount: '',
  14. contactPhone: '',
  15. createBy: '',
  16. createTime: '',
  17. customerCode: '',
  18. customerId: '',
  19. customerMobile: '',
  20. customerName: '',
  21. email: '',
  22. entTaxId: '',
  23. lastUpdateBy: '',
  24. lastUpdateTime: '',
  25. manageUserId: '',
  26. parentCode: null,
  27. remark: null,
  28. shortCode: null
  29. },
  30. bankName: '', //开户行
  31. interactTypeDetail: '', //interactTypeDetail
  32. cardList: [{ //交付方式
  33. text: '邮箱',
  34. value: 1,
  35. selected: false
  36. },
  37. {
  38. text: '手机短信',
  39. value: 2,
  40. selected: false
  41. },
  42. {
  43. text: '微信卡包',
  44. value: 3,
  45. selected: true
  46. },
  47. {
  48. text: '支付宝发票管家',
  49. value: 3,
  50. selected: false
  51. },
  52. {
  53. text: '其他',
  54. value: 99,
  55. selected: false
  56. }
  57. ],
  58. },
  59. /**
  60. * 生命周期函数--监听页面加载
  61. */
  62. onLoad: function (options) {
  63. this.setData({
  64. recordId: options.recordId
  65. })
  66. this.getDetail()
  67. this.getItem()
  68. },
  69. //提交开票
  70. submitData() {
  71. let buyer = this.data.buyer
  72. let params = {
  73. recordId: this.data.recordId,
  74. customerEntTaxId: utils.trimAll(buyer.entTaxId),
  75. customerName: utils.trimAll(buyer.customerName),
  76. address: utils.trimAll(buyer.address),
  77. contactPhone: utils.trimAll(buyer.contactPhone),
  78. bankName: utils.trimAll(this.data.bankName),
  79. bankAccountNo: utils.trimAll(buyer.bankAccount),
  80. customerEmail: utils.trimAll(buyer.email),
  81. customerMobile: utils.trimAll(buyer.customerMobile),
  82. interactType: '',
  83. interactTypeDetail: utils.trimAll(this.data.interactTypeDetail)
  84. }
  85. if (params.customerName === '') {
  86. utils.toast('发票抬头不能为空')
  87. return
  88. }
  89. if (params.customerEntTaxId === '') {
  90. utils.toast('税号不能为空')
  91. return
  92. }
  93. if (params.customerEmail === '') {
  94. utils.toast('邮箱不能为空')
  95. return
  96. }
  97. if (params.customerMobile === '') {
  98. utils.toast('手机号码不能为空')
  99. return
  100. }
  101. if (params.interactTypeDetail === '') {
  102. utils.toast('接收方式不能为空')
  103. return
  104. }
  105. let cardList = this.data.cardList
  106. for (let i = 0; i < cardList.length; i++) {
  107. if (cardList[i].selected) {
  108. params.interactType = cardList[i].value
  109. }
  110. }
  111. utils.axios({
  112. method: 'post',
  113. url: '/sys/fapiao/todo/apply',
  114. data: params,
  115. sendBefore() {
  116. wx.showLoading({
  117. title: '提交申请中...',
  118. mask: true
  119. })
  120. },
  121. complete() {
  122. wx.hideLoading()
  123. },
  124. success: res => {
  125. utils.toast('开票申请提交成功')
  126. wx.redirectTo({
  127. url: '/pages/ticketWaiting/ticketWaiting'
  128. })
  129. }
  130. })
  131. },
  132. //开票基本信息
  133. getDetail() {
  134. let params = {
  135. recordId: this.data.recordId
  136. }
  137. utils.axios({
  138. method: 'get',
  139. url: '/sys/fapiao/todo/findBaseInfoById',
  140. data: params,
  141. sendBefore() {
  142. wx.showLoading({
  143. title: '加载中...',
  144. mask: true
  145. })
  146. },
  147. complete() {
  148. wx.hideLoading()
  149. },
  150. success: res => {
  151. this.setData({
  152. seller: res.data
  153. })
  154. }
  155. })
  156. },
  157. //获取项目明细
  158. getItem() {
  159. let params = {
  160. recordId: this.data.recordId
  161. }
  162. utils.axios({
  163. method: 'get',
  164. url: '/sys/fapiao/todo/findItemsById',
  165. data: params,
  166. sendBefore() {
  167. wx.showNavigationBarLoading()
  168. },
  169. complete() {
  170. wx.hideNavigationBarLoading()
  171. },
  172. success: res => {
  173. this.setData({
  174. proList: res.data
  175. })
  176. }
  177. })
  178. },
  179. //查询购方名字
  180. toSearch() {
  181. wx.navigateTo({
  182. url: '/pages/search/search'
  183. })
  184. },
  185. //选择接收方式
  186. selectType(e) {
  187. let index = Number(e.currentTarget.dataset.index)
  188. let cardList = this.data.cardList
  189. for (let i = 0; i < cardList.length; i++) {
  190. cardList[i].selected = false
  191. }
  192. cardList[index].selected = true
  193. this.setData({
  194. cardList
  195. })
  196. },
  197. //以下是获取表单信息的函数
  198. getcustomerName(e) {
  199. this.setData({
  200. ['buyer.customerName']: e.detail.value
  201. })
  202. },
  203. getentTaxId(e) {
  204. this.setData({
  205. ['buyer.entTaxId']: e.detail.value
  206. })
  207. },
  208. getemail(e) {
  209. this.setData({
  210. ['buyer.email']: e.detail.value
  211. })
  212. },
  213. getcustomerMobile(e) {
  214. this.setData({
  215. ['buyer.customerMobile']: e.detail.value
  216. })
  217. },
  218. getaddress(e) {
  219. this.setData({
  220. ['buyer.address']: e.detail.value
  221. })
  222. },
  223. getcontactPhone(e) {
  224. this.setData({
  225. ['buyer.contactPhone']: e.detail.value
  226. })
  227. },
  228. getbankName(e) {
  229. this.setData({
  230. bankName: e.detail.value
  231. })
  232. },
  233. getbankAccount(e) {
  234. this.setData({
  235. ['buyer.bankAccount']: e.detail.value
  236. })
  237. },
  238. getremark(e) {
  239. this.setData({
  240. remark: e.detail.value
  241. })
  242. },
  243. getinteractTypeDetail(e) {
  244. this.setData({
  245. interactTypeDetail: e.detail.value
  246. })
  247. },
  248. /**
  249. * 生命周期函数--监听页面初次渲染完成
  250. */
  251. onReady: function () {
  252. },
  253. /**
  254. * 生命周期函数--监听页面显示
  255. */
  256. onShow: function () {
  257. },
  258. /**
  259. * 生命周期函数--监听页面隐藏
  260. */
  261. onHide: function () {
  262. },
  263. /**
  264. * 生命周期函数--监听页面卸载
  265. */
  266. onUnload: function () {
  267. },
  268. /**
  269. * 页面相关事件处理函数--监听用户下拉动作
  270. */
  271. onPullDownRefresh: function () {
  272. },
  273. /**
  274. * 页面上拉触底事件的处理函数
  275. */
  276. onReachBottom: function () {
  277. },
  278. /**
  279. * 用户点击右上角分享
  280. */
  281. onShareAppMessage: function () {
  282. return {
  283. title: '诺信云',
  284. path: '/pages/index/index'
  285. }
  286. }
  287. })