Browse Source

优化接口json=null或者""的情况下不显示报错文本问题;

下单页面优惠券ui优化调整;
优惠券页面,没有设置可用门店时新增提示,确定按钮适配更改,点击立即使用火锅店无需先扫码再跳转至店铺;
下单页面,微信支付失败ui处理;
dev
wurong 1 year ago
parent
commit
85be4f2f53
  1. 8
      lib/retrofit/min_api.g.dart
  2. 12
      lib/retrofit/retrofit_api.g.dart
  3. 6
      lib/settlement/settlement.dart
  4. 11
      lib/settlement/settlement_view/coupon.dart
  5. 2
      lib/union/union_list.dart
  6. 3
      lib/union/union_select_city.dart
  7. 123
      lib/view_widget/selector_store_dialog.dart

8
lib/retrofit/min_api.g.dart

@ -219,7 +219,7 @@ class _MinApiService implements MinApiService {
data: _data); data: _data);
final value = BaseData<SettleOrderInfo>.fromJson( final value = BaseData<SettleOrderInfo>.fromJson(
_result.data, _result.data,
(json) => json == "" ? null :SettleOrderInfo.fromJson(json), (json) => ((json??"") == "")? null :SettleOrderInfo.fromJson(json),
); );
return value; return value;
} }
@ -242,7 +242,7 @@ class _MinApiService implements MinApiService {
data: _data); data: _data);
final value = BaseData<MinOrderInfo>.fromJson( final value = BaseData<MinOrderInfo>.fromJson(
_result.data, _result.data,
(json) => json==null?null:MinOrderInfo.fromJson(json), (json) => ((json??"") == "")?null:MinOrderInfo.fromJson(json),
); );
return value; return value;
} }
@ -331,7 +331,7 @@ class _MinApiService implements MinApiService {
data: _data); data: _data);
final value = BaseData<WxPay>.fromJson( final value = BaseData<WxPay>.fromJson(
_result.data, _result.data,
(json) => json==null?null:(WxPay.fromJson(json)), (json) => ((json??"") == "")?null:(WxPay.fromJson(json)),
); );
return value; return value;
} }
@ -353,7 +353,7 @@ class _MinApiService implements MinApiService {
data: _data); data: _data);
final value = BaseData<dynamic>.fromJson( final value = BaseData<dynamic>.fromJson(
_result.data, _result.data,
(json) => json==null?null:(json as dynamic), (json) => ((json??"") == "")?null:(json as dynamic),
); );
return value; return value;
} }

12
lib/retrofit/retrofit_api.g.dart

@ -90,7 +90,7 @@ class _ApiService implements ApiService {
data: _data); data: _data);
final value = BaseData.fromJson( final value = BaseData.fromJson(
_result.data, _result.data,
(json) => json == null ? null : json, (json) => ((json??"") == "")? null : json,
); );
return value; return value;
} }
@ -133,7 +133,7 @@ class _ApiService implements ApiService {
data: _data); data: _data);
final value = BaseData<dynamic>.fromJson( final value = BaseData<dynamic>.fromJson(
_result.data, _result.data,
(json) => json == null ? null :json as dynamic, (json) => ((json??"") == "")? null :json as dynamic,
); );
return value; return value;
} }
@ -355,7 +355,7 @@ class _ApiService implements ApiService {
data: _data); data: _data);
final value = BaseData<dynamic>.fromJson( final value = BaseData<dynamic>.fromJson(
_result.data, _result.data,
(json) => json == null ? null : json as dynamic, (json) => ((json??"") == "")? null : json as dynamic,
); );
return value; return value;
} }
@ -910,7 +910,7 @@ class _ApiService implements ApiService {
data: _data); data: _data);
final value = BaseData<OrderInfo>.fromJson( final value = BaseData<OrderInfo>.fromJson(
_result.data, _result.data,
(json) => json == null ? null : OrderInfo.fromJson(json), (json) => ((json??"") == "")? null : OrderInfo.fromJson(json),
); );
return value; return value;
} }
@ -1312,7 +1312,7 @@ class _ApiService implements ApiService {
data: _data); data: _data);
final value = BaseData<String>.fromJson( final value = BaseData<String>.fromJson(
_result.data, _result.data,
(json) => json == null ? null : (json as String), (json) => ((json??"") == "")? null : (json as String),
); );
return value; return value;
} }
@ -1335,7 +1335,7 @@ class _ApiService implements ApiService {
data: _data); data: _data);
final value = BaseData<bool>.fromJson( final value = BaseData<bool>.fromJson(
_result.data, _result.data,
(json) => (json ?? "") == "" ? null : (json as bool), (json) => ((json??"") == "")? null : (json as bool),
); );
return value; return value;
} }

