🔥 发票:移除相关功能,暂时不考虑

pull/29/head^2
YunaiV 2023-12-16 21:00:23 +08:00
parent cfb514e276
commit 1add3af785
9 changed files with 9 additions and 872 deletions

View File

@ -199,16 +199,6 @@
"group": "订单中心"
}
},
{
"path": "invoice",
"style": {
"navigationBarTitleText": "发票详情"
},
"meta": {
"auth": true,
"title": "发票详情"
}
},
{
"path": "aftersale/apply",
"style": {
@ -324,28 +314,6 @@
"title": "编辑地址"
}
},
{
"path": "invoice/list",
"style": {
"navigationBarTitleText": "发票管理"
},
"meta": {
"auth": true,
"sync": true,
"title": "发票管理",
"group": "用户中心"
}
},
{
"path": "invoice/edit",
"style": {
"navigationBarTitleText": "编辑发票"
},
"meta": {
"auth": true,
"title": "编辑发票"
}
},
{
"path": "wallet/money",
"style": {

View File

@ -1,329 +0,0 @@
<!-- 订单详情 -->
<template>
<s-layout title="发票详情" class="invoice-wrap" navbar="inner">
<view
class="invoice-heard ss-flex-col ss-row-right ss-col-center"
:style="[
{
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 88) + 'rpx',
},
]"
>
<view class="ss-flex ss-m-t-32 ss-m-b-32">
<text
class="sicon-warning-line"
v-if="state.data.status === 'waiting' || state.data.status === 'unpaid'"
></text>
<text class="sicon-check-line" v-if="state.data.status === 'finish'"></text>
<view class="invoice-heard-title">{{ state.data.status_text }}</view>
</view>
<view class="ss-flex ss-m-b-52">
<view class="ss-m-r-20 invoice-heard-desc">预计可开发票金额</view>
<view class="invoice-heard-price">{{ state.data.amount }}</view>
</view>
</view>
<view class="invoice-content ss-flex-col ss-col-center">
<view class="ss-m-t-50 ss-m-b-42 invoice-content-title">增值税电子普通发票</view>
<view class="ss-flex ss-m-b-64">
<view v-for="(item, index) in state.info" :key="item.title">
<view class="log-icon ss-flex">
<text class="sicon-circlecheck" v-if="statusNum >= index"></text>
<text class="sicon-unchecked" v-else></text>
<view
v-if="state.info.length - 1 != index"
class="line"
:class="statusNum >= index ? 'activity-color' : ''"
></view>
</view>
<view class="log-title">{{ item.title }}</view>
</view>
</view>
<view class="invoice-content-list ss-flex ss-row-between ss-col-top">
<view class="">
<view class="ss-flex">
<view class="list-title">发票类型</view>
<view class="list-desc">{{ state.data.type_text }}</view>
</view>
<view class="ss-flex">
<view class="list-title">发票抬头</view>
<view class="list-desc">{{ state.data.name }}</view>
</view>
<view class="ss-flex" v-if="state.data.type === 'company'">
<view class="list-title">发票税号</view>
<view class="list-desc">{{ state.data.tax_no }}</view>
</view>
<view class="ss-flex" v-if="state.data.status === 'finish'">
<view class="list-title">实开金额</view>
<view class="list-desc">{{ state.data.invoice_amount }}</view>
</view>
<view class="ss-flex" v-if="state.data.status === 'finish'">
<view class="list-title">开票时间</view>
<view class="list-desc">{{ state.data.finish_time }}</view>
</view>
<view class="ss-flex">
<view class="list-title">申请时间</view>
<view class="list-desc">{{ state.data.create_time }}</view>
</view>
</view>
<view
class="invoice-content-img ss-flex-col ss-col-center"
v-if="state.data.status === 'finish'"
>
<su-image
class="invoice-img"
isPreview
:previewList="state.jointImage"
:current="0"
:src="sheep.$url.static('/static/img/shop/order/invoice_thumb.png')"
:height="110"
mode="scaleToFill"
v-if="state.jointImage[0].substr(-4) != '.pdf'"
></su-image>
<!-- TODO: 发票为多个pdf时 -->
<view v-if="state.jointImage[0].substr(-4) == '.pdf'" @tap="onInvoice">
<image
:src="sheep.$url.static('/static/img/shop/order/invoice_thumb.png')"
class="invoice-img"
></image>
</view>
<view class="invoice-img-num">{{ state.numImage }}</view>
<view class="invoice-img-title">点击预览发票</view>
</view>
</view>
</view>
<view class="invoice-order ss-m-t-20">
<view class="goods-box" v-for="item in state.data.order_items" :key="item.id">
<s-goods-item
:img="item.goods_image"
:title="item.goods_title"
:skuText="item.goods_sku_text"
:price="item.goods_price"
:num="item.goods_num"
/>
</view>
<view class="invoice-order-list">
<view class="ss-flex">
<view class="list-title">订单状态</view>
<view class="list-desc">{{ state.data.order?.status_text }}</view>
</view>
<view class="ss-flex">
<view class="list-title">订单编号</view>
<view class="list-desc">{{ state.data.order?.order_sn }}</view>
</view>
<view class="ss-flex">
<view class="list-title">下单时间</view>
<view class="list-desc">{{ state.data.order?.create_time }}</view>
</view>
</view>
</view>
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/order/invoice_bg.png');
const state = reactive({
info: [
{
title: '订单提交',
},
{
title: '等待开票',
},
{
title: '开票完成',
},
],
data: {},
jointImage: [],
numImage: 0,
});
const statusNum = computed(() => {
if (state.data.status === 'finish') {
return 2;
} else if (state.data.status === 'waiting') {
return 1;
} else {
return 0;
}
});
function onInvoice() {
// #ifdef H5
window.open(state.jointImage);
// #endif
// #ifdef MP || APP-PLUS
uni.downloadFile({
url: state.jointImage[0],
success: function (res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function (res) {
console.log('打开文档成功');
},
});
},
});
// #endif
}
async function getInvoiceDetail(id) {
const { data } = await sheep.$api.order.invoice(id);
state.data = data;
state.data.download_urls?.forEach((i, index) => {
state.numImage = index + 1;
if (i.substr(-4) != '.pdf') {
state.jointImage.push(sheep.$url.static(i));
} else {
state.jointImage.push(sheep.$url.static(i));
}
});
}
onLoad((options) => {
getInvoiceDetail(options.invoiceId);
});
</script>
<style lang="scss" scoped>
.invoice-heard {
width: 100%;
box-sizing: border-box;
background: v-bind(headerBg) no-repeat,
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
background-size: 750rpx 100%;
.sicon-warning-line {
color: #fff;
font-size: 34rpx;
}
.sicon-check-line {
color: #fff;
font-size: 34rpx;
}
.invoice-heard-title {
font-size: 34rpx;
font-weight: 500;
color: #ffffff;
margin-left: 8rpx;
line-height: normal;
}
.invoice-heard-desc {
font-size: 24rpx;
font-weight: 500;
color: #ffffff;
}
.invoice-heard-price {
font-size: 28rpx;
font-family: OPPOSANS;
font-weight: 500;
color: #ffffff;
}
}
.invoice-content {
width: 100%;
position: relative;
z-index: 3;
background: #ffffff;
border-radius: 20rpx;
margin-top: -16rpx;
.invoice-content-title {
font-size: 30rpx;
font-weight: 500;
color: #333333;
}
.log-icon {
.sicon-unchecked {
color: #c2bec2;
font-size: 44rpx;
}
.sicon-circlecheck {
color: #e60a00;
font-size: 44rpx;
}
.line {
width: 158rpx;
height: 6rpx;
background: #f2f2f2;
border: 2rpx solid #ffffff;
}
.activity-color {
background: #e60a00;
}
}
.log-title {
font-size: 26rpx;
font-weight: 500;
color: #333333;
margin-left: -26rpx;
margin-top: 30rpx;
}
.invoice-content-list {
width: 100%;
padding: 0 46rpx 0 30rpx;
box-sizing: border-box;
}
.list-title {
font-size: 26rpx;
font-weight: 500;
color: #999999;
margin-right: 44rpx;
margin-bottom: 36rpx;
}
.list-desc {
font-size: 26rpx;
font-weight: 500;
color: #333333;
margin-bottom: 36rpx;
}
.invoice-img {
width: 200rpx;
height: 110rpx;
}
.invoice-img-num {
width: 216rpx;
height: 40rpx;
background: rgba(#000000, 0.45);
font-size: 24rpx;
font-weight: 500;
color: #ffffff;
text-align: center;
margin-top: -30rpx;
z-index: 1;
}
.invoice-img-title {
font-size: 24rpx;
font-weight: 500;
color: #999999;
}
}
.invoice-order {
width: 100%;
padding-top: 30rpx;
box-sizing: border-box;
background: #fff;
border-radius: 20rpx;
}
.goods-box {
border-bottom: 2rpx solid #dfdfdf;
}
.invoice-order-list {
padding: 40rpx 24rpx 0 24rpx;
.list-title {
font-size: 26rpx;
font-weight: 500;
color: #999999;
margin-right: 44rpx;
margin-bottom: 36rpx;
}
.list-desc {
font-size: 26rpx;
font-weight: 500;
color: #333333;
margin-bottom: 36rpx;
}
}
</style>

View File

@ -1,3 +1,4 @@
<!-- 错误界面 -->
<template>
<view class="error-page">
<s-empty
@ -8,7 +9,7 @@
actionText="重新连接"
@clickAction="onReconnect"
buttonColor="#ff3000"
></s-empty>
/>
<s-empty
v-else-if="errCode === 'TemplateError'"
icon="/static/internet-empty.png"
@ -17,7 +18,7 @@
actionText="重新加载"
@clickAction="onReconnect"
buttonColor="#ff3000"
></s-empty>
/>
<s-empty
v-else-if="errCode !== ''"
icon="/static/internet-empty.png"
@ -26,7 +27,7 @@
actionText="重新加载"
@clickAction="onReconnect"
buttonColor="#ff3000"
></s-empty>
/>
</view>
</template>
@ -37,16 +38,18 @@
const errCode = ref('');
const errMsg = ref('');
onLoad((options) => {
errCode.value = options.errCode;
errMsg.value = options.errMsg;
});
//
async function onReconnect() {
uni.reLaunch({
url: '/pages/index/index',
});
ShoproInit();
await ShoproInit();
}
</script>

View File

@ -140,15 +140,7 @@
showArrow
:border="false"
class="list-border"
></uni-list-item>
<uni-list-item
clickable
@tap="sheep.$router.go('/pages/user/invoice/list')"
title="发票管理"
showArrow
:border="false"
class="list-border"
></uni-list-item>
/>
</uni-list>
</view>
</uni-forms>
@ -316,7 +308,7 @@
// avatar: state.model.avatar,
// nickname: state.model.nickname,
// gender: state.model.gender,
// });
// });
const { code, data } = await sheep.$api.user.update({
avatar: state.model.avatar,
nickname: state.model.nickname,

View File

@ -1,277 +0,0 @@
<template>
<s-layout :title="state.model.id ? '编辑发票' : '添加发票'">
<uni-forms
ref="invoiceFormRef"
v-model="state.model"
:rules="state.rules"
validateTrigger="bind"
labelWidth="160"
labelAlign="left"
border
:labelStyle="{ fontWeight: 'bold' }"
>
<view class="bg-white form-box ss-p-x-30">
<uni-forms-item name="type" label="发票类型">
<view class="ss-flex ss-col-center ss-h-100">
<radio-group @change="onChange" class="ss-flex ss-col-center">
<label class="radio" v-for="item in invoiceTypeList" :key="item.value">
<view class="ss-flex ss-col-center ss-m-r-32">
<radio
:value="item.value"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
:checked="item.value === state.model.type"
/>
<view class="radio-name">
{{ item.name }}
</view>
</view>
</label>
</radio-group>
</view>
</uni-forms-item>
<view v-if="state.model.type === 'person'">
<uni-forms-item name="name" label="姓名">
<uni-easyinput
v-model="state.model.name"
type="text"
placeholder="请输入您的姓名(必填)"
placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
:inputBorder="false"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="mobile" label="手机号">
<uni-easyinput
v-model="state.model.mobile"
type="number"
placeholder="请输入手机号(必填)"
placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
:inputBorder="false"
></uni-easyinput>
</uni-forms-item>
</view>
<view v-if="state.model.type === 'company'">
<uni-forms-item name="name" label="单位名称">
<uni-easyinput
v-model="state.model.name"
type="text"
placeholder="请输入单位名称(必填)"
placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
:inputBorder="false"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="mobile" label="手机号">
<uni-easyinput
v-model="state.model.mobile"
type="number"
placeholder="请输入手机号(必填)"
placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
:inputBorder="false"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="tax_no" label="税号">
<uni-easyinput
v-model="state.model.tax_no"
type="text"
placeholder="请输入单位税号(必填)"
placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
:inputBorder="false"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="bank_name" label="开户银行">
<uni-easyinput
v-model="state.model.bank_name"
type="text"
placeholder="请输入对公账户开户银行"
placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
:inputBorder="false"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="bank_no" label="银行账号">
<uni-easyinput
v-model="state.model.bank_no"
type="text"
placeholder="请输入对公账户银行账号"
placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
:inputBorder="false"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item
name="address"
label="详细地址"
:formItemStyle="{ alignItems: 'flex-start' }"
:labelStyle="{ lineHeight: '5em' }"
class="textarea-item"
>
<uni-easyinput
:inputBorder="false"
type="textarea"
v-model="state.model.address"
placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
placeholder="请输入详细地址"
clearable
></uni-easyinput>
</uni-forms-item>
</view>
</view>
</uni-forms>
<su-fixed bottom :opacity="false" bg="" placeholder :noFixed="false" :index="10">
<view class="footer-box ss-flex-col ss-row-between ss-p-20">
<view class="ss-m-b-20">
<button class="ss-reset-button save-btn ui-Shadow-Main" @tap="onSave"></button>
</view>
<button v-if="state.model.id" class="ss-reset-button cancel-btn" @tap="onDelete">
删除
</button>
</view>
</su-fixed>
</s-layout>
</template>
<script setup>
import { computed, watch, ref, reactive, unref } from 'vue';
import sheep from '@/sheep';
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
import _ from 'lodash';
import { realName, mobile, taxNo, taxName } from '@/sheep/validate/form';
const invoiceFormRef = ref(null);
const invoiceTypeList = [
{
name: '个人',
value: 'person',
},
{
name: '企/事业单位',
value: 'company',
},
];
const state = reactive({
model: {
type: '',
name: '',
mobile: '',
tax_no: '',
bank_name: '',
bank_no: '',
address: '',
},
rules: {
name: taxName,
mobile,
tax_no: taxNo,
},
});
//
function onChange(e) {
state.model.type = e.detail.value;
}
const onSave = async () => {
const validate = await unref(invoiceFormRef)
.validate()
.catch((error) => {
console.log('error: ', error);
});
if (!validate) return;
let res = null;
if (state.model.id) {
res = await sheep.$api.user.invoice.update(state.model.id, state.model);
} else {
res = await sheep.$api.user.invoice.create(state.model);
}
if (res.error === 0) {
sheep.$router.back();
}
};
const onDelete = () => {
uni.showModal({
title: '提示',
content: '确认删除此发票信息吗?',
success: async function (res) {
if (res.confirm) {
const { error } = await sheep.$api.user.invoice.delete(state.model.id);
if (res.error === 0) {
sheep.$router.back();
}
}
},
});
};
onLoad(async (options) => {
if (options.id) {
let res = await sheep.$api.user.invoice.detail(options.id);
if (res.error === 0) {
state.model = {
...state.model,
...res.data,
};
}
} else {
state.model.type = 'person';
}
if (options.data) {
let data = JSON.parse(options.data);
state.model = {
...state.model,
...data,
};
}
});
</script>
<style lang="scss" scoped>
:deep() {
.uni-forms-item__label .label-text {
font-size: 28rpx !important;
color: #333333 !important;
line-height: normal !important;
}
.uni-easyinput__content-input {
font-size: 28rpx !important;
color: #333333 !important;
line-height: normal !important;
padding-left: 0 !important;
}
.uni-easyinput__content-textarea {
font-size: 28rpx !important;
color: #333333 !important;
line-height: normal !important;
margin-top: 4rpx;
}
.uni-icons {
font-size: 40rpx !important;
}
.is-textarea-icon {
margin-top: 14rpx;
}
.is-disabled {
color: #333333;
}
}
.footer-box {
.save-btn {
width: 710rpx;
height: 80rpx;
border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white;
}
.cancel-btn {
width: 710rpx;
height: 80rpx;
border-radius: 40rpx;
background: var(--ui-BG);
}
}
</style>

View File

@ -1,82 +0,0 @@
<template>
<s-layout title="发票管理" :bgStyle="{ color: '#FFF' }">
<view v-if="state.list.length">
<s-invoice-item
v-for="item in state.list"
hasBorderBottom
:key="item.id"
:item="item"
:isDefault="item.is_default"
@tap="onSelect(item)"
></s-invoice-item>
</view>
<su-fixed bottom placeholder>
<view class="footer-box ss-flex ss-row-between ss-p-20">
<button
class="add-btn ss-reset-button ui-Shadow-Main"
@tap="sheep.$router.go('/pages/user/invoice/edit')"
>
新增发票抬头
</button>
</view>
</su-fixed>
<s-empty
v-if="state.list.length === 0 && !state.loading"
text="暂无发票"
icon="/static/data-empty.png"
/>
</s-layout>
</template>
<script setup>
import { reactive } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import _ from 'lodash';
const state = reactive({
list: [],
loading: true,
});
const onSelect = (invoiceInfo) => {
uni.$emit('SELECT_INVOICE', {
invoiceInfo,
});
sheep.$router.back();
};
onShow(async () => {
state.list = (await sheep.$api.user.invoice.list()).data;
state.loading = false;
});
</script>
<style lang="scss" scoped>
// page{
// background-color: red;
// }
.footer-box {
.add-btn {
flex: 1;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
border-radius: 80rpx;
font-size: 30rpx;
font-weight: 500;
line-height: 80rpx;
color: $white;
position: relative;
z-index: 1;
}
.sync-wxaddress {
flex: 1;
line-height: 80rpx;
background: $white;
border-radius: 80rpx;
font-size: 30rpx;
font-weight: 500;
color: $dark-6;
margin-right: 16rpx;
}
}
</style>

View File

@ -15,12 +15,6 @@ export default {
// method: 'GET',
// params,
// }),
// 发票详情
invoice: (id) =>
request({
url: 'order/invoice/' + id,
method: 'GET',
}),
// 获取支付结果
payResult: (id) =>
request({

View File

@ -247,42 +247,6 @@ export default {
method: 'DELETE',
}),
},
invoice: {
list: () =>
request({
url: 'user/invoice',
method: 'GET',
custom: {},
}),
create: (data) =>
request({
url: 'user/invoice',
method: 'POST',
data,
custom: {
showSuccess: true,
},
}),
update: (id, data) =>
request({
url: 'user/invoice/' + id,
method: 'PUT',
data,
custom: {
showSuccess: true,
},
}),
detail: (id) =>
request({
url: 'user/invoice/' + id,
method: 'GET',
}),
delete: (id) =>
request({
url: 'user/invoice/' + id,
method: 'DELETE',
}),
},
favorite: {
list: (params) =>
request2({

View File

@ -1,96 +0,0 @@
<template>
<view
class="address-item ss-flex ss-row-between ss-col-center"
:class="[{ 'border-bottom': props.hasBorderBottom }]"
>
<view class="item-left" v-if="!_.isEmpty(props.item)">
<view class="address-text">{{ props.item.name }}</view>
<view class="person-text">{{ props.item.mobile }}</view>
</view>
<view v-else>
<view class="address-text">请选择收货地址</view>
</view>
<slot>
<button class="ss-reset-button edit-btn" @tap.stop="onEdit">
<view class="edit-icon ss-flex ss-row-center ss-col-center">
<image :src="sheep.$url.static('/static/img/shop/user/address/edit.png')"></image>
</view>
</button>
</slot>
</view>
</template>
<script setup>
/**
* 基础组件 - 地址卡片
*
* @param {String} icon = _icon-edit - icon
*
* @event {Function()} click - 点击
* @event {Function()} actionClick - 点击工具栏
*
* @slot - 默认插槽
*/
import sheep from '@/sheep';
import _ from 'lodash';
const props = defineProps({
item: {
type: Object,
default() {},
},
hasBorderBottom: {
type: Boolean,
defult: true,
},
});
const onEdit = () => {
sheep.$router.go('/pages/user/invoice/edit', {
id: props.item.id,
});
};
</script>
<style lang="scss" scoped>
.address-item {
padding: 30rpx;
.item-left {
width: 600rpx;
}
.area-text {
font-size: 26rpx;
font-weight: 400;
color: $dark-9;
}
.address-text {
font-size: 32rpx;
font-weight: 600;
color: #333333;
line-height: 48rpx;
}
.person-text {
font-size: 28rpx;
font-weight: 400;
color: $dark-9;
}
}
.edit-btn {
width: 44rpx;
height: 44rpx;
background: $gray-f;
border-radius: 50%;
.edit-icon {
width: 24rpx;
height: 24rpx;
}
}
image {
width: 100%;
height: 100%;
}
</style>