DistributorInfo

Brightcells 6 年 前
コミット
1d4dc7ca9e
共有6 個のファイルを変更した78 個の追加71 個の削除を含む
  1. 6 5
      api/clerk_views.py
  2. 10 8
      api/mch_views.py
  3. 1 0
      mch/models.py
  4. 6 5
      page/oauth_views.py
  5. 44 42
      page/sale_views.py
  6. 11 11
      page/templates/page/clerk_oauth.html

+ 6 - 5
api/clerk_views.py

@@ -23,15 +23,16 @@ def clerk_add(request):
23 23
     except AdministratorInfo.DoesNotExist:
24 24
         return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND)
25 25
 
26
-    try:
27
-        distributor = DistributorInfo.objects.get(distributor_id=distributor_id, status=True)
28
-    except DistributorInfo.DoesNotExist:
29
-        return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
26
+    # try:
27
+    #     distributor = DistributorInfo.objects.get(distributor_id=distributor_id, status=True)
28
+    # except DistributorInfo.DoesNotExist:
29
+    #     return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
30 30
 
31 31
     SaleclerkInfo.objects.create(
32 32
         brand_id=administrator.brand_id,
33 33
         distributor_id=distributor_id,
34
-        distributor_name=distributor.distributor_name,
34
+        # distributor_name=distributor.distributor_name,
35
+        distributor_name='',
35 36
         clerk_name=clerk_name,
36 37
         clerk_phone=clerk_phone,
37 38
     )

+ 10 - 8
api/mch_views.py

@@ -235,12 +235,12 @@ def consumer_info_api(request):
235 235
     except ValueError:
236 236
         return response(ProductModelStatusCode.MODEL_NOT_FOUND)
237 237
 
238
-    try:
239
-        distributor = DistributorInfo.objects.get(pk=distributorID)
240
-    except DistributorInfo.DoesNotExist:
241
-        return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
242
-    except ValueError:
243
-        return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
238
+    # try:
239
+    #     distributor = DistributorInfo.objects.get(pk=distributorID)
240
+    # except DistributorInfo.DoesNotExist:
241
+    #     return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
242
+    # except ValueError:
243
+    #     return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
244 244
 
245 245
     # 记录用户信息提交记录
