mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 15:43:27 +08:00
【新增】新增全局优惠展示接口,前端商品详情增加全局优惠显示入口。
This commit is contained in:
@@ -90,5 +90,12 @@ namespace CoreCms.Net.IServices
|
||||
/// <param name="promotionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> ReceiveCoupon(int promotionId);
|
||||
|
||||
/// <summary>
|
||||
/// 获取全局促销列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<GetPromotionResult>> GetPromotionList(int type = (int)GlobalEnumVars.PromotionType.Promotion);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11603,6 +11603,101 @@
|
||||
颜色
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.id">
|
||||
<summary>
|
||||
序列
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.name">
|
||||
<summary>
|
||||
促销名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.type">
|
||||
<summary>
|
||||
类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.sort">
|
||||
<summary>
|
||||
排序
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.parameters">
|
||||
<summary>
|
||||
其它参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.maxNums">
|
||||
<summary>
|
||||
每人限购数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.maxGoodsNums">
|
||||
<summary>
|
||||
每个商品活动数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.maxRecevieNums">
|
||||
<summary>
|
||||
最大领取数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.startTime">
|
||||
<summary>
|
||||
开始时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.endTime">
|
||||
<summary>
|
||||
结束时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.isExclusive">
|
||||
<summary>
|
||||
是否排他
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.isAutoReceive">
|
||||
<summary>
|
||||
是否自动领取
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.isEnable">
|
||||
<summary>
|
||||
是否开启
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.isDel">
|
||||
<summary>
|
||||
是否删除
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.effectiveDays">
|
||||
<summary>
|
||||
有效天数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.effectiveHours">
|
||||
<summary>
|
||||
有效小时
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.conditions">
|
||||
<summary>
|
||||
条件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.ViewModels.DTO.GetPromotionResult.results">
|
||||
<summary>
|
||||
结果
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Model.ViewModels.DTO.RandUser">
|
||||
<summary>
|
||||
随机用户数据(用于首页返回购买用户随机数据)
|
||||
|
||||
108
CoreCms.Net.Model/ViewModels/DTO/Promotion.cs
Normal file
108
CoreCms.Net.Model/ViewModels/DTO/Promotion.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CoreCms.Net.Model.ViewModels.DTO
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GetPromotionResult
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 序列
|
||||
/// </summary>
|
||||
public System.Int32 id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 促销名称
|
||||
/// </summary>
|
||||
public System.String name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public System.Int32 type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public System.Int32 sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其它参数
|
||||
/// </summary>
|
||||
public System.String parameters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 每人限购数量
|
||||
/// </summary>
|
||||
public System.Int32 maxNums { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 每个商品活动数量
|
||||
/// </summary>
|
||||
public System.Int32 maxGoodsNums { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大领取数量
|
||||
/// </summary>
|
||||
public System.Int32 maxRecevieNums { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
public System.DateTime startTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
public System.DateTime endTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否排他
|
||||
/// </summary>
|
||||
public System.Boolean isExclusive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否自动领取
|
||||
/// </summary>
|
||||
public System.Boolean isAutoReceive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启
|
||||
/// </summary>
|
||||
public System.Boolean isEnable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
/// </summary>
|
||||
public System.Boolean isDel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 有效天数
|
||||
/// </summary>
|
||||
public System.Int32 effectiveDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 有效小时
|
||||
/// </summary>
|
||||
public System.Int32 effectiveHours { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条件
|
||||
/// </summary>
|
||||
public List<string> conditions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结果
|
||||
/// </summary>
|
||||
public List<string> results { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NetTaste;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
@@ -733,5 +734,176 @@ namespace CoreCms.Net.Services
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取全局促销列表
|
||||
|
||||
/// <summary>
|
||||
/// 获取全局促销列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<GetPromotionResult>> GetPromotionList(int type = (int)GlobalEnumVars.PromotionType.Promotion)
|
||||
{
|
||||
var where = PredicateBuilder.True<CoreCmsPromotion>();
|
||||
var dt = DateTime.Now;
|
||||
where = where.And(p => p.startTime < dt); //判断优惠券失效时间 是否可领取
|
||||
where = where.And(p => p.endTime > dt); //判断优惠券失效时间 是否可领取
|
||||
where = where.And(p => p.isEnable); //启用状态
|
||||
where = where.And(p => p.type == type); //促销类型
|
||||
where = where.And(p => !p.isDel); //是否被删除
|
||||
|
||||
var data = await _dal.QueryPageAndChildsAsync(where, p => p.sort, OrderByType.Asc, true, 1, 1000);
|
||||
|
||||
if (data != null && data.Any())
|
||||
{
|
||||
var goodsServices = _serviceProvider.GetService<ICoreCmsGoodsServices>();
|
||||
var goodsCategoryServices = _serviceProvider.GetService<ICoreCmsGoodsCategoryServices>();
|
||||
var brandServices = _serviceProvider.GetService<ICoreCmsBrandServices>();
|
||||
var userGradeServices = _serviceProvider.GetService<ICoreCmsUserGradeServices>();
|
||||
|
||||
foreach (var item in data)
|
||||
{
|
||||
foreach (var condition in item.promotionCondition)
|
||||
{
|
||||
var obj = (JObject)JsonConvert.DeserializeObject(condition.parameters);
|
||||
var str = string.Empty;
|
||||
|
||||
if (condition.code == "GOODS_ALL")
|
||||
{
|
||||
str = "购买任意商品:只要购买任意产品即可;";
|
||||
}
|
||||
//购买指定商品
|
||||
else if (condition.code == "GOODS_IDS")
|
||||
{
|
||||
var goodsId = obj["goodsId"].ObjectToString();
|
||||
if (!string.IsNullOrEmpty(goodsId))
|
||||
{
|
||||
str = "购买指定商品:";
|
||||
var ids = goodsId.Split(",").Select(p => p.ObjectToInt()).ToList();
|
||||
var goods = await goodsServices.QueryListByClauseAsync(p => ids.Contains(p.id), p => p.id, OrderByType.Asc, true);
|
||||
if (goods.Any())
|
||||
{
|
||||
var goodsName = goods.Select(p => p.name = "【" + p.name + "】").ToList();
|
||||
str += string.Join(",", goodsName);
|
||||
}
|
||||
str += ";购买数量:" + obj["nums"].ObjectToString();
|
||||
}
|
||||
}
|
||||
//购买指定商品分类
|
||||
else if (condition.code == "GOODS_CATS")
|
||||
{
|
||||
var id = obj["catId"].ObjectToInt(0);
|
||||
if (id > 0)
|
||||
{
|
||||
str = "购买指定分类商品:";
|
||||
var goodCache = await goodsCategoryServices.GetCaChe();
|
||||
var goodsCategory = goodCache.FirstOrDefault(p => p.id == id);
|
||||
str += goodsCategory != null ? "【" + goodsCategory.name + "】" : "";
|
||||
str += ";购买数量:" + obj["nums"].ObjectToString();
|
||||
}
|
||||
}
|
||||
//购买指定品牌商品
|
||||
else if (condition.code == "GOODS_BRANDS")
|
||||
{
|
||||
var id = obj["brandId"].ObjectToInt(0);
|
||||
if (id > 0)
|
||||
{
|
||||
str = "购买指定品牌商品:";
|
||||
var brandCache = await brandServices.QueryAsync(true, true);
|
||||
var brand = brandCache.FirstOrDefault(p => p.id == id);
|
||||
str += brand != null ? "【" + brand.name + "】" : "";
|
||||
str += ";购买数量:" + obj["nums"].ObjectToString();
|
||||
}
|
||||
}
|
||||
//用户符合指定等级
|
||||
else if (condition.code == "USER_GRADE")
|
||||
{
|
||||
var gradesId = obj["grades"].ObjectToString();
|
||||
if (!string.IsNullOrEmpty(gradesId))
|
||||
{
|
||||
str = "用户符合指定等级:";
|
||||
var ids = gradesId.Split(",").Select(p => p.ObjectToInt()).ToList();
|
||||
var userGradesCache = await userGradeServices.QueryAsync(true, true);
|
||||
var userGrades = userGradesCache.Where(p => ids.Contains(p.id));
|
||||
if (userGrades.Any())
|
||||
{
|
||||
var goodsName = userGrades.Select(p => p.title = "【" + p.title + "】").ToList();
|
||||
str += string.Join(",", goodsName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (condition.code == "ORDER_FULL")
|
||||
{
|
||||
str = obj != null ? "购买订单满" + obj["money"].ObjectToString() + "元 " : "";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(str))
|
||||
{
|
||||
item.conditions.Add(str);
|
||||
}
|
||||
}
|
||||
foreach (var result in item.promotionResult)
|
||||
{
|
||||
//var str = PromotionHelper.GetResultMsg(result.code, result.parameters);
|
||||
var msg = string.Empty;
|
||||
var obj = (JObject)JsonConvert.DeserializeObject(result.parameters);
|
||||
|
||||
switch (result.code)
|
||||
{
|
||||
case "GOODS_REDUCE":
|
||||
msg = "指定商品减少固定金额:减" + obj["money"].ObjectToString() + "元 ";
|
||||
break;
|
||||
case "GOODS_DISCOUNT":
|
||||
msg = "指定商品打折:打" + obj["discount"].ObjectToString() + "折 ";
|
||||
break;
|
||||
case "GOODS_ONE_PRICE":
|
||||
msg = "指定商品一口价:" + obj["money"].ObjectToString() + "元 ";
|
||||
break;
|
||||
case "ORDER_REDUCE":
|
||||
msg = "订单减" + obj["money"].ObjectToString() + "元 ";
|
||||
break;
|
||||
case "ORDER_DISCOUNT":
|
||||
msg = "订单打" + obj["discount"].ObjectToString() + "折 ";
|
||||
break;
|
||||
case "GOODS_HALF_PRICE":
|
||||
msg = "指定商品每第" + obj["num"].ObjectToString() + "件减少" + obj["money"].ObjectToString() + "元";
|
||||
break;
|
||||
}
|
||||
|
||||
item.results.Add(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var list = new List<GetPromotionResult>();
|
||||
if (data.Any())
|
||||
{
|
||||
foreach (var item in data)
|
||||
{
|
||||
var dto = new GetPromotionResult();
|
||||
dto.id = item.id;
|
||||
dto.name = item.name;
|
||||
dto.type = item.type;
|
||||
dto.sort = item.sort;
|
||||
dto.maxNums = item.maxNums;
|
||||
dto.maxGoodsNums = item.maxGoodsNums;
|
||||
dto.maxRecevieNums = item.maxRecevieNums;
|
||||
dto.startTime = item.startTime;
|
||||
dto.endTime = item.endTime;
|
||||
dto.isEnable = item.isEnable;
|
||||
dto.isExclusive = item.isExclusive;
|
||||
dto.isAutoReceive = item.isAutoReceive;
|
||||
dto.effectiveDays = item.effectiveDays;
|
||||
dto.effectiveHours = item.effectiveHours;
|
||||
dto.conditions = item.conditions;
|
||||
dto.results = item.results;
|
||||
list.Add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,6 +419,11 @@ const install = (Vue, vm) => {
|
||||
//本地选择图片转base64,再上传服务器存储返回地址
|
||||
let uploadFilesFByBase64 = (params, config = {}) => http.post('/Api/Common/UploadFilesFByBase64', params, { custom: { methodName: 'topUp.uploadFilesFByBase64', needToken: true } });
|
||||
|
||||
//获取全局促销列表
|
||||
let getPromotionList = (params, config = {}) => http.post('/Api/Promotion/GetPromotionList', params, { custom: { methodName: 'promotion.getPromotionList', needToken: false } });
|
||||
|
||||
|
||||
|
||||
|
||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||
vm.$u.api = {
|
||||
@@ -619,7 +624,8 @@ const install = (Vue, vm) => {
|
||||
getTypeDetail,
|
||||
|
||||
|
||||
uploadFilesFByBase64
|
||||
uploadFilesFByBase64,
|
||||
getPromotionList
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,23 @@ export const loadStatus = {
|
||||
};
|
||||
|
||||
|
||||
//优惠促销类型
|
||||
export const promotionType = {
|
||||
// 促销
|
||||
promotion: 1,
|
||||
|
||||
// 优惠券
|
||||
coupon: 2,
|
||||
|
||||
// 团购
|
||||
group: 3,
|
||||
|
||||
// 秒杀
|
||||
seckill: 4,
|
||||
};
|
||||
|
||||
|
||||
|
||||
//nav页面导航类型
|
||||
export const navLinkType = {
|
||||
urlLink: 1, //"URL链接"
|
||||
|
||||
@@ -81,8 +81,25 @@
|
||||
</view>
|
||||
|
||||
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white">
|
||||
<!--全局促销-->
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row" @tap="promotionListTap" v-if="promotionList.length>0">
|
||||
<view class="coreshop-basis-2">
|
||||
<text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">优惠</text>
|
||||
</view>
|
||||
<view class="coreshop-basis-7 coreshop-flex coreshop-align-center">
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row coreshop-align-center">
|
||||
<u-icon name="info-circle" size="12" labelSize="12" color="#e54d42" :label="item.name" v-for="(item, index) in promotionList" :key="index" style="margin-right: 10px; margin-bottom: 10px;"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-basis-1">
|
||||
<view class="coreshop-float-right">
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-solid-bottom coreshop-margin-top-10 coreshop-margin-bottom-10" v-if="promotionList.length>0" />
|
||||
<!--服务-->
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row" @tap="serviceTap" v-if="serviceDescription.service.length>0">
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row coreshop-padding-top-10" @tap="serviceTap" v-if="serviceDescription.service.length>0">
|
||||
<view class="coreshop-basis-2">
|
||||
<text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">服务</text>
|
||||
</view>
|
||||
@@ -408,14 +425,14 @@
|
||||
</view>
|
||||
|
||||
<!--弹出框-->
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" @close="hideModal" :closeable="true" safeAreaInsetTop>
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" @close="hideModal" :closeable="true" :safeAreaInsetTop="true">
|
||||
<view class="radius coreshop-bg-white">
|
||||
<!--标题-->
|
||||
<view class="coreshop-text-black coreshop-text-center coreshop-margin-top-15 coreshop-margin-bottom-15 coreshop-font-lg coreshop-title-bar">
|
||||
<text>{{modalTitle}}</text>
|
||||
</view>
|
||||
<!--内容区域-->
|
||||
<view class="coreshop-modal-content">
|
||||
<view class="coreshop-modal-content" style="max-height: calc(100vh - 327.5px); overflow-y: auto; ">
|
||||
<!--服务区域-->
|
||||
<view class="coreshop-common-view-box service" v-if="modalType=='service'">
|
||||
<view v-for="(item, index) in serviceDescription.service" :key="index">
|
||||
@@ -435,6 +452,54 @@
|
||||
<text class="coreshop-margin-left-10 u-line-5 coreshop-text-black">{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--全平台促销区域-->
|
||||
<view class="coreshop-common-view-box promotion" v-if="modalType=='promotionList'">
|
||||
<view class="coreshop-solid coreshop-padding-10 coreshop-margin-bottom-10" v-for="(item, index) in promotionList" :key="index">
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-padding-bottom-10">
|
||||
<u--text :text="'活动'+(index+1)+':'+item.name" size="17" bold="true" :lines="2"></u--text>
|
||||
</view>
|
||||
<u-line margin="10rpx 0"></u-line>
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-padding-top-8" v-if="item.conditions">
|
||||
<view class="coreshop-text-grey coreshop-font-14 coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
|
||||
<view class="coreshop-margin-right-5">
|
||||
<u-icon name="setting" size="18"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-text-grey coreshop-font-13 coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
|
||||
满足条件:<view class="coreshop-text-red">要求同时满足下面所有条件</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-line margin="10rpx 0"></u-line>
|
||||
<view class="coreshop-flex coreshop-flex-direction coreshop-justify-start">
|
||||
<text class="coreshop-font-sm coreshop-margin-bottom-5 coreshop-margin-top-5" style="line-height: 20px;" v-for="(itemC, indexC) in item.conditions" :key="indexC">
|
||||
条件{{indexC+1}} :{{itemC}}
|
||||
</text>
|
||||
</view>
|
||||
<u-line margin="10rpx 0"></u-line>
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-padding-top-8" v-if="item.results">
|
||||
<view class="coreshop-text-grey coreshop-font-14 coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
|
||||
<view class="coreshop-margin-right-5">
|
||||
<u-icon name="bell" size="18"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-text-grey coreshop-font-13 coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
|
||||
活动结果:<view class="coreshop-text-red">{{item.results[0]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-line margin="10rpx 0"></u-line>
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-padding-bottom-10">
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-align-center coreshop-flex-direction-row coreshop-justify-start">
|
||||
<view class="coreshop-margin-right-5">
|
||||
<u-icon name="calendar" size="18"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-text-grey coreshop-font-13">
|
||||
活动时间:{{$u.timeFormat(item.startTime, 'yyyy-mm-dd hh:MM')}} 至 {{$u.timeFormat(item.endTime, 'yyyy-mm-dd hh:MM')}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
@@ -495,7 +560,8 @@
|
||||
autoplay: true,
|
||||
userAgent: {},
|
||||
userAgentGrade: {},
|
||||
agentProducts: []
|
||||
agentProducts: [],
|
||||
promotionList: [],
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
@@ -538,6 +604,7 @@
|
||||
}
|
||||
})
|
||||
};
|
||||
this.getPromotionList();
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
@@ -980,6 +1047,11 @@
|
||||
this.modalType = 'promotion';
|
||||
this.showModal();
|
||||
},
|
||||
promotionListTap() {
|
||||
this.modalTitle = "全平台促销优惠";
|
||||
this.modalType = 'promotionList';
|
||||
this.showModal();
|
||||
},
|
||||
showModal() {
|
||||
this.bottomModal = true;
|
||||
},
|
||||
@@ -988,6 +1060,17 @@
|
||||
this.modalTitle = "";
|
||||
this.modalType = '';
|
||||
},
|
||||
getPromotionList() {
|
||||
let data = {
|
||||
id: this.$globalConstVars.promotionType.promotion,
|
||||
};
|
||||
this.$u.api.getPromotionList(data).then(res => {
|
||||
if (res.status) {
|
||||
this.promotionList = res.data;
|
||||
}
|
||||
console.log(data);
|
||||
});
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
goodsInfo: {
|
||||
|
||||
67
CoreCms.Net.Web.WebApi/Controllers/PromotionController.cs
Normal file
67
CoreCms.Net.Web.WebApi/Controllers/PromotionController.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Linq;
|
||||
using CoreCms.Net.Auth.HttpContextUser;
|
||||
using CoreCms.Net.Caching.AutoMate.RedisCache;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
|
||||
namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 促销活动接口
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class PromotionController : ControllerBase
|
||||
{
|
||||
private readonly ICoreCmsPromotionServices _promotionServices;
|
||||
private readonly IRedisOperationRepository _redisOperationRepository;
|
||||
private readonly IHttpContextUser _user;
|
||||
private readonly IUnitOfWork _unionOfWork;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public PromotionController(ICoreCmsPromotionServices promotionServices, IRedisOperationRepository redisOperationRepository, IHttpContextUser user, IUnitOfWork unionOfWork)
|
||||
{
|
||||
_promotionServices = promotionServices;
|
||||
_redisOperationRepository = redisOperationRepository;
|
||||
_user = user;
|
||||
_unionOfWork = unionOfWork;
|
||||
}
|
||||
|
||||
|
||||
//公共接口====================================================================================================
|
||||
|
||||
#region 获取全局促销列表==================================================
|
||||
/// <summary>
|
||||
/// 获取全局促销列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
//[Authorize]
|
||||
public async Task<WebApiCallBack> GetPromotionList([FromBody] FMIntId entity)
|
||||
{
|
||||
var jm = new WebApiCallBack() { msg = "获取失败" };
|
||||
|
||||
var list = await _promotionServices.GetPromotionList(entity.id);
|
||||
jm.status = true;
|
||||
jm.data = list;
|
||||
jm.msg = "获取成功";
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
//验证接口====================================================================================================
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -830,6 +830,22 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Web.WebApi.Controllers.PromotionController">
|
||||
<summary>
|
||||
促销活动接口
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PromotionController.#ctor(CoreCms.Net.IServices.ICoreCmsPromotionServices,CoreCms.Net.Caching.AutoMate.RedisCache.IRedisOperationRepository,CoreCms.Net.Auth.HttpContextUser.IHttpContextUser,CoreCms.Net.IRepository.UnitOfWork.IUnitOfWork)">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PromotionController.GetPromotionList(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
获取全局促销列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Web.WebApi.Controllers.ServiceController">
|
||||
<summary>
|
||||
服务卡控制器
|
||||
|
||||
Reference in New Issue
Block a user