# Generated by Django 2.1.7 on 2020-09-01 18:30

from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('company', '0061_changelog'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('sales', '0043_auto_20200815_1349'),
    ]

    operations = [
        migrations.CreateModel(
            name='ChannelPromotions',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('reward_id', models.SmallIntegerField(choices=[(0, '积分奖励'), (1, '微信红包')], default=0, verbose_name='奖励方式')),
                ('vtype_id', models.SmallIntegerField(choices=[(0, '不限定'), (1, '扫码入库'), (2, '扫码出库')], default=2, verbose_name='扫码方式')),
                ('status', models.SmallIntegerField(choices=[(0, '未激活'), (1, '进行中'), (2, '暂停'), (3, '已结束')], default=0, verbose_name='活动状态')),
                ('name', models.CharField(max_length=100, verbose_name='活动名称')),
                ('digest', models.CharField(blank=True, max_length=300, null=True, verbose_name='活动摘要')),
                ('agent_lvs', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None, verbose_name='指定层级')),
                ('div_ids', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None, verbose_name='指定战区')),
                ('subdiv_ids', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None, verbose_name='指定分区')),
                ('agents', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None, verbose_name='指定商家')),
                ('products', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None, verbose_name='指定产品')),
                ('tm_start', models.DateTimeField(verbose_name='开始时间')),
                ('tm_end', models.DateTimeField(verbose_name='结束时间')),
                ('tm_closed', models.DateTimeField(blank=True, null=True, verbose_name='关闭时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelpromotion_company', to='company.Company', verbose_name='公司名称')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelpromotion_user', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('user_closed', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='channelpromotion_user_close', to=settings.AUTH_USER_MODEL, verbose_name='关闭人')),
            ],
            options={
                'verbose_name': '渠道促销活动',
                'verbose_name_plural': '渠道促销活动',
            },
        ),
        migrations.CreateModel(
            name='ChannelPromtionsRebate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('package_id', models.SmallIntegerField(choices=[(1, '瓶/支（最内层包装）'), (2, '盒'), (3, '箱(最外层包装')], default=3, verbose_name='扫码标签类型')),
                ('val_lv1', models.IntegerField(default=0, verbose_name='返利金额（点值）')),
                ('val_lv2', models.IntegerField(default=0, verbose_name='返利金额（点值）')),
                ('val_lv3', models.IntegerField(default=0, verbose_name='返利金额（点值）')),
                ('val_lv4', models.IntegerField(default=0, verbose_name='返利金额（点值）')),
                ('val_lv5', models.IntegerField(default=0, verbose_name='返利金额（点值）')),
                ('channel_lv', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebate_level', to='company.Level', verbose_name='当前扫码层级')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebate_company', to='company.Company', verbose_name='公司名称')),
                ('promotion', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebate_promotion', to='sales.ChannelPromotions', verbose_name='渠道促销活动')),
            ],
            options={
                'verbose_name': '渠道促销返利策略',
                'verbose_name_plural': '渠道促销返利策略',
            },
        ),
        migrations.AlterUniqueTogether(
            name='channelpromtionsrebate',
            unique_together={('promotion', 'channel_lv', 'package_id')},
        ),
    ]
