Merge pull request '发票' (#331) from zhy into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/331
This commit is contained in:
hansu 2020-09-04 17:30:53 +08:00
commit 23a75971f3
12 changed files with 745 additions and 26 deletions

View File

@ -1,6 +1,6 @@
export default {
init(vm){
return {
return {
// 获取首页轮播
getIndexSwiper() {
return vm.$u.post('adv/indexadv');
@ -139,7 +139,7 @@ export default {
});
},
// 订单步骤2发起订单返回订单信息
sendOrder({ ifcart, cart_id, address_id, buy_city_id, pintuan_id, pintuangroup_id, voucher_id, is_selfraising }) {
sendOrder({ ifcart, cart_id, address_id, buy_city_id, pintuan_id, pintuangroup_id, voucher_id, is_selfraising, invoice_id }) {
return vm.$u.post('buy/buy_step2', {
ifcart: ifcart,
cart_id: cart_id,
@ -149,6 +149,7 @@ export default {
pintuangroup_id: pintuangroup_id,
voucher_id: voucher_id, // 优惠券信息
is_selfraising: is_selfraising, // 是否自提
invoice_id: invoice_id,
});
},
// 订单步骤3发起支付第三方统一下单
@ -373,8 +374,11 @@ export default {
//内容
tipsinfo({document_code}){
return vm.$u.post('Shop/tipInfo',{document_code})
}
}
},
advClick({ adv_id }) {
return vm.$u.post('adv/advClick',{ adv_id })
},
}
}
}

View File

@ -479,8 +479,26 @@ export default {
return vm.$u.post("Expertapply/expertApply", {
name, mobile, address, industry, hobby
})
}
},
getInvoiceList() {
return vm.$u.post("Invoice/invoiceList")
},
getInvoiceInfo({ invoice_id }) {
return vm.$u.post("Invoice/invoiceInfo", { invoice_id })
},
invoiceAdd({ invoice_type, invoice_title, invoice_code, invoice_goto_addr, invoice_rec_mobphone, invoice_reg_bname, invoice_reg_baccount }) {
return vm.$u.post("Invoice/invoiceAdd", {
invoice_type, invoice_title, invoice_code, invoice_goto_addr, invoice_rec_mobphone, invoice_reg_bname, invoice_reg_baccount
})
},
invoiceEdit({ invoice_id, invoice_title, invoice_code, invoice_goto_addr, invoice_rec_mobphone, invoice_reg_bname, invoice_reg_baccount, invoice_type }) {
return vm.$u.post("Invoice/invoiceEdit", {
invoice_id, invoice_title, invoice_code, invoice_goto_addr, invoice_rec_mobphone, invoice_reg_bname, invoice_reg_baccount, invoice_type
})
},
invoiceDel({ invoice_id }) {
return vm.$u.post("Invoice/invoiceDel", { invoice_id })
},
}
}
}

View File

