From 235da59f70f6a51b3cd0d213530ac00ab4f57d32 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Mon, 8 Apr 2019 21:47:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=8A=B5=E5=88=97=E8=A1=A8=20=E5=89=8D=E7=AB=AF=EF=BC=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B7=AF=E7=94=B1=E7=9A=84=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile-web/src/api/promotion.js | 12 + mobile-web/src/config/env.js | 4 +- mobile-web/src/config/router.js | 18 +- mobile-web/src/main.js | 10 +- mobile-web/src/page/account/phonelogin.vue | 5 +- mobile-web/src/page/user/coupon/list.vue | 271 +++++++++++------- mobile-web/src/utils/date.js | 15 + .../order/api/dto/OrderCreateItemDTO.java | 5 + .../mall/order/api/dto/OrderDeliveryDTO.java | 5 + .../order/api/dto/OrderItemDeletedDTO.java | 5 + .../order/api/dto/OrderItemUpdateDTO.java | 5 + .../api/dto/OrderLogisticsUpdateDTO.java | 5 + .../mall/order/api/dto/OrderQueryDTO.java | 5 + .../order/api/dto/OrderReturnCreateDTO.java | 5 + .../vo/users/UsersCouponCardVO.java | 4 + .../mall/promotion/api/bo/CouponCardBO.java | 8 + .../constant/CouponTemplateStatusEnum.java | 4 +- .../biz/dataobject/CouponCardDO.java | 12 + .../biz/dataobject/CouponCodeDO.java | 2 + .../biz/dataobject/CouponTemplateDO.java | 25 +- .../biz/scheduler/CouponCardExpireJob.java | 9 + .../biz/service/CouponServiceImpl.java | 2 + .../resources/mapper/CouponCardMapper.xml | 12 +- 23 files changed, 321 insertions(+), 127 deletions(-) create mode 100644 mobile-web/src/utils/date.js create mode 100644 promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/scheduler/CouponCardExpireJob.java diff --git a/mobile-web/src/api/promotion.js b/mobile-web/src/api/promotion.js index 37a96ff50..6917997b1 100644 --- a/mobile-web/src/api/promotion.js +++ b/mobile-web/src/api/promotion.js @@ -41,3 +41,15 @@ export function doAddCouponCard(templateId) { } // Coupon Card + +export function getCouponPage(status, pageNo, pageSize) { + return request({ + url: '/promotion-api/users/coupon/card/page', + method: 'get', + params: { + status, + pageNo, + pageSize + } + }); +} diff --git a/mobile-web/src/config/env.js b/mobile-web/src/config/env.js index a8e7df4aa..ab335a08f 100644 --- a/mobile-web/src/config/env.js +++ b/mobile-web/src/config/env.js @@ -20,8 +20,8 @@ if (!process.env.NODE_ENV || process.env.NODE_ENV == 'development') { // baseUrl = 'http://127.0.0.1'; // baseUrl = 'http://180.167.213.26:18099'; -// dataSources = 'remote'; -dataSources = 'local'; +dataSources = 'remote'; +// dataSources = 'local'; export { baseUrl, diff --git a/mobile-web/src/config/router.js b/mobile-web/src/config/router.js index f519f6f19..d9bfa06e5 100644 --- a/mobile-web/src/config/router.js +++ b/mobile-web/src/config/router.js @@ -1,6 +1,8 @@ import Vue from 'vue'; import Router from 'vue-router'; +import { getAccessToken } from '../utils/cache'; + Vue.use(Router); const routes = [ @@ -84,7 +86,8 @@ const routes = [ path: '/user/coupon', component: () => import('../page/user/coupon/list'), meta: { - title: '我的优惠券' + title: '我的优惠券', + requireAuth: true, } }, { @@ -202,10 +205,23 @@ routes.forEach(route => { const router = new Router({ routes }); 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; if (title) { document.title = title; } + // 继续路由 next(); }); diff --git a/mobile-web/src/main.js b/mobile-web/src/main.js index ff8d752cb..9577aa1c7 100644 --- a/mobile-web/src/main.js +++ b/mobile-web/src/main.js @@ -7,6 +7,8 @@ import VueLazyload from 'vue-lazyload' import components from './config/components.js'; import { Dialog } from 'vant'; +import { formatDate } from './utils/date.js'; + Vue.use(components); Vue.use(VueLazyload); @@ -16,4 +18,10 @@ new Vue({ router, el: '#app', render: h => h(App) -}); \ No newline at end of file +}); + +Vue.filter('formatDate', function(date, pattern) { + if (date) { + return formatDate(date, pattern); + } +}); diff --git a/mobile-web/src/page/account/phonelogin.vue b/mobile-web/src/page/account/phonelogin.vue index 866404bcf..6fe20cb64 100644 --- a/mobile-web/src/page/account/phonelogin.vue +++ b/mobile-web/src/page/account/phonelogin.vue @@ -73,8 +73,9 @@ export default { message: '登陆成功', beforeClose: function (action, done) { done(); - // TODO 芋艿,先暂时不做 callback - that.$router.push('/user/index'); + // TODO 芋艿,简单的 callback 后续完善 + let redirect = that.$route.query.redirect || '/user/index'; + that.$router.push(redirect); } }); }); diff --git a/mobile-web/src/page/user/coupon/list.vue b/mobile-web/src/page/user/coupon/list.vue index ba2ed7e3e..044ba9a69 100644 --- a/mobile-web/src/page/user/coupon/list.vue +++ b/mobile-web/src/page/user/coupon/list.vue @@ -6,7 +6,7 @@ center clearable placeholder="请输入优惠码" - + v-model="couponCode" > 兑换 @@ -16,41 +16,50 @@