Commit 7de21c524d9fd76bc4e7ea178bddb7af6bcad1e4

Authored by wdn127929
1 parent a0fd2265

核销记录

  1 +import 'dart:convert';
  2 +
  3 +import 'package:common_utils/common_utils.dart';
  4 +import 'package:one_key/models/coupon_model.dart';
  5 +
  6 +class IsExamineModel {
  7 + int ret;
  8 + List<IsExamineSunModel> data;
  9 + String msg;
  10 +
  11 + IsExamineModel({this.ret, this.data, this.msg});
  12 +
  13 + IsExamineModel.fromJson(Map<String, dynamic> json) {
  14 + ret = json['ret'];
  15 + if (json['data'] != null) {
  16 + data = [];
  17 + json['data'].forEach((v) {
  18 + data.add(new IsExamineSunModel.fromJson(v));
  19 + });
  20 + }
  21 + msg = json['msg'];
  22 + }
  23 +
  24 + Map<String, dynamic> toJson() {
  25 + final Map<String, dynamic> data = new Map<String, dynamic>();
  26 + data['ret'] = this.ret;
  27 + if (this.data != null) {
  28 + data['data'] = this.data.map((v) => v.toJson()).toList();
  29 + }
  30 + data['msg'] = this.msg;
  31 + return data;
  32 + }
  33 +}
  34 +
  35 +class IsExamineSunModel {
  36 + String id;
  37 + String status;
  38 + String rechargeId;
  39 + String rechargeName;
  40 + String price;
  41 + String sellerid;
  42 + String sellername;
  43 + String openid;
  44 + String orderNo;
  45 + String combineOutTradeNo;
  46 + String outTradeNo;
  47 + dynamic outRefundNo;
  48 + ExpDate expDate;
  49 + String stime;
  50 + String etime;
  51 + String transactionId;
  52 + dynamic refundId;
  53 + dynamic reOutTradeNo;
  54 + String tradeState;
  55 + dynamic tradeStateDesc;
  56 + String qrcode;
  57 + String isExamine;
  58 + dynamic examineName;
  59 + dynamic examineTime;
  60 + String isComment;
  61 + String type;
  62 + String cdate;
  63 + String desc;
  64 + String explain;
  65 +
  66 + String get examineTimeStr {
  67 + if (examineTime == null) {
  68 + return '';
  69 + }
  70 + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
  71 + int.parse(examineTime.toString()) * 1000);
  72 + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
  73 + }
  74 +
  75 + IsExamineSunModel(
  76 + {this.id,
  77 + this.status,
  78 + this.rechargeId,
  79 + this.rechargeName,
  80 + this.price,
  81 + this.sellerid,
  82 + this.sellername,
  83 + this.openid,
  84 + this.orderNo,
  85 + this.combineOutTradeNo,
  86 + this.outTradeNo,
  87 + this.outRefundNo,
  88 + this.expDate,
  89 + this.stime,
  90 + this.etime,
  91 + this.transactionId,
  92 + this.refundId,
  93 + this.reOutTradeNo,
  94 + this.tradeState,
  95 + this.tradeStateDesc,
  96 + this.qrcode,
  97 + this.isExamine,
  98 + this.examineName,
  99 + this.examineTime,
  100 + this.isComment,
  101 + this.type,
  102 + this.cdate,
  103 + this.desc,
  104 + this.explain});
  105 +
  106 + IsExamineSunModel.fromJson(Map<String, dynamic> json) {
  107 + id = json['id'];
  108 + status = json['status'];
  109 + rechargeId = json['recharge_id'];
  110 + rechargeName = json['recharge_name'];
  111 + price = json['price'];
  112 + sellerid = json['sellerid'];
  113 + sellername = json['sellername'];
  114 + openid = json['openid'];
  115 + orderNo = json['order_no'];
  116 + combineOutTradeNo = json['combine_out_trade_no'];
  117 + outTradeNo = json['out_trade_no'];
  118 + outRefundNo = json['out_refund_no'];
  119 +
  120 + expDate = json['exp_date'] == null
  121 + ? null
  122 + : (json['exp_date'] is String)
  123 + ? ExpDate.fromJson(jsonDecode(json['exp_date']))
  124 + : (json['exp_date'] is Map)
  125 + ? ExpDate.fromJson(json['exp_date'])
  126 + : null;
  127 + stime = json['stime'];
  128 + etime = json['etime'];
  129 + transactionId = json['transaction_id'];
  130 + refundId = json['refund_id'];
  131 + reOutTradeNo = json['re_out_trade_no'];
  132 + tradeState = json['trade_state'];
  133 + tradeStateDesc = json['trade_state_desc'];
  134 + qrcode = json['qrcode'];
  135 + isExamine = json['is_examine'];
  136 + examineName = json['examine_name'];
  137 + examineTime = json['examine_time'];
  138 + isComment = json['is_comment'];
  139 + type = json['type'];
  140 + cdate = json['cdate'];
  141 + desc = json['desc'];
  142 + explain = json['explain'];
  143 + }
  144 +
  145 + Map<String, dynamic> toJson() {
  146 + final Map<String, dynamic> data = new Map<String, dynamic>();
  147 + data['id'] = this.id;
  148 + data['status'] = this.status;
  149 + data['recharge_id'] = this.rechargeId;
  150 + data['recharge_name'] = this.rechargeName;
  151 + data['price'] = this.price;
  152 + data['sellerid'] = this.sellerid;
  153 + data['sellername'] = this.sellername;
  154 + data['openid'] = this.openid;
  155 + data['order_no'] = this.orderNo;
  156 + data['combine_out_trade_no'] = this.combineOutTradeNo;
  157 + data['out_trade_no'] = this.outTradeNo;
  158 + data['out_refund_no'] = this.outRefundNo;
  159 + data['exp_date'] = this.expDate;
  160 + data['stime'] = this.stime;
  161 + data['etime'] = this.etime;
  162 + data['transaction_id'] = this.transactionId;
  163 + data['refund_id'] = this.refundId;
  164 + data['re_out_trade_no'] = this.reOutTradeNo;
  165 + data['trade_state'] = this.tradeState;
  166 + data['trade_state_desc'] = this.tradeStateDesc;
  167 + data['qrcode'] = this.qrcode;
  168 + data['is_examine'] = this.isExamine;
  169 + data['examine_name'] = this.examineName;
  170 + data['examine_time'] = this.examineTime;
  171 + data['is_comment'] = this.isComment;
  172 + data['type'] = this.type;
  173 + data['cdate'] = this.cdate;
  174 + data['desc'] = this.desc;
  175 + data['explain'] = this.explain;
  176 + return data;
  177 + }
  178 +}