@ -21,6 +21,10 @@ const store = new Vuex.Store({
showLoginModel: false, // 登录框
question: {}, // 帮助与反馈
showCoupons: true, // 是否显示新人领取优惠券
invoiceInfo: { // 是否选择发票
invoice_type: '',
invoice_id: 0,
}
},
getters: {
getOrderAddress(state) {
@ -31,8 +35,15 @@ const store = new Vuex.Store({
},
getGoodsInfo(state) {
return state.goodsDetails.goods;
},
hasInvoice(state) {
const type = state.invoiceInfo.invoice_type;
return type ? type : 0;
},
getInvoiceId(state) {
return state.invoiceInfo.invoice_id || 0;
}
},
},
mutations: {
// 登录
loginIn(state, token) {
@ -83,6 +94,9 @@ const store = new Vuex.Store({
},
updateShowCoupons(state, status) {
state.showCoupons = status;
},
setInvoiceInfo(state, invoice = {}) {
state.invoiceInfo = invoice;
}
}
})

View File

@ -69,6 +69,14 @@
<image src="../static/image/1.png"></image>
</view>
</view>
<view>
<view class="title">开具发票</view>
<view class="value" @click="selectInvoice">
<view class="invoice" v-if="!hasInvoice">本次不开具发票</view>
<view class="invoice" v-else>{{ hasInvoice == 1 ? '个人或事业单位发票' : '企业发票' }}</view>
<image src="../static/image/1.png"></image>
</view>
</view>
</view>
<u-popup v-model="couponStatus" mode="bottom">
<scroll-view class="coupon-choose" scroll-y style="height: 50vh;" v-if="this.couponType.type == 1">
@ -134,6 +142,7 @@ export default {
orderType: '', // 1 2 3 4 5
debounce: true,
is_selfraising: 0, // 0=1=
hasInvoice: 0,
}
},
components: {
@ -176,9 +185,12 @@ export default {
} else {
if(this.$store.getters.getOrderAddress) this.addressInfo = this.$store.state.orderAddress;
}
this.hasInvoice = this.$store.getters.hasInvoice;
console.log(this.hasInvoice);
},
beforeDestroy() {
this.$store.commit('updateAddress', {});
this.$store.commit('setInvoiceInfo', {});
},
watch: {
'$store.state.orderAddress'(value) {
@ -265,6 +277,7 @@ export default {
address_id: this.addressInfo.address_id,
buy_city_id: this.addressInfo.city_id,
is_selfraising: this.is_selfraising,
invoice_id: this.$store.getters.getInvoiceId, // ID0
}
if(coupon.length) Object.assign(params, { voucher_id: coupon });
if(this.orderType == 2) {
@ -430,7 +443,10 @@ export default {
uni.navigateTo({
url: '/pageE/more/Address?type=choose'
});
}
},
selectInvoice() {
this.$u.route('/pageC/cart/selectInvoice');
},
},
};
</script>
@ -632,6 +648,9 @@ export default {
align-items: center;
font-size: 30rpx;
color:rgba(51,51,51,1);
.invoice {
font-size: 26rpx;
}
> image {
width: 12rpx;
height: 22rpx;

View File

@ -0,0 +1,186 @@
<template>
<view class="select-invoice">
<view class="invoice-type">
<view class="title">发票类型</view>
<u-radio-group v-model="type" @change="radioGroupChange" icon-size="0" active-color="#FF780F" size="16">
<u-radio
v-for="(item, index) in list" :key="index"
:name="item.type"
>
{{item.name}}
</u-radio>
</u-radio-group>
</view>
<view class="invoice-list" v-if="currentList.length">
<u-radio-group v-model="invoice" @change="selectInvoice" active-color="#FF780F" icon-size="12" size="30" :wrap="true">
<u-radio
v-for="(item, index) in currentList" :key="index"
:name="item.invoice_id"
>
{{ item.invoice_title }}
</u-radio>
</u-radio-group>
</view>
<view class="invoice-none" v-if="!currentList.length">您当前还未添加抬头发票<text @click="addInvoice">点击立即添加</text></view>
<view class="btn-group">
<view class="submit" @click="submit">提交申请</view>
<view class="cancel" @click="cancel">不开发票</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
type: 1,
list: [{
type: 1,
name: '个人或事业单位'
}, {
type: 2,
name: '企业'
}],
invoice: '',
invoiceList: [],
currentList: [],
}
},
onShow() {
this.type = 1;
this.getInvoiceList();
},
watch: {
type(value) {
let invoiceList = this.invoiceList.filter(item => item.invoice_type == value);
this.currentList = invoiceList;
}
},
methods: {
getInvoiceList() {
this.$u.api.getInvoiceList().then(res => {
this.invoiceList = res.data;
this.currentList = this.invoiceList.filter(item => item.invoice_type == this.type);
// console.log(this.invoiceList);
})
},
radioGroupChange(e) {
this.type = e;
},
selectInvoice(e) {
this.invoice = e;
},
submit() {
console.log(this.invoice);
if(!this.invoice) {
this.$u.toast('请选择发票');
return false;
}
this.$store.commit('setInvoiceInfo', {
invoice_type: this.type,
invoice_id: this.invoice
});
this.$u.route({ type: 'back' });
},
cancel() {
this.$store.commit('setInvoiceInfo', {
invoice_type: 0
});
this.$u.route({ type: 'back' });
},
addInvoice() {
this.$u.route('/pageE/more/EditInvoice', { action: 1 });
},
}
};
</script>
<style lang="scss" scoped>
.select-invoice {
min-height: calc(100vh - var(--window-top));
background: #ECECEC;
padding-top: 1rpx;
.invoice-type {
height: 98rpx;
background: #FFFFFF;
margin-bottom: 2rpx;
padding: 35rpx 30rpx;
display: flex;
align-items: center;
.title {
font-size: 30rpx;
color: #333333;
width: 120rpx;
margin-right: 50rpx;
}
.u-radio-group {
flex: 1;
/deep/ .u-radio {
.u-radio__icon-wrap {
margin: 0 20rpx;
position: relative;
background-color: #DBDBDB;
&::before {
content: '';
position: absolute;
width: 29rpx;
height: 29rpx;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1rpx solid #DBDBDB;
border-radius: 50%;
}
}
.u-radio__icon-wrap--checked {
background-color: #FF780F;
&::before {
border-color: #FF780F;
}
}
}
}
}
.invoice-list {
background-color: #FFFFFF;
/deep/ .u-radio-group {
height: 80rpx;
padding: 30rpx;
.u-radio {
line-height: 1 !important;
.u-radio__icon-wrap {
margin-right: 20rpx;
}
}
}
}
.invoice-none {
text-align: center;
margin-top: 70rpx;
font-size: 26rpx;
color: #333333;
> text {
color: #FF780F;
}
}
.btn-group {
margin-top: 250rpx;
> view {
width: 690rpx;
height: 98rpx;
border-radius: 49rpx;
font-size: 36rpx;
margin: 0 auto;
line-height: 98rpx;
text-align: center;
}
.submit {
background: #FF780F;
color: #FFFFFF;
margin-bottom: 20rpx;
}
.cancel {
background: #FFFFFF;
color: #FF780F;
}
}
}
</style>

