Commit d3ce4913629ce68e6ad351f3dbf465f9aa8f976b

Authored by wdn127929
1 parent c6b76629

创建免费券有效期和用户领取后有效期 UI 调整

@@ -83,8 +83,8 @@ android { @@ -83,8 +83,8 @@ android {
83 83
84 ndk { 84 ndk {
85 //选择要添加的对应 cpu 类型的 .so 库。 85 //选择要添加的对应 cpu 类型的 .so 库。
86 - abiFilters 'arm64-v8a', 'x86_64', 'mips64' //魅族64位,不支持32位  
87 - // abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86_64','x86', 'mips', 'mips64' 86 + // abiFilters 'arm64-v8a', 'x86_64', 'mips64' //魅族64位,不支持32位
  87 + abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86_64','x86', 'mips', 'mips64'
88 } 88 }
89 89
90 lintOptions { 90 lintOptions {
@@ -63,8 +63,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -63,8 +63,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
63 final heightCell = ScreenUtil().setWidth(48 * 2); 63 final heightCell = ScreenUtil().setWidth(48 * 2);
64 bool swichState = true; //默认启用 开关状态 64 bool swichState = true; //默认启用 开关状态
65 final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); 65 final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
66 - String fromDate = '点击选择'; //有效期开始时间  
67 - String endDate = '点击选择'; //有效期结束时间 66 + String fromDate = '点击选择开始日期'; //有效期开始时间
  67 + String endDate = '点击选择结束日期'; //有效期结束时间
68 FocusNode _nameFocusNode = FocusNode(); 68 FocusNode _nameFocusNode = FocusNode();
69 FocusNode _requireFocusNode = FocusNode(); 69 FocusNode _requireFocusNode = FocusNode();
70 bool showDateSelWidget = false; 70 bool showDateSelWidget = false;
@@ -122,6 +122,20 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -122,6 +122,20 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
122 122
123 late StoreBaseIndoProvider storeBaseIndoProvider; 123 late StoreBaseIndoProvider storeBaseIndoProvider;
124 124
  125 + bool validForever = false;
  126 + bool validForeverCus = false;
  127 + bool fromToEndDateCus = true;
  128 + bool todayCus = false;
  129 + bool tomorrowCus = false;
  130 + bool fromToEndDayCus = false;
  131 + String fromDateCus = '点击选择开始日期'; //领取后有效期开始时间
  132 + String endDateCus = '点击选择结束日期'; //领取后有效期结束时间
  133 +
  134 + TextEditingController todayC = TextEditingController();
  135 + TextEditingController tomorrowC = TextEditingController();
  136 +
  137 + TextEditingController fromDayC = TextEditingController();
  138 + TextEditingController endDayC = TextEditingController();
125 @override 139 @override
126 void initState() { 140 void initState() {
127 super.initState(); 141 super.initState();
@@ -225,7 +239,6 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -225,7 +239,6 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
225 swichState = widget.couponSunModel!.status == '1' ? true : false; 239 swichState = widget.couponSunModel!.status == '1' ? true : false;
226 _priceControl.text = widget.couponSunModel!.price; 240 _priceControl.text = widget.couponSunModel!.price;
227 _limitDay.text = widget.couponSunModel!.aexpiration ?? ''; 241 _limitDay.text = widget.couponSunModel!.aexpiration ?? '';
228 -  
229 242
230 isSameDay = widget.couponSunModel!.arule!.isSameDay; 243 isSameDay = widget.couponSunModel!.arule!.isSameDay;
231 isAccumulation = widget.couponSunModel!.arule!.isAccumulation; 244 isAccumulation = widget.couponSunModel!.arule!.isAccumulation;
@@ -1183,83 +1196,83 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1183,83 +1196,83 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1183 color: MyColours.color_E7E7E7, 1196 color: MyColours.color_E7E7E7,
1184 ), 1197 ),
1185 VEmptyView(24), 1198 VEmptyView(24),
1186 - _select('活动开始于', fromDate, () {  
1187 - FocusScope.of(context)  
1188 - .requestFocus(FocusNode()); //点击空白处隐藏键盘  
1189 - //弹出时间选择器  
1190 - // showPickerDateTime(context);  
1191 - showDateSelWidget = true;  
1192 - DialogUtil.showPickerDateTime24(  
1193 - context,  
1194 - scaffoldKey,  
1195 - (value) {  
1196 - // {'text': picker.adapter.text, 'select': selecteds}  
1197 - if (value != null) {  
1198 - setState(() {  
1199 - print(value);  
1200 - fromDate = DateUtil.formatDateStr(  
1201 - value,  
1202 - format: DateFormats.y_mo_d);  
1203 - });  
1204 - }  
1205 - showDateSelWidget = false;  
1206 - },  
1207 - dateTime: fromDate == '点击选择'  
1208 - ? null  
1209 - : DateUtil.getDateTime(fromDate),  
1210 - pickerDateTimeType: PickerDateTimeType.kYMD,  
1211 - onCancel: () {  
1212 - showDateSelWidget = false;  
1213 - });  
1214 - }),  
1215 - Container(  
1216 - height: ScreenUtil().setWidth(2),  
1217 - color: MyColours.color_E7E7E7,  
1218 - ),  
1219 - VEmptyView(24),  
1220 - _select('活动结束于', endDate, () {  
1221 - FocusScope.of(context)  
1222 - .requestFocus(FocusNode()); //点击空白处隐藏键盘  
1223 - //弹出时间选择器  
1224 - // showPickerDateTime(context);  
1225 - showDateSelWidget = true;  
1226 - DialogUtil.showPickerDateTime24(  
1227 - context,  
1228 - scaffoldKey,  
1229 - (value) {  
1230 - // {'text': picker.adapter.text, 'select': selecteds}  
1231 - if (value != null) {  
1232 - setState(() {  
1233 - print(value);  
1234 - endDate = DateUtil.formatDateStr(  
1235 - value,  
1236 - format: DateFormats.y_mo_d);  
1237 - });  
1238 - }  
1239 - showDateSelWidget = false;  
1240 - },  
1241 - dateTime: endDate == '点击选择'  
1242 - ? null  
1243 - : DateUtil.getDateTime(endDate),  
1244 - pickerDateTimeType: PickerDateTimeType.kYMD,  
1245 - onCancel: () {  
1246 - showDateSelWidget = false;  
1247 - });  
1248 - }),  
1249 - Container(  
1250 - height: ScreenUtil().setWidth(2),  
1251 - color: MyColours.color_E7E7E7,  
1252 - ),  
1253 - VEmptyView(48), 1199 + // _select('活动开始于', fromDate, () {
  1200 + // FocusScope.of(context)
  1201 + // .requestFocus(FocusNode()); //点击空白处隐藏键盘
  1202 + // //弹出时间选择器
  1203 + // // showPickerDateTime(context);
  1204 + // showDateSelWidget = true;
  1205 + // DialogUtil.showPickerDateTime24(
  1206 + // context,
  1207 + // scaffoldKey,
  1208 + // (value) {
  1209 + // // {'text': picker.adapter.text, 'select': selecteds}
  1210 + // if (value != null) {
  1211 + // setState(() {
  1212 + // print(value);
  1213 + // fromDate = DateUtil.formatDateStr(
  1214 + // value,
  1215 + // format: DateFormats.y_mo_d);
  1216 + // });
  1217 + // }
  1218 + // showDateSelWidget = false;
  1219 + // },
  1220 + // dateTime: fromDate == '点击选择'
  1221 + // ? null
  1222 + // : DateUtil.getDateTime(fromDate),
  1223 + // pickerDateTimeType: PickerDateTimeType.kYMD,
  1224 + // onCancel: () {
  1225 + // showDateSelWidget = false;
  1226 + // });
  1227 + // }),
  1228 + // Container(
  1229 + // height: ScreenUtil().setWidth(2),
  1230 + // color: MyColours.color_E7E7E7,
  1231 + // ),
  1232 + // VEmptyView(24),
  1233 + // _select('活动结束于', endDate, () {
  1234 + // FocusScope.of(context)
  1235 + // .requestFocus(FocusNode()); //点击空白处隐藏键盘
  1236 + // //弹出时间选择器
  1237 + // // showPickerDateTime(context);
  1238 + // showDateSelWidget = true;
  1239 + // DialogUtil.showPickerDateTime24(
  1240 + // context,
  1241 + // scaffoldKey,
  1242 + // (value) {
  1243 + // // {'text': picker.adapter.text, 'select': selecteds}
  1244 + // if (value != null) {
  1245 + // setState(() {
  1246 + // print(value);
  1247 + // endDate = DateUtil.formatDateStr(
  1248 + // value,
  1249 + // format: DateFormats.y_mo_d);
  1250 + // });
  1251 + // }
  1252 + // showDateSelWidget = false;
  1253 + // },
  1254 + // dateTime: endDate == '点击选择'
  1255 + // ? null
  1256 + // : DateUtil.getDateTime(endDate),
  1257 + // pickerDateTimeType: PickerDateTimeType.kYMD,
  1258 + // onCancel: () {
  1259 + // showDateSelWidget = false;
  1260 + // });
  1261 + // }),
  1262 + // Container(
  1263 + // height: ScreenUtil().setWidth(2),
  1264 + // color: MyColours.color_E7E7E7,
  1265 + // ),
  1266 + // VEmptyView(48),
1254 1267
1255 - _textfield('领取后有效天数', '点击输入,0表示到活动结束', _limitDay,  
1256 - _limitDayFocusNode,  
1257 - textInputType: TextInputType.number),  
1258 - Container(  
1259 - height: ScreenUtil().setWidth(2),  
1260 - color: MyColours.color_E7E7E7,  
1261 - ),  
1262 - VEmptyView(24), 1268 + // _textfield('领取后有效天数', '点击输入,0表示到活动结束', _limitDay,
  1269 + // _limitDayFocusNode,
  1270 + // textInputType: TextInputType.number),
  1271 + // Container(
  1272 + // height: ScreenUtil().setWidth(2),
  1273 + // color: MyColours.color_E7E7E7,
  1274 + // ),
  1275 + // VEmptyView(24),
1263 1276
1264 _select('不可用日期', weekShow, () async { 1277 _select('不可用日期', weekShow, () async {
1265 if (storeBaseIndoProvider.dayDateData == null || 1278 if (storeBaseIndoProvider.dayDateData == null ||
@@ -1455,6 +1468,798 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1455,6 +1468,798 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1455 Container( 1468 Container(
1456 alignment: Alignment.centerLeft, 1469 alignment: Alignment.centerLeft,
1457 child: Text( 1470 child: Text(
  1471 + '活动有效期',
  1472 + style: TextStyle(
  1473 + color: Color.fromRGBO(0, 0, 0, 0.9),
  1474 + fontWeight: FontWeight.bold,
  1475 + fontSize: ScreenUtil().setSp(32)),
  1476 + ),
  1477 + ),
  1478 + // VEmptyView(24),
  1479 + // Container(
  1480 + // height: ScreenUtil().setWidth(2),
  1481 + // color: MyColours.color_E7E7E7,
  1482 + // ),
  1483 + VEmptyView(16),
  1484 + Padding(
  1485 + padding: EdgeInsets.only(
  1486 + left: w(16),
  1487 + ),
  1488 + child: Column(children: [
  1489 + InkWell(
  1490 + onTap: () {
  1491 + setState(() {
  1492 + validForever = !validForever;
  1493 + });
  1494 + },
  1495 + child: Padding(
  1496 + padding: EdgeInsets.only(
  1497 + top: w(8), bottom: w(8)),
  1498 + child: Row(
  1499 + children: [
  1500 + Image.asset(
  1501 + Utils.getImgPath(validForever
  1502 + ? 'base_radio_sel'
  1503 + : 'base_radio_un'),
  1504 + width: w(20),
  1505 + ),
  1506 + HEmptyView(10),
  1507 + Text('永久有效',
  1508 + style: TextStyle(
  1509 + fontSize: font(14),
  1510 + color: MyColours
  1511 + .color_515151))
  1512 + ],
  1513 + ))),
  1514 + Padding(
  1515 + padding: EdgeInsets.only(
  1516 + top: w(3), bottom: w(3)),
  1517 + child: Row(
  1518 + children: [
  1519 + InkWell(
  1520 + onTap: () {
  1521 + setState(() {
  1522 + validForever =
  1523 + !validForever;
  1524 + });
  1525 + },
  1526 + child: Padding(
  1527 + padding: EdgeInsets.only(
  1528 + right: w(10)),
  1529 + child: Image.asset(
  1530 + Utils.getImgPath(
  1531 + !validForever
  1532 + ? 'base_radio_sel'
  1533 + : 'base_radio_un'),
  1534 + width: w(20),
  1535 + ))),
  1536 + InkWell(
  1537 + onTap: () {
  1538 + FocusScope.of(context)
  1539 + .requestFocus(
  1540 + FocusNode()); //点击空白处隐藏键盘
  1541 + //弹出时间选择器
  1542 + // showPickerDateTime(context);
  1543 + showDateSelWidget = true;
  1544 + DialogUtil
  1545 + .showPickerDateTime24(
  1546 + context,
  1547 + scaffoldKey,
  1548 + (value) {
  1549 + // {'text': picker.adapter.text, 'select': selecteds}
  1550 + if (value != null) {
  1551 + setState(() {
  1552 + print(value);
  1553 + fromDate = DateUtil
  1554 + .formatDateStr(
  1555 + value,
  1556 + format:
  1557 + DateFormats.y_mo_d);
  1558 + });
  1559 + }
  1560 + showDateSelWidget =
  1561 + false;
  1562 + },
  1563 + dateTime: fromDate ==
  1564 + '点击选择开始日期'
  1565 + ? null
  1566 + : DateUtil
  1567 + .getDateTime(
  1568 + fromDate),
  1569 + pickerDateTimeType:
  1570 + PickerDateTimeType
  1571 + .kYMD,
  1572 + onCancel: () {
  1573 + showDateSelWidget =
  1574 + false;
  1575 + });
  1576 + },
  1577 + child: Container(
  1578 + height: w(34),
  1579 + padding: EdgeInsets.all(w(5)),
  1580 + alignment: Alignment.center,
  1581 + decoration: BoxDecoration(
  1582 + border: Border.all(
  1583 + width: w(1),
  1584 + color: MyColours
  1585 + .color_515151)),
  1586 + child: Text(fromDate,
  1587 + style: TextStyle(
  1588 + fontSize: font(14),
  1589 + color: fromDate ==
  1590 + '点击选择开始日期'
  1591 + ? MyColours
  1592 + .color_999999
  1593 + : MyColours
  1594 + .color_515151)),
  1595 + )),
  1596 + HEmptyView(10),
  1597 + Text('至',
  1598 + style: TextStyle(
  1599 + fontSize: font(14),
  1600 + color: MyColours
  1601 + .color_999999)),
  1602 + HEmptyView(10),
  1603 + InkWell(
  1604 + onTap: () {
  1605 + FocusScope.of(context)
  1606 + .requestFocus(
  1607 + FocusNode()); //点击空白处隐藏键盘
  1608 + //弹出时间选择器
  1609 + // showPickerDateTime(context);
  1610 + showDateSelWidget = true;
  1611 + DialogUtil
  1612 + .showPickerDateTime24(
  1613 + context,
  1614 + scaffoldKey,
  1615 + (value) {
  1616 + // {'text': picker.adapter.text, 'select': selecteds}
  1617 + if (value != null) {
  1618 + setState(() {
  1619 + print(value);
  1620 + endDate = DateUtil
  1621 + .formatDateStr(
  1622 + value,
  1623 + format:
  1624 + DateFormats.y_mo_d);
  1625 + });
  1626 + }
  1627 + showDateSelWidget =
  1628 + false;
  1629 + },
  1630 + dateTime: endDate ==
  1631 + '点击选择结束日期'
  1632 + ? null
  1633 + : DateUtil
  1634 + .getDateTime(
  1635 + endDate),
  1636 + pickerDateTimeType:
  1637 + PickerDateTimeType
  1638 + .kYMD,
  1639 + onCancel: () {
  1640 + showDateSelWidget =
  1641 + false;
  1642 + });
  1643 + },
  1644 + child: Container(
  1645 + height: w(34),
  1646 + padding: EdgeInsets.all(w(5)),
  1647 + alignment: Alignment.center,
  1648 + decoration: BoxDecoration(
  1649 + border: Border.all(
  1650 + width: w(1),
  1651 + color: MyColours
  1652 + .color_515151)),
  1653 + child: Text(endDate,
  1654 + style: TextStyle(
  1655 + fontSize: font(14),
  1656 + color: endDate == '点击选择结束日期'
  1657 + ? MyColours
  1658 + .color_999999
  1659 + : MyColours
  1660 + .color_515151)),
  1661 + )),
  1662 + ],
  1663 + ))
  1664 + ])),
  1665 + VEmptyView(20),
  1666 +
  1667 + Container(
  1668 + height: ScreenUtil().setWidth(2),
  1669 + color: MyColours.color_E7E7E7,
  1670 + ),
  1671 + VEmptyView(60),
  1672 +
  1673 + Container(
  1674 + alignment: Alignment.centerLeft,
  1675 + child: Text(
  1676 + '用户领取后有效期:',
  1677 + style: TextStyle(
  1678 + color: Color.fromRGBO(0, 0, 0, 0.9),
  1679 + fontWeight: FontWeight.bold,
  1680 + fontSize: ScreenUtil().setSp(32)),
  1681 + ),
  1682 + ),
  1683 + // VEmptyView(24),
  1684 + // Container(
  1685 + // height: ScreenUtil().setWidth(2),
  1686 + // color: MyColours.color_E7E7E7,
  1687 + // ),
  1688 + VEmptyView(16),
  1689 + Padding(
  1690 + padding: EdgeInsets.only(
  1691 + left: w(16),
  1692 + ),
  1693 + child: Column(children: [
  1694 + InkWell(
  1695 + onTap: () {
  1696 + validForeverCus = true;
  1697 + fromToEndDateCus = false;
  1698 + todayCus = false;
  1699 + tomorrowCus = false;
  1700 + fromToEndDayCus = false;
  1701 + setState(() {});
  1702 + },
  1703 + child: Padding(
  1704 + padding: EdgeInsets.only(
  1705 + top: w(8), bottom: w(8)),
  1706 + child: Row(
  1707 + children: [
  1708 + Image.asset(
  1709 + Utils.getImgPath(
  1710 + validForeverCus
  1711 + ? 'base_radio_sel'
  1712 + : 'base_radio_un'),
  1713 + width: w(20),
  1714 + ),
  1715 + HEmptyView(10),
  1716 + Text('永久有效',
  1717 + style: TextStyle(
  1718 + fontSize: font(14),
  1719 + color: MyColours
  1720 + .color_515151))
  1721 + ],
  1722 + ))),
  1723 + Padding(
  1724 + padding: EdgeInsets.only(
  1725 + top: w(3), bottom: w(3)),
  1726 + child: Row(
  1727 + children: [
  1728 + InkWell(
  1729 + onTap: () {
  1730 + validForeverCus = false;
  1731 + fromToEndDateCus = true;
  1732 + todayCus = false;
  1733 + tomorrowCus = false;
  1734 + fromToEndDayCus = false;
  1735 + setState(() {});
  1736 + },
  1737 + child: Padding(
  1738 + padding: EdgeInsets.only(
  1739 + right: w(10)),
  1740 + child: Image.asset(
  1741 + Utils.getImgPath(
  1742 + fromToEndDateCus
  1743 + ? 'base_radio_sel'
  1744 + : 'base_radio_un'),
  1745 + width: w(20),
  1746 + ))),
  1747 + InkWell(
  1748 + onTap: () {
  1749 + if (fromDate == '点击选择开始日期') {
  1750 + Utils.showToast(
  1751 + '请先选择活动有效期的开始时间!');
  1752 + return;
  1753 + }
  1754 +
  1755 + FocusScope.of(context)
  1756 + .requestFocus(
  1757 + FocusNode()); //点击空白处隐藏键盘
  1758 + //弹出时间选择器
  1759 + // showPickerDateTime(context);
  1760 + showDateSelWidget = true;
  1761 + DialogUtil
  1762 + .showPickerDateTime24(
  1763 + context,
  1764 + scaffoldKey,
  1765 + (value) {
  1766 + // {'text': picker.adapter.text, 'select': selecteds}
  1767 + if (value != null) {
  1768 + setState(() {
  1769 + print(value);
  1770 + fromDateCus = DateUtil
  1771 + .formatDateStr(
  1772 + value,
  1773 + format:
  1774 + DateFormats.y_mo_d);
  1775 + });
  1776 + }
  1777 + showDateSelWidget =
  1778 + false;
  1779 + },
  1780 + dateTime: fromDateCus ==
  1781 + '点击选择开始日期'
  1782 + ? null
  1783 + : DateUtil
  1784 + .getDateTime(
  1785 + fromDateCus),
  1786 + pickerDateTimeType:
  1787 + PickerDateTimeType
  1788 + .kYMD,
  1789 + onCancel: () {
  1790 + showDateSelWidget =
  1791 + false;
  1792 + });
  1793 + },
  1794 + child: Container(
  1795 + height: w(34),
  1796 + padding: EdgeInsets.all(w(5)),
  1797 + alignment: Alignment.center,
  1798 + decoration: BoxDecoration(
  1799 + border: Border.all(
  1800 + width: w(1),
  1801 + color: MyColours
  1802 + .color_515151)),
  1803 + child: Text(fromDateCus,
  1804 + style: TextStyle(
  1805 + fontSize: font(14),
  1806 + color: MyColours
  1807 + .color_999999)),
  1808 + )),
  1809 + HEmptyView(10),
  1810 + Text('至',
  1811 + style: TextStyle(
  1812 + fontSize: font(14),
  1813 + color: MyColours
  1814 + .color_999999)),
  1815 + HEmptyView(10),
  1816 + InkWell(
  1817 + onTap: () {
  1818 + if (endDate == '点击选择结束日期') {
  1819 + Utils.showToast(
  1820 + '请先选择活动有效期的结束时间!');
  1821 + return;
  1822 + }
  1823 + FocusScope.of(context)
  1824 + .requestFocus(
  1825 + FocusNode()); //点击空白处隐藏键盘
  1826 + //弹出时间选择器
  1827 + // showPickerDateTime(context);
  1828 + showDateSelWidget = true;
  1829 + DialogUtil
  1830 + .showPickerDateTime24(
  1831 + context,
  1832 + scaffoldKey,
  1833 + (value) {
  1834 + // {'text': picker.adapter.text, 'select': selecteds}
  1835 + if (value != null) {
  1836 + setState(() {
  1837 + print(value);
  1838 + endDateCus = DateUtil
  1839 + .formatDateStr(
  1840 + value,
  1841 + format:
  1842 + DateFormats.y_mo_d);
  1843 + });
  1844 + }
  1845 + showDateSelWidget =
  1846 + false;
  1847 + },
  1848 + dateTime: endDateCus ==
  1849 + '点击选择结束日期'
  1850 + ? null
  1851 + : DateUtil
  1852 + .getDateTime(
  1853 + endDateCus),
  1854 + pickerDateTimeType:
  1855 + PickerDateTimeType
  1856 + .kYMD,
  1857 + onCancel: () {
  1858 + showDateSelWidget =
  1859 + false;
  1860 + });
  1861 + },
  1862 + child: Container(
  1863 + height: w(34),
  1864 + padding: EdgeInsets.all(w(5)),
  1865 + alignment: Alignment.center,
  1866 + decoration: BoxDecoration(
  1867 + border: Border.all(
  1868 + width: w(1),
  1869 + color: MyColours
  1870 + .color_515151)),
  1871 + child: Text(endDateCus,
  1872 + style: TextStyle(
  1873 + fontSize: font(14),
  1874 + color: MyColours
  1875 + .color_999999)),
  1876 + )),
  1877 + ],
  1878 + )),
  1879 + Padding(
  1880 + padding: EdgeInsets.only(
  1881 + top: w(3), bottom: w(3)),
  1882 + child: Row(
  1883 + children: [
  1884 + InkWell(
  1885 + onTap: () {
  1886 + validForeverCus = false;
  1887 + fromToEndDateCus = false;
  1888 + todayCus = true;
  1889 + tomorrowCus = false;
  1890 + fromToEndDayCus = false;
  1891 + setState(() {});
  1892 + },
  1893 + child: Padding(
  1894 + padding: EdgeInsets.only(
  1895 + right: w(10)),
  1896 + child: Image.asset(
  1897 + Utils.getImgPath(todayCus
  1898 + ? 'base_radio_sel'
  1899 + : 'base_radio_un'),
  1900 + width: w(20),
  1901 + ))),
  1902 + Text('领券当日起',
  1903 + style: TextStyle(
  1904 + fontSize: font(14),
  1905 + color: MyColours
  1906 + .color_515151)),
  1907 + HEmptyView(10),
  1908 + Container(
  1909 + width: w(100),
  1910 + height: w(34),
  1911 + padding: EdgeInsets.all(w(5)),
  1912 + alignment: Alignment.center,
  1913 + decoration: BoxDecoration(
  1914 + border: Border.all(
  1915 + width: w(1),
  1916 + color: MyColours
  1917 + .color_515151)),
  1918 + child: TextField(
  1919 + maxLines: 1,
  1920 + controller: todayC,
  1921 + // focusNode: _focusNode,
  1922 + // autofocus: true,
  1923 + textAlign: TextAlign.center,
  1924 + style: TextStyle(
  1925 + color:
  1926 + MyColours.color_515151,
  1927 + fontSize:
  1928 + ScreenUtil().setSp(28)),
  1929 + // textAlignVertical: TextAlignVertical.center,
  1930 + inputFormatters: [
  1931 + FilteringTextInputFormatter
  1932 + .digitsOnly
  1933 + ],
  1934 + decoration: InputDecoration(
  1935 + hintText: '点击输入多少',
  1936 + hintStyle: TextStyle(
  1937 + color: MyColours
  1938 + .color_66000000,
  1939 + fontSize:
  1940 + ScreenUtil().setSp(28),
  1941 + ),
  1942 + isCollapsed:
  1943 + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  1944 + border: OutlineInputBorder(
  1945 + borderSide:
  1946 + BorderSide.none),
  1947 + contentPadding:
  1948 + EdgeInsets.zero,
  1949 + ),
  1950 + keyboardType: TextInputType
  1951 + .numberWithOptions(),
  1952 + textInputAction:
  1953 + TextInputAction.done,
  1954 +
  1955 + onChanged: (value) {
  1956 + // setState(() {});
  1957 + // _searchSellerLocation();
  1958 + // customerProvider.searchData(value);
  1959 + },
  1960 + onEditingComplete: () {
  1961 + FocusScope.of(context)
  1962 + .requestFocus(
  1963 + FocusNode()); //点击空白处隐藏键盘
  1964 + // contantShowModel.searchData(
  1965 + // contantShowModel.controller.text);
  1966 + // _searchSellerLocation();
  1967 + // _focusNode.unfocus();
  1968 + },
  1969 + ),
  1970 + ),
  1971 + HEmptyView(10),
  1972 + Text('天内可用',
  1973 + style: TextStyle(
  1974 + fontSize: font(14),
  1975 + color: MyColours
  1976 + .color_515151)),
  1977 + ],
  1978 + )),
  1979 + Padding(
  1980 + padding: EdgeInsets.only(
  1981 + top: w(3), bottom: w(3)),
  1982 + child: Row(
  1983 + children: [
  1984 + InkWell(
  1985 + onTap: () {
  1986 + validForeverCus = false;
  1987 + fromToEndDateCus = false;
  1988 + todayCus = false;
  1989 + tomorrowCus = true;
  1990 + fromToEndDayCus = false;
  1991 + setState(() {});
  1992 + },
  1993 + child: Padding(
  1994 + padding: EdgeInsets.only(
  1995 + right: w(10)),
  1996 + child: Image.asset(
  1997 + Utils.getImgPath(
  1998 + tomorrowCus
  1999 + ? 'base_radio_sel'
  2000 + : 'base_radio_un'),
  2001 + width: w(20),
  2002 + ))),
  2003 + Text('领券次日起',
  2004 + style: TextStyle(
  2005 + fontSize: font(14),
  2006 + color: MyColours
  2007 + .color_515151)),
  2008 + HEmptyView(10),
  2009 + Container(
  2010 + width: w(100),
  2011 + height: w(34),
  2012 + padding: EdgeInsets.all(w(5)),
  2013 + alignment: Alignment.center,
  2014 + decoration: BoxDecoration(
  2015 + border: Border.all(
  2016 + width: w(1),
  2017 + color: MyColours
  2018 + .color_515151)),
  2019 + child: TextField(
  2020 + maxLines: 1,
  2021 + controller: tomorrowC,
  2022 + // focusNode: _focusNode,
  2023 + // autofocus: true,
  2024 + textAlign: TextAlign.center,
  2025 + style: TextStyle(
  2026 + color:
  2027 + MyColours.color_515151,
  2028 + fontSize:
  2029 + ScreenUtil().setSp(28)),
  2030 + // textAlignVertical: TextAlignVertical.center,
  2031 + inputFormatters: [
  2032 + FilteringTextInputFormatter
  2033 + .digitsOnly
  2034 + ],
  2035 + decoration: InputDecoration(
  2036 + hintText: '点击输入多少',
  2037 + hintStyle: TextStyle(
  2038 + color: MyColours
  2039 + .color_66000000,
  2040 + fontSize:
  2041 + ScreenUtil().setSp(28),
  2042 + ),
  2043 + isCollapsed:
  2044 + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  2045 + border: OutlineInputBorder(
  2046 + borderSide:
  2047 + BorderSide.none),
  2048 + contentPadding:
  2049 + EdgeInsets.zero,
  2050 + ),
  2051 + keyboardType: TextInputType
  2052 + .numberWithOptions(),
  2053 + textInputAction:
  2054 + TextInputAction.done,
  2055 +
  2056 + onChanged: (value) {
  2057 + // setState(() {});
  2058 + // _searchSellerLocation();
  2059 + // customerProvider.searchData(value);
  2060 + },
  2061 + onEditingComplete: () {
  2062 + FocusScope.of(context)
  2063 + .requestFocus(
  2064 + FocusNode()); //点击空白处隐藏键盘
  2065 + // contantShowModel.searchData(
  2066 + // contantShowModel.controller.text);
  2067 + // _searchSellerLocation();
  2068 + // _focusNode.unfocus();
  2069 + },
  2070 + ),
  2071 + ),
  2072 + HEmptyView(10),
  2073 + Text('天内可用',
  2074 + style: TextStyle(
  2075 + fontSize: font(14),
  2076 + color: MyColours
  2077 + .color_515151)),
  2078 + ],
  2079 + )),
  2080 + Padding(
  2081 + padding: EdgeInsets.only(
  2082 + top: w(3), bottom: w(3)),
  2083 + child: Row(
  2084 + children: [
  2085 + InkWell(
  2086 + onTap: () {
  2087 + validForeverCus = false;
  2088 + fromToEndDateCus = false;
  2089 + todayCus = false;
  2090 + tomorrowCus = false;
  2091 + fromToEndDayCus = true;
  2092 + setState(() {});
  2093 + },
  2094 + child: Padding(
  2095 + padding: EdgeInsets.only(
  2096 + right: w(10)),
  2097 + child: Image.asset(
  2098 + Utils.getImgPath(
  2099 + fromToEndDayCus
  2100 + ? 'base_radio_sel'
  2101 + : 'base_radio_un'),
  2102 + width: w(20),
  2103 + ))),
  2104 + Text('领券后第',
  2105 + style: TextStyle(
  2106 + fontSize: font(14),
  2107 + color: MyColours
  2108 + .color_515151)),
  2109 + HEmptyView(10),
  2110 + Container(
  2111 + width: w(74),
  2112 + height: w(34),
  2113 + padding: EdgeInsets.all(w(5)),
  2114 + alignment: Alignment.center,
  2115 + decoration: BoxDecoration(
  2116 + border: Border.all(
  2117 + width: w(1),
  2118 + color: MyColours
  2119 + .color_515151)),
  2120 + child: TextField(
  2121 + maxLines: 1,
  2122 + controller: fromDayC,
  2123 + // focusNode: _focusNode,
  2124 + // autofocus: true,
  2125 + textAlign: TextAlign.center,
  2126 + style: TextStyle(
  2127 + color:
  2128 + MyColours.color_515151,
  2129 + fontSize:
  2130 + ScreenUtil().setSp(28)),
  2131 + // textAlignVertical: TextAlignVertical.center,
  2132 + inputFormatters: [
  2133 + FilteringTextInputFormatter
  2134 + .digitsOnly
  2135 + ],
  2136 + decoration: InputDecoration(
  2137 + hintText: '点击输入',
  2138 + hintStyle: TextStyle(
  2139 + color: MyColours
  2140 + .color_66000000,
  2141 + fontSize:
  2142 + ScreenUtil().setSp(28),
  2143 + ),
  2144 + isCollapsed:
  2145 + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  2146 + border: OutlineInputBorder(
  2147 + borderSide:
  2148 + BorderSide.none),
  2149 + contentPadding:
  2150 + EdgeInsets.zero,
  2151 + ),
  2152 + keyboardType: TextInputType
  2153 + .numberWithOptions(),
  2154 + textInputAction:
  2155 + TextInputAction.done,
  2156 +
  2157 + onChanged: (value) {
  2158 + // setState(() {});
  2159 + // _searchSellerLocation();
  2160 + // customerProvider.searchData(value);
  2161 + },
  2162 + onEditingComplete: () {
  2163 + FocusScope.of(context)
  2164 + .requestFocus(
  2165 + FocusNode()); //点击空白处隐藏键盘
  2166 + // contantShowModel.searchData(
  2167 + // contantShowModel.controller.text);
  2168 + // _searchSellerLocation();
  2169 + // _focusNode.unfocus();
  2170 + },
  2171 + ),
  2172 + ),
  2173 + HEmptyView(10),
  2174 + Text('天至',
  2175 + style: TextStyle(
  2176 + fontSize: font(14),
  2177 + color: MyColours
  2178 + .color_515151)),
  2179 + HEmptyView(10),
  2180 + Container(
  2181 + width: w(74),
  2182 + height: w(34),
  2183 + padding: EdgeInsets.all(w(5)),
  2184 + alignment: Alignment.center,
  2185 + decoration: BoxDecoration(
  2186 + border: Border.all(
  2187 + width: w(1),
  2188 + color: MyColours
  2189 + .color_515151)),
  2190 + child: TextField(
  2191 + maxLines: 1,
  2192 + controller: endDayC,
  2193 + // focusNode: _focusNode,
  2194 + // autofocus: true,
  2195 + textAlign: TextAlign.center,
  2196 + style: TextStyle(
  2197 + color:
  2198 + MyColours.color_515151,
  2199 + fontSize:
  2200 + ScreenUtil().setSp(28)),
  2201 + // textAlignVertical: TextAlignVertical.center,
  2202 + inputFormatters: [
  2203 + FilteringTextInputFormatter
  2204 + .digitsOnly
  2205 + ],
  2206 + decoration: InputDecoration(
  2207 + hintText: '点击输入',
  2208 + hintStyle: TextStyle(
  2209 + color: MyColours
  2210 + .color_66000000,
  2211 + fontSize:
  2212 + ScreenUtil().setSp(28),
  2213 + ),
  2214 + isCollapsed:
  2215 + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  2216 + border: OutlineInputBorder(
  2217 + borderSide:
  2218 + BorderSide.none),
  2219 + contentPadding:
  2220 + EdgeInsets.zero,
  2221 + ),
  2222 + keyboardType: TextInputType
  2223 + .numberWithOptions(),
  2224 + textInputAction:
  2225 + TextInputAction.done,
  2226 +
  2227 + onChanged: (value) {
  2228 + // setState(() {});
  2229 + // _searchSellerLocation();
  2230 + // customerProvider.searchData(value);
  2231 + },
  2232 + onEditingComplete: () {
  2233 + FocusScope.of(context)
  2234 + .requestFocus(
  2235 + FocusNode()); //点击空白处隐藏键盘
  2236 + // contantShowModel.searchData(
  2237 + // contantShowModel.controller.text);
  2238 + // _searchSellerLocation();
  2239 + // _focusNode.unfocus();
  2240 + },
  2241 + ),
  2242 + ),
  2243 + HEmptyView(10),
  2244 + Text('天可用',
  2245 + style: TextStyle(
  2246 + fontSize: font(14),
  2247 + color: MyColours
  2248 + .color_515151)),
  2249 + ],
  2250 + )),
  2251 + ])),
  2252 + VEmptyView(20),
  2253 +
  2254 + Container(
  2255 + height: ScreenUtil().setWidth(2),
  2256 + color: MyColours.color_E7E7E7,
  2257 + ),
  2258 + VEmptyView(60),
  2259 +
  2260 + Container(
  2261 + alignment: Alignment.centerLeft,
  2262 + child: Text(
1458 '使用规则:', 2263 '使用规则:',
1459 style: TextStyle( 2264 style: TextStyle(
1460 color: Color.fromRGBO(0, 0, 0, 0.9), 2265 color: Color.fromRGBO(0, 0, 0, 0.9),
@@ -1753,40 +2558,106 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1753,40 +2558,106 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1753 Utils.showToast('请填写消费要求'); 2558 Utils.showToast('请填写消费要求');
1754 return; 2559 return;
1755 } 2560 }
1756 - if (fromDate == '点击选择') {  
1757 - Utils.showToast('请选择活动开始时间');  
1758 - return;  
1759 - }  
1760 - if (endDate == '点击选择') {  
1761 - Utils.showToast('请选择活动结束时间');  
1762 - return;  
1763 - }  
1764 - // 券开始早于活动开始 && 券结束大于活动结束  
1765 - if (widget.from != null && widget.from != 'null') {  
1766 - if (DateUtil.getDateTime(fromDate)  
1767 - .compareTo(DateUtil.getDateTime(widget.from!)) > 2561 + if (!validForever) {
  2562 + //需要输入活动有效期
  2563 + if (fromDate == '点击选择开始日期') {
  2564 + Utils.showToast('请选择活动有效期的开始时间');
  2565 + return;
  2566 + }
  2567 + if (endDate == '点击选择结束日期') {
  2568 + Utils.showToast('请选择活动有效期的结束时间');
  2569 + return;
  2570 + }
  2571 + // 券开始早于活动开始 && 券结束大于活动结束
  2572 + if (widget.from != null && widget.from != 'null') {
  2573 + if (DateUtil.getDateTime(fromDate).compareTo(
  2574 + DateUtil.getDateTime(widget.from!)) >
  2575 + 0) {
  2576 + Utils.showToast(
  2577 + '优惠券的开始日期需要选择${widget.from}或以前的时间!');
  2578 + return;
  2579 + }
  2580 + if (DateUtil.getDateTime(widget.end!)
  2581 + .compareTo(DateUtil.getDateTime(endDate)) >
  2582 + 0) {
  2583 + Utils.showToast('优惠券的结束日期需要选择${widget.end}或以后的时间!');
  2584 + return;
  2585 + }
  2586 + }
  2587 +
  2588 + if (DateUtil.getDateTime(endDate)
  2589 + .compareTo(DateUtil.getDateTime(fromDate)) <
1768 0) { 2590 0) {
1769 - Utils.showToast('优惠券的开始日期需要选择${widget.from}或以前的时间!'); 2591 + Utils.showToast('活动有效期的结束时间不能早于活动开始时间');
1770 return; 2592 return;
1771 } 2593 }
1772 - if (DateUtil.getDateTime(widget.end!)  
1773 - .compareTo(DateUtil.getDateTime(endDate)) > 2594 + }
  2595 +
  2596 + if (fromToEndDateCus) {
  2597 + if (fromDateCus == '点击选择开始日期') {
  2598 + Utils.showToast('请选择用户领取后有效期的开始时间');
  2599 + return;
  2600 + }
  2601 + if (endDateCus == '点击选择结束日期') {
  2602 + Utils.showToast('请选择用户领取后有效期的结束时间');
  2603 + return;
  2604 + }
  2605 + if (DateUtil.getDateTime(endDateCus)
  2606 + .compareTo(DateUtil.getDateTime(fromDateCus)) <
1774 0) { 2607 0) {
1775 - Utils.showToast('优惠券的结束日期需要选择${widget.end}或以后的时间!'); 2608 + Utils.showToast('用户领取后有效期的结束时间不能早于开始时间');
1776 return; 2609 return;
1777 } 2610 }
  2611 + if (!validForever) {
  2612 + if (DateUtil.getDateTime(fromDate).compareTo(
  2613 + DateUtil.getDateTime(fromDateCus)) >
  2614 + 0) {
  2615 + Utils.showToast(
  2616 + '用户领取后有效期开始日期需要选择${fromDate}或以后的时间!');
  2617 + return;
  2618 + }
  2619 + if (DateUtil.getDateTime(endDate)
  2620 + .compareTo(DateUtil.getDateTime(endDateCus)) >
  2621 + 0) {
  2622 + Utils.showToast(
  2623 + '用户领取后有效期开始日期需要选择${endDate}或以后的时间!');
  2624 + return;
  2625 + }
  2626 + }
1778 } 2627 }
1779 2628
1780 - if (DateUtil.getDateTime(endDate)  
1781 - .compareTo(DateUtil.getDateTime(fromDate)) <  
1782 - 0) {  
1783 - Utils.showToast('活动结束时间不能早于活动开始时间');  
1784 - return; 2629 + if (todayCus) {
  2630 + if (todayC.text.trim().length == 0) {
  2631 + Utils.showToast('请输入领券当日起天多少内可用!');
  2632 + return;
  2633 + }
1785 } 2634 }
1786 - if (_limitDay.text.trim().length == 0) {  
1787 - Utils.showToast('请填写领取后有效天数');  
1788 - return; 2635 + if (tomorrowCus) {
  2636 + if (tomorrowC.text.trim().length == 0) {
  2637 + Utils.showToast('请输入领券次日起天多少内可用!');
  2638 + return;
  2639 + }
1789 } 2640 }
  2641 + if (fromToEndDayCus) {
  2642 + if (fromDayC.text.trim().length == 0) {
  2643 + Utils.showToast('请输入领券后第几天至第几天可用的开始天数!');
  2644 + return;
  2645 + }
  2646 + if (endDayC.text.trim().length == 0) {
  2647 + Utils.showToast('请输入领券后第几天至第几天可用的结束天数!');
  2648 + return;
  2649 + }
  2650 + if(int.parse(endDayC.text.trim()) < int.parse(fromDayC.text.trim())){
  2651 + Utils.showToast('领券后第几天至第几天可用的结束天数须大于开始天数!');
  2652 + return;
  2653 + }
  2654 +
  2655 + }
  2656 +
  2657 + // if (_limitDay.text.trim().length == 0) {
  2658 + // Utils.showToast('请填写领取后有效天数');
  2659 + // return;
  2660 + // }
1790 2661
1791 // if (isCommission && 2662 // if (isCommission &&
1792 // (_commissionControl.text.trim().length == 0 || 2663 // (_commissionControl.text.trim().length == 0 ||