6
lib/settlement/settlement.dart

@ -716,6 +716,12 @@ class _Settlement extends State<Settlement> {
timeStamp: int.tryParse(wxPay.timeStamp), timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign, sign: wxPay.sign,
); );
}else{
EasyLoading.dismiss();
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
Future.delayed(Duration(seconds:2), () {
toOrderDetails(placeOrderFirst.id);
});
} }
} else { } else {
BaseData baseData = await minService BaseData baseData = await minService

11
lib/settlement/settlement_view/coupon.dart

@ -30,7 +30,7 @@ class _CouponWidget extends State<CouponWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: 170, height: 170.h,
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -102,12 +102,9 @@ class _CouponWidget extends State<CouponWidget> {
// flex: 1, // flex: 1,
// ), // ),
SizedBox( SizedBox(
width: 8, width: 8.w,
),
couponListWidget(context),
SizedBox(
width: 5,
), ),
Expanded(child: couponListWidget(context)),
Expanded( Expanded(
flex: 2, flex: 2,
child: Column( child: Column(
@ -121,7 +118,7 @@ class _CouponWidget extends State<CouponWidget> {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
border: Border.all( border: Border.all(
width: 1, width: 1.w,
color: Color(0xFFFF7A1A), color: Color(0xFFFF7A1A),
style: BorderStyle.solid, style: BorderStyle.solid,
), ),

2
lib/union/union_list.dart

@ -104,7 +104,7 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
src: "assets/image/di_zhi.webp", src: "assets/image/di_zhi.webp",
isShowBtn: false, isShowBtn: false,
text: ((widget.city??"") != "武汉" && (widget.city??"") != "郑州" && (widget.city??"") != "北京") ? text: ((widget.city??"") != "武汉" && (widget.city??"") != "郑州" && (widget.city??"") != "北京") ?
" 当前回乡开放门店 仅包含 武汉/北京/郑州,您当前的位置无法获取,请手动更换城市" :"暂无店铺列表~", " 当前海峡姐妹开放门店 仅包含 武汉/北京/郑州,您当前的位置无法获取,请手动更换城市" :"暂无店铺列表~",
fontSize: 16.sp, fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h,left:45.w,right:45.w), margin: EdgeInsets.only(top: 120.h,left:45.w,right:45.w),
) )

3
lib/union/union_select_city.dart

@ -286,7 +286,8 @@ class _UnionSelectCity extends State<UnionSelectCity> {
}, },
):Padding(padding:EdgeInsets.only(top:12.h), ):Padding(padding:EdgeInsets.only(top:12.h),
child: Text( child: Text(
"抱歉,未找到相关位置,可尝试修改后重试", // "抱歉,未找到相关位置,可尝试修改后重试",
"抱歉,该城市未开设门店,可尝试修改后重试",
style: TextStyle( style: TextStyle(
color: Color(0xFF4D4D4D), color: Color(0xFF4D4D4D),
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,

123
lib/view_widget/selector_store_dialog.dart

@ -78,7 +78,7 @@ class _SelectorStoreWidget extends State<SelectorStoreWidget> {
size: 18, size: 18,
), ),
), ),
SizedBox(width: 14), SizedBox(width: 14.w),
], ],
), ),
Container( Container(
@ -87,49 +87,55 @@ class _SelectorStoreWidget extends State<SelectorStoreWidget> {
color: Color(0xFFF2F2F2), color: Color(0xFFF2F2F2),
margin: EdgeInsets.only(bottom: 11.h), margin: EdgeInsets.only(bottom: 11.h),
), ),
Expanded(child: Expanded(
Container( child: Container(
height: (widget.stores != null height: (widget.stores != null
? (widget.stores.length > 4 ? 4 : widget.stores.length) ? (widget.stores.length > 4 ? 4 : widget.stores.length)
: 0) * : 0) *
60.h, 60.h,
child: (widget.stores == null || widget.stores.length == 0) child: (widget.stores == null || widget.stores.length == 0)
? Padding(padding:EdgeInsets.symmetric(horizontal: 16.w), ? Padding(
child: Text( padding: EdgeInsets.symmetric(horizontal: 16.w),
"该优惠券未设置适用门店,适用情况请查看使用详情", child: Text(
textAlign: TextAlign.center, "该优惠券未设置适用门店,适用情况请查看使用详情",
style: TextStyle( textAlign: TextAlign.center,
fontWeight: MyFontWeight.regular, style: TextStyle(
fontSize: 14.sp, fontWeight: MyFontWeight.regular,
color: Colors.black, fontSize: 14.sp,
), color: Colors.black,
),) ),
),
)
: ListView.builder( : ListView.builder(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: (){ onTap: () {
setState(() { setState(() {
selectIndex = position; selectIndex = position;
}); });
}, },
child: storeItem(widget.stores[position], position), child: storeItem(widget.stores[position], position),
); );
}, },
itemCount: widget.stores != null ? widget.stores.length : 0, itemCount: widget.stores != null ? widget.stores.length : 0,
), ),
)), )),
GestureDetector( GestureDetector(
onTap: (){ onTap: () {
if (widget.stores[selectIndex].posType.code == if (widget.stores == null || widget.stores.length == 0) {
"NORMALSTORE") { Navigator.of(context).pop();
Scan.toScan( }
context, // if (widget.stores[selectIndex].posType.code ==
widget.stores[selectIndex].id, // "NORMALSTORE") {
widget.stores[selectIndex].tenantCode, // Scan.toScan(
widget.stores[selectIndex].storeName, // context,
); // widget.stores[selectIndex].id,
} else { // widget.stores[selectIndex].tenantCode,
// widget.stores[selectIndex].storeName,
// );
// }
else {
Navigator.of(context).pushReplacementNamed( Navigator.of(context).pushReplacementNamed(
'/router/store_order', '/router/store_order',
arguments: { arguments: {
@ -145,10 +151,11 @@ class _SelectorStoreWidget extends State<SelectorStoreWidget> {
height: 40.h, height: 40.h,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
color:Color(0xFF32A060), color: Color(0xFF32A060),
), ),
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only(top: 14.h,bottom: 30.h,left: 16.w,right: 16.w), margin: EdgeInsets.only(
top: 14.h, bottom: 30.h, left: 16.w, right: 16.w),
child: Text( child: Text(
S.of(context).queding, S.of(context).queding,
style: TextStyle( style: TextStyle(
@ -226,9 +233,9 @@ class _SelectorStoreWidget extends State<SelectorStoreWidget> {
} }
Widget storeItem(Store store, position) { Widget storeItem(Store store, position) {
return Container( return Container(
height:52 , height: 52.h,
margin: EdgeInsets.only(bottom: 12,left: 14,right: 14), margin: EdgeInsets.only(bottom: 12.h, left: 14.w, right: 14.w),
child: Stack( child: Stack(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
children: [ children: [
@ -238,29 +245,37 @@ class _SelectorStoreWidget extends State<SelectorStoreWidget> {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: new BorderRadius.circular(6), borderRadius: new BorderRadius.circular(6),
border: Border.all( border: Border.all(
color: position == selectIndex ? Color(0xFF32A060):Color(0xFFF7F7F7), color: position == selectIndex
width: position == selectIndex ? 1 :0, ? Color(0xFF32A060)
: Color(0xFFF7F7F7),
width: position == selectIndex ? 1 : 0,
), ),
color: position == selectIndex ? Color(0xFFF0FAF4) :Color(0xFFF7F7F7), color: position == selectIndex
? Color(0xFFF0FAF4)
: Color(0xFFF7F7F7),
), ),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 12,), padding: EdgeInsets.only(
left: 12,
),
child: Text( child: Text(
store.storeName, store.storeName,
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.bold, fontWeight: MyFontWeight.bold,
fontSize: 15.sp, fontSize: 15.sp,
color: position == selectIndex ?Color(0xFF32A060) : Color(0xFF0D0D0D), color: position == selectIndex
? Color(0xFF32A060)
: Color(0xFF0D0D0D),
), ),
), ),
), ),
if (position == selectIndex) if (position == selectIndex)
Image.asset( Image.asset(
"assets/image/recharge.webp", "assets/image/recharge.webp",
width: 20, width: 20,
height: 20, height: 20,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
// MImage( // MImage(
// store.logo, // store.logo,
// width: 28.w, // width: 28.w,

Loading…
Cancel
Save