@@ -3,8 +3,7 @@  | 
            ||
| 3 | 3 | 
                from django.contrib import admin  | 
            
| 4 | 4 | 
                from django_admin import ChangeOnlyModelAdmin, ReadOnlyModelAdmin  | 
            
| 5 | 5 | 
                 | 
            
| 6 | 
                -from account.models import FranchiserInfo, SaleclerkInfo, UserInfo  | 
            |
| 7 | 
                -from integral.models import SaleclerkIntegralIncomeExpensesInfo, SaleclerkSubmitLogInfo  | 
            |
| 6 | 
                +from account.models import UserInfo  | 
            |
| 8 | 7 | 
                from mch.models import ConsumeInfoSubmitLogInfo  | 
            
| 9 | 8 | 
                 | 
            
| 10 | 9 | 
                 | 
            
                @@ -20,27 +19,4 @@ class UserInfoAdmin(ChangeOnlyModelAdmin, admin.ModelAdmin):  | 
            ||
| 20 | 19 | 
                ConsumeInfoSubmitLogInfo.objects.filter(user_id=obj.user_id).update(test_user=True)  | 
            
| 21 | 20 | 
                 | 
            
| 22 | 21 | 
                 | 
            
| 23 | 
                -class FranchiserInfoAdmin(admin.ModelAdmin):  | 
            |
| 24 | 
                -    list_display = ('franchiser_id', 'franchiser_name', 'franchiser_addr', 'franchiser_phone', 'franchiser_boss_name', 'franchiser_boss_phone', 'status', 'created_at', 'updated_at')
               | 
            |
| 25 | 
                -    list_filter = ('status', )
               | 
            |
| 26 | 
                -    readonly_fields = ('franchiser_id',)
               | 
            |
| 27 | 
                -    search_fields = ('franchiser_id', 'franchiser_name', 'franchiser_addr', 'franchiser_phone', 'franchiser_boss_name', 'franchiser_boss_phone')
               | 
            |
| 28 | 
                -  | 
            |
| 29 | 
                -  | 
            |
| 30 | 
                -class SaleclerkInfoAdmin(admin.ModelAdmin):  | 
            |
| 31 | 
                -    list_display = ('franchiser_id', 'clerk_id', 'clerk_name', 'clerk_sex', 'clerk_phone', 'user_status', 'test_user', 'status', 'created_at', 'updated_at')
               | 
            |
| 32 | 
                -    list_filter = ('test_user', 'user_status', 'status')
               | 
            |
| 33 | 
                -    readonly_fields = ('franchiser_id', )
               | 
            |
| 34 | 
                -    search_fields = ('franchiser_id', 'clerk_id', 'clerk_name', 'clerk_phone')
               | 
            |
| 35 | 
                -  | 
            |
| 36 | 
                - def save_model(self, request, obj, form, change):  | 
            |
| 37 | 
                - obj.save()  | 
            |
| 38 | 
                - if not obj.test_user:  | 
            |
| 39 | 
                - return  | 
            |
| 40 | 
                - SaleclerkIntegralIncomeExpensesInfo.objects.filter(franchiser_id=obj.franchiser_id).update(test_user=True)  | 
            |
| 41 | 
                - SaleclerkSubmitLogInfo.objects.filter(franchiser_id=obj.franchiser_id).update(test_user=True)  | 
            |
| 42 | 
                -  | 
            |
| 43 | 
                -  | 
            |
| 44 | 22 | 
                admin.site.register(UserInfo, UserInfoAdmin)  | 
            
| 45 | 
                -admin.site.register(FranchiserInfo, FranchiserInfoAdmin)  | 
            |
| 46 | 
                -admin.site.register(SaleclerkInfo, SaleclerkInfoAdmin)  | 
            
                @@ -0,0 +1,18 @@  | 
            ||
| 1 | 
                +# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                +# Generated by Django 1.11.11 on 2018-05-22 03:00  | 
            |
| 3 | 
                +from __future__ import unicode_literals  | 
            |
| 4 | 
                +  | 
            |
| 5 | 
                +from django.db import migrations  | 
            |
| 6 | 
                +  | 
            |
| 7 | 
                +  | 
            |
| 8 | 
                +class Migration(migrations.Migration):  | 
            |
| 9 | 
                +  | 
            |
| 10 | 
                + dependencies = [  | 
            |
| 11 | 
                +        ('account', '0031_auto_20180417_1031'),
               | 
            |
| 12 | 
                + ]  | 
            |
| 13 | 
                +  | 
            |
| 14 | 
                + operations = [  | 
            |
| 15 | 
                + migrations.DeleteModel(  | 
            |
| 16 | 
                + name='SaleclerkInfo',  | 
            |
| 17 | 
                + ),  | 
            |
| 18 | 
                + ]  | 
            
                @@ -2,11 +2,12 @@  | 
            ||
| 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, SexModelMixin  | 
            |
| 5 | 
                +from django_models_ext import BaseModelMixin  | 
            |
| 6 | 6 | 
                from jsonfield import JSONField  | 
            
| 7 | 7 | 
                from shortuuidfield import ShortUUIDField  | 
            
| 8 | 8 | 
                 | 
            
| 9 | 
                -from kodo.basemodels import LensmanTypeBoolMixin, LensmanTypeMixin  | 
            |
| 9 | 
                +from kodo.basemodels import LensmanTypeBoolMixin  | 
            |
| 10 | 
                +from mch.models import SaleclerkInfo  | 
            |
| 10 | 11 | 
                 | 
            
| 11 | 12 | 
                 | 
            
| 12 | 13 | 
                class LensmanInfo(BaseModelMixin, LensmanTypeBoolMixin):  | 
            
                @@ -371,6 +372,7 @@ class UserInfo(BaseModelMixin, LensmanTypeBoolMixin):  | 
            ||
| 371 | 372 | 
                'nickname': self.nickname,  | 
            
| 372 | 373 | 
                'avatar': self.avatar,  | 
            
| 373 | 374 | 
                'phone': self.phone,  | 
            
| 375 | 
                + # TODO: Diff for Brands  | 
            |
| 374 | 376 | 
                'has_membercard': self.has_membercard,  | 
            
| 375 | 377 | 
                'saleclerk': SaleclerkInfo.objects.filter(unionid=self.unionid, status=True).exists(),  | 
            
| 376 | 378 | 
                }  | 
            
                @@ -429,83 +431,3 @@ class UserIncomeExpensesInfo(BaseModelMixin):  | 
            ||
| 429 | 431 | 
                 | 
            
| 430 | 432 | 
                def __unicode__(self):  | 
            
| 431 | 433 | 
                return unicode(self.pk)  | 
            
| 432 | 
                -  | 
            |
| 433 | 
                -  | 
            |
| 434 | 
                -class FranchiserInfo(BaseModelMixin):  | 
            |
| 435 | 
                - franchiser_id = ShortUUIDField(_(u'franchiser_id'), max_length=32, help_text=u'经销商唯一标识', db_index=True, unique=True)  | 
            |
| 436 | 
                - franchiser_name = models.CharField(_(u'franchiser_name'), max_length=32, blank=True, null=True, help_text=u'经销商名称')  | 
            |
| 437 | 
                - franchiser_addr = models.CharField(_(u'franchiser_addr'), max_length=32, blank=True, null=True, help_text=u'经销商地址')  | 
            |
| 438 | 
                - franchiser_phone = models.CharField(_(u'franchiser_phone'), max_length=11, blank=True, null=True, help_text=u'经销商联系电话')  | 
            |
| 439 | 
                - franchiser_boss_name = models.CharField(_(u'franchiser_boss_name'), max_length=32, blank=True, null=True, help_text=u'经销商老板名称')  | 
            |
| 440 | 
                - franchiser_boss_phone = models.CharField(_(u'franchiser_boss_phone'), max_length=11, blank=True, null=True, help_text=u'经销商老板联系电话')  | 
            |
| 441 | 
                -  | 
            |
| 442 | 
                - class Meta:  | 
            |
| 443 | 
                - verbose_name = _(u'经销商信息表')  | 
            |
| 444 | 
                - verbose_name_plural = _(u'经销商信息表')  | 
            |
| 445 | 
                -  | 
            |
| 446 | 
                - def __unicode__(self):  | 
            |
| 447 | 
                - return unicode(self.pk)  | 
            |
| 448 | 
                -  | 
            |
| 449 | 
                - @property  | 
            |
| 450 | 
                - def data(self):  | 
            |
| 451 | 
                -        return {
               | 
            |
| 452 | 
                - 'franchiser_id': self.franchiser_id,  | 
            |
| 453 | 
                - 'franchiser_name': self.franchiser_name,  | 
            |
| 454 | 
                - }  | 
            |
| 455 | 
                -  | 
            |
| 456 | 
                -  | 
            |
| 457 | 
                -class SaleclerkInfo(BaseModelMixin, SexModelMixin):  | 
            |
| 458 | 
                - REFUSED = -1  | 
            |
| 459 | 
                - UNVERIFIED = 0  | 
            |
| 460 | 
                - ACTIVATED = 1  | 
            |
| 461 | 
                - DISABLED = 2  | 
            |
| 462 | 
                - DELETED = 3  | 
            |
| 463 | 
                - ASSIGN = 10  | 
            |
| 464 | 
                -  | 
            |
| 465 | 
                - USER_STATUS = (  | 
            |
| 466 | 
                - (REFUSED, u'已拒绝'),  | 
            |
| 467 | 
                - (UNVERIFIED, u'未验证'),  | 
            |
| 468 | 
                - (ACTIVATED, u'已激活'),  | 
            |
| 469 | 
                - (DISABLED, u'已禁用'),  | 
            |
| 470 | 
                - (DELETED, u'已删除'),  | 
            |
| 471 | 
                - (ASSIGN, u'已分配'),  | 
            |
| 472 | 
                - )  | 
            |
| 473 | 
                -  | 
            |
| 474 | 
                - franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True)  | 
            |
| 475 | 
                - franchiser_name = models.CharField(_(u'franchiser_name'), max_length=32, blank=True, null=True, help_text=u'经销商名称')  | 
            |
| 476 | 
                - clerk_id = ShortUUIDField(_(u'clerk_id'), max_length=32, help_text=u'店员唯一标识', db_index=True, unique=True)  | 
            |
| 477 | 
                - clerk_name = models.CharField(_(u'clerk_name'), max_length=32, blank=True, null=True, help_text=u'店员名称')  | 
            |
