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>
|
/// </summary>
|
||||||
public string where { get; set; }
|
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 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 } });
|
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,
|
getServiceDetail,
|
||||||
addServiceOrder,
|
addServiceOrder,
|
||||||
getUserServicesPageList,
|
getUserServicesPageList,
|
||||||
|
getServicesById,
|
||||||
getServicesTickets,
|
getServicesTickets,
|
||||||
getverificationPageList,
|
getverificationPageList,
|
||||||
serviceLogDelete,
|
serviceLogDelete,
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
.top { color: #ff9900; font-size: 14px;
|
.top { color: #ff9900; font-size: 14px;
|
||||||
.big { font-size: 25px; font-weight: bold; margin-right: 5px; }
|
.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; }
|
.type { font-size: 14px; color: #82848a; }
|
||||||
.date { margin-top: 5px; font-size: 10px; color: #82848a; }
|
.date { margin-top: 5px; font-size: 10px; color: #82848a; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,25 +34,33 @@
|
|||||||
<view class="coreshop-text-gray coreshop-font-xs coreshop-flex coreshop-flex-nowrap coreshop-padding-10">
|
<view class="coreshop-text-gray coreshop-font-xs coreshop-flex coreshop-flex-nowrap coreshop-padding-10">
|
||||||
兑换级别:
|
兑换级别:
|
||||||
<view class="coreshop-width-fit-content coreshop-padding-right-5" v-if="info.allowedMemberships && info.allowedMemberships.length>0" v-for="(item, index) in info.allowedMemberships" :key="index">
|
<view class="coreshop-width-fit-content coreshop-padding-right-5" v-if="info.allowedMemberships && info.allowedMemberships.length>0" v-for="(item, index) in info.allowedMemberships" :key="index">
|
||||||
<u-tag :text="item" mode="light" size="mini" class="coreshop-margin-right-5" />
|
<u-tag :text="item" mode="light" size="mini" class="coreshop-margin-right-5" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="coreshop-text-gray coreshop-font-xs coreshop-flex coreshop-flex-nowrap coreshop-padding-10">
|
<view class="coreshop-text-gray coreshop-font-xs coreshop-flex coreshop-flex-nowrap coreshop-padding-10">
|
||||||
兑换门店:
|
兑换门店:
|
||||||
<view class="coreshop-width-fit-content coreshop-padding-right-3" v-if="info.consumableStores && info.consumableStores.length>0" v-for="(item, index) in info.consumableStores" :key="index">
|
<view class="coreshop-width-fit-content coreshop-padding-right-3" v-if="info.consumableStores && info.consumableStores.length>0" v-for="(item, index) in info.consumableStores" :key="index">
|
||||||
<view class="coreshop-bg-orange-light sm coreshop-padding-4 coreshop-margin-right-5">{{item}}</view>
|
<view class="coreshop-bg-orange-light sm coreshop-padding-4 coreshop-margin-right-5">{{item}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</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="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="left">
|
||||||
<view class="introduce">
|
<view class="introduce">
|
||||||
<view class="top">
|
<view class="top" v-if="current==0">
|
||||||
核销码:
|
核销码:<text class="big">{{item.redeemCode}}</text>
|
||||||
<text class="big">{{item.redeemCode}}</text>
|
</view>
|
||||||
|
<view class="topD" v-if="current!=0">
|
||||||
|
核销码:<text class="big">{{item.redeemCode}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="type">{{item.validityType==1?'长期有效':'限时间段内消费'}}</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>
|
<view class="date u-line-1" v-if="item.validityStartTime && item.validityEndTime">{{item.validityStartTime}} 至 {{item.validityEndTime}}</view>
|
||||||
@@ -77,16 +85,19 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import uQRCode from '@/common/utils/uqrcode.js'
|
import uQRCode from '@/common/utils/uqrcode.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
items: ['正常', '过期', '作废', '已核销'],
|
||||||
|
current: 0,
|
||||||
|
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
list: [],
|
listData: [],
|
||||||
serviceOrderId: '',
|
serviceOrderId: '',
|
||||||
info: {},
|
info: {},
|
||||||
show: false,
|
show: false,
|
||||||
@@ -101,7 +112,8 @@
|
|||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.serviceOrderId = e.id;
|
this.serviceOrderId = e.id;
|
||||||
this.getServicesTickets()
|
this.getServicesById();
|
||||||
|
this.getServicesTickets();
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
},
|
},
|
||||||
@@ -111,10 +123,33 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
getServicesTickets() {
|
||||||
let _this = this;
|
let _this = this;
|
||||||
let data = {
|
let data = {
|
||||||
id: this.serviceOrderId,
|
id: this.serviceOrderId,
|
||||||
|
status: this.current,
|
||||||
page: this.page,
|
page: this.page,
|
||||||
limit: this.limit
|
limit: this.limit
|
||||||
}
|
}
|
||||||
@@ -122,11 +157,10 @@
|
|||||||
|
|
||||||
this.$u.api.getServicesTickets(data).then(res => {
|
this.$u.api.getServicesTickets(data).then(res => {
|
||||||
if (res.status) {
|
if (res.status) {
|
||||||
this.info = res.data.model;
|
let _list = res.data
|
||||||
let _list = res.data.list
|
this.listData = [...this.listData, ..._list]
|
||||||
this.list = [...this.list, ..._list]
|
|
||||||
|
|
||||||
if (res.data.count > _this.list.length) {
|
if (res.data.count > _this.listData.length) {
|
||||||
_this.page++
|
_this.page++
|
||||||
_this.status = 'loadmore'
|
_this.status = 'loadmore'
|
||||||
} else {
|
} else {
|
||||||
@@ -141,8 +175,11 @@
|
|||||||
this.show = false
|
this.show = false
|
||||||
},
|
},
|
||||||
showQrcodeBox(index) {
|
showQrcodeBox(index) {
|
||||||
|
if (this.current != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let _this = this;
|
let _this = this;
|
||||||
var item = _this.list[index];
|
var item = _this.listData[index];
|
||||||
if (item.status == 0) {
|
if (item.status == 0) {
|
||||||
_this.make(item.redeemCode);
|
_this.make(item.redeemCode);
|
||||||
_this.show = true;
|
_this.show = true;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="coreshop-flex">
|
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -338,16 +338,30 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
return jm;
|
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;
|
return jm;
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = await _servicesServices.QueryByIdAsync(ticket.serviceId);
|
var service = await _servicesServices.QueryByClauseAsync(p => p.id == order.servicesId, true);
|
||||||
if (service == null)
|
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;
|
return jm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1248,7 +1248,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
{
|
{
|
||||||
jm.msg = "数据处理异常";
|
jm.msg = "数据处理异常";
|
||||||
jm.otherData = e;
|
jm.otherData = e;
|
||||||
NLogUtil.WriteFileLog(NLog.LogLevel.Error, LogType.ApiRequest, "用户支付支付",JsonConvert.SerializeObject(jm));
|
NLogUtil.WriteFileLog(NLog.LogLevel.Error, LogType.ApiRequest, "用户支付支付", JsonConvert.SerializeObject(jm));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -2092,19 +2092,19 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 取得服务卡列表信息
|
#region 获取单个服务订单
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 取得服务卡列表信息
|
/// 获取单个服务订单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public async Task<WebApiCallBack> GetServicesTickets([FromBody] FMPageByStringId entity)
|
public async Task<WebApiCallBack> GetServicesById([FromBody] FMStringId entity)
|
||||||
{
|
{
|
||||||
var jm = new WebApiCallBack();
|
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)
|
if (order == null)
|
||||||
{
|
{
|
||||||
jm.msg = "订单信息获取失败";
|
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);
|
jm.status = true;
|
||||||
if (orders.Any())
|
jm.data = model;
|
||||||
|
return jm;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 取得服务卡列表信息
|
||||||
|
/// <summary>
|
||||||
|
/// 取得服务卡列表信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Authorize]
|
||||||
|
public async Task<WebApiCallBack> GetServicesTickets([FromBody] FMPageByStringIdWhitStatus entity)
|
||||||
|
{
|
||||||
|
var jm = new WebApiCallBack();
|
||||||
|
|
||||||
|
var order = await _userServicesOrderServices.QueryByClauseAsync(p => p.serviceOrderId == entity.id && p.userId == _user.ID);
|
||||||
|
if (order == null)
|
||||||
{
|
{
|
||||||
foreach (var item in orders)
|
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);
|
var entityModel = EnumHelper.GetEnumberEntity<GlobalEnumVars.ServicesTicketStatus>(item.status);
|
||||||
item.statusStr = entityModel.title;
|
item.statusStr = entityModel.title;
|
||||||
@@ -2150,12 +2205,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
jm.status = true;
|
jm.status = true;
|
||||||
jm.data = new
|
jm.data = tickets;
|
||||||
{
|
|
||||||
model,
|
|
||||||
list = orders,
|
|
||||||
count = orders.TotalCount,
|
|
||||||
};
|
|
||||||
return jm;
|
return jm;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user