This commit is contained in:
2020-09-04 17:29:45 +08:00
parent 377f3b080a
commit 83eb365628
12 changed files with 745 additions and 26 deletions

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, // 发票抬头ID不开票传0
}
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>