| 478 | 
                - clerk_sex = models.IntegerField(_(u'clerk_sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.MALE, help_text=u'店员性别', db_index=True)  | 
            |
| 479 | 
                - clerk_phone = models.CharField(_(u'clerk_phone'), max_length=11, blank=True, null=True, help_text=u'店员联系电话')  | 
            |
| 480 | 
                -  | 
            |
| 481 | 
                - openid = models.CharField(_(u'openid'), max_length=32, blank=True, null=True, help_text=u'微信 OpenID', db_index=True, unique=True)  | 
            |
| 482 | 
                - unionid = models.CharField(_(u'unionid'), max_length=32, blank=True, null=True, help_text=u'微信 UnionID', db_index=True, unique=True)  | 
            |
| 483 | 
                -  | 
            |
| 484 | 
                - integral = models.IntegerField(_(u'integral'), default=0, help_text=u'积分')  | 
            |
| 485 | 
                - total_integral = models.IntegerField(_(u'total_integral'), default=0, help_text=u'全部积分')  | 
            |
| 486 | 
                -  | 
            |
| 487 | 
                - user_status = models.IntegerField(_(u'user_status'), choices=USER_STATUS, default=UNVERIFIED, help_text=u'用户状态', db_index=True)  | 
            |
| 488 | 
                - refused_reason = models.TextField(_(u'refused_reason'), blank=True, null=True, help_text=u'审核拒绝原因')  | 
            |
| 489 | 
                -  | 
            |
| 490 | 
                - test_user = models.BooleanField(_(u'test_user'), default=False, help_text=_(u'是否为测试用户'), db_index=True)  | 
            |
| 491 | 
                -  | 
            |
| 492 | 
                - class Meta:  | 
            |
| 493 | 
                - verbose_name = _(u'saleclerkinfo')  | 
            |
| 494 | 
                - verbose_name_plural = _(u'saleclerkinfo')  | 
            |
| 495 | 
                -  | 
            |
| 496 | 
                - def __unicode__(self):  | 
            |
| 497 | 
                - return unicode(self.pk)  | 
            |
| 498 | 
                -  | 
            |
| 499 | 
                - @property  | 
            |
| 500 | 
                - def data(self):  | 
            |
| 501 | 
                -        return {
               | 
            |
| 502 | 
                - 'franchiser_id': self.franchiser_id,  | 
            |
| 503 | 
                - 'franchiser_name': self.franchiser_name,  | 
            |
| 504 | 
                - 'clerk_id': self.clerk_id,  | 
            |
| 505 | 
                - 'clerk_name': self.clerk_name,  | 
            |
| 506 | 
                - 'clerk_sex': self.clerk_sex,  | 
            |
| 507 | 
                - 'clerk_phone': self.clerk_phone,  | 
            |
| 508 | 
                - 'integral': self.integral,  | 
            |
| 509 | 
                - 'status': self.user_status,  | 
            |
| 510 | 
                - 'refused_reason': self.refused_reason,  | 
            |
| 511 | 
                - }  | 
            
                @@ -7,15 +7,15 @@ from integral.models import SaleclerkIntegralIncomeExpensesInfo, SaleclerkSubmit  | 
            ||
| 7 | 7 | 
                 | 
            
| 8 | 8 | 
                 | 
            
| 9 | 9 | 
                class SaleclerkIntegralIncomeExpensesInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):  | 
            
| 10 | 
                -    list_display = ('franchiser_id', 'clerk_id', 'type', 'code', 'integral', 'left_integral', 'remark', 'test_user', 'status', 'created_at', 'updated_at')
               | 
            |
| 11 | 
                -    list_filter = ('franchiser_id', 'test_user', 'type', 'status')
               | 
            |
| 12 | 
                -    readonly_fields = ('franchiser_id', 'clerk_id', 'type', 'code', 'integral', 'left_integral')
               | 
            |
| 10 | 
                +    list_display = ('clerk_id', 'type', 'code', 'integral', 'left_integral', 'remark', 'test_user', 'status', 'created_at', 'updated_at')
               | 
            |
| 11 | 
                +    list_filter = ('test_user', 'type', 'status')
               | 
            |
| 12 | 
                +    readonly_fields = ('clerk_id', 'type', 'code', 'integral', 'left_integral')
               | 
            |
| 13 | 13 | 
                     search_fields = ('code', 'remark')
               | 
            
| 14 | 14 | 
                 | 
            
| 15 | 15 | 
                 | 
            
| 16 | 16 | 
                class SaleclerkSubmitLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):  | 
            
| 17 | 
                -    list_display = ('franchiser_id', 'clerk_id', 'code', 'remark', 'dupload', 'test_user', 'status', 'created_at', 'updated_at')
               | 
            |
| 18 | 
                -    list_filter = ('franchiser_id', 'dupload', 'test_user', 'status')
               | 
            |
| 17 | 
                +    list_display = ('clerk_id', 'code', 'remark', 'dupload', 'test_user', 'status', 'created_at', 'updated_at')
               | 
            |
| 18 | 
                +    list_filter = ('dupload', 'test_user', 'status')
               | 
            |
| 19 | 19 | 
                     search_fields = ('code', 'remark')
               | 
            
| 20 | 20 | 
                 | 
            
| 21 | 21 | 
                 | 
            
                @@ -16,7 +16,6 @@ class SaleclerkIntegralIncomeExpensesInfo(BaseModelMixin):  | 
            ||
| 16 | 16 | 
                (UNFREEZE, u'解冻'),  | 
            
| 17 | 17 | 
                )  | 
            
| 18 | 18 | 
                 | 
            
| 19 | 
                - franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True)  | 
            |
| 20 | 19 | 
                clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True)  | 
            
| 21 | 20 | 
                 | 
            
| 22 | 21 | 
                type = models.IntegerField(_(u'type'), choices=TYPE, default=INCOME, help_text=u'收支类别', db_index=True)  | 
            
                @@ -66,7 +65,6 @@ class SaleclerkIntegralIncomeExpensesInfo(BaseModelMixin):  | 
            ||
| 66 | 65 | 
                 | 
            
| 67 | 66 | 
                 | 
            
| 68 | 67 | 
                class SaleclerkSubmitLogInfo(BaseModelMixin):  | 
            
| 69 | 
                - franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True)  | 
            |
| 70 | 68 | 
                clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True)  | 
            
| 71 | 69 | 
                 | 
            
| 72 | 70 | 
                brand_pk = models.IntegerField(_(u'brand_pk'), default=0, help_text=u'品牌PK', db_index=True)  | 
            
                @@ -62,7 +62,6 @@ INSTALLED_APPS = (  | 
            ||
| 62 | 62 | 
                'pay',  | 
            
| 63 | 63 | 
                'photo',  | 
            
| 64 | 64 | 
                'pre',  | 
            
| 65 | 
                - 'product',  | 
            |
| 66 | 65 | 
                'server',  | 
            
| 67 | 66 | 
                'statistic',  | 
            
| 68 | 67 | 
                'website',  | 
            
                @@ -115,12 +115,12 @@ class SaleclerkInfoAdmin(admin.ModelAdmin):  | 
            ||
| 115 | 115 | 
                     list_filter = ('test_user', 'user_status', 'status')
               | 
            
| 116 | 116 | 
                     search_fields = ('brand_id', 'brand_name', 'distributor_id', 'distributor_name', 'clerk_id', 'clerk_name', 'clerk_phone')
               | 
            
| 117 | 117 | 
                 | 
            
| 118 | 
                - def save_model(self, request, obj, form, change):  | 
            |
| 119 | 
                - obj.save()  | 
            |
| 120 | 
                - if not obj.test_user:  | 
            |
| 121 | 
                - return  | 
            |
| 122 | 
                - SaleclerkIntegralIncomeExpensesInfo.objects.filter(franchiser_id=obj.franchiser_id).update(test_user=True)  | 
            |
| 123 | 
                - SaleclerkSubmitLogInfo.objects.filter(franchiser_id=obj.franchiser_id).update(test_user=True)  | 
            |
| 118 | 
                + # def save_model(self, request, obj, form, change):  | 
            |
| 119 | 
                + # obj.save()  | 
            |
| 120 | 
                + # if not obj.test_user:  | 
            |
| 121 | 
                + # return  | 
            |
| 122 | 
                + # SaleclerkIntegralIncomeExpensesInfo.objects.filter(distributor_id=obj.distributor_id).update(test_user=True)  | 
            |
| 123 | 
                + # SaleclerkSubmitLogInfo.objects.filter(distributor_id=obj.distributor_id).update(test_user=True)  | 
            |
| 124 | 124 | 
                 | 
            
| 125 | 125 | 
                 | 
            
| 126 | 126 | 
                class BrandModelDistributorPriceInfoAdmin(DeleteModelAdmin, admin.ModelAdmin):  | 
            
                @@ -0,0 +1,29 @@  | 
            ||
| 1 | 
                +# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                +# Generated by Django 1.11.11 on 2018-05-22 03:00  | 
            |
| 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 | 
                +        ('mch', '0020_auto_20180517_1819'),
               | 
            |
| 12 | 
                + ]  | 
            |
| 13 | 
                +  | 
            |
| 14 | 
                + operations = [  | 
            |
| 15 | 
                + migrations.AlterField(  | 
            |
| 16 | 
                + model_name='saleclerkinfo',  | 
            |
| 17 | 
                + name='openid',  | 
            |
| 18 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u5fae\u4fe1 OpenID', max_length=32, null=True, verbose_name='openid'),  | 
            |
| 19 | 
                + ),  | 
            |
| 20 | 
                + migrations.AlterField(  | 
            |
| 21 | 
                + model_name='saleclerkinfo',  | 
            |
| 22 | 
                + name='unionid',  | 
            |
| 23 | 
                + field=models.CharField(blank=True, db_index=True, help_text='\u5fae\u4fe1 UnionID', max_length=32, null=True, verbose_name='unionid'),  | 
            |
| 24 | 
                + ),  | 
            |
| 25 | 
                + migrations.AlterUniqueTogether(  | 
            |
| 26 | 
                + name='saleclerkinfo',  | 
            |
| 27 | 
                +            unique_together=set([('unionid', 'brand_id')]),
               | 
            |
| 28 | 
                + ),  | 
            |
| 29 | 
                + ]  | 
            
                @@ -271,8 +271,8 @@ class SaleclerkInfo(BaseModelMixin, SexModelMixin):  | 
            ||
| 271 | 271 | 
                clerk_sex = models.IntegerField(_(u'clerk_sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.MALE, help_text=u'店员性别', db_index=True)  | 
            
| 272 | 272 | 
                clerk_phone = models.CharField(_(u'clerk_phone'), max_length=11, blank=True, null=True, help_text=u'店员联系电话')  | 
            
| 273 | 273 | 
                 | 
            
| 274 | 
                - unionid = models.CharField(_(u'unionid'), max_length=32, blank=True, null=True, help_text=u'微信 UnionID', db_index=True, unique=True)  | 
            |
| 275 | 
                - openid = models.CharField(_(u'openid'), max_length=32, blank=True, null=True, help_text=u'微信 OpenID', db_index=True, unique=True)  | 
            |
| 274 | 
                + unionid = models.CharField(_(u'unionid'), max_length=32, blank=True, null=True, help_text=u'微信 UnionID', db_index=True)  | 
            |
| 275 | 
                + openid = models.CharField(_(u'openid'), max_length=32, blank=True, null=True, help_text=u'微信 OpenID', db_index=True)  | 
            |
| 276 | 276 | 
                 | 
            
| 277 | 277 | 
                integral = models.IntegerField(_(u'integral'), default=0, help_text=u'积分')  | 
            
| 278 | 278 | 
                total_integral = models.IntegerField(_(u'total_integral'), default=0, help_text=u'全部积分')  | 
            
                @@ -287,6 +287,9 @@ class SaleclerkInfo(BaseModelMixin, SexModelMixin):  | 
            ||
| 287 | 287 | 
                class Meta:  | 
            
| 288 | 288 | 
                verbose_name = _(u'经销商销售员信息')  | 
            
| 289 | 289 | 
                verbose_name_plural = _(u'经销商销售员信息')  | 
            
| 290 | 
                + unique_together = (  | 
            |
| 291 | 
                +            ('unionid', 'brand_id'),
               | 
            |
| 292 | 
                + )  | 
            |
| 290 | 293 | 
                 | 
            
| 291 | 294 | 
                def __unicode__(self):  | 
            
| 292 | 295 | 
                return unicode(self.pk)  | 
            
                @@ -306,6 +309,8 @@ class SaleclerkInfo(BaseModelMixin, SexModelMixin):  | 
            ||
| 306 | 309 | 
                'is_auth': self.is_auth,  | 
            
| 307 | 310 | 
                }  | 
            
| 308 | 311 | 
                 | 
            
| 312 | 
                + data = admindata  | 
            |
| 313 | 
                +  | 
            |
| 309 | 314 | 
                 | 
            
| 310 | 315 | 
                class BrandModelDistributorPriceInfo(BaseModelMixin):  | 
            
| 311 | 316 | 
                brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)  | 
            
                @@ -5,14 +5,15 @@ from __future__ import division  | 
            ||