@@ -91,6 +91,10 @@ class CouponSunModel extends Object { @@ -91,6 +91,10 @@ class CouponSunModel extends Object {
91 @JsonKey(name: 'nick_name') 91 @JsonKey(name: 'nick_name')
92 String nickNameShow; 92 String nickNameShow;
93 93
  94 + @JsonKey(name: 'grant_num')
  95 + String grantNum;
  96 +
  97 +
94 bool isCheck = false; 98 bool isCheck = false;
95 bool showText = false; 99 bool showText = false;
96 100
@@ -115,7 +119,7 @@ class CouponSunModel extends Object { @@ -115,7 +119,7 @@ class CouponSunModel extends Object {
115 this.price, 119 this.price,
116 this.use, 120 this.use,
117 this.expDate, 121 this.expDate,
118 - this.nickNameShow); 122 + this.nickNameShow,this.grantNum);
119 123
120 factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) => 124 factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) =>
121 _$CouponSunModelFromJson(srcJson); 125 _$CouponSunModelFromJson(srcJson);
@@ -59,6 +59,7 @@ CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) { @@ -59,6 +59,7 @@ CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) {
59 ? ExpDate.fromJson(json['exp_date']) 59 ? ExpDate.fromJson(json['exp_date'])
60 : null, 60 : null,
61 json['nick_name'] as String, 61 json['nick_name'] as String,
  62 + json['grant_num'] as String,
62 ); 63 );
63 } 64 }
64 65
@@ -84,7 +85,8 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) => @@ -84,7 +85,8 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) =>
84 'price': instance.price, 85 'price': instance.price,
85 'use': instance.use, 86 'use': instance.use,
86 'exp_date': instance.expDate, 87 'exp_date': instance.expDate,
87 - 'nick_name':instance.nickNameShow 88 + 'nick_name': instance.nickNameShow,
  89 + 'grant_num': instance.grantNum
88 }; 90 };
89 91
90 CouponUse _$CouponUseFromJson(Map<String, dynamic> json) { 92 CouponUse _$CouponUseFromJson(Map<String, dynamic> json) {
@@ -433,4 +433,7 @@ class HttpUrl { @@ -433,4 +433,7 @@ class HttpUrl {
433 static const String get_dz_seller_conf = 433 static const String get_dz_seller_conf =
434 "?service=App.Seller.GetDzSellerConf"; // 获取商家订座配置 434 "?service=App.Seller.GetDzSellerConf"; // 获取商家订座配置
435 435
  436 + static const String get_is_examine_list =
  437 + "?service=App.Activity.GetIsExamineList"; // 商家券核销列表
  438 +
436 } 439 }
@@ -227,7 +227,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -227,7 +227,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
227 couponProvider.couponSunModel.status == '1') { 227 couponProvider.couponSunModel.status == '1') {
228 //店铺可核销券 228 //店铺可核销券
229 Utils.goShareBuyCouponToWeChat( 229 Utils.goShareBuyCouponToWeChat(
230 - context, widget.idstr, couponProvider.couponSunModel.use,couponProvider.couponSunModel); 230 + context,
  231 + widget.idstr,
  232 + couponProvider.couponSunModel.use,
  233 + couponProvider.couponSunModel);
231 } 234 }
232 }, 235 },
233 ), 236 ),
@@ -431,6 +434,15 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -431,6 +434,15 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
431 '谁可以发放', 434 '谁可以发放',
432 couponProvider 435 couponProvider
433 .couponSunModel.nickNameShow), 436 .couponSunModel.nickNameShow),
  437 + Container(
  438 + height: ScreenUtil().setWidth(2),
  439 + color: MyColours.color_E7E7E7,
  440 + ),
  441 + VEmptyView(24),
  442 + _item(
  443 + '发放总量限制',
  444 + couponProvider
  445 + .couponSunModel.grantNum??''),
434 // _select( 446 // _select(
435 // '谁可以发放', 447 // '谁可以发放',
436 // '查看', 448 // '查看',
@@ -39,6 +39,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -39,6 +39,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
39 TextEditingController _couponNameEditControl = TextEditingController(); 39 TextEditingController _couponNameEditControl = TextEditingController();
40 TextEditingController _couponRequireEditControl = TextEditingController(); 40 TextEditingController _couponRequireEditControl = TextEditingController();
41 TextEditingController _couponExplainEditControl = TextEditingController(); 41 TextEditingController _couponExplainEditControl = TextEditingController();
  42 + TextEditingController _limitNumControl = TextEditingController();
  43 + FocusNode _limitNumFocusNode = FocusNode();
42 final heightCell = ScreenUtil().setWidth(48 * 2); 44 final heightCell = ScreenUtil().setWidth(48 * 2);
43 bool swichState = true; //默认启用 开关状态 45 bool swichState = true; //默认启用 开关状态
44 final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); 46 final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
@@ -239,6 +241,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -239,6 +241,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
239 'week_data': weekData 241 'week_data': weekData
240 }; 242 };
241 params['exp_date'] = jsonEncode(expDate); 243 params['exp_date'] = jsonEncode(expDate);
  244 +
  245 + if (_limitNumControl.text.trim().length == 0) {
  246 + params['grant_num'] = '1000';
  247 + } else {
  248 + params['grant_num'] = _limitNumControl.text;
  249 + }