307
pageE/more/EditInvoice.vue Normal file
View File

@ -0,0 +1,307 @@
<template>
<view class="edit-invoice">
<view class="invoice-type">
<view class="title">发票类型</view>
<u-radio-group v-model="type" @change="radioGroupChange" icon-size="0" active-color="#FF780F" size="16">
<u-radio
v-for="(item, index) in list" :key="index"
:name="item.type"
:disabled="action==0"
>
{{item.name}}
</u-radio>
</u-radio-group>
</view>
<view class="info-item">
<view class="title">发票抬头</view>
<input type="text" placeholder="抬头名称或极速开票6位代码" v-model="title" />
</view>
<view class="personal" v-show="type==1">
<view class="info-item">
<view class="title">手机号</view>
<input type="number" placeholder="请输入您的手机号" maxlength="11" v-model="personalPhone" />
</view>
<view class="info-item">
<view class="title">身份证号</view>
<input type="text" placeholder="请输入您的身份证号" v-model="idCard" />
</view>
</view>
<view class="company" v-show="type==2">
<view class="info-item">
<view class="title">税号</view>
<input type="text" placeholder="纳税人识别号或社会统一征信代码" v-model="taxNumber" />
</view>
<view class="info-item">
<view class="title">单位地址</view>
<input type="text" placeholder="请输入公司地址" v-model="address" />
</view>
<view class="info-item">
<view class="title">电话号码</view>
<input type="number" placeholder="请输入公司电话" maxlength="11" v-model="companyPhone" />
</view>
<view class="info-item">
<view class="title">开户银行</view>
<input type="text" placeholder="请输入开户银行" v-model="bankDeposit" />
</view>
<view class="info-item">
<view class="title">银行账户</view>
<input type="text" placeholder="请输入银行账户" v-model="bankAccounts" />
</view>
</view>
<view class="save-btn" @click="submit">保存</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
export default {
data() {
return {
invoice_id: '',
action: '', // 0 1
type: '', //
list: [{
type: 1,
name: '个人或事业单位'
}, {
type: 2,
name: '企业'
}],
title: '',
personalPhone: '',
idCard: '',
taxNumber: '',
address: '',
companyPhone: '',
bankDeposit: '',
bankAccounts: '',
}
},
onLoad(option) {
this.action = option.action;
if(option.invoice_id) {
this.type = 0;
this.invoice_id = option.invoice_id;
this.getInvoiceInfo();
} else {
this.type = 1;
}
},
methods: {
submit() {
this.action == 1 ? this.invoiceAdd() : this.invoiceEdit();
},
verificationParams() {
if(this.type == 1) {
if(this.$u.test.isEmpty(this.title)) {
this.$u.toast('发票抬头不可为空');
return false;
}
if(this.$u.test.isEmpty(this.personalPhone)) {
this.$u.toast('手机号不可为空');
return false;
}
if(!this.$u.test.mobile(this.personalPhone)) {
this.$u.toast('请正确填写手机号');
return false;
}
if(this.$u.test.isEmpty(this.idCard)) {
this.$u.toast('身份证号不可为空');
return false;
}
} else {
if(this.$u.test.isEmpty(this.title)) {
this.$u.toast('发票抬头不可为空');
return false;
}
if(this.$u.test.isEmpty(this.taxNumber)) {
this.$u.toast('税号不可为空');
return false;
}
if(this.$u.test.isEmpty(this.address)) {
this.$u.toast('单位地址不可为空');
return false;
}
if(this.$u.test.isEmpty(this.companyPhone)) {
this.$u.toast('电话号码不可为空');
return false;
}
if(!this.$u.test.mobile(this.companyPhone)) {
this.$u.toast('请正确填写电话号码');
return false;
}
if(this.$u.test.isEmpty(this.bankDeposit)) {
this.$u.toast('开户银行不可为空');
return false;
}
if(this.$u.test.isEmpty(this.bankAccounts)) {
this.$u.toast('银行账户不可为空');
return false;
}
}
return true;
},
invoiceAdd() {
if(!this.verificationParams()) return false;
let params = {};
this.type == 1
? params = {
invoice_type: 1,
invoice_title: this.title,
invoice_code: this.idCard,
invoice_rec_mobphone: this.personalPhone,
}
: params = {
invoice_type: 2,
invoice_title: this.title,
invoice_code: this.taxNumber,
invoice_goto_addr: this.address,
invoice_rec_mobphone: this.companyPhone,
invoice_reg_bname: this.bankDeposit,
invoice_reg_baccount: this.bankAccounts,
}
this.$u.api.invoiceAdd(params).then(res => {
if(res.errCode == 0) {
this.$refs.uToast.show({
title: res.message,
back: true
})
} else {
this.$u.toast(res.message);
}
})
},
invoiceEdit() {
if(!this.verificationParams()) return false;
let params = {};
this.type == 1
? params = {
invoice_id: this.invoice_id,
invoice_type: 1,
invoice_title: this.title,
invoice_code: this.idCard,
invoice_rec_mobphone: this.personalPhone,
}
: params = {
invoice_id: this.invoice_id,
invoice_type: 2,
invoice_title: this.title,
invoice_code: this.taxNumber,
invoice_goto_addr: this.address,
invoice_rec_mobphone: this.companyPhone,
invoice_reg_bname: this.bankDeposit,
invoice_reg_baccount: this.bankAccounts,
}
this.$u.api.invoiceEdit(params).then(res => {
if(res.errCode == 0) {
this.$refs.uToast.show({
title: res.message,
back: true
})
} else {
this.$u.toast(res.message);
}
})
},
getInvoiceInfo() {
this.$u.api.getInvoiceInfo({ invoice_id: this.invoice_id }).then(res => {
if(res.errCode == 0) {
const invoice = res.data;
if(res.data.invoice_type == 1) {
this.title = invoice.invoice_title;
this.personalPhone = invoice.invoice_rec_mobphone;
this.idCard = invoice.invoice_code;
this.type = invoice.invoice_type;
} else if(res.data.invoice_type == 2) {
this.title = invoice.invoice_title;
this.taxNumber = invoice.invoice_code;
this.address = invoice.invoice_goto_addr;
this.companyPhone = invoice.invoice_rec_mobphone;
this.bankDeposit = invoice.invoice_reg_bname;
this.bankAccounts = invoice.invoice_reg_baccount;
this.type = invoice.invoice_type;
}
}
})
},
radioGroupChange(e) {
this.type = e;
}
}
};
</script>
<style lang="scss" scoped>
.edit-invoice {
min-height: calc(100vh - var(--window-top));
background: #ECECEC;
.invoice-type {
height: 98rpx;
background: #FFFFFF;
margin-bottom: 2rpx;
padding: 35rpx 30rpx;
display: flex;
align-items: center;
.title {
font-size: 30rpx;
color: #333333;
width: 120rpx;
margin-right: 50rpx;
}
.u-radio-group {
flex: 1;
/deep/ .u-radio {
.u-radio__icon-wrap {
margin: 0 20rpx;
position: relative;
background-color: #DBDBDB;
&::before {
content: '';
position: absolute;
width: 29rpx;
height: 29rpx;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1rpx solid #DBDBDB;
border-radius: 50%;
}
}
.u-radio__icon-wrap--checked {
background-color: #FF780F;
&::before {
border-color: #FF780F;
}
}
}
}
}
.info-item {
height: 98rpx;
background: #FFFFFF;
display: flex;
align-items: center;
margin-bottom: 2rpx;
padding: 35rpx 30rpx;
.title {
font-size: 30rpx;
color: #333333;
width: 120rpx;
margin-right: 50rpx;
}
> input {
flex: 1;
font-size: 28rpx;
}
}
.save-btn {
width: 690rpx;
height: 98rpx;
background: #FF780F;
border-radius: 49rpx;
font-size: 36rpx;
color: #FFFFFF;
margin: 120rpx auto 0;
line-height: 98rpx;
text-align: center;
}
}
</style>