| 5 | 5 | 
                from django.conf import settings  | 
            
| 6 | 6 | 
                from django.shortcuts import render  | 
            
| 7 | 7 | 
                 | 
            
| 8 | 
                -from account.models import SaleclerkInfo  | 
            |
| 8 | 
                +from mch.models import SaleclerkInfo  | 
            |
| 9 | 9 | 
                 | 
            
| 10 | 10 | 
                 | 
            
| 11 | 11 | 
                def clerk_info_oauth(request):  | 
            
| 12 | 
                +    brand_id = request.GET.get('brand_id', '')
               | 
            |
| 12 | 13 | 
                     unionid = request.GET.get('unionid', '')
               | 
            
| 13 | 14 | 
                 | 
            
| 14 | 15 | 
                try:  | 
            
| 15 | 
                - clerk = SaleclerkInfo.objects.get(unionid=unionid)  | 
            |
| 16 | 
                + clerk = SaleclerkInfo.objects.get(brand_id=brand_id, unionid=unionid)  | 
            |
| 16 | 17 | 
                except SaleclerkInfo.DoesNotExist:  | 
            
| 17 | 18 | 
                clerk = None  | 
            
| 18 | 19 | 
                 | 
            
                @@ -7,8 +7,9 @@ from django_logit import logit  | 
            ||
| 7 | 7 | 
                from django_response import response  | 
            
| 8 | 8 | 
                from json_render import json_render  | 
            
| 9 | 9 | 
                 | 
            
| 10 | 
                -from account.models import FranchiserInfo, LensmanInfo, SaleclerkInfo, TourGuideInfo  | 
            |
| 11 | 
                -from utils.error.errno_utils import FranchiserStatusCode, SaleclerkStatusCode  | 
            |
| 10 | 
                +from account.models import LensmanInfo, TourGuideInfo  | 
            |
| 11 | 
                +from mch.models import BrandInfo, DistributorInfo, SaleclerkInfo  | 
            |
| 12 | 
                +from utils.error.errno_utils import ProductBrandStatusCode, ProductDistributorStatusCode, SaleclerkStatusCode  | 
            |
| 12 | 13 | 
                from utils.redis.connect import r  | 
            
| 13 | 14 | 
                 | 
            
| 14 | 15 | 
                 | 
            
                @@ -56,19 +57,25 @@ def login_qrcode(request):  | 
            ||
| 56 | 57 | 
                 | 
            
| 57 | 58 | 
                 | 
            
| 58 | 59 | 
                def clerk_oauth(request):  | 
            
| 60 | 
                +    brand_id = request.GET.get('brand_id', '')
               | 
            |
| 59 | 61 | 
                     unionid = request.GET.get('unionid', '')
               | 
            
| 60 | 62 | 
                 | 
            
| 61 | 
                - chisers = FranchiserInfo.objects.filter(status=True)  | 
            |
| 62 | 
                - chisers = [chiser.data for chiser in chisers]  | 
            |
| 63 | 
                + try:  | 
            |
| 64 | 
                + BrandInfo.objects.get(brand_id=brand_id, status=True)  | 
            |
| 65 | 
                + except BrandInfo.DoesNotExist:  | 
            |
| 66 | 
                + return response(ProductBrandStatusCode.BRAND_NOT_FOUND)  | 
            |
| 67 | 
                +  | 
            |
| 68 | 
                + distributors = DistributorInfo.objects.filter(brand_id=brand_id, status=True)  | 
            |
| 69 | 
                + distributors = [distributor.admindata for distributor in distributors]  | 
            |
| 63 | 70 | 
                 | 
            
| 64 | 71 | 
                try:  | 
            
| 65 | 
                - clerk = SaleclerkInfo.objects.get(unionid=unionid)  | 
            |
| 72 | 
                + clerk = SaleclerkInfo.objects.get(brand_id=brand_id, unionid=unionid)  | 
            |
| 66 | 73 | 
                except SaleclerkInfo.DoesNotExist:  | 
            
| 67 | 74 | 
                clerk = None  | 
            
| 68 | 75 | 
                 | 
            
| 69 | 76 | 
                     return render(request, 'page/clerk_oauth.html', {
               | 
            
| 70 | 77 | 
                'domain': settings.DOMAIN,  | 
            
| 71 | 
                - 'chisers': chisers,  | 
            |
| 78 | 
                + 'distributors': distributors,  | 
            |
| 72 | 79 | 
                'clerk_info': clerk and clerk.data,  | 
            
| 73 | 80 | 
                'modified': bool((not clerk) or (clerk and clerk.user_status in [SaleclerkInfo.UNVERIFIED, SaleclerkInfo.REFUSED])), # 是否可以更改信息  | 
            
| 74 | 81 | 
                })  | 
            
                @@ -78,22 +85,23 @@ def clerk_oauth(request):  | 
            ||
| 78 | 85 | 
                @transaction.atomic  | 
            
| 79 | 86 | 
                def clerk_submit_api(request):  | 
            
| 80 | 87 | 
                """ 店员授权信息提交 """  | 
            
| 88 | 
                +    brand_id = request.POST.get('brand_id', '')
               | 
            |
| 81 | 89 | 
                     unionid = request.POST.get('unionid', '')
               | 
            
| 82 | 90 | 
                     openid = request.POST.get('openid', '')
               | 
            
| 83 | 91 | 
                     phone = request.POST.get('phone', '')
               | 
            
| 84 | 
                -    chiser = request.POST.get('chiser', '')
               | 
            |
| 92 | 
                +    distributor_id = request.POST.get('distributor_id', '')
               | 
            |
| 85 | 93 | 
                 | 
            
| 86 | 94 | 
                if SaleclerkInfo.objects.filter(clerk_phone=phone).exclude(unionid=unionid).exists():  | 
            
| 87 | 95 | 
                return response(SaleclerkStatusCode.CLERK_PHONE_ALREADY_EXISTS)  | 
            
| 88 | 96 | 
                 | 
            
| 89 | 97 | 
                try:  | 
            
| 90 | 
                - franchiser = FranchiserInfo.objects.get(franchiser_id=chiser)  | 
            |
| 91 | 
                - except FranchiserInfo.DoesNotExist:  | 
            |
| 92 | 
                - return response(FranchiserStatusCode.CHISER_NOT_FOUND)  | 
            |
| 98 | 
                + distributor = DistributorInfo.objects.get(distributor_id=distributor_id)  | 
            |
| 99 | 
                + except DistributorInfo.DoesNotExist:  | 
            |
| 100 | 
                + return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)  | 
            |
| 93 | 101 | 
                 | 
            
| 94 | 102 | 
                     fields = {
               | 
            
| 95 | 
                - 'franchiser_id': chiser,  | 
            |
| 96 | 
                - 'franchiser_name': franchiser.franchiser_name,  | 
            |
| 103 | 
                + 'distributor_id': distributor_id,  | 
            |
| 104 | 
                + 'distributor_name': distributor.distributor_name,  | 
            |
| 97 | 105 | 
                         'clerk_name': request.POST.get('name', ''),
               | 
            
| 98 | 106 | 
                         'clerk_sex': int(request.POST.get('sex', 1)),
               | 
            
| 99 | 107 | 
                'clerk_phone': phone,  | 
            
                @@ -101,13 +109,13 @@ def clerk_submit_api(request):  | 
            ||
| 101 | 109 | 
                'user_status': SaleclerkInfo.UNVERIFIED,  | 
            
| 102 | 110 | 
                }  | 
            
| 103 | 111 | 
                 | 
            
| 104 | 
                - lensman, created = SaleclerkInfo.objects.select_for_update().get_or_create(unionid=unionid, defaults=fields)  | 
            |
| 112 | 
                + clerk, created = SaleclerkInfo.objects.select_for_update().get_or_create(brand_id=brand_id, unionid=unionid, defaults=fields)  | 
            |
| 105 | 113 | 
                # 状态为 UNVERIFIED 的允许修改, 其他需要登录摄影师 APP 进行信息的修改  | 
            
| 106 | 
                - if lensman.user_status not in [SaleclerkInfo.UNVERIFIED, SaleclerkInfo.REFUSED]:  | 
            |
| 107 | 
                - return response(SaleclerkInfo.LENSMAN_ALREADY_NOT_UNVERIFIED)  | 
            |
| 114 | 
                + if clerk.user_status not in [SaleclerkInfo.UNVERIFIED, SaleclerkInfo.REFUSED]:  | 
            |
| 115 | 
                + return response(SaleclerkStatusCode.CLERK_ALREADY_NOT_UNVERIFIED)  | 
            |
| 108 | 116 | 
                if not created:  | 
            
| 109 | 117 | 
                for key, value in fields.iteritems():  | 
            
| 110 | 
                - setattr(lensman, key, value)  | 
            |
| 111 | 
                - lensman.save()  | 
            |
| 118 | 
                + setattr(clerk, key, value)  | 
            |
| 119 | 
                + clerk.save()  | 
            |
| 112 | 120 | 
                 | 
            
| 113 | 121 | 
                     return response(200, 'Submit Success', u'提交成功', {})
               | 
            
                @@ -4,40 +4,20 @@ from __future__ import division  | 
            ||
| 4 | 4 | 
                 | 
            
| 5 | 5 | 
                from django.conf import settings  | 
            
| 6 | 6 | 
                from django.db import transaction  | 
            
| 7 | 
                -from django.shortcuts import render  | 
            |
| 8 | 7 | 
                from django_logit import logit  | 
            
| 9 | 8 | 
                from django_response import response  | 
            
| 10 | 9 | 
                from paginator import pagination  | 
            
| 11 | 10 | 
                from TimeConvert import TimeConvert as tc  | 
            
| 12 | 11 | 
                 | 
            
| 13 | 
                -from account.models import SaleclerkInfo, UserInfo  | 
            |
| 12 | 
                +from account.models import UserInfo  | 
            |
| 14 | 13 | 
                from integral.models import SaleclerkIntegralIncomeExpensesInfo, SaleclerkSubmitLogInfo  | 
            
| 15 | 
                -from mch.models import BrandInfo, DistributorInfo, ModelInfo  | 
            |
| 16 | 
                -from product.models import ProductModelInfo  | 
            |
| 14 | 
                +from mch.models import BrandInfo, DistributorInfo, ModelInfo, SaleclerkInfo  | 
            |
| 17 | 15 | 
                from statistic.models import (DistributorSaleStatisticInfo, ModelSaleStatisticInfo, ProvinceSaleStatisticInfo,  | 
            
| 18 | 16 | 
                SaleStatisticInfo)  | 
            
| 19 | 17 | 
                from utils.error.errno_utils import (ProductBrandStatusCode, ProductDistributorStatusCode, ProductModelStatusCode,  | 
            
| 20 | 18 | 
                SaleclerkStatusCode)  | 
            
