前端:优惠劵列表
前端:增加路由的认证拦截
This commit is contained in:
parent
92ed97faed
commit
235da59f70
@ -41,3 +41,15 @@ export function doAddCouponCard(templateId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Coupon Card
|
// Coupon Card
|
||||||
|
|
||||||
|
export function getCouponPage(status, pageNo, pageSize) {
|
||||||
|
return request({
|
||||||
|
url: '/promotion-api/users/coupon/card/page',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
status,
|
||||||
|
pageNo,
|
||||||
|
pageSize
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -20,8 +20,8 @@ if (!process.env.NODE_ENV || process.env.NODE_ENV == 'development') {
|
|||||||
|
|
||||||
// baseUrl = 'http://127.0.0.1';
|
// baseUrl = 'http://127.0.0.1';
|
||||||
// baseUrl = 'http://180.167.213.26:18099';
|
// baseUrl = 'http://180.167.213.26:18099';
|
||||||
// dataSources = 'remote';
|
dataSources = 'remote';
|
||||||
dataSources = 'local';
|
// dataSources = 'local';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
baseUrl,
|
baseUrl,
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Router from 'vue-router';
|
import Router from 'vue-router';
|
||||||
|
|
||||||
|
import { getAccessToken } from '../utils/cache';
|
||||||
|
|
||||||
Vue.use(Router);
|
Vue.use(Router);
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
@ -84,7 +86,8 @@ const routes = [
|
|||||||
path: '/user/coupon',
|
path: '/user/coupon',
|
||||||
component: () => import('../page/user/coupon/list'),
|
component: () => import('../page/user/coupon/list'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '我的优惠券'
|
title: '我的优惠券',
|
||||||
|
requireAuth: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -202,10 +205,23 @@ routes.forEach(route => {
|
|||||||
const router = new Router({ routes });
|
const router = new Router({ routes });
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
|
// 判断是否需要认证
|
||||||
|
const requireAuth = to.meta && to.meta.requireAuth;
|
||||||
|
if (requireAuth) {
|
||||||
|
if (!getAccessToken()) { // 未登陆
|
||||||
|
next({
|
||||||
|
path: '/login',
|
||||||
|
query: {redirect: to.fullPath} // 将跳转的路由path作为参数,登录成功后跳转到该路由
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理标题
|
||||||
const title = to.meta && to.meta.title;
|
const title = to.meta && to.meta.title;
|
||||||
if (title) {
|
if (title) {
|
||||||
document.title = title;
|
document.title = title;
|
||||||
}
|
}
|
||||||
|
// 继续路由
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ import VueLazyload from 'vue-lazyload'
|
|||||||
import components from './config/components.js';
|
import components from './config/components.js';
|
||||||
import { Dialog } from 'vant';
|
import { Dialog } from 'vant';
|
||||||
|
|
||||||
|
import { formatDate } from './utils/date.js';
|
||||||
|
|
||||||
Vue.use(components);
|
Vue.use(components);
|
||||||
|
|
||||||
Vue.use(VueLazyload);
|
Vue.use(VueLazyload);
|
||||||
@ -17,3 +19,9 @@ new Vue({
|
|||||||
el: '#app',
|
el: '#app',
|
||||||
render: h => h(App)
|
render: h => h(App)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Vue.filter('formatDate', function(date, pattern) {
|
||||||
|
if (date) {
|
||||||
|
return formatDate(date, pattern);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@ -73,8 +73,9 @@ export default {
|
|||||||
message: '登陆成功',
|
message: '登陆成功',
|
||||||
beforeClose: function (action, done) {
|
beforeClose: function (action, done) {
|
||||||
done();
|
done();
|
||||||
// TODO 芋艿,先暂时不做 callback
|
// TODO 芋艿,简单的 callback 后续完善
|
||||||
that.$router.push('/user/index');
|
let redirect = that.$route.query.redirect || '/user/index';
|
||||||
|
that.$router.push(redirect);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -16,40 +16,49 @@
|
|||||||
<van-tab title="未使用">
|
<van-tab title="未使用">
|
||||||
<ul>
|
<ul>
|
||||||
<van-list
|
<van-list
|
||||||
v-model="loading"
|
v-model="unusedData.loading"
|
||||||
:finished="finished"
|
:finished="unusedData.finished"
|
||||||
@load="onLoad"
|
@load="onLoad"
|
||||||
>
|
>
|
||||||
<li v-for="(item,index) in list" :key="index" :class="'couponitem '+(item.show?'show':'') ">
|
<li v-for="(item,index) in unusedData.list" :key="index" :class="'couponitem '+(item.show?'show':'') ">
|
||||||
<div class="couponTop">
|
<div class="couponTop">
|
||||||
<div class="cpnamount">
|
<div class="cpnamount">
|
||||||
<div class="amountWrap">
|
<div class="amountWrap">
|
||||||
<div class="amount">
|
<div class="amount" v-if="item.preferentialType === 1">
|
||||||
<span class="amountSign" v-if="item.SignPosition=='left'" >{{item.Sign}}</span>
|
<span class="amountSign" >¥</span>
|
||||||
<span class="amountNum">{{item.Coupon}}</span>
|
<span class="amountNum">{{item.priceOff / 100}}</span>
|
||||||
<span class="amountSign" v-if="item.SignPosition=='right'" >{{item.Sign}}</span>
|
</div>
|
||||||
|
<div class="amount" v-else="item.preferentialType === 2">
|
||||||
|
<span class="amountNum">{{item.percentOff / 10.0}}</span>
|
||||||
|
<span class="amountSign">折</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="condition">
|
<div class="condition">
|
||||||
<span>{{item.Condition}}</span>
|
<span>满 {{item.priceAvailable}} 元可用</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="couponInfoWrap">
|
<div class="couponInfoWrap">
|
||||||
<div class="cpninfo">
|
<div class="cpninfo">
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
<span class="name">{{item.Name}}</span></div>
|
<span class="name">{{item.title}}</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="validity">
|
<div class="validity">
|
||||||
<span>{{item.BeginDate}}-{{item.EndDate}}
|
<span>{{item.validStartTime | formatDate('yyyy-MM-dd')}}
|
||||||
</span>
|
~ {{item.validEndTime | formatDate('yyyy-MM-dd')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<van-button type="danger" size="mini">立即使用</van-button>
|
<van-button type="danger" size="mini">立即使用</van-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="couponMid " v-if="item.Info!=''">
|
<!-- <div class="couponMid " v-if="item.Info!=''">-->
|
||||||
<span>详细信息</span>
|
<!-- <span>详细信息</span>-->
|
||||||
<van-icon name="arrow" class="down" @click="onShowInfo(item.Id,index)" />
|
<!-- <van-icon name="arrow" class="down" @click="onShowInfo(item.Id,index)" />-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
|
<!-- <div class="info" v-if="item.Info!=''" >-->
|
||||||
|
<!-- <div class="text">-->
|
||||||
|
<!-- {{item.Info}}-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- todo 芋艿,后续做优化。指定哪些商品 / 分类可用 -->
|
||||||
<div class="info" v-if="item.Info!=''" >
|
<div class="info" v-if="item.Info!=''" >
|
||||||
<div class="text">
|
<div class="text">
|
||||||
{{item.Info}}
|
{{item.Info}}
|
||||||
@ -62,32 +71,35 @@
|
|||||||
<van-tab title="使用记录">
|
<van-tab title="使用记录">
|
||||||
<ul class="gray" >
|
<ul class="gray" >
|
||||||
<van-list
|
<van-list
|
||||||
v-model="useLoading"
|
v-model="usedData.loading"
|
||||||
:finished="useFinished"
|
:finished="usedData.finished"
|
||||||
@load="onLoadUse"
|
@load="onLoadUse"
|
||||||
>
|
>
|
||||||
<li v-for="(item,index) in useList" :key="index" class="couponitem">
|
<li v-for="(item,index) in usedData.list" :key="index" class="couponitem">
|
||||||
<div class="couponTop">
|
<div class="couponTop">
|
||||||
<div class="cpnamount">
|
<div class="cpnamount">
|
||||||
<div class="amountWrap">
|
<div class="amountWrap">
|
||||||
<div class="amount">
|
<div class="amount" v-if="item.preferentialType === 1">
|
||||||
<span class="amountSign" v-if="item.SignPosition=='left'" >{{item.Sign}}</span>
|
<span class="amountSign" >¥</span>
|
||||||
<span class="amountNum">{{item.Coupon}}</span>
|
<span class="amountNum">{{item.priceOff / 100}}</span>
|
||||||
<span class="amountSign" v-if="item.SignPosition=='right'" >{{item.Sign}}</span>
|
</div>
|
||||||
|
<div class="amount" v-else="item.preferentialType === 2">
|
||||||
|
<span class="amountNum">{{item.percentOff / 10.0}}</span>
|
||||||
|
<span class="amountSign">折</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="condition">
|
<div class="condition">
|
||||||
<span>{{item.Condition}}</span>
|
<span>满 {{item.priceAvailable}} 元可用</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="couponInfoWrap">
|
<div class="couponInfoWrap">
|
||||||
<div class="cpninfo">
|
<div class="cpninfo">
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
<span class="name">{{item.Name}}</span></div>
|
<span class="name">{{item.title}}</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="validity">
|
<div class="validity">
|
||||||
<span>{{item.BeginDate}}-{{item.EndDate}}
|
<span>{{item.validStartTime | formatDate('yyyy-MM-dd')}}
|
||||||
</span>
|
~ {{item.validEndTime | formatDate('yyyy-MM-dd')}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -99,32 +111,35 @@
|
|||||||
<ul class="gray" >
|
<ul class="gray" >
|
||||||
|
|
||||||
<van-list
|
<van-list
|
||||||
v-model="endLoading"
|
v-model="expireData.loading"
|
||||||
:finished="endFinished"
|
:finished="expireData.finished"
|
||||||
@load="onLoadEnd"
|
@load="onLoadEnd"
|
||||||
>
|
>
|
||||||
<li v-for="(item,index) in endList" :key="index" class="couponitem">
|
<li v-for="(item,index) in expireData.list" :key="index" class="couponitem">
|
||||||
<div class="couponTop">
|
<div class="couponTop">
|
||||||
<div class="cpnamount">
|
<div class="cpnamount">
|
||||||
<div class="amountWrap">
|
<div class="amountWrap">
|
||||||
<div class="amount">
|
<div class="amount" v-if="item.preferentialType === 1">
|
||||||
<span class="amountSign" v-if="item.SignPosition=='left'" >{{item.Sign}}</span>
|
<span class="amountSign" >¥</span>
|
||||||
<span class="amountNum">{{item.Coupon}}</span>
|
<span class="amountNum">{{item.priceOff / 100}}</span>
|
||||||
<span class="amountSign" v-if="item.SignPosition=='right'" >{{item.Sign}}</span>
|
</div>
|
||||||
|
<div class="amount" v-else="item.preferentialType === 2">
|
||||||
|
<span class="amountNum">{{item.percentOff / 10.0}}</span>
|
||||||
|
<span class="amountSign">折</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="condition">
|
<div class="condition">
|
||||||
<span>{{item.Condition}}</span>
|
<span>满 {{item.priceAvailable}} 元可用</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="couponInfoWrap">
|
<div class="couponInfoWrap">
|
||||||
<div class="cpninfo">
|
<div class="cpninfo">
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
<span class="name">{{item.Name}}</span></div>
|
<span class="name">{{item.title}}</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="validity">
|
<div class="validity">
|
||||||
<span>{{item.BeginDate}}-{{item.EndDate}}
|
<span>{{item.validStartTime | formatDate('yyyy-MM-dd')}}
|
||||||
</span>
|
~ {{item.validEndTime | formatDate('yyyy-MM-dd')}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -138,83 +153,131 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { GetCoupon,ExchangeCoupon } from "../../../api/user.js";
|
import { GetCoupon,ExchangeCoupon } from "../../../api/user.js";
|
||||||
|
import { getCouponPage } from "../../../api/promotion.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading:false,
|
// loading:false,
|
||||||
finished:false,
|
// finished:false,
|
||||||
list:[],
|
// list:[],
|
||||||
page:0,
|
// page:0,
|
||||||
|
//
|
||||||
|
//
|
||||||
useLoading:false,
|
// useLoading:false,
|
||||||
useFinished:false,
|
// useFinished:false,
|
||||||
useList:[],
|
// useList:[],
|
||||||
usePage:0,
|
// usePage:0,
|
||||||
|
//
|
||||||
|
//
|
||||||
endLoading:false,
|
// endLoading:false,
|
||||||
endFinished:false,
|
// endFinished:false,
|
||||||
endList:[],
|
// endList:[],
|
||||||
endPage:0,
|
// endPage:0,
|
||||||
|
|
||||||
couponCode:'',
|
couponCode:'',
|
||||||
exchangeLoading:false,
|
exchangeLoading:false,
|
||||||
|
|
||||||
|
unusedData: {
|
||||||
|
page: 0,
|
||||||
|
pageSize: 10,
|
||||||
|
list: [],
|
||||||
|
loading: false,
|
||||||
|
finished: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
usedData: {
|
||||||
|
page: 0,
|
||||||
|
pageSize: 10,
|
||||||
|
list: [],
|
||||||
|
loading: false,
|
||||||
|
finished: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
expireData: {
|
||||||
|
page: 0,
|
||||||
|
pageSize: 10,
|
||||||
|
list: [],
|
||||||
|
loading: false,
|
||||||
|
finished: false,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.page++;
|
// 进入下一页
|
||||||
GetCoupon({page:this.page}).then(response=>{
|
let page = this.unusedData.page + 1;
|
||||||
response.List.forEach(item => {
|
getCouponPage(1, page, this.unusedData.pageSize).then(data => {
|
||||||
item.show=false;
|
// debugger;
|
||||||
this.list.push(item);
|
// 设置下页面
|
||||||
});
|
this.unusedData.page = page;
|
||||||
this.loading = false;
|
// 数据保存到 list 中
|
||||||
if(response.TotalPage<=this.page){
|
this.unusedData.list.push(...data.list);
|
||||||
this.finished = true;
|
// 判断页数
|
||||||
|
if (this.unusedData.list.length >= data.total) {
|
||||||
|
this.unusedData.finished = true;
|
||||||
}
|
}
|
||||||
|
// 标记不在加载中
|
||||||
|
this.unusedData.loading = false;
|
||||||
|
});
|
||||||
|
|
||||||
})
|
// GetCoupon({page:this.page}).then(response=>{
|
||||||
},
|
// response.List.forEach(item => {
|
||||||
onShowInfo(id,index){
|
// item.show=false;
|
||||||
this.list.forEach((item,itemIndex) => {
|
// this.list.push(item);
|
||||||
if(index==itemIndex){
|
// });
|
||||||
item.show=!item.show;
|
// this.loading = false;
|
||||||
return;
|
// if(response.TotalPage<=this.page){
|
||||||
}
|
// this.finished = true;
|
||||||
});
|
// }
|
||||||
|
//
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
|
// onShowInfo(id,index){
|
||||||
|
// this.list.forEach((item,itemIndex) => {
|
||||||
|
// if(index==itemIndex){
|
||||||
|
// item.show=!item.show;
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// },
|
||||||
onLoadUse() {
|
onLoadUse() {
|
||||||
this.usePage++;
|
// 进入下一页
|
||||||
GetCoupon({page:this.usePage}).then(response=>{
|
let page = this.usedData.page + 1;
|
||||||
response.List.forEach(item => {
|
getCouponPage(2, page, this.usedData.pageSize).then(data => {
|
||||||
this.useList.push(item);
|
// debugger;
|
||||||
});
|
// 设置下页面
|
||||||
this.useLoading = false;
|
this.usedData.page = page;
|
||||||
if(response.TotalPage<=this.usePage){
|
// 数据保存到 list 中
|
||||||
this.useFinished = true;
|
this.usedData.list.push(...data.list);
|
||||||
|
// 判断页数
|
||||||
|
if (this.usedData.list.length >= data.total) {
|
||||||
|
this.usedData.finished = true;
|
||||||
}
|
}
|
||||||
|
// 标记不在加载中
|
||||||
})
|
this.usedData.loading = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onLoadEnd() {
|
onLoadEnd() {
|
||||||
this.endPage++;
|
// 进入下一页
|
||||||
GetCoupon({page:this.endPage}).then(response=>{
|
let page = this.expireData.page + 1;
|
||||||
response.List.forEach(item => {
|
getCouponPage(3, page, this.expireData.pageSize).then(data => {
|
||||||
this.endList.push(item);
|
// debugger;
|
||||||
});
|
// 设置下页面
|
||||||
this.endLoading = false;
|
this.expireData.page = page;
|
||||||
if(response.TotalPage<=this.endPage){
|
// 数据保存到 list 中
|
||||||
this.endFinished = true;
|
this.expireData.list.push(...data.list);
|
||||||
|
// 判断页数
|
||||||
|
if (this.expireData.list.length >= data.total) {
|
||||||
|
this.expireData.finished = true;
|
||||||
}
|
}
|
||||||
|
// 标记不在加载中
|
||||||
})
|
this.expireData.loading = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onExchange(){
|
onExchange(){
|
||||||
if(this.exchangeLoading){
|
if(this.exchangeLoading){
|
||||||
|
15
mobile-web/src/utils/date.js
Normal file
15
mobile-web/src/utils/date.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
// TODO 临时代码
|
||||||
|
export function formatDate(date, pattern) {
|
||||||
|
if (!(date instanceof Date)) {
|
||||||
|
date = new Date(date);
|
||||||
|
}
|
||||||
|
if (pattern === 'yyyy-MM-dd') {
|
||||||
|
let d = date.getDate();
|
||||||
|
let m = date.getMonth() + 1; //Month from 0 to 11
|
||||||
|
let y = date.getFullYear();
|
||||||
|
return '' + y + '-' + (m <= 9 ? '0' + m : m) + '-' + (d <= 9 ? '0' + d : d);
|
||||||
|
} else {
|
||||||
|
return '暂不支持';
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.mall.order.api.dto;
|
package cn.iocoder.mall.order.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.Max;
|
import javax.validation.constraints.Max;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@ -7,6 +10,8 @@ import javax.validation.constraints.NotNull;
|
|||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-03-17 09:37
|
* @time 2019-03-17 09:37
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderCreateItemDTO {
|
public class OrderCreateItemDTO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.mall.order.api.dto;
|
package cn.iocoder.mall.order.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -9,6 +12,8 @@ import java.util.List;
|
|||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-03-30 22:31
|
* @time 2019-03-30 22:31
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderDeliveryDTO implements Serializable {
|
public class OrderDeliveryDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.mall.order.api.dto;
|
package cn.iocoder.mall.order.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -7,6 +10,8 @@ import java.util.List;
|
|||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-03-23 10:22
|
* @time 2019-03-23 10:22
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderItemDeletedDTO implements Serializable {
|
public class OrderItemDeletedDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.mall.order.api.dto;
|
package cn.iocoder.mall.order.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -9,6 +12,8 @@ import java.io.Serializable;
|
|||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-03-16 14:46
|
* @time 2019-03-16 14:46
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderItemUpdateDTO implements Serializable {
|
public class OrderItemUpdateDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.mall.order.api.dto;
|
package cn.iocoder.mall.order.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -10,6 +13,8 @@ import java.io.Serializable;
|
|||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-03-17 20:22
|
* @time 2019-03-17 20:22
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderLogisticsUpdateDTO implements Serializable {
|
public class OrderLogisticsUpdateDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.mall.order.api.dto;
|
package cn.iocoder.mall.order.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -9,6 +12,8 @@ import java.util.Date;
|
|||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-03-23 14:15
|
* @time 2019-03-23 14:15
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderQueryDTO implements Serializable {
|
public class OrderQueryDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.mall.order.api.dto;
|
package cn.iocoder.mall.order.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -8,6 +11,8 @@ import java.io.Serializable;
|
|||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-03-30 15:34
|
* @time 2019-03-30 15:34
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderReturnCreateDTO implements Serializable {
|
public class OrderReturnCreateDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,12 +18,16 @@ public class UsersCouponCardVO {
|
|||||||
private Integer id;
|
private Integer id;
|
||||||
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
|
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
|
||||||
private Integer templateId;
|
private Integer templateId;
|
||||||
|
@ApiModelProperty(value = "优惠劵名", required = true, example = "大保剑")
|
||||||
|
private String title;
|
||||||
@ApiModelProperty(value = "优惠码状态", required = true, example = "参见 CouponCardStatusEnum 枚举")
|
@ApiModelProperty(value = "优惠码状态", required = true, example = "参见 CouponCardStatusEnum 枚举")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
// ========== 基本信息 END ==========
|
// ========== 基本信息 END ==========
|
||||||
|
|
||||||
// ========== 使用规则 BEGIN ==========
|
// ========== 使用规则 BEGIN ==========
|
||||||
|
@ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true)
|
||||||
|
private Integer priceAvailable;
|
||||||
@ApiModelProperty(value = "固定日期-生效开始时间", required = true)
|
@ApiModelProperty(value = "固定日期-生效开始时间", required = true)
|
||||||
private Date validStartTime;
|
private Date validStartTime;
|
||||||
@ApiModelProperty(value = "固定日期-生效结束时间", required = true)
|
@ApiModelProperty(value = "固定日期-生效结束时间", required = true)
|
||||||
|
@ -21,6 +21,10 @@ public class CouponCardBO {
|
|||||||
* 优惠劵(码)分组编号
|
* 优惠劵(码)分组编号
|
||||||
*/
|
*/
|
||||||
private Integer templateId;
|
private Integer templateId;
|
||||||
|
/**
|
||||||
|
* 优惠劵名
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
// /**
|
// /**
|
||||||
// * 核销码
|
// * 核销码
|
||||||
// */
|
// */
|
||||||
@ -51,6 +55,10 @@ public class CouponCardBO {
|
|||||||
// ========== 领取情况 END ==========
|
// ========== 领取情况 END ==========
|
||||||
|
|
||||||
// ========== 使用规则 BEGIN ==========
|
// ========== 使用规则 BEGIN ==========
|
||||||
|
/**
|
||||||
|
* 是否设置满多少金额可用,单位:分
|
||||||
|
*/
|
||||||
|
private Integer priceAvailable;
|
||||||
/**
|
/**
|
||||||
* 生效开始时间
|
* 生效开始时间
|
||||||
*/
|
*/
|
||||||
|
@ -6,8 +6,8 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
public enum CouponTemplateStatusEnum implements IntArrayValuable {
|
public enum CouponTemplateStatusEnum implements IntArrayValuable {
|
||||||
|
|
||||||
ENABLE(1, "开启中"),
|
ENABLE(1, "生效中"),
|
||||||
DISABLE(2, "禁用中"),
|
DISABLE(2, "已失效"),
|
||||||
// EXPIRE(3, "已过期"), TODO 芋艿,暂时不考虑过期的
|
// EXPIRE(3, "已过期"), TODO 芋艿,暂时不考虑过期的
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -22,6 +22,14 @@ public class CouponCardDO extends BaseDO {
|
|||||||
* 优惠劵(码)分组编号,{@link CouponTemplateDO} 的 id
|
* 优惠劵(码)分组编号,{@link CouponTemplateDO} 的 id
|
||||||
*/
|
*/
|
||||||
private Integer templateId;
|
private Integer templateId;
|
||||||
|
/**
|
||||||
|
* 优惠劵名
|
||||||
|
*
|
||||||
|
* 冗余自 {@link CouponTemplateDO} 的 title
|
||||||
|
*
|
||||||
|
* TODO 芋艿,暂时不考虑冗余的更新
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
// /**
|
// /**
|
||||||
// * 核销码
|
// * 核销码
|
||||||
// */
|
// */
|
||||||
@ -52,6 +60,10 @@ public class CouponCardDO extends BaseDO {
|
|||||||
// ========== 领取情况 END ==========
|
// ========== 领取情况 END ==========
|
||||||
|
|
||||||
// ========== 使用规则 BEGIN ==========
|
// ========== 使用规则 BEGIN ==========
|
||||||
|
/**
|
||||||
|
* 是否设置满多少金额可用,单位:分
|
||||||
|
*/
|
||||||
|
private Integer priceAvailable;
|
||||||
/**
|
/**
|
||||||
* 生效开始时间
|
* 生效开始时间
|
||||||
*/
|
*/
|
||||||
|
@ -38,4 +38,6 @@ public class CouponCodeDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Integer couponId;
|
private Integer couponId;
|
||||||
|
|
||||||
|
// TODO 芋艿,后续要考虑状态的追踪
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,15 +35,6 @@ public class CouponTemplateDO extends BaseDO {
|
|||||||
* 2-优惠码
|
* 2-优惠码
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
/**
|
|
||||||
* 码类型
|
|
||||||
*
|
|
||||||
* 1-一卡一码(UNIQUE)
|
|
||||||
* 2-通用码(GENERAL)
|
|
||||||
*
|
|
||||||
* 【优惠码独有】 @see CouponCodeDO
|
|
||||||
*/
|
|
||||||
private Integer codeType;
|
|
||||||
/**
|
/**
|
||||||
* 优惠码状态
|
* 优惠码状态
|
||||||
*
|
*
|
||||||
@ -212,4 +203,20 @@ public class CouponTemplateDO extends BaseDO {
|
|||||||
// private Integer statUseNum;
|
// private Integer statUseNum;
|
||||||
// ========== 统计信息 END ==========
|
// ========== 统计信息 END ==========
|
||||||
|
|
||||||
|
// ========== 优惠码 BEGIN ==========
|
||||||
|
/**
|
||||||
|
* 码类型
|
||||||
|
*
|
||||||
|
* 1-一卡一码(UNIQUE)
|
||||||
|
* 2-通用码(GENERAL)
|
||||||
|
*
|
||||||
|
* 【优惠码独有】 @see CouponCodeDO
|
||||||
|
*/
|
||||||
|
private Integer codeType;
|
||||||
|
/**
|
||||||
|
* 通用码
|
||||||
|
*/
|
||||||
|
private String commonCode;
|
||||||
|
// ========== 优惠码 BEGIN ==========
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package cn.iocoder.mall.promotion.biz.scheduler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠劵过期 Job
|
||||||
|
*
|
||||||
|
* TODO 芋艿
|
||||||
|
*/
|
||||||
|
public class CouponCardExpireJob {
|
||||||
|
}
|
@ -224,10 +224,12 @@ public class CouponServiceImpl implements CouponService {
|
|||||||
// 1. 基本信息 + 领取情况
|
// 1. 基本信息 + 领取情况
|
||||||
CouponCardDO card = new CouponCardDO()
|
CouponCardDO card = new CouponCardDO()
|
||||||
.setTemplateId(couponTemplateId)
|
.setTemplateId(couponTemplateId)
|
||||||
|
.setTitle(template.getTitle())
|
||||||
.setStatus(CouponCardStatusEnum.UNUSED.getValue())
|
.setStatus(CouponCardStatusEnum.UNUSED.getValue())
|
||||||
.setUserId(userId)
|
.setUserId(userId)
|
||||||
.setTakeType(CouponCardTakeTypeEnum.BY_USER.getValue()); // TODO 需要改
|
.setTakeType(CouponCardTakeTypeEnum.BY_USER.getValue()); // TODO 需要改
|
||||||
// 2. 使用规则
|
// 2. 使用规则
|
||||||
|
card.setPriceAvailable(template.getPriceAvailable());
|
||||||
setCouponCardValidTime(card, template);
|
setCouponCardValidTime(card, template);
|
||||||
// 3. 使用效果
|
// 3. 使用效果
|
||||||
card.setPreferentialType(template.getPreferentialType())
|
card.setPreferentialType(template.getPreferentialType())
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
<mapper namespace="cn.iocoder.mall.promotion.biz.dao.CouponCardMapper">
|
<mapper namespace="cn.iocoder.mall.promotion.biz.dao.CouponCardMapper">
|
||||||
|
|
||||||
<sql id="FIELDS">
|
<sql id="FIELDS">
|
||||||
id, template_id, status, user_id, take_type,
|
id, template_id, title, status, user_id, take_type,
|
||||||
valid_start_time, valid_end_time, preferential_type, percent_off, price_off,
|
price_available, valid_start_time, valid_end_time, preferential_type, percent_off, price_off,
|
||||||
discount_price_limit, used_order_id, used_price, used_time,
|
discount_price_limit, used_order_id, used_price, used_time,
|
||||||
create_time
|
create_time
|
||||||
</sql>
|
</sql>
|
||||||
@ -78,13 +78,13 @@
|
|||||||
|
|
||||||
<insert id="insert" parameterType="CouponCardDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
<insert id="insert" parameterType="CouponCardDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
INSERT INTO coupon_card (
|
INSERT INTO coupon_card (
|
||||||
template_id, status, user_id, take_type,
|
template_id, title, status, user_id, take_type,
|
||||||
valid_start_time, valid_end_time, preferential_type, percent_off, price_off,
|
price_available, valid_start_time, valid_end_time, preferential_type, percent_off, price_off,
|
||||||
discount_price_limit, used_order_id, used_price, used_time,
|
discount_price_limit, used_order_id, used_price, used_time,
|
||||||
create_time
|
create_time
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{templateId}, #{status}, #{userId}, #{takeType},
|
#{templateId}, #{title}, #{status}, #{userId}, #{takeType},
|
||||||
#{validStartTime}, #{validEndTime}, #{preferentialType}, #{percentOff}, #{priceOff},
|
#{priceAvailable}, #{validStartTime}, #{validEndTime}, #{preferentialType}, #{percentOff}, #{priceOff},
|
||||||
#{discountPriceLimit}, #{usedOrderId}, #{usedPrice}, #{usedTime},
|
#{discountPriceLimit}, #{usedOrderId}, #{usedPrice}, #{usedTime},
|
||||||
#{createTime}
|
#{createTime}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user