242 } 250 }
243 bool isSuccess = 251 bool isSuccess =
244 await couponProvider.createCustomerActivity(context, params); 252 await couponProvider.createCustomerActivity(context, params);
@@ -271,8 +279,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -271,8 +279,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
271 ), 279 ),
272 ), 280 ),
273 HEmptyView(80), 281 HEmptyView(80),
274 - Container(  
275 - width: ScreenUtil().setWidth(231 * 2), 282 + Expanded(
  283 + // width: ScreenUtil().setWidth(231 * 2),
276 child: TextField( 284 child: TextField(
277 controller: controller, 285 controller: controller,
278 textAlign: TextAlign.right, 286 textAlign: TextAlign.right,
@@ -999,6 +1007,18 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -999,6 +1007,18 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
999 color: MyColours.color_E7E7E7, 1007 color: MyColours.color_E7E7E7,
1000 ), 1008 ),
1001 widget.isMine ? SizedBox() : VEmptyView(24), 1009 widget.isMine ? SizedBox() : VEmptyView(24),
  1010 + widget.isMine
  1011 + ? SizedBox()
  1012 + : _textfield('发放总量限制', '点击输入总数量限制',
  1013 + _limitNumControl, _limitNumFocusNode,
  1014 + textInputType: TextInputType.number),
  1015 + widget.isMine
  1016 + ? SizedBox()
  1017 + : Container(
  1018 + height: ScreenUtil().setWidth(2),
  1019 + color: MyColours.color_E7E7E7,
  1020 + ),
  1021 + widget.isMine ? SizedBox() : VEmptyView(24),
1002 _explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'), 1022 _explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'),
1003 VEmptyView(20), 1023 VEmptyView(20),
1004 _canUse('立即启用', swichState, () { 1024 _canUse('立即启用', swichState, () {
@@ -1039,6 +1059,14 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1039,6 +1059,14 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1039 Utils.showToast('请设置发放人!'); 1059 Utils.showToast('请设置发放人!');
1040 return; 1060 return;
1041 } 1061 }
  1062 +
  1063 + bool isNumber = Utils.isInteger(
  1064 + _limitNumControl.text.trim()); //判断输入的内容是否是数字
  1065 + if (!isNumber) {
  1066 + Utils.showToast('发放总量限制请输入数字');
  1067 + _limitNumControl.text = '';
  1068 + return;
  1069 + }
1042 } 1070 }
1043 if (_couponRequireEditControl.text.trim().length == 0) { 1071 if (_couponRequireEditControl.text.trim().length == 0) {
1044 Utils.showToast('请填写券要求'); 1072 Utils.showToast('请填写券要求');
@@ -30,8 +30,6 @@ class CouponHasVerificationPage extends StatefulWidget { @@ -30,8 +30,6 @@ class CouponHasVerificationPage extends StatefulWidget {
30 class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> { 30 class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
31 CouponProvider couponProvider; 31 CouponProvider couponProvider;
32 EasyRefreshController _controller = EasyRefreshController(); 32 EasyRefreshController _controller = EasyRefreshController();
33 - PersonnelProvider personnelProvider;  
34 - List<PersonnelManageSunModel> authUserLists = [];  
35 33
36 @override 34 @override
37 void initState() { 35 void initState() {
@@ -39,12 +37,12 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> { @@ -39,12 +37,12 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
39 super.initState(); 37 super.initState();
40 38
41 WidgetsBinding.instance.addPostFrameCallback((_) { 39 WidgetsBinding.instance.addPostFrameCallback((_) {
42 - couponProvider.pageStateVerification = PageState.Success; 40 + couponProvider.pageStateVerification = PageState.Loading;
43 couponProvider.notifyListeners(); 41 couponProvider.notifyListeners();
44 - // _couponNetworkData(widget.index, isShowLoading: false); 42 + _getIsExamineList();
45 43
46 bus.on("refresh_coupon_verification_list", (arg) { 44 bus.on("refresh_coupon_verification_list", (arg) {
47 - // _couponNetworkData(widget.index); 45 + _getIsExamineList();
48 }); 46 });
49 }); 47 });
50 } 48 }
@@ -56,40 +54,19 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> { @@ -56,40 +54,19 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
56 } 54 }
57 55
58 ///获取优惠券列表数据 56 ///获取优惠券列表数据
59 - _couponNetworkData(int index, {bool isShowLoading = true}) async {  
60 - Map<String, String> params = {  
61 - "uid": Provider.of<UserModel>(context, listen: false).user.openid,  
62 - // 'is_time': '0'  
63 - "is_type": index.toString()  
64 - };  
65 - await couponProvider.getCustomerActivity(context, params, index,  
66 - isShowLoading: isShowLoading);  
67 - }  
68 57
69 ///修改活动信息 58 ///修改活动信息
70 - _setCustomerActivity(int index) async { 59 + _getIsExamineList() async {
71 Map<String, String> params = { 60 Map<String, String> params = {
72 - "id": couponProvider.couponList[index].id,  
73 - "status": couponProvider.couponList[index].isOpenBool ? '1' : '0',  
74 - 'is_open': couponProvider.couponList[index].isOpenBool ? '1' : '0', 61 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid
75 }; 62 };
76 - bool isSuccess = await couponProvider.setCustomerActivity(context, params, 63 + await couponProvider.getIsExamineList(context, params,
77 isShowLoading: false); 64 isShowLoading: false);
78 - print(isSuccess);  
79 - // _couponNetworkData(widget.index, isShowLoading: false);  
80 - // if (isSuccess) {  
81 - // couponProvider.notifyListeners();  
82 - // } else {  
83 - // couponProvider.couponList[index].isOpenBool =  
84 - // !couponProvider.couponList[index].isOpenBool;  
85 - // couponProvider.notifyListeners();  
86 - // }  
87 } 65 }
88 66
89 @override 67 @override
90 Widget build(BuildContext context) { 68 Widget build(BuildContext context) {
91 couponProvider = Provider.of<CouponProvider>(context, listen: true); 69 couponProvider = Provider.of<CouponProvider>(context, listen: true);
92 - personnelProvider = Provider.of<PersonnelProvider>(context, listen: true);  
93 70
94 return Container( 71 return Container(
95 color: MyColours.color_f3f3f3, 72 color: MyColours.color_f3f3f3,
@@ -107,7 +84,7 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> { @@ -107,7 +84,7 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
107 // // _couponNetworkData(widget.index); 84 // // _couponNetworkData(widget.index);
108 // } 85 // }
109 }, 86 },
110 - emptyMsg: "暂时没有列表信息哦,", 87 + emptyMsg: "暂时没有列表信息哦",
111 emptyImg: "empty_search", 88 emptyImg: "empty_search",
112 showMsg: "加载中,请稍后...", 89 showMsg: "加载中,请稍后...",
113 ); 90 );
@@ -121,7 +98,7 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> { @@ -121,7 +98,7 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
121 (BuildContext context, int index) { 98 (BuildContext context, int index) {
122 return CouponVerificationItemF( 99 return CouponVerificationItemF(
123 // from: 'quan', 100 // from: 'quan',
124 - // couponSonModel: couponProvider.couponList[index], 101 + isExamineSunModel: couponProvider.isExamineList[index],
125 // showBtn: true, 102 // showBtn: true,
126 // onPressedSwich: () { 103 // onPressedSwich: () {
127 // couponProvider.couponList[index].isOpenBool = 104 // couponProvider.couponList[index].isOpenBool =
@@ -129,12 +106,13 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> { @@ -129,12 +106,13 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
129 // _setCustomerActivity(index); 106 // _setCustomerActivity(index);
130 // }, 107 // },
131 onPressed: () { 108 onPressed: () {
132 - NavigatorUtil.goCouponVerificationDetailPage(  
133 - context, couponProvider.couponList[index],  
134 - idStr: couponProvider.couponList[index].id); 109 + NavigatorUtil.goCouponVerificationDetailPage(context,
  110 + couponProvider.isExamineList[index],
  111 + idStr:
  112 + couponProvider.isExamineList[index].rechargeId);
135 }, 113 },
136 ); 114 );
137 - }, childCount: couponProvider.couponList.length), 115 + }, childCount: couponProvider.isExamineList.length),
138 ), 116 ),
139 // SliverList( 117 // SliverList(
140 // delegate: SliverChildBuilderDelegate( 118 // delegate: SliverChildBuilderDelegate(
@@ -204,9 +204,9 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { @@ -204,9 +204,9 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
204 Tab( 204 Tab(
205 text: "我的优惠券", 205 text: "我的优惠券",
206 ), 206 ),
207 - // Tab(  
208 - // text: "核销记录",  
209 - // ) 207 + Tab(
  208 + text: "核销记录",
  209 + )
210 ], 210 ],
211 indicatorColor: MyColours.color_438E93, 211 indicatorColor: MyColours.color_438E93,
212 indicatorSize: TabBarIndicatorSize.label, 212 indicatorSize: TabBarIndicatorSize.label,
@@ -236,9 +236,9 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { @@ -236,9 +236,9 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
236 ChangeNotifierProvider<PersonnelProvider>( 236 ChangeNotifierProvider<PersonnelProvider>(
237 create: (_) => PersonnelProvider(), 237 create: (_) => PersonnelProvider(),
238 child: CouponSunPage(index: 2)), 238 child: CouponSunPage(index: 2)),
239 - // ChangeNotifierProvider<PersonnelProvider>(  
240 - // create: (_) => PersonnelProvider(),  
241 - // child: CouponHasVerificationPage()), 239 + ChangeNotifierProvider<PersonnelProvider>(
  240 + create: (_) => PersonnelProvider(),
  241 + child: CouponHasVerificationPage()),
242 ], 242 ],
243 ), 243 ),
244 ), 244 ),
@@ -18,6 +18,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; @@ -18,6 +18,7 @@ import 'package:one_key/widgets/system_app_bar.dart';
18 import 'package:one_key/widgets/v_empty_view.dart'; 18 import 'package:one_key/widgets/v_empty_view.dart';
19 import 'package:provider/provider.dart'; 19 import 'package:provider/provider.dart';
20 20
  21 +import '../../models/IsExamineModel.dart';