| 21 | 19 | 
                 | 
            
| 22 | 20 | 
                 | 
            
| 23 | 
                -def clerk_sale_oauth(request):  | 
            |
| 24 | 
                -    unionid = request.GET.get('unionid', '')
               | 
            |
| 25 | 
                -  | 
            |
| 26 | 
                - models = ProductModelInfo.objects.filter(status=True)  | 
            |
| 27 | 
                - models = [model.data for model in models]  | 
            |
| 28 | 
                -  | 
            |
| 29 | 
                - try:  | 
            |
| 30 | 
                - clerk = SaleclerkInfo.objects.get(unionid=unionid)  | 
            |
| 31 | 
                - except SaleclerkInfo.DoesNotExist:  | 
            |
| 32 | 
                - clerk = None  | 
            |
| 33 | 
                -  | 
            |
| 34 | 
                -    return render(request, 'page/clerk_sale.html', {
               | 
            |
| 35 | 
                - 'domain': settings.DOMAIN,  | 
            |
| 36 | 
                - 'models': models,  | 
            |
| 37 | 
                - 'clerk_info': clerk and clerk.data,  | 
            |
| 38 | 
                - })  | 
            |
| 39 | 
                -  | 
            |
| 40 | 
                -  | 
            |
| 41 | 21 | 
                @logit  | 
            
| 42 | 22 | 
                @transaction.atomic  | 
            
| 43 | 23 | 
                def clerk_sale_submit_api(request):  | 
            
                @@ -63,13 +43,12 @@ def clerk_sale_submit_api(request):  | 
            ||
| 63 | 43 | 
                return response(SaleclerkStatusCode.CLERK_NOT_FOUND)  | 
            
| 64 | 44 | 
                 | 
            
| 65 | 45 | 
                try:  | 
            
| 66 | 
                - clerk = SaleclerkInfo.objects.get(unionid=user.unionid, status=True)  | 
            |
| 46 | 
                + clerk = SaleclerkInfo.objects.get(brand_id=brandID, unionid=user.unionid, status=True)  | 
            |
| 67 | 47 | 
                except SaleclerkInfo.DoesNotExist:  | 
            
| 68 | 48 | 
                return response(SaleclerkStatusCode.CLERK_NOT_FOUND)  | 
            
| 69 | 49 | 
                 | 
            
| 70 | 50 | 
                # 店员提交记录  | 
            
