ass="lines-code">
- show_error_dialog2('成功', '机器信息提交成功');
- } else {
- show_error_dialog('错误', data.description);
- }
- }
- })
- }
- });
-
- $('#submit2').click(function () {
- var check_result = data_check2();
- if (check_result){
- $.ajax({
- type: 'POST',
- url: '{{ domain }}/api/clerk/sale/submit',
- data: check_result,
- success: function(data) {
- if (data.status == 200) {
- show_error_dialog3('成功', '消费者信息提交成功');
- } else {
- show_error_dialog('错误', data.description);
- }
- }
- })
- }
- });
-
- $('#dialog .weui_btn_dialog').click(function () {
- $('#dialog').hide();
- })
-
- $('#dialog2 .weui_btn_dialog').click(function () {
- $('#dialog2').hide();
- $('#machine_info').hide();
- $('#customer_info').show();
- })
-
- $('#dialog3 .weui_btn_dialog').click(function () {
- $('#dialog').hide();
- window.location.reload();
- })
- });
- </script>
- <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
- <script type="text/javascript" src="{% static 'kodo/js/jswe-0.0.4.js' %}"></script>
- <script>
- V.initWxData({
- imgUrl: 'http://pai.ai/static/kodo/img/paiai_96_96.png',
- link: 'http://pai.ai/w/o?r=http%3A%2F%2Fkodo.xfoto.com.cn%2Fp%2Fclerk%2Fsale',
- desc: '店员授权',
- title: '店员授权',
- timeLine: ''
- }, true);
- V.hideOptionMenu();
-
- $('#scan').click(function () {
- V.scanQRCode({
- needResult: 1
- });
- });
- V.wxScanQRCodeSuccess = function (res) {
- $('#code').val(V.parseScanQRCodeResultStr(res.resultStr));
- }
- </script>
- </body>
-</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'店员不存在') |