21 import '../../utils/screen_util.dart'; 22 import '../../utils/screen_util.dart';
22 import '../../widgets/page_exception.dart'; 23 import '../../widgets/page_exception.dart';
23 24
@@ -26,10 +27,12 @@ import '../../widgets/page_exception.dart'; @@ -26,10 +27,12 @@ import '../../widgets/page_exception.dart';
26 */ 27 */
27 28
28 class CouponVerificationDetailPage extends StatefulWidget { 29 class CouponVerificationDetailPage extends StatefulWidget {
29 - final CouponSunModel couponSunModel;  
30 - final String idstr;  
31 - CouponVerificationDetailPage({Key key, this.couponSunModel, this.idstr})  
32 - : super(key: key); 30 + final IsExamineSunModel isExamineSunModel;
  31 +
  32 + CouponVerificationDetailPage({
  33 + Key key,
  34 + this.isExamineSunModel,
  35 + }) : super(key: key);
33 36
34 @override 37 @override
35 _CouponVerificationDetailPageState createState() => 38 _CouponVerificationDetailPageState createState() =>
@@ -49,27 +52,15 @@ class _CouponVerificationDetailPageState @@ -49,27 +52,15 @@ class _CouponVerificationDetailPageState
49 52
50 WidgetsBinding.instance.addPostFrameCallback((_) { 53 WidgetsBinding.instance.addPostFrameCallback((_) {
51 // if (widget.idstr != null && widget.idstr != 'null') { 54 // if (widget.idstr != null && widget.idstr != 'null') {
52 - _getActivityById(); 55 + // _getActivityById();
53 // } else { 56 // } else {
54 - // couponProvider.couponSunModel = widget.couponSunModel;  
55 - // pageState = PageState.Success;  
56 - // setState(() {}); 57 + // ;
  58 + // pageState = PageState.Success;
  59 + // setState(() {});
57 // } 60 // }
58 }); 61 });
59 } 62 }
60 63
61 - _getActivityById() async {  
62 - pageState = PageState.Loading;  
63 - bool success = await couponProvider  
64 - .getActivityById(context, {'id': widget.idstr}, isShowLoading: false);  
65 - if (success) {  
66 - pageState = PageState.Success;  
67 - } else {  
68 - pageState = PageState.ConnectivityError;  
69 - }  
70 - setState(() {});  
71 - }  
72 -  
73 ///时间选择 64 ///时间选择
74 Widget _select(String title, String hintText, GestureTapCallback onTap) { 65 Widget _select(String title, String hintText, GestureTapCallback onTap) {
75 return InkWell( 66 return InkWell(
@@ -216,277 +207,215 @@ class _CouponVerificationDetailPageState @@ -216,277 +207,215 @@ class _CouponVerificationDetailPageState
216 onTap: () { 207 onTap: () {
217 Navigator.pop(context); 208 Navigator.pop(context);
218 }, 209 },
219 - rightImgName: couponProvider.couponSunModel.isType == '1' &&  
220 - couponProvider.couponSunModel.isExamine == '1' &&  
221 - couponProvider.couponSunModel.status == '1'  
222 - ? 'share.png'  
223 - : null,  
224 - onTapRight: () {  
225 - if (couponProvider.couponSunModel.isType == '1' &&  
226 - couponProvider.couponSunModel.isExamine == '1' &&  
227 - couponProvider.couponSunModel.status == '1') {  
228 - //店铺可核销券  
229 - Utils.goShareBuyCouponToWeChat(  
230 - context,  
231 - widget.idstr,  
232 - couponProvider.couponSunModel.use,  
233 - couponProvider.couponSunModel);  
234 - }  
235 - },  
236 ), 210 ),
237 - body: Consumer<CouponProvider>(builder: (context, model, _) {  
238 - if (pageState != PageState.Success) {  
239 - return ExceptionPage(  
240 - pageState: pageState,  
241 - callback: () {  
242 - _getActivityById();  
243 - },  
244 - emptyMsg: "暂时没有数据哦,",  
245 - emptyImg: "empty_search",  
246 - showMsg: "加载中,请稍后...",  
247 - );  
248 - } else {  
249 - return Column(children: [  
250 - Expanded(  
251 - child: SingleChildScrollView(  
252 - controller: controller,  
253 - physics: BouncingScrollPhysics(),  
254 - child: Padding(  
255 - padding: EdgeInsets.symmetric(  
256 - horizontal: ScreenUtil().setWidth(32)),  
257 - child: Column(  
258 - children: [  
259 - VEmptyView(56),  
260 - _item(  
261 - '券类型',  
262 - couponProvider.couponSunModel.isType == '1'  
263 - ? '店铺优惠券'  
264 - : '我的优惠券'),  
265 - Container(  
266 - height: ScreenUtil().setWidth(2),  
267 - color: MyColours.color_E7E7E7,  
268 - ),  
269 - VEmptyView(24),  
270 - _item('券编码', 'NO.01774420230223150306'),  
271 - Container(  
272 - height: ScreenUtil().setWidth(2),  
273 - color: MyColours.color_E7E7E7,  
274 - ),  
275 - VEmptyView(24),  
276 - _item('券名称', couponProvider.couponSunModel.aname),  
277 - Container(  
278 - height: ScreenUtil().setWidth(2),  
279 - color: MyColours.color_E7E7E7,  
280 - ), 211 + body:
  212 + // Consumer<CouponProvider>(builder: (context, model, _) {
  213 + // if (pageState != PageState.Success) {
  214 + // return ExceptionPage(
  215 + // pageState: pageState,
  216 + // callback: () {
  217 + // // _getActivityById();
  218 + // },
  219 + // emptyMsg: "暂时没有数据哦,",
  220 + // emptyImg: "empty_search",
  221 + // showMsg: "加载中,请稍后...",
  222 + // );
  223 + // } else {
  224 + // return
  225 + Column(children: [
  226 + Expanded(
  227 + child: SingleChildScrollView(
  228 + controller: controller,
  229 + physics: BouncingScrollPhysics(),
  230 + child: Padding(
  231 + padding: EdgeInsets.symmetric(
  232 + horizontal: ScreenUtil().setWidth(32)),
  233 + child: Column(
  234 + children: [
  235 + VEmptyView(56),
  236 + _item(
  237 + '券类型',
  238 + widget.isExamineSunModel.type == '1'
  239 + ? '店铺优惠券'
  240 + : '我的优惠券'),
  241 + Container(
  242 + height: ScreenUtil().setWidth(2),
  243 + color: MyColours.color_E7E7E7,
  244 + ),
  245 + VEmptyView(24),
  246 + _item('券编码', widget.isExamineSunModel.orderNo ?? ''),
  247 + Container(
  248 + height: ScreenUtil().setWidth(2),
  249 + color: MyColours.color_E7E7E7,
  250 + ),
  251 + VEmptyView(24),
  252 + _item(
  253 + '券名称', widget.isExamineSunModel.rechargeName ?? ""),
  254 + Container(
  255 + height: ScreenUtil().setWidth(2),
  256 + color: MyColours.color_E7E7E7,
  257 + ),
281 258
282 - VEmptyView(24),  
283 - if (couponProvider.couponSunModel.use != null)  
284 - Column(  
285 - crossAxisAlignment: CrossAxisAlignment.start,  
286 - children: [  
287 - // _item(  
288 - // '券用途',  
289 - // couponProvider.couponSunModel.use.isCash  
290 - // ? '代金券'  
291 - // : couponProvider  
292 - // .couponSunModel.use.isDiscount  
293 - // ? '折扣券'  
294 - // : couponProvider  
295 - // .couponSunModel.use.isDish  
296 - // ? '菜品券'  
297 - // : ''),  
298 - // Container(  
299 - // height: ScreenUtil().setWidth(2),  
300 - // color: MyColours.color_E7E7E7,  
301 - // ),  
302 - // VEmptyView(24),  
303 - // _item(  
304 - // couponProvider.couponSunModel.use.isCash  
305 - // ? '金额'  
306 - // : couponProvider  
307 - // .couponSunModel.use.isDiscount  
308 - // ? '折扣率'  
309 - // : couponProvider  
310 - // .couponSunModel.use.isDish  
311 - // ? '菜品'  
312 - // : '',  
313 - // couponProvider.couponSunModel.use.isCash  
314 - // ? '${couponProvider.couponSunModel.use.cash}元'  
315 - // : couponProvider  
316 - // .couponSunModel.use.isDiscount  
317 - // ? '${couponProvider.couponSunModel.use.discount}折'  
318 - // : couponProvider  
319 - // .couponSunModel.use.isDish  
320 - // ? couponProvider  
321 - // .couponSunModel.use.dish  
322 - // : ''),  
323 - // Container(  
324 - // height: ScreenUtil().setWidth(2),  
325 - // color: MyColours.color_E7E7E7,  
326 - // ),  
327 - // VEmptyView(24),  
328 - _item(  
329 - '销售价',  
330 - '${couponProvider.couponSunModel.price}元' ??  
331 - ''),  
332 - Container(  
333 - height: ScreenUtil().setWidth(2),  
334 - color: MyColours.color_E7E7E7, 259 + VEmptyView(24),
  260 + _item(
  261 + '销售价', '${widget.isExamineSunModel.price ?? ''}元'),
  262 + Container(
  263 + height: ScreenUtil().setWidth(2),
  264 + color: MyColours.color_E7E7E7,
  265 + ),
  266 + VEmptyView(24),
  267 + _item('券要求', widget.isExamineSunModel.desc ?? ''),
  268 + Container(
  269 + height: ScreenUtil().setWidth(2),
  270 + color: MyColours.color_E7E7E7,
  271 + ),
  272 + VEmptyView(24),
  273 + _item(
  274 + '有效期从',
  275 + Utils.getDateStrFromJiekou(
  276 + widget.isExamineSunModel.stime)),
  277 + Container(
  278 + height: ScreenUtil().setWidth(2),
  279 + color: MyColours.color_E7E7E7,
  280 + ),
  281 + VEmptyView(24),
  282 + _item(
  283 + '有效期至',
  284 + Utils.getDateStrFromJiekou(
  285 + widget.isExamineSunModel.etime)),
  286 +
  287 + Column(children: [
  288 + Container(
  289 + height: ScreenUtil().setWidth(2),
  290 + color: MyColours.color_E7E7E7,
  291 + ),
  292 + VEmptyView(24),
  293 + _item(
  294 + '使用限制',
  295 + widget.isExamineSunModel.expDate.isNone
  296 + ? '无'
  297 + : widget.isExamineSunModel.expDate.isBirthday
  298 + ? '会员生日当天'
  299 + : widget.isExamineSunModel.expDate.isWeek
  300 + ? '每周指定日期餐段可用'
  301 + : ''),
  302 + if (widget.isExamineSunModel.expDate.isWeek)
  303 + Align(
  304 + alignment: Alignment.centerLeft,
  305 + child: Padding(
  306 + padding: EdgeInsets.only(left: w(16)),
  307 + child: Text(
  308 + widget.isExamineSunModel.expDate.weekShow,
  309 + textAlign: TextAlign.left,
  310 + style: TextStyle(
  311 + height: 1.5,
  312 + fontSize: font(16),
  313 + color: MyColours.color_999999),
335 ), 314 ),
336 - VEmptyView(24),  
337 - ],  
338 - ),  
339 - _item('券要求', couponProvider.couponSunModel.desc), 315 + )),
  316 + if (widget.isExamineSunModel.expDate.isWeek)
  317 + VEmptyView(24),
  318 + ]),
  319 +
  320 + // widget.isExamineSunModel.isType == '1'
  321 + // ? Column(
  322 + // crossAxisAlignment:
  323 + // CrossAxisAlignment.start,
  324 + // children: [
  325 + // Container(
  326 + // height: ScreenUtil().setWidth(2),
  327 + // color: MyColours.color_E7E7E7,
  328 + // ),
  329 + // VEmptyView(24),
  330 + // _item('创建人',
  331 + // widget.isExamineSunModel.uid),
  332 + // ],
  333 + // )
  334 + // : SizedBox(),
  335 + Column(
  336 + crossAxisAlignment: CrossAxisAlignment.start,
  337 + children: [
340 Container( 338 Container(
341 height: ScreenUtil().setWidth(2), 339 height: ScreenUtil().setWidth(2),
342 color: MyColours.color_E7E7E7, 340 color: MyColours.color_E7E7E7,
343 ), 341 ),
344 VEmptyView(24), 342 VEmptyView(24),
345 - _item(  
346 - '有效期从',  
347 - Utils.getDateStrFromJiekou(  
348 - couponProvider.couponSunModel.stime)), 343 + _item('核销日期',
  344 + widget.isExamineSunModel.examineTimeStr),
349 Container( 345 Container(
350 height: ScreenUtil().setWidth(2), 346 height: ScreenUtil().setWidth(2),
351 color: MyColours.color_E7E7E7, 347 color: MyColours.color_E7E7E7,
352 ), 348 ),
353 VEmptyView(24), 349 VEmptyView(24),
354 - _item(  
355 - '有效期至',  
356 - Utils.getDateStrFromJiekou(  
357 - couponProvider.couponSunModel.etime)),  
358 -  
359 - Column(children: [  
360 - Container( 350 + _item('核销人',
  351 + widget.isExamineSunModel.examineName ?? ''),
  352 + // _select(
  353 + // '谁可以发放',
  354 + // '查看',
  355 + // () async {
  356 + // await NavigatorUtil
  357 + // .goCouponToPersonnalPage(
  358 + // context,
  359 + // couponProvider
  360 + // .couponSunModel.uidList,
  361 + // onlyShow: true);
  362 + // },
  363 + // )
  364 + ],
  365 + ),
  366 + widget.isExamineSunModel.explain != null &&
  367 + widget.isExamineSunModel.explain != ''
  368 + ? Container(
361 height: ScreenUtil().setWidth(2), 369 height: ScreenUtil().setWidth(2),
362 color: MyColours.color_E7E7E7, 370 color: MyColours.color_E7E7E7,
363 - ),  
364 - VEmptyView(24),  
365 - _item(  
366 - '使用限制',  
367 - couponProvider.couponSunModel.expDate.isNone  
368 - ? '无'  
369 - : couponProvider  
370 - .couponSunModel.expDate.isBirthday  
371 - ? '会员生日当天'  
372 - : couponProvider  
373 - .couponSunModel.expDate.isWeek  
374 - ? '每周指定日期餐段可用'  
375 - : ''),  
376 - if (couponProvider.couponSunModel.expDate.isWeek)  
377 - Align(  
378 - alignment: Alignment.centerLeft,  
379 - child: Padding(  
380 - padding: EdgeInsets.only(left: w(16)),  
381 - child: Text(  
382 - couponProvider  
383 - .couponSunModel.expDate.weekShow,  
384 - textAlign: TextAlign.left,  
385 - style: TextStyle(  
386 - height: 1.5,  
387 - fontSize: font(16),  
388 - color: MyColours.color_999999),  
389 - ),  
390 - )),  
391 - if (couponProvider.couponSunModel.expDate.isWeek)  
392 - VEmptyView(24),  
393 - ]),  
394 -  
395 - // couponProvider.couponSunModel.isType == '1'  
396 - // ? Column(  
397 - // crossAxisAlignment:  
398 - // CrossAxisAlignment.start,  
399 - // children: [  
400 - // Container(  
401 - // height: ScreenUtil().setWidth(2),  
402 - // color: MyColours.color_E7E7E7,  
403 - // ),  
404 - // VEmptyView(24),  
405 - // _item('创建人',  
406 - // couponProvider.couponSunModel.uid),  
407 - // ],  
408 - // )  
409 - // : SizedBox(),  
410 - Column(  
411 - crossAxisAlignment: CrossAxisAlignment.start,  
412 - children: [  
413 - Container(  
414 - height: ScreenUtil().setWidth(2),  
415 - color: MyColours.color_E7E7E7,  
416 - ),  
417 - VEmptyView(24),  
418 - _item('核销日期', '2023-05-05'),  
419 - Container(  
420 - height: ScreenUtil().setWidth(2),  
421 - color: MyColours.color_E7E7E7,  
422 - ),  
423 - VEmptyView(24),  
424 - _item('核销人', '核销人'),  
425 - // _select(  
426 - // '谁可以发放',  
427 - // '查看',  
428 - // () async {  
429 - // await NavigatorUtil  
430 - // .goCouponToPersonnalPage(  
431 - // context,  
432 - // couponProvider  
433 - // .couponSunModel.uidList,  
434 - // onlyShow: true);  
435 - // },  
436 - // )  
437 - ], 371 + )
  372 + : SizedBox(),
  373 + widget.isExamineSunModel.explain != null &&
  374 + widget.isExamineSunModel.explain != ''
  375 + ? VEmptyView(24)
  376 + : SizedBox(),
  377 + widget.isExamineSunModel.explain != null &&
  378 + widget.isExamineSunModel.explain != ''
  379 + ? _item('券说明', '')
  380 + : SizedBox(),
  381 + Container(
  382 + height: ScreenUtil().setWidth(2),
  383 + color: MyColours.color_E7E7E7,
  384 + ),
  385 + VEmptyView(24),
  386 + if (widget.isExamineSunModel.explain != null &&
  387 + widget.isExamineSunModel.explain != '')
  388 + Align(
  389 + alignment: Alignment.centerLeft,
  390 + child: Text(
  391 + widget.isExamineSunModel.explain,
  392 + textAlign: TextAlign.left,
  393 + style: TextStyle(
  394 + // height: 1.5,
  395 + fontSize: font(16),
  396 + color: MyColours.color_999999),
438 ), 397 ),
439 - couponProvider.couponSunModel.explain != null &&  
440 - couponProvider.couponSunModel.explain != ''  
441 - ? Container(  
442 - height: ScreenUtil().setWidth(2),  
443 - color: MyColours.color_E7E7E7,  
444 - )  
445 - : SizedBox(),  
446 - couponProvider.couponSunModel.explain != null &&  
447 - couponProvider.couponSunModel.explain != ''  
448 - ? VEmptyView(24)  
449 - : SizedBox(),  
450 - couponProvider.couponSunModel.explain != null &&  
451 - couponProvider.couponSunModel.explain != ''  
452 - ? _item('券说明', '')  
453 - : SizedBox(),  
454 - Container(  
455 - height: ScreenUtil().setWidth(2),  
456 - color: MyColours.color_E7E7E7,  
457 - ),  
458 - VEmptyView(24),  
459 - if (couponProvider.couponSunModel.explain != null &&  
460 - couponProvider.couponSunModel.explain != '')  
461 - Align(  
462 - alignment: Alignment.centerLeft,  
463 - child: Text(  
464 - couponProvider.couponSunModel.explain,  
465 - textAlign: TextAlign.left,  
466 - style: TextStyle(  
467 - // height: 1.5,  
468 - fontSize: font(16),  
469 - color: MyColours.color_999999),  
470 - ),  
471 - ),  
472 - if (couponProvider.couponSunModel.explain != null &&  
473 - couponProvider.couponSunModel.explain != '')  
474 - VEmptyView(24),  
475 - // Container(  
476 - // height: ScreenUtil().setWidth(2),  
477 - // color: MyColours.color_E7E7E7,  
478 - // ),  
479 - VEmptyView(24),  
480 - _canUse(  
481 - '立即启用',  
482 - couponProvider.couponSunModel.status == '1'  
483 - ? true  
484 - : false)  
485 - ],  
486 - ))),  
487 - )  
488 - ]);  
489 - }  
490 - })); 398 + ),
  399 + if (widget.isExamineSunModel.explain != null &&
  400 + widget.isExamineSunModel.explain != '')
  401 + VEmptyView(24),
  402 + // Container(
  403 + // height: ScreenUtil().setWidth(2),
  404 + // color: MyColours.color_E7E7E7,
  405 + // ),
  406 + // VEmptyView(24),
  407 + // _canUse(
  408 + // '立即启用',
  409 + // widget.isExamineSunModel.status == '1'
  410 + // ? true
  411 + // : false)
  412 + ],
  413 + ))),
  414 + )
  415 + ])
  416 + // ;
  417 + // }
  418 + // })
  419 + );
