| @@ -0,0 +1,28 @@ | ||
| 1 | +# Generated by Django 2.2.12 on 2020-05-21 13:14 | |
| 2 | + | |
| 3 | +from django.db import migrations, models | |
| 4 | + | |
| 5 | + | |
| 6 | +class Migration(migrations.Migration): | |
| 7 | + | |
| 8 | + dependencies = [ | |
| 9 | +        ('account', '0003_administratorinfo'), | |
| 10 | + ] | |
| 11 | + | |
| 12 | + operations = [ | |
| 13 | + migrations.AddField( | |
| 14 | + model_name='userinfo', | |
| 15 | + name='consignee_city', | |
| 16 | + field=models.CharField(blank=True, help_text='收货人城市', max_length=255, null=True, verbose_name='consignee_city'), | |
| 17 | + ), | |
| 18 | + migrations.AddField( | |
| 19 | + model_name='userinfo', | |
| 20 | + name='consignee_county', | |
| 21 | + field=models.CharField(blank=True, help_text='收货人区', max_length=255, null=True, verbose_name='consignee_county'), | |
| 22 | + ), | |
| 23 | + migrations.AddField( | |
| 24 | + model_name='userinfo', | |
| 25 | + name='consignee_province', | |
| 26 | + field=models.CharField(blank=True, help_text='收货人省份', max_length=255, null=True, verbose_name='consignee_province'), | |
| 27 | + ), | |
| 28 | + ] | 
| @@ -23,6 +23,9 @@ class UserInfo(BaseModelMixin): | ||
| 23 | 23 | # 收货信息 | 
| 24 | 24 |      consignee_name = models.CharField(_('consignee_name'), max_length=255, blank=True, null=True, help_text='收货人姓名') | 
| 25 | 25 |      consignee_phone = models.CharField(_('consignee_phone'), max_length=255, blank=True, null=True, help_text='收货人电话') | 
| 26 | +    consignee_province = models.CharField(_('consignee_province'), max_length=255, blank=True, null=True, help_text='收货人省份') | |
| 27 | +    consignee_city = models.CharField(_('consignee_city'), max_length=255, blank=True, null=True, help_text='收货人城市') | |
| 28 | +    consignee_county = models.CharField(_('consignee_county'), max_length=255, blank=True, null=True, help_text='收货人区') | |
| 26 | 29 |      consignee_address = models.CharField(_('consignee_address'), max_length=255, blank=True, null=True, help_text='收货人地址') | 
| 27 | 30 |  | 
| 28 | 31 | class Meta: | 
| @@ -47,6 +50,9 @@ class UserInfo(BaseModelMixin): | ||
| 47 | 50 | 'user_id': self.user_id, | 
| 48 | 51 | 'consignee_name': self.consignee_name, | 
| 49 | 52 | 'consignee_phone': self.consignee_phone, | 
| 53 | + 'consignee_province': self.consignee_province, | |
| 54 | + 'consignee_city': self.consignee_city, | |
| 55 | + 'consignee_county': self.consignee_county, | |
| 50 | 56 | 'consignee_address': self.consignee_address, | 
| 51 | 57 | } | 
| 52 | 58 |  | 
| @@ -0,0 +1,33 @@ | ||
| 1 | +# Generated by Django 2.2.12 on 2020-05-21 13:14 | |
| 2 | + | |
| 3 | +from django.db import migrations, models | |
| 4 | + | |
| 5 | + | |
| 6 | +class Migration(migrations.Migration): | |
| 7 | + | |
| 8 | + dependencies = [ | |
| 9 | +        ('live', '0010_auto_20200520_1716'), | |
| 10 | + ] | |
| 11 | + | |
| 12 | + operations = [ | |
| 13 | + migrations.AddField( | |
| 14 | + model_name='roomorderinfo', | |
| 15 | + name='city', | |
| 16 | + field=models.CharField(blank=True, help_text='城市', max_length=255, null=True, verbose_name='city'), | |
| 17 | + ), | |
| 18 | + migrations.AddField( | |
| 19 | + model_name='roomorderinfo', | |
| 20 | + name='county', | |
| 21 | + field=models.CharField(blank=True, help_text='区', max_length=255, null=True, verbose_name='county'), | |
| 22 | + ), | |
| 23 | + migrations.AddField( | |
| 24 | + model_name='roomorderinfo', | |
| 25 | + name='province', | |
| 26 | + field=models.CharField(blank=True, help_text='省份', max_length=255, null=True, verbose_name='province'), | |
| 27 | + ), | |
| 28 | + migrations.AlterField( | |
| 29 | + model_name='roomuserinfo', | |
| 30 | + name='user_id', | |
| 31 | + field=models.CharField(blank=True, help_text='用户唯一标识', max_length=32, verbose_name='user_id'), | |
| 32 | + ), | |
| 33 | + ] | 
| @@ -194,7 +194,7 @@ class RoomGoodsInfo(BaseModelMixin): | ||
| 194 | 194 | class RoomUserInfo(BaseModelMixin): | 
| 195 | 195 |      room_id = models.CharField(_('room_id'), max_length=32, help_text='房间唯一标识', db_index=True) | 
| 196 | 196 |      anchor_id = models.CharField(_('anchor_id'), max_length=32, blank=True, help_text='主播唯一标识') | 
| 197 | -    user_id = models.CharField(_('anchor_id'), max_length=32, blank=True, help_text='用户唯一标识') | |
| 197 | +    user_id = models.CharField(_('user_id'), max_length=32, blank=True, help_text='用户唯一标识') | |
| 198 | 198 |      openid = models.CharField(_('openid'), max_length=32, blank=True, help_text='用户 openid') | 
| 199 | 199 |      share_openid = models.CharField(_('share_openid'), max_length=32, blank=True, help_text='分享用户 openid') | 
| 200 | 200 |  | 
| @@ -240,6 +240,9 @@ class RoomOrderInfo(BaseModelMixin): | ||
| 240 | 240 |  | 
| 241 | 241 |      name = models.CharField(_('name'), max_length=255, blank=True, null=True, help_text='姓名') | 
| 242 | 242 |      phone = models.CharField(_('phone'), max_length=255, blank=True, null=True, help_text='电话') | 
| 243 | +    province = models.CharField(_('province'), max_length=255, blank=True, null=True, help_text='省份') | |
| 244 | +    city = models.CharField(_('city'), max_length=255, blank=True, null=True, help_text='城市') | |
| 245 | +    county = models.CharField(_('county'), max_length=255, blank=True, null=True, help_text='区') | |
| 243 | 246 |      address = models.CharField(_('address'), max_length=255, blank=True, null=True, help_text='地址') | 
| 244 | 247 |  | 
| 245 | 248 |      tracking_number = models.CharField(_('tracking_number'), max_length=255, blank=True, null=True, help_text='快递单号') | 
| @@ -269,4 +272,26 @@ class RoomOrderInfo(BaseModelMixin): | ||
| 269 | 272 |          verbose_name_plural = _('直播间订单') | 
| 270 | 273 |  | 
| 271 | 274 | def __unicode__(self): | 
| 272 | - return self.pk | |
| 275 | + return self.pk | |
| 276 | + | |
| 277 | + property | |
| 278 | + def admindata(self): | |
| 279 | + room = RoomInfo.objects.get(room_id=self.room_id) | |
| 280 | + anchor = AnchorInfo.objects.get(anchor_id=self.anchor_id) | |
| 281 | + goods = liveGoodsInfo.objects.get(goods_id=self.goods_id) | |
| 282 | +        return { | |
| 283 | + 'order_id': self.order_id, | |
| 284 | + 'transaction_id': self.transaction_id, | |
| 285 | + 'user_id': self.user_id, | |
| 286 | + 'room_id': self.room_id, | |
| 287 | + 'room_name': room.name, | |
| 288 | + 'anchor_id': self.anchor_id, | |
| 289 | + 'anchor_name': anchor.anchor_name, | |
| 290 | + 'goods_id': self.goods_id, | |
| 291 | + 'goods_name': goods.name, | |
| 292 | + 'goods_img': goods.goods_img_url, | |
| 293 | + 'tracking_number': self.tracking_number, | |
| 294 | + 'total_fee': self.total_fee, | |
| 295 | + 'pay_status': self.pay_status, | |
| 296 | + 'paid_at': tc.local_string(utc_dt=info.paid_at, format='%Y-%m-%d %H:%M'), | |
| 297 | + } | 
| @@ -85,6 +85,9 @@ def live_order_create(request): | ||
| 85 | 85 |  | 
| 86 | 86 |      name = request.POST.get('name', '') | 
| 87 | 87 |      phone = request.POST.get('phone', '') | 
| 88 | +    province = request.POST.get('province', '') | |
| 89 | +    city = request.POST.get('city', '') | |
| 90 | +    county = request.POST.get('county', '') | |
| 88 | 91 |      address = request.POST.get('address', '') | 
| 89 | 92 |  | 
| 90 | 93 |      amount = int(request.POST.get('amount', 0)) | 
| @@ -97,6 +100,9 @@ def live_order_create(request): | ||
| 97 | 100 | user = UserInfo.objects.get(user_id=user_id, status=True) | 
| 98 | 101 | user.consignee_name = name | 
| 99 | 102 | user.consignee_phone = phone | 
| 103 | + user.consignee_province = province | |
| 104 | + user.consignee_city = city | |
| 105 | + user.consignee_county = county | |
| 100 | 106 | user.consignee_address = address | 
| 101 | 107 | user.save() | 
| 102 | 108 | except UserInfo.DoesNotExist: | 
| @@ -140,6 +146,9 @@ def live_order_create(request): | ||
| 140 | 146 | trade_type=trade_type, | 
| 141 | 147 | name=name, | 
| 142 | 148 | phone=phone, | 
| 149 | + province=province, | |
| 150 | + city=city, | |
| 151 | + county=county, | |
| 143 | 152 | address=address, | 
| 144 | 153 | ) | 
| 145 | 154 |  |