【新增】用户如果下单时未填写发票信息,可通过订单详情提交发票申请,仅限支付后的订单。

This commit is contained in:
jianweie code
2023-11-21 01:10:05 +08:00
parent 96ffffb664
commit bfd15507a8
9 changed files with 432 additions and 20 deletions

View File

@@ -9526,6 +9526,26 @@
属性集合 属性集合
</summary> </summary>
</member> </member>
<member name="P:CoreCms.Net.Model.FromBody.FMSubmitInvoiceApply.type">
<summary>
发票类型
</summary>
</member>
<member name="P:CoreCms.Net.Model.FromBody.FMSubmitInvoiceApply.name">
<summary>
抬头信息
</summary>
</member>
<member name="P:CoreCms.Net.Model.FromBody.FMSubmitInvoiceApply.code">
<summary>
发票编码
</summary>
</member>
<member name="P:CoreCms.Net.Model.FromBody.FMSubmitInvoiceApply.orderId">
<summary>
订单编号
</summary>
</member>
<member name="T:CoreCms.Net.Model.FromBody.FMLogin"> <member name="T:CoreCms.Net.Model.FromBody.FMLogin">
<summary> <summary>
用户登录验证实体 用户登录验证实体

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreCms.Net.Model.FromBody
{
public class FMSubmitInvoiceApply
{
/// <summary>
/// 发票类型
/// </summary>
public int type { get; set; }
/// <summary>
/// 抬头信息
/// </summary>
public string name { get; set; }
/// <summary>
/// 发票编码
/// </summary>
public string code { get; set; } = string.Empty;
/// <summary>
/// 订单编号
/// </summary>
public string orderId { get; set; }
}
}

View File

@@ -422,6 +422,11 @@ const install = (Vue, vm) => {
//获取全局促销列表 //获取全局促销列表
let getPromotionList = (params, config = {}) => http.post('/Api/Promotion/GetPromotionList', params, { custom: { methodName: 'promotion.getPromotionList', needToken: false } }); let getPromotionList = (params, config = {}) => http.post('/Api/Promotion/GetPromotionList', params, { custom: { methodName: 'promotion.getPromotionList', needToken: false } });
//获取发票是否开具
let checkInvoice = (params, config = {}) => http.post('/Api/Order/CheckInvoice', params, { custom: { methodName: 'order.checkInvoice', needToken: true } });
//提交发票申请
let submitInvoiceApply = (params, config = {}) => http.post('/Api/Order/SubmitInvoiceApply', params, { custom: { methodName: 'order.submitInvoiceApply', needToken: true } });
@@ -625,7 +630,9 @@ const install = (Vue, vm) => {
uploadFilesFByBase64, uploadFilesFByBase64,
getPromotionList getPromotionList,
checkInvoice,
submitInvoiceApply
}; };
} }

View File

@@ -62,13 +62,14 @@
"navigationBarTitleText": "直播间" "navigationBarTitleText": "直播间"
} }
} }
], ]
"plugins": { //,
"live-player-plugin": { //"plugins": {
"version": "1.3.5", // 注意该直播组件最新版本号 // "live-player-plugin": {
"provider": "wx2b03c6e691cd7370" // 必须填该直播组件appid不是小程序的appid // "version": "1.3.5", // 注意该直播组件最新版本号
} // "provider": "wx2b03c6e691cd7370" // 必须填该直播组件appid不是小程序的appid
} // }
//}
}, },
{ {
"root": "pages/article", "root": "pages/article",
@@ -605,6 +606,13 @@
"navigationBarTitleText": "物流信息" "navigationBarTitleText": "物流信息"
} }
}, },
{
"path": "order/invoice/invoice",
"style": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "申请发票"
}
},
{ {
"path": "distribution/index/index", "path": "distribution/index/index",
"style": { "style": {

View File

@@ -474,6 +474,9 @@
<view class="coreshop-width-fit-content coreshop-padding-left-10 coreshop-padding-right-10" v-if="orderInfo.billAftersalesId && orderInfo.billAftersalesId != false"> <view class="coreshop-width-fit-content coreshop-padding-left-10 coreshop-padding-right-10" v-if="orderInfo.billAftersalesId && orderInfo.billAftersalesId != false">
<u-button class='coreshop-bg-red coreshop-margin-left-10 coreshop-margin-right-10' size="small" @click="showCustomerService(orderInfo)">查看售后</u-button> <u-button class='coreshop-bg-red coreshop-margin-left-10 coreshop-margin-right-10' size="small" @click="showCustomerService(orderInfo)">查看售后</u-button>
</view> </view>
<view class="coreshop-width-fit-content coreshop-padding-left-10 coreshop-padding-right-10" v-if="orderInfo.status === 1 && orderInfo.payStatus > 1 && orderInfo.invoice && orderInfo.invoice.type == 1">
<u-button class='coreshop-margin-left-10 coreshop-margin-right-10' type="primary " size="small" @click="goApplyForInvoice(orderInfo.orderId)">申请发票</u-button>
</view>
</view> </view>
<u-popup :show="show" mode="center" width="180px" height="180px" @close="close"> <u-popup :show="show" mode="center" width="180px" height="180px" @close="close">
@@ -703,6 +706,12 @@
url: '/pages/member/order/invitationGroup/invitationGroup?orderId=' + this.orderInfo.orderId + '&closeTime=' + this.teamInfo.closeTime url: '/pages/member/order/invitationGroup/invitationGroup?orderId=' + this.orderInfo.orderId + '&closeTime=' + this.teamInfo.closeTime
}) })
}, },
//邀请拼单
goApplyForInvoice(orderId) {
uni.navigateTo({
url: '/pages/member/order/invoice/invoice?orderId=' + this.orderInfo.orderId
})
},
//拼团信息 //拼团信息
getTeam(id) { getTeam(id) {
this.$u.api.getOrderPinTuanTeamInfo({ this.$u.api.getOrderPinTuanTeamInfo({

View File

@@ -0,0 +1,9 @@
.cu-form-group .title { min-width: calc(4em + 15px); }
.coreshop-bottomBox .coreshop-btn { width: 100%; }
.cheque { position: relative; }
.cheque-content { position: absolute; left: 7.5px; z-index: 10; width: calc(100% - 15px);; background-color: #fff; box-shadow: 0 0 0.666667vw 0.4vw rgba(0, 0, 0, .13); border-radius: 5px; padding: 10px; }
.tips-item { margin-bottom: 10px; }
.tips-name { font-size: 16px; line-height: 17.5px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 5px; }
.sub-div { display: flex; width: 100%; justify-content: space-between; height: 15px; font-size: 12px; line-height: 15px; color: #999; }
.num { display: inline-block; }

View File

@@ -0,0 +1,228 @@
<template>
<view>
<u-toast ref="uToast" /><u-no-network></u-no-network>
<u-navbar title="申请发票" safeAreaInsetTop fixed placeholder @leftClick="goNavigateBack"></u-navbar>
<view class="coreshop-bg-white">
<u--form :model="model" :rules="rules" ref="uForm" errorType="message" labelPosition="top" labelWidth="100">
<view class="coreshop-padding-10">
<u-form-item label="发票类型" prop="typeName" borderBottom>
<u-radio-group v-model="model.typeName" placement="column">
<u-radio :customStyle="{marginBottom: '8px'}" @change="radioChange" v-for="(item, index) in radioItems" :key="index" :name="item.name" :label="item.name"></u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="发票抬头" class="cheque" prop="name" borderBottom>
<u--input v-model="model.name" placeholder='公司/个人名称' @input="getCheque" />
<view class="cheque-content" v-show="isShow">
<view class="tips-item" v-for="(item,index) in chequeLisit" :key="index" @click="chooseCheque(item)">
<view class="tips-name">
{{item.name|| ''}}
</view>
<view class="sub-div">
<view class="tax-no">
{{item.code|| ''}}
</view>
<view class="tips-num">
<view class="num">
{{item.frequency|| ''}}
</view>
人使用过
</view>
</view>
</view>
</view>
</u-form-item>
<u-form-item label="纳税人识别号" prop="code" v-show="type === '3'" borderBottom>
<u--input v-model="model.code" placeholder='纳税人识别号' />
</u-form-item>
<u-form-item label="发票内容" v-show="type === '3'" borderBottom>
<view>明细</view>
</u-form-item>
<view class="coreshop-margin-top-20">
<u--text type="error" text="注:"></u--text>
<u--text text="个人发票只需录入抬头名称为个人姓名即可,企业发票需要提交公司名称和纳税人识别号。" size="13"></u--text>
<u--text text="发票一旦开具,不可修改,请认真填写。" size="13"></u--text>
<u--text text="发票将在订单完成后7个工作日开具。" size="13"></u--text>
<u--text text="电子发票可在订单详情中下载纸质发票将在订单完成后7个工作日内寄出。" size="13"></u--text>
</view>
</view>
<view class="coreshop-bg-white coreshop-footer-fixed coreshop-foot-padding-bottom">
<u-button class="coreshop-percent-100" type="error" size="normal" @click="saveInvoice">提交申请</u-button>
</view>
</u--form>
</view>
<!-- 登录提示 -->
<coreshop-login-modal></coreshop-login-modal>
</view>
</template>
<script>
export default {
data() {
return {
orderId: '',
radioItems: [
{
name: '企业发票',
value: '3'
}, {
name: '个人发票',
value: '2'
}
],
type: '3', // 发票类型 1不开发票、2个人发票、3公司发票
model: {
typeName: '', // 发票类型 2个人 3企业
name: '', // 抬头名称
code: '', // 税号
},
isShow: false,
chequeLisit: [],
rules: {
typeName: [
{
required: true,
message: '请选择发票类型',
trigger: ['change', 'blur'],
}
],
name: [
{
required: true,
message: '请输入发票抬头',
trigger: ['change', 'blur'],
}
],
code: [
{
validator: (rule, value, callback) => {
if (this.type === '3' && !this.model.code) {
return false;
}
return true;
},
message: '请输入发票税务编号'
}
],
},
}
},
onReady() {
this.$refs.uForm.setRules(this.rules);
},
onLoad(options) {
this.orderId = options.orderId;
if (this.orderId) {
this.checkInvoice();
} else {
this.$refs.uToast.show({
message: '获取失败', type: 'error', complete: function () {
uni.navigateBack({
delta: 1
});
}
});
}
},
methods: {
// 获取订单详情
checkInvoice() {
let _this = this
let data = {
id: _this.orderId
}
_this.$u.api.checkInvoice(data).then(res => {
if (res.status) {
if (res.data) {
this.$refs.uToast.show({
message: '此订单已经提交发票申请。', type: 'error', complete: function () {
uni.navigateBack({
delta: 1
});
}
});
}
} else {
_this.$u.toast(res.msg)
}
})
},
// 选中某个单选框时由radio时触发
radioChange(e) {
this.radioItems.forEach(item => {
if (item.name === e) {
this.type = item.value
}
})
},
// 保存发票信息
saveInvoice() {
this.$refs.uForm.validate().then(res => {
let data = {
type: this.type,
name: this.model.name
}
// 不是企业类型不需要税号
data.code = this.type === '3' ? this.model.code : '';
data.orderId = this.orderId;
console.log(data);
this.$u.api.submitInvoiceApply(data).then(res => {
if (res.status) {
if (res.data) {
this.$refs.uToast.show({
message: '发票申请提交成功。', type: 'success', complete: function () {
uni.navigateBack({
delta: 1
});
}
});
} else {
this.$u.toast(res.msg)
}
} else {
this.$u.toast(res.msg)
}
});
}).catch(errors => {
uni.$u.toast('提交的数据校验失败,请输入合法信息!')
})
},
getCheque(event) {
let name = event;
if (name != '') {
let data = {
name: name
}
this.$u.api.getTaxInfo(data).then(res => {
if (res.status) {
if (res.data.length != 0) {
this.isShow = true
this.chequeLisit = res.data
} else {
// this.isShow = false
}
} else {
this.$u.toast(res.msg)
}
});
} else {
this.isShow = false
}
},
chooseCheque(item) {
this.model.name = item.name;
this.model.code = item.code;
this.isShow = false;
this.type = '3';
this.model.typeName = this.radioItems[1].name;
}
}
}
</script>
<style scoped lang="scss">
@import "invoice.scss";
</style>

View File

@@ -45,16 +45,12 @@ namespace CoreCms.Net.Web.WebApi.Controllers
private readonly ICoreCmsAreaServices _areaServices; private readonly ICoreCmsAreaServices _areaServices;
private readonly ICoreCmsBillReshipServices _reshipServices; private readonly ICoreCmsBillReshipServices _reshipServices;
private readonly ICoreCmsShipServices _shipServices; private readonly ICoreCmsShipServices _shipServices;
private readonly ICoreCmsBillDeliveryServices _billDeliveryServices;
private readonly ICoreCmsLogisticsServices _logisticsServices; private readonly ICoreCmsLogisticsServices _logisticsServices;
private readonly ICoreCmsGoodsServices _goodsServices;
private readonly ICoreCmsStoreServices _storeServices;
private readonly ICoreCmsOrderDistributionModelServices _orderDistributionModelServices; private readonly ICoreCmsOrderDistributionModelServices _orderDistributionModelServices;
private readonly ICoreCmsBillPaymentsServices _billPaymentsServices;
private readonly IRedisOperationRepository _redisOperationRepository; private readonly IRedisOperationRepository _redisOperationRepository;
private readonly ICoreCmsUserServices _userServices; private readonly ICoreCmsUserServices _userServices;
private readonly ICoreCmsClerkServices _clerkServices; private readonly ICoreCmsClerkServices _clerkServices;
private readonly ICoreCmsInvoiceServices _invoiceServices;
/// <summary> /// <summary>
@@ -65,8 +61,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
, ICoreCmsBillAftersalesServices aftersalesServices , ICoreCmsBillAftersalesServices aftersalesServices
, ICoreCmsSettingServices settingServices , ICoreCmsSettingServices settingServices
, ICoreCmsAreaServices areaServices , ICoreCmsAreaServices areaServices
, ICoreCmsBillReshipServices reshipServices, ICoreCmsShipServices shipServices , ICoreCmsBillReshipServices reshipServices, ICoreCmsShipServices shipServices, ICoreCmsLogisticsServices logisticsServices, ICoreCmsOrderDistributionModelServices orderDistributionModelServices, IRedisOperationRepository redisOperationRepository, ICoreCmsUserServices userServices, ICoreCmsClerkServices clerkServices, ICoreCmsInvoiceServices invoiceServices)
, ICoreCmsBillDeliveryServices billDeliveryServices, ICoreCmsLogisticsServices logisticsServices, ICoreCmsGoodsServices goodsServices, ICoreCmsStoreServices storeServices, ICoreCmsOrderDistributionModelServices orderDistributionModelServices, IRedisOperationRepository redisOperationRepository, ICoreCmsBillPaymentsServices billPaymentsServices, ICoreCmsUserServices userServices, ICoreCmsClerkServices clerkServices)
{ {
_user = user; _user = user;
_orderServices = orderServices; _orderServices = orderServices;
@@ -75,15 +70,12 @@ namespace CoreCms.Net.Web.WebApi.Controllers
_areaServices = areaServices; _areaServices = areaServices;
_reshipServices = reshipServices; _reshipServices = reshipServices;
_shipServices = shipServices; _shipServices = shipServices;
_billDeliveryServices = billDeliveryServices;
_logisticsServices = logisticsServices; _logisticsServices = logisticsServices;
_goodsServices = goodsServices;
_storeServices = storeServices;
_orderDistributionModelServices = orderDistributionModelServices; _orderDistributionModelServices = orderDistributionModelServices;
_redisOperationRepository = redisOperationRepository; _redisOperationRepository = redisOperationRepository;
_billPaymentsServices = billPaymentsServices;
_userServices = userServices; _userServices = userServices;
_clerkServices = clerkServices; _clerkServices = clerkServices;
_invoiceServices = invoiceServices;
} }
@@ -681,6 +673,100 @@ namespace CoreCms.Net.Web.WebApi.Controllers
#endregion #endregion
#region =======================================================
/// <summary>
/// 检查订单发票是否已经开具
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> CheckInvoice([FromBody] FMStringId entity)
{
var jm = new WebApiCallBack();
if (string.IsNullOrEmpty(entity.id))
{
jm.msg = "请提交订单编码。";
return jm;
}
var isHave = await _invoiceServices.ExistsAsync(p => p.sourceId == entity.id && p.category == (int)GlobalEnumVars.OrderTaxCategory.Order);
jm.status = true;
jm.data = isHave;
return jm;
}
#endregion
#region =======================================================
/// <summary>
/// 提交发票申请
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> SubmitInvoiceApply([FromBody] FMSubmitInvoiceApply entity)
{
var jm = new WebApiCallBack();
if (entity.type == 3 && string.IsNullOrEmpty(entity.code))
{
jm.msg = "企业发票申请必须填写纳税人识别号";
return jm;
}
var isHave = await _invoiceServices.ExistsAsync(p => p.sourceId == entity.orderId && p.category == (int)GlobalEnumVars.OrderTaxCategory.Order);
if (isHave)
{
jm.msg = "此订单已经存在发票信息。";
return jm;
}
var order = await _orderServices.QueryByClauseAsync(p => p.orderId == entity.orderId);
if (order == null)
{
jm.msg = "订单查询失败。";
return jm;
}
if (order.userId != _user.ID)
{
jm.msg = "你无权申请发票。";
return jm;
}
//组装发票信息
var taxInfo = new CoreCmsInvoice
{
category = (int)GlobalEnumVars.OrderTaxCategory.Order,
sourceId = order.orderId,
userId = order.userId,
type = entity.type,
title = entity.name,
taxNumber = entity.code,
amount = order.orderAmount,
status = (int)GlobalEnumVars.OrderTaxStatus.No,
createTime = DateTime.Now
};
var bl = await _invoiceServices.InsertAsync(taxInfo) > 0;
jm.status = true;
jm.data = bl;
return jm;
}
#endregion
} }

View File

@@ -571,7 +571,7 @@
订单调用接口数据 订单调用接口数据
</summary> </summary>
</member> </member>
<member name="M:CoreCms.Net.Web.WebApi.Controllers.OrderController.#ctor(CoreCms.Net.Auth.HttpContextUser.IHttpContextUser,CoreCms.Net.IServices.ICoreCmsOrderServices,CoreCms.Net.IServices.ICoreCmsBillAftersalesServices,CoreCms.Net.IServices.ICoreCmsSettingServices,CoreCms.Net.IServices.ICoreCmsAreaServices,CoreCms.Net.IServices.ICoreCmsBillReshipServices,CoreCms.Net.IServices.ICoreCmsShipServices,CoreCms.Net.IServices.ICoreCmsBillDeliveryServices,CoreCms.Net.IServices.ICoreCmsLogisticsServices,CoreCms.Net.IServices.ICoreCmsGoodsServices,CoreCms.Net.IServices.ICoreCmsStoreServices,CoreCms.Net.IServices.ICoreCmsOrderDistributionModelServices,CoreCms.Net.Caching.AutoMate.RedisCache.IRedisOperationRepository,CoreCms.Net.IServices.ICoreCmsBillPaymentsServices,CoreCms.Net.IServices.ICoreCmsUserServices,CoreCms.Net.IServices.ICoreCmsClerkServices)"> <member name="M:CoreCms.Net.Web.WebApi.Controllers.OrderController.#ctor(CoreCms.Net.Auth.HttpContextUser.IHttpContextUser,CoreCms.Net.IServices.ICoreCmsOrderServices,CoreCms.Net.IServices.ICoreCmsBillAftersalesServices,CoreCms.Net.IServices.ICoreCmsSettingServices,CoreCms.Net.IServices.ICoreCmsAreaServices,CoreCms.Net.IServices.ICoreCmsBillReshipServices,CoreCms.Net.IServices.ICoreCmsShipServices,CoreCms.Net.IServices.ICoreCmsLogisticsServices,CoreCms.Net.IServices.ICoreCmsOrderDistributionModelServices,CoreCms.Net.Caching.AutoMate.RedisCache.IRedisOperationRepository,CoreCms.Net.IServices.ICoreCmsUserServices,CoreCms.Net.IServices.ICoreCmsClerkServices,CoreCms.Net.IServices.ICoreCmsInvoiceServices)">
<summary> <summary>
构造函数 构造函数
</summary> </summary>
@@ -678,6 +678,18 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:CoreCms.Net.Web.WebApi.Controllers.OrderController.CheckInvoice(CoreCms.Net.Model.FromBody.FMStringId)">
<summary>
检查订单发票是否已经开具
</summary>
<returns></returns>
</member>
<member name="M:CoreCms.Net.Web.WebApi.Controllers.OrderController.SubmitInvoiceApply(CoreCms.Net.Model.FromBody.FMSubmitInvoiceApply)">
<summary>
提交发票申请
</summary>
<returns></returns>
</member>
<member name="T:CoreCms.Net.Web.WebApi.Controllers.PageController"> <member name="T:CoreCms.Net.Web.WebApi.Controllers.PageController">
<summary> <summary>
页面接口 页面接口