diff --git a/packageB/invoice/addInvoice.vue b/packageB/invoice/addInvoice.vue index 19b7cb7..8fcd7ae 100644 --- a/packageB/invoice/addInvoice.vue +++ b/packageB/invoice/addInvoice.vue @@ -2,14 +2,22 @@ - + - + + + - 活动名 - ¥ 价格 + {{detail.title}} + ¥ {{detailAny.payprice}} + + + + 已选择{{num}}个订单 预计发票金额:¥ + 43.25 + 预计金额仅作为参考,请以合并后的实际金额为准 @@ -17,87 +25,211 @@ - - - + + + - - + + 普通发票 - + + + + + + 专用发票 + - + - - - + + + + + + + + 商品明细 + + + - - + + + + + + + + + 个人或事业单位 + + + + + + + 企业 + + + + + + + + 选择预设抬头类型 + + + + - + - - - + + + - - - + + - - + + - - + + - - + + - - + + - - + + + + + + - - - - - - - - - - - - - - - - - + + + - + - + - 申请开票 + + 申请开票 + + + + + + 选择预设抬头 + + + + + 专用发票抬头 + 个人发票抬头 + + + + + 默认 + {{item.invoice_header}} + + {{item.tax_id}} + + + + + + + + + + + + + + 添加抬头 + + + + + @@ -105,83 +237,307 @@ export default { data() { return { - upTypelist:[],//抬头类型列表 - id:1, - order_no:'', + popupStyletk: { + width: '710rpx', + padding: '24rpx 24rpx 42rpx 24rpx', + height: '800rpx', + margin: '0 auto', // 水平居中 + display: 'flex', + justifyContent: 'start', + alignItems: 'center', + flexColumn: 'column' + }, + style: { + // 字符串的形式 + img: 'width: 100%' + }, + upTypelist: [], //抬头类型列表 + id: 0, + order_no: '', + order_nos: '', + num: '', form: { - username: '', - password: '', - confirmPassword: '', - email: '', - age: '' + order_nos: '', + head_type: '', + invoice_type: '', + invoice_header: '', + tax_id: '', + bank_deposit: '', + bank_number: '', + enterprise_address: '', + enterprise_phone: '', + invoice_reservation_phone: '', + invoice_reservation_email: '' }, rules: { - username: [{ - required: true, - message: '请输入用户名', - trigger: 'blur' - }, - { - min: 3, - max: 10, - message: '用户名长度在3到10个字符', - trigger: 'blur' - } - ], - - email: [{ - type: 'email', - message: '邮箱格式不正确', + // invoice_type: [{ + // required: true, + // message: '请选择发票类型', + // trigger: 'blur' + // }], + invoice_header: [{ + required: true, + // type: 'invoice_header', + message: '请输入抬头名称', trigger: 'blur' }], - age: [{ - type: 'number', - message: '年龄必须为数字', - trigger: 'blur' - }, - { - min: 18, - max: 60, - type: 'number', - message: '年龄必须在18到60岁之间', - trigger: 'blur' - } - ] - } + // invoice_type: [{ + // required: true, + // // type: 'invoice_type', + // message: '请选择抬头类型', + // trigger: 'blur' + // }], + invoice_reservation_phone: [{ + required: true, + // type: 'invoice_reservation_phone', + message: '请输入发票预留手机号', + trigger: 'blur' + }], + invoice_reservation_email: [{ + required: true, + message: '请输入发票预留邮箱', + trigger: 'blur' + }], + }, + detail: '', //第二个detail + detailAny: '', //第一个detail + qrimages: '', + headShow: false, //预设抬头的遮罩 + page: 1, + limit: 10, + headList: [], + selectHeadIndex: null, + // keywords: '', } }, onLoad(options) { - // this.userInfo = uni.getStorageSync("userInfo") - this.id = options.id - this.order_no = options.order_no - console.log('id:',this.id,'order_no:',this.order_no); - }, - methods: { - submit() { - this.$refs.uForm.validate(valid => { - if (valid) { - uni.showToast({ - title: '提交成功', - icon: 'success' - }) - console.log('表单数据:', this.form) - } else { - console.log('验证失败') - } - }) - }, - reset() { - this.$refs.uForm.resetFields() + console.log('options:', options.num, options.order_nos); + this.num = options.num + this.order_nos = options.order_nos + if (this.num == 1) { + this.id = options.id + console.log('id1', this.id); + this.getOrderInfo(); } + console.log('num:', this.num, 'order_nos:', this.order_nos); }, onReady() { - this.$refs.uForm.setRules(this.rules) - } + console.log('设置规则:', this.rules); + this.$refs.uForm.setRules(this.rules); + }, + methods: { + getOrderInfo() { + console.log('id', this.id); + uni.$u.http.get('/api/school.newactivity.order/detail', { + params: { + id: this.id, + } + }).then(res => { + if (res.code == 1) { + this.detail = res.data.detail.detail; + + // this.qrList = res.data.detail.ordercode; + this.qrimages = res.data.detail.ordercode; + this.detailAny = res.data.detail; + // this.generateAllQRCodes() + console.log('qrimages:', this.qrimages); + console.log('detailAny:', this.detailAny); + console.log('detail:', this.detail); + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }).catch(error => {}); + }, + handleHeadTp1() { + this.form.invoice_type = 'ordinary' + console.log('1-1', this.form.invoice_type); + }, + handleHeadTp2() { + // this.$set(this.form.invoice_type = 'special') + this.form.invoice_type = 'special' + console.log('2-2', this.form.invoice_type); + }, + handlePerson() { + console.log('1'); + this.form.head_type = 'personal' + }, + handleCompany() { + console.log('2'); + this.form.head_type = 'corporate' + }, + openHeadShow() { + this.headShow = true; + this.getHeadList(); + }, + closeHeadShow() { + this.headShow = false; + }, + getHeadList() { + uni.$u.http.get('/api/school.header/header_list', { + params: { + // keywords: this.keywords, + page: this.page, + limit: this.limit, + } + }).then(res => { + if (res.code == 1) { + console.log('res:', res); + this.headList = res.data.list + console.log('headlist', this.headList[2]); + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }).catch(error => {}); + }, + selectHead(item, index) { + console.log('index:', index, 'item:', item.head_type); + this.form.head_type = item.head_type + console.log('this.form.head_type', this.form.head_type); + // if(this.form.head_type == 'ordinary'){ + // console.log('edfsd'); + // this.form.tax_id = item.tax_id + // this.form.bank_deposit = item.bank_deposit + // this.form.bank_number = item.bank_number + // this.form.enterprise_address = item.enterprise_address + // this.form.enterprise_phone = item.enterprise_phone + // } + this.selectHeadIndex = index + this.form.invoice_type = item.invoice_type + this.form.invoice_header = item.invoice_header + this.form.invoice_reservation_phone = item.invoice_reservation_phone + this.form.invoice_reservation_email = item.invoice_reservation_email + this.form.tax_id = item.tax_id + this.form.bank_deposit = item.bank_deposit + this.form.bank_number = item.bank_number + this.form.enterprise_address = item.enterprise_address + this.form.enterprise_phone = item.enterprise_phone + console.log('5555'); + this.closeHeadShow(); + }, + submit() { + console.log('sub1'); + if (this.form.invoice_reservation_phone == '') { + uni.showToast({ + title: '请输入手机号', + icon: 'none', + duration: 2000 + }) + return; + } + if (this.form.invoice_reservation_email == '') { + uni.showToast({ + title: '请输入邮箱地址', + icon: 'none', + duration: 2000 + }) + return; + } + if (this.form.invoice_header == '') { + uni.showToast({ + title: '请输入抬头名称', + icon: 'none', + duration: 2000 + }) + return; + } + if (this.form.head_type == 'corporate') { + console.log('判断'); + if (this.form.tax_id == '') { + uni.showToast({ + title: '请输入单位税号', + icon: 'none', + duration: 2000 + }) + return; + } + if (this.form.enterprise_address == '') { + uni.showToast({ + title: '请输入企业注册地址', + icon: 'none', + duration: 2000 + }) + return; + } + if (this.form.enterprise_phone == '') { + uni.showToast({ + title: '请输入企业注册电话', + icon: 'none', + duration: 2000 + }) + return; + } + if (this.form.bank_deposit == '') { + uni.showToast({ + title: '请输入企业开户银行', + icon: 'none', + duration: 2000 + }) + return; + } + if (this.form.bank_number == '') { + uni.showToast({ + title: '请输入银行账号', + icon: 'none', + duration: 2000 + }) + return; + } + } + uni.$u.http.post('/api/school.header/apply', { + order_nos: this.order_nos, + head_type: this.form.head_type, + invoice_type: this.form.invoice_type, + invoice_header: this.form.invoice_header, + tax_id: this.form.tax_id, + bank_deposit: this.form.bank_deposit, + bank_number: this.form.bank_number, + enterprise_address: this.form.enterprise_address, + enterprise_address: this.form.enterprise_address, + invoice_reservation_phone: this.form.invoice_reservation_phone, + invoice_reservation_email: this.form.invoice_reservation_email + }).then(res => { + if (res.code == 1) { + uni.showToast({ + title: '提交申请成功', + icon: 'success', + duration: 2000 + }) + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }).catch(error => {}); + // this.$refs.uForm.validate(valid => { + // console.log('sub2'); + // if (valid) { + // console.log('sub3'); + + // console.log('表单数据:', this.form) + // } else { + // console.log('验证失败') + // } + // }) + }, + }, } \ No newline at end of file diff --git a/packageB/invoice/invoiceCenter.vue b/packageB/invoice/invoiceCenter.vue index 9bffda5..ee5e422 100644 --- a/packageB/invoice/invoiceCenter.vue +++ b/packageB/invoice/invoiceCenter.vue @@ -14,9 +14,9 @@ - + - + @@ -217,6 +217,8 @@ upList: [],//支票抬头列表 count:0, order_nos: '',//选中的多个订单号 + num:0, + id: 0, }; }, onLoad(option) { @@ -305,14 +307,31 @@ handleIssueInvoice() { //拿到选中的订单 const list = this.unInvoiceList.filter(item => item.invoiceCheck == 1).map(item => item.order_no) - console.log('list:',list); + const idList = this.unInvoiceList.filter(item => item.invoiceCheck == 1).map(item => item.id) + console.log('list:',list,idList); // this.order_nos = JSON.stringify(list) this.order_nos = JSON.stringify(list.join(',')) - const num = list.length - console.log('num:',num); - uni.navigateTo({ - url:'/packageB/invoice/addInvoice?order_nos=' + this.order_nos + '&num?' + num - }) + this.num = list.length + console.log('num:',this.num); + if(list.length<1){ + uni.showToast({ + title: '请选择需要开发票的订单', + icon: 'none', + duration: 2000 + }) + }else if(list.length === 1){ + this.id = idList[0] + console.log('id',this.id); + uni.navigateTo({ + url:'/packageB/invoice/addInvoice?order_nos=' + this.order_nos + '&num=' + this.num + '&id=' + this.id + }) + } + else{ + uni.navigateTo({ + url:'/packageB/invoice/addInvoice?order_nos=' + this.order_nos + '&num=' + this.num + }) + } + } }