123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- // pages/ticketScan/detail.js
- const utils = require('../../utils/util.js')
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- belongEntTaxId: '',
- buyer: { //购方信息
- address: '',
- bankAccount: '',
- contactPhone: '',
- createBy: '',
- createTime: '',
- customerCode: '',
- customerId: '',
- customerMobile: '',
- customerName: '',
- email: '',
- entTaxId: '',
- lastUpdateBy: '',
- lastUpdateTime: '',
- manageUserId: '',
- parentCode: null,
- remark: null,
- shortCode: null
- },
- bankName: '', //开户行
- remark: '', //备注
- interactTypeDetail: '', //interactTypeDetail
- cardList: [{ //交付方式
- text: '邮箱',
- value: 1,
- selected: false
- },
- {
- text: '手机短信',
- value: 2,
- selected: false
- },
- {
- text: '微信卡包',
- value: 3,
- selected: true
- },
- {
- text: '支付宝发票管家',
- value: 3,
- selected: false
- },
- {
- text: '其他',
- value: 99,
- selected: false
- }
- ],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- belongEntTaxId: options.belongEntTaxId
- })
- },
- //提交开票
- submitData() {
- let buyer = this.data.buyer
- let params = {
- belongEntTaxId: this.data.belongEntTaxId,
- customerName: utils.trimAll(buyer.customerName),
- customerEntTaxId: utils.trimAll(buyer.entTaxId),
- address: utils.trimAll(buyer.address),
- contactPhone: utils.trimAll(buyer.contactPhone),
- bankName: utils.trimAll(this.data.bankName),
- bankAccountNo: utils.trimAll(buyer.bankAccount),
- customerEmail: utils.trimAll(buyer.email),
- customerMobile: utils.trimAll(buyer.customerMobile),
- remark: utils.trimAll(this.data.remark),
- interactType: '',
- interactTypeDetail: utils.trimAll(this.data.interactTypeDetail)
- }
- if (params.customerName === '') {
- utils.toast('发票抬头不能为空')
- return
- }
- if (params.customerEntTaxId === '') {
- utils.toast('税号不能为空')
- return
- }
- if (params.customerEmail === '') {
- utils.toast('邮箱不能为空')
- return
- }
- if (params.customerMobile === '') {
- utils.toast('手机号码不能为空')
- return
- }
- if (params.interactTypeDetail === '') {
- utils.toast('接收方式不能为空')
- return
- }
- let cardList = this.data.cardList
- for (let i = 0; i < cardList.length; i++) {
- if (cardList[i].selected) {
- params.interactType = cardList[i].value
- }
- }
- utils.axios({
- method: 'post',
- url: '/sys/taitou/todo/save',
- data: params,
- sendBefore() {
- wx.showLoading({
- title: '待开抬头保存中...',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- },
- success: res => {
- wx.redirectTo({
- url: '/pages/ticketScan/success'
- })
- }
- })
- },
- //查询购方名字
- toSearch() {
- wx.navigateTo({
- url: '/pages/search/search'
- })
- },
- //选择接收方式
- selectType(e) {
- let index = Number(e.currentTarget.dataset.index)
- let cardList = this.data.cardList
- for (let i = 0; i < cardList.length; i++) {
- cardList[i].selected = false
- }
- cardList[index].selected = true
- this.setData({
- cardList
- })
- },
- //以下是获取表单信息的函数
- getcustomerName(e) {
- this.setData({
- ['buyer.customerName']: e.detail.value
- })
- },
- getentTaxId(e) {
- this.setData({
- ['buyer.entTaxId']: e.detail.value
- })
- },
- getemail(e) {
- this.setData({
- ['buyer.email']: e.detail.value
- })
- },
- getcustomerMobile(e) {
- this.setData({
- ['buyer.customerMobile']: e.detail.value
- })
- },
- getaddress(e) {
- this.setData({
- ['buyer.address']: e.detail.value
- })
- },
- getcontactPhone(e) {
- this.setData({
- ['buyer.contactPhone']: e.detail.value
- })
- },
- getbankName(e) {
- this.setData({
- bankName: e.detail.value
- })
- },
- getbankAccount(e) {
- this.setData({
- ['buyer.bankAccount']: e.detail.value
- })
- },
- getremark(e) {
- this.setData({
- remark: e.detail.value
- })
- },
- getinteractTypeDetail(e) {
- this.setData({
- interactTypeDetail: e.detail.value
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- return {
- title: '诺信云',
- path: '/pages/index/index'
- }
- }
- })
|