123
pageE/more/MineInvoice.vue Normal file
View File

@ -0,0 +1,123 @@
<template>
<view class="invoice">
<view class="invoice-container">
<view class="invoice-item" v-for="(item, index) in invoiceList" :key="index">
<view class="title">{{ item.invoice_type == 1 ? '个人发票' : '企业发票' }}</view>
<view class="code">{{ item.invoice_title }}</view>
<view class="tool">
<view class="tool-item" @click="edit(0, item.invoice_id)">
<image src="../static/mine/24.png"></image>
<text>编辑</text>
</view>
<view class="tool-item" @click="delInvoice(item.invoice_id)">
<image src="../static/mine/25.png"></image>
<text>删除</text>
</view>
</view>
</view>
</view>
<view class="invoice-btn" @click="edit(1)">添加发票抬头</view>
</view>
</template>
<script>
export default {
data() {
return {
invoiceList: [],
}
},
onShow() {
this.getInvoiceList();
},
methods: {
getInvoiceList() {
this.$u.api.getInvoiceList().then(res => {
this.invoiceList = res.data;
})
},
delInvoice(id) {
this.$u.api.invoiceDel({ invoice_id: id }).then(res => {
if(res.errCode == 0) this.getInvoiceList();
else this.$u.toast(res.message);
})
},
edit(action, invoice_id) {
this.$u.route('/pageE/more/EditInvoice', {
action: action, // 0 1
invoice_id: invoice_id,
});
}
}
};
</script>
<style lang="scss" scoped>
.invoice {
min-height: calc(100vh - var(--window-top));
background: #ECECEC;
padding-top: 20rpx;
.invoice-container {
width: 690rpx;
margin: 0 auto;
.invoice-item {
margin-bottom: 20rpx;
background-color: #ffffff;
padding: 16rpx 20rpx;
border-radius: 10rpx;
.title {
font-size: 26rpx;
color: #666666;
margin-bottom: 16rpx;
}
.code {
font-size: 28rpx;
color: #333333;
position: relative;
padding: 30rpx 0;
&::after {
position: absolute;
content: '';
width: 100%;
height: 2rpx;
background-color: #ECECEC;
bottom: 0;
left: 0;
}
}
.tool {
padding-top: 18rpx;
display: flex;
align-items: center;
justify-content: flex-end;
.tool-item {
&:not(:last-child) {
margin-right: 30rpx;
}
> image {
width: 23rpx;
height: 23rpx;
margin-right: 14rpx;
}
> text {
font-size: 24rpx;
color: #999999;
}
}
}
}
}
.invoice-btn {
width: 690rpx;
height: 98rpx;
background: #FF780F;
border-radius: 49rpx;
font-size: 36rpx;
color: #FFFFFF;
line-height: 98rpx;
text-align: center;
position: absolute;
bottom: 40rpx;
left: 50%;
transform: translate(-50%, 0);
}
}
</style>

