# Generated by Django 3.1.4 on 2022-11-23 16:00

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


class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('sales', '0298_lotteryseeds_batch_id'),
        ('company', '0306_operationlog'),
    ]

    operations = [
        migrations.CreateModel(
            name='BonusPointsLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ancestor_id', models.IntegerField(blank=True, null=True, verbose_name='所属族系')),
                ('object_id', models.IntegerField(blank=True, null=True, verbose_name='实例ID')),
                ('points', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='当前积分变化值')),
                ('dt', models.DateField(auto_now_add=True, db_index=True, verbose_name='日期')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('activity', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='bonuspointslog_activity', to='sales.activities', verbose_name='所属活动')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bonuspointslog_company', to='company.company', verbose_name='所属公司')),
                ('contenttype', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype', verbose_name='实例对像')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bonuspointslog_user', to='company.company', verbose_name='用户帐号')),
            ],
            options={
                'verbose_name': '用户积分日志',
                'verbose_name_plural': '用户积分日志',
            },
        ),
        migrations.CreateModel(
            name='PointsRedeemed',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ancestor_id', models.IntegerField(blank=True, null=True, verbose_name='所属族系')),
                ('points', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='兑换积分值')),
                ('amount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='金额')),
                ('payment_method', models.SmallIntegerField(choices=[(1, '微信钱包'), (2, '银行卡'), (3, '货返')], default=1, verbose_name='付款方式')),
                ('invoice_needed', models.SmallIntegerField(choices=[(1, '开票提现'), (0, '不开票提现')], default=0, verbose_name='是否开票')),
                ('bank_receipt', models.CharField(blank=True, max_length=50, null=True, verbose_name='银行/微信回单编号')),
                ('qty', models.IntegerField(blank=True, 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='时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('award', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='sales.award', verbose_name='兑换奖项')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pointsredeem_company', to='company.company', verbose_name='所属公司')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pointsredeem_user', to='company.company', verbose_name='用户帐号')),
            ],
            options={
                'verbose_name': '积分兑换',
                'verbose_name_plural': '积分兑换',
            },
        ),
        migrations.CreateModel(
            name='PointsLogDetails',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ancestor_id', models.IntegerField(blank=True, null=True, verbose_name='所属族系')),
                ('label_code', models.CharField(db_index=True, max_length=20, verbose_name='标签号码')),
                ('label_id', models.BigIntegerField(db_index=True, verbose_name='标签ID')),
                ('label_pk_id', models.BigIntegerField(db_index=True, verbose_name='标签PKID')),
                ('label_pkg', models.SmallIntegerField(db_index=True, verbose_name='标签类型')),
                ('points', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='积分值')),
                ('dt', models.DateField(auto_now_add=True, db_index=True, verbose_name='日期')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('activity', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pointslogdetails_activity', to='sales.activities', verbose_name='所属活动')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pointslogdetails_company', to='company.company', verbose_name='所属公司')),
                ('log', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='company.bonuspointslog', verbose_name='所属积分日志')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pointslogdetails_user', to='company.company', verbose_name='用户帐号')),
            ],
            options={
                'verbose_name': '积分物流标签明细',
                'verbose_name_plural': '积分物流标签明细',
            },
        ),
        migrations.CreateModel(
            name='BonusPoints',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ancestor_id', models.IntegerField(blank=True, null=True, verbose_name='所属族系')),
                ('points', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='当前积分值')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('tm', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bonuspoints_company', to='company.company', verbose_name='所属公司')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='bonuspoints_user', to=settings.AUTH_USER_MODEL, verbose_name='用户帐号')),
            ],
            options={
                'verbose_name': '用户积分',
                'verbose_name_plural': '用户积分',
            },
        ),
    ]