| 71 | 51 | 
                ssli = SaleclerkSubmitLogInfo.objects.create(  | 
            
| 72 | 
                - franchiser_id=clerk.franchiser_id,  | 
            |
| 73 | 52 | 
                clerk_id=clerk.clerk_id,  | 
            
| 74 | 53 | 
                brand_pk=brandID,  | 
            
| 75 | 54 | 
                model_pk=modelID,  | 
            
                @@ -98,7 +77,7 @@ def clerk_sale_submit_api(request):  | 
            ||
| 98 | 77 | 
                clerk = None  | 
            
| 99 | 78 | 
                 | 
            
| 100 | 79 | 
                         return response(SaleclerkStatusCode.DUPLICATE_SUBMIT, data={
               | 
            
| 101 | 
                - 'franchiser_name': clerk.franchiser_name,  | 
            |
| 80 | 
                + 'franchiser_name': clerk.distributor_name,  | 
            |
| 102 | 81 | 
                'clerk_name': clerk.clerk_name,  | 
            
| 103 | 82 | 
                         } if clerk else {})
               | 
            
| 104 | 83 | 
                 | 
            
                @@ -132,7 +111,6 @@ def clerk_sale_submit_api(request):  | 
            ||
| 132 | 111 | 
                 | 
            
| 133 | 112 | 
                # 店员积分记录  | 
            
| 134 | 113 | 
                SaleclerkIntegralIncomeExpensesInfo.objects.create(  | 
            
| 135 | 
                - franchiser_id=clerk.franchiser_id,  | 
            |
| 136 | 114 | 
                clerk_id=clerk.clerk_id,  | 
            
| 137 | 115 | 
                type=SaleclerkIntegralIncomeExpensesInfo.INCOME,  | 
            
| 138 | 116 | 
                brand_id=brand.brand_id,  | 
            
                @@ -229,6 +207,7 @@ def clerk_sale_submit_api(request):  | 
            ||
| 229 | 207 | 
                 | 
            
| 230 | 208 | 
                @logit  | 
            
| 231 | 209 | 
                def clerk_integral_list_api(request):  | 
            
| 210 | 
                +    brandID = request.POST.get('BrandID', '')
               | 
            |
| 232 | 211 | 
                     user_id = request.POST.get('user_id', '')
               | 
            
| 233 | 212 | 
                     page = int(request.POST.get('page', 1))
               | 
            
| 234 | 213 | 
                     num = int(request.POST.get('num', settings.GROUP_NUM_PER_PAGE))
               | 
            
                @@ -239,7 +218,7 @@ def clerk_integral_list_api(request):  | 
            ||
| 239 | 218 | 
                return response(SaleclerkStatusCode.CLERK_NOT_FOUND)  | 
            
| 240 | 219 | 
                 | 
            
| 241 | 220 | 
                try:  | 
            
| 242 | 
                - clerk = SaleclerkInfo.objects.get(unionid=user.unionid, status=True)  | 
            |
| 221 | 
                + clerk = SaleclerkInfo.objects.get(brand_id=brandID, unionid=user.unionid, status=True)  | 
            |
| 243 | 222 | 
                except SaleclerkInfo.DoesNotExist:  | 
            
| 244 | 223 | 
                return response(SaleclerkStatusCode.CLERK_NOT_FOUND)  | 
            
| 245 | 224 | 
                 | 
            
                @@ -19,9 +19,9 @@  | 
            ||
| 19 | 19 | 
                <div class="weui_cell weui_cell_select weui_select_after">  | 
            
| 20 | 20 | 
                <div class="weui_cell_hd"><label for="" class="weui_label">经销商</label></div>  | 
            
| 21 | 21 | 
                <div class="weui_cell_bd weui_cell_primary">  | 
            
| 22 | 
                -                        <select id="chiser" class="weui_select" name="select" {% if not modified %}disabled{% endif %}>
               | 
            |
| 23 | 
                -                            {% for chiser in chisers %}
               | 
            |
| 24 | 
                -                            <option value="{{ chiser.franchiser_id }}" {% ifequal chiser.franchiser_id clerk_info.franchiser_id %}selected{% endifequal %}>{{ chiser.franchiser_name }}</option>
               | 
            |
| 22 | 
                +                        <select id="distributor" class="weui_select" name="select" {% if not modified %}disabled{% endif %}>
               | 
            |
| 23 | 
                +                            {% for distributor in distributors %}
               | 
            |
| 24 | 
                +                            <option value="{{ distributor.distributor_id }}" {% ifequal distributor.distributor_id clerk_info.distributor_id %}selected{% endifequal %}>{{ distributor.distributor_name }}</option>
               | 
            |
| 25 | 25 | 
                                             {% endfor %}
               | 
            
| 26 | 26 | 
                </select>  | 
            
| 27 | 27 | 
                </div>  | 
            
                @@ -107,10 +107,6 @@  | 
            ||
| 107 | 107 | 
                <script>  | 
            
| 108 | 108 | 
                             {% if modified %}
               | 
            
| 109 | 109 | 
                             $(function() {
               | 
            
| 110 | 
                -                function getURLParameter(name) {
               | 
            |
| 111 | 
                -                  return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
               | 
            |
| 112 | 
                - }  | 
            |
| 113 | 
                -  | 
            |
| 114 | 110 | 
                                 function show_error_dialog(title, content) {
               | 
            
| 115 | 111 | 
                                     $('#dialog #title').text(title);
               | 
            
| 116 | 112 | 
                                     $('#dialog #content').text(content);
               | 
            
                @@ -118,7 +114,7 @@  | 
            ||
| 118 | 114 | 
                }  | 
            
| 119 | 115 | 
                 | 
            
| 120 | 116 | 
                                 function data_check() {
               | 
            
| 121 | 
                -                    var unionid = getURLParameter('unionid');
               | 
            |
| 117 | 
                +                    var unionid = '{{ request.GET.unionid }}';
               | 
            |
| 122 | 118 | 
                                     if (!unionid) {
               | 
            
| 123 | 119 | 
                                         show_error_dialog('微信授权', '微信授权失败,请重新打开页面');
               | 
            
| 124 | 120 | 
                return false;  | 
            
                @@ -139,8 +135,9 @@  | 
            ||
| 139 | 135 | 
                 | 
            
| 140 | 136 | 
                                     return {
               | 
            
| 141 | 137 | 
                unionid: unionid,  | 
            
| 142 | 
                -                        openid: getURLParameter('openid'),
               | 
            |
| 143 | 
                -                        chiser: $('#chiser option:checked').val(),
               | 
            |
| 138 | 
                +                        openid: '{{ request.GET.openid }}',
               | 
            |
| 139 | 
                +                        brand_id: '{{ request.GET.brand_id }}',
               | 
            |
| 140 | 
                +                        distributor_id: $('#distributor option:checked').val(),
               | 
            |
| 144 | 141 | 
                name: name,  | 
            
| 145 | 142 | 
                                         sex: $('#sex option:checked').val(),
               | 
            
| 146 | 143 | 
                phone: phone,  | 
            
                @@ -1,366 +0,0 @@  | 
            ||
| 1 | 
                -{% load staticfiles %}
               | 
            |
| 2 | 
                -  | 
            |
| 3 | 
                -<!DOCTYPE html>  | 
            |
| 4 | 
                -<html lang="zh-CN">  | 
            |
| 5 | 
                - <head>  | 
            |
| 6 | 
                - <meta charset="utf-8">  | 
            |
| 7 | 
                - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  | 
            |
| 8 | 
                - <meta name="format-detection" content="telephone=no,email=no,address=no">  | 
            |
| 9 | 
                - <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">  | 
            |
| 10 | 
                - <title>店员销售</title>  | 
            |
| 11 | 
                -  | 
            |
| 12 | 
                - <link href="//res.wx.qq.com/open/libs/weui/0.4.3/weui.min.css" rel="stylesheet" type="text/css" />  | 
            |
| 13 | 
                -        <link href="{% static 'page/css/weui.ext.css' %}?v=1" rel="stylesheet" type="text/css" />
               | 
            |
| 14 | 
                - </head>  | 
            |
| 15 | 
                - <body>  | 
            |
| 16 | 
                - <div class="container" >  | 
            |
| 17 | 
                - <div id="machine_info">  | 
            |
| 18 | 
                - <div class="weui_cells_title">机器信息</div>  | 
            |
| 19 | 
                - <div class="weui_cells weui_cells_form">  | 
            |
| 20 | 
                - <div class="weui_cell">  | 
            |
| 21 | 
                - <div class="weui_cell_hd"><label for="" class="weui_label">型号</label></div>  | 
            |
| 22 | 
                - <div class="weui_cell_bd weui_cell_primary">  | 
            |
| 23 | 
                - <input id="model" class="weui_input" type="text" value="" placeholder="请选择相机型号" disabled>  | 
            |
| 24 | 
                - </div>  | 
            |
| 25 | 
                - </div>  | 
            |
| 26 | 
                - <div id="model_radio" class="weui_cells weui_cells_radio radio_cells">  | 
            |
| 27 | 
                -                        {% for model in models %}
               | 
            |
| 28 | 
                - <div>  | 
            |
| 29 | 
                -                            <input type="radio" class="weui_check" name="model" id="{{ model.model_id }}" value="{{ model.model_id }}" {% if forloop.first %}checked="checked"{% endif %}>
               | 
            |
| 30 | 
                -                            <label class="weui_cell weui_check_label quartern" for="{{ model.model_id }}">
               | 
            |
| 31 | 
                -                                <div class="weui_cell_bd weui_cell_primary">{{ model.model_name }}</div>
               | 
            |
| 32 | 
                - </label>  | 
            |
| 33 | 
                - </div>  | 
            |
| 34 | 
                -                        {% endfor %}
               | 
            |
| 35 | 
                - </div>  | 
            |
| 36 | 
                - <div class="weui_cell">  | 
            |
| 37 | 
                - <div class="weui_cell_hd"><label for="" class="weui_label">卡口</label></div>  | 
            |
| 38 | 
                - <div class="weui_cell_bd weui_cell_primary">  | 
            |
| 39 | 
                - <input id="mount" class="weui_input" type="text" value="" placeholder="请选择相机卡口" disabled>  | 
            |
| 40 | 
                - </div>  | 
            |
| 41 | 
                - </div>  | 
            |
| 42 | 
                - <div id="mount_radio" class="weui_cells weui_cells_radio radio_cells">  | 
            |
| 43 | 
                - <div>  | 
            |
| 44 | 
                - <input type="radio" class="weui_check" name="mount" id="e" value="E" checked="checked">  | 
            |
| 45 | 
                - <label class="weui_cell weui_check_label quartern" for="e">  | 
            |
| 46 | 
                - <div class="weui_cell_bd weui_cell_primary">E</div>  | 
            |
| 47 | 
                - </label>  | 
            |
| 48 | 
                - </div>  | 
            |
| 49 | 
                - <div>  | 
            |
| 50 | 
                - <input type="radio" class="weui_check" name="mount" id="n" value="N">  | 
            |
| 51 | 
                - <label class="weui_cell weui_check_label quartern" for="n">  | 
            |
| 52 | 
                - <div class="weui_cell_bd weui_cell_primary">N</div>  | 
            |
| 53 | 
                - </label>  | 
            |
| 54 | 
                - </div>  | 
            |
| 55 | 
                - <div>  | 
            |
| 56 | 
                - <input type="radio" class="weui_check" name="mount" id="s" value="S">  | 
            |
| 57 | 
                - <label class="weui_cell weui_check_label quartern" for="s">  | 
            |
| 58 | 
                - <div class="weui_cell_bd weui_cell_primary">S</div>  | 
            |
| 59 | 
                - </label>  | 
            |
| 60 | 
                - </div>  | 
            |
| 61 | 
                - <div>  | 
            |
| 62 | 
                - <input type="radio" class="weui_check" name="mount" id="p" value="P">  | 
            |
| 63 | 
                - <label class="weui_cell weui_check_label quartern" for="p">  | 
            |
| 64 | 
                - <div class="weui_cell_bd weui_cell_primary">P</div>  | 
            |
| 65 | 
                - </label>  | 
            |
| 66 | 
                - </div>  | 
            |
| 67 | 
                - </div>  | 
            |
| 68 | 
                - <div class="weui_cell">  | 
            |
| 69 | 
                - <div class="weui_cell_hd"><label for="" class="weui_label">机身码</label></div>  | 
            |
| 70 | 
                - <div class="weui_cell_bd weui_cell_primary">  | 
            |
| 71 | 
                - <input id="code" class="weui_input" type="text" value="" placeholder="请输入机身码">  | 
            |
| 72 | 
                - </div>  | 
            |
| 73 | 
                - <div class="weui_cell_ft">  | 
            |
| 74 | 
                - <a id="scan" href="javascript:;" class="weui_btn weui_btn_mini weui_btn_default">扫码</a>  | 
            |
| 75 | 
                - </div>  | 
            |
| 76 | 
                - </div>  | 
            |
| 77 | 
                - </div>  | 
            |
| 78 | 
                -  | 
            |
| 79 | 
                - <br>  | 
            |
| 80 | 
                -  | 
            |
| 81 | 
                - <button id="submit1" class="weui_btn weui_btn_warn">确认</button>  | 
            |
| 82 | 
                - </div>  | 
            |
| 83 | 
                -  | 
            |
| 84 | 
                - <div id="customer_info" style="display: none;">  | 
            |
| 85 | 
                - <div class="weui_cells_title">消费者信息</div>  | 
            |
| 86 | 
                - <div class="weui_cells weui_cells_form">  | 
            |
| 87 | 
                - <div class="weui_cell">  | 
            |
| 88 | 
                - <div class="weui_cell_hd"><label for="" class="weui_label">姓名</label></div>  | 
            |
| 89 | 
                - <div class="weui_cell_bd weui_cell_primary">  | 
            |
| 90 | 
                - <input id="name" class="weui_input" type="text" value="" placeholder="请输入消费者姓名">  | 
            |
| 91 | 
                - </div>  | 
            |
| 92 | 
                - </div>  | 
            |
| 93 | 
                - <div class="weui_cell">  | 
            |
| 94 | 
                - <div class="weui_cell_hd"><label for="" class="weui_label">性别</label></div>  | 
            |
| 95 | 
                - <div class="weui_cell_bd weui_cell_primary">  | 
            |
| 96 | 
                - <input id="sex" class="weui_input" type="text" value="" placeholder="请选择消费者性别" disabled>  | 
            |
| 97 | 
                - </div>  | 
            |
| 98 | 
                - </div>  | 
            |
| 99 | 
                - <div id="sex_radio" class="weui_cells weui_cells_radio radio_cells">  | 
            |
| 100 | 
                - <div>  | 
            |
| 101 | 
                - <input type="radio" class="weui_check" name="sex" id="male" value="1" checked="checked">  | 
            |
| 102 | 
                - <label class="weui_cell weui_check_label quartern" for="male">  | 
            |
| 103 | 
                - <div class="weui_cell_bd weui_cell_primary">先生</div>  | 
            |
| 104 | 
                - </label>  | 
            |
| 105 | 
                - </div>  | 
            |
| 106 | 
                - <div>  | 
            |
| 107 | 
                - <input type="radio" class="weui_check" name="sex" id="female" value="0">  | 
            |
| 108 | 
                - <label class="weui_cell weui_check_label quartern" for="female">  | 
            |
| 109 | 
                - <div class="weui_cell_bd weui_cell_primary">女士</div>  | 
            |
| 110 | 
                - </label>  | 
            |
| 111 | 
                - </div>  | 
            |
| 112 | 
                - </div>  | 
            |
| 113 | 
                - <div class="weui_cell">  | 
            |
| 114 | 
                - <div class="weui_cell_hd"><label for="" class="weui_label">年龄段</label></div>  | 
            |
| 115 | 
                - <div class="weui_cell_bd weui_cell_primary">  | 
            |
| 116 | 
                - <input id="age" class="weui_input" type="text" value="" placeholder="请选择消费者年龄段" disabled>  | 
            |
| 117 | 
                - </div>  | 
            |
| 118 | 
                - </div>  | 
            |
| 119 | 
                - <div id="age_radio" class="weui_cells weui_cells_radio radio_cells">  | 
            |
| 120 | 
                - <div>  | 
            |
| 121 | 
                - <input type="radio" class="weui_check" name="age" id="age1" value="1" checked="checked">  | 
            |
| 122 | 
                - <label class="weui_cell weui_check_label quartern" for="age1">  | 
            |
| 123 | 
                - <div class="weui_cell_bd weui_cell_primary">20岁以下</div>  | 
            |
| 124 | 
                - </label>  | 
            |
| 125 | 
                - </div>  | 
            |
| 126 | 
                - <div>  | 
            |
| 127 | 
                - <input type="radio" class="weui_check" name="age" id="age2" value="2">  | 
            |
| 128 | 
                - <label class="weui_cell weui_check_label quartern" for="age2">  | 
            |
| 129 | 
                - <div class="weui_cell_bd weui_cell_primary">20~30岁</div>  | 
            |
| 130 | 
                - </label>  | 
            |
| 131 | 
                - </div>  | 
            |
| 132 | 
                - <div>  | 
            |
| 133 | 
                - <input type="radio" class="weui_check" name="age" id="age3" value="3">  | 
            |
| 134 | 
                - <label class="weui_cell weui_check_label quartern" for="age3">  | 
            |
| 135 | 
                - <div class="weui_cell_bd weui_cell_primary">30~40岁</div>  | 
            |
| 136 | 
                - </label>  | 
            |
| 137 | 
                - </div>  | 
            |
| 138 | 
                - <div>  | 
            |
| 139 | 
                - <input type="radio" class="weui_check" name="age" id="age4" value="4">  | 
            |
| 140 | 
                - <label class="weui_cell weui_check_label quartern" for="age4">  | 
            |
| 141 | 
                - <div class="weui_cell_bd weui_cell_primary">40~50岁</div>  | 
            |
| 142 | 
                - </label>  | 
            |
| 143 | 
                - </div>  | 
            |
| 144 | 
                - <div>  | 
            |
| 145 | 
                - <input type="radio" class="weui_check" name="age" id="age5" value="5">  | 
            |
| 146 | 
                - <label class="weui_cell weui_check_label quartern" for="age5">  | 
            |
| 147 | 
                - <div class="weui_cell_bd weui_cell_primary">50岁以上</div>  | 
            |
| 148 | 
                - </label>  | 
            |
| 149 | 
                - </div>  | 
            |
| 150 | 
                - </div>  | 
            |
| 151 | 
                - <div class="weui_cell">  | 
            |
| 152 | 
                - <div class="weui_cell_hd"><label for="" class="weui_label">手机号</label></div>  | 
            |
| 153 | 
                - <div class="weui_cell_bd weui_cell_primary">  | 
            |
| 154 | 
                -                            <input id="phone" class="weui_input" type="text" required="required" pattern="1[0-9]{10}" value="" placeholder="请输入消费者手机号">
               | 
            |
| 155 | 
                - </div>  | 
            |
| 156 | 
                - </div>  | 
            |
| 157 | 
                - </div>  | 
            |
| 158 | 
                -  | 
            |
| 159 | 
                - <br>  | 
            |
| 160 | 
                -  | 
            |
| 161 | 
                - <button id="submit2" class="weui_btn weui_btn_warn">确认</button>  | 
            |
| 162 | 
                - </div>  | 
            |
| 163 | 
                -  | 
            |
| 164 | 
                - <div class="weui_dialog_alert" id="dialog" style="display: none">  | 
            |
| 165 | 
                - <div class="weui_mask"></div>  | 
            |
| 166 | 
                - <div class="weui_dialog">  | 
            |
| 167 | 
                - <div class="weui_dialog_hd"><strong id="title" class="weui_dialog_title">弹窗标题</strong></div>  | 
            |
| 168 | 
                - <div id="content" class="weui_dialog_bd">弹窗内容,告知当前页面信息等</div>  | 
            |
| 169 | 
                - <div class="weui_dialog_ft">  | 
            |
| 170 | 
                - <a href="javascript:;" class="weui_btn_dialog primary">确定</a>  | 
            |
| 171 | 
                - </div>  | 
            |
| 172 | 
                - </div>  | 
            |
| 173 | 
                - </div>  | 
            |
| 174 | 
                -  | 
            |
| 175 | 
                - <div class="weui_dialog_alert" id="dialog2" style="display: none">  | 
            |
| 176 | 
                - <div class="weui_mask"></div>  | 
            |
| 177 | 
                - <div class="weui_dialog">  | 
            |
| 178 | 
                - <div class="weui_dialog_hd"><strong id="title" class="weui_dialog_title">弹窗标题</strong></div>  | 
            |
| 179 | 
                - <div id="content" class="weui_dialog_bd">弹窗内容,告知当前页面信息等</div>  | 
            |
| 180 | 
                - <div class="weui_dialog_ft">  | 
            |
| 181 | 
                - <a href="javascript:;" class="weui_btn_dialog primary">确定</a>  | 
            |
| 182 | 
                - </div>  | 
            |
| 183 | 
                - </div>  | 
            |
| 184 | 
                - </div>  | 
            |
| 185 | 
                -  | 
            |
| 186 | 
                - <div class="weui_dialog_alert" id="dialog3" style="display: none">  | 
            |
| 187 | 
                - <div class="weui_mask"></div>  | 
            |
| 188 | 
                - <div class="weui_dialog">  | 
            |
| 189 | 
                - <div class="weui_dialog_hd"><strong id="title" class="weui_dialog_title">弹窗标题</strong></div>  | 
            |
| 190 | 
                - <div id="content" class="weui_dialog_bd">弹窗内容,告知当前页面信息等</div>  | 
            |
| 191 | 
                - <div class="weui_dialog_ft">  | 
            |
| 192 | 
                - <a href="javascript:;" class="weui_btn_dialog primary">确定</a>  | 
            |
| 193 | 
                - </div>  | 
            |
| 194 | 
                - </div>  | 
            |
| 195 | 
                - </div>  | 
            |
| 196 | 
                -  | 
            |
| 197 | 
                - <div id="toast" style="display: none;">  | 
            |
| 198 | 
                - <div class="weui_mask_transparent"></div>  | 
            |
| 199 | 
                - <div class="weui_toast">  | 
            |
| 200 | 
                - <i class="weui_icon_toast"></i>  | 
            |
| 201 | 
                - <p class="weui_toast_content">已完成</p>  | 
            |
| 202 | 
                - </div>  | 
            |
| 203 | 
                - </div>  | 
            |
| 204 | 
                - </div>  | 
            |
| 205 | 
                -  | 
            |
| 206 | 
                - <script src="//cdn.bootcss.com/zepto/1.1.6/zepto.min.js"></script>  | 
            |
| 207 | 
                - <script>  | 
            |
| 208 | 
                -            $(function() {
               | 
            |
| 209 | 
                -                function show_error_dialog(title, content) {
               | 
            |
| 210 | 
                -                    $('#dialog #title').text(title);
               | 
            |
| 211 | 
                -                    $('#dialog #content').text(content);
               | 
            |
| 212 | 
                -                    $('#dialog').show();
               | 
            |
| 213 | 
                - }  | 
            |
| 214 | 
                -  | 
            |
| 215 | 
                -                function show_error_dialog2(title, content) {
               | 
            |
| 216 | 
                -                    $('#dialog2 #title').text(title);
               | 
            |
| 217 | 
                -                    $('#dialog2 #content').text(content);
               | 
            |
| 218 | 
                -                    $('#dialog2').show();
               | 
            |
| 219 | 
                - }  | 
            |
| 220 | 
                -  | 
            |
| 221 | 
                -                function show_error_dialog3(title, content) {
               | 
            |
| 222 | 
                -                    $('#dialog3 #title').text(title);
               | 
            |
| 223 | 
                -                    $('#dialog3 #content').text(content);
               | 
            |
| 224 | 
                -                    $('#dialog3').show();
               | 
            |
| 225 | 
                - }  | 
            |
| 226 | 
                -  | 
            |
| 227 | 
                -                function data_check() {
               | 
            |
| 228 | 
                -                    var clerk_id = "{{ clerk_info.clerk_id }}";
               | 
            |
| 229 | 
                -                    if (!clerk_id) {
               | 
            |
| 230 | 
                -                        show_error_dialog('微信授权', '微信授权失败,请重新打开页面');
               | 
            |
| 231 | 
                - return false;  | 
            |
| 232 | 
                - }  | 
            |
| 233 | 
                -  | 
            |
| 234 | 
                -                    var code = $('#code').val();
               | 
            |
| 235 | 
                -                    if (!code) {
               | 
            |
| 236 | 
                -                        show_error_dialog('机身码', '机身码错误,请检查重新输入');
               | 
            |
| 237 | 
                - return false;  | 
            |
| 238 | 
                - }  | 
            |
| 239 | 
                -  | 
            |
| 240 | 
                -                    return {
               | 
            |
| 241 | 
                - step: 1,  | 
            |
| 242 | 
                - clerk_id: clerk_id,  | 
            |
| 243 | 
                -                        model_id: $("#model_radio input[name='model']:checked").val(),
               | 
            |
| 244 | 
                -                        mount: $("#mount_radio input[name='mount']:checked").val(),
               | 
            |
| 245 | 
                - code: code,  | 
            |
| 246 | 
                - }  | 
            |
| 247 | 
                - }  | 
            |
| 248 | 
                -  | 
            |
| 249 | 
                -                function data_check2() {
               | 
            |
| 250 | 
                -                    var clerk_id = "{{ clerk_info.clerk_id }}";
               | 
            |
| 251 | 
                -                    if (!clerk_id) {
               | 
            |
| 252 | 
                -                        show_error_dialog('微信授权', '微信授权失败,请重新打开页面');
               | 
            |
| 253 | 
                - return false;  | 
            |
| 254 | 
                - }  | 
            |
| 255 | 
                -  | 
            |
| 256 | 
                -                    var code = $('#code').val();
               | 
            |
| 257 | 
                -                    if (!code) {
               | 
            |
| 258 | 
                -                        show_error_dialog('机身码', '机身码错误,请检查重新输入');
               | 
            |
| 259 | 
                - return false;  | 
            |
| 260 | 
                - }  | 
            |
| 261 | 
                -  | 
            |
| 262 | 
                -                    var name = $('#name').val();
               | 
            |
| 263 | 
                -                    if (!name) {
               | 
            |
| 264 | 
                -                        show_error_dialog('姓名', '姓名错误,请检查重新输入');
               | 
            |
| 265 | 
                - return false;  | 
            |
| 266 | 
                - }  | 
            |
| 267 | 
                -  | 
            |
| 268 | 
                -                    var phone = $('#phone').val();
               | 
            |
| 269 | 
                -                    var phone_valid = $('#phone').is(':valid');
               | 
            |
| 270 | 
                -                    if (!(phone && phone_valid)) {
               | 
            |
| 271 | 
                -                        show_error_dialog('手机号', '手机号错误,请检查重新输入');
               | 
            |
| 272 | 
                - return false;  | 
            |
| 273 | 
                - }  | 
            |
| 274 | 
                -  | 
            |
| 275 | 
                -                    return {
               | 
            |
| 276 | 
                - step: 2,  | 
            |
| 277 | 
                - clerk_id: clerk_id,  | 
            |
| 278 | 
                -                        model_id: $("#model_radio input[name='model']:checked").val(),
               | 
            |
| 279 | 
                -                        mount: $("#mount_radio input[name='mount']:checked").val(),
               | 
            |
| 280 | 
                - code: code,  | 
            |
| 281 | 
                - name: name,  | 
            |
| 282 | 
                -                        sex: $("#sex_radio input[name='sex']:checked").val(),
               | 
            |
| 283 | 
                -                        age: $("#age_radio input[name='age']:checked").val(),
               | 
            |
| 284 | 
                - phone: phone,  | 
            |
| 285 | 
                - }  | 
            |
| 286 | 
                - }  | 
            |
| 287 | 
                -  | 
            |
| 288 | 
                -                $('#submit1').click(function () {
               | 
            |
| 289 | 
                - var check_result = data_check();  | 
            |
| 290 | 
                -                    if (check_result){
               | 
            |
| 291 | 
                -                        $.ajax({
               | 
            |
| 292 | 
                - type: 'POST',  | 
            |
| 293 | 
                -                            url: '{{ domain }}/api/clerk/sale/submit',
               | 
            |
| 294 | 
                - data: check_result,  | 
            |
| 295 | 
                -                            success: function(data) {
               | 
            |
| 296 | 
                -                                if (data.status == 200) {
               | 
            |
| 297 | 
                -{#                                    $('#toast').show();#}
               | 
            |
| 298 | 
                -{#                                    setTimeout(function () {#}
               | 
            |
| 299 | 
                -{#                                        $('#toast').hide();#}
               | 
            |
| 300 | 
                -{#                                    }, 1000);#}
               | 
            |
| 301 | 
                -                                    show_error_dialog2('成功', '机器信息提交成功');
               | 
            |
| 302 | 
                -                                } else {
               | 
            |
| 303 | 
                -                                    show_error_dialog('错误', data.description);
               | 
            |
| 304 | 
                - }  | 
            |
| 305 | 
                - }  | 
            |
| 306 | 
                - })  | 
            |
| 307 | 
                - }  | 
            |
| 308 | 
                - });  | 
            |
| 309 | 
                -  | 
            |
| 310 | 
                -                $('#submit2').click(function () {
               | 
            |
| 311 | 
                - var check_result = data_check2();  | 
            |
| 312 | 
                -                    if (check_result){
               | 
            |
| 313 | 
                -                        $.ajax({
               | 
            |
| 314 | 
                - type: 'POST',  | 
            |
| 315 | 
                -                            url: '{{ domain }}/api/clerk/sale/submit',
               | 
            |
| 316 | 
                - data: check_result,  | 
            |
| 317 | 
                -                            success: function(data) {
               | 
            |
| 318 | 
                -                                if (data.status == 200) {
               | 
            |
| 319 | 
                -                                    show_error_dialog3('成功', '消费者信息提交成功');
               | 
            |
| 320 | 
                -                                } else {
               | 
            |
| 321 | 
                -                                    show_error_dialog('错误', data.description);
               | 
            |
| 322 | 
                - }  | 
            |
| 323 | 
                - }  | 
            |
| 324 | 
                - })  | 
            |
| 325 | 
                - }  | 
            |
| 326 | 
                - });  | 
            |
| 327 | 
                -  | 
            |
| 328 | 
                -                $('#dialog .weui_btn_dialog').click(function () {
               | 
            |
| 329 | 
                -                    $('#dialog').hide();
               | 
            |
| 330 | 
                - })  | 
            |
| 331 | 
                -  | 
            |
| 332 | 
                -                $('#dialog2 .weui_btn_dialog').click(function () {
               | 
            |
| 333 | 
                -                    $('#dialog2').hide();
               | 
            |
| 334 | 
                -                    $('#machine_info').hide();
               | 
            |
| 335 | 
                -                    $('#customer_info').show();
               | 
            |
| 336 | 
                - })  | 
            |
| 337 | 
                -  | 
            |
| 338 | 
                -                $('#dialog3 .weui_btn_dialog').click(function () {
               | 
            |
| 339 | 
                -                    $('#dialog').hide();
               | 
            |
| 340 | 
                - window.location.reload();  | 
            |
| 341 | 
                - })  | 
            |
| 342 | 
                - });  | 
            |
| 343 | 
                - </script>  | 
            |
| 344 | 
                - <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>  | 
            |
| 345 | 
                -        <script type="text/javascript" src="{% static 'kodo/js/jswe-0.0.4.js' %}"></script>
               | 
            |
| 346 | 
                - <script>  | 
            |
| 347 | 
                -            V.initWxData({
               | 
            |
| 348 | 
                - imgUrl: 'http://pai.ai/static/kodo/img/paiai_96_96.png',  | 
            |
| 349 | 
                - link: 'http://pai.ai/w/o?r=http%3A%2F%2Fkodo.xfoto.com.cn%2Fp%2Fclerk%2Fsale',  | 
            |
| 350 | 
                - desc: '店员授权',  | 
            |
| 351 | 
                - title: '店员授权',  | 
            |
| 352 | 
                - timeLine: ''  | 
            |
| 353 | 
                - }, true);  | 
            |
| 354 | 
                - V.hideOptionMenu();  | 
            |
| 355 | 
                -  | 
            |
| 356 | 
                -            $('#scan').click(function () {
               | 
            |
| 357 | 
                -                V.scanQRCode({
               | 
            |
| 358 | 
                - needResult: 1  | 
            |
| 359 | 
                - });  | 
            |
| 360 | 
                - });  | 
            |
| 361 | 
                -            V.wxScanQRCodeSuccess = function (res) {
               | 
            |
| 362 | 
                -                $('#code').val(V.parseScanQRCodeResultStr(res.resultStr));
               | 
            |
| 363 | 
                - }  | 
            |
| 364 | 
                - </script>  | 
            |
| 365 | 
                - </body>  | 
            |
| 366 | 
                -</html>  | 
            
                @@ -31,6 +31,5 @@ urlpatterns += [  | 
            ||
| 31 | 31 | 
                 | 
            
| 32 | 32 | 
                urlpatterns = [  | 
            
| 33 | 33 | 
                url(r'^clerk$', oauth_views.clerk_oauth, name='clerk_oauth'), # 店员授权页面  | 
            
| 34 | 
                - url(r'^clerk/sale$', sale_views.clerk_sale_oauth, name='clerk_sale_oauth'), # 店员销售授权页面  | 
            |
| 35 | 34 | 
                url(r'^clerk/info$', info_views.clerk_info_oauth, name='clerk_info_oauth'), # 店员信息授权页面  | 
            
| 36 | 35 | 
                ]  | 
            
                @@ -1,29 +0,0 @@  | 
            ||
| 1 | 
                -# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                -  | 
            |
| 3 | 
                -from django.contrib import admin  | 
            |
| 4 | 
                -  | 
            |
| 5 | 
                -from product.models import ProductCodeSubmitLogInfo, ProductInfo, ProductModelInfo  | 
            |
| 6 | 
                -  | 
            |
| 7 | 
                -  | 
            |
| 8 | 
                -class ProductModelInfoAdmin(admin.ModelAdmin):  | 
            |
| 9 | 
                -    readonly_fields = ('model_id', )
               | 
            |
| 10 | 
                -    list_display = ('model_id', 'model_name', 'integral', 'has_mount', 'status', 'created_at', 'updated_at')
               | 
            |
| 11 | 
                -    search_fields = ('model_id', 'model_name')
               | 
            |
| 12 | 
                -    list_filter = ('has_mount', 'status')
               | 
            |
| 13 | 
                -  | 
            |
| 14 | 
                -  | 
            |
| 15 | 
                -class ProductInfoAdmin(admin.ModelAdmin):  | 
            |
| 16 | 
                -    list_display = ('model_id', 'model_name', 'code', 'code_status', 'integral', 'integral_status', 'franchiser_id', 'clerk_id', 'consumer_name', 'consumer_sex', 'consumer_age', 'consumer_phone', 'status', 'created_at', 'updated_at')
               | 
            |
| 17 | 
                -    search_fields = ('model_id', 'model_name', 'code', 'consumer_name', 'consumer_phone')
               | 
            |
| 18 | 
                -    list_filter = ('code_status', 'integral_status', 'franchiser_id', 'consumer_sex', 'status')
               | 
            |
| 19 | 
                -  | 
            |
| 20 | 
                -  | 
            |
| 21 | 
                -class ProductCodeSubmitLogInfoAdmin(admin.ModelAdmin):  | 
            |
| 22 | 
                -    list_display = ('model_id', 'model_name', 'mount', 'code', 'franchiser_id', 'clerk_id', 'consumer_name', 'consumer_sex', 'consumer_age', 'consumer_phone', 'status', 'created_at', 'updated_at')
               | 
            |
| 23 | 
                -    search_fields = ('model_id', 'model_name', 'code', 'consumer_name', 'consumer_phone')
               | 
            |
| 24 | 
                -    list_filter = ('step', 'mount', 'franchiser_id', 'consumer_sex', 'status')
               | 
            |
| 25 | 
                -  | 
            |
| 26 | 
                -  | 
            |
| 27 | 
                -admin.site.register(ProductModelInfo, ProductModelInfoAdmin)  | 
            |
| 28 | 
                -admin.site.register(ProductInfo, ProductInfoAdmin)  | 
            |
| 29 | 
                -admin.site.register(ProductCodeSubmitLogInfo, ProductCodeSubmitLogInfoAdmin)  | 
            
                @@ -1,86 +0,0 @@  | 
            ||
| 1 | 
                -# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                -# Generated by Django 1.11.9 on 2018-02-07 14:16  | 
            |
| 3 | 
                -from __future__ import unicode_literals  | 
            |
| 4 | 
                -  | 
            |
| 5 | 
                -from django.db import migrations, models  | 
            |
| 6 | 
                -import shortuuidfield.fields  | 
            |
| 7 | 
                -  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -class Migration(migrations.Migration):  | 
            |
| 10 | 
                -  | 
            |
| 11 | 
                - initial = True  | 
            |
| 12 | 
                -  | 
            |
| 13 | 
                - dependencies = [  | 
            |
| 14 | 
                - ]  | 
            |
| 15 | 
                -  | 
            |
| 16 | 
                - operations = [  | 
            |
| 17 | 
                - migrations.CreateModel(  | 
            |
| 18 | 
                - name='ProductCodeSubmitLogInfo',  | 
            |
| 19 | 
                - fields=[  | 
            |
| 20 | 
                -                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
               | 
            |
| 21 | 
                -                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
               | 
            |
| 22 | 
                -                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
               | 
            |
| 23 | 
                -                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
               | 
            |
| 24 | 
                -                ('sex', models.BooleanField(choices=[(1, '\u7537'), (0, '\u5973')], db_index=True, default=1, help_text='Sex', verbose_name='sex')),
               | 
            |
| 25 | 
                -                ('step', models.IntegerField(db_index=True, default=1, help_text='\u63d0\u4ea4\u6b65\u9aa4', verbose_name='step')),
               | 
            |
| 26 | 
                -                ('model_id', models.CharField(blank=True, db_index=True, help_text='\u578b\u53f7\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='model_id')),
               | 
            |
| 27 | 
                -                ('model_name', models.CharField(blank=True, db_index=True, help_text='\u578b\u53f7\u540d\u79f0', max_length=32, null=True, verbose_name='model_name')),
               | 
            |
| 28 | 
                -                ('mount', models.CharField(blank=True, db_index=True, help_text='\u5361\u53e3', max_length=255, null=True, verbose_name='mount')),
               | 
            |
| 29 | 
                -                ('code', models.CharField(blank=True, help_text='\u673a\u8eab\u7801', max_length=32, null=True, verbose_name='code')),
               | 
            |
| 30 | 
                -                ('franchiser_id', models.CharField(blank=True, db_index=True, help_text='\u7ecf\u9500\u5546\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='franchiser_id')),
               | 
            |
| 31 | 
                -                ('clerk_id', models.CharField(blank=True, db_index=True, help_text='\u5e97\u5458\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='clerk_id')),
               | 
            |
| 32 | 
                -                ('consumer_name', models.CharField(blank=True, help_text='\u6d88\u8d39\u8005\u540d\u79f0', max_length=32, null=True, verbose_name='consumer_name')),
               | 
            |
| 33 | 
                -                ('consumer_sex', models.IntegerField(choices=[(1, '\u7537'), (0, '\u5973')], db_index=True, default=1, help_text='\u6d88\u8d39\u8005\u6027\u522b', verbose_name='consumer_sex')),
               | 
            |
| 34 | 
                -                ('consumer_age', models.IntegerField(default=0, help_text='\u6d88\u8d39\u8005\u5e74\u9f84', verbose_name='consumer_age')),
               | 
            |
| 35 | 
                -                ('consumer_phone', models.CharField(blank=True, help_text='\u6d88\u8d39\u8005\u8054\u7cfb\u7535\u8bdd', max_length=11, null=True, verbose_name='consumer_phone')),
               | 
            |
| 36 | 
                - ],  | 
            |
| 37 | 
                -            options={
               | 
            |
| 38 | 
                - 'verbose_name': 'productcodesubmitloginfo',  | 
            |
| 39 | 
                - 'verbose_name_plural': 'productcodesubmitloginfo',  | 
            |
| 40 | 
                - },  | 
            |
| 41 | 
                - ),  | 
            |
| 42 | 
                - migrations.CreateModel(  | 
            |
| 43 | 
                - name='ProductInfo',  | 
            |
| 44 | 
                - fields=[  | 
            |
| 45 | 
                -                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
               | 
            |
| 46 | 
                -                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
               | 
            |
| 47 | 
                -                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
               | 
            |
| 48 | 
                -                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
               | 
            |
| 49 | 
                -                ('sex', models.BooleanField(choices=[(1, '\u7537'), (0, '\u5973')], db_index=True, default=1, help_text='Sex', verbose_name='sex')),
               | 
            |
| 50 | 
                -                ('model_id', models.CharField(blank=True, db_index=True, help_text='\u578b\u53f7\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='model_id')),
               | 
            |
| 51 | 
                -                ('model_name', models.CharField(blank=True, db_index=True, help_text='\u578b\u53f7\u540d\u79f0', max_length=32, null=True, verbose_name='model_name')),
               | 
            |
| 52 | 
                -                ('mount', models.CharField(blank=True, db_index=True, help_text='\u5361\u53e3', max_length=32, null=True, verbose_name='mount')),
               | 
            |
| 53 | 
                -                ('code', models.CharField(blank=True, help_text='\u673a\u8eab\u7801', max_length=32, null=True, verbose_name='code')),
               | 
            |
| 54 | 
                -                ('code_status', models.BooleanField(db_index=True, default=False, help_text='\u673a\u8eab\u7801\u72b6\u6001, True\u5df2\u4f7f\u7528\uff0cFalse\u672a\u4f7f\u7528', verbose_name='code_status')),
               | 
            |
| 55 | 
                -                ('integral', models.IntegerField(default=0, help_text='\u79ef\u5206', verbose_name='integral')),
               | 
            |
| 56 | 
                -                ('integral_status', models.BooleanField(db_index=True, default=False, help_text='\u79ef\u5206\u72b6\u6001, True\u5df2\u79ef\u5206\uff0cFalse\u672a\u79ef\u5206', verbose_name='integral_status')),
               | 
            |
| 57 | 
                -                ('franchiser_id', models.CharField(blank=True, db_index=True, help_text='\u7ecf\u9500\u5546\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='franchiser_id')),
               | 
            |
| 58 | 
                -                ('clerk_id', models.CharField(blank=True, db_index=True, help_text='\u5e97\u5458\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='clerk_id')),
               | 
            |
| 59 | 
                -                ('consumer_name', models.CharField(blank=True, help_text='\u6d88\u8d39\u8005\u540d\u79f0', max_length=32, null=True, verbose_name='consumer_name')),
               | 
            |
| 60 | 
                -                ('consumer_sex', models.IntegerField(choices=[(1, '\u7537'), (0, '\u5973')], db_index=True, default=1, help_text='\u6d88\u8d39\u8005\u6027\u522b', verbose_name='consumer_sex')),
               | 
            |
| 61 | 
                -                ('consumer_age', models.IntegerField(default=0, help_text='\u6d88\u8d39\u8005\u5e74\u9f84', verbose_name='consumer_age')),
               | 
            |
| 62 | 
                -                ('consumer_phone', models.CharField(blank=True, help_text='\u6d88\u8d39\u8005\u8054\u7cfb\u7535\u8bdd', max_length=11, null=True, verbose_name='consumer_phone')),
               | 
            |
| 63 | 
                - ],  | 
            |
| 64 | 
                -            options={
               | 
            |
| 65 | 
                - 'verbose_name': 'productinfo',  | 
            |
| 66 | 
                - 'verbose_name_plural': 'productinfo',  | 
            |
| 67 | 
                - },  | 
            |
| 68 | 
                - ),  | 
            |
| 69 | 
                - migrations.CreateModel(  | 
            |
| 70 | 
                - name='ProductModelInfo',  | 
            |
| 71 | 
                - fields=[  | 
            |
| 72 | 
                -                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
               | 
            |
| 73 | 
                -                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
               | 
            |
| 74 | 
                -                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
               | 
            |
| 75 | 
                -                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
               | 
            |
| 76 | 
                -                ('model_id', shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='\u578b\u53f7\u552f\u4e00\u6807\u8bc6', max_length=22, unique=True)),
               | 
            |
| 77 | 
                -                ('model_name', models.CharField(blank=True, help_text='\u578b\u53f7\u540d\u79f0', max_length=32, null=True, unique=True, verbose_name='model_name')),
               | 
            |
| 78 | 
                -                ('integral', models.IntegerField(default=0, help_text='\u578b\u53f7\u79ef\u5206', verbose_name='integral')),
               | 
            |
| 79 | 
                -                ('has_mount', models.BooleanField(db_index=True, default=True, help_text='\u662f\u5426\u6709\u5361\u53e3', verbose_name='has_mount')),
               | 
            |
| 80 | 
                - ],  | 
            |
| 81 | 
                -            options={
               | 
            |
| 82 | 
                - 'verbose_name': '\u4ea7\u54c1\u578b\u53f7\u4fe1\u606f',  | 
            |
| 83 | 
                - 'verbose_name_plural': '\u4ea7\u54c1\u578b\u53f7\u4fe1\u606f',  | 
            |
| 84 | 
                - },  | 
            |
| 85 | 
                - ),  | 
            |
| 86 | 
                - ]  | 
            
                @@ -1,88 +0,0 @@  | 
            ||
| 1 | 
                -# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                -  | 
            |
| 3 | 
                -from django.db import models  | 
            |
| 4 | 
                -from django.utils.translation import ugettext_lazy as _  | 
            |
| 5 | 
                -from django_models_ext import BaseModelMixin, SexModelMixin  | 
            |
| 6 | 
                -from shortuuidfield import ShortUUIDField  | 
            |
| 7 | 
                -  | 
            |
| 8 | 
                -  | 
            |
| 9 | 
                -class ProductModelInfo(BaseModelMixin):  | 
            |
| 10 | 
                - model_id = ShortUUIDField(_(u'model_id'), max_length=32, help_text=u'型号唯一标识', db_index=True, unique=True)  | 
            |
| 11 | 
                - model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称', unique=True)  | 
            |
| 12 | 
                - integral = models.IntegerField(_(u'integral'), default=0, help_text=u'型号积分')  | 
            |
| 13 | 
                - has_mount = models.BooleanField(_(u'has_mount'), default=True, help_text=u'是否有卡口', db_index=True)  | 
            |
| 14 | 
                -  | 
            |
| 15 | 
                - class Meta:  | 
            |
| 16 | 
                - verbose_name = _(u'产品型号信息')  | 
            |
| 17 | 
                - verbose_name_plural = _(u'产品型号信息')  | 
            |
| 18 | 
                -  | 
            |
| 19 | 
                - def __unicode__(self):  | 
            |
| 20 | 
                - return unicode(self.pk)  | 
            |
| 21 | 
                -  | 
            |
| 22 | 
                - @property  | 
            |
| 23 | 
                - def data(self):  | 
            |
| 24 | 
                -        return {
               | 
            |
| 25 | 
                - 'model_id': self.model_id,  | 
            |
| 26 | 
                - 'model_name': self.model_name,  | 
            |
| 27 | 
                - 'integral': self.integral,  | 
            |
| 28 | 
                - 'has_mount': self.has_mount,  | 
            |
| 29 | 
                - }  | 
            |
| 30 | 
                -  | 
            |
| 31 | 
                -  | 
            |
| 32 | 
                -class ProductInfo(BaseModelMixin, SexModelMixin):  | 
            |
| 33 | 
                - model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True)  | 
            |
| 34 | 
                - model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称', db_index=True)  | 
            |
| 35 | 
                -  | 
            |
| 36 | 
                - mount = models.CharField(_(u'mount'), max_length=32, blank=True, null=True, help_text=u'卡口', db_index=True)  | 
            |
| 37 | 
                - code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码')  | 
            |
| 38 | 
                - code_status = models.BooleanField(_(u'code_status'), default=False, help_text=u'机身码状态, True已使用,False未使用', db_index=True)  | 
            |
| 39 | 
                -  | 
            |
| 40 | 
                - integral = models.IntegerField(_(u'integral'), default=0, help_text=u'积分')  | 
            |
| 41 | 
                - integral_status = models.BooleanField(_(u'integral_status'), default=False, help_text=u'积分状态, True已积分,False未积分', db_index=True)  | 
            |
| 42 | 
                -  | 
            |
| 43 | 
                - franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True)  | 
            |
| 44 | 
                - clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True)  | 
            |
| 45 | 
                -  | 
            |
| 46 | 
                - consumer_name = models.CharField(_(u'consumer_name'), max_length=32, blank=True, null=True, help_text=u'消费者名称')  | 
            |
| 47 | 
                - consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.MALE, help_text=u'消费者性别', db_index=True)  | 
            |
| 48 | 
                - consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄')  | 
            |
| 49 | 
                - consumer_phone = models.CharField(_(u'consumer_phone'), max_length=11, blank=True, null=True, help_text=u'消费者联系电话')  | 
            |
| 50 | 
                -  | 
            |
| 51 | 
                - class Meta:  | 
            |
| 52 | 
                - verbose_name = _(u'productinfo')  | 
            |
| 53 | 
                - verbose_name_plural = _(u'productinfo')  | 
            |
| 54 | 
                -  | 
            |
| 55 | 
                - def __unicode__(self):  | 
            |
| 56 | 
                - return unicode(self.pk)  | 
            |
| 57 | 
                -  | 
            |
| 58 | 
                - @property  | 
            |
| 59 | 
                - def data(self):  | 
            |
| 60 | 
                -        return {
               | 
            |
| 61 | 
                - 'model_id': self.model_id,  | 
            |
| 62 | 
                - 'model_name': self.model_name,  | 
            |
| 63 | 
                - 'code': self.code,  | 
            |
| 64 | 
                - }  | 
            |
| 65 | 
                -  | 
            |
| 66 | 
                -  | 
            |
| 67 | 
                -class ProductCodeSubmitLogInfo(BaseModelMixin, SexModelMixin):  | 
            |
| 68 | 
                - step = models.IntegerField(_(u'step'), default=1, help_text=u'提交步骤', db_index=True)  | 
            |
| 69 | 
                -  | 
            |
| 70 | 
                - model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True)  | 
            |
| 71 | 
                - model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称', db_index=True)  | 
            |
| 72 | 
                - mount = models.CharField(_(u'mount'), max_length=255, blank=True, null=True, help_text=u'卡口', db_index=True)  | 
            |
| 73 | 
                - code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码')  | 
            |
| 74 | 
                -  | 
            |
| 75 | 
                - franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True)  | 
            |
| 76 | 
                - clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True)  | 
            |
| 77 | 
                -  | 
            |
| 78 | 
                - consumer_name = models.CharField(_(u'consumer_name'), max_length=32, blank=True, null=True, help_text=u'消费者名称')  | 
            |
| 79 | 
                - consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.MALE, help_text=u'消费者性别', db_index=True)  | 
            |
| 80 | 
                - consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄')  | 
            |
| 81 | 
                - consumer_phone = models.CharField(_(u'consumer_phone'), max_length=11, blank=True, null=True, help_text=u'消费者联系电话')  | 
            |
| 82 | 
                -  | 
            |
| 83 | 
                - class Meta:  | 
            |
| 84 | 
                - verbose_name = _(u'productcodesubmitloginfo')  | 
            |
| 85 | 
                - verbose_name_plural = _(u'productcodesubmitloginfo')  | 
            |
| 86 | 
                -  | 
            |
| 87 | 
                - def __unicode__(self):  | 
            |
| 88 | 
                - return unicode(self.pk)  | 
            
                @@ -1,4 +0,0 @@  | 
            ||
| 1 | 
                -from django.test import TestCase  | 
            |
| 2 | 
                -  | 
            |
| 3 | 
                -  | 
            |
| 4 | 
                -# Create your tests here.  | 
            
                @@ -1,4 +0,0 @@  | 
            ||
| 1 | 
                -from django.shortcuts import render  | 
            |
| 2 | 
                -  | 
            |
| 3 | 
                -  | 
            |
| 4 | 
                -# Create your views here.  | 
            
                @@ -25,7 +25,7 @@ django-rlog==1.0.7  | 
            ||
| 25 | 25 | 
                django-shortuuidfield==0.1.3  | 
            
| 26 | 26 | 
                django-six==1.0.4  | 
            
| 27 | 27 | 
                django-uniapi==1.0.1  | 
            
| 28 | 
                -django-we==1.3.9  | 
            |
| 28 | 
                +django-we==1.4.0  | 
            |
| 29 | 29 | 
                djangorestframework==3.7.7  | 
            
| 30 | 30 | 
                furl==1.0.1  | 
            
| 31 | 31 | 
                hiredis==0.2.0  | 
            
                @@ -3,11 +3,6 @@  | 
            ||
| 3 | 3 | 
                from StatusCode import BaseStatusCode, StatusCodeField  | 
            
| 4 | 4 | 
                 | 
            
| 5 | 5 | 
                 | 
            
| 6 | 
                -class FranchiserStatusCode(BaseStatusCode):  | 
            |
| 7 | 
                - """ 经销商相关错误码 5000xx """  | 
            |
| 8 | 
                - CHISER_NOT_FOUND = StatusCodeField(500001, 'Chiser Not Found', description=u'经销商不存在')  | 
            |
| 9 | 
                -  | 
            |
| 10 | 
                -  | 
            |
| 11 | 6 | 
                class SaleclerkStatusCode(BaseStatusCode):  | 
            
| 12 | 7 | 
                """ 店员相关错误码 5001xx """  | 
            
| 13 | 8 | 
                CLERK_NOT_FOUND = StatusCodeField(500101, 'Clerk Not Found', description=u'店员不存在')  |