491 } 420 }
492 } 421 }
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter/rendering.dart'; 2 import 'package:flutter/rendering.dart';
  3 +import 'package:one_key/models/IsExamineModel.dart';
3 import 'package:one_key/res/colors.dart'; 4 import 'package:one_key/res/colors.dart';
4 import 'package:one_key/widgets/v_empty_view.dart'; 5 import 'package:one_key/widgets/v_empty_view.dart';
5 6
@@ -7,7 +8,9 @@ import '../../utils/screen_util.dart'; @@ -7,7 +8,9 @@ import '../../utils/screen_util.dart';
7 8
8 class CouponVerificationItemF extends StatefulWidget { 9 class CouponVerificationItemF extends StatefulWidget {
9 final VoidCallback onPressed; 10 final VoidCallback onPressed;
10 - CouponVerificationItemF({Key key, this.onPressed}) : super(key: key); 11 + final IsExamineSunModel isExamineSunModel;
  12 + CouponVerificationItemF({Key key, this.onPressed, this.isExamineSunModel})
  13 + : super(key: key);
11 14
12 @override 15 @override
13 _CouponVerificationItemFState createState() => 16 _CouponVerificationItemFState createState() =>
@@ -44,7 +47,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> { @@ -44,7 +47,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
44 Expanded( 47 Expanded(
45 flex: 1, 48 flex: 1,
46 child: Text( 49 child: Text(
47 - '200元代金券', 50 + widget.isExamineSunModel.rechargeName,
48 style: TextStyle( 51 style: TextStyle(
49 color: MyColours.color_999999, 52 color: MyColours.color_999999,
50 fontSize: font(16), 53 fontSize: font(16),
@@ -54,7 +57,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> { @@ -54,7 +57,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
54 Expanded( 57 Expanded(
55 flex: 2, 58 flex: 2,
56 child: Text( 59 child: Text(
57 - 'NO.01774420230223150306', 60 + widget.isExamineSunModel.orderNo,
58 textAlign: TextAlign.right, 61 textAlign: TextAlign.right,
59 style: TextStyle( 62 style: TextStyle(
60 color: MyColours.color_999999, 63 color: MyColours.color_999999,
@@ -69,7 +72,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> { @@ -69,7 +72,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
69 Padding( 72 Padding(
70 padding: EdgeInsets.symmetric(horizontal: w(20)), 73 padding: EdgeInsets.symmetric(horizontal: w(20)),
71 child: Text( 74 child: Text(
72 - '核销:张阿生', 75 + '核销:${widget.isExamineSunModel.examineName ?? ''}',
73 style: TextStyle( 76 style: TextStyle(
74 color: MyColours.color_999999, 77 color: MyColours.color_999999,
75 fontSize: font(12), 78 fontSize: font(12),
@@ -81,7 +84,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> { @@ -81,7 +84,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
81 Padding( 84 Padding(
82 padding: EdgeInsets.symmetric(horizontal: w(20)), 85 padding: EdgeInsets.symmetric(horizontal: w(20)),
83 child: Text( 86 child: Text(
84 - '日期:2023-05-05', 87 + '日期:${widget.isExamineSunModel.examineTimeStr ?? ''}',
85 style: TextStyle( 88 style: TextStyle(
86 color: MyColours.color_999999, 89 color: MyColours.color_999999,
87 fontSize: font(12), 90 fontSize: font(12),
@@ -92,6 +95,6 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> { @@ -92,6 +95,6 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
92 VEmptyView(24), 95 VEmptyView(24),
93 ], 96 ],
94 ), 97 ),
95 - )) ; 98 + ));
96 } 99 }
97 } 100 }
@@ -17,6 +17,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; @@ -17,6 +17,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
17 import 'package:provider/provider.dart'; 17 import 'package:provider/provider.dart';
18 18
19 import '../../constant/state.dart'; 19 import '../../constant/state.dart';
  20 +import '../../utils/event_bus.dart';
20 import '../../utils/screen_util.dart'; 21 import '../../utils/screen_util.dart';
21 import '../../widgets/page_exception.dart'; 22 import '../../widgets/page_exception.dart';
22 23
@@ -168,8 +169,6 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { @@ -168,8 +169,6 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> {
168 setState(() {}); 169 setState(() {});
169 } 170 }
170 171
171 -  
172 -  
173 ///输入框 172 ///输入框
174 Widget _item(String title, String subTitle, 173 Widget _item(String title, String subTitle,
175 {Color textColor = MyColours.color_40000000, int fontSize = 16}) { 174 {Color textColor = MyColours.color_40000000, int fontSize = 16}) {
@@ -464,11 +463,20 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { @@ -464,11 +463,20 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> {
464 content: '${limitStr}确定要核销当前优惠券吗?核销使用后,该券不能再次使用。', 463 content: '${limitStr}确定要核销当前优惠券吗?核销使用后,该券不能再次使用。',
465 rCallback: () async { 464 rCallback: () async {
466 //确定核销 465 //确定核销
467 - 466 + Map<String, String> pramas = {
  467 + 'id': widget.idstr,
  468 + 'examine_name': Provider.of<UserModel>(context,
  469 + listen: false)
  470 + .user
  471 + .nickName ??
  472 + Provider.of<UserModel>(context, listen: false)
  473 + .user
  474 + .account
  475 + };
468 bool success = await couponProvider 476 bool success = await couponProvider
469 - .setNewRechargeWriteOff(  
470 - context, {'id': widget.idstr}); 477 + .setNewRechargeWriteOff(context, pramas);
471 if (success) { 478 if (success) {
  479 + bus.emit('refresh_coupon_verification_list');
472 //核销成功,刷新当前页面 480 //核销成功,刷新当前页面
473 _getOrderRechargeByid( 481 _getOrderRechargeByid(
474 pageS: PageState.Success, 482 pageS: PageState.Success,
@@ -307,15 +307,17 @@ class _MessageHasOrderFoodPageState extends State<MessageHasOrderFoodPage> { @@ -307,15 +307,17 @@ class _MessageHasOrderFoodPageState extends State<MessageHasOrderFoodPage> {
307 Spacer(), 307 Spacer(),
308 Text( 308 Text(
309 '¥' + 309 '¥' +
310 - _orderFoodProvider  
311 - .orderList[i][_orderFoodProvider  
312 - .orderList[i].keys.first][index]  
313 - .price + 310 + (_orderFoodProvider
  311 + .orderList[i][_orderFoodProvider
  312 + .orderList[i].keys.first][index]
  313 + .price ??
  314 + '') +
314 '/' + 315 '/' +
315 - _orderFoodProvider  
316 - .orderList[i][_orderFoodProvider  
317 - .orderList[i].keys.first][index]  
318 - .cookunit, 316 + (_orderFoodProvider
  317 + .orderList[i][_orderFoodProvider
  318 + .orderList[i].keys.first][index]
  319 + .cookunit ??
  320 + "份"),
319 style: TextStyle( 321 style: TextStyle(
320 color: MyColours.color_333333, 322 color: MyColours.color_333333,
321 fontSize: ScreenUtil().setWidth(30)), 323 fontSize: ScreenUtil().setWidth(30)),
@@ -12,6 +12,7 @@ import 'package:one_key/provider/user_model.dart'; @@ -12,6 +12,7 @@ import 'package:one_key/provider/user_model.dart';
12 import 'package:one_key/utils/utils.dart'; 12 import 'package:one_key/utils/utils.dart';
13 import 'package:provider/provider.dart'; 13 import 'package:provider/provider.dart';
14 14
  15 +import '../models/IsExamineModel.dart';
15 import '../models/order_recharge_by_id_model.dart'; 16 import '../models/order_recharge_by_id_model.dart';
16 17
17 class CouponProvider with ChangeNotifier { 18 class CouponProvider with ChangeNotifier {
@@ -37,6 +38,8 @@ class CouponProvider with ChangeNotifier { @@ -37,6 +38,8 @@ class CouponProvider with ChangeNotifier {
37 CouponSunModel couponSunModel; //优惠券详情 38 CouponSunModel couponSunModel; //优惠券详情
38 OrderRechargeByidSunModel orderRechargeByidSunModel; //核销详情页 39 OrderRechargeByidSunModel orderRechargeByidSunModel; //核销详情页
39 40
  41 + List<IsExamineSunModel> isExamineList = []; //商家券核销列表
  42 + IsExamineSunModel isExamineDetail;
40 CouponProvider() { 43 CouponProvider() {
41 // for (int i = 0; i < 20; i++) { 44 // for (int i = 0; i < 20; i++) {
42 // swichStateData.add(true); 45 // swichStateData.add(true);
@@ -230,6 +233,51 @@ class CouponProvider with ChangeNotifier { @@ -230,6 +233,51 @@ class CouponProvider with ChangeNotifier {
230 return couponList; 233 return couponList;
231 } 234 }
232 235
  236 + ///商家券核销列表
  237 + Future<List<IsExamineSunModel>> getIsExamineList(
  238 + BuildContext context, Map<String, String> params,
  239 + {isShowLoading = true}) async {
  240 + if (isShowLoading) {
  241 + pageStateVerification = PageState.Loading;
  242 + notifyListeners();
  243 + }
  244 + BaseResp<dynamic> baseResp = await DioUtil()
  245 + .request<dynamic>(context, Method.get, HttpUrl.get_is_examine_list,
  246 + data: params, showLoading: false)
  247 + .catchError((error) {
  248 + print(error.toString());
  249 + if (error is MyError) {
  250 + switch (error.type) {
  251 + case 1:
  252 + pageStateVerification = PageState.ConnectivityError;
  253 + break;
  254 + case 2:
  255 + pageStateVerification = PageState.ConnectivityTimeOut;
  256 + break;
  257 + default:
  258 + pageStateVerification = PageState.ConnectivityError;
  259 + break;
  260 + }
  261 + }
  262 + notifyListeners();
  263 + });
  264 + if (baseResp.code == Constant.status_success) {
  265 + if (baseResp.data.isEmpty) {
  266 + pageStateVerification = PageState.Empty;
  267 + } else {
  268 + pageStateVerification = PageState.Success;
  269 + }
  270 + isExamineList = IsExamineModel.fromJson(baseResp.responseData).data;
  271 + notifyListeners();
  272 + } else {
  273 + pageStateVerification = PageState.ConnectivityError;
  274 + if (baseResp != null) {
  275 + Utils.showToast(baseResp.msg ?? "");
  276 + }
  277 + }
  278 + return isExamineList;
  279 + }
  280 +
233 ///客户经理获取所创建活动列表 281 ///客户经理获取所创建活动列表
234 Future<List<CouponSunModel>> getCustomerHistoryActivity( 282 Future<List<CouponSunModel>> getCustomerHistoryActivity(
235 BuildContext context, Map<String, String> params, 283 BuildContext context, Map<String, String> params,
@@ -26,6 +26,7 @@ import 'package:one_key/utils/utils.dart'; @@ -26,6 +26,7 @@ import 'package:one_key/utils/utils.dart';
26 import 'package:sqflite/sqlite_api.dart'; 26 import 'package:sqflite/sqlite_api.dart';
27 27
28 import '../app.dart'; 28 import '../app.dart';
  29 +import '../models/IsExamineModel.dart';
29 import '../models/get_banquet_by_id_new_model.dart'; 30 import '../models/get_banquet_by_id_new_model.dart';
30 import '../models/get_banquet_deposit_model.dart'; 31 import '../models/get_banquet_deposit_model.dart';
31 import '../models/menu_unit_model.dart'; 32 import '../models/menu_unit_model.dart';
@@ -1717,10 +1718,10 @@ class NavigatorUtil { @@ -1717,10 +1718,10 @@ class NavigatorUtil {
1717 1718
1718 /// 优惠券核销详情页 1719 /// 优惠券核销详情页
1719 static Future<dynamic> goCouponVerificationDetailPage( 1720 static Future<dynamic> goCouponVerificationDetailPage(
1720 - BuildContext context, CouponSunModel couponSunModel, 1721 + BuildContext context, IsExamineSunModel isExamineSunModel,
1721 {replace = false, String idStr}) { 1722 {replace = false, String idStr}) {
1722 return _navigateTo(context, 1723 return _navigateTo(context,
1723 - "${Routes.coupon_verification_detail_page}?couponSunModel=${FluroConvertUtils.object2string(couponSunModel)}&idStr=$idStr", 1724 + "${Routes.coupon_verification_detail_page}?isExamineSunModel=${FluroConvertUtils.object2string(isExamineSunModel)}&idStr=$idStr",
1724 replace: replace); 1725 replace: replace);
1725 } 1726 }
1726 } 1727 }
@@ -153,6 +153,7 @@ import 'package:one_key/utils/fluro_convert_utils.dart'; @@ -153,6 +153,7 @@ import 'package:one_key/utils/fluro_convert_utils.dart';
153 import 'package:one_key/utils/utils.dart'; 153 import 'package:one_key/utils/utils.dart';
154 import 'package:provider/provider.dart'; 154 import 'package:provider/provider.dart';
155 155
  156 +import '../models/IsExamineModel.dart';
156 import '../models/get_banquet_by_id_new_model.dart'; 157 import '../models/get_banquet_by_id_new_model.dart';
157 import '../models/menu_unit_model.dart'; 158 import '../models/menu_unit_model.dart';
158 import '../models/out_wine_record_model.dart'; 159 import '../models/out_wine_record_model.dart';
@@ -2773,7 +2774,6 @@ var messageRechargeInfoPageHandle = new Handler( @@ -2773,7 +2774,6 @@ var messageRechargeInfoPageHandle = new Handler(
2773 2774
2774 var feastDishSharePageHandle = new Handler( 2775 var feastDishSharePageHandle = new Handler(
2775 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 2776 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
2776 -  
2777 SetMealSunModel setmealDetail = SetMealSunModel.fromJson(json 2777 SetMealSunModel setmealDetail = SetMealSunModel.fromJson(json
2778 .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); 2778 .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
2779 return ChangeNotifierProvider<FeastModel>( 2779 return ChangeNotifierProvider<FeastModel>(
@@ -2784,13 +2784,12 @@ var feastDishSharePageHandle = new Handler( @@ -2784,13 +2784,12 @@ var feastDishSharePageHandle = new Handler(
2784 ///优惠券核销详情页 2784 ///优惠券核销详情页
2785 var couponVerificationDetailPageHandle = new Handler( 2785 var couponVerificationDetailPageHandle = new Handler(
2786 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 2786 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
2787 - String idStr = params["idStr"].first;  
2788 - CouponSunModel couponSunModel;  
2789 - if (idStr == null || idStr == 'null') {  
2790 - couponSunModel = CouponSunModel.fromJson(json.decode(  
2791 - FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));  
2792 - } 2787 + // String idStr = params["idStr"].first;
  2788 + IsExamineSunModel isExamineSunModel = IsExamineSunModel.fromJson(json.decode(
  2789 + FluroConvertUtils.fluroCnParamsDecode(
  2790 + params["isExamineSunModel"].first)));
  2791 + // }
2793 2792
2794 return CouponVerificationDetailPage( 2793 return CouponVerificationDetailPage(
2795 - couponSunModel: couponSunModel, idstr: idStr); 2794 + isExamineSunModel: isExamineSunModel);
2796 }); 2795 });
@@ -1091,6 +1091,9 @@ class Utils { @@ -1091,6 +1091,9 @@ class Utils {
1091 } 1091 }
1092 1092
1093 static getDateStrFromJiekou(String ms) { 1093 static getDateStrFromJiekou(String ms) {
  1094 + if (ms == null || ms == '') {
  1095 + return '';
  1096 + }
1094 return DateUtil.formatDate( 1097 return DateUtil.formatDate(
1095 DateTime.fromMillisecondsSinceEpoch(int.parse(ms) * 1000), 1098 DateTime.fromMillisecondsSinceEpoch(int.parse(ms) * 1000),
1096 format: DateFormats.y_mo_d); 1099 format: DateFormats.y_mo_d);
@@ -1234,6 +1237,7 @@ class Utils { @@ -1234,6 +1237,7 @@ class Utils {
1234 path: _path, 1237 path: _path,
1235 // thumbnail: WeChatImage.asset(Utils.getImgPath('mini_image')), 1238 // thumbnail: WeChatImage.asset(Utils.getImgPath('mini_image')),
1236 description: _description, 1239 description: _description,
  1240 +
1237 // thumbnail: WeChatImage.binary(source) 1241 // thumbnail: WeChatImage.binary(source)
1238 1242
1239 thumbnail: WeChatImage.network(_thumbnail)); 1243 thumbnail: WeChatImage.network(_thumbnail));