246 246
     ConsumeInfoSubmitLogInfo.objects.create(
@@ -254,8 +254,10 @@ def consumer_info_api(request):
254 254
         brand_name=brand.brand_name,
255 255
         model_id=model.model_id,
256 256
         model_name=model.model_name,
257
-        distributor_id=distributor.distributor_id,
258
-        distributor_name=distributor.distributor_name,
257
+        # distributor_id=distributor.distributor_id,
258
+        # distributor_name=distributor.distributor_name,
259
+        distributor_id='',
260
+        distributor_name='',
259 261
         serialNo=serialNo,
260 262
         verifyResult=verifyResult,
261 263
         test_user=user.test_user,

+ 1 - 0
mch/models.py

@@ -163,6 +163,7 @@ class ModelInfo(BaseModelMixin):
163 163
     @property
164 164
     def data(self):
165 165
         return {
166
+            'jancode': self.jancode,
166 167
             'model_id': str(self.pk),
167 168
             'model_name': self.model_name,
168 169
             'model_descr': self.model_descr,

+ 6 - 5
page/oauth_views.py

@@ -94,14 +94,15 @@ def clerk_submit_api(request):
94 94
     if SaleclerkInfo.objects.filter(clerk_phone=phone).exclude(unionid=unionid).exists():
95 95
         return response(SaleclerkStatusCode.CLERK_PHONE_ALREADY_EXISTS)
96 96
 
97
-    try:
98
-        distributor = DistributorInfo.objects.get(distributor_id=distributor_id)
99
-    except DistributorInfo.DoesNotExist:
100
-        return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
97
+    # try:
98
+    #     distributor = DistributorInfo.objects.get(distributor_id=distributor_id)
99
+    # except DistributorInfo.DoesNotExist:
100
+    #     return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
101 101
 
102 102
     fields = {
103 103
         'distributor_id': distributor_id,
104
-        'distributor_name': distributor.distributor_name,
104
+        # 'distributor_name': distributor.distributor_name,
105
+        'distributor_name': '',
105 106
         'clerk_name': request.POST.get('name', ''),
106 107
         'clerk_sex': int(request.POST.get('sex', 1)),
107 108
         'clerk_phone': phone,

+ 44 - 42
page/sale_views.py

@@ -62,12 +62,12 @@ def clerk_sale_submit_api(request):
62 62
     except ValueError:
63 63
         return response(ProductModelStatusCode.MODEL_NOT_FOUND)
64 64
 
65
-    try:
66
-        distributor = DistributorInfo.objects.get(pk=distributorID)
67
-    except DistributorInfo.DoesNotExist:
68
-        return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
69
-    except ValueError:
70
-        return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
65
+    # try:
66
+    #     distributor = DistributorInfo.objects.get(pk=distributorID)
67
+    # except DistributorInfo.DoesNotExist:
68
+    #     return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
69
+    # except ValueError:
70
+    #     return response(ProductDistributorStatusCode.DISTRIBUTOR_NOT_FOUND)
71 71
 
72 72
     try:
73 73
         clerk = SaleclerkInfo.objects.get(brand_id=brand.brand_id, unionid=user.unionid, status=True)
@@ -123,8 +123,10 @@ def clerk_sale_submit_api(request):
123 123
         brand_name=brand.brand_name,
124 124
         model_id=model.model_id,
125 125
         model_name=model.model_name,
126
-        distributor_id=distributor.distributor_id,
127
-        distributor_name=distributor.distributor_name,
126
+        # distributor_id=distributor.distributor_id,
127
+        # distributor_name=distributor.distributor_name,
128
+        distributor_id='',
129
+        distributor_name='',
128 130
         code=serialNo,
129 131
         consumer_name=consumer_name,
130 132
         consumer_phone=consumer_phone,
@@ -168,42 +170,42 @@ def clerk_sale_submit_api(request):
168 170
         mssi2.save()
169 171
 
170 172
         # 经销商销量统计
171
-        dssi, _ = DistributorSaleStatisticInfo.objects.select_for_update().get_or_create(
172
-            brand_id=brand.brand_id,
173
-            distributor_id=distributor.distributor_id,
174
-            ymd=ymd,
175
-        )
176
-        dssi.distributor_name = distributor.distributor_name
177
-        dssi.num += 1
178
-        dssi.save()
179
-
180
-        dssi2, _ = DistributorSaleStatisticInfo.objects.select_for_update().get_or_create(
181
-            brand_id=brand.brand_id,
182
-            distributor_id=distributor.distributor_id,
183
-            ymd=0,
184
-        )
185
-        dssi2.distributor_name = distributor.distributor_name
186
-        dssi2.num += 1
187
-        dssi2.save()
173
+        # dssi, _ = DistributorSaleStatisticInfo.objects.select_for_update().get_or_create(
174
+        #     brand_id=brand.brand_id,
175
+        #     distributor_id=distributor.distributor_id,
176
+        #     ymd=ymd,
177
+        # )
178
+        # dssi.distributor_name = distributor.distributor_name
179
+        # dssi.num += 1
180
+        # dssi.save()
181
+        #
182
+        # dssi2, _ = DistributorSaleStatisticInfo.objects.select_for_update().get_or_create(
183
+        #     brand_id=brand.brand_id,
184
+        #     distributor_id=distributor.distributor_id,
185
+        #     ymd=0,
186
+        # )
187
+        # dssi2.distributor_name = distributor.distributor_name
188
+        # dssi2.num += 1
189
+        # dssi2.save()
188 190
 
189 191
         # 省份销量统计
190
-        pssi, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
191
-            brand_id=brand.brand_id,
192
-            province_code=distributor.distributor_province_code,
193
-            ymd=ymd,
194
-        )
195
-        pssi.province_name = distributor.distributor_province_name
196
-        pssi.num += 1
197
-        pssi.save()
198
-
199
-        pssi2, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
200
-            brand_id=brand.brand_id,
201
-            province_code=distributor.distributor_province_code,
202
-            ymd=0,
203
-        )
204
-        pssi2.province_name = distributor.distributor_province_name
205
-        pssi2.num += 1
206
-        pssi2.save()
192
+        # pssi, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
193
+        #     brand_id=brand.brand_id,
194
+        #     province_code=distributor.distributor_province_code,
195
+        #     ymd=ymd,
196
+        # )
197
+        # pssi.province_name = distributor.distributor_province_name
198
+        # pssi.num += 1
199
+        # pssi.save()
200
+        #
201
+        # pssi2, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
202
+        #     brand_id=brand.brand_id,
203
+        #     province_code=distributor.distributor_province_code,
204
+        #     ymd=0,
205
+        # )
206
+        # pssi2.province_name = distributor.distributor_province_name
207
+        # pssi2.num += 1
208
+        # pssi2.save()
207 209
 
208 210
     return response(200, data={
209 211
         'integral': integral,

+ 11 - 11
page/templates/page/clerk_oauth.html

@@ -16,16 +16,16 @@
16 16
         <div class="container" >
17 17
             <div class="weui_cells_title">基本信息</div>
18 18
             <div class="weui_cells weui_cells_form">
19
-                <div class="weui_cell weui_cell_select weui_select_after">
20
-                    <div class="weui_cell_hd"><label for="" class="weui_label">经销商</label></div>
21
-                    <div class="weui_cell_bd weui_cell_primary">
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
-                            {% endfor %}
26
-                        </select>
27
-                    </div>
28
-                </div>
19
+{#                <div class="weui_cell weui_cell_select weui_select_after">#}
20
+{#                    <div class="weui_cell_hd"><label for="" class="weui_label">经销商</label></div>#}
21
+{#                    <div class="weui_cell_bd weui_cell_primary">#}
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
+{#                            {% endfor %}#}
26
+{#                        </select>#}
27
+{#                    </div>#}
28
+{#                </div>#}
29 29
                 <div class="weui_cell">
30 30
                     <div class="weui_cell_hd"><label for="" class="weui_label">姓名</label></div>
31 31
                     <div class="weui_cell_bd weui_cell_primary">
@@ -137,7 +137,7 @@
137 137
                         unionid: unionid,
138 138
                         openid: '{{ request.GET.openid }}',
139 139
                         brand_id: '{{ request.GET.brand_id }}',
140
-                        distributor_id: $('#distributor option:checked').val(),
140
+{#                        distributor_id: $('#distributor option:checked').val(),#}
141 141
                         name: name,
142 142
                         sex: $('#sex option:checked').val(),
143 143
                         phone: phone,