View File

@ -358,6 +358,19 @@
}
}
},
{
"path": "cart/selectInvoice",
"style": {
"navigationBarTitleText": "发票抬头",
"app-plus": {
"titleSize": "36px",
"titleNView": {
"titleColor": "#333333",
"backgroundColor": "#FFFFFF"
}
}
}
},
{
"path": "merchant/index",
"style": {
@ -635,6 +648,32 @@
}
}
},
{
"path": "more/MineInvoice",
"style": {
"navigationBarTitleText": "我的发票",
"app-plus": {
"titleSize": "36px",
"titleNView": {
"titleColor": "#333333",
"backgroundColor": "#FFFFFF"
}
}
}
},
{
"path": "more/EditInvoice",
"style": {
"navigationBarTitleText": "发票抬头",
"app-plus": {
"titleSize": "36px",
"titleNView": {
"titleColor": "#333333",
"backgroundColor": "#FFFFFF"
}
}
}
},
{
"path": "mine/ArticleDetails",
"style": {

View File

@ -549,7 +549,8 @@
// console.log(item);
this.jumpPage({
type: item.url_type,
id: item.info_id,
id: item.info_id,
adv_id: item.adv_id,
});
},
clickSImage(index) {
@ -557,11 +558,12 @@
// console.log(item);
this.jumpPage({
type: item.url_type,
id: item.info_id,
id: item.info_id,
adv_id: item.adv_id,
});
},
goSearch() {
this.$u.route("/pageB/search/index", {
goSearch() {
this.$u.route("/pageB/search/index", {
type: 2,
curent:2
});
@ -576,17 +578,18 @@
})
},
onPulling(e) {
console.log("onpulling", e);
},
onRestore() {
this.refresher = 'restore'; //
console.log("onRestore");
},
onAbort() {
console.log("onAbort");
},
console.log("onpulling", e);
},
onRestore() {
this.refresher = 'restore'; //
console.log("onRestore");
},
onAbort() {
console.log("onAbort");
},
jumpPage(uri) {
// console.log(uri);
this.$u.api.advClick({ adv_id: uri.adv_id });
common.jumpPage({ type: uri.type, id: uri.id });
}
},

