um-old">
+from django.db import migrations, models
+import jsonfield.fields
+import shortuuidfield.fields
+import simditor.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('coupon', '0002_auto_20191221_1534'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='UserCouponInfo',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
+ ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
+ ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
+ ('brand_id', models.CharField(blank=True, db_index=True, help_text='\u54c1\u724c\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='brand_id')),
+ ('brand_name', models.CharField(blank=True, help_text='\u54c1\u724c\u540d\u79f0', max_length=255, null=True, verbose_name='brand_name')),
+ ('coupon_id', shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=22, null=True, unique=True)),
+ ('user_id', models.CharField(blank=True, db_index=True, help_text='\u7528\u6237\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='user_id')),
+ ('coupon_title', models.CharField(blank=True, help_text='\u5238\u6807\u9898', max_length=255, null=True, verbose_name='coupon_title')),
+ ('coupon_detail', simditor.fields.RichTextField(blank=True, help_text='\u5238\u8be6\u60c5', null=True, verbose_name='coupon_detail')),
+ ('coupon_value', models.IntegerField(blank=True, default=0, help_text='\u5238\u91d1\u989d\uff08\u5355\u4f4d\uff1a\u5206\uff09', null=True, verbose_name='coupon_value')),
+ ('active_at', models.DateTimeField(blank=True, help_text='\u751f\u6548\u65f6\u95f4', null=True, verbose_name='active_at')),
+ ('expire_at', models.DateTimeField(blank=True, help_text='\u8fc7\u671f\u65f6\u95f4', null=True, verbose_name='expire_at')),
+ ('coupon_valid_period', models.IntegerField(default=0, help_text='\u5238\u6709\u6548\u65f6\u95f4\uff08\u5355\u4f4d\uff1a\u5929\uff09', verbose_name='coupon_valid_period')),
+ ('coupon_limit_brand_ids', jsonfield.fields.JSONField(blank=True, help_text='\u5238\u9650\u5236\u4f7f\u7528 brand_ids', null=True, verbose_name='coupon_limit_brand_ids')),
+ ('has_used', models.BooleanField(db_index=True, default=False, help_text='\u662f\u5426\u5df2\u6838\u9500', verbose_name='has_used')),
+ ('admin_id', models.CharField(blank=True, db_index=True, help_text='\u6838\u9500\u5458\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='admin_id')),
+ ('used_at', models.DateTimeField(blank=True, help_text='\u7ef4\u4fee\u5238\u6838\u9500\u65f6\u95f4', null=True, verbose_name='used_at')),
+ ],
+ options={
+ 'verbose_name': '\u7528\u6237\u5238\u4fe1\u606f',
+ 'verbose_name_plural': '\u7528\u6237\u5238\u4fe1\u606f',
+ },
+ ),
+ migrations.AddField(
+ model_name='couponinfo',
+ name='brand_id',
+ field=models.CharField(blank=True, db_index=True, help_text='\u54c1\u724c\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='brand_id'),
+ ),
+ migrations.AddField(
+ model_name='couponinfo',
+ name='brand_name',
+ field=models.CharField(blank=True, help_text='\u54c1\u724c\u540d\u79f0', max_length=255, null=True, verbose_name='brand_name'),
+ ),
+ ]
@@ -2,8 +2,10 @@ |
||
2 | 2 |
|
3 | 3 |
from django.db import models |
4 | 4 |
from django.utils.translation import ugettext_lazy as _ |
5 |
-from django_models_ext import BaseModelMixin |
|
5 |
+from django_models_ext import BaseModelMixin, upload_file_path, upload_file_url, upload_path |
|
6 |
+from jsonfield import JSONField |
|
6 | 7 |
from shortuuidfield import ShortUUIDField |
8 |
+from TimeConvert import TimeConvert as tc |
|
7 | 9 |
|
8 | 10 |
from simditor.fields import RichTextField |
9 | 11 |
|
@@ -17,22 +19,21 @@ class CouponInfo(BaseModelMixin): |
||
17 | 19 |
(CHANGED_EXPIRED_TIME, u'可变结束时间'), |
18 | 20 |
) |
19 | 21 |
|
22 |
+ brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) |
|
23 |
+ brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') |
|
24 |
+ |
|
20 | 25 |
coupon_id = ShortUUIDField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True, unique=True) |
21 | 26 |
|
22 |
- # 活动券信息 |
|
27 |
+ coupon_title = models.CharField(_(u'coupon_title'), max_length=255, blank=True, null=True, help_text=u'券标题') |
|
28 |
+ coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情') |
|
29 |
+ coupon_value = models.IntegerField(_(u'coupon_value'), default=0, help_text=_(u'维修券金额(单位:分)')) |
|
30 |
+ coupon_image = models.ImageField(_(u'coupon_image'), upload_to=upload_path, blank=True, null=True, help_text=u'券图片') |
|
31 |
+ |
|
23 | 32 |
coupon_expire_type = models.IntegerField(_(u'coupon_expire_type'), choices=COUPON_EXPIRED_TIME_TUPLE, default=FIXED_EXPIRED_TIME, help_text=_(u'维修券类型')) |
24 | 33 |
coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'维修券有效时间(单位:天)')) |
25 | 34 |
coupon_expire_at = models.DateTimeField(_(u'coupon_expire_at'), blank=True, null=True, help_text=_(u'维修券过期时间')) |
26 |
- coupon_value = models.IntegerField(_(u'coupon_value'), default=0, help_text=_(u'维修券金额(单位:分)')) |
|
27 | 35 |
|
28 |
- # 会员券信息 |
|
29 |
- coupon_num = models.IntegerField(_(u'coupon_num'), default=0, help_text=_(u'券每会员级别发放张数')) |
|
30 |
- coupon_level1_amount = models.IntegerField(_(u'coupon_level1_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
31 |
- coupon_level2_amount = models.IntegerField(_(u'coupon_level2_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
32 |
- coupon_level3_amount = models.IntegerField(_(u'coupon_level3_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
33 |
- coupon_level4_amount = models.IntegerField(_(u'coupon_level4_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
34 |
- coupon_level5_amount = models.IntegerField(_(u'coupon_level5_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
35 |
- coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情') |
|
36 |
+ coupon_limit_brand_ids = JSONField(_(u'coupon_limit_brand_ids'), blank=True, null=True, help_text=u'券限制使用 brand_ids') |
|
36 | 37 |
|
37 | 38 |
class Meta: |
38 | 39 |
verbose_name = _(u'券信息') |
@@ -40,3 +41,59 @@ class CouponInfo(BaseModelMixin): |
||
40 | 41 |
|
41 | 42 |
def __unicode__(self): |
42 | 43 |
return unicode(self.pk) |
44 |
+ |
|
45 |
+ |
|
46 |
+class UserCouponInfo(BaseModelMixin): |
|
47 |
+ brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) |
|
48 |
+ brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') |
|
49 |
+ |
|
50 |
+ coupon_id = ShortUUIDField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True, unique=True) |
|
51 |
+ user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) |
|
52 |
+ |
|
53 |
+ coupon_title = models.CharField(_(u'coupon_title'), max_length=255, blank=True, null=True, help_text=u'券标题') |
|
54 |
+ coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情') |
|
55 |
+ coupon_value = models.IntegerField(_(u'coupon_value'), default=0, blank=True, null=True, help_text=u'券金额(单位:分)') |
|
56 |
+ coupon_image = models.ImageField(_(u'coupon_image'), upload_to=upload_path, blank=True, null=True, help_text=u'券图片') |
|
57 |
+ |
|
58 |
+ active_at = models.DateTimeField(_(u'active_at'), blank=True, null=True, help_text=_(u'生效时间')) |
|
59 |
+ expire_at = models.DateTimeField(_(u'expire_at'), blank=True, null=True, help_text=_(u'过期时间')) |
|
60 |
+ coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'券有效时间(单位:天)')) |
|
61 |
+ |
|
62 |
+ coupon_limit_brand_ids = JSONField(_(u'coupon_limit_brand_ids'), blank=True, null=True, help_text=u'券限制使用 brand_ids') |
|
63 |
+ |
|
64 |
+ has_used = models.BooleanField(_(u'has_used'), default=False, help_text=u'是否已核销', db_index=True) |
|
65 |
+ admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'核销员唯一标识', db_index=True) |
|
66 |
+ used_at = models.DateTimeField(_(u'used_at'), blank=True, null=True, help_text=u'维修券核销时间') |
|
67 |
+ |
|
68 |
+ class Meta: |
|
69 |
+ verbose_name = _(u'用户券信息') |
|
70 |
+ verbose_name_plural = _(u'用户券信息') |
|
71 |
+ |
|
72 |
+ def __unicode__(self): |
|
73 |
+ return unicode(self.pk) |
|
74 |
+ |
|
75 |
+ @property |
|
76 |
+ def coupon_image(self): |
|
77 |
+ return upload_file_path(self.coupon_image) |
|
78 |
+ |
|
79 |
+ @property |
|
80 |
+ def coupon_image_url(self): |
|
81 |
+ return upload_file_url(self.coupon_image) |
|
82 |
+ |
|
83 |
+ @property |
|
84 |
+ def data(self): |
|
85 |
+ return { |
|
86 |
+ 'coupon_id': self.coupon_id, |
|
87 |
+ 'coupon_title': self.coupon_title, |
|
88 |
+ 'coupon_detail': self.coupon_detail, |
|
89 |
+ 'coupon_amount': self.coupon_value, |
|
90 |
+ 'coupon_value': self.coupon_value, |
|
91 |
+ 'coupon_image_url': self.coupon_image_url, |
|
92 |
+ 'active_at': tc.local_string(self.active_at, format='%Y%m%d'), |
|
93 |
+ 'expire_at': tc.local_string(self.expire_at, format='%Y%m%d'), |
|
94 |
+ 'coupon_valid_period': self.coupon_valid_period, |
|
95 |
+ 'coupon_limit_brand_ids': self.coupon_limit_brand_ids, |
|
96 |
+ 'has_used': self.has_used, |
|
97 |
+ 'admin_id': self.admin_id, |
|
98 |
+ 'used_at': self.used_at, |
|
99 |
+ } |
@@ -2,13 +2,13 @@ |
||
2 | 2 |
|
3 | 3 |
from django.contrib import admin |
4 | 4 |
|
5 |
-from member.models import (CouponInfo, GoodsInfo, GoodsOrderInfo, MemberActivityInfo, MemberActivitySigninInfo, |
|
5 |
+from member.models import (GoodsInfo, GoodsOrderInfo, MemberActivityInfo, MemberActivitySigninInfo, |
|
6 | 6 |
MemberActivitySignupInfo, RightInfo, ShotTypeInfo) |
7 | 7 |
from utils.redis.rshot import update_member_shot_data |
8 | 8 |
|
9 | 9 |
|
10 | 10 |
class GoodsInfoAdmin(admin.ModelAdmin): |
11 |
- list_display = ('good_id', 'good_type', 'title', 'desc', 'image', 'is_slider', 'slider_image', 'integral', 'fee', 'minlevel', 'only_for_member', 'position', 'status', 'created_at', 'updated_at') |
|
11 |
+ list_display = ('good_id', 'good_type', 'title', 'value', 'left_num', 'coupon_id', 'image', 'is_slider', 'slider_image', 'integral', 'fee', 'minlevel', 'only_for_member', 'position', 'status', 'created_at', 'updated_at') |
|
12 | 12 |
list_filter = ('good_type', 'is_slider', 'only_for_member', 'status') |
13 | 13 |
|
14 | 14 |
|
@@ -28,7 +28,7 @@ class GoodsOrderInfoAdmin(admin.ModelAdmin): |
||
28 | 28 |
|
29 | 29 |
|
30 | 30 |
class RightInfoAdmin(admin.ModelAdmin): |
31 |
- list_display = ('right_id', 'right_type', 'icon', 'title', 'subtitle', 'detail', 'level1', 'level2', 'level3', 'level4', 'level5', 'minlevel', 'position', 'is_send_coupon', 'coupon_valid_period', 'coupon_num', 'status', 'created_at', 'updated_at') |
|
31 |
+ list_display = ('right_id', 'right_type', 'icon', 'title', 'subtitle', 'detail', 'level1', 'level2', 'level3', 'level4', 'level5', 'minlevel', 'position', 'is_send_coupon', 'coupon_num', 'coupon_level1_id', 'coupon_level2_id', 'coupon_level3_id', 'status', 'created_at', 'updated_at') |
|
32 | 32 |
list_filter = ('right_type', 'is_send_coupon', 'status') |
33 | 33 |
|
34 | 34 |
def save_model(self, request, obj, form, change): |
@@ -37,11 +37,6 @@ class RightInfoAdmin(admin.ModelAdmin): |
||
37 | 37 |
# TODO: Update coupon relative |
38 | 38 |
|
39 | 39 |
|
40 |
-class CouponInfoAdmin(admin.ModelAdmin): |
|
41 |
- list_display = ('coupon_id', 'user_id', 'coupon_valid_period', 'coupon_amount', 'coupon_detail', 'active_at', 'expire_at', 'right_id', 'right_type', 'icon', 'title', 'subtitle', 'detail', 'status', 'created_at', 'updated_at') |
|
42 |
- list_filter = ('right_type', 'status') |
|
43 |
- |
|
44 |
- |
|
45 | 40 |
class ShotTypeInfoAdmin(admin.ModelAdmin): |
46 | 41 |
list_display = ('shot_type_id', 'shot_type_name', 'position', 'status', 'created_at', 'updated_at') |
47 | 42 |
|
@@ -74,7 +69,6 @@ class MemberActivitySigninInfoAdmin(admin.ModelAdmin): |
||
74 | 69 |
admin.site.register(GoodsInfo, GoodsInfoAdmin) |
75 | 70 |
admin.site.register(GoodsOrderInfo, GoodsOrderInfoAdmin) |
76 | 71 |
admin.site.register(RightInfo, RightInfoAdmin) |
77 |
-admin.site.register(CouponInfo, CouponInfoAdmin) |
|
78 | 72 |
admin.site.register(ShotTypeInfo, ShotTypeInfoAdmin) |
79 | 73 |
admin.site.register(MemberActivityInfo, MemberActivityInfoAdmin) |
80 | 74 |
admin.site.register(MemberActivitySignupInfo, MemberActivitySignupInfoAdmin) |
@@ -0,0 +1,90 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+# Generated by Django 1.11.26 on 2019-12-21 08:13 |
|
3 |
+from __future__ import unicode_literals |
|
4 |
+ |
|
5 |
+from django.db import migrations, models |
|
6 |
+ |
|
7 |
+ |
|
8 |
+class Migration(migrations.Migration): |
|
9 |
+ |
|
10 |
+ dependencies = [ |
|
11 |
+ ('member', '0013_goodsinfo_only_for_member'), |
|
12 |
+ ] |
|
13 |
+ |
|
14 |
+ operations = [ |
|
15 |
+ migrations.DeleteModel( |
|
16 |
+ name='CouponInfo', |
|
17 |
+ ), |
|
18 |
+ migrations.RemoveField( |
|
19 |
+ model_name='rightinfo', |
|
20 |
+ name='coupon_detail', |
|
21 |
+ ), |
|
22 |
+ migrations.RemoveField( |
|
23 |
+ model_name='rightinfo', |
|
24 |
+ name='coupon_id', |
|
25 |
+ ), |
|
26 |
+ migrations.RemoveField( |
|
27 |
+ model_name='rightinfo', |
|
28 |
+ name='coupon_level1_amount', |
|
29 |
+ ), |
|
30 |
+ migrations.RemoveField( |
|
31 |
+ model_name='rightinfo', |
|
32 |
+ name='coupon_level2_amount', |
|
33 |
+ ), |
|
34 |
+ migrations.RemoveField( |
|
35 |
+ model_name='rightinfo', |
|
36 |
+ name='coupon_level3_amount', |
|
37 |
+ ), |
|
38 |
+ migrations.RemoveField( |
|
39 |
+ model_name='rightinfo', |
|
40 |
+ name='coupon_level4_amount', |
|
41 |
+ ), |
|
42 |
+ migrations.RemoveField( |
|
43 |
+ model_name='rightinfo', |
|
44 |
+ name='coupon_level5_amount', |
|
45 |
+ ), |
|
46 |
+ migrations.RemoveField( |
|
47 |
+ model_name='rightinfo', |
|
48 |
+ name='coupon_valid_period', |
|
49 |
+ ), |
|
50 |
+ migrations.AddField( |
|
51 |
+ model_name='goodsinfo', |
|
52 |
+ name='coupon_id', |
|
53 |
+ field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_id'), |
|
54 |
+ ), |
|
55 |
+ migrations.AddField( |
|
56 |
+ model_name='goodsinfo', |
|
57 |
+ name='left_num', |
|
58 |
+ field=models.IntegerField(default=0, help_text='\u5546\u54c1\u5e93\u5b58', verbose_name='left_num'), |
|
59 |
+ ), |
|
60 |
+ migrations.AddField( |
|
61 |
+ model_name='goodsinfo', |
|
62 |
+ name='value', |
|
63 |
+ field=models.IntegerField(default=99999, help_text='\u5546\u54c1\u4ef7\u503c\uff0c\u5355\u4f4d\u5206', verbose_name='value'), |
|
64 |
+ ), |
|
65 |
+ migrations.AddField( |
|
66 |
+ model_name='rightinfo', |
|
67 |
+ name='coupon_level1_id', |
|
68 |
+ field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level1_id'), |
|
69 |
+ ), |
|
70 |
+ migrations.AddField( |
|
71 |
+ model_name='rightinfo', |
|
72 |
+ name='coupon_level2_id', |
|
73 |
+ field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level2_id'), |
|
74 |
+ ), |
|
75 |
+ migrations.AddField( |
|
76 |
+ model_name='rightinfo', |
|
77 |
+ name='coupon_level3_id', |
|
78 |
+ field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level3_id'), |
|
79 |
+ ), |
|
80 |
+ migrations.AddField( |
|
81 |
+ model_name='rightinfo', |
|
82 |
+ name='coupon_level4_id', |
|
83 |
+ field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level4_id'), |
|
84 |
+ ), |
|
85 |
+ migrations.AddField( |
|
86 |
+ model_name='rightinfo', |
|
87 |
+ name='coupon_level5_id', |
|
88 |
+ field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_level5_id'), |
|
89 |
+ ), |
|
90 |
+ ] |
@@ -27,9 +27,13 @@ class GoodsInfo(BaseModelMixin): |
||
27 | 27 |
|
28 | 28 |
title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'商品名称') |
29 | 29 |
desc = RichTextField(_(u'desc'), blank=True, null=True, help_text=u'商品描述') |
30 |
+ value = models.IntegerField(_(u'value'), default=99999, help_text=u'商品价值,单位分') |
|
31 |
+ left_num = models.IntegerField(_(u'left_num'), default=0, help_text=u'商品库存') |
|
30 | 32 |
|
31 | 33 |
image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, null=True, help_text=u'商品图片') |
32 | 34 |
|
35 |
+ coupon_id = models.CharField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True) |
|
36 |
+ |
|
33 | 37 |
is_slider = models.BooleanField(_(u'is_slider'), default=True, help_text=u'是否为轮播商品', db_index=True) |
34 | 38 |
slider_image = models.ImageField(_(u'slider_image'), upload_to=upload_path, blank=True, null=True, help_text=u'商品轮播图片') |
35 | 39 |
|
@@ -164,17 +168,12 @@ class RightInfo(BaseModelMixin): |
||
164 | 168 |
|
165 | 169 |
# 券相关 |
166 | 170 |
is_send_coupon = models.BooleanField(_(u'is_send_coupon'), default=False, help_text=_(u'是否发券'), db_index=True) |
167 |
- |
|
168 |
- coupon_id = models.CharField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True) |
|
169 |
- |
|
170 |
- coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'券有效时间(单位:天)')) |
|
171 | 171 |
coupon_num = models.IntegerField(_(u'coupon_num'), default=0, help_text=_(u'券每会员级别发放张数')) |
172 |
- coupon_level1_amount = models.IntegerField(_(u'coupon_level1_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
173 |
- coupon_level2_amount = models.IntegerField(_(u'coupon_level2_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
174 |
- coupon_level3_amount = models.IntegerField(_(u'coupon_level3_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
175 |
- coupon_level4_amount = models.IntegerField(_(u'coupon_level4_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
176 |
- coupon_level5_amount = models.IntegerField(_(u'coupon_level5_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)') |
|
177 |
- coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情') |
|
172 |
+ coupon_level1_id = models.CharField(_(u'coupon_level1_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True) |
|
173 |
+ coupon_level2_id = models.CharField(_(u'coupon_level2_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True) |
|
174 |
+ coupon_level3_id = models.CharField(_(u'coupon_level3_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True) |
|
175 |
+ coupon_level4_id = models.CharField(_(u'coupon_level4_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True) |
|
176 |
+ coupon_level5_id = models.CharField(_(u'coupon_level5_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True) |
|
178 | 177 |
|
179 | 178 |
class Meta: |
180 | 179 |
verbose_name = _(u'会员权益信息') |
@@ -212,78 +211,6 @@ class RightInfo(BaseModelMixin): |
||
212 | 211 |
} |
213 | 212 |
|
214 | 213 |
|
215 |
-class CouponInfo(BaseModelMixin): |
|
216 |
- PHYSICAL = 0 |
|
217 |
- VIRTUAL = 1 |
|
218 |
- COUPON = 2 |
|
219 |
- |
|
220 |
- RIGHT_TYPE_TUPLE = ( |
|
221 |
- (PHYSICAL, u'实物'), |
|
222 |
- (VIRTUAL, u'虚拟'), |
|
223 |
- (COUPON, u'优惠券'), |
|
224 |
- ) |
|
225 |
- |
|
226 |
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) |
|
227 |
- brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') |
|
228 |
- |
|
229 |
- coupon_id = ShortUUIDField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True, unique=True) |
|
230 |
- user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) |
|
231 |
- |
|
232 |
- coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'券有效时间(单位:天)')) |
|
233 |
- coupon_amount = models.IntegerField(_(u'coupon_amount'), default=0, blank=True, null=True, help_text=u'券金额(单位:分)') |
|
234 |
- coupon_detail = RichTextField(_(u'coupon_detail'), blank=True, null=True, help_text=u'券详情') |
|
235 |
- |
|
236 |
- active_at = models.DateTimeField(_(u'active_at'), blank=True, null=True, help_text=_(u'生效时间')) |
|
237 |
- expire_at = models.DateTimeField(_(u'expire_at'), blank=True, null=True, help_text=_(u'过期时间')) |
|
238 |
- |
|
239 |
- right_id = models.CharField(_(u'right_id'), max_length=32, blank=True, null=True, help_text=u'权益唯一标识', db_index=True) |
|
240 |
- right_type = models.IntegerField(_(u'right_type'), choices=RIGHT_TYPE_TUPLE, default=VIRTUAL, help_text=u'权益类型', db_index=True) |
|
241 |
- |
|
242 |
- icon = models.ImageField(_(u'icon'), upload_to=upload_path, blank=True, null=True, help_text=u'权益图标') |
|
243 |
- title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'权益名称') |
|
244 |
- subtitle = models.CharField(_(u'subtitle'), max_length=255, blank=True, null=True, help_text=u'权益二级名称') |
|
245 |
- detail = RichTextField(_(u'detail'), blank=True, null=True, help_text=u'权益详情') |
|
246 |
- |
|
247 |
- has_used = models.BooleanField(_(u'has_used'), default=False, help_text=u'是否已核销', db_index=True) |
|
248 |
- admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'核销员唯一标识', db_index=True) |
|
249 |
- used_at = models.DateTimeField(_(u'used_at'), blank=True, null=True, help_text=u'维修券核销时间') |
|
250 |
- |
|
251 |
- class Meta: |
|
252 |
- verbose_name = _(u'会员券信息') |
|
253 |
- verbose_name_plural = _(u'会员券信息') |
|
254 |
- |
|
255 |
- def __unicode__(self): |
|
256 |
- return unicode(self.pk) |
|
257 |
- |
|
258 |
- @property |
|
259 |
- def icon_path(self): |
|
260 |
- return upload_file_path(self.icon) |
|
261 |
- |
|
262 |
- @property |
|
263 |
- def icon_url(self): |
|
264 |
- return upload_file_url(self.icon) |
|
265 |
- |
|
266 |
- @property |
|
267 |
- def data(self): |
|
268 |
- return { |
|
269 |
- 'coupon_id': self.coupon_id, |
|
270 |
- 'coupon_valid_period': self.coupon_valid_period, |
|
271 |
- 'coupon_amount': self.coupon_amount, |
|
272 |
- 'coupon_detail': self.coupon_detail, |
|
273 |
- 'active_at': tc.local_string(self.active_at, format='%Y%m%d'), |
|
274 |
- 'expire_at': tc.local_string(self.expire_at, format='%Y%m%d'), |
|
275 |
- 'right_id': self.right_id, |
|
276 |
- 'right_type': self.right_type, |
|
277 |
- 'icon': self.icon_url, |
|
278 |
- 'title': self.title, |
|
279 |
- 'subtitle': self.subtitle, |
|
280 |
- 'detail': self.detail, |
|
281 |
- 'has_used': self.has_used, |
|
282 |
- 'admin_id': self.admin_id, |
|
283 |
- 'used_at': self.used_at, |
|
284 |
- } |
|
285 |
- |
|
286 |
- |
|
287 | 214 |
class ShotTypeInfo(BaseModelMixin): |
288 | 215 |
brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) |
289 | 216 |
brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') |