@@ -22,12 +22,8 @@ def model_add(request): |
||
| 22 | 22 |
model_full_name = request.POST.get('model_full_name', '')
|
| 23 | 23 |
image_path = request.POST.get('image_path', '')
|
| 24 | 24 |
image2_path = request.POST.get('image2_path', '')
|
| 25 |
- factory_yuan = request.POST.get('factory_yuan', 1000)
|
|
| 26 | 25 |
integral = int(request.POST.get('integral', 100))
|
| 27 | 26 |
|
| 28 |
- category = request.POST.get('category', '')
|
|
| 29 |
- warehouse = request.POST.get('warehouse', '')
|
|
| 30 |
- |
|
| 31 | 27 |
admin_id = request.session.get('admin_id')
|
| 32 | 28 |
|
| 33 | 29 |
is_important = request.POST.get('is_important', 0)
|
@@ -43,12 +39,8 @@ def model_add(request): |
||
| 43 | 39 |
model_name=model_name, |
| 44 | 40 |
model_uni_name=model_uni_name, |
| 45 | 41 |
model_full_name=model_full_name, |
| 46 |
- category=category, |
|
| 47 |
- warehouse=warehouse, |
|
| 48 | 42 |
image=image_path, |
| 49 | 43 |
image2=image2_path, |
| 50 |
- factory_yuan=factory_yuan, |
|
| 51 |
- factory_fee=monetary.Yuan2Fen(factory_yuan), |
|
| 52 | 44 |
integral=integral, |
| 53 | 45 |
is_important=is_important, |
| 54 | 46 |
) |
@@ -87,12 +79,8 @@ def model_update(request): |
||
| 87 | 79 |
model_full_name = request.POST.get('model_full_name', '')
|
| 88 | 80 |
image_path = request.POST.get('image_path', '')
|
| 89 | 81 |
image2_path = request.POST.get('image2_path', '')
|
| 90 |
- factory_yuan = request.POST.get('factory_yuan', 1000)
|
|
| 91 | 82 |
integral = int(request.POST.get('integral', 100))
|
| 92 | 83 |
|
| 93 |
- category = request.POST.get('category', '')
|
|
| 94 |
- warehouse = request.POST.get('warehouse', '')
|
|
| 95 |
- |
|
| 96 | 84 |
admin_id = request.session.get('admin_id')
|
| 97 | 85 |
|
| 98 | 86 |
is_important = request.POST.get('is_important', 0)
|
@@ -115,17 +103,12 @@ def model_update(request): |
||
| 115 | 103 |
modelObj.model_uni_name = model_uni_name |
| 116 | 104 |
if model_full_name: |
| 117 | 105 |
modelObj.model_full_name = model_full_name |
| 118 |
- if category: |
|
| 119 |
- modelObj.category = category |
|
| 120 | 106 |
if warehouse: |
| 121 | 107 |
modelObj.warehouse = warehouse |
| 122 | 108 |
if image_path: |
| 123 | 109 |
modelObj.image = image_path |
| 124 | 110 |
if image2_path: |
| 125 | 111 |
modelObj.image2 = image2_path |
| 126 |
- if factory_yuan: |
|
| 127 |
- modelObj.factory_yuan = factory_yuan |
|
| 128 |
- modelObj.factory_fee = monetary.Yuan2Fen(factory_yuan) |
|
| 129 | 112 |
if integral: |
| 130 | 113 |
modelObj.integral = integral |
| 131 | 114 |
|
@@ -11,6 +11,7 @@ from pysnippets.strsnippets import strip |
||
| 11 | 11 |
from mch.models import (ActivityInfo, AdministratorInfo, BrandInfo, CameraModelInfo, ConsumeInfoSubmitLogInfo, |
| 12 | 12 |
DistributorInfo, LatestAppInfo, LatestAppScreenInfo, MaintenancemanInfo, ModelCameraBodyInfo, |
| 13 | 13 |
ModelInfo, OperatorInfo, SaleclerkInfo) |
| 14 |
+from integral.models import SaleclerkSubmitLogInfo |
|
| 14 | 15 |
from utils.redis.rshot import update_member_shot_data |
| 15 | 16 |
|
| 16 | 17 |
|
@@ -65,10 +66,10 @@ class BrandInfoAdmin(admin.ModelAdmin): |
||
| 65 | 66 |
|
| 66 | 67 |
|
| 67 | 68 |
class ModelInfoAdmin(AdvancedExportExcelModelAdmin, DeleteModelAdmin, admin.ModelAdmin): |
| 68 |
- list_display = ('pk', 'brand_id', 'brand_name', 'jancode', 'model_id', 'model_name', 'model_uni_name', 'model_full_name', 'model_descr', 'category', 'warehouse', 'image', 'url', 'image2', 'factory_yuan', 'integral', 'position', 'display', 'is_important', 'shot_type_id', 'shot_member_integral', 'shot_member_image', 'shot_member_name', 'status', 'created_at', 'updated_at')
|
|
| 69 |
- list_filter = ('brand_name', 'category', 'warehouse', 'shot_type_id', 'display', 'status')
|
|
| 69 |
+ list_display = ('pk', 'brand_id', 'brand_name', 'jancode', 'model_id', 'model_name', 'model_uni_name', 'model_full_name', 'model_descr', 'image', 'url', 'image2', 'integral', 'position', 'display', 'is_important', 'shot_type_id', 'shot_member_integral', 'shot_member_image', 'shot_member_name', 'status', 'created_at', 'updated_at')
|
|
| 70 |
+ list_filter = ('brand_name', 'shot_type_id', 'display', 'status')
|
|
| 70 | 71 |
readonly_fields = ('brand_name', 'factory_fee')
|
| 71 |
- search_fields = ('brand_id', 'brand_name', 'jancode', 'model_id', 'model_name', 'model_uni_name', 'model_full_name', 'model_descr', 'category', 'warehouse')
|
|
| 72 |
+ search_fields = ('brand_id', 'brand_name', 'jancode', 'model_id', 'model_name', 'model_uni_name', 'model_full_name', 'model_descr')
|
|
| 72 | 73 |
|
| 73 | 74 |
def save_model(self, request, obj, form, change): |
| 74 | 75 |
obj.brand_id = strip(obj.brand_id) |
@@ -76,14 +77,25 @@ class ModelInfoAdmin(AdvancedExportExcelModelAdmin, DeleteModelAdmin, admin.Mode |
||
| 76 | 77 |
obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name |
| 77 | 78 |
except BrandInfo.DoesNotExist: |
| 78 | 79 |
obj.brand_name = '' |
| 79 |
- |
|
| 80 |
- obj.factory_fee = monetary.Yuan2Fen(obj.factory_yuan) |
|
| 81 |
- obj.factory_yuan = monetary.Fen2Yuan(obj.factory_fee) |
|
| 82 |
- |
|
| 80 |
+ |
|
| 81 |
+ obj.is_show_shot = True |
|
| 83 | 82 |
obj.save() |
| 84 | 83 |
|
| 84 |
+ ModelInfo.objects.filter(brand_id=obj.brand_id, model_uni_name=obj.model_uni_name).exclude(model_id=obj.model_id).update(is_show_shot=False) |
|
| 85 |
+ |
|
| 85 | 86 |
update_member_shot_data() |
| 86 | 87 |
|
| 88 |
+ #更新用户提交列表和销售员提交列表 |
|
| 89 |
+ SaleclerkSubmitLogInfo.objects.filter(model_pk=obj.pk).update( |
|
| 90 |
+ model_name=obj.model_name, |
|
| 91 |
+ model_uni_name=obj.model_uni_name, |
|
| 92 |
+ ) |
|
| 93 |
+ |
|
| 94 |
+ ConsumeInfoSubmitLogInfo.objects.filter(model_id=obj.model_id).update( |
|
| 95 |
+ model_uni_name=obj.model_uni_name, |
|
| 96 |
+ model_name=obj.model_name, |
|
| 97 |
+ ) |
|
| 98 |
+ |
|
| 87 | 99 |
# 更新"型号机身适配"型号图片 |
| 88 | 100 |
ModelCameraBodyInfo.objects.filter( |
| 89 | 101 |
brand_id=obj.brand_id, |
@@ -193,9 +205,6 @@ class BrandModelDistributorPriceInfoAdmin(admin.ModelAdmin): |
||
| 193 | 205 |
except BrandInfo.DoesNotExist: |
| 194 | 206 |
obj.distributor_name = '' |
| 195 | 207 |
|
| 196 |
- obj.factory_fee = monetary.Yuan2Fen(obj.factory_yuan) |
|
| 197 |
- obj.factory_yuan = monetary.Fen2Yuan(obj.factory_fee) |
|
| 198 |
- |
|
| 199 | 208 |
obj.save() |
| 200 | 209 |
|
| 201 | 210 |
|
@@ -0,0 +1,30 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 3.2.16 on 2022-11-18 08:57 |
|
| 3 |
+ |
|
| 4 |
+from django.db import migrations, models |
|
| 5 |
+import django_models_ext.fileext |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+class Migration(migrations.Migration): |
|
| 9 |
+ |
|
| 10 |
+ dependencies = [ |
|
| 11 |
+ ('mch', '0064_alter_modelinfo_display'),
|
|
| 12 |
+ ] |
|
| 13 |
+ |
|
| 14 |
+ operations = [ |
|
| 15 |
+ migrations.AddField( |
|
| 16 |
+ model_name='modelinfo', |
|
| 17 |
+ name='model_mount', |
|
| 18 |
+ field=models.CharField(choices=[('SONY', '索尼'), ('FUJIFILM', '富士'), ('CANON', '佳能'), ('NIKON', '尼康')], default='SONY', help_text='镜头卡口', max_length=32, verbose_name='model_mount'),
|
|
| 19 |
+ ), |
|
| 20 |
+ migrations.AlterField( |
|
| 21 |
+ model_name='modelinfo', |
|
| 22 |
+ name='image', |
|
| 23 |
+ field=models.ImageField(blank=True, help_text='横图', null=True, upload_to=django_models_ext.fileext.upload_path, verbose_name='image'), |
|
| 24 |
+ ), |
|
| 25 |
+ migrations.AlterField( |
|
| 26 |
+ model_name='modelinfo', |
|
| 27 |
+ name='image2', |
|
| 28 |
+ field=models.ImageField(blank=True, help_text='方图', null=True, upload_to=django_models_ext.fileext.upload_path, verbose_name='image2'), |
|
| 29 |
+ ), |
|
| 30 |
+ ] |
@@ -147,6 +147,13 @@ class BrandInfo(BaseModelMixin): |
||
| 147 | 147 |
|
| 148 | 148 |
|
| 149 | 149 |
class ModelInfo(BaseModelMixin): |
| 150 |
+ MOUNT_TUPLE = ( |
|
| 151 |
+ ('SONY', u'索尼'),
|
|
| 152 |
+ ('FUJIFILM', u'富士'),
|
|
| 153 |
+ ('CANON', u'佳能'),
|
|
| 154 |
+ ('NIKON', u'尼康'),
|
|
| 155 |
+ ) |
|
| 156 |
+ |
|
| 150 | 157 |
brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) |
| 151 | 158 |
brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') |
| 152 | 159 |
|
@@ -157,14 +164,15 @@ class ModelInfo(BaseModelMixin): |
||
| 157 | 164 |
model_uni_name = models.CharField(_(u'model_uni_name'), max_length=32, blank=True, null=True, help_text=u'型号统一名称') |
| 158 | 165 |
model_full_name = models.CharField(_(u'model_full_name'), max_length=255, blank=True, null=True, help_text=u'型号全名称') |
| 159 | 166 |
model_descr = models.TextField(_(u'model_descr'), max_length=255, blank=True, null=True, help_text=u'型号描述') |
| 167 |
+ model_mount = models.CharField(_(u'model_mount'), max_length=32, choices=MOUNT_TUPLE, default='SONY', help_text=u'镜头卡口') |
|
| 160 | 168 |
|
| 161 | 169 |
category = models.CharField(_(u'category'), max_length=32, blank=True, null=True, help_text=u'型号类别', db_index=True) |
| 162 | 170 |
warehouse = models.CharField(_(u'warehouse'), max_length=32, blank=True, null=True, help_text=u'所属仓库', db_index=True) |
| 163 | 171 |
|
| 164 |
- image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, null=True, help_text=u'图片') |
|
| 172 |
+ image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, null=True, help_text=u'横图') |
|
| 165 | 173 |
url = models.CharField(_(u'url'), max_length=255, blank=True, null=True, help_text=u'链接') |
| 166 | 174 |
|
| 167 |
- image2 = models.ImageField(_(u'image2'), upload_to=upload_path, blank=True, null=True, help_text=u'图片2') |
|
| 175 |
+ image2 = models.ImageField(_(u'image2'), upload_to=upload_path, blank=True, null=True, help_text=u'方图') |
|
| 168 | 176 |
|
| 169 | 177 |
factory_yuan = models.FloatField(_(u'factory_yuan'), default=1000, help_text=u'出厂价(元)') |
| 170 | 178 |
factory_fee = models.IntegerField(_(u'factory_fee'), default=100000, help_text=u'出厂价(分)') |
@@ -267,7 +275,7 @@ class ModelInfo(BaseModelMixin): |
||
| 267 | 275 |
return {
|
| 268 | 276 |
'shot_id': self.model_id, |
| 269 | 277 |
'shot_name': self.shot_member_name, |
| 270 |
- 'shot_image': self.shot_member_image_url, |
|
| 278 |
+ 'shot_image': self.image2_url, |
|
| 271 | 279 |
'integral': self.shot_member_integral, |
| 272 | 280 |
} |
| 273 | 281 |
|
@@ -282,6 +290,7 @@ class ModelInfo(BaseModelMixin): |
||
| 282 | 290 |
'model_uni_name': self.model_uni_name, |
| 283 | 291 |
'model_full_name': self.model_full_name, |
| 284 | 292 |
'model_desc': self.model_descr, |
| 293 |
+ 'model_mount': self.model_mount, |
|
| 285 | 294 |
'shot_type': self.shot_type_id, |
| 286 | 295 |
'shot_name': self.shot_member_name, |
| 287 | 296 |
'shot_type_name': shot_type.shot_type_name |