Showing
8 changed files
with
809 additions
and
609 deletions
| 1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
| 2 | 2 | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 3 | import 'package:json_annotation/json_annotation.dart'; | 4 | import 'package:json_annotation/json_annotation.dart'; |
| 4 | import 'package:one_key/models/filter_btn_model.dart'; | 5 | import 'package:one_key/models/filter_btn_model.dart'; |
| 5 | import 'package:one_key/models/upload_img_model.dart'; | 6 | import 'package:one_key/models/upload_img_model.dart'; |
| @@ -88,9 +89,8 @@ class CouponSunModel extends Object { | @@ -88,9 +89,8 @@ class CouponSunModel extends Object { | ||
| 88 | @JsonKey(name: 'use') | 89 | @JsonKey(name: 'use') |
| 89 | CouponUse use; | 90 | CouponUse use; |
| 90 | 91 | ||
| 91 | - | ||
| 92 | - @JsonKey(name: 'arule') | ||
| 93 | - Arule arule; | 92 | + @JsonKey(name: 'arule') |
| 93 | + Arule arule; | ||
| 94 | 94 | ||
| 95 | @JsonKey(name: 'exp_date') | 95 | @JsonKey(name: 'exp_date') |
| 96 | ExpDate expDate; | 96 | ExpDate expDate; |
| @@ -110,12 +110,17 @@ class CouponSunModel extends Object { | @@ -110,12 +110,17 @@ class CouponSunModel extends Object { | ||
| 110 | @JsonKey(name: 'aexpiration') | 110 | @JsonKey(name: 'aexpiration') |
| 111 | String aexpiration; | 111 | String aexpiration; |
| 112 | 112 | ||
| 113 | + @JsonKey(name: 'number') | ||
| 114 | + int number; | ||
| 115 | + | ||
| 113 | // arule 券使用和分享规则 领取后有效天数 | 116 | // arule 券使用和分享规则 领取后有效天数 |
| 114 | 117 | ||
| 115 | bool isCheck = false; | 118 | bool isCheck = false; |
| 116 | bool showText = false; | 119 | bool showText = false; |
| 117 | bool isMarking = false; | 120 | bool isMarking = false; |
| 118 | 121 | ||
| 122 | + TextEditingController numberC = TextEditingController(text: '0'); | ||
| 123 | + | ||
| 119 | CouponSunModel( | 124 | CouponSunModel( |
| 120 | this.id, | 125 | this.id, |
| 121 | this.uid, | 126 | this.uid, |
| @@ -142,7 +147,8 @@ class CouponSunModel extends Object { | @@ -142,7 +147,8 @@ class CouponSunModel extends Object { | ||
| 142 | this.grantNum, | 147 | this.grantNum, |
| 143 | this.urllink, | 148 | this.urllink, |
| 144 | this.liteQrcode, | 149 | this.liteQrcode, |
| 145 | - this.aexpiration); | 150 | + this.aexpiration, |
| 151 | + this.number); | ||
| 146 | 152 | ||
| 147 | factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) => | 153 | factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) => |
| 148 | _$CouponSunModelFromJson(srcJson); | 154 | _$CouponSunModelFromJson(srcJson); |
| @@ -26,51 +26,51 @@ Map<String, dynamic> _$CouponModelToJson(CouponModel instance) => | @@ -26,51 +26,51 @@ Map<String, dynamic> _$CouponModelToJson(CouponModel instance) => | ||
| 26 | 26 | ||
| 27 | CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) { | 27 | CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) { |
| 28 | return CouponSunModel( | 28 | return CouponSunModel( |
| 29 | - json['id'] as String, | ||
| 30 | - json['uid'] as String, | ||
| 31 | - json['aname'] as String, | ||
| 32 | - json['desc'] as String, | ||
| 33 | - json['stime'] as String, | ||
| 34 | - json['etime'] as String, | ||
| 35 | - json['explain'] as String, | ||
| 36 | - json['status'] as String, | ||
| 37 | - json['cdate'] as String, | ||
| 38 | - json['receive_num'] as String, | ||
| 39 | - json['use_num'] as String, | ||
| 40 | - json['nickname'] as String, | ||
| 41 | - json['uid_list'] as String, | ||
| 42 | - json['is_examine'] as String, | ||
| 43 | - json['is_type'] as String, | ||
| 44 | - json['is_open'] as String, | ||
| 45 | - json['is_open'] == "1" ? true : false, | ||
| 46 | - json['price'] as String, | ||
| 47 | - json['use'] == null | ||
| 48 | - ? null | ||
| 49 | - : (json['use'] is String) | ||
| 50 | - ? CouponUse.fromJson(jsonDecode(json['use'])) | ||
| 51 | - : (json['use'] is Map) | ||
| 52 | - ? CouponUse.fromJson(json['use']) | ||
| 53 | - : null, | ||
| 54 | - json['arule'] == null | ||
| 55 | - ? null | ||
| 56 | - : (json['arule'] is String) | ||
| 57 | - ? Arule.fromJson(jsonDecode(json['arule'])) | ||
| 58 | - : (json['arule'] is Map) | ||
| 59 | - ? Arule.fromJson(json['arule']) | ||
| 60 | - : null, | ||
| 61 | - json['exp_date'] == null | ||
| 62 | - ? null | ||
| 63 | - : (json['exp_date'] is String) | ||
| 64 | - ? ExpDate.fromJson(jsonDecode(json['exp_date'])) | ||
| 65 | - : (json['exp_date'] is Map) | ||
| 66 | - ? ExpDate.fromJson(json['exp_date']) | ||
| 67 | - : null, | ||
| 68 | - json['nick_name'] as String, | ||
| 69 | - json['grant_num'] as String, | ||
| 70 | - json['urllink'] as String, | ||
| 71 | - json['lite_qrcode'] as String, | ||
| 72 | - json['aexpiration'] as String, | ||
| 73 | - ); | 29 | + json['id'] as String, |
| 30 | + json['uid'] as String, | ||
| 31 | + json['aname'] as String, | ||
| 32 | + json['desc'] as String, | ||
| 33 | + json['stime'] as String, | ||
| 34 | + json['etime'] as String, | ||
| 35 | + json['explain'] as String, | ||
| 36 | + json['status'] as String, | ||
| 37 | + json['cdate'] as String, | ||
| 38 | + json['receive_num'] as String, | ||
| 39 | + json['use_num'] as String, | ||
| 40 | + json['nickname'] as String, | ||
| 41 | + json['uid_list'] as String, | ||
| 42 | + json['is_examine'] as String, | ||
| 43 | + json['is_type'] as String, | ||
| 44 | + json['is_open'] as String, | ||
| 45 | + json['is_open'] == "1" ? true : false, | ||
| 46 | + json['price'] as String, | ||
| 47 | + json['use'] == null | ||
| 48 | + ? null | ||
| 49 | + : (json['use'] is String) | ||
| 50 | + ? CouponUse.fromJson(jsonDecode(json['use'])) | ||
| 51 | + : (json['use'] is Map) | ||
| 52 | + ? CouponUse.fromJson(json['use']) | ||
| 53 | + : null, | ||
| 54 | + json['arule'] == null | ||
| 55 | + ? null | ||
| 56 | + : (json['arule'] is String) | ||
| 57 | + ? Arule.fromJson(jsonDecode(json['arule'])) | ||
| 58 | + : (json['arule'] is Map) | ||
| 59 | + ? Arule.fromJson(json['arule']) | ||
| 60 | + : null, | ||
| 61 | + json['exp_date'] == null | ||
| 62 | + ? null | ||
| 63 | + : (json['exp_date'] is String) | ||
| 64 | + ? ExpDate.fromJson(jsonDecode(json['exp_date'])) | ||
| 65 | + : (json['exp_date'] is Map) | ||
| 66 | + ? ExpDate.fromJson(json['exp_date']) | ||
| 67 | + : null, | ||
| 68 | + json['nick_name'] as String, | ||
| 69 | + json['grant_num'] as String, | ||
| 70 | + json['urllink'] as String, | ||
| 71 | + json['lite_qrcode'] as String, | ||
| 72 | + json['aexpiration'] as String, | ||
| 73 | + json['number'] ?? 0 as int); | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) => | 76 | Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) => |
| @@ -100,7 +100,8 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) => | @@ -100,7 +100,8 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) => | ||
| 100 | 'grant_num': instance.grantNum, | 100 | 'grant_num': instance.grantNum, |
| 101 | 'urllink': instance.urllink, | 101 | 'urllink': instance.urllink, |
| 102 | 'lite_qrcode': instance.liteQrcode, | 102 | 'lite_qrcode': instance.liteQrcode, |
| 103 | - 'aexpiration': instance.aexpiration | 103 | + 'aexpiration': instance.aexpiration, |
| 104 | + 'number': instance.number | ||
| 104 | }; | 105 | }; |
| 105 | 106 | ||
| 106 | CouponUse _$CouponUseFromJson(Map<String, dynamic> json) { | 107 | CouponUse _$CouponUseFromJson(Map<String, dynamic> json) { |
| @@ -5,11 +5,14 @@ import 'package:dio/dio.dart'; | @@ -5,11 +5,14 @@ import 'package:dio/dio.dart'; | ||
| 5 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
| 6 | import 'package:one_key/app.dart'; | 6 | import 'package:one_key/app.dart'; |
| 7 | import 'package:one_key/constant/error.dart'; | 7 | import 'package:one_key/constant/error.dart'; |
| 8 | +import 'package:one_key/net/http_url.dart'; | ||
| 9 | +import 'package:one_key/pages/my/contant_item_page.dart'; | ||
| 8 | import 'package:one_key/provider/user_model.dart'; | 10 | import 'package:one_key/provider/user_model.dart'; |
| 9 | import 'package:one_key/utils/utils.dart'; | 11 | import 'package:one_key/utils/utils.dart'; |
| 10 | import 'package:one_key/widgets/loading.dart'; | 12 | import 'package:one_key/widgets/loading.dart'; |
| 11 | import 'package:provider/provider.dart'; | 13 | import 'package:provider/provider.dart'; |
| 12 | 14 | ||
| 15 | +import '../constant/constant.dart'; | ||
| 13 | import 'base_resp.dart'; | 16 | import 'base_resp.dart'; |
| 14 | 17 | ||
| 15 | /** | 18 | /** |
| @@ -378,7 +381,7 @@ class DioUtil { | @@ -378,7 +381,7 @@ class DioUtil { | ||
| 378 | // }; | 381 | // }; |
| 379 | } | 382 | } |
| 380 | _dio.options.method = method; | 383 | _dio.options.method = method; |
| 381 | - _dio.options.baseUrl = 'http://xt04.colorcun.com/'; | 384 | + _dio.options.baseUrl = HttpUrl.server_address; |
| 382 | _dio.options.contentType = Headers.multipartFormDataContentType; | 385 | _dio.options.contentType = Headers.multipartFormDataContentType; |
| 383 | 386 | ||
| 384 | return options; | 387 | return options; |
| 1 | import 'package:common_utils/common_utils.dart'; | 1 | import 'package:common_utils/common_utils.dart'; |
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | +import 'package:flutter/services.dart'; | ||
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | import 'package:one_key/models/coupon_model.dart'; | 5 | import 'package:one_key/models/coupon_model.dart'; |
| 5 | import 'package:one_key/provider/coupon_provider.dart'; | 6 | import 'package:one_key/provider/coupon_provider.dart'; |
| @@ -19,16 +20,17 @@ class CouponItemF extends StatefulWidget { | @@ -19,16 +20,17 @@ class CouponItemF extends StatefulWidget { | ||
| 19 | final bool showBtn; | 20 | final bool showBtn; |
| 20 | final bool showCheck; | 21 | final bool showCheck; |
| 21 | final bool radio; | 22 | final bool radio; |
| 22 | - CouponItemF( | ||
| 23 | - {Key key, | ||
| 24 | - this.from, | ||
| 25 | - this.onPressed, | ||
| 26 | - this.onPressedSwich, | ||
| 27 | - this.couponSonModel, | ||
| 28 | - this.showBtn = false, | ||
| 29 | - this.showCheck = false, | ||
| 30 | - this.radio = false}) | ||
| 31 | - : super(key: key); | 23 | + |
| 24 | + CouponItemF({ | ||
| 25 | + Key key, | ||
| 26 | + this.from, | ||
| 27 | + this.onPressed, | ||
| 28 | + this.onPressedSwich, | ||
| 29 | + this.couponSonModel, | ||
| 30 | + this.showBtn = false, | ||
| 31 | + this.showCheck = false, | ||
| 32 | + this.radio = false, | ||
| 33 | + }) : super(key: key); | ||
| 32 | 34 | ||
| 33 | @override | 35 | @override |
| 34 | _CouponItemFState createState() => _CouponItemFState(); | 36 | _CouponItemFState createState() => _CouponItemFState(); |
| @@ -68,138 +70,141 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -68,138 +70,141 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 68 | children: [ | 70 | children: [ |
| 69 | HEmptyView(20), | 71 | HEmptyView(20), |
| 70 | widget.from == 'select' | 72 | widget.from == 'select' |
| 71 | - ? Image.asset( | ||
| 72 | - Utils.getImgPath(sunModel.isCheck | ||
| 73 | - ? widget.radio | ||
| 74 | - ? 'select_f' | ||
| 75 | - : 'c_mul_select' | ||
| 76 | - : widget.radio | ||
| 77 | - ? 'show_select_f' | ||
| 78 | - : 'c_not_edit'), | ||
| 79 | - width: w(20), | ||
| 80 | - ) | 73 | + ? InkWell( |
| 74 | + onTap: widget.onPressed, | ||
| 75 | + child: Image.asset( | ||
| 76 | + Utils.getImgPath(sunModel.isCheck | ||
| 77 | + ? widget.radio | ||
| 78 | + ? 'c_mul_select' | ||
| 79 | + : 'select_f' | ||
| 80 | + : widget.radio | ||
| 81 | + ? 'c_not_edit' | ||
| 82 | + : 'show_select_f'), | ||
| 83 | + width: w(20), | ||
| 84 | + )) | ||
| 81 | : Container(), | 85 | : Container(), |
| 82 | Expanded( | 86 | Expanded( |
| 83 | - child: InkWell( | ||
| 84 | - onTap: widget.onPressed, | ||
| 85 | - child: Container( | ||
| 86 | - // width: ScreenUtil().setWidth(610), | ||
| 87 | - margin: EdgeInsets.fromLTRB( | ||
| 88 | - ScreenUtil().setWidth(20), | ||
| 89 | - ScreenUtil().setWidth(0), | ||
| 90 | - ScreenUtil().setWidth(40), | ||
| 91 | - ScreenUtil().setWidth(0)), | ||
| 92 | - decoration: BoxDecoration( | ||
| 93 | - color: MyColours.color_ffffff, | ||
| 94 | - boxShadow: [ | ||
| 95 | - BoxShadow( | ||
| 96 | - spreadRadius: ScreenUtil().setWidth(2), | ||
| 97 | - color: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 98 | - offset: Offset(0, ScreenUtil().setWidth(8)), | ||
| 99 | - blurRadius: ScreenUtil().setWidth(8)) | ||
| 100 | - ], | ||
| 101 | - borderRadius: BorderRadius.all( | ||
| 102 | - Radius.circular(ScreenUtil().setWidth(16)), | 87 | + child: Container( |
| 88 | + // width: ScreenUtil().setWidth(610), | ||
| 89 | + margin: EdgeInsets.fromLTRB( | ||
| 90 | + ScreenUtil().setWidth(20), | ||
| 91 | + ScreenUtil().setWidth(0), | ||
| 92 | + ScreenUtil().setWidth(40), | ||
| 93 | + ScreenUtil().setWidth(0)), | ||
| 94 | + decoration: BoxDecoration( | ||
| 95 | + color: MyColours.color_ffffff, | ||
| 96 | + boxShadow: [ | ||
| 97 | + BoxShadow( | ||
| 98 | + spreadRadius: ScreenUtil().setWidth(2), | ||
| 99 | + color: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 100 | + offset: Offset(0, ScreenUtil().setWidth(8)), | ||
| 101 | + blurRadius: ScreenUtil().setWidth(8)) | ||
| 102 | + ], | ||
| 103 | + borderRadius: BorderRadius.all( | ||
| 104 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 105 | + ), | ||
| 106 | + ), | ||
| 107 | + child: Column( | ||
| 108 | + mainAxisSize: MainAxisSize.min, | ||
| 109 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 110 | + children: [ | ||
| 111 | + Container( | ||
| 112 | + height: ScreenUtil().setWidth(40), | ||
| 113 | + padding: EdgeInsets.symmetric( | ||
| 114 | + horizontal: ScreenUtil().setWidth(24)), | ||
| 115 | + decoration: BoxDecoration( | ||
| 116 | + color: widget.from == 'history' | ||
| 117 | + ? MyColours.color_BFC4D4 | ||
| 118 | + : widget.from == 'setting' | ||
| 119 | + ? MyColours.color_00A870 | ||
| 120 | + : notSelect | ||
| 121 | + ? sunModel.isType == '1' || | ||
| 122 | + sunModel.isType == '3' || | ||
| 123 | + sunModel.isType == '4' | ||
| 124 | + ? sunModel.isMarking | ||
| 125 | + ? MyColours.color_00A870 | ||
| 126 | + : MyColours.color_438E93 | ||
| 127 | + : MyColours.color_ED7B2F | ||
| 128 | + : MyColours.color_999999, | ||
| 129 | + borderRadius: BorderRadius.only( | ||
| 130 | + topLeft: | ||
| 131 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 132 | + topRight: Radius.circular( | ||
| 133 | + ScreenUtil().setWidth(16)))), | ||
| 134 | + child: Row( | ||
| 135 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 136 | + children: [ | ||
| 137 | + Text( | ||
| 138 | + sunModel.isType == '1' | ||
| 139 | + ? sunModel.isExamine == '1' | ||
| 140 | + ? '店铺优惠券(核销)' | ||
| 141 | + : '店铺优惠券' | ||
| 142 | + : sunModel.isType == '2' | ||
| 143 | + ? '我的优惠券' | ||
| 144 | + : sunModel.isType == '3' | ||
| 145 | + ? '免费代金券' | ||
| 146 | + : '付费优惠券', | ||
| 147 | + style: TextStyle( | ||
| 148 | + color: MyColours.color_ffffff, | ||
| 149 | + fontSize: ScreenUtil().setSp(24)), | ||
| 103 | ), | 150 | ), |
| 104 | - ), | ||
| 105 | - child: Column( | ||
| 106 | - mainAxisSize: MainAxisSize.min, | ||
| 107 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 108 | - children: [ | ||
| 109 | - Container( | ||
| 110 | - height: ScreenUtil().setWidth(40), | ||
| 111 | - padding: EdgeInsets.symmetric( | ||
| 112 | - horizontal: ScreenUtil().setWidth(24)), | ||
| 113 | - decoration: BoxDecoration( | ||
| 114 | - color: widget.from == 'history' | ||
| 115 | - ? MyColours.color_BFC4D4 | ||
| 116 | - : widget.from == 'setting' | ||
| 117 | - ? MyColours.color_00A870 | ||
| 118 | - : notSelect | ||
| 119 | - ? sunModel.isType == '1' || | ||
| 120 | - sunModel.isType == | ||
| 121 | - '3' || | ||
| 122 | - sunModel.isType == '4' | ||
| 123 | - ? sunModel.isMarking | ||
| 124 | - ? MyColours.color_00A870 | ||
| 125 | - : MyColours.color_438E93 | ||
| 126 | - : MyColours.color_ED7B2F | ||
| 127 | - : MyColours.color_999999, | ||
| 128 | - borderRadius: BorderRadius.only( | ||
| 129 | - topLeft: Radius.circular( | ||
| 130 | - ScreenUtil().setWidth(16)), | ||
| 131 | - topRight: Radius.circular( | ||
| 132 | - ScreenUtil().setWidth(16)))), | ||
| 133 | - child: Row( | ||
| 134 | - mainAxisAlignment: | ||
| 135 | - MainAxisAlignment.spaceBetween, | ||
| 136 | - children: [ | ||
| 137 | - Text( | ||
| 138 | - sunModel.isType == '1' | ||
| 139 | - ? sunModel.isExamine == '1' | ||
| 140 | - ? '店铺优惠券(核销)' | ||
| 141 | - : '店铺优惠券' | ||
| 142 | - : sunModel.isType == '2' | ||
| 143 | - ? '我的优惠券' | ||
| 144 | - : sunModel.isType == '3' | ||
| 145 | - ? '免费代金券' | ||
| 146 | - : '付费优惠券', | ||
| 147 | - style: TextStyle( | ||
| 148 | - color: MyColours.color_ffffff, | ||
| 149 | - fontSize: ScreenUtil().setSp(24)), | ||
| 150 | - ), | ||
| 151 | - InkWell( | ||
| 152 | - onTap: widget.onPressedSwich, | ||
| 153 | - child: Text( | ||
| 154 | - sunModel.isType == '1' | ||
| 155 | - ? sunModel.isExamine == '1' | ||
| 156 | - ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张' | ||
| 157 | - : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张' | ||
| 158 | - : sunModel.isType == '2' | ||
| 159 | - ? '被领取:${sunModel.receiveNum}张' | ||
| 160 | - : '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张', | ||
| 161 | - maxLines: 1, | ||
| 162 | - overflow: TextOverflow.ellipsis, | ||
| 163 | - style: TextStyle( | ||
| 164 | - color: MyColours.color_ffffff, | ||
| 165 | - fontSize: | ||
| 166 | - ScreenUtil().setSp(20))), | ||
| 167 | - ), | ||
| 168 | - ], | ||
| 169 | - ), | ||
| 170 | - ), | ||
| 171 | - Container( | ||
| 172 | - padding: EdgeInsets.fromLTRB( | ||
| 173 | - ScreenUtil().setWidth(24 * 2), | ||
| 174 | - ScreenUtil().setWidth(9 * 2), | ||
| 175 | - ScreenUtil().setWidth(10), | ||
| 176 | - ScreenUtil().setWidth(20)), | ||
| 177 | - child: Column( | 151 | + InkWell( |
| 152 | + onTap: widget.onPressedSwich, | ||
| 153 | + child: Text( | ||
| 154 | + sunModel.isType == '1' | ||
| 155 | + ? sunModel.isExamine == '1' | ||
| 156 | + ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张' | ||
| 157 | + : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张' | ||
| 158 | + : sunModel.isType == '2' | ||
| 159 | + ? '被领取:${sunModel.receiveNum}张' | ||
| 160 | + : sunModel.receiveNum == null | ||
| 161 | + ? '' | ||
| 162 | + : '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张', | ||
| 163 | + maxLines: 1, | ||
| 164 | + overflow: TextOverflow.ellipsis, | ||
| 165 | + style: TextStyle( | ||
| 166 | + color: MyColours.color_ffffff, | ||
| 167 | + fontSize: ScreenUtil().setSp(20))), | ||
| 168 | + ), | ||
| 169 | + ], | ||
| 170 | + ), | ||
| 171 | + ), | ||
| 172 | + Container( | ||
| 173 | + padding: EdgeInsets.fromLTRB( | ||
| 174 | + ScreenUtil().setWidth(24 * 2), | ||
| 175 | + ScreenUtil().setWidth(9 * 2), | ||
| 176 | + ScreenUtil().setWidth(10), | ||
| 177 | + ScreenUtil().setWidth(20)), | ||
| 178 | + child: Column( | ||
| 179 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 180 | + children: [ | ||
| 181 | + Row( | ||
| 182 | + children: [ | ||
| 183 | + Expanded( | ||
| 184 | + child: Column( | ||
| 178 | crossAxisAlignment: CrossAxisAlignment.start, | 185 | crossAxisAlignment: CrossAxisAlignment.start, |
| 179 | children: [ | 186 | children: [ |
| 180 | Container( | 187 | Container( |
| 181 | - width: ScreenUtil().setWidth(232 * 2), | 188 | + // width: ScreenUtil() |
| 189 | + // .setWidth(232 * 2), | ||
| 182 | child: Container( | 190 | child: Container( |
| 183 | - height: ScreenUtil().setWidth(25 * 2), | ||
| 184 | - constraints: BoxConstraints( | ||
| 185 | - maxWidth: | ||
| 186 | - ScreenUtil().setWidth(190)), | ||
| 187 | - child: Text( | ||
| 188 | - sunModel.aname, | ||
| 189 | - maxLines: 2, | ||
| 190 | - overflow: TextOverflow.ellipsis, | ||
| 191 | - style: TextStyle( | ||
| 192 | - color: widget.from == 'history' | ||
| 193 | - ? MyColours.color_BFC4D4 | ||
| 194 | - : notSelect | ||
| 195 | - ? MyColours.color_515151 | ||
| 196 | - : MyColours | ||
| 197 | - .color_999999, | ||
| 198 | - fontSize: | ||
| 199 | - ScreenUtil().setSp(36), | ||
| 200 | - fontWeight: FontWeight.bold), | ||
| 201 | - ), | ||
| 202 | - )), | 191 | + height: ScreenUtil().setWidth(25 * 2), |
| 192 | + constraints: BoxConstraints( | ||
| 193 | + maxWidth: ScreenUtil().setWidth(190)), | ||
| 194 | + child: Text( | ||
| 195 | + sunModel.aname, | ||
| 196 | + maxLines: 2, | ||
| 197 | + overflow: TextOverflow.ellipsis, | ||
| 198 | + style: TextStyle( | ||
| 199 | + color: widget.from == 'history' | ||
| 200 | + ? MyColours.color_BFC4D4 | ||
| 201 | + : notSelect | ||
| 202 | + ? MyColours.color_515151 | ||
| 203 | + : MyColours.color_999999, | ||
| 204 | + fontSize: ScreenUtil().setSp(36), | ||
| 205 | + fontWeight: FontWeight.bold), | ||
| 206 | + ), | ||
| 207 | + )), | ||
| 203 | Container( | 208 | Container( |
| 204 | height: ScreenUtil().setWidth(14 * 2), | 209 | height: ScreenUtil().setWidth(14 * 2), |
| 205 | width: ScreenUtil().setWidth(232 * 2), | 210 | width: ScreenUtil().setWidth(232 * 2), |
| @@ -221,177 +226,298 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -221,177 +226,298 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 221 | fontSize: ScreenUtil().setSp(20), | 226 | fontSize: ScreenUtil().setSp(20), |
| 222 | )), | 227 | )), |
| 223 | ), | 228 | ), |
| 224 | - VEmptyView(16), | ||
| 225 | - (ObjectUtil.isNotEmpty(sunModel.stime) && | ||
| 226 | - sunModel.stime != '0') || | ||
| 227 | - (ObjectUtil.isNotEmpty( | ||
| 228 | - sunModel.etime) && | ||
| 229 | - sunModel.etime != '0') | ||
| 230 | - ? Container( | ||
| 231 | - child: Text( | ||
| 232 | - '使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}', | ||
| 233 | - style: TextStyle( | ||
| 234 | - color: widget.from == | ||
| 235 | - 'history' | ||
| 236 | - ? MyColours.color_BFC4D4 | ||
| 237 | - : MyColours | ||
| 238 | - .color_999999, | ||
| 239 | - fontSize: ScreenUtil() | ||
| 240 | - .setSp(20))), | ||
| 241 | - ) | ||
| 242 | - : Container(), | ||
| 243 | ], | 229 | ], |
| 244 | - ), | ||
| 245 | - // widget.from == 'select' | ||
| 246 | - // ? widget.showCheck | ||
| 247 | - // ? Positioned( | ||
| 248 | - // right: 0, | ||
| 249 | - // top: ScreenUtil().setWidth(20), | ||
| 250 | - // child: Image.asset( | ||
| 251 | - // Utils.getImgPath(widget.couponSonModel.isCheck | ||
| 252 | - // ? 'check_r' | ||
| 253 | - // : 'check_un'), | ||
| 254 | - // width: ScreenUtil().setWidth(40), | ||
| 255 | - // height: ScreenUtil().setWidth(40), | ||
| 256 | - // )) | ||
| 257 | - // : Container() | ||
| 258 | - // : | ||
| 259 | - ), | ||
| 260 | - ObjectUtil.isNotEmpty(sunModel.explain) | ||
| 261 | - ? const MySeparator( | ||
| 262 | - width: 3, color: MyColours.color_f3f3f3) | ||
| 263 | - : SizedBox(), | ||
| 264 | - ObjectUtil.isNotEmpty(sunModel.explain) | ||
| 265 | - ? InkWell( | ||
| 266 | - onTap: () { | ||
| 267 | - if (explainH > 19) { | ||
| 268 | - setState(() { | ||
| 269 | - widget.couponSonModel.showText = | ||
| 270 | - !widget.couponSonModel.showText; | ||
| 271 | - }); | ||
| 272 | - } | ||
| 273 | - }, | ||
| 274 | - child: Container( | ||
| 275 | - width: double.infinity, | 230 | + )), |
| 231 | + if (widget.from == 'select' && | ||
| 232 | + sunModel.isType == '3' && | ||
| 233 | + widget.radio) | ||
| 234 | + Row( | ||
| 235 | + children: [ | ||
| 236 | + InkWell( | ||
| 237 | + onTap: () { | ||
| 238 | + if (sunModel.number == 0) { | ||
| 239 | + return; | ||
| 240 | + } | ||
| 241 | + sunModel.number--; | ||
| 242 | + sunModel.numberC.text = | ||
| 243 | + '${sunModel.number}'; | ||
| 244 | + }, | ||
| 245 | + child: Container( | ||
| 246 | + height: w(40), | ||
| 247 | + padding: EdgeInsets.symmetric( | ||
| 248 | + horizontal: w(10)), | ||
| 249 | + child: Image.asset( | ||
| 250 | + Utils.getImgPath('plan_dish_minus'), | ||
| 251 | + width: w(8), | ||
| 252 | + ), | ||
| 253 | + ), | ||
| 254 | + ), | ||
| 255 | + Container( | ||
| 256 | + // constraints: BoxConstraints( | ||
| 257 | + // minWidth: w(34), | ||
| 258 | + // ), | ||
| 259 | + width: w(30), | ||
| 276 | decoration: BoxDecoration( | 260 | decoration: BoxDecoration( |
| 277 | - color: widget.from == 'history' | ||
| 278 | - ? MyColours.color_ffffff | ||
| 279 | - : notSelect | ||
| 280 | - ? MyColours.color_ffffff | ||
| 281 | - : MyColours.color_FAFAFA, | ||
| 282 | - borderRadius: BorderRadius.only( | ||
| 283 | - bottomLeft: Radius.circular( | ||
| 284 | - ScreenUtil() | ||
| 285 | - .setWidth(20)), | ||
| 286 | - bottomRight: Radius.circular( | ||
| 287 | - ScreenUtil() | ||
| 288 | - .setWidth(20)))), | ||
| 289 | - child: Row( | ||
| 290 | - crossAxisAlignment: | ||
| 291 | - CrossAxisAlignment.start, | ||
| 292 | - children: [ | ||
| 293 | - widget.couponSonModel.showText | ||
| 294 | - ? Container( | ||
| 295 | - padding: | ||
| 296 | - EdgeInsets.fromLTRB( | ||
| 297 | - ScreenUtil() | ||
| 298 | - .setWidth( | ||
| 299 | - 24 * 2), | ||
| 300 | - ScreenUtil() | ||
| 301 | - .setWidth(14), | ||
| 302 | - ScreenUtil() | ||
| 303 | - .setWidth(0), | ||
| 304 | - ScreenUtil() | ||
| 305 | - .setWidth( | ||
| 306 | - 14)), | ||
| 307 | - width: ScreenUtil() | ||
| 308 | - .screenWidth - | ||
| 309 | - ScreenUtil() | ||
| 310 | - .setWidth(92 * 2), | ||
| 311 | - child: Text( | ||
| 312 | - '说明:${sunModel.explain}', | ||
| 313 | - maxLines: 5, | ||
| 314 | - style: TextStyle( | ||
| 315 | - color: widget | ||
| 316 | - .from == | ||
| 317 | - 'history' | ||
| 318 | - ? MyColours | ||
| 319 | - .color_BFC4D4 | ||
| 320 | - : MyColours | ||
| 321 | - .color_999999, | ||
| 322 | - fontSize: | ||
| 323 | - ScreenUtil() | ||
| 324 | - .setSp( | ||
| 325 | - 20))), | ||
| 326 | - ) | ||
| 327 | - : Container( | ||
| 328 | - padding: | ||
| 329 | - EdgeInsets.fromLTRB( | ||
| 330 | - ScreenUtil() | ||
| 331 | - .setWidth( | ||
| 332 | - 24 * 2), | ||
| 333 | - ScreenUtil() | ||
| 334 | - .setWidth(14), | ||
| 335 | - ScreenUtil() | ||
| 336 | - .setWidth(0), | ||
| 337 | - ScreenUtil() | ||
| 338 | - .setWidth( | ||
| 339 | - 14)), | ||
| 340 | - width: ScreenUtil() | ||
| 341 | - .screenWidth - | ||
| 342 | - ScreenUtil().setWidth( | ||
| 343 | - 92 * 2) + | ||
| 344 | - ScreenUtil() | ||
| 345 | - .setWidth(20), | ||
| 346 | - child: Text( | ||
| 347 | - '说明:${sunModel.explain}', | ||
| 348 | - maxLines: 1, | ||
| 349 | - overflow: | ||
| 350 | - TextOverflow.fade, | ||
| 351 | - softWrap: false, | ||
| 352 | - style: TextStyle( | ||
| 353 | - color: widget | ||
| 354 | - .from == | ||
| 355 | - 'history' | ||
| 356 | - ? MyColours | ||
| 357 | - .color_BFC4D4 | ||
| 358 | - : MyColours | ||
| 359 | - .color_999999, | ||
| 360 | - fontSize: | ||
| 361 | - ScreenUtil() | ||
| 362 | - .setSp( | ||
| 363 | - 20))), | ||
| 364 | - ), | ||
| 365 | - Spacer(), | ||
| 366 | - explainH > 19 | ||
| 367 | - ? Container( | ||
| 368 | - margin: EdgeInsets.only( | ||
| 369 | - top: ScreenUtil() | ||
| 370 | - .setWidth(10), | ||
| 371 | - right: ScreenUtil() | ||
| 372 | - .setWidth(16)), | ||
| 373 | - child: Image.asset( | ||
| 374 | - !widget.couponSonModel | ||
| 375 | - .showText | ||
| 376 | - ? Utils.getImgPath( | ||
| 377 | - 'quan_down_f') | ||
| 378 | - : Utils.getImgPath( | ||
| 379 | - 'quan_up_f'), | ||
| 380 | - width: ScreenUtil() | ||
| 381 | - .setWidth(28), | ||
| 382 | - height: ScreenUtil() | ||
| 383 | - .setWidth(28)), | ||
| 384 | - ) | ||
| 385 | - : Container(), | ||
| 386 | - HEmptyView(14) | 261 | + borderRadius: |
| 262 | + BorderRadius.circular(r(5)), | ||
| 263 | + border: Border.all( | ||
| 264 | + width: w(1), | ||
| 265 | + color: | ||
| 266 | + MyColours.color_438E93)), | ||
| 267 | + // constraints: BoxConstraints(minWidth: w(20)), | ||
| 268 | + child: TextField( | ||
| 269 | + maxLines: 1, | ||
| 270 | + controller: sunModel.numberC, | ||
| 271 | + // focusNode: _focusNode, | ||
| 272 | + // autofocus: true, | ||
| 273 | + | ||
| 274 | + inputFormatters: [ | ||
| 275 | + FilteringTextInputFormatter.allow( | ||
| 276 | + RegExp(r'[0-9]')), | ||
| 387 | ], | 277 | ], |
| 278 | + | ||
| 279 | + style: TextStyle( | ||
| 280 | + color: MyColours.color_438E93, | ||
| 281 | + fontSize: font(11)), | ||
| 282 | + textAlign: TextAlign.center, | ||
| 283 | + // textAlignVertical: TextAlignVertical.center, | ||
| 284 | + decoration: InputDecoration( | ||
| 285 | + hintText: "数量", | ||
| 286 | + isCollapsed: true, | ||
| 287 | + hintStyle: TextStyle( | ||
| 288 | + color: MyColours.color_999999, | ||
| 289 | + fontSize: font(11), | ||
| 290 | + ), | ||
| 291 | + // isCollapsed: | ||
| 292 | + // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度 | ||
| 293 | + border: OutlineInputBorder( | ||
| 294 | + borderSide: BorderSide.none), | ||
| 295 | + contentPadding: EdgeInsets.only( | ||
| 296 | + top: w(2), bottom: w(2)), | ||
| 297 | + ), | ||
| 298 | + keyboardType: | ||
| 299 | + TextInputType.numberWithOptions( | ||
| 300 | + decimal: true), | ||
| 301 | + textInputAction: | ||
| 302 | + TextInputAction.done, | ||
| 303 | + | ||
| 304 | + onChanged: (value) { | ||
| 305 | + // bool isNumber = Utils.isNumeric( | ||
| 306 | + // value); //判断输入的内容是否是数字 | ||
| 307 | + // if (!isNumber) { | ||
| 308 | + // Utils.showToast('请输入数字'); | ||
| 309 | + // pNumC.text = ''; | ||
| 310 | + // return; | ||
| 311 | + // } else { | ||
| 312 | + if (value != null && | ||
| 313 | + value != '') { | ||
| 314 | + if (int.parse(value) > | ||
| 315 | + int.parse( | ||
| 316 | + sunModel.grantNum)) { | ||
| 317 | + Utils.showToast( | ||
| 318 | + '最大数量限制为${sunModel.grantNum}'); | ||
| 319 | + sunModel.numberC.text = | ||
| 320 | + sunModel.grantNum; | ||
| 321 | + sunModel.number = int.parse( | ||
| 322 | + sunModel.grantNum); | ||
| 323 | + | ||
| 324 | + return; | ||
| 325 | + } | ||
| 326 | + sunModel.number = | ||
| 327 | + int.parse(value); | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + // } | ||
| 331 | + // setState(() {}); | ||
| 332 | + // _searchSellerLocation(); | ||
| 333 | + // customerProvider.searchData(value); | ||
| 334 | + }, | ||
| 335 | + onEditingComplete: () { | ||
| 336 | + FocusScope.of(context) | ||
| 337 | + .requestFocus( | ||
| 338 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 339 | + // contantShowModel.searchData( | ||
| 340 | + // contantShowModel.controller.text); | ||
| 341 | + // _searchSellerLocation(); | ||
| 342 | + // _focusNode.unfocus(); | ||
| 343 | + }, | ||
| 388 | )), | 344 | )), |
| 389 | - ) | ||
| 390 | - : Container(), | ||
| 391 | - VEmptyView(32), | ||
| 392 | - ], | ||
| 393 | - ), | ||
| 394 | - ))), | 345 | + InkWell( |
| 346 | + onTap: () { | ||
| 347 | + if (sunModel.number == | ||
| 348 | + int.parse(sunModel.grantNum)) { | ||
| 349 | + Utils.showToast('已达到最大数量限制'); | ||
| 350 | + return; | ||
| 351 | + } | ||
| 352 | + sunModel.number++; | ||
| 353 | + sunModel.numberC.text = | ||
| 354 | + '${sunModel.number}'; | ||
| 355 | + }, | ||
| 356 | + child: Container( | ||
| 357 | + height: w(40), | ||
| 358 | + padding: EdgeInsets.only( | ||
| 359 | + left: w(10), right: w(10)), | ||
| 360 | + child: Image.asset( | ||
| 361 | + Utils.getImgPath('plan_dish_add'), | ||
| 362 | + width: w(8), | ||
| 363 | + ), | ||
| 364 | + ), | ||
| 365 | + ), | ||
| 366 | + ], | ||
| 367 | + ), | ||
| 368 | + if (widget.from == 'setting' && | ||
| 369 | + sunModel.isType == '3') | ||
| 370 | + Padding( | ||
| 371 | + padding: EdgeInsets.only(right: w(20)), | ||
| 372 | + child: Text( | ||
| 373 | + '${sunModel.number}张', | ||
| 374 | + style: TextStyle( | ||
| 375 | + fontSize: font(12), | ||
| 376 | + fontWeight: FontWeight.bold, | ||
| 377 | + color: MyColours.color_438E93), | ||
| 378 | + )) | ||
| 379 | + ], | ||
| 380 | + ), | ||
| 381 | + VEmptyView(16), | ||
| 382 | + (ObjectUtil.isNotEmpty(sunModel.stime) && | ||
| 383 | + sunModel.stime != '0') || | ||
| 384 | + (ObjectUtil.isNotEmpty(sunModel.etime) && | ||
| 385 | + sunModel.etime != '0') | ||
| 386 | + ? Container( | ||
| 387 | + child: Text( | ||
| 388 | + '使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}', | ||
| 389 | + style: TextStyle( | ||
| 390 | + color: widget.from == 'history' | ||
| 391 | + ? MyColours.color_BFC4D4 | ||
| 392 | + : MyColours.color_999999, | ||
| 393 | + fontSize: ScreenUtil().setSp(20))), | ||
| 394 | + ) | ||
| 395 | + : Container(), | ||
| 396 | + ], | ||
| 397 | + ), | ||
| 398 | + // widget.from == 'select' | ||
| 399 | + // ? widget.showCheck | ||
| 400 | + // ? Positioned( | ||
| 401 | + // right: 0, | ||
| 402 | + // top: ScreenUtil().setWidth(20), | ||
| 403 | + // child: Image.asset( | ||
| 404 | + // Utils.getImgPath(widget.couponSonModel.isCheck | ||
| 405 | + // ? 'check_r' | ||
| 406 | + // : 'check_un'), | ||
| 407 | + // width: ScreenUtil().setWidth(40), | ||
| 408 | + // height: ScreenUtil().setWidth(40), | ||
| 409 | + // )) | ||
| 410 | + // : Container() | ||
| 411 | + // : | ||
| 412 | + ), | ||
| 413 | + ObjectUtil.isNotEmpty(sunModel.explain) | ||
| 414 | + ? const MySeparator( | ||
| 415 | + width: 3, color: MyColours.color_f3f3f3) | ||
| 416 | + : SizedBox(), | ||
| 417 | + ObjectUtil.isNotEmpty(sunModel.explain) | ||
| 418 | + ? InkWell( | ||
| 419 | + onTap: () { | ||
| 420 | + if (explainH > 19) { | ||
| 421 | + setState(() { | ||
| 422 | + widget.couponSonModel.showText = | ||
| 423 | + !widget.couponSonModel.showText; | ||
| 424 | + }); | ||
| 425 | + } | ||
| 426 | + }, | ||
| 427 | + child: Container( | ||
| 428 | + width: double.infinity, | ||
| 429 | + decoration: BoxDecoration( | ||
| 430 | + color: widget.from == 'history' | ||
| 431 | + ? MyColours.color_ffffff | ||
| 432 | + : notSelect | ||
| 433 | + ? MyColours.color_ffffff | ||
| 434 | + : MyColours.color_FAFAFA, | ||
| 435 | + borderRadius: BorderRadius.only( | ||
| 436 | + bottomLeft: Radius.circular( | ||
| 437 | + ScreenUtil().setWidth(20)), | ||
| 438 | + bottomRight: Radius.circular( | ||
| 439 | + ScreenUtil().setWidth(20)))), | ||
| 440 | + child: Row( | ||
| 441 | + crossAxisAlignment: | ||
| 442 | + CrossAxisAlignment.start, | ||
| 443 | + children: [ | ||
| 444 | + widget.couponSonModel.showText | ||
| 445 | + ? Container( | ||
| 446 | + padding: EdgeInsets.fromLTRB( | ||
| 447 | + ScreenUtil().setWidth(24 * 2), | ||
| 448 | + ScreenUtil().setWidth(14), | ||
| 449 | + ScreenUtil().setWidth(0), | ||
| 450 | + ScreenUtil().setWidth(14)), | ||
| 451 | + width: ScreenUtil().screenWidth - | ||
| 452 | + ScreenUtil().setWidth(92 * 2), | ||
| 453 | + child: Text( | ||
| 454 | + '说明:${sunModel.explain}', | ||
| 455 | + maxLines: 5, | ||
| 456 | + style: TextStyle( | ||
| 457 | + color: widget.from == | ||
| 458 | + 'history' | ||
| 459 | + ? MyColours | ||
| 460 | + .color_BFC4D4 | ||
| 461 | + : MyColours | ||
| 462 | + .color_999999, | ||
| 463 | + fontSize: ScreenUtil() | ||
| 464 | + .setSp(20))), | ||
| 465 | + ) | ||
| 466 | + : Container( | ||
| 467 | + padding: EdgeInsets.fromLTRB( | ||
| 468 | + ScreenUtil().setWidth(24 * 2), | ||
| 469 | + ScreenUtil().setWidth(14), | ||
| 470 | + ScreenUtil().setWidth(0), | ||
| 471 | + ScreenUtil().setWidth(14)), | ||
| 472 | + width: ScreenUtil().screenWidth - | ||
| 473 | + ScreenUtil() | ||
| 474 | + .setWidth(92 * 2) + | ||
| 475 | + ScreenUtil().setWidth(20), | ||
| 476 | + child: Text( | ||
| 477 | + '说明:${sunModel.explain}', | ||
| 478 | + maxLines: 1, | ||
| 479 | + overflow: TextOverflow.fade, | ||
| 480 | + softWrap: false, | ||
| 481 | + style: TextStyle( | ||
| 482 | + color: widget.from == | ||
| 483 | + 'history' | ||
| 484 | + ? MyColours | ||
| 485 | + .color_BFC4D4 | ||
| 486 | + : MyColours | ||
| 487 | + .color_999999, | ||
| 488 | + fontSize: ScreenUtil() | ||
| 489 | + .setSp(20))), | ||
| 490 | + ), | ||
| 491 | + Spacer(), | ||
| 492 | + explainH > 19 | ||
| 493 | + ? Container( | ||
| 494 | + margin: EdgeInsets.only( | ||
| 495 | + top: | ||
| 496 | + ScreenUtil().setWidth(10), | ||
| 497 | + right: ScreenUtil() | ||
| 498 | + .setWidth(16)), | ||
| 499 | + child: Image.asset( | ||
| 500 | + !widget.couponSonModel | ||
| 501 | + .showText | ||
| 502 | + ? Utils.getImgPath( | ||
| 503 | + 'quan_down_f') | ||
| 504 | + : Utils.getImgPath( | ||
| 505 | + 'quan_up_f'), | ||
| 506 | + width: | ||
| 507 | + ScreenUtil().setWidth(28), | ||
| 508 | + height: ScreenUtil() | ||
| 509 | + .setWidth(28)), | ||
| 510 | + ) | ||
| 511 | + : Container(), | ||
| 512 | + HEmptyView(14) | ||
| 513 | + ], | ||
| 514 | + )), | ||
| 515 | + ) | ||
| 516 | + : Container(), | ||
| 517 | + VEmptyView(32), | ||
| 518 | + ], | ||
| 519 | + ), | ||
| 520 | + )), | ||
| 395 | ], | 521 | ], |
| 396 | ), | 522 | ), |
| 397 | Positioned( | 523 | Positioned( |
| @@ -136,6 +136,10 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | @@ -136,6 +136,10 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | ||
| 136 | ///优惠券设置 | 136 | ///优惠券设置 |
| 137 | 137 | ||
| 138 | _setCouponShow() async { | 138 | _setCouponShow() async { |
| 139 | + List couponSelectFreeTemp = []; | ||
| 140 | + couponSelectFree.forEach((element) { | ||
| 141 | + couponSelectFreeTemp.add(element.toJson()); | ||
| 142 | + }); | ||
| 139 | //接口 | 143 | //接口 |
| 140 | Map marketingData = { | 144 | Map marketingData = { |
| 141 | // 'isTranspond': isTranspond ? '1' : '0', //转发同行客人 | 145 | // 'isTranspond': isTranspond ? '1' : '0', //转发同行客人 |
| @@ -150,7 +154,7 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | @@ -150,7 +154,7 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | ||
| 150 | 'wecomle': welcome ?? '', | 154 | 'wecomle': welcome ?? '', |
| 151 | 'logo': qiniuUrl, | 155 | 'logo': qiniuUrl, |
| 152 | 'recharge_data': rechargeData, | 156 | 'recharge_data': rechargeData, |
| 153 | - // 'coupon_data_free': json.encode(couponDataList), | 157 | + 'coupon_data_free': couponSelectFreeTemp, |
| 154 | 'coupon_data_pay': json.encode(couponSelectPay), | 158 | 'coupon_data_pay': json.encode(couponSelectPay), |
| 155 | 'is_comments': isComments ? '1' : '0', | 159 | 'is_comments': isComments ? '1' : '0', |
| 156 | 'is_comments_coupon': isCommentsCoupon ? '1' : '0', | 160 | 'is_comments_coupon': isCommentsCoupon ? '1' : '0', |
| @@ -226,6 +230,7 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | @@ -226,6 +230,7 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | ||
| 226 | 230 | ||
| 227 | ///优惠券 | 231 | ///优惠券 |
| 228 | Widget _markingCupon({ | 232 | Widget _markingCupon({ |
| 233 | + List<CouponSunModel> coupon, | ||
| 229 | VoidCallback onPressed, | 234 | VoidCallback onPressed, |
| 230 | bool select = false, | 235 | bool select = false, |
| 231 | VoidCallback onPressedSelect, | 236 | VoidCallback onPressedSelect, |
| @@ -268,9 +273,9 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | @@ -268,9 +273,9 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | ||
| 268 | ListView.builder( | 273 | ListView.builder( |
| 269 | shrinkWrap: true, | 274 | shrinkWrap: true, |
| 270 | controller: controller, | 275 | controller: controller, |
| 271 | - itemCount: couponSelectPay.length, | 276 | + itemCount: coupon.length, |
| 272 | itemBuilder: (BuildContext context, int index) { | 277 | itemBuilder: (BuildContext context, int index) { |
| 273 | - CouponSunModel couponData = couponSelectPay[index]; | 278 | + CouponSunModel couponData = coupon[index]; |
| 274 | return CouponItemF( | 279 | return CouponItemF( |
| 275 | from: 'setting', | 280 | from: 'setting', |
| 276 | couponSonModel: couponData, | 281 | couponSonModel: couponData, |
| @@ -475,6 +480,7 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | @@ -475,6 +480,7 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | ||
| 475 | VEmptyView(24), | 480 | VEmptyView(24), |
| 476 | couponDataListPay != null && couponDataListPay.length > 0 | 481 | couponDataListPay != null && couponDataListPay.length > 0 |
| 477 | ? _markingCupon( | 482 | ? _markingCupon( |
| 483 | + coupon: couponSelectPay, | ||
| 478 | select: isCouponPay, | 484 | select: isCouponPay, |
| 479 | onPressedSelect: () { | 485 | onPressedSelect: () { |
| 480 | setState(() { | 486 | setState(() { |
| @@ -502,6 +508,37 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | @@ -502,6 +508,37 @@ class _CouponSettingPageState extends State<CouponSettingPage> { | ||
| 502 | select: false, | 508 | select: false, |
| 503 | ) | 509 | ) |
| 504 | : SizedBox(), | 510 | : SizedBox(), |
| 511 | + VEmptyView(24), | ||
| 512 | + couponDataListFree != null && couponDataListFree.length > 0 | ||
| 513 | + ? _markingCupon( | ||
| 514 | + coupon: couponSelectFree, | ||
| 515 | + select: isCouponFree, | ||
| 516 | + onPressedSelect: () { | ||
| 517 | + setState(() { | ||
| 518 | + isCouponFree = !isCouponFree; | ||
| 519 | + }); | ||
| 520 | + }, | ||
| 521 | + onPressed: () async { | ||
| 522 | + //切换活动 | ||
| 523 | + Map temp = | ||
| 524 | + await NavigatorUtil.goMarkingCouponSelectPage( | ||
| 525 | + context, | ||
| 526 | + '3', | ||
| 527 | + {'object': couponSelectFree}); | ||
| 528 | + if (temp != null && temp['coupon'] != null) { | ||
| 529 | + couponSelectFree = temp['coupon']; | ||
| 530 | + | ||
| 531 | + setState(() {}); | ||
| 532 | + } | ||
| 533 | + }) | ||
| 534 | + : (couponDataListFree == null || | ||
| 535 | + couponDataListFree.length == 0) | ||
| 536 | + ? _markingItem( | ||
| 537 | + '预订安排中免费赠送代金券', | ||
| 538 | + '当前没有可用优惠券,请创建优惠券后再来尝试。', | ||
| 539 | + select: false, | ||
| 540 | + ) | ||
| 541 | + : SizedBox(), | ||
| 505 | ], | 542 | ], |
| 506 | ), | 543 | ), |
| 507 | ), | 544 | ), |
| @@ -49,6 +49,26 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -49,6 +49,26 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 49 | CouponProvider couponProvider; | 49 | CouponProvider couponProvider; |
| 50 | 50 | ||
| 51 | List<CouponSunModel> selectDataList = []; | 51 | List<CouponSunModel> selectDataList = []; |
| 52 | + bool all = false; | ||
| 53 | + | ||
| 54 | + @override | ||
| 55 | + void initState() { | ||
| 56 | + // TODO: implement initState | ||
| 57 | + super.initState(); | ||
| 58 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 59 | + // if (!couponProvider.hasModify) { | ||
| 60 | + _couponNetworkData(); | ||
| 61 | + // } else { | ||
| 62 | + // couponProvider.pageStateSelect = PageState.Success; | ||
| 63 | + // // couponProvider.notifyListeners(); | ||
| 64 | + // } | ||
| 65 | + }); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @override | ||
| 69 | + void dispose() { | ||
| 70 | + super.dispose(); | ||
| 71 | + } | ||
| 52 | 72 | ||
| 53 | ///获取优惠券列表数据(status == 1) | 73 | ///获取优惠券列表数据(status == 1) |
| 54 | 74 | ||
| @@ -74,145 +94,81 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -74,145 +94,81 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 74 | for (var itemselect in widget.couponList) { | 94 | for (var itemselect in widget.couponList) { |
| 75 | if (itemselect.id == item.id) { | 95 | if (itemselect.id == item.id) { |
| 76 | item.isCheck = true; | 96 | item.isCheck = true; |
| 97 | + item.number = itemselect.number; | ||
| 98 | + item.numberC.text = item.number.toString(); | ||
| 77 | selectDataList.add(item); | 99 | selectDataList.add(item); |
| 78 | // break outerloop; | 100 | // break outerloop; |
| 79 | } | 101 | } |
| 80 | } | 102 | } |
| 81 | } | 103 | } |
| 104 | + if (selectDataList.length == couponProvider.couponListSelect.length) { | ||
| 105 | + all = true; | ||
| 106 | + } | ||
| 82 | 107 | ||
| 83 | setState(() {}); | 108 | setState(() {}); |
| 84 | } | 109 | } |
| 85 | 110 | ||
| 86 | @override | 111 | @override |
| 87 | - void initState() { | ||
| 88 | - // TODO: implement initState | ||
| 89 | - super.initState(); | ||
| 90 | - WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 91 | - // if (!couponProvider.hasModify) { | ||
| 92 | - _couponNetworkData(); | ||
| 93 | - // } else { | ||
| 94 | - // couponProvider.pageStateSelect = PageState.Success; | ||
| 95 | - // // couponProvider.notifyListeners(); | ||
| 96 | - // } | ||
| 97 | - }); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - @override | ||
| 101 | - void dispose() { | ||
| 102 | - super.dispose(); | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - @override | ||
| 106 | Widget build(BuildContext context) { | 112 | Widget build(BuildContext context) { |
| 107 | couponProvider = Provider.of<CouponProvider>(context, listen: true); | 113 | couponProvider = Provider.of<CouponProvider>(context, listen: true); |
| 108 | return Scaffold( | 114 | return Scaffold( |
| 109 | - backgroundColor: MyColours.color_ffffff, | ||
| 110 | - appBar: SystemAppBar( | ||
| 111 | - '选择优惠券', | ||
| 112 | - onTap: () { | ||
| 113 | - if (Navigator.canPop(context)) { | ||
| 114 | - Navigator.pop(context); | ||
| 115 | - } | ||
| 116 | - }, | ||
| 117 | - ), | ||
| 118 | - body: Column( | ||
| 119 | - children: [ | ||
| 120 | - Expanded(child: Consumer<CouponProvider>( | ||
| 121 | - builder: (context, model, _) { | ||
| 122 | - if (model.pageStateSelect != PageState.Success) { | ||
| 123 | - return ExceptionPage( | ||
| 124 | - pageState: model.pageStateSelect, | ||
| 125 | - callback: () { | ||
| 126 | - _couponNetworkData(); | ||
| 127 | - // offset = 0; | ||
| 128 | - // getMessage(showLoading: true); | ||
| 129 | - }, | ||
| 130 | - emptyMsg: "暂时没有列表信息哦", | ||
| 131 | - emptyImg: "empty_search", | ||
| 132 | - showMsg: "加载中,请稍后...", | ||
| 133 | - ); | ||
| 134 | - } else { | ||
| 135 | - return EasyRefresh.custom( | ||
| 136 | - controller: _controller, | ||
| 137 | - shrinkWrap: true, | ||
| 138 | - slivers: [ | ||
| 139 | - SliverList( | ||
| 140 | - delegate: SliverChildBuilderDelegate( | ||
| 141 | - (BuildContext context, int index) { | ||
| 142 | - return VEmptyView(40); | ||
| 143 | - }, childCount: 1), | ||
| 144 | - ), | ||
| 145 | - SliverList( | ||
| 146 | - delegate: SliverChildBuilderDelegate( | ||
| 147 | - (BuildContext context, int index) { | ||
| 148 | - return InkWell( | ||
| 149 | - onTap: () { | ||
| 150 | - //改这里 ******8 | ||
| 151 | - if (widget.mulSelect) { | ||
| 152 | - couponProvider.couponListSelect[index].isCheck = | ||
| 153 | - !couponProvider | ||
| 154 | - .couponListSelect[index].isCheck; | ||
| 155 | - if (couponProvider | ||
| 156 | - .couponListSelect[index].isCheck) { | ||
| 157 | - selectDataList.add( | ||
| 158 | - couponProvider.couponListSelect[index]); | ||
| 159 | - } else { | ||
| 160 | - selectDataList.remove( | ||
| 161 | - couponProvider.couponListSelect[index]); | ||
| 162 | - } | ||
| 163 | - } else { | ||
| 164 | - couponProvider.couponListSelect | ||
| 165 | - .forEach((element) { | ||
| 166 | - element.isCheck = false; | ||
| 167 | - }); | ||
| 168 | - selectDataList = []; | ||
| 169 | - selectDataList.add( | ||
| 170 | - couponProvider.couponListSelect[index]); | ||
| 171 | - couponProvider.couponListSelect[index].isCheck = | ||
| 172 | - true; | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - setState(() {}); | ||
| 176 | - }, | ||
| 177 | - // child: Row( | ||
| 178 | - // children: [ | ||
| 179 | - // HEmptyView(30), | ||
| 180 | - // !widget.hasModify | ||
| 181 | - // ? Checkbox( | ||
| 182 | - // value: couponProvider | ||
| 183 | - // .couponListSelect[index].isCheck, | ||
| 184 | - // checkColor: MyColours.color_ffffff, | ||
| 185 | - // activeColor: MyColours.app_main, | ||
| 186 | - // onChanged: (bool value) {}, | ||
| 187 | - // ) | ||
| 188 | - // : Container(), | ||
| 189 | - // Image.asset( | ||
| 190 | - // couponProvider.listData[index]['checked'] | ||
| 191 | - // ? 'assets/select.png' | ||
| 192 | - // : 'assets/unselect.png', | ||
| 193 | - // width: ScreenUtil().setWidth(44)), | ||
| 194 | - child: CouponItemF( | ||
| 195 | - from: 'select', | ||
| 196 | - showCheck: true, | ||
| 197 | - radio: false, | ||
| 198 | - couponSonModel: | ||
| 199 | - couponProvider.couponListSelect[index], | ||
| 200 | - onPressed: () { | ||
| 201 | - // bool old = couponProvider | ||
| 202 | - // .couponListSelect[index].isCheck; | 115 | + backgroundColor: MyColours.color_ffffff, |
| 116 | + appBar: SystemAppBar( | ||
| 117 | + '选择优惠券', | ||
| 118 | + onTap: () { | ||
| 119 | + if (Navigator.canPop(context)) { | ||
| 120 | + Navigator.pop(context); | ||
| 121 | + } | ||
| 122 | + }, | ||
| 123 | + ), | ||
| 124 | + body: Column( | ||
| 125 | + children: [ | ||
| 126 | + Expanded(child: Consumer<CouponProvider>( | ||
| 127 | + builder: (context, model, _) { | ||
| 128 | + if (model.pageStateSelect != PageState.Success) { | ||
| 129 | + return ExceptionPage( | ||
| 130 | + pageState: model.pageStateSelect, | ||
| 131 | + callback: () { | ||
| 132 | + _couponNetworkData(); | ||
| 133 | + // offset = 0; | ||
| 134 | + // getMessage(showLoading: true); | ||
| 135 | + }, | ||
| 136 | + emptyMsg: "暂时没有列表信息哦", | ||
| 137 | + emptyImg: "empty_search", | ||
| 138 | + showMsg: "加载中,请稍后...", | ||
| 139 | + ); | ||
| 140 | + } else { | ||
| 141 | + return EasyRefresh.custom( | ||
| 142 | + controller: _controller, | ||
| 143 | + shrinkWrap: true, | ||
| 144 | + slivers: [ | ||
| 145 | + SliverList( | ||
| 146 | + delegate: SliverChildBuilderDelegate( | ||
| 147 | + (BuildContext context, int index) { | ||
| 148 | + return VEmptyView(40); | ||
| 149 | + }, childCount: 1), | ||
| 150 | + ), | ||
| 151 | + SliverList( | ||
| 152 | + delegate: SliverChildBuilderDelegate( | ||
| 153 | + (BuildContext context, int index) { | ||
| 154 | + CouponSunModel sunModel = | ||
| 155 | + couponProvider.couponListSelect[index]; | ||
| 156 | + return InkWell( | ||
| 157 | + onTap: () { | ||
| 158 | + if (sunModel.isType != '3') { | ||
| 203 | //改这里 ******8 | 159 | //改这里 ******8 |
| 204 | if (widget.mulSelect) { | 160 | if (widget.mulSelect) { |
| 205 | - couponProvider | ||
| 206 | - .couponListSelect[index].isCheck = | ||
| 207 | - !couponProvider | ||
| 208 | - .couponListSelect[index].isCheck; | ||
| 209 | - if (couponProvider | ||
| 210 | - .couponListSelect[index].isCheck) { | ||
| 211 | - selectDataList.add(couponProvider | ||
| 212 | - .couponListSelect[index]); | 161 | + sunModel.isCheck = !sunModel.isCheck; |
| 162 | + if (sunModel.isCheck) { | ||
| 163 | + selectDataList.add(sunModel); | ||
| 213 | } else { | 164 | } else { |
| 214 | - selectDataList.remove(couponProvider | ||
| 215 | - .couponListSelect[index]); | 165 | + selectDataList.remove(sunModel); |
| 166 | + } | ||
| 167 | + if (couponProvider.couponListSelect | ||
| 168 | + .every((element) => element.isCheck)) { | ||
| 169 | + all = true; | ||
| 170 | + } else { | ||
| 171 | + all = false; | ||
| 216 | } | 172 | } |
| 217 | } else { | 173 | } else { |
| 218 | couponProvider.couponListSelect | 174 | couponProvider.couponListSelect |
| @@ -220,51 +176,156 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -220,51 +176,156 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 220 | element.isCheck = false; | 176 | element.isCheck = false; |
| 221 | }); | 177 | }); |
| 222 | selectDataList = []; | 178 | selectDataList = []; |
| 223 | - selectDataList.add( | ||
| 224 | - couponProvider.couponListSelect[index]); | ||
| 225 | - couponProvider | ||
| 226 | - .couponListSelect[index].isCheck = true; | 179 | + selectDataList.add(sunModel); |
| 180 | + sunModel.isCheck = true; | ||
| 227 | } | 181 | } |
| 182 | + | ||
| 228 | setState(() {}); | 183 | setState(() {}); |
| 229 | - })); | ||
| 230 | - }, childCount: couponProvider.couponListSelect.length), | ||
| 231 | - ) | ||
| 232 | - ], | ||
| 233 | - // onRefresh: () async { | ||
| 234 | - // // offset = 0; | ||
| 235 | - // // getMessage(showLoading: false); | ||
| 236 | - // }, | ||
| 237 | - // onLoad: () async { | ||
| 238 | - // // offset++; | ||
| 239 | - // // getMessage(showLoading: false); | ||
| 240 | - // }, | ||
| 241 | - ); | ||
| 242 | - } | ||
| 243 | - }, | ||
| 244 | - )), | ||
| 245 | - VEmptyView(20), | ||
| 246 | - couponProvider.pageStateSelect == PageState.Success | ||
| 247 | - ? Container( | ||
| 248 | - padding: EdgeInsets.only( | ||
| 249 | - left: w(20), top: w(12), right: w(20), bottom: w(25)), | ||
| 250 | - child: Row( | ||
| 251 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 252 | - children: [ | ||
| 253 | - Image.asset( | ||
| 254 | - Utils.getImgPath(true ? 'c_mul_select' : 'c_not_edit'), | ||
| 255 | - width: ScreenUtil().setWidth(40), | ||
| 256 | - ), | ||
| 257 | - HEmptyView(10), | ||
| 258 | - Text( | ||
| 259 | - '全选', | ||
| 260 | - style: TextStyle( | ||
| 261 | - fontSize: ScreenUtil().setWidth(32), | ||
| 262 | - fontWeight: FontWeight.bold, | ||
| 263 | - color: MyColours.color_000000), | ||
| 264 | - ), | ||
| 265 | - HEmptyView(20), | ||
| 266 | - Expanded( | ||
| 267 | - child: RoundButton( | 184 | + } |
| 185 | + }, | ||
| 186 | + // child: Row( | ||
| 187 | + // children: [ | ||
| 188 | + // HEmptyView(30), | ||
| 189 | + // !widget.hasModify | ||
| 190 | + // ? Checkbox( | ||
| 191 | + // value: couponProvider | ||
| 192 | + // .couponListSelect[index].isCheck, | ||
| 193 | + // checkColor: MyColours.color_ffffff, | ||
| 194 | + // activeColor: MyColours.app_main, | ||
| 195 | + // onChanged: (bool value) {}, | ||
| 196 | + // ) | ||
| 197 | + // : Container(), | ||
| 198 | + // Image.asset( | ||
| 199 | + // couponProvider.listData[index]['checked'] | ||
| 200 | + // ? 'assets/select.png' | ||
| 201 | + // : 'assets/unselect.png', | ||
| 202 | + // width: ScreenUtil().setWidth(44)), | ||
| 203 | + child: CouponItemF( | ||
| 204 | + from: 'select', | ||
| 205 | + showCheck: true, | ||
| 206 | + radio: widget.mulSelect, | ||
| 207 | + couponSonModel: | ||
| 208 | + couponProvider.couponListSelect[index], | ||
| 209 | + onPressed: () { | ||
| 210 | + // bool old = couponProvider | ||
| 211 | + // .couponListSelect[index].isCheck; | ||
| 212 | + //改这里 ******8 | ||
| 213 | + if (widget.mulSelect) { | ||
| 214 | + couponProvider | ||
| 215 | + .couponListSelect[index].isCheck = | ||
| 216 | + !couponProvider | ||
| 217 | + .couponListSelect[index].isCheck; | ||
| 218 | + if (couponProvider | ||
| 219 | + .couponListSelect[index].isCheck) { | ||
| 220 | + selectDataList.add(couponProvider | ||
| 221 | + .couponListSelect[index]); | ||
| 222 | + } else { | ||
| 223 | + selectDataList.remove(couponProvider | ||
| 224 | + .couponListSelect[index]); | ||
| 225 | + } | ||
| 226 | + if (couponProvider.couponListSelect.every( | ||
| 227 | + (element) => element.isCheck)) { | ||
| 228 | + all = true; | ||
| 229 | + } else { | ||
| 230 | + all = false; | ||
| 231 | + } | ||
| 232 | + } else { | ||
| 233 | + couponProvider.couponListSelect | ||
| 234 | + .forEach((element) { | ||
| 235 | + element.isCheck = false; | ||
| 236 | + }); | ||
| 237 | + selectDataList = []; | ||
| 238 | + selectDataList.add(couponProvider | ||
| 239 | + .couponListSelect[index]); | ||
| 240 | + couponProvider.couponListSelect[index] | ||
| 241 | + .isCheck = true; | ||
| 242 | + } | ||
| 243 | + setState(() {}); | ||
| 244 | + })); | ||
| 245 | + }, childCount: couponProvider.couponListSelect.length), | ||
| 246 | + ) | ||
| 247 | + ], | ||
| 248 | + // onRefresh: () async { | ||
| 249 | + // // offset = 0; | ||
| 250 | + // // getMessage(showLoading: false); | ||
| 251 | + // }, | ||
| 252 | + // onLoad: () async { | ||
| 253 | + // // offset++; | ||
| 254 | + // // getMessage(showLoading: false); | ||
| 255 | + // }, | ||
| 256 | + ); | ||
| 257 | + } | ||
| 258 | + }, | ||
| 259 | + )), | ||
| 260 | + VEmptyView(20), | ||
| 261 | + if (couponProvider.pageStateSelect == PageState.Success) | ||
| 262 | + widget.mulSelect | ||
| 263 | + ? Container( | ||
| 264 | + padding: EdgeInsets.only( | ||
| 265 | + left: w(20), top: w(12), right: w(20), bottom: w(25)), | ||
| 266 | + child: Row( | ||
| 267 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 268 | + children: [ | ||
| 269 | + InkWell( | ||
| 270 | + onTap: () { | ||
| 271 | + all = !all; | ||
| 272 | + if (all) { | ||
| 273 | + selectDataList = []; | ||
| 274 | + for (var item | ||
| 275 | + in couponProvider.couponListSelect) { | ||
| 276 | + item.isCheck = true; | ||
| 277 | + selectDataList.add(item); | ||
| 278 | + } | ||
| 279 | + } else { | ||
| 280 | + selectDataList = []; | ||
| 281 | + for (var item | ||
| 282 | + in couponProvider.couponListSelect) { | ||
| 283 | + item.isCheck = false; | ||
| 284 | + } | ||
| 285 | + } | ||
| 286 | + setState(() {}); | ||
| 287 | + }, | ||
| 288 | + child: Row( | ||
| 289 | + children: [ | ||
| 290 | + Image.asset( | ||
| 291 | + Utils.getImgPath( | ||
| 292 | + all ? 'c_mul_select' : 'c_not_edit'), | ||
| 293 | + width: ScreenUtil().setWidth(40), | ||
| 294 | + ), | ||
| 295 | + HEmptyView(10), | ||
| 296 | + Text( | ||
| 297 | + '全选', | ||
| 298 | + style: TextStyle( | ||
| 299 | + fontSize: ScreenUtil().setWidth(32), | ||
| 300 | + fontWeight: FontWeight.bold, | ||
| 301 | + color: MyColours.color_000000), | ||
| 302 | + ), | ||
| 303 | + HEmptyView(20), | ||
| 304 | + ], | ||
| 305 | + )), | ||
| 306 | + Expanded( | ||
| 307 | + child: RoundButton( | ||
| 308 | + onPressed: () async { | ||
| 309 | + Map temp = { | ||
| 310 | + 'coupon': selectDataList, | ||
| 311 | + }; | ||
| 312 | + if (Navigator.canPop(context)) { | ||
| 313 | + Navigator.pop(context, temp); | ||
| 314 | + } | ||
| 315 | + }, | ||
| 316 | + text: '确定选择${selectDataList.length}个优惠券', | ||
| 317 | + fontSize: 34, | ||
| 318 | + isBold: false, | ||
| 319 | + height: ScreenUtil().setWidth(80), | ||
| 320 | + // width: double.infinity, | ||
| 321 | + radius: ScreenUtil().setWidth(10), | ||
| 322 | + )), | ||
| 323 | + ], | ||
| 324 | + )) | ||
| 325 | + : Container( | ||
| 326 | + padding: EdgeInsets.only( | ||
| 327 | + left: w(20), top: w(12), right: w(20), bottom: w(25)), | ||
| 328 | + child: RoundButton( | ||
| 268 | onPressed: () async { | 329 | onPressed: () async { |
| 269 | Map temp = { | 330 | Map temp = { |
| 270 | 'coupon': selectDataList, | 331 | 'coupon': selectDataList, |
| @@ -273,18 +334,14 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -273,18 +334,14 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 273 | Navigator.pop(context, temp); | 334 | Navigator.pop(context, temp); |
| 274 | } | 335 | } |
| 275 | }, | 336 | }, |
| 276 | - text: '确定选择${selectDataList.length}个优惠券', | 337 | + text: '确定', |
| 277 | fontSize: 34, | 338 | fontSize: 34, |
| 278 | isBold: false, | 339 | isBold: false, |
| 279 | height: ScreenUtil().setWidth(80), | 340 | height: ScreenUtil().setWidth(80), |
| 280 | - // width: double.infinity, | 341 | + width: double.infinity, |
| 281 | radius: ScreenUtil().setWidth(10), | 342 | radius: ScreenUtil().setWidth(10), |
| 282 | - )), | ||
| 283 | - ], | ||
| 284 | - )) | ||
| 285 | - : Container() | ||
| 286 | - ], | ||
| 287 | - ), | ||
| 288 | - ); | 343 | + )) |
| 344 | + ], | ||
| 345 | + )); | ||
| 289 | } | 346 | } |
| 290 | } | 347 | } |
| 1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
| 2 | 2 | ||
| 3 | +import 'package:dio/dio.dart'; | ||
| 3 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 4 | import 'package:one_key/constant/state.dart'; | 5 | import 'package:one_key/constant/state.dart'; |
| 5 | import 'package:one_key/models/recharge_list_model.dart'; | 6 | import 'package:one_key/models/recharge_list_model.dart'; |
| @@ -22,6 +23,7 @@ import '../net/base_resp.dart'; | @@ -22,6 +23,7 @@ import '../net/base_resp.dart'; | ||
| 22 | import '../net/dio_util.dart'; | 23 | import '../net/dio_util.dart'; |
| 23 | import '../net/http_url.dart'; | 24 | import '../net/http_url.dart'; |
| 24 | import '../utils/utils.dart'; | 25 | import '../utils/utils.dart'; |
| 26 | +import '../widgets/loading.dart'; | ||
| 25 | import 'choose_table_model.dart'; | 27 | import 'choose_table_model.dart'; |
| 26 | 28 | ||
| 27 | class MarketingCenterProvider extends ChangeNotifier { | 29 | class MarketingCenterProvider extends ChangeNotifier { |
| @@ -33,7 +35,7 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -33,7 +35,7 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 33 | PageState pageStateBookInfo = PageState.Loading; | 35 | PageState pageStateBookInfo = PageState.Loading; |
| 34 | PageState pageStateThemeHome = PageState.Loading; | 36 | PageState pageStateThemeHome = PageState.Loading; |
| 35 | PageState pageStateSetting = PageState.Loading; | 37 | PageState pageStateSetting = PageState.Loading; |
| 36 | - | 38 | + |
| 37 | PageState pageStateSettingMini = PageState.Loading; | 39 | PageState pageStateSettingMini = PageState.Loading; |
| 38 | List<RechargeListSunModel> rechargeList = []; | 40 | List<RechargeListSunModel> rechargeList = []; |
| 39 | 41 | ||
| @@ -60,7 +62,7 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -60,7 +62,7 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 60 | List<ColorListModel> colors = []; | 62 | List<ColorListModel> colors = []; |
| 61 | bool isThemeColor = true; //当前颜色不可用 | 63 | bool isThemeColor = true; //当前颜色不可用 |
| 62 | bool isThemeTitle = true; //当前主题不可用 | 64 | bool isThemeTitle = true; //当前主题不可用 |
| 63 | - List<TitlteTypeSunModel> titleTypeS = []; | 65 | + List<TitlteTypeSunModel> titleTypeS = []; |
| 64 | 66 | ||
| 65 | // 获取预订详情自定义图文 | 67 | // 获取预订详情自定义图文 |
| 66 | 68 | ||
| @@ -172,70 +174,31 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -172,70 +174,31 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 172 | return false; | 174 | return false; |
| 173 | } | 175 | } |
| 174 | 176 | ||
| 175 | - ///模版标题样式可选数据 | 177 | + ///模版标题样式可选数据 |
| 176 | Future<bool> getTitleTypeData(BuildContext context, | 178 | Future<bool> getTitleTypeData(BuildContext context, |
| 177 | {bool showLoading = true}) async { | 179 | {bool showLoading = true}) async { |
| 178 | // Map<String, String> params = { | 180 | // Map<String, String> params = { |
| 179 | // 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid | 181 | // 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid |
| 180 | // }; | 182 | // }; |
| 181 | - Map <String,dynamic>data = { | ||
| 182 | - "ret": 200, | ||
| 183 | - "data": [ | ||
| 184 | - { | ||
| 185 | - "id": "1", | ||
| 186 | - "url": "https://nosqn.colorcun.com/module_title_1.png" | ||
| 187 | - }, | ||
| 188 | - { | ||
| 189 | - "id": "2", | ||
| 190 | - "url": "https://nosqn.colorcun.com/module_title_2.png" | ||
| 191 | - }, | ||
| 192 | - { | ||
| 193 | - "id": "3", | ||
| 194 | - "url": "https://nosqn.colorcun.com/module_title_3.png" | ||
| 195 | - }, | ||
| 196 | - { | ||
| 197 | - "id": "4", | ||
| 198 | - "url": "https://nosqn.colorcun.com/module_title_4.png" | ||
| 199 | - }, | ||
| 200 | - { | ||
| 201 | - "id": "5", | ||
| 202 | - "url": "https://nosqn.colorcun.com/module_title_5.png" | ||
| 203 | - }, | ||
| 204 | - { | ||
| 205 | - "id": "6", | ||
| 206 | - "url": "https://nosqn.colorcun.com/module_title_6.png" | ||
| 207 | - }, | ||
| 208 | - { | ||
| 209 | - "id": "7", | ||
| 210 | - "url": "https://nosqn.colorcun.com/module_title_7.png" | ||
| 211 | - }, | ||
| 212 | - { | ||
| 213 | - "id": "8", | ||
| 214 | - "url": "https://nosqn.colorcun.com/module_title_8.png" | ||
| 215 | - }, | ||
| 216 | - { | ||
| 217 | - "id": "9", | ||
| 218 | - "url": "https://nosqn.colorcun.com/module_title_9.png" | ||
| 219 | - }, | ||
| 220 | - { | ||
| 221 | - "id": "10", | ||
| 222 | - "url": "https://nosqn.colorcun.com/module_title_10.png" | ||
| 223 | - }, | ||
| 224 | - { | ||
| 225 | - "id": "11", | ||
| 226 | - "url": "https://nosqn.colorcun.com/module_title_11.png" | ||
| 227 | - }, | ||
| 228 | - { | ||
| 229 | - "id": "12", | ||
| 230 | - "url": "https://nosqn.colorcun.com/module_title_12.png" | ||
| 231 | - }, | ||
| 232 | - { | ||
| 233 | - "id": "13", | ||
| 234 | - "url": "https://nosqn.colorcun.com/module_title_13.png" | ||
| 235 | - } | ||
| 236 | - ], | ||
| 237 | - "msg": "" | ||
| 238 | -}; | 183 | + Map<String, dynamic> data = { |
| 184 | + "ret": 200, | ||
| 185 | + "data": [ | ||
| 186 | + {"id": "1", "url": "https://nosqn.colorcun.com/module_title_1.png"}, | ||
| 187 | + {"id": "2", "url": "https://nosqn.colorcun.com/module_title_2.png"}, | ||
| 188 | + {"id": "3", "url": "https://nosqn.colorcun.com/module_title_3.png"}, | ||
| 189 | + {"id": "4", "url": "https://nosqn.colorcun.com/module_title_4.png"}, | ||
| 190 | + {"id": "5", "url": "https://nosqn.colorcun.com/module_title_5.png"}, | ||
| 191 | + {"id": "6", "url": "https://nosqn.colorcun.com/module_title_6.png"}, | ||
| 192 | + {"id": "7", "url": "https://nosqn.colorcun.com/module_title_7.png"}, | ||
| 193 | + {"id": "8", "url": "https://nosqn.colorcun.com/module_title_8.png"}, | ||
| 194 | + {"id": "9", "url": "https://nosqn.colorcun.com/module_title_9.png"}, | ||
| 195 | + {"id": "10", "url": "https://nosqn.colorcun.com/module_title_10.png"}, | ||
| 196 | + {"id": "11", "url": "https://nosqn.colorcun.com/module_title_11.png"}, | ||
| 197 | + {"id": "12", "url": "https://nosqn.colorcun.com/module_title_12.png"}, | ||
| 198 | + {"id": "13", "url": "https://nosqn.colorcun.com/module_title_13.png"} | ||
| 199 | + ], | ||
| 200 | + "msg": "" | ||
| 201 | + }; | ||
| 239 | titleTypeS = TitlteTypeModel.fromJson(data).data; | 202 | titleTypeS = TitlteTypeModel.fromJson(data).data; |
| 240 | // BaseResp<dynamic> baseResp = await DioUtil() | 203 | // BaseResp<dynamic> baseResp = await DioUtil() |
| 241 | // .request<dynamic>(context, Method.post, HttpUrl.get_colors_data, | 204 | // .request<dynamic>(context, Method.post, HttpUrl.get_colors_data, |
| @@ -346,13 +309,13 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -346,13 +309,13 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 346 | 309 | ||
| 347 | // 获取商家订座配置 | 310 | // 获取商家订座配置 |
| 348 | Future<bool> getDzSellerConf(BuildContext context, | 311 | Future<bool> getDzSellerConf(BuildContext context, |
| 349 | - {bool showLoading = true,bool selfDismiss = false}) async { | 312 | + {bool showLoading = true, bool selfDismiss = false}) async { |
| 350 | Map<String, String> params = { | 313 | Map<String, String> params = { |
| 351 | 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid | 314 | 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid |
| 352 | }; | 315 | }; |
| 353 | BaseResp<dynamic> baseResp = await DioUtil() | 316 | BaseResp<dynamic> baseResp = await DioUtil() |
| 354 | .request<dynamic>(context, Method.post, HttpUrl.get_dz_seller_conf, | 317 | .request<dynamic>(context, Method.post, HttpUrl.get_dz_seller_conf, |
| 355 | - data: params, showLoading: showLoading,selfDismiss: selfDismiss) | 318 | + data: params, showLoading: showLoading, selfDismiss: selfDismiss) |
| 356 | .catchError((error) { | 319 | .catchError((error) { |
| 357 | print(error.toString()); | 320 | print(error.toString()); |
| 358 | Utils.showToast('请求失败,请重试'); | 321 | Utils.showToast('请求失败,请重试'); |
| @@ -411,24 +374,31 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -411,24 +374,31 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 411 | Future<bool> setSellerTemplateConf( | 374 | Future<bool> setSellerTemplateConf( |
| 412 | BuildContext context, Map<String, String> params, | 375 | BuildContext context, Map<String, String> params, |
| 413 | {bool showLoading = true}) async { | 376 | {bool showLoading = true}) async { |
| 414 | - BaseResp<dynamic> baseResp = await DioUtil() | ||
| 415 | - .request<dynamic>( | ||
| 416 | - context, Method.post, HttpUrl.set_seller_template_conf, | ||
| 417 | - data: params, showLoading: showLoading) | ||
| 418 | - .catchError((error) { | ||
| 419 | - print(error.toString()); | ||
| 420 | - Utils.showToast('商家设置预订安排模板页面失败,请重试'); | ||
| 421 | - return false; | ||
| 422 | - }); | ||
| 423 | - if (baseResp.code == Constant.status_success) { | ||
| 424 | - if (baseResp.data == 0 || baseResp.data == 1) { | 377 | + Loading.showLoading(context); |
| 378 | + FormData formData = FormData.fromMap(params); | ||
| 379 | + Response response = await DioUtil.getInstance().getDio().post( | ||
| 380 | + '${HttpUrl.server_address}${HttpUrl.set_seller_template_conf}', | ||
| 381 | + data: formData); | ||
| 382 | + Loading.hideLoading(context); | ||
| 383 | + // BaseResp<dynamic> baseResp = await DioUtil() | ||
| 384 | + // .request<dynamic>( | ||
| 385 | + // context, Method.post, HttpUrl.set_seller_template_conf, | ||
| 386 | + // data: params, showLoading: showLoading) | ||
| 387 | + // .catchError((error) { | ||
| 388 | + // print(error.toString()); | ||
| 389 | + // Utils.showToast('商家设置预订安排模板页面失败,请重试'); | ||
| 390 | + // return false; | ||
| 391 | + // }); | ||
| 392 | + if (response.data['ret'] == 200) { | ||
| 393 | + if (response.data['data'] == 0 || response.data['data'] == 1) { | ||
| 425 | return true; | 394 | return true; |
| 426 | } else { | 395 | } else { |
| 427 | Utils.showToast('商家设置预订安排模板页面失败,请重试'); | 396 | Utils.showToast('商家设置预订安排模板页面失败,请重试'); |
| 428 | } | 397 | } |
| 429 | } else { | 398 | } else { |
| 430 | - Utils.showToast(baseResp.msg ?? '商家设置预订安排模板页面失败,请重试'); | 399 | + Utils.showToast('商家设置预订安排模板页面失败,请重试'); |
| 431 | } | 400 | } |
| 401 | + | ||
| 432 | return false; | 402 | return false; |
| 433 | } | 403 | } |
| 434 | 404 | ||
| @@ -456,7 +426,7 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -456,7 +426,7 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 456 | return false; | 426 | return false; |
| 457 | } | 427 | } |
| 458 | 428 | ||
| 459 | - // 设置订座商家配置信息 | 429 | + // 设置订座商家配置信息 |
| 460 | Future<bool> setConfings(BuildContext context, Map<String, String> params, | 430 | Future<bool> setConfings(BuildContext context, Map<String, String> params, |
| 461 | {bool showLoading = true, bool needToast = true}) async { | 431 | {bool showLoading = true, bool needToast = true}) async { |
| 462 | BaseResp<dynamic> baseResp = await DioUtil() | 432 | BaseResp<dynamic> baseResp = await DioUtil() |
| @@ -206,7 +206,7 @@ class PlanDishProvider extends ChangeNotifier { | @@ -206,7 +206,7 @@ class PlanDishProvider extends ChangeNotifier { | ||
| 206 | Loading.showLoading(context); | 206 | Loading.showLoading(context); |
| 207 | FormData formData = FormData.fromMap(params); | 207 | FormData formData = FormData.fromMap(params); |
| 208 | Response response = await DioUtil.getInstance().getDio().post( | 208 | Response response = await DioUtil.getInstance().getDio().post( |
| 209 | - 'http://xt04.colorcun.com/${HttpUrl.set_plan_cook}', | 209 | + '${HttpUrl.server_address}${HttpUrl.set_plan_cook}', |
| 210 | data: formData); | 210 | data: formData); |
| 211 | Loading.hideLoading(context); | 211 | Loading.hideLoading(context); |
| 212 | 212 | ||
| @@ -242,7 +242,7 @@ class PlanDishProvider extends ChangeNotifier { | @@ -242,7 +242,7 @@ class PlanDishProvider extends ChangeNotifier { | ||
| 242 | Loading.showLoading(context); | 242 | Loading.showLoading(context); |
| 243 | FormData formData = FormData.fromMap(params); | 243 | FormData formData = FormData.fromMap(params); |
| 244 | Response response = await DioUtil.getInstance().getDio().post( | 244 | Response response = await DioUtil.getInstance().getDio().post( |
| 245 | - 'http://xt04.colorcun.com/${HttpUrl.set_plan_cook_by_reserve}', | 245 | + '${HttpUrl.server_address}${HttpUrl.set_plan_cook_by_reserve}', |
| 246 | data: formData); | 246 | data: formData); |
| 247 | Loading.hideLoading(context); | 247 | Loading.hideLoading(context); |
| 248 | 248 |
-
Please register or login to post a comment