Commit 5a2b5603d399b218ac3f533bd267fd8050a12007

Authored by weixin_45529955
1 parent 622ea624

优惠券发放数量限制 10000 5

@@ -680,7 +680,15 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -680,7 +680,15 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
680 borderSide: BorderSide.none, 680 borderSide: BorderSide.none,
681 ), 681 ),
682 ), 682 ),
683 - onChanged: (value) {}, 683 + onChanged: (value) {
  684 + if (title == '发放总量限制' && value.trim().length > 0) {
  685 + int? number = int.parse(value);
  686 + if (number != null && number > 10000) {
  687 + _limitNumControl.text = '10000';
  688 + Utils.showToast('发放总量最大可设置10000张');
  689 + }
  690 + }
  691 + },
684 onEditingComplete: () { 692 onEditingComplete: () {
685 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 693 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
686 }, 694 },
@@ -1432,7 +1440,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1432,7 +1440,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1432 if (mealDayList.length == 0) { 1440 if (mealDayList.length == 0) {
1433 await _getDailyTime(); 1441 await _getDailyTime();
1434 } 1442 }
1435 - if (mealDayList.length == 0) { 1443 + if (mealDayList.length == 0) {
1436 Utils.showToast('请开启餐段后重试'); 1444 Utils.showToast('请开启餐段后重试');
1437 return; 1445 return;
1438 } 1446 }
@@ -1613,7 +1621,6 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1613,7 +1621,6 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1613 // if (meal2Str != null) { 1621 // if (meal2Str != null) {
1614 // show += ('\n' + meal2Str!); 1622 // show += ('\n' + meal2Str!);
1615 // } 1623 // }
1616 -  
1617 1624
1618 weekShow = show; 1625 weekShow = show;
1619 } 1626 }
@@ -481,7 +481,15 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -481,7 +481,15 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
481 borderSide: BorderSide.none, 481 borderSide: BorderSide.none,
482 ), 482 ),
483 ), 483 ),
484 - onChanged: (value) {}, 484 + onChanged: (value) {
  485 + if (title == '发放总量限制' && value.trim().length > 0) {
  486 + int? number = int.parse(value);
  487 + if (number != null && number > 10000) {
  488 + _limitNumControl.text = '10000';
  489 + Utils.showToast('发放总量最大可设置10000张');
  490 + }
  491 + }
  492 + },