View File

@ -109,6 +109,10 @@
<image src="/static/image/mine/45.png"></image>
<view>达人申请</view>
</view>
<view @click="toOtherPage('/more/MineInvoice')">
<image src="/static/image/mine/46.png"></image>
<view>我的发票</view>
</view>
</view>
</view>
</view>
@ -451,7 +455,7 @@ export default {
width: 100rpx;
}
> view:not(:last-child) {
margin-right: 32rpx;
margin-right: 16rpx;
}
}
}
@ -468,7 +472,7 @@ export default {
width: 100rpx;
}
> view:not(:last-child) {
margin-right: 32rpx;
margin-right: 16rpx;
}
}
.badge-box {

View File

@ -50,7 +50,7 @@
<!-- 拼团列表 -->
<group></group>
<view class="activity-view">
<image class="lingquan" :src="activityInfo.adv_code" @click="jumpPage({ type: activityInfo.url_type, id: activityInfo.info_id })"></image>
<image class="lingquan" :src="activityInfo.adv_code" @click="jumpPage({ type: activityInfo.url_type, id: activityInfo.info_id, adv_id: activityInfo.adv_id })"></image>
</view>
<!-- 优惠券 -->
<youhq></youhq>
@ -211,10 +211,11 @@
},
clickImage(index) {
// console.log(this.list[index]);
let item = this.list[index];
let item = this.list[index];
this.jumpPage({
type: item.url_type,
id: item.info_id,
id: item.info_id,
adv_id: item.adv_id,
});
},
//
@ -244,6 +245,7 @@
},
jumpPage(uri) {
// console.log(uri);
this.$u.api.advClick({ adv_id: uri.adv_id });
common.jumpPage({ type: uri.type, id: uri.id });
}
},

BIN
static/image/mine/46.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB