mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:13:26 +08:00
【优化】优化【我的服务卡】界面效果,调整为'正常', '过期', '作废', '已核销',同时优化查询及核销验证方法。
This commit is contained in:
@@ -98,4 +98,30 @@ namespace CoreCms.Net.Model.FromBody
|
||||
/// </summary>
|
||||
public string where { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据String类型id加where查询条件和order排序获取列表(一般用于直接id分页)
|
||||
/// </summary>
|
||||
public class FMPageByStringIdWhitStatus
|
||||
{
|
||||
public string id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前页码
|
||||
/// </summary>
|
||||
public int page { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 每页数据量
|
||||
/// </summary>
|
||||
public int limit { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int status { get; set; } = 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -383,7 +383,9 @@ const install = (Vue, vm) => {
|
||||
|
||||
//获取个人服务订单列表
|
||||
let getUserServicesPageList = (params, config = {}) => http.post('/Api/User/GetServicesPageList', params, { custom: { methodName: 'user.getServicesPageList', needToken: true } });
|
||||
//获取服务卡下用户券列表
|
||||
//获取单个服务订单
|
||||
let getServicesById = (params, config = {}) => http.post('/Api/User/GetServicesById', params, { custom: { methodName: 'user.getServicesTickets', needToken: true } });
|
||||
//获取单个服务订单下面服务券
|
||||
let getServicesTickets = (params, config = {}) => http.post('/Api/User/GetServicesTickets', params, { custom: { methodName: 'user.getServicesTickets', needToken: true } });
|
||||
|
||||
|
||||
@@ -598,6 +600,7 @@ const install = (Vue, vm) => {
|
||||
getServiceDetail,
|
||||
addServiceOrder,
|
||||
getUserServicesPageList,
|
||||
getServicesById,
|
||||
getServicesTickets,
|
||||
getverificationPageList,
|
||||
serviceLogDelete,
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
.top { color: #ff9900; font-size: 14px;
|
||||
.big { font-size: 25px; font-weight: bold; margin-right: 5px; }
|
||||
}
|
||||
.topD { color: #82848a; font-size: 14px; text-decoration: line-through;
|
||||
.big { font-size: 25px; font-weight: bold; margin-right: 5px; }
|
||||
}
|
||||
.type { font-size: 14px; color: #82848a; }
|
||||
.date { margin-top: 5px; font-size: 10px; color: #82848a; }
|
||||
}
|
||||
|
||||
@@ -46,13 +46,21 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="coreshop-padding-left-15 coreshop-padding-right-15 coreshop-padding-top-15">
|
||||
<u-subsection :list="items" :current="current" :animation="true" @change="onClickItem" active-color="#ff9900"></u-subsection>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="taobao">
|
||||
<view class="ticket" :class="item.status==3?'grayscale':''" v-if="list.length" v-for="(item, index) in list" :key="index" @click="showQrcodeBox(index)">
|
||||
<view class="ticket" :class="item.status==3?'grayscale':''" v-if="listData.length" v-for="(item, index) in listData" :key="index" @click="showQrcodeBox(index)">
|
||||
<view class="left">
|
||||
<view class="introduce">
|
||||
<view class="top">
|
||||
核销码:
|
||||
<text class="big">{{item.redeemCode}}</text>
|
||||
<view class="top" v-if="current==0">
|
||||
核销码:<text class="big">{{item.redeemCode}}</text>
|
||||
</view>
|
||||
<view class="topD" v-if="current!=0">
|
||||
核销码:<text class="big">{{item.redeemCode}}</text>
|
||||
</view>
|
||||
<view class="type">{{item.validityType==1?'长期有效':'限时间段内消费'}}</view>
|
||||
<view class="date u-line-1" v-if="item.validityStartTime && item.validityEndTime">{{item.validityStartTime}} 至 {{item.validityEndTime}}</view>
|
||||
@@ -84,9 +92,12 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: ['正常', '过期', '作废', '已核销'],
|
||||
current: 0,
|
||||
|
||||
page: 1,
|
||||
limit: 10,
|
||||
list: [],
|
||||
listData: [],
|
||||
serviceOrderId: '',
|
||||
info: {},
|
||||
show: false,
|
||||
@@ -101,7 +112,8 @@
|
||||
},
|
||||
onLoad(e) {
|
||||
this.serviceOrderId = e.id;
|
||||
this.getServicesTickets()
|
||||
this.getServicesById();
|
||||
this.getServicesTickets();
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
@@ -111,10 +123,33 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// tab点击切换
|
||||
onClickItem(index) {
|
||||
if (this.current !== index) {
|
||||
this.current = index;
|
||||
this.page = 1;
|
||||
this.listData = [];
|
||||
this.getServicesTickets();
|
||||
}
|
||||
},
|
||||
getServicesById() {
|
||||
let _this = this;
|
||||
let data = {
|
||||
id: this.serviceOrderId
|
||||
}
|
||||
this.$u.api.getServicesById(data).then(res => {
|
||||
if (res.status) {
|
||||
this.info = res.data;
|
||||
} else {
|
||||
_this.$u.toast(res.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
getServicesTickets() {
|
||||
let _this = this;
|
||||
let data = {
|
||||
id: this.serviceOrderId,
|
||||
status: this.current,
|
||||
page: this.page,
|
||||
limit: this.limit
|
||||
}
|
||||
@@ -122,11 +157,10 @@
|
||||
|
||||
this.$u.api.getServicesTickets(data).then(res => {
|
||||
if (res.status) {
|
||||
this.info = res.data.model;
|
||||
let _list = res.data.list
|
||||
this.list = [...this.list, ..._list]
|
||||
let _list = res.data
|
||||
this.listData = [...this.listData, ..._list]
|
||||
|
||||
if (res.data.count > _this.list.length) {
|
||||
if (res.data.count > _this.listData.length) {
|
||||
_this.page++
|
||||
_this.status = 'loadmore'
|
||||
} else {
|
||||
@@ -141,8 +175,11 @@
|
||||
this.show = false
|
||||
},
|
||||
showQrcodeBox(index) {
|
||||
if (this.current != 0) {
|
||||
return;
|
||||
}
|
||||
let _this = this;
|
||||
var item = _this.list[index];
|
||||
var item = _this.listData[index];
|
||||
if (item.status == 0) {
|
||||
_this.make(item.redeemCode);
|
||||
_this.show = true;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</view>
|
||||
|
||||
<view class="coreshop-flex">
|
||||
<view class='coreshop-btn exchange' @click="goServicesUserDetail(item.serviceOrderId)">立即使用</view>
|
||||
<view class='coreshop-btn exchange' @click="goServicesUserDetail(item.serviceOrderId)">查看详情</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -338,16 +338,30 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
return jm;
|
||||
}
|
||||
|
||||
if (ticket.status != (int)GlobalEnumVars.ServicesTicketStatus.正常)
|
||||
var order = await _userServicesOrderServices.QueryByClauseAsync(p => p.serviceOrderId == ticket.serviceOrderId);
|
||||
if (order == null)
|
||||
{
|
||||
jm.msg = "服务券状态不支持核销";
|
||||
jm.msg = "订单信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var service = await _servicesServices.QueryByIdAsync(ticket.serviceId);
|
||||
var service = await _servicesServices.QueryByClauseAsync(p => p.id == order.servicesId, true);
|
||||
if (service == null)
|
||||
{
|
||||
jm.msg = "服务项目获取失败";
|
||||
jm.msg = "服务商品获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var dt = DateTime.Now;
|
||||
if (service.validityType == 2 && dt > ticket.validityEndTime)
|
||||
{
|
||||
jm.msg = "服务券已经过期";
|
||||
return jm;
|
||||
}
|
||||
|
||||
if (ticket.status != (int)GlobalEnumVars.ServicesTicketStatus.正常)
|
||||
{
|
||||
jm.msg = "服务券状态不支持核销";
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
@@ -2092,19 +2092,19 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
|
||||
#endregion
|
||||
|
||||
#region 取得服务卡列表信息
|
||||
#region 获取单个服务订单
|
||||
/// <summary>
|
||||
/// 取得服务卡列表信息
|
||||
/// 获取单个服务订单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<WebApiCallBack> GetServicesTickets([FromBody] FMPageByStringId entity)
|
||||
public async Task<WebApiCallBack> GetServicesById([FromBody] FMStringId entity)
|
||||
{
|
||||
var jm = new WebApiCallBack();
|
||||
|
||||
|
||||
var order = await _userServicesOrderServices.QueryByClauseAsync(p => p.serviceOrderId == entity.id);
|
||||
var order = await _userServicesOrderServices.QueryByClauseAsync(p => p.serviceOrderId == entity.id && p.userId == _user.ID);
|
||||
if (order == null)
|
||||
{
|
||||
jm.msg = "订单信息获取失败";
|
||||
@@ -2139,10 +2139,65 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
var orders = await _userServicesTicketServices.QueryPageAsync(p => p.serviceOrderId == entity.id, p => p.createTime, OrderByType.Asc, entity.page, entity.limit);
|
||||
if (orders.Any())
|
||||
jm.status = true;
|
||||
jm.data = model;
|
||||
return jm;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 取得服务卡列表信息
|
||||
/// <summary>
|
||||
/// 取得服务卡列表信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<WebApiCallBack> GetServicesTickets([FromBody] FMPageByStringIdWhitStatus entity)
|
||||
{
|
||||
foreach (var item in orders)
|
||||
var jm = new WebApiCallBack();
|
||||
|
||||
var order = await _userServicesOrderServices.QueryByClauseAsync(p => p.serviceOrderId == entity.id && p.userId == _user.ID);
|
||||
if (order == null)
|
||||
{
|
||||
jm.msg = "订单信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var service = await _servicesServices.QueryByClauseAsync(p => p.id == order.servicesId, true);
|
||||
if (service == null)
|
||||
{
|
||||
jm.msg = "服务商品获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var status = entity.status switch
|
||||
{
|
||||
(int)GlobalEnumVars.ServicesTicketStatus.过期 => (int)GlobalEnumVars.ServicesTicketStatus.过期,
|
||||
(int)GlobalEnumVars.ServicesTicketStatus.作废 => (int)GlobalEnumVars.ServicesTicketStatus.作废,
|
||||
(int)GlobalEnumVars.ServicesTicketStatus.已核销 => (int)GlobalEnumVars.ServicesTicketStatus.已核销,
|
||||
_ => (int)GlobalEnumVars.ServicesTicketStatus.正常
|
||||
};
|
||||
|
||||
var where = PredicateBuilder.True<CoreCmsUserServicesTicket>();
|
||||
where = where.And(p => p.serviceOrderId == entity.id);
|
||||
|
||||
var dt = DateTime.Now;
|
||||
if (service.validityType == 2 && status == (int)GlobalEnumVars.ServicesTicketStatus.过期)
|
||||
{
|
||||
where = where.And(p => dt > p.validityEndTime);
|
||||
}
|
||||
else if (service.validityType == 2 && status != (int)GlobalEnumVars.ServicesTicketStatus.过期)
|
||||
{
|
||||
where = where.And(p => p.validityStartTime < dt && p.validityEndTime > dt && p.status == status);
|
||||
}
|
||||
|
||||
|
||||
var tickets = await _userServicesTicketServices.QueryPageAsync(where, p => p.createTime, OrderByType.Asc, entity.page, entity.limit);
|
||||
if (tickets.Any())
|
||||
{
|
||||
foreach (var item in tickets)
|
||||
{
|
||||
var entityModel = EnumHelper.GetEnumberEntity<GlobalEnumVars.ServicesTicketStatus>(item.status);
|
||||
item.statusStr = entityModel.title;
|
||||
@@ -2150,12 +2205,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
}
|
||||
|
||||
jm.status = true;
|
||||
jm.data = new
|
||||
{
|
||||
model,
|
||||
list = orders,
|
||||
count = orders.TotalCount,
|
||||
};
|
||||
jm.data = tickets;
|
||||
return jm;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user