# Generated by Django 3.1.4 on 2023-05-06 09:12

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('company', '0323_auto_20230304_1014'),
        ('sales', '0321_channelpromotionaccumulations_priority'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='channelpromotionaccumulations',
            options={'verbose_name': '消费者累计扫码返利', 'verbose_name_plural': '消费者累计扫码返利'},
        ),
        migrations.RemoveField(
            model_name='channelpromotionaccumulations',
            name='per_basis',
        ),
        migrations.AddField(
            model_name='channelpromotionaccumulations',
            name='cycler',
            field=models.SmallIntegerField(blank=True, default=1, null=True, verbose_name='累计扫码基数'),
        ),
        migrations.AddField(
            model_name='channelpromotionaccumulations',
            name='target',
            field=models.SmallIntegerField(choices=[(1, '二级(终端)'), (2, '一级经销商'), (3, '一级和二级(终端)')], default=1, verbose_name='返利对像'),
        ),
        migrations.AlterField(
            model_name='channelpromotionaccumulations',
            name='amount',
            field=models.DecimalField(decimal_places=2, max_digits=12, verbose_name='返利金额'),
        ),
        migrations.CreateModel(
            name='ChannelRebateAccumulation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('val', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='返利金额（点值）')),
                ('group_uuid', models.CharField(blank=True, db_index=True, max_length=32, null=True, unique=True, verbose_name='组别标识')),
                ('invoice_redeemed', models.CharField(blank=True, max_length=30, null=True, verbose_name='返利兑付凭证')),
                ('tm_redeemed', models.DateTimeField(blank=True, null=True, verbose_name='返利兑付时间')),
                ('remark', models.CharField(blank=True, max_length=30, null=True, verbose_name='备注')),
                ('dt', models.DateField(auto_now_add=True, db_index=True, verbose_name='日期')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='时间')),
                ('accumulation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebateaccumulation_accumulation', to='sales.channelpromotionaccumulations', verbose_name='累计返利设置')),
                ('agent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebateaccumulation_agent', to='company.company', verbose_name='经销商/终端名称')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebateaccumulation_company', to='company.company', verbose_name='所属企业')),
                ('promotion', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebateaccumulation_promotion', to='sales.channelpromotions', verbose_name='渠道促销方案')),
            ],
            options={
                'verbose_name': '消费者扫码累计返利',
                'verbose_name_plural': '消费者扫码累计返利)',
            },
        ),
        migrations.CreateModel(
            name='ChannelRebateConsumer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label_code', models.CharField(db_index=True, max_length=20, verbose_name='标签号码')),
                ('label_pkg', models.SmallIntegerField(blank=True, db_index=True, null=True, verbose_name='标签类型')),
                ('accumulated', models.BooleanField(blank=True, db_index=True, default=False, null=True, verbose_name='标签是否已被累计返利')),
                ('val', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='返利金额（点值）')),
                ('group_uuid', models.CharField(blank=True, db_index=True, max_length=32, null=True, verbose_name='组别标识')),
                ('remark', models.CharField(blank=True, max_length=30, null=True, verbose_name='备注')),
                ('dt', models.DateField(auto_now_add=True, db_index=True, verbose_name='日期')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='时间')),
                ('invoice_redeemed', models.CharField(blank=True, max_length=30, null=True, verbose_name='返利兑付凭证')),
                ('tm_redeemed', models.DateTimeField(blank=True, null=True, verbose_name='返利兑付时间')),
                ('agent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebateconsumer_agent', to='company.company', verbose_name='经销商/终端名称')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebateconsumer_company', to='company.company', verbose_name='所属企业')),
                ('labelscan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebateconsumer_labelscan', to='sales.labelscan', verbose_name='消费者扫码记录')),
                ('promotion', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='channelrebateconsumer_promotion', to='sales.channelpromotions', verbose_name='渠道促销方案')),
            ],
            options={
                'verbose_name': '渠道返利明细(消费者扫码)',
                'verbose_name_plural': '渠道返利明细(消费者扫码)',
                'unique_together': {('agent', 'label_code')},
            },
        ),
    ]