485 onEditingComplete: () { 493 onEditingComplete: () {
486 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 494 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
487 }, 495 },
@@ -67,563 +67,622 @@ class _CouponItemFState extends State<CouponItemF> { @@ -67,563 +67,622 @@ class _CouponItemFState extends State<CouponItemF> {
67 } 67 }
68 return InkWell( 68 return InkWell(
69 onTap: widget.onPressed, 69 onTap: widget.onPressed,
70 - child: Column(children: [  
71 - Stack(  
72 - alignment: widget.from == 'select'  
73 - ? Alignment.centerLeft  
74 - : AlignmentDirectional.topStart,  
75 - children: [  
76 - Row( 70 + child: Container(
  71 + color: MyColours.color_ffffff,
  72 + child: Column(children: [
  73 + Stack(
  74 + alignment: widget.from == 'select'
  75 + ? Alignment.centerLeft
  76 + : AlignmentDirectional.topStart,
77 children: [ 77 children: [
78 - HEmptyView(20),  
79 - widget.from == 'select'  
80 - ? InkWell(  
81 - onTap: widget.onPressedSelect, 78 + Row(
  79 + children: [
  80 + HEmptyView(20),
  81 + widget.from == 'select'
  82 + ? InkWell(
  83 + onTap: widget.onPressedSelect,
  84 + child: Container(
  85 + // color: Colors.red,
  86 + padding: EdgeInsets.symmetric(
  87 + vertical: w(50), horizontal: w(5)),
  88 + child: Image.asset(
  89 + Utils.getImgPath(sunModel.isCheck
  90 + ? widget.radio
  91 + ? 'c_mul_select'
  92 + : 'select_f'
  93 + : widget.radio
  94 + ? 'c_not_edit'
  95 + : 'show_select_f'),
  96 + width: w(20),
  97 + ),
  98 + ))
  99 + : Container(),
  100 + Expanded(
82 child: Container( 101 child: Container(
83 - // color: Colors.red,  
84 - padding: EdgeInsets.symmetric(  
85 - vertical: w(50), horizontal: w(5)),  
86 - child: Image.asset(  
87 - Utils.getImgPath(sunModel.isCheck  
88 - ? widget.radio  
89 - ? 'c_mul_select'  
90 - : 'select_f'  
91 - : widget.radio  
92 - ? 'c_not_edit'  
93 - : 'show_select_f'),  
94 - width: w(20),  
95 - ),  
96 - ))  
97 - : Container(),  
98 - Expanded(  
99 - child: Container(  
100 - // width: ScreenUtil().setWidth(610),  
101 - margin: EdgeInsets.fromLTRB(  
102 - ScreenUtil().setWidth(20),  
103 - ScreenUtil().setWidth(0),  
104 - ScreenUtil().setWidth(40),  
105 - ScreenUtil().setWidth(0)),  
106 - decoration: BoxDecoration(  
107 - color: MyColours.color_ffffff,  
108 - boxShadow: [  
109 - BoxShadow(  
110 - spreadRadius: ScreenUtil().setWidth(2),  
111 - color: Color.fromRGBO(0, 0, 0, 0.25),  
112 - offset: Offset(0, ScreenUtil().setWidth(8)),  
113 - blurRadius: ScreenUtil().setWidth(8))  
114 - ],  
115 - borderRadius: BorderRadius.all(  
116 - Radius.circular(ScreenUtil().setWidth(16)),  
117 - ),  
118 - ),  
119 - child: Column(  
120 - mainAxisSize: MainAxisSize.min,  
121 - crossAxisAlignment: CrossAxisAlignment.start,  
122 - children: [  
123 - Container(  
124 - height: ScreenUtil().setWidth(40),  
125 - padding: EdgeInsets.symmetric(  
126 - horizontal: ScreenUtil().setWidth(24)),  
127 - decoration: BoxDecoration(  
128 - color: widget.from == 'history'  
129 - ? MyColours.color_BFC4D4  
130 - : widget.from == 'setting'  
131 - ? MyColours.color_00A870  
132 - : notSelect  
133 - ? sunModel.isType == '1' ||  
134 - sunModel.isType == '3' ||  
135 - sunModel.isType == '4'  
136 - ? sunModel.isMarking  
137 - ? MyColours.color_00A870  
138 - : MyColours.color_438E93  
139 - : MyColours.color_ED7B2F  
140 - : MyColours.color_999999,  
141 - borderRadius: BorderRadius.only(  
142 - topLeft: Radius.circular(  
143 - ScreenUtil().setWidth(16)),  
144 - topRight: Radius.circular(  
145 - ScreenUtil().setWidth(16)))),  
146 - child: Row(  
147 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
148 - children: [  
149 - Text(  
150 - sunModel.isType == '1'  
151 - ? '付费优惠券'  
152 - : sunModel.isType == '2'  
153 - ? '我的优惠券'  
154 - : sunModel.isType == '3'  
155 - ? '免费代金券'  
156 - : '付费优惠券',  
157 - style: TextStyle(  
158 - color: MyColours.color_ffffff,  
159 - fontSize: ScreenUtil().setSp(24)),  
160 - ),  
161 - InkWell(  
162 - onTap: widget.onPressedSwich,  
163 - child: Text( 102 + // width: ScreenUtil().setWidth(610),
  103 + margin: EdgeInsets.fromLTRB(
  104 + ScreenUtil().setWidth(20),
  105 + ScreenUtil().setWidth(0),
  106 + ScreenUtil().setWidth(40),
  107 + ScreenUtil().setWidth(0)),
  108 + decoration: BoxDecoration(
  109 + color: MyColours.color_ffffff,
  110 + boxShadow: [
  111 + BoxShadow(
  112 + spreadRadius: ScreenUtil().setWidth(2),
  113 + color: Color.fromRGBO(0, 0, 0, 0.25),
  114 + offset: Offset(0, ScreenUtil().setWidth(8)),
  115 + blurRadius: ScreenUtil().setWidth(8))
  116 + ],
  117 + borderRadius: BorderRadius.all(
  118 + Radius.circular(ScreenUtil().setWidth(16)),
  119 + ),
  120 + ),
  121 + child: Column(
  122 + mainAxisSize: MainAxisSize.min,
  123 + crossAxisAlignment: CrossAxisAlignment.start,
  124 + children: [
  125 + Container(
  126 + height: ScreenUtil().setWidth(40),
  127 + padding: EdgeInsets.symmetric(
  128 + horizontal: ScreenUtil().setWidth(24)),
  129 + decoration: BoxDecoration(
  130 + color: widget.from == 'history'
  131 + ? MyColours.color_BFC4D4
  132 + : widget.from == 'setting'
  133 + ? MyColours.color_00A870
  134 + : notSelect
  135 + ? sunModel.isType == '1' ||
  136 + sunModel.isType ==
  137 + '3' ||
  138 + sunModel.isType == '4'
  139 + ? sunModel.isMarking
  140 + ? MyColours.color_00A870
  141 + : MyColours.color_438E93
  142 + : MyColours.color_ED7B2F
  143 + : MyColours.color_999999,
  144 + borderRadius: BorderRadius.only(
  145 + topLeft: Radius.circular(
  146 + ScreenUtil().setWidth(16)),
  147 + topRight: Radius.circular(
  148 + ScreenUtil().setWidth(16)))),
  149 + child: Row(
  150 + mainAxisAlignment:
  151 + MainAxisAlignment.spaceBetween,
  152 + children: [
  153 + Text(
164 sunModel.isType == '1' 154 sunModel.isType == '1'
165 - ? sunModel.isExamine == '1'  
166 - ? sunModel.receiveNum == null  
167 - ? ''  
168 - : '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'  
169 - : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张' 155 + ? '付费优惠券'
170 : sunModel.isType == '2' 156 : sunModel.isType == '2'
171 - ? '被领取:${sunModel.receiveNum}张'  
172 - : sunModel.receiveNum == null  
173 - ? ''  
174 - : '被领取:${sunModel.receiveNum}张 已使用:${sunModel.useNum}张',  
175 - maxLines: 1,  
176 - overflow: TextOverflow.ellipsis, 157 + ? '我的优惠券'
  158 + : sunModel.isType == '3'
  159 + ? '免费代金券'
  160 + : '付费优惠券',
177 style: TextStyle( 161 style: TextStyle(
178 color: MyColours.color_ffffff, 162 color: MyColours.color_ffffff,
179 - fontSize: ScreenUtil().setSp(20))), 163 + fontSize: ScreenUtil().setSp(24)),
  164 + ),
  165 + InkWell(
  166 + onTap: widget.onPressedSwich,
  167 + child: Text(
  168 + sunModel.isType == '1'
  169 + ? sunModel.isExamine == '1'
  170 + ? sunModel.receiveNum == null
  171 + ? ''
  172 + : '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'
  173 + : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张'
  174 + : sunModel.isType == '2'
  175 + ? '被领取:${sunModel.receiveNum}张'
  176 + : sunModel.receiveNum == null
  177 + ? ''
  178 + : '被领取:${sunModel.receiveNum}张 已使用:${sunModel.useNum}张',
  179 + maxLines: 1,
  180 + overflow: TextOverflow.ellipsis,
  181 + style: TextStyle(
  182 + color: MyColours.color_ffffff,
  183 + fontSize:
  184 + ScreenUtil().setSp(20))),
  185 + ),
  186 + ],
180 ), 187 ),
181 - ],  
182 - ),  
183 - ),  
184 - Container(  
185 - padding: EdgeInsets.fromLTRB(  
186 - ScreenUtil().setWidth(24 * 2),  
187 - ScreenUtil().setWidth(9 * 2),  
188 - ScreenUtil().setWidth(10),  
189 - ScreenUtil().setWidth(20)),  
190 - child: Column(  
191 - crossAxisAlignment: CrossAxisAlignment.start,  
192 - children: [  
193 - Row( 188 + ),
  189 + Container(
  190 + padding: EdgeInsets.fromLTRB(
  191 + ScreenUtil().setWidth(24 * 2),
  192 + ScreenUtil().setWidth(9 * 2),
  193 + ScreenUtil().setWidth(10),
  194 + ScreenUtil().setWidth(20)),
  195 + child: Column(
  196 + crossAxisAlignment: CrossAxisAlignment.start,
194 children: [ 197 children: [
195 - Expanded(  
196 - child: Column(  
197 - crossAxisAlignment:  
198 - CrossAxisAlignment.start, 198 + Row(
199 children: [ 199 children: [
200 - Container(  
201 - // width: ScreenUtil()  
202 - // .setWidth(232 * 2),  
203 - child: Container(  
204 - // height: ScreenUtil().setWidth(25 * 2),  
205 - constraints: BoxConstraints(  
206 - maxWidth: ((widget.from ==  
207 - 'select' &&  
208 - sunModel.isType ==  
209 - '3' &&  
210 - widget.radio) ||  
211 - (widget.from ==  
212 - 'setting' &&  
213 - sunModel.isType ==  
214 - '3') ||  
215 - widget.showBtn)  
216 - ? ScreenUtil().screenWidth -  
217 - w(160)  
218 - : double.infinity),  
219 - child: Text(  
220 - sunModel.aname ?? '', //  
221 - maxLines: 10,  
222 - overflow: TextOverflow.ellipsis,  
223 - style: TextStyle(  
224 - color: widget.from == 'history'  
225 - ? MyColours.color_BFC4D4  
226 - : notSelect  
227 - ? MyColours.color_515151  
228 - : MyColours  
229 - .color_999999,  
230 - fontSize:  
231 - ScreenUtil().setSp(36),  
232 - fontWeight: FontWeight.bold),  
233 - ),  
234 - )),  
235 - Container(  
236 - height: ScreenUtil().setWidth(14 * 2),  
237 - width: ScreenUtil().setWidth(232 * 2),  
238 - child: Text(  
239 - sunModel.isType == '1' ||  
240 - sunModel.isType == '2'  
241 - ? '${sunModel.desc}'  
242 - : sunModel.desc == '0'  
243 - ? ''  
244 - : '消费满${sunModel.desc}元可用',  
245 - maxLines: 1,  
246 - overflow: TextOverflow.ellipsis,  
247 - style: TextStyle(  
248 - color: widget.from == 'history'  
249 - ? MyColours.color_BFC4D4  
250 - : notSelect  
251 - ? MyColours.color_515151  
252 - : MyColours  
253 - .color_999999,  
254 - fontSize:  
255 - ScreenUtil().setSp(20),  
256 - )),  
257 - ),  
258 - ],  
259 - )),  
260 - if (widget.from == 'select' &&  
261 - sunModel.isType == '3' &&  
262 - widget.radio &&  
263 - widget.needNum)  
264 - Row(  
265 - children: [  
266 - InkWell(  
267 - onTap: () {  
268 - if (sunModel.number == 0) {  
269 - return;  
270 - }  
271 - sunModel.number--;  
272 - sunModel.numberC.text =  
273 - '${sunModel.number}';  
274 - },  
275 - child: Container(  
276 - height: w(40),  
277 - padding: EdgeInsets.symmetric(  
278 - horizontal: w(10)),  
279 - child: Image.asset(  
280 - Utils.getImgPath(  
281 - 'plan_dish_minus'),  
282 - width: w(8), 200 + Expanded(
  201 + child: Column(
  202 + crossAxisAlignment:
  203 + CrossAxisAlignment.start,
  204 + children: [
  205 + Container(
  206 + // width: ScreenUtil()
  207 + // .setWidth(232 * 2),
  208 + child: Container(
  209 + // height: ScreenUtil().setWidth(25 * 2),
  210 + constraints: BoxConstraints(
  211 + maxWidth: ((widget.from ==
  212 + 'select' &&
  213 + sunModel.isType ==
  214 + '3' &&
  215 + widget.radio) ||
  216 + (widget.from ==
  217 + 'setting' &&
  218 + sunModel.isType ==
  219 + '3') ||
  220 + widget.showBtn)
  221 + ? ScreenUtil()
  222 + .screenWidth -
  223 + w(160)
  224 + : double.infinity),
  225 + child: Text(
  226 + sunModel.aname ?? '', //
  227 + maxLines: 10,
  228 + overflow: TextOverflow.ellipsis,
  229 + style: TextStyle(
  230 + color: widget.from ==
  231 + 'history'
  232 + ? MyColours.color_BFC4D4
  233 + : notSelect
  234 + ? MyColours
  235 + .color_515151
  236 + : MyColours
  237 + .color_999999,
  238 + fontSize:
  239 + ScreenUtil().setSp(36),
  240 + fontWeight:
  241 + FontWeight.bold),
283 ), 242 ),
  243 + )),
  244 + Container(
  245 + height:
  246 + ScreenUtil().setWidth(14 * 2),
  247 + width: ScreenUtil()
  248 + .setWidth(232 * 2),
  249 + child: Text(
  250 + sunModel.isType == '1' ||
  251 + sunModel.isType == '2'
  252 + ? '${sunModel.desc}'
  253 + : sunModel.desc == '0'
  254 + ? ''
  255 + : '消费满${sunModel.desc}元可用',
  256 + maxLines: 1,
  257 + overflow:
  258 + TextOverflow.ellipsis,
  259 + style: TextStyle(
  260 + color: widget.from ==
  261 + 'history'
  262 + ? MyColours.color_BFC4D4
  263 + : notSelect
  264 + ? MyColours
  265 + .color_515151
  266 + : MyColours
  267 + .color_999999,
  268 + fontSize:
  269 + ScreenUtil().setSp(20),
  270 + )),
284 ), 271 ),
285 - ),  
286 - Container(  
287 - // constraints: BoxConstraints(  
288 - // minWidth: w(34),  
289 - // ),  
290 - width: w(30),  
291 - decoration: BoxDecoration(  
292 - borderRadius:  
293 - BorderRadius.circular(  
294 - r(5)),  
295 - border: Border.all(  
296 - width: w(1),  
297 - color: MyColours  
298 - .color_438E93)),  
299 - // constraints: BoxConstraints(minWidth: w(20)),  
300 - child: TextField(  
301 - maxLines: 1,  
302 - controller: sunModel.numberC,  
303 - // focusNode: _focusNode,  
304 - // autofocus: true,  
305 -  
306 - inputFormatters: [  
307 - FilteringTextInputFormatter  
308 - .allow(RegExp(r'[0-9]')),  
309 - ],  
310 -  
311 - style: TextStyle(  
312 - color:  
313 - MyColours.color_438E93,  
314 - fontSize: font(11)),  
315 - textAlign: TextAlign.center,  
316 - // textAlignVertical: TextAlignVertical.center,  
317 - decoration: InputDecoration(  
318 - hintText: "数量",  
319 - isCollapsed: true,  
320 - hintStyle: TextStyle(  
321 - color:  
322 - MyColours.color_999999,  
323 - fontSize: font(11), 272 + ],
  273 + )),
  274 + if (widget.from == 'select' &&
  275 + sunModel.isType == '3' &&
  276 + widget.radio &&
  277 + widget.needNum)
  278 + Row(
  279 + children: [
  280 + InkWell(
  281 + onTap: () {
  282 + if (sunModel.number == 0) {
  283 + return;
  284 + }
  285 + sunModel.number--;
  286 + sunModel.numberC.text =
  287 + '${sunModel.number}';
  288 + },
  289 + child: Container(
  290 + height: w(40),
  291 + padding: EdgeInsets.symmetric(
  292 + horizontal: w(10)),
  293 + child: Image.asset(
  294 + Utils.getImgPath(
  295 + 'plan_dish_minus'),
  296 + width: w(8),
324 ), 297 ),
325 - // isCollapsed:  
326 - // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度  
327 - border: OutlineInputBorder(  
328 - borderSide:  
329 - BorderSide.none),  
330 - contentPadding:  
331 - EdgeInsets.only(  
332 - top: w(2),  
333 - bottom: w(2)),  
334 ), 298 ),
335 - keyboardType: TextInputType  
336 - .numberWithOptions(  
337 - decimal: true),  
338 - textInputAction:  
339 - TextInputAction.done, 299 + ),
  300 + Container(
  301 + // constraints: BoxConstraints(
  302 + // minWidth: w(34),
  303 + // ),
  304 + width: w(30),
  305 + decoration: BoxDecoration(
  306 + borderRadius:
  307 + BorderRadius.circular(
  308 + r(5)),
  309 + border: Border.all(
  310 + width: w(1),
  311 + color: MyColours
  312 + .color_438E93)),
  313 + // constraints: BoxConstraints(minWidth: w(20)),
  314 + child: TextField(
  315 + maxLines: 1,
  316 + controller:
  317 + sunModel.numberC,
  318 + // focusNode: _focusNode,
  319 + // autofocus: true,
  320 +
  321 + inputFormatters: [
  322 + FilteringTextInputFormatter
  323 + .allow(
  324 + RegExp(r'[0-9]')),
  325 + ],
340 326
341 - onChanged: (value) {  
342 - // bool isNumber = Utils.isNumeric(  
343 - // value); //判断输入的内容是否是数字  
344 - // if (!isNumber) {  
345 - // Utils.showToast('请输入数字');  
346 - // pNumC.text = '';  
347 - // return;  
348 - // } else {  
349 - if (value != null &&  
350 - value != '') {  
351 - if (int.parse(value) >  
352 - int.parse(  
353 - sunModel.grantNum ?? 327 + style: TextStyle(
  328 + color: MyColours
  329 + .color_438E93,
  330 + fontSize: font(11)),
  331 + textAlign: TextAlign.center,
  332 + // textAlignVertical: TextAlignVertical.center,
  333 + decoration: InputDecoration(
  334 + hintText: "数量",
  335 + isCollapsed: true,
  336 + hintStyle: TextStyle(
  337 + color: MyColours
  338 + .color_999999,
  339 + fontSize: font(11),
  340 + ),
  341 + // isCollapsed:
  342 + // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  343 + border:
  344 + OutlineInputBorder(
  345 + borderSide:
  346 + BorderSide
  347 + .none),
  348 + contentPadding:
  349 + EdgeInsets.only(
  350 + top: w(2),
  351 + bottom: w(2)),
  352 + ),
  353 + keyboardType: TextInputType
  354 + .numberWithOptions(
  355 + decimal: true),
  356 + textInputAction:
  357 + TextInputAction.done,
  358 +
  359 + onChanged: (value) {
  360 + // bool isNumber = Utils.isNumeric(
  361 + // value); //判断输入的内容是否是数字
  362 + // if (!isNumber) {
  363 + // Utils.showToast('请输入数字');
  364 + // pNumC.text = '';
  365 + // return;
  366 + // } else {
  367 + if (value != null &&
  368 + value != '') {
  369 + if (int.parse(value) >
  370 + int.parse(sunModel
  371 + .grantNum ??
354 '0')) { 372 '0')) {
355 - Utils.showToast(  
356 - '最大数量限制为${sunModel.grantNum}');  
357 - sunModel.numberC.text =  
358 - sunModel.grantNum ??  
359 - '';  
360 - sunModel.number =  
361 - int.parse(sunModel 373 + Utils.showToast(
  374 + '最大数量限制为${sunModel.grantNum}');
  375 + sunModel.numberC
  376 + .text = sunModel
362 .grantNum ?? 377 .grantNum ??
363 - '0'); 378 + '';
  379 + sunModel.number =
  380 + int.parse(sunModel
  381 + .grantNum ??
  382 + '0');
364 383
365 - return;  
366 - }  
367 - sunModel.number =  
368 - int.parse(value);  
369 - } 384 + return;
  385 + }
  386 + if (int.parse(value) >
  387 + 5) {
  388 + Utils.showToast(
  389 + '最多可设置5张');
  390 + sunModel.numberC
  391 + .text = '5';
  392 + return;
  393 + }
  394 + sunModel.number =
  395 + int.parse(value);
  396 + }
370 397
371 - // }  
372 - // setState(() {});  
373 - // _searchSellerLocation();  
374 - // customerProvider.searchData(value);  
375 - },  
376 - onEditingComplete: () {  
377 - FocusScope.of(context)  
378 - .requestFocus(  
379 - FocusNode()); //点击空白处隐藏键盘  
380 - // contantShowModel.searchData(  
381 - // contantShowModel.controller.text);  
382 - // _searchSellerLocation();  
383 - // _focusNode.unfocus(); 398 + // }
  399 + // setState(() {});
  400 + // _searchSellerLocation();
  401 + // customerProvider.searchData(value);
  402 + },
  403 + onEditingComplete: () {
  404 + FocusScope.of(context)
  405 + .requestFocus(
  406 + FocusNode()); //点击空白处隐藏键盘
  407 + // contantShowModel.searchData(
  408 + // contantShowModel.controller.text);
  409 + // _searchSellerLocation();
  410 + // _focusNode.unfocus();
  411 + },
  412 + )),
  413 + InkWell(
  414 + onTap: () {
  415 + if (sunModel.number ==
  416 + int.parse(
  417 + sunModel.grantNum ??
  418 + '0')) {
  419 + Utils.showToast(
  420 + '已达到最大数量限制');
  421 + return;
  422 + }
  423 + if (sunModel.number >= 5) {
  424 + Utils.showToast('最多可设置5张');
  425 + return;
  426 + }
  427 + sunModel.number++;
  428 + sunModel.numberC.text =
  429 + '${sunModel.number}';
384 }, 430 },
385 - )),  
386 - InkWell(  
387 - onTap: () {  
388 - if (sunModel.number ==  
389 - int.parse(sunModel.grantNum ??  
390 - '0')) {  
391 - Utils.showToast('已达到最大数量限制');  
392 - return;  
393 - }  
394 - sunModel.number++;  
395 - sunModel.numberC.text =  
396 - '${sunModel.number}';  
397 - },  
398 - child: Container(  
399 - height: w(40),  
400 - padding: EdgeInsets.only(  
401 - left: w(10), right: w(10)),  
402 - child: Image.asset(  
403 - Utils.getImgPath(  
404 - 'plan_dish_add'),  
405 - width: w(8), 431 + child: Container(
  432 + height: w(40),
  433 + padding: EdgeInsets.only(
  434 + left: w(10),
  435 + right: w(10)),
  436 + child: Image.asset(
  437 + Utils.getImgPath(
  438 + 'plan_dish_add'),
  439 + width: w(8),
  440 + ),
  441 + ),
406 ), 442 ),
407 - ), 443 + ],
408 ), 444 ),
409 - ],  
410 - ),  
411 - if (widget.from == 'setting' &&  
412 - sunModel.isType == '3')  
413 - Padding(  
414 - padding:  
415 - EdgeInsets.only(right: w(20)),  
416 - child: Text(  
417 - '${sunModel.number}张',  
418 - style: TextStyle(  
419 - fontSize: font(12),  
420 - fontWeight: FontWeight.bold,  
421 - color: MyColours.color_438E93),  
422 - ))  
423 - ],  
424 - ),  
425 - VEmptyView(16),  
426 - if (sunModel.isType == '3' &&  
427 - sunModel.expirationDate != null)  
428 - Container(  
429 - child: Text(  
430 - sunModel.expirationDate!.validForever ==  
431 - '1'  
432 - ? '使用时间:永久有效'  
433 - : '使用时间:${ObjectUtil.isNotEmpty(sunModel.expirationDate!.stime) ? Utils.getDateStrFromJiekou(sunModel.expirationDate!.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.expirationDate!.etime) ? Utils.getDateStrFromJiekou(sunModel.expirationDate!.etime) : '--'}',  
434 - style: TextStyle(  
435 - color: widget.from == 'history'  
436 - ? MyColours.color_BFC4D4  
437 - : MyColours.color_999999,  
438 - fontSize: ScreenUtil().setSp(20))),  
439 - ),  
440 - (sunModel.isType == '1' &&  
441 - ObjectUtil.isNotEmpty(  
442 - sunModel.stime) &&  
443 - sunModel.stime != '0') ||  
444 - (sunModel.isType == '1' &&  
445 - ObjectUtil.isNotEmpty(  
446 - sunModel.etime) &&  
447 - sunModel.etime != '0')  
448 - ? Container( 445 + if (widget.from == 'setting' &&
  446 + sunModel.isType == '3')
  447 + Padding(
  448 + padding:
  449 + EdgeInsets.only(right: w(20)),
  450 + child: Text(
  451 + '${sunModel.number}张',
  452 + style: TextStyle(
  453 + fontSize: font(12),
  454 + fontWeight: FontWeight.bold,
  455 + color:
  456 + MyColours.color_438E93),
  457 + ))
  458 + ],
  459 + ),
  460 + VEmptyView(16),
  461 + if (sunModel.isType == '3' &&
  462 + sunModel.expirationDate != null)
  463 + Container(
449 child: Text( 464 child: Text(
450 - '使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}', 465 + sunModel.expirationDate!
  466 + .validForever ==
  467 + '1'
  468 + ? '使用时间:永久有效'
  469 + : '使用时间:${ObjectUtil.isNotEmpty(sunModel.expirationDate!.stime) ? Utils.getDateStrFromJiekou(sunModel.expirationDate!.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.expirationDate!.etime) ? Utils.getDateStrFromJiekou(sunModel.expirationDate!.etime) : '--'}',
451 style: TextStyle( 470 style: TextStyle(
452 color: widget.from == 'history' 471 color: widget.from == 'history'
453 ? MyColours.color_BFC4D4 472 ? MyColours.color_BFC4D4
454 : MyColours.color_999999, 473 : MyColours.color_999999,
455 fontSize: 474 fontSize:
456 ScreenUtil().setSp(20))), 475 ScreenUtil().setSp(20))),
457 - )  
458 - : Container(),  
459 - ],  
460 - ),  
461 - // widget.from == 'select'  
462 - // ? widget.showCheck  
463 - // ? Positioned(  
464 - // right: 0,  
465 - // top: ScreenUtil().setWidth(20),  
466 - // child: Image.asset(  
467 - // Utils.getImgPath(widget.couponSonModel.isCheck  
468 - // ? 'check_r'  
469 - // : 'check_un'),  
470 - // width: ScreenUtil().setWidth(40),  
471 - // height: ScreenUtil().setWidth(40),  
472 - // ))  
473 - // : Container()  
474 - // :  
475 - ),  
476 - ObjectUtil.isNotEmpty(sunModel.explain)  
477 - ? const MySeparator(  
478 - width: 3, color: MyColours.color_f3f3f3)  
479 - : SizedBox(),  
480 - ObjectUtil.isNotEmpty(sunModel.explain)  
481 - ? InkWell(  
482 - onTap: () {  
483 - if (explainH > 19) {  
484 - setState(() {  
485 - widget.couponSonModel!.showText =  
486 - !widget.couponSonModel!.showText;  
487 - });  
488 - }  
489 - },  
490 - child: Container(  
491 - width: double.infinity,  
492 - decoration: BoxDecoration(  
493 - color: widget.from == 'history'  
494 - ? MyColours.color_ffffff  
495 - : notSelect 476 + ),
  477 + (sunModel.isType == '1' &&
  478 + ObjectUtil.isNotEmpty(
  479 + sunModel.stime) &&
  480 + sunModel.stime != '0') ||
  481 + (sunModel.isType == '1' &&
  482 + ObjectUtil.isNotEmpty(
  483 + sunModel.etime) &&
  484 + sunModel.etime != '0')
  485 + ? Container(
  486 + child: Text(
  487 + '使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
  488 + style: TextStyle(
  489 + color: widget.from ==
  490 + 'history'
  491 + ? MyColours.color_BFC4D4
  492 + : MyColours
  493 + .color_999999,
  494 + fontSize: ScreenUtil()
  495 + .setSp(20))),
  496 + )
  497 + : Container(),
  498 + ],
  499 + ),
  500 + // widget.from == 'select'
  501 + // ? widget.showCheck
  502 + // ? Positioned(
  503 + // right: 0,
  504 + // top: ScreenUtil().setWidth(20),
  505 + // child: Image.asset(
  506 + // Utils.getImgPath(widget.couponSonModel.isCheck
  507 + // ? 'check_r'
  508 + // : 'check_un'),
  509 + // width: ScreenUtil().setWidth(40),
  510 + // height: ScreenUtil().setWidth(40),
  511 + // ))
  512 + // : Container()
  513 + // :
  514 + ),
  515 + ObjectUtil.isNotEmpty(sunModel.explain)
  516 + ? const MySeparator(
  517 + width: 3, color: MyColours.color_f3f3f3)
  518 + : SizedBox(),
  519 + ObjectUtil.isNotEmpty(sunModel.explain)
  520 + ? InkWell(
  521 + onTap: () {
  522 + if (explainH > 19) {
  523 + setState(() {
  524 + widget.couponSonModel!.showText =
  525 + !widget
  526 + .couponSonModel!.showText;
  527 + });
  528 + }
  529 + },
  530 + child: Container(
  531 + width: double.infinity,
  532 + decoration: BoxDecoration(
  533 + color: widget.from == 'history'
496 ? MyColours.color_ffffff 534 ? MyColours.color_ffffff
497 - : MyColours.color_FAFAFA,  
498 - borderRadius: BorderRadius.only(  
499 - bottomLeft: Radius.circular(  
500 - ScreenUtil().setWidth(20)),  
501 - bottomRight: Radius.circular(  
502 - ScreenUtil().setWidth(20)))),  
503 - child: Row(  
504 - crossAxisAlignment:  
505 - CrossAxisAlignment.start,  
506 - children: [  
507 - widget.couponSonModel!.showText  
508 - ? Container(  
509 - padding: EdgeInsets.fromLTRB( 535 + : notSelect
  536 + ? MyColours.color_ffffff
  537 + : MyColours.color_FAFAFA,
  538 + borderRadius: BorderRadius.only(
  539 + bottomLeft: Radius.circular(
510 ScreenUtil() 540 ScreenUtil()
511 - .setWidth(24 * 2),  
512 - ScreenUtil().setWidth(14),  
513 - ScreenUtil().setWidth(0), 541 + .setWidth(20)),
  542 + bottomRight: Radius.circular(
514 ScreenUtil() 543 ScreenUtil()
515 - .setWidth(14)),  
516 - width:  
517 - ScreenUtil().screenWidth - 544 + .setWidth(20)))),
  545 + child: Row(
  546 + crossAxisAlignment:
  547 + CrossAxisAlignment.start,
  548 + children: [
  549 + widget.couponSonModel!.showText
  550 + ? Container(
  551 + padding:
  552 + EdgeInsets.fromLTRB(
  553 + ScreenUtil()
  554 + .setWidth(
  555 + 24 * 2),
  556 + ScreenUtil()
  557 + .setWidth(14),
  558 + ScreenUtil()
  559 + .setWidth(0),
  560 + ScreenUtil()
  561 + .setWidth(
  562 + 14)),
  563 + width: ScreenUtil()
  564 + .screenWidth -
518 ScreenUtil() 565 ScreenUtil()
519 .setWidth(92 * 2), 566 .setWidth(92 * 2),
520 - child: Text(  
521 - '说明:${sunModel.explain}',  
522 - maxLines: 5,  
523 - style: TextStyle(  
524 - color: widget.from ==  
525 - 'history'  
526 - ? MyColours  
527 - .color_BFC4D4  
528 - : MyColours  
529 - .color_999999,  
530 - fontSize: ScreenUtil()  
531 - .setSp(20))),  
532 - )  
533 - : Container(  
534 - padding: EdgeInsets.fromLTRB(  
535 - ScreenUtil()  
536 - .setWidth(24 * 2),  
537 - ScreenUtil().setWidth(14),  
538 - ScreenUtil().setWidth(0),  
539 - ScreenUtil()  
540 - .setWidth(14)),  
541 - width: ScreenUtil()  
542 - .screenWidth -  
543 - ScreenUtil()  
544 - .setWidth(92 * 2) +  
545 - ScreenUtil().setWidth(20),  
546 - child: Text(  
547 - '说明:${sunModel.explain}',  
548 - maxLines: 1,  
549 - overflow:  
550 - TextOverflow.fade,  
551 - softWrap: false,  
552 - style: TextStyle(  
553 - color: widget.from ==  
554 - 'history'  
555 - ? MyColours  
556 - .color_BFC4D4  
557 - : MyColours  
558 - .color_999999,  
559 - fontSize: ScreenUtil()  
560 - .setSp(20))),  
561 - ),  
562 - Spacer(),  
563 - explainH > 19  
564 - ? Container(  
565 - margin: EdgeInsets.only(  
566 - top: ScreenUtil()  
567 - .setWidth(10),  
568 - right: ScreenUtil()  
569 - .setWidth(16)),  
570 - child: Image.asset(  
571 - !widget.couponSonModel!  
572 - .showText  
573 - ? Utils.getImgPath(  
574 - 'quan_down_f')  
575 - : Utils.getImgPath(  
576 - 'quan_up_f'), 567 + child: Text(
  568 + '说明:${sunModel.explain}',
  569 + maxLines: 5,
  570 + style: TextStyle(
  571 + color: widget
  572 + .from ==
  573 + 'history'
  574 + ? MyColours
  575 + .color_BFC4D4
  576 + : MyColours
  577 + .color_999999,
  578 + fontSize:
  579 + ScreenUtil()
  580 + .setSp(
  581 + 20))),
  582 + )
  583 + : Container(
  584 + padding:
  585 + EdgeInsets.fromLTRB(
  586 + ScreenUtil()
  587 + .setWidth(
  588 + 24 * 2),
  589 + ScreenUtil()
  590 + .setWidth(14),
  591 + ScreenUtil()
  592 + .setWidth(0),
  593 + ScreenUtil()
  594 + .setWidth(
  595 + 14)),
577 width: ScreenUtil() 596 width: ScreenUtil()
578 - .setWidth(28),  
579 - height: ScreenUtil()  
580 - .setWidth(28)),  
581 - )  
582 - : Container(),  
583 - HEmptyView(14)  
584 - ],  
585 - )),  
586 - )  
587 - : Container(),  
588 - VEmptyView(32),  
589 - ],  
590 - ),  
591 - )),  
592 - ],  
593 - ),  
594 - Positioned(  
595 - right: ScreenUtil().setWidth(100),  
596 - top: ScreenUtil().setWidth(37 * 2),  
597 - child: widget.showBtn  
598 - ? RoundButton(  
599 - width: widget.from == 'history'  
600 - ? ScreenUtil().setWidth(44 * 2)  
601 - : ScreenUtil().setWidth(32 * 2),  
602 - height: ScreenUtil().setWidth(21 * 2),  
603 - radius: ScreenUtil().setWidth(10),  
604 - text: widget.from == 'history'  
605 - ? '已过期'  
606 - : notSelect  
607 - ? '停用'  
608 - : '启用',  
609 - fontSize: 24,  
610 - textColor: widget.from == 'history'  
611 - ? MyColours.color_BFC4D4  
612 - : widget.canOperate && notSelect  
613 - ? MyColours.color_438E93  
614 - : MyColours.color_999999,  
615 - gradientStart: MyColours.color_ffffff,  
616 - gradientEnd: MyColours.color_ffffff,  
617 - borderColor: widget.from == 'history'  
618 - ? MyColours.color_BFC4D4  
619 - : widget.canOperate && notSelect  
620 - ? MyColours.color_438E93  
621 - : MyColours.color_999999,  
622 - onPressed: widget.onPressedSwich,  
623 - )  
624 - : Container())  
625 - ]),  
626 - VEmptyView(32)  
627 - ])); 597 + .screenWidth -
  598 + ScreenUtil().setWidth(
  599 + 92 * 2) +
  600 + ScreenUtil()
  601 + .setWidth(20),
  602 + child: Text(
  603 + '说明:${sunModel.explain}',
  604 + maxLines: 1,
  605 + overflow:
  606 + TextOverflow.fade,
  607 + softWrap: false,
  608 + style: TextStyle(
  609 + color: widget
  610 + .from ==
  611 + 'history'
  612 + ? MyColours
  613 + .color_BFC4D4
  614 + : MyColours
  615 + .color_999999,
  616 + fontSize:
  617 + ScreenUtil()
  618 + .setSp(
  619 + 20))),
  620 + ),
  621 + Spacer(),
  622 + explainH > 19
  623 + ? Container(
  624 + margin: EdgeInsets.only(
  625 + top: ScreenUtil()
  626 + .setWidth(10),
  627 + right: ScreenUtil()
  628 + .setWidth(16)),
  629 + child: Image.asset(
  630 + !widget.couponSonModel!
  631 + .showText
  632 + ? Utils.getImgPath(
  633 + 'quan_down_f')
  634 + : Utils.getImgPath(
  635 + 'quan_up_f'),
  636 + width: ScreenUtil()
  637 + .setWidth(28),
  638 + height: ScreenUtil()
  639 + .setWidth(28)),
  640 + )
  641 + : Container(),
  642 + HEmptyView(14)
  643 + ],
  644 + )),
  645 + )
  646 + : Container(),
  647 + VEmptyView(32),
  648 + ],
  649 + ),
  650 + )),
  651 + ],
  652 + ),
  653 + Positioned(
  654 + right: ScreenUtil().setWidth(100),
  655 + top: ScreenUtil().setWidth(37 * 2),
  656 + child: widget.showBtn
  657 + ? RoundButton(
  658 + width: widget.from == 'history'
  659 + ? ScreenUtil().setWidth(44 * 2)
  660 + : ScreenUtil().setWidth(32 * 2),
  661 + height: ScreenUtil().setWidth(21 * 2),
  662 + radius: ScreenUtil().setWidth(10),
  663 + text: widget.from == 'history'
  664 + ? '已过期'
  665 + : notSelect
  666 + ? '停用'
  667 + : '启用',
  668 + fontSize: 24,
  669 + textColor: widget.from == 'history'
  670 + ? MyColours.color_BFC4D4
  671 + : widget.canOperate && notSelect
  672 + ? MyColours.color_438E93
  673 + : MyColours.color_999999,
  674 + gradientStart: MyColours.color_ffffff,
  675 + gradientEnd: MyColours.color_ffffff,
  676 + borderColor: widget.from == 'history'
  677 + ? MyColours.color_BFC4D4
  678 + : widget.canOperate && notSelect
  679 + ? MyColours.color_438E93
  680 + : MyColours.color_999999,
  681 + onPressed: widget.onPressedSwich,
  682 + )
  683 + : Container())
  684 + ]),
  685 + VEmptyView(32)
  686 + ])));
628 } 687 }
629 } 688 }