123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- <template>
- <!-- 发票管理模块 -->
- <view :style="colorStyle">
- <view class="acea-row nav">
- <view class="acea-row row-center-wrapper" :class="{ on: nav === 1 }" @click="navTab(1)">发票记录</view>
- <view class="acea-row row-center-wrapper" :class="{ on: nav === 2 }" @click="navTab(2)">抬头管理</view>
- </view>
- <view v-show="nav === 1" class="record-wrapper">
- <view v-for="item in orderList" :key="item.id" class="item">
- <view class="item-hd acea-row">
- <image class="image" :src="item.order.cartInfo[0].productInfo.image"></image>
- <view class="text">{{ item.order.cartInfo[0].productInfo.store_name + item.order.cartInfo[0].productInfo.attrInfo.suk || '' }}</view>
- </view>
- <view class="item-bd acea-row row-between-wrapper">
- <view>
- <view class="name">{{ item.header_type === 1 ? '个人' : '企业' }}{{ item.type === 1 ? '普通' : '专用' }}发票</view>
- <view>申请时间 {{ item.add_time }}</view>
- </view>
- <view class="money">¥<text class="num">{{ item.order.pay_price }}</text></view>
- </view>
- <view class="item-ft acea-row row-between-wrapper">
- <view>{{ item.is_invoice ? '已开票' : '未开票' }}</view>
- <navigator class="link" :url="`/pages/users/user_invoice_order/index?order_id=${item.order.order_id}`">查看详情</navigator>
- </view>
- </view>
- <view v-show="page === 2 && !orderList.length" class="nothing">
- <image class="image" :src="imgHost + '/statics/images/noInvoice.png'"></image>
- <view>没有发票信息哟~</view>
- </view>
- </view>
- <view v-show="nav === 2">
- <view v-if="invoiceList.length" class="list">
- <template v-for="item in invoiceList">
- <view v-if="item.type === 1 || item.type === 2 && specialInvoice" :key="item.id" class="item">
- <view class="acea-row item-hd">
- <view class="acea-row row-middle">
- <view class="name">{{ item.name }}</view>
- <view v-if="item.is_default" class="label">默认</view>
- </view>
- <view class="type" :class="{ special: item.type === 2 }">{{ item.type === 1 && item.header_type === 1 ? '个人普通发票' : item.type === 1 && item.header_type === 2?'企业普通发票':'企业专用发票' }}</view>
- </view>
- <view class="item-bd">
- <view class="cell">联系邮箱 {{ item.email }}</view>
- <view v-if="item.header_type === 2" class="cell">企业税号 {{ item.duty_number }}</view>
- <view v-if="item.header_type === 1 && item.drawer_phone" class="cell">联系电话 {{ item.drawer_phone }}</view>
- </view>
- <view class="acea-row row-right item-ft">
- <view class="btn" @click="editInvoice(item.id)"><text class="iconfont icon-bianji"></text>编辑</view>
- <view class="btn" @click="deleteInvoice(item.id)"><text class="iconfont icon-shanchu"></text>删除</view>
- </view>
- </view>
- </template>
- </view>
- <view v-show="page === 2 && !invoiceList.length" class="nothing">
- <image class="image" :src="imgHost + '/statics/images/noInvoice.png'"></image>
- <view>没有发票信息哟~</view>
- </view>
- <navigator class="add-link" :url="`/pages/users/user_invoice_form/index?specialInvoice=${specialInvoice}`"><text
- class="iconfont icon-fapiao"></text>添加新抬头</navigator>
- </view>
- <home v-if="navigation"></home>
- </view>
- </template>
- <script>
- import home from '@/components/home';
- import {
- mapGetters
- } from "vuex";
- import {
- invoiceList,
- invoiceDelete,
- getUserInfo
- } from '@/api/user.js';
- import {
- orderInvoiceList
- } from '@/api/order.js';
- import colors from '@/mixins/color.js';
- import {HTTP_REQUEST_URL} from '@/config/app';
- export default {
- components: {
- home
- },
- mixins:[colors],
- data() {
- return {
- orderList: [],
- invoiceList: [],
- nav: 1, // 1:发票记录 2:抬头管理
- page: 1,
- limit: 30,
- loading: false,
- finished: false,
- specialInvoice: true,
- imgHost:HTTP_REQUEST_URL
- };
- },
- watch: {
- nav: {
- immediate: true,
- handler(value) {
- this.page = 1;
- switch (value) {
- case 1:
- this.orderList = [];
- this.getOrderList();
- break;
- case 2:
- this.invoiceList = [];
- this.getInvoiceList();
- break;
- }
- }
- }
- },
- computed: mapGetters(['isLogin']),
- onLoad(option) {
- if (option.from === 'invoice_form') {
- this.nav = 2;
- }
- this.getUserInfo();
- },
- onShow() {
- uni.removeStorageSync('form_type_cart');
- },
- methods: {
- getUserInfo() {
- getUserInfo().then(res => {
- const {
- special_invoice
- } = res.data;
- this.specialInvoice = special_invoice
- });
- },
- // 菜单切换
- navTab(nav) {
- if (this.nav !== nav) {
- this.nav = nav;
- }
- },
- // 记录列表
- getOrderList() {
- uni.showLoading({
- title: '加载中'
- });
- orderInvoiceList({
- page: this.page,
- limit: this.limit
- }).then(res => {
- const {
- data
- } = res;
- uni.hideLoading();
- this.orderList = this.orderList.concat(data);
- this.finished = data.length < this.limit;
- this.page += 1;
- }).catch(err => {
- uni.showToast({
- title: err.msg,
- icon: 'none'
- });
- });
- },
- // 发票列表
- getInvoiceList() {
- uni.showLoading({
- title: '加载中'
- });
- invoiceList({
- page: this.page,
- limit: this.limit
- }).then(res => {
- const {
- data
- } = res;
- uni.hideLoading();
- this.invoiceList = this.invoiceList.concat(data);
- this.finished = data.length < this.limit;
- this.page += 1;
- }).catch(err => {
- uni.showToast({
- title: err.msg,
- icon: 'none'
- });
- });
- },
- // 编辑发票
- editInvoice(id) {
- uni.navigateTo({
- url: `/pages/users/user_invoice_form/index?id=${id}`
- });
- },
- // 删除发票
- deleteInvoice(id) {
- let that = this;
- uni.showModal({
- content: '删除该发票?',
- confirmColor: '#E93323',
- success(res) {
- if (res.confirm) {
- invoiceDelete(id).then(() => {
- that.$util.Tips({
- title: '删除成功',
- icon: 'success'
- }, () => {
- let index = that.invoiceList.findIndex(value => {
- return value.id == id;
- });
- that.invoiceList.splice(index, 1);
- });
- }).catch(err => {
- return that.$util.Tips({
- title: err
- });
- });
- }
- }
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .nav {
- position: fixed;
- top: 0;
- left: 0;
- z-index: 9;
- width: 100%;
- height: 90rpx;
- background-color: #FFFFFF;
- }
- .nav .acea-row {
- flex: 1;
- border-top: 3rpx solid transparent;
- border-bottom: 3rpx solid transparent;
- font-size: 30rpx;
- color: #282828;
- }
- .nav .on {
- border-bottom-color: var(--view-theme);
- color: var(--view-theme);
- }
- .list {
- padding: 14rpx 32rpx;
- margin-top: 90rpx;
- margin-bottom: 140rpx;
- }
- .list .item {
- padding: 28rpx 32rpx;
- background-color: #FFFFFF;
- }
- .list .item~.item {
- margin-top: 14rpx;
- }
- .list .item-hd .acea-row {
- flex: 1;
- min-width: 0;
- }
- .list .name {
- font-weight: 600;
- font-size: 30rpx;
- color: #282828;
- }
- .list .label {
- width: 56rpx;
- height: 28rpx;
- border: 1rpx solid var(--view-theme);
- margin-left: 18rpx;
- font-size: 20rpx;
- line-height: 26rpx;
- text-align: center;
- color: var(--view-theme);
- }
- .list .type {
- width: 172rpx;
- height: 42rpx;
- margin-left: 30rpx;
- background-color: #FCF0E0;
- font-size: 24rpx;
- line-height: 42rpx;
- text-align: center;
- color: #D67300;
- }
- .list .type.special {
- background-color: #FDE9E7;
- color: #E93323;
- }
- .list .item-bd {
- margin-top: 18rpx;
- }
- .list .cell {
- font-size: 26rpx;
- color: #666666;
- }
- .list .cell~.cell {
- margin-top: 12rpx;
- }
- .list .item-ft {
- margin-top: 11rpx;
- }
- .list .btn {
- font-size: 26rpx;
- color: #282828;
- cursor: pointer;
- }
- .list .btn~.btn {
- margin-left: 35rpx;
- }
- .list .btn .iconfont {
- margin-right: 10rpx;
- font-size: 24rpx;
- color: #000000;
- }
- .add-link {
- position: fixed;
- right: 30rpx;
- bottom: 53rpx;
- left: 30rpx;
- height: 86rpx;
- border-radius: 43rpx;
- background-color: var(--view-theme);
- font-size: 30rpx;
- line-height: 86rpx;
- text-align: center;
- color: #FFFFFF;
- .iconfont {
- margin-right: 14rpx;
- font-size: 28rpx;
- }
- }
- .nothing {
- margin-top: 254rpx;
- font-size: 26rpx;
- text-align: center;
- color: #999999;
- .image {
- width: 400rpx;
- height: 260rpx;
- margin-bottom: 20rpx;
- }
- }
- .record-wrapper {
- margin-top: 110rpx;
- .item {
- padding-right: 30rpx;
- padding-left: 30rpx;
- border-radius: 6rpx;
- margin: 30rpx;
- background-color: #FFFFFF;
- .item-hd {
- padding-top: 36rpx;
- padding-bottom: 36rpx;
- .image {
- width: 78rpx;
- height: 78rpx;
- border-radius: 6rpx;
- }
- .text {
- flex: 1;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- margin-left: 24rpx;
- font-size: 26rpx;
- line-height: 37rpx;
- color: #282828;
- }
- }
- .item-bd {
- padding: 26rpx 30rpx 25rpx 32rpx;
- border-radius: 20rpx;
- background-color: #F5F6F7;
- font-size: 26rpx;
- line-height: 37rpx;
- color: #818181;
- .name {
- margin-bottom: 8rpx;
- font-weight: bold;
- font-size: 26rpx;
- color: #282828;
- }
- .money {
- font-weight: bold;
- font-size: 24rpx;
- color: #282828;
- .num {
- font-size: 32rpx;
- }
- }
- }
- .item-ft {
- padding-top: 30rpx;
- padding-bottom: 30rpx;
- font-weight: bold;
- font-size: 28rpx;
- color: #282828;
- .link {
- width: 150rpx;
- height: 57rpx;
- border: 1rpx solid #707070;
- border-radius: 29rpx;
- font-weight: normal;
- font-size: 26rpx;
- line-height: 57rpx;
- text-align: center;
- color: #282828;
- }
- }
- }
- }
- </style>
|