From 1b5dfd0bc7ae6229a566f2a22d30930b200b10af Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 21 Apr 2021 20:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/coupon.ts | 53 +++ src/api/shop.ts | 1 - src/api/types.d.ts | 2 +- .../Tinymce/components/EditorImage.vue | 8 +- src/lang/en.ts | 1 + src/lang/zh.ts | 1 + src/router/modules/marketing.ts | 22 ++ src/views/marketing/coupon.vue | 52 ++- src/views/marketing/coupon_edit.vue | 307 ++++++++++++++++++ 9 files changed, 438 insertions(+), 9 deletions(-) create mode 100644 src/api/coupon.ts create mode 100644 src/views/marketing/coupon_edit.vue diff --git a/src/api/coupon.ts b/src/api/coupon.ts new file mode 100644 index 0000000..68305da --- /dev/null +++ b/src/api/coupon.ts @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +export interface ICouponData { + _id?: string, + name: string, + createdAt?: Date, + shop: string, + content: string, + comment?: string, + total: number, + count: number, + validBegin?: number, + validEnd?: number, + limitOne: number, +} + + +export const defaultCouponData: ICouponData = { + shop: '', + name: '', + content: '', + total: 0, + count: 0, + limitOne: 1 +} + +export const getCoupons = (params: any) => + request({ + url: '/coupons', + method: 'post', + params + }) + +export const getCoupon = (id: string, params: any) => + request({ + url: `/coupon/${id}`, + method: 'get', + params + }) + + +export const saveCoupon = (data: any) => + request({ + url: `/coupon/save`, + method: 'post', + data + }) + +export const deleteCoupon = (id: string) => + request({ + url: `/coupon/${id}/delete`, + method: 'post' + }) diff --git a/src/api/shop.ts b/src/api/shop.ts index a77e3df..3167c71 100644 --- a/src/api/shop.ts +++ b/src/api/shop.ts @@ -3,7 +3,6 @@ import { IShopData } from './types' export const defaultShopData: IShopData = { name: '', - _id: '', address: '', logo: '' } diff --git a/src/api/types.d.ts b/src/api/types.d.ts index 2e389b9..d8f6f29 100644 --- a/src/api/types.d.ts +++ b/src/api/types.d.ts @@ -42,7 +42,7 @@ export interface IQuestionData { } export interface IShopData { - _id: string, + _id?: string, name: string, createdAt?: Date, areaCode?: number, diff --git a/src/components/Tinymce/components/EditorImage.vue b/src/components/Tinymce/components/EditorImage.vue index cb43951..c59b7f6 100644 --- a/src/components/Tinymce/components/EditorImage.vue +++ b/src/components/Tinymce/components/EditorImage.vue @@ -15,13 +15,15 @@ > this.listObj[item].hasSuccess) } @@ -87,7 +91,7 @@ export default class extends Vue { const objKeyArr = Object.keys(this.listObj) for (let i = 0, len = objKeyArr.length; i < len; i++) { if (this.listObj[objKeyArr[i]].uid === uid) { - this.listObj[objKeyArr[i]].url = response.files.file + this.listObj[objKeyArr[i]].url = response.url_cdn this.listObj[objKeyArr[i]].hasSuccess = true return } diff --git a/src/lang/en.ts b/src/lang/en.ts index 01ea204..ef6edad 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -68,6 +68,7 @@ export default { article: 'Article', marketing: 'Marketing', marketing_coupon: 'Coupon', + marketing_coupon_info: 'Coupon Info', marketing_promo: 'Promo Code', marketing_points: 'Points Setting', question: 'Question Set', diff --git a/src/lang/zh.ts b/src/lang/zh.ts index 53e98bc..3a0210e 100644 --- a/src/lang/zh.ts +++ b/src/lang/zh.ts @@ -68,6 +68,7 @@ export default { article: '资讯管理', marketing: '营销管理', marketing_coupon: '优惠券设置', + marketing_coupon_info: '编辑优惠券', marketing_promo: '优惠码设置', marketing_points: '积分设置', question: '题库管理', diff --git a/src/router/modules/marketing.ts b/src/router/modules/marketing.ts index c4b0856..f73b1dd 100644 --- a/src/router/modules/marketing.ts +++ b/src/router/modules/marketing.ts @@ -20,6 +20,28 @@ const marketingRoutes: RouteConfig = { icon: 'coupon' } }, + { + path: 'edit_coupon', + component: () => import('@/views/marketing/coupon_edit.vue'), + name: 'CouponDetail', + meta: { + title: 'marketing_coupon_info', + permissions: ['coupon:read'], + icon: 'coupon', + hidden: true + } + }, + { + path: 'edit_coupon/:id', + component: () => import('@/views/marketing/coupon_edit.vue'), + name: 'CouponDetail', + meta: { + title: 'marketing_coupon_info', + permissions: ['coupon:read'], + icon: 'coupon', + hidden: true + } + }, { path: 'promo', component: () => import('@/views/marketing/promo.vue'), diff --git a/src/views/marketing/coupon.vue b/src/views/marketing/coupon.vue index acb190a..06d3c7a 100644 --- a/src/views/marketing/coupon.vue +++ b/src/views/marketing/coupon.vue @@ -26,7 +26,7 @@ 重置 - + {{ row.createdAt | parseTime }} + + + + + + + + +