Browse Source

新增票券详情接口;

优化接口json=null或者""的情况下不显示报错文本问题;
首页优化下来刷新loading显示问题;
更改首页侧面弹窗门店选择首页数据不一致问题;
解决首页扫一扫功能问题;
更改首页生意总览部分统计图问题;
更改底部导航栏布局,扫一扫部分流程更改为点击跳转至扫码页面;
删除底部扫一扫页面;
app下单页面优惠券ui优化调整;
流水页面ui更改;
商品搜索板块上下架bug更改;
新增扫一扫页面;
统计图-提示框位置更改;统计图日期列表显示适配更改;统计图提示框数量变量更改;
在售中商品下架更改;
核销页面-接口流程更改;数据更改;(适配扫码页面数据及订单列表数据)
app优惠券页面,没有设置可用门店时新增提示,确定按钮适配更改,点击立即使用火锅店无需先扫码再跳转至店铺;
app下单页面,微信支付失败ui处理;
生意总览-总览,订单板块日期选择数据更改;ui流程优化适配;
我的订单-审核申请退款,退出刷新数据优化了;
门店列表城市搜索提示更改;
wr_2023_business
wurong 1 year ago
parent
commit
af34ee7897
  1. 13
      lib/business_system/business_page.dart
  2. 137
      lib/business_system/business_scan_code.dart
  3. 2
      lib/business_system/goods/business_goods_page.dart
  4. 15
      lib/business_system/goods/goods_search_page.dart
  5. 1
      lib/business_system/goods/off_shelf/off_shelf_page.dart
  6. 1
      lib/business_system/goods/on_sale/add_assort.dart
  7. 55
      lib/business_system/goods/on_sale/on_sale_page.dart
  8. 101
      lib/business_system/home/business_home_page.dart
  9. 2
      lib/business_system/home/flow_page.dart
  10. 10
      lib/business_system/home/home_view/my_line_chart.dart
  11. 7
      lib/business_system/home/overview/trade_goods.dart
  12. 144
      lib/business_system/home/overview/trade_order.dart
  13. 160
      lib/business_system/home/overview/trade_summary.dart
  14. 3
      lib/business_system/mine/business_mine_page.dart
  15. 10
      lib/business_system/mine/shop_image_info.dart
  16. 2
      lib/business_system/order/business_order_page.dart
  17. 283
      lib/business_system/order/order_list.dart
  18. 200
      lib/business_system/order/order_write_off.dart
  19. 2
      lib/business_system/order/request_refund.dart
  20. 208
      lib/business_system/scan_code_page.dart
  21. 3
      lib/main.dart
  22. 4
      lib/retrofit/business_api.dart
  23. 82
      lib/retrofit/business_api.g.dart
  24. 477
      lib/retrofit/data/ticket_details.dart
  25. 8
      lib/retrofit/min_api.g.dart
  26. 28
      lib/retrofit/retrofit_api.g.dart
  27. 6
      lib/settlement/settlement.dart
  28. 15
      lib/settlement/settlement_view/coupon.dart
  29. 3
      lib/union/union_select_city.dart
  30. 121
      lib/view_widget/selector_store_dialog.dart

13
lib/business_system/business_page.dart

@ -7,7 +7,6 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/business_login_info.dart';
import 'business_scan_code.dart';
import 'home/business_home_page.dart';
class BusinessPage extends StatefulWidget {
@ -51,7 +50,7 @@ class _BusinessPage extends State<BusinessPage>
});
}),
if (choiceIndex == 1) BusinessOrderPage(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
if (choiceIndex == 2) BusinessScanCode(),
// if (choiceIndex == 2) BusinessScanCode(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
if (choiceIndex == 3) BusinessGoodsPage(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
if (choiceIndex == 4) BusinessMinePage(businessLoginInfo,businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
Align(
@ -110,7 +109,6 @@ class _BusinessPage extends State<BusinessPage>
children: [
Image.asset(
(choiceIndex == 0 ||
choiceIndex == 2 ||
choiceIndex == 3 ||
choiceIndex == 4)
? "assets/image/business_order_h.webp"
@ -127,7 +125,6 @@ class _BusinessPage extends State<BusinessPage>
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 ||
choiceIndex == 2 ||
choiceIndex == 3 ||
choiceIndex == 4)
? Color(0xFFACACAC)
@ -141,9 +138,7 @@ class _BusinessPage extends State<BusinessPage>
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 2;
});
Navigator.of(context).pushNamed('/router/scan_code_page', arguments:{"storeId":businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"});
},
child: Image.asset(
"assets/image/business_scan_code.webp",
@ -164,7 +159,6 @@ class _BusinessPage extends State<BusinessPage>
Image.asset(
(choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 4)
? "assets/image/business_goods_h.webp"
: "assets/image/business_goods.webp",
@ -181,7 +175,6 @@ class _BusinessPage extends State<BusinessPage>
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 4)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
@ -203,7 +196,6 @@ class _BusinessPage extends State<BusinessPage>
Image.asset(
(choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 3)
? "assets/image/business_mine_h.webp"
: "assets/image/business_mine.webp",
@ -220,7 +212,6 @@ class _BusinessPage extends State<BusinessPage>
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 3)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),

137
lib/business_system/business_scan_code.dart

@ -1,137 +0,0 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:image_pickers/image_pickers.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:scan/scan.dart';
import '../generated/l10n.dart';
class BusinessScanCode extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _BusinessScanCode();
}
}
class _BusinessScanCode extends State<BusinessScanCode>
with AutomaticKeepAliveClientMixin {
ScanController controller = ScanController();
final screenWidth = window.physicalSize.width;
final screenHeight = window.physicalSize.height;
@override
void initState() {
super.initState();
}
@override
void dispose() {
if (this.controller != null) {
this.controller.pause();
}
super.dispose();
}
@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
body: Container(
child: Stack(
children: [
Positioned(
child: Column(
children: [
Expanded(
child: ScanView(
controller: controller,
scanAreaScale: 0.7,
scanLineColor: Colors.green.shade400,
onCapture: (data) {
if (data != null && data != "") {
// Navigator.of(context).pop(data);
}
},
),
flex: 1,
),
],
),
top: 0,
bottom: 0,
left: 0,
right: 0,
),
Positioned(
child: Container(
margin: EdgeInsets.only(left:12.w,right: 16.w,top: 16.h),
child:Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// Expanded(child:Text(
// S.of(context).saoma,
// style: TextStyle(
// color: Colors.white,
// fontSize: 18.sp,
// fontWeight: FontWeight.bold,
// ),
// )),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
pickImage();
},
child:Container(
padding: EdgeInsets.symmetric(horizontal:10.w),
child: Text(
S.of(context).xiangce,
style: TextStyle(
color: Colors.white,
fontSize: 18.sp,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
top:MediaQuery.of(context).padding.top,
left: 0,
right: 0,
),
],
),
),
);
}
pickImage() async {
List<Media> medias = await ImagePickers.pickerPaths(
galleryMode: GalleryMode.image,
selectCount: 1,
showGif: true,
showCamera: false,
compressSize: 500,
uiConfig: UIConfig(
uiThemeColor: Color(0xFFFFFFFF),
),
cropConfig: CropConfig(
enableCrop: false,
),
);
if (medias != null && medias.length > 0) {
String result = await Scan.parse(medias[0].path);
if (result != null && result != "") {
// Navigator.of(context).pop(result);
}
}
}
@override
bool get wantKeepAlive => true;
}

2
lib/business_system/goods/business_goods_page.dart

@ -1,5 +1,3 @@
import 'dart:ffi';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/business_system/goods/off_shelf/off_shelf_page.dart';

15
lib/business_system/goods/goods_search_page.dart

@ -46,7 +46,6 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
int _pageIndex = 1;
BusinessApiService businessService;
List<AdminProductVoList> adminProductVoList = [];
int goodsIndex = 0;
bool _shimmer =true;
@override
@ -136,7 +135,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
}
///
queryGoodsUpdate() async {
queryGoodsUpdate(productId) async {
try{
EasyLoading.show(
status: S.current.zhengzaijiazai,
@ -150,7 +149,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
}
BaseData baseData =
await businessService.goodsUpdate({
"productId": adminProductVoList[goodsIndex]?.id ?? "",
"productId": productId,
"sell": widget.arguments["onSaleStatus"] == "1"?false:true,
}).catchError((error) {
});
@ -280,13 +279,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
goodsIndex = position;
},
child:
searchGoodsItem(adminProductVoList[position]),
);
return searchGoodsItem(adminProductVoList[position]);
},
),
)),
@ -399,7 +392,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
queryGoodsUpdate();
queryGoodsUpdate(adminProductVoList.id ?? "");
},
child:Container(
decoration: BoxDecoration(

1
lib/business_system/goods/off_shelf/off_shelf_page.dart

@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

1
lib/business_system/goods/on_sale/add_assort.dart

@ -10,7 +10,6 @@ import '../../../generated/l10n.dart';
import '../../../retrofit/business_api.dart';
import '../../../retrofit/data/base_data.dart';
import '../../../utils/business_instance.dart';
import '../../../view_widget/border_text.dart';
import '../../../view_widget/round_button.dart';
class AddAssort extends StatefulWidget {

55
lib/business_system/goods/on_sale/on_sale_page.dart

@ -158,27 +158,36 @@ class _OnSalePage extends State<OnSalePage> {
}
///
queryGoodsUpdate() async {
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
}
BaseData baseData = await businessService.goodsUpdate({
"productId": adminProductVoList[0]?.id ?? "",
"sell": false,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
_pageIndex = 1;
adminProductVoList.clear();
await queryGoodsList(groupIndex == -1
? ""
: productGroupList?.records[groupIndex]?.id ?? "");
SmartDialog.showToast("商品下架成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
queryGoodsUpdate(productId) async {
try {
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
}
BaseData baseData = await businessService.goodsUpdate({
"productId": productId,
"sell": false,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
_pageIndex = 1;
adminProductVoList.clear();
await queryGoodsList(
groupIndex == -1
? ""
: productGroupList?.records[groupIndex]?.id ?? "",
isSing: false);
SmartDialog.showToast("商品下架成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
EasyLoading.dismiss();
}
}
@ -310,7 +319,7 @@ class _OnSalePage extends State<OnSalePage> {
onTap: () {
Navigator.of(context).pushNamed('/router/goods_assort',
arguments: {"storeId": widget.storeId}).then((value) {
adminProductVoList.clear();
adminProductVoList.clear();
_onRefresh();
});
},
@ -593,7 +602,7 @@ class _OnSalePage extends State<OnSalePage> {
)),
GestureDetector(
onTap: () {
queryGoodsUpdate();
queryGoodsUpdate(adminProductVoList.id ?? "");
},
child: Container(
decoration: BoxDecoration(

101
lib/business_system/home/business_home_page.dart

@ -73,7 +73,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
super.dispose();
}
_onRefresh() async {
_onRefresh({int index,isLoading = true}) async {
if(isLoading)
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
@ -81,11 +82,11 @@ class _BusinessHomePage extends State<BusinessHomePage>
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.name ==
storeId: widget.businessLoginInfo.storeList[index??widget.selectStoreIndex]
.name ==
"所有门店"
? "0"
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id);
: widget.businessLoginInfo.storeList[index??widget.selectStoreIndex].id);
queryDayAmount();
queryPopularList(isSing: false);
queryOrderTrend();
@ -217,7 +218,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
return MyFooter(mode);
},
),
onRefresh: _onRefresh,
onRefresh:(){
_onRefresh(isLoading: false);
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
@ -290,7 +293,17 @@ class _BusinessHomePage extends State<BusinessHomePage>
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
onTap: () {
Navigator.of(context)
.pushNamed('/router/scan_code_page', arguments: {
"storeId": widget.businessLoginInfo
.storeList[widget.selectStoreIndex].name ==
"所有门店"
? "0"
: widget.businessLoginInfo
.storeList[widget.selectStoreIndex].id
});
},
child: Image.asset(
"assets/image/icon_scan_qr_code.webp",
width: 28.h,
@ -299,10 +312,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
)
],
),
SizedBox(
height: 14.h,
),
Container(
margin: EdgeInsets.only(top:14.h),
padding: EdgeInsets.symmetric(vertical: 12.h),
decoration: BoxDecoration(
color: Colors.white,
@ -493,7 +504,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
return;
}
widget.changeIndex(index);
_onRefresh();
_onRefresh(index: index);
}
}
@ -567,17 +578,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
SizedBox(
height: 18.h,
),
// if (lineChartSample2Data.isNotEmpty)
// (lineChartSample2Data.isNotEmpty)
// ? NoDataView(
// src: "assets/image/bs_no data_logo.webp",
// isShowBtn: false,
// text: "暂无数据",
// fontSize: 16.sp,
// margin: EdgeInsets.all(20.h),
// )
// :
LineChartSample2(lineChartSample2Data, "销售量"),
LineChartSample2(lineChartSample2Data, "销售量"),
],
),
);
@ -588,29 +589,31 @@ class _BusinessHomePage extends State<BusinessHomePage>
return Container(
color: Colors.white,
margin: EdgeInsets.only(top: 16.h),
padding:
EdgeInsets.only(left:9.w, right:9.w, top: 12.h, bottom: 12.h),
padding: EdgeInsets.only(left: 9.w, right: 9.w, top: 12.h, bottom: 12.h),
child: Column(
children: [
Padding(padding:EdgeInsets.only(left:7.w,),
child: Row(
children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)),
Padding(
padding: EdgeInsets.only(
left: 12.w,
),
child: Text(
"用户概览",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF0D0D0D),
),
),
Padding(
padding: EdgeInsets.only(
left: 7.w,
),
],
)),
child: Row(
children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)),
Padding(
padding: EdgeInsets.only(
left: 12.w,
),
child: Text(
"用户概览",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF0D0D0D),
),
),
),
],
)),
SizedBox(
height: 12.h,
),
@ -626,7 +629,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
margin: EdgeInsets.symmetric(horizontal:4.w),
margin: EdgeInsets.symmetric(horizontal: 4.w),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFC5A58), Color(0xFFFF716F)],
@ -673,9 +676,6 @@ class _BusinessHomePage extends State<BusinessHomePage>
),
),
)),
// SizedBox(
// width: 9.w,
// ),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
@ -685,7 +685,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 8.w, vertical: 6.h),
margin: EdgeInsets.symmetric(horizontal:4.w),
margin: EdgeInsets.symmetric(horizontal: 4.w),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)],
@ -731,9 +731,6 @@ class _BusinessHomePage extends State<BusinessHomePage>
],
),
))),
// SizedBox(
// width: 9.w,
// ),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
@ -743,7 +740,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 8.w, vertical: 6.h),
margin: EdgeInsets.symmetric(horizontal:4.w),
margin: EdgeInsets.symmetric(horizontal: 4.w),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF4B77FC), Color(0xFF7091FF)],
@ -1020,7 +1017,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
margin: EdgeInsets.all(20.h),
)
: ListView.builder(
padding: EdgeInsets.zero,
@ -1184,7 +1181,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
margin: EdgeInsets.all(20.h),
)
: ListView.builder(
padding: EdgeInsets.zero,

2
lib/business_system/home/flow_page.dart

@ -150,7 +150,7 @@ class _FlowPage extends State<FlowPage> {
Text(
_datetime == null
? DateFormat("yyyy年MM月").format(DateTime.now())
: "${_datetime.replaceAll("-", "")}",
: "${_datetime.replaceAll("-", "")}",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,

10
lib/business_system/home/home_view/my_line_chart.dart

@ -2,6 +2,7 @@ import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../utils/flutter_utils.dart';
import '../../../utils/font_weight.dart';
class LineChartSample2 extends StatefulWidget {
@ -34,7 +35,8 @@ class _LineChartSample2State extends State<LineChartSample2> {
(meta.appliedInterval > 1 &&
double.parse(meta.formattedValue) % meta.appliedInterval != 0))
return Text("");
String text = widget.lineChartSample2Data[int.parse(meta.formattedValue)].time ?? "";
String text =
widget.lineChartSample2Data[int.parse(meta.formattedValue)].time ?? "";
if (text.length == 10)
text = text.substring(5, 10);
else if (text.length == 7) text = text.substring(2, 7);
@ -179,10 +181,12 @@ class _LineChartSample2State extends State<LineChartSample2> {
tooltipMargin: 5,
tooltipRoundedRadius: 2,
tooltipHorizontalAlignment: FLHorizontalAlignment.center,
tooltipHorizontalOffset: -13,
getTooltipItems: (touchedSpots) {
return touchedSpots.map((LineBarSpot touchedSpot) {
return LineTooltipItem(
'${(widget.lineChartSample2Data[touchedSpot.x.toInt()].time ?? "").substring(5, 10)}',
'${(widget.lineChartSample2Data[touchedSpot.x.toInt()].time ?? "").length >= 10 ?
(widget.lineChartSample2Data[touchedSpot.x.toInt()].time ?? "").substring(5, 10) : (widget.lineChartSample2Data[touchedSpot.x.toInt()].time ?? "")}',
const TextStyle(
color: Colors.white,
fontWeight: MyFontWeight.light,
@ -197,7 +201,7 @@ class _LineChartSample2State extends State<LineChartSample2> {
fontSize: 10),
),
TextSpan(
text: '${touchedSpot.y.toInt()}',
text: '${AppUtils.calculateDouble(touchedSpot.y)}',
style: const TextStyle(
color: Color(0xFFFFC163),
fontWeight: MyFontWeight.light,

7
lib/business_system/home/overview/trade_goods.dart

@ -64,7 +64,8 @@ class _TradeGoods extends State<TradeGoods> {
_onRefresh();
}
_onRefresh() async {
_onRefresh({isLoading = true}) async {
if(isLoading)
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
@ -269,7 +270,9 @@ class _TradeGoods extends State<TradeGoods> {
return MyFooter(mode);
},
),
onRefresh: _onRefresh,
onRefresh:(){
_onRefresh(isLoading: false);
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(

144
lib/business_system/home/overview/trade_order.dart

@ -17,7 +17,6 @@ import '../../../retrofit/data/trade_summary_list.dart';
import '../../../utils/business_instance.dart';
import '../../../utils/flutter_utils.dart';
import '../../../utils/font_weight.dart';
import '../../../view_widget/no_data_view.dart';
import '../home_view/my_line_chart.dart';
class TradeOrder extends StatefulWidget {
@ -61,7 +60,8 @@ class _TradeOrder extends State<TradeOrder> {
"${DateFormat("yyyy年MM月dd日").format(DateTime.now().subtract(Duration(days: 6)))}"
"${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
String monthlyDate = "";
String monthlyDateNum = "${DateFormat("yyyy年MM月dd").format(DateTime.now())}";
String monthlyDateNum = "${DateFormat("yyyy年MM月dd").format(DateTime(DateTime.now().year, DateTime.now().month, 1))}"
"${DateFormat("yyyy年MM月dd").format(DateTime(DateTime.now().year, DateTime.now().month + 1, 0))}";
String customDate = "";
String customDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
int _loadCount = 0;
@ -77,10 +77,11 @@ class _TradeOrder extends State<TradeOrder> {
@override
void initState() {
super.initState();
// _onRefresh();
_onRefresh();
}
_onRefresh() async {
_onRefresh({isLoading = true}) async {
if(isLoading)
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
@ -114,8 +115,8 @@ class _TradeOrder extends State<TradeOrder> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
"week",
.substring(13, 23),
"custom",
isSing: false);
} else if (dateIndex == 2) {
queryBusinessAnalysis(
@ -128,7 +129,7 @@ class _TradeOrder extends State<TradeOrder> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
.substring(10, 20),
"month",
isSing: false);
} else if (dateIndex == 3) {
@ -142,7 +143,7 @@ class _TradeOrder extends State<TradeOrder> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(timeDate().length <= 15 ? 0 : 12,
.substring(timeDate().length <= 15 ? 0 : 13,
timeDate().length <= 15 ? 10 : 23),
"custom",
isSing: false);
@ -178,27 +179,56 @@ class _TradeOrder extends State<TradeOrder> {
alignment: Alignment.center);
});
if (baseData != null && baseData.isSuccess) {
double amountIndex = 0;
double numIndex = 0;
if (baseData.data.saleBusinessAnalysisVOS.isNotEmpty) {
lineChartSample2DataOrderAmount.clear();
lineChartSample2DataOrderNum.clear();
}
int forIndex = 0;
lineChartSample2DataOrderAmount.clear();
lineChartSample2DataOrderNum.clear();
tradeSummaryList = baseData.data;
tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
lineChartSample2DataOrderAmount.add(LineChartSample2Data(
amountIndex,
double.tryParse(element.localDateBigDecimal.toString()),
element.localDateTime.substring(0, 10)));
amountIndex += 1;
});
tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
lineChartSample2DataOrderNum.add(LineChartSample2Data(
numIndex,
double.tryParse(element.localDateCount.toString()),
element.localDateTime.substring(0, 10)));
numIndex += 1;
});
if (queryRange != "day") {
DateTime startDate = DateTime.parse(selectDay);
DateTime endDate = DateTime.parse(selectEndDay);
while (startDate.isBefore(endDate) ||
startDate.isAtSameMomentAs(endDate)) {
String startDateStr = DateFormat("yyyy-MM-dd").format(startDate);
var searchData = tradeSummaryList.saleBusinessAnalysisVOS
.where((element) =>
element.localDateTime.substring(0, 10) == startDateStr)
?.toList();
double localDateBigDecimal = 0, localDateCount = 0;
if (searchData.isNotEmpty) {
localDateBigDecimal = double.tryParse(
searchData.first.localDateBigDecimal.toString());
localDateCount =
double.tryParse(searchData.first.localDateCount.toString());
}
lineChartSample2DataOrderAmount.add(LineChartSample2Data(
forIndex.toDouble(), localDateBigDecimal, startDateStr));
lineChartSample2DataOrderNum.add(LineChartSample2Data(
forIndex.toDouble(), localDateCount, startDateStr));
forIndex += 1;
startDate = startDate.add(Duration(days: 1));
}
} else {
for (int i = 0; i < 25; i++) {
String dateStr = "${i < 10 ? "0$i" : i}:00:00";
var searchData = tradeSummaryList.saleBusinessAnalysisVOS
.where((element) =>
element.localDateTime.length > 10 &&
element.localDateTime.substring(11) == dateStr)
?.toList();
double localDateBigDecimal = 0, localDateCount = 0;
if (searchData.isNotEmpty) {
localDateBigDecimal = double.tryParse(
searchData.first.localDateBigDecimal.toString());
localDateCount =
double.tryParse(searchData.first.localDateCount.toString());
}
dateStr = dateStr.substring(0, 5);
lineChartSample2DataOrderAmount.add(LineChartSample2Data(
i.toDouble(), localDateBigDecimal, dateStr));
lineChartSample2DataOrderNum.add(
LineChartSample2Data(i.toDouble(), localDateCount, dateStr));
}
}
}
} finally {
if (isSing) {
@ -226,7 +256,8 @@ class _TradeOrder extends State<TradeOrder> {
controller: _refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
header: MyHeader(
color: Color(0xFF30415B),),
physics: BouncingScrollPhysics(),
scrollController: scrollController,
footer: CustomFooter(
@ -234,7 +265,9 @@ class _TradeOrder extends State<TradeOrder> {
return MyFooter(mode);
},
),
onRefresh: _onRefresh,
onRefresh: (){
_onRefresh(isLoading: false);
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
@ -304,8 +337,8 @@ class _TradeOrder extends State<TradeOrder> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
"week");
.substring(13, 23),
"custom");
},
child: Container(
alignment: Alignment.center,
@ -343,7 +376,7 @@ class _TradeOrder extends State<TradeOrder> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
.substring(10, 20),
"month");
},
child: Container(
@ -383,7 +416,7 @@ class _TradeOrder extends State<TradeOrder> {
.replaceAll("", "-")
.replaceAll("", "")
.substring(
timeDate().length <= 15 ? 0 : 12,
timeDate().length <= 15 ? 0 : 13,
timeDate().length <= 15 ? 10 : 23),
"custom");
},
@ -449,8 +482,8 @@ class _TradeOrder extends State<TradeOrder> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
"week");
.substring(13, 23),
"custom");
});
} else if (dateIndex == 2) {
Navigator.of(context)
@ -467,7 +500,7 @@ class _TradeOrder extends State<TradeOrder> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
.substring(10, 20),
"month");
});
} else if (dateIndex == 3) {
@ -485,7 +518,7 @@ class _TradeOrder extends State<TradeOrder> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
.substring(13, 23),
"custom");
});
}
@ -563,10 +596,16 @@ class _TradeOrder extends State<TradeOrder> {
return (monthlyDate == "" || monthlyDate == null)
? "${monthlyDateNum ?? ""}"
: (monthlyDateNum ==
(DateFormat("yyyy年MM月dd日")
.format(DateTime.parse(monthlyDate)))
? "${(DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)))}"
: DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)));
(DateFormat("yyyy年MM月dd日")
.format(DateTime.parse(monthlyDate)) +
DateFormat("yyyy年MM月dd日").format(DateTime(
DateTime.now().year,
DateTime.parse(monthlyDate).month + 1,
0)))
? "${(DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)) + DateFormat("yyyy年MM月dd日").format(DateTime(DateTime.now().year, DateTime.parse(monthlyDate).month + 1, 0)))}"
: (DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)) +
DateFormat("yyyy年MM月dd日").format(DateTime(DateTime.now().year,
DateTime.parse(monthlyDate).month + 1, 0))));
} else if (dateIndex == 3) {
return (customDate == "" || customDate == null)
? "${customDateNum ?? ""}(今日)"
@ -609,16 +648,6 @@ class _TradeOrder extends State<TradeOrder> {
)
],
)),
(tradeSummaryList == null ||
tradeSummaryList.saleBusinessAnalysisVOS.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
:
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: LineChartSample2(lineChartSample2DataOrderAmount, "金额"),
@ -656,16 +685,7 @@ class _TradeOrder extends State<TradeOrder> {
)
],
)),
(tradeSummaryList == null ||
tradeSummaryList.saleBusinessAnalysisVOS.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: Padding(
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: LineChartSample2(lineChartSample2DataOrderNum, "订单量"),
),

160
lib/business_system/home/overview/trade_summary.dart

@ -46,7 +46,9 @@ class _TradeSummary extends State<TradeSummary> {
"${DateFormat("yyyy年MM月dd日").format(DateTime.now().subtract(Duration(days: 6)))}"
"${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
String monthlyDate = "";
String monthlyDateNum = "${DateFormat("yyyy年MM月dd").format(DateTime.now())}";
String monthlyDateNum =
"${DateFormat("yyyy年MM月dd").format(DateTime(DateTime.now().year, DateTime.now().month, 1))}"
"${DateFormat("yyyy年MM月dd").format(DateTime(DateTime.now().year, DateTime.now().month + 1, 0))}";
String customDate = "";
String customDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
int _loadCount = 0;
@ -83,7 +85,8 @@ class _TradeSummary extends State<TradeSummary> {
_onRefresh();
}
_onRefresh() async {
_onRefresh({isLoading = true}) async {
if(isLoading)
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
@ -117,8 +120,8 @@ class _TradeSummary extends State<TradeSummary> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
"week",
.substring(13, 23),
"custom",
isSing: false);
} else if (dateIndex == 2) {
queryBusinessAnalysis(
@ -131,7 +134,7 @@ class _TradeSummary extends State<TradeSummary> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
.substring(10, 20),
"month",
isSing: false);
} else if (dateIndex == 3) {
@ -145,7 +148,7 @@ class _TradeSummary extends State<TradeSummary> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(timeDate().length <= 15 ? 0 : 12,
.substring(timeDate().length <= 15 ? 0 : 13,
timeDate().length <= 15 ? 10 : 23),
"custom",
isSing: false);
@ -181,27 +184,56 @@ class _TradeSummary extends State<TradeSummary> {
alignment: Alignment.center);
});
if (baseData != null && baseData.isSuccess) {
int amountIndex = 0;
int numIndex = 0;
if (baseData.data.saleBusinessAnalysisVOS.isNotEmpty) {
lineChartSample2DataAmount.clear();
lineChartSample2DataNum.clear();
}
int forIndex = 0;
lineChartSample2DataAmount.clear();
lineChartSample2DataNum.clear();
tradeSummaryList = baseData.data;
tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
lineChartSample2DataAmount.add(LineChartSample2Data(
amountIndex.toDouble(),
double.tryParse(element.localDateBigDecimal.toString()),
element.localDateTime.substring(0, 10)));
amountIndex += 1;
});
tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
lineChartSample2DataNum.add(LineChartSample2Data(
numIndex.toDouble(),
double.tryParse(element.localDateCount.toString()),
element.localDateTime.substring(0, 10)));
numIndex += 1;
});
if (queryRange != "day") {
DateTime startDate = DateTime.parse(selectDay);
DateTime endDate = DateTime.parse(selectEndDay);
while (startDate.isBefore(endDate) ||
startDate.isAtSameMomentAs(endDate)) {
String startDateStr = DateFormat("yyyy-MM-dd").format(startDate);
var searchData = tradeSummaryList.saleBusinessAnalysisVOS
.where((element) =>
element.localDateTime.substring(0, 10) == startDateStr)
?.toList();
double localDateBigDecimal = 0, localDateCount = 0;
if (searchData.isNotEmpty) {
localDateBigDecimal = double.tryParse(
searchData.first.localDateBigDecimal.toString());
localDateCount =
double.tryParse(searchData.first.localDateCount.toString());
}
lineChartSample2DataAmount.add(LineChartSample2Data(
forIndex.toDouble(), localDateBigDecimal, startDateStr));
lineChartSample2DataNum.add(LineChartSample2Data(
forIndex.toDouble(), localDateCount, startDateStr));
forIndex += 1;
startDate = startDate.add(Duration(days: 1));
}
} else {
for (int i = 0; i < 25; i++) {
String dateStr = "${i < 10 ? "0$i" : i}:00:00";
var searchData = tradeSummaryList.saleBusinessAnalysisVOS
.where((element) =>
element.localDateTime.length > 10 &&
element.localDateTime.substring(11) == dateStr)
?.toList();
double localDateBigDecimal = 0, localDateCount = 0;
if (searchData.isNotEmpty) {
localDateBigDecimal = double.tryParse(
searchData.first.localDateBigDecimal.toString());
localDateCount =
double.tryParse(searchData.first.localDateCount.toString());
}
dateStr = dateStr.substring(0, 5);
lineChartSample2DataAmount.add(LineChartSample2Data(
i.toDouble(), localDateBigDecimal, dateStr));
lineChartSample2DataNum.add(
LineChartSample2Data(i.toDouble(), localDateCount, dateStr));
}
}
}
} finally {
if (isSing) {
@ -239,7 +271,9 @@ class _TradeSummary extends State<TradeSummary> {
return MyFooter(mode);
},
),
onRefresh: _onRefresh,
onRefresh:(){
_onRefresh(isLoading:false);
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
@ -310,8 +344,8 @@ class _TradeSummary extends State<TradeSummary> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
"week");
.substring(13, 23),
"custom");
},
child: Container(
alignment: Alignment.center,
@ -349,7 +383,7 @@ class _TradeSummary extends State<TradeSummary> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
.substring(10, 20),
"month");
},
child: Container(
@ -389,7 +423,7 @@ class _TradeSummary extends State<TradeSummary> {
.replaceAll("", "-")
.replaceAll("", "")
.substring(
timeDate().length <= 15 ? 0 : 12,
timeDate().length <= 15 ? 0 : 13,
timeDate().length <= 15 ? 10 : 23),
"custom");
},
@ -455,8 +489,8 @@ class _TradeSummary extends State<TradeSummary> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
"week");
.substring(13, 23),
"custom");
});
} else if (dateIndex == 2) {
Navigator.of(context)
@ -473,7 +507,7 @@ class _TradeSummary extends State<TradeSummary> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 10),
.substring(10, 20),
"month");
});
} else if (dateIndex == 3) {
@ -491,7 +525,7 @@ class _TradeSummary extends State<TradeSummary> {
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(12, 23),
.substring(13, 23),
"custom");
});
}
@ -575,9 +609,15 @@ class _TradeSummary extends State<TradeSummary> {
? "${monthlyDateNum ?? ""}"
: (monthlyDateNum ==
(DateFormat("yyyy年MM月dd日")
.format(DateTime.parse(monthlyDate)))
? "${(DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)))}"
: DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)));
.format(DateTime.parse(monthlyDate)) +
DateFormat("yyyy年MM月dd日").format(DateTime(
DateTime.now().year,
DateTime.parse(monthlyDate).month + 1,
0)))
? "${(DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)) + DateFormat("yyyy年MM月dd日").format(DateTime(DateTime.now().year, DateTime.parse(monthlyDate).month + 1, 0)))}"
: (DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)) +
DateFormat("yyyy年MM月dd日").format(DateTime(DateTime.now().year,
DateTime.parse(monthlyDate).month + 1, 0))));
} else if (dateIndex == 3) {
return (customDate == "" || customDate == null)
? "${customDateNum ?? ""}(今日)"
@ -675,30 +715,12 @@ class _TradeSummary extends State<TradeSummary> {
margin: EdgeInsets.only(bottom: 30.h),
),
if (operateSelect == 0)
(tradeSummaryList == null ||
tradeSummaryList.saleBusinessAnalysisVOS.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: Container(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: LineChartSample2(lineChartSample2DataAmount, "金额"),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: LineChartSample2(lineChartSample2DataAmount, "金额"),
),
if (operateSelect == 1)
(tradeSummaryList == null ||
tradeSummaryList.saleBusinessAnalysisVOS.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: Padding(
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: LineChartSample2(lineChartSample2DataNum, "交易笔数"),
),
@ -814,9 +836,8 @@ class _TradeSummary extends State<TradeSummary> {
),
),
if (expensesSelect == 0)
(tradeSummaryList == null ||
tradeSummaryList.collectionAmount == null ||
tradeSummaryList.refundAmount == null)
((tradeSummaryList?.collectionAmount ?? "0") == "0" &&
(tradeSummaryList?.refundAmount ?? "0") == "0")
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
@ -824,7 +845,8 @@ class _TradeSummary extends State<TradeSummary> {
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: Container(
:
Container(
height: 150.h,
child: DonutAutoLabelChart([
new charts.Series<LinearSales, int>(
@ -855,9 +877,8 @@ class _TradeSummary extends State<TradeSummary> {
]),
),
if (expensesSelect == 1)
(tradeSummaryList == null ||
tradeSummaryList.collectionCount == null ||
tradeSummaryList.refundCount == null)
((tradeSummaryList?.collectionCount ?? "0") == "0" &&
(tradeSummaryList?.refundCount ?? "0") == "0")
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
@ -865,7 +886,8 @@ class _TradeSummary extends State<TradeSummary> {
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: Container(
:
Container(
height: 150.h,
child: DonutAutoLabelChart([
new charts.Series<LinearSales, int>(

3
lib/business_system/mine/business_mine_page.dart

@ -1,7 +1,6 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
@ -9,8 +8,6 @@ import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:visibility_detector/visibility_detector.dart';
import '../../generated/l10n.dart';
import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_login_info.dart';

10
lib/business_system/mine/shop_image_info.dart

@ -1,4 +1,3 @@
import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
@ -9,17 +8,12 @@ import 'package:flutter_svg/svg.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/upload_result.dart';
import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/cupertino_date_picker.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:image_pickers/image_pickers.dart';
import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../retrofit/business_api.dart';
@ -48,10 +42,6 @@ class _ShopImageInfo extends State<ShopImageInfo> {
@override
void initState() {
super.initState();
// SharedPreferences.getInstance().then((value) => {
// imageInfo["logo"] = widget.arguments["logo"],
// imageInfo["facade"] = widget.arguments["facade"],
// });
}
refresh() async {

2
lib/business_system/order/business_order_page.dart

@ -1,10 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:intl/intl.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../generated/l10n.dart';
import '../../utils/font_weight.dart';
import '../../view_widget/my_appbar.dart';
import '../../view_widget/my_tab.dart';

283
lib/business_system/order/order_list.dart

@ -25,7 +25,8 @@ class OrderList extends StatefulWidget {
final String time;
final bool isKeyBoardShow;
OrderList(Key key, this.status, this.storeId, this.keyword, this.time,this.isKeyBoardShow)
OrderList(Key key, this.status, this.storeId, this.keyword, this.time,
this.isKeyBoardShow)
: super(key: key);
@override
@ -61,7 +62,7 @@ class _OrderList extends State<OrderList> {
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
await queryOrderList();
await queryOrderList(isRefreshData: false);
_shimmer = false;
EasyLoading.dismiss();
if (!mounted) return;
@ -70,53 +71,66 @@ class _OrderList extends State<OrderList> {
}
///
queryOrderList() async {
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
}
BaseData<BusinessOrderList> baseData =
await businessService.findAdminOrderList({
"orderCode": "",
"keywordType": 1,
"keyword": widget?.keyword ?? "",
"orderStatus": "",
"startTime": widget.time
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 19),
"endTime": widget.time
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(widget.time.length >= 21 ? 22 : 0,
widget.time.length >= 21 ? 41 : 0),
"pageIndex": _pageIndex,
"pageSize": 10,
"refundStatus": widget.status == 3 ? "1" : "",
"payStatus": widget.status == 1 ? "0" : (widget.status == 2 ? "1" : ""),
"showCancelOrder": 1,
"orderType": ""
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
adminOrderDTOList.addAll(baseData?.data?.adminOrderDTOList ?? []);
if ((baseData?.data?.adminOrderDTOList ?? []).isEmpty ||
adminOrderDTOList.length == baseData.data.total)
_refreshController.loadNoData();
else
_refreshController.loadComplete();
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
queryOrderList({String queryId, isRefreshData = true}) async {
try {
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
}
BaseData<BusinessOrderList> baseData =
await businessService.findAdminOrderList({
"orderCode": "",
"keywordType": 1,
"keyword": widget?.keyword ?? queryId ?? "",
"orderStatus": "",
"startTime": widget.time
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(0, 19),
"endTime": widget.time
.replaceAll("", "-")
.replaceAll("", "-")
.replaceAll("", "")
.substring(widget.time.length >= 21 ? 22 : 0,
widget.time.length >= 21 ? 41 : 0),
"pageIndex": _pageIndex,
"pageSize": 10,
"refundStatus": widget.status == 3 ? "1" : "",
"payStatus": widget.status == 1 ? "0" : (widget.status == 2 ? "1" : ""),
"showCancelOrder": 1,
"orderType": ""
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
if (queryId == null){
adminOrderDTOList.addAll(baseData?.data?.adminOrderDTOList ?? []);
if ((baseData?.data?.adminOrderDTOList ?? []).isEmpty ||
adminOrderDTOList.length == baseData.data.total)
_refreshController.loadNoData();
else
_refreshController.loadComplete();
}
else
adminOrderDTOList.forEach((element) {
if (element.id == queryId) {
adminOrderDTOList[index] = element;
return;
}
});
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
if (isRefreshData) setState(() {});
}
}
@ -142,49 +156,53 @@ class _OrderList extends State<OrderList> {
_pageIndex++;
_onRefresh(isShowLoad: false);
},
child: (_shimmer) ? ListView.builder(
padding: EdgeInsets.zero,
itemCount: 10,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return orderItemSm();
},
): ((adminOrderDTOList == null || adminOrderDTOList.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
iconHeight: 120.h,
margin: EdgeInsets.all(50.h),
child: (_shimmer)
? ListView.builder(
padding: EdgeInsets.zero,
itemCount: 10,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return orderItemSm();
},
)
: Padding(
padding: EdgeInsets.only(top: 16.h),
child: ListView.builder(
itemCount: adminOrderDTOList?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if(widget.isKeyBoardShow){
return;
}else{
Navigator.of(context).pushNamed(
'/router/business_order_detail',
arguments: {
"id": adminOrderDTOList[position].id,
"storeId": widget.storeId
});}
: ((adminOrderDTOList == null || adminOrderDTOList.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
iconHeight: 120.h,
margin: EdgeInsets.all(50.h),
)
: Padding(
padding: EdgeInsets.only(top: 16.h),
child: ListView.builder(
itemCount: adminOrderDTOList?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (widget.isKeyBoardShow) {
FocusScope.of(context).requestFocus(FocusNode());
return;
} else {
Navigator.of(context).pushNamed(
'/router/business_order_detail',
arguments: {
"id": adminOrderDTOList[position].id,
"storeId": widget.storeId
});
}
},
child: orderItem(adminOrderDTOList[position]),
);
},
child: orderItem(adminOrderDTOList[position]),
);
},
),
)),
),
)),
);
}
@ -324,43 +342,45 @@ class _OrderList extends State<OrderList> {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if(adminOrderDtoList.ticketStatus != null)
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context)
.pushNamed('/router/order_write_off', arguments:{
"tickets":adminOrderDtoList.tickets,
"orderCode": adminOrderDtoList?.orderCode ?? "",
"userName":adminOrderDtoList?.name ?? "",
"ticketStatus":adminOrderDtoList?.ticketStatus,
}).then((value) async{
// _pageIndex = 1;
adminOrderDTOList.clear();
await _onRefresh(isShowLoad: false);
});
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(4),
),
padding: EdgeInsets.symmetric(
vertical: 5.h, horizontal: 26.w),
margin: EdgeInsets.only(
right: (adminOrderDtoList.payStatus == 1 &&
adminOrderDtoList.refundStatus == 0)
? 20.w
: 0),
child: Text(
"核销",
style: TextStyle(
fontSize: 12.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
if (adminOrderDtoList.ticketStatus != null && adminOrderDtoList.refundStatus == 0)
GestureDetector(behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context)
.pushNamed('/router/order_write_off', arguments: {
"tickets": adminOrderDtoList.tickets,
"orderCode": adminOrderDtoList?.orderCode ?? "",
"userName": adminOrderDtoList?.name ?? "",
"ticketStatus": adminOrderDtoList?.ticketStatus,
}).then((value) async {
// if (value == 1) {
// _pageIndex = 1;
// adminOrderDTOList.clear();
// _onRefresh(isShowLoad: false);
queryOrderList(queryId: adminOrderDtoList.id);
// }
});
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(4),
),
padding: EdgeInsets.symmetric(
vertical: 5.h, horizontal: 26.w),
margin: EdgeInsets.only(
right: (adminOrderDtoList.payStatus == 1 &&
adminOrderDtoList.refundStatus == 0)
? 20.w
: 0),
child: Text(
"核销",
style: TextStyle(
fontSize: 12.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
),
),
),
),
if (adminOrderDtoList.payStatus == 1 &&
adminOrderDtoList.refundStatus == 0)
GestureDetector(
@ -372,11 +392,14 @@ class _OrderList extends State<OrderList> {
"mid": adminOrderDtoList?.mid ?? "",
"orderId": adminOrderDtoList?.id ?? "",
"storeId": widget.storeId ?? "",
}).then((value) => {
_pageIndex = 1,
adminOrderDTOList.clear(),
_onRefresh(isShowLoad: false),
});
}).then((value) {
if (value == 1) {
// _pageIndex = 1;
// adminOrderDTOList.clear();
// _onRefresh(isShowLoad: false);
queryOrderList(queryId: adminOrderDtoList.id);
}
});
},
child: Container(
decoration: BoxDecoration(

200
lib/business_system/order/order_write_off.dart

@ -1,5 +1,4 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
@ -8,11 +7,11 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../generated/l10n.dart';
import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_order_list.dart';
import '../../retrofit/data/business_order_list.dart' as business;
import '../../retrofit/data/ticket_details.dart';
import '../../utils/business_instance.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
@ -31,20 +30,25 @@ class OrderWriteOff extends StatefulWidget {
class _OrderWriteOff extends State<OrderWriteOff> {
final RefreshController refreshController = RefreshController();
var writeOffCheck = false;
List<Tickets> tickets;
AdminOrderDtoList adminOrderDTOList;
List<business.Tickets> tickets;
TicketDetails ticketDetails;
business.AdminOrderDtoList adminOrderDTOList;
int nameIndex = 0;
BusinessApiService businessService;
@override
void initState() {
super.initState();
tickets = widget.arguments["tickets"];
if (widget.arguments["tickets"] != null) {
tickets = widget.arguments["tickets"];
} else {
ticketDetails = widget.arguments["ticketDetails"];
}
}
///
severalWiped(ticketWipedBatch) async {
// try {
try {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
if (businessService == null) {
@ -58,16 +62,14 @@ class _OrderWriteOff extends State<OrderWriteOff> {
.wipedBatchs(jsonEncode(ticketWipedBatch).replaceAll("\\\"", "\""))
.catchError((error) {});
if (baseData != null && baseData.isSuccess) {
EasyLoading.dismiss();
Navigator.pop(context);
Navigator.of(context).pop(1);
SmartDialog.showToast("核销成功", alignment: Alignment.center);
} else {
EasyLoading.dismiss();
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
// } finally {
// EasyLoading.dismiss();
// }
} finally {
EasyLoading.dismiss();
}
}
@override
@ -108,35 +110,61 @@ class _OrderWriteOff extends State<OrderWriteOff> {
writeOffInfo(),
GestureDetector(
onTap: () {
if (widget.arguments["ticketStatus"] == false) {
if (tickets != null ? (widget.arguments["ticketStatus"] == false) : (ticketDetails.state == 9)) {
return;
} else {
List<dynamic> ticketWipedBatch = [];
tickets.forEach((element) {
List<dynamic> skuTickets = [];
element.ticketItemList.forEach((ele) {
if (ele.isSelect) {
skuTickets.add({
"number": 1,
"skuTicket": ele.name,
"state": ele.state,
if(widget.arguments["tickets"] != null){
tickets.forEach((element) {
List<dynamic> skuTickets = [];
element.ticketItemList.forEach((ele) {
if (ele.isSelect) {
skuTickets.add({
"number": 1,
"skuTicket": ele.name,
"state": ele.state,
});
}
});
if (skuTickets.isNotEmpty) {
ticketWipedBatch.add({
"itemMap": [
{
"productSkuld": element.productSkuId,
"ticketExchangeName": element.name,
"ticketId": element.id,
"skuTickets": skuTickets
}
],
"ticketCode": element.code,
});
}
});
if (skuTickets.isNotEmpty) {
ticketWipedBatch.add({
"itemMap": [
{
"productSkuld": element.productSkuId,
"ticketExchangeName": element.name,
"ticketId": element.id,
"skuTickets": skuTickets
}
],
"ticketCode": element.code,
}else{
List<dynamic> skuTickets = [];
ticketDetails.ticketItemList.forEach((element) {
if (element.isSelect) {
skuTickets.add({
"number": 1,
"skuTicket": element.name,
"state": element.state,
});
}
});
}
});
if (skuTickets.isNotEmpty) {
ticketWipedBatch.add({
"itemMap": [
{
"productSkuld": ticketDetails.productSkuId,
"ticketExchangeName": ticketDetails.name,
"ticketId": ticketDetails.id,
"skuTickets": skuTickets
}
],
"ticketCode": ticketDetails.code,
});
}
}
if (ticketWipedBatch.length == 0) {
SmartDialog.showToast("请选择要核销的商品",
alignment: Alignment.center);
@ -149,14 +177,14 @@ class _OrderWriteOff extends State<OrderWriteOff> {
child: Container(
width: double.infinity,
alignment: Alignment.center,
margin: EdgeInsets.only(
bottom: 55.h, top: tickets.length < 2 ? 125.h : 0),
margin: EdgeInsets.only(bottom: 55.h, top: (tickets != null ? tickets.length : ticketDetails.ticketItemList.length) <= 2 ? 125.h : 0),
padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(27),
color: widget.arguments["ticketStatus"] == true
color: (tickets != null ? (widget.arguments["ticketStatus"] == true) : (ticketDetails.state != 9))
? Color(0xFF30415B)
: Color(0xFFABACAB)),
:
Color(0xFFABACAB)),
child: Text(
"确认核销",
style: TextStyle(
@ -215,8 +243,8 @@ class _OrderWriteOff extends State<OrderWriteOff> {
SizedBox(
height: 12.h,
),
basicInfoItem("用户名称::", widget?.arguments["userName"] ?? ""),
basicInfoItem("订单编号::", widget?.arguments["orderCode"] ?? ""),
basicInfoItem("用户名称::", widget?.arguments["userName"] ?? ticketDetails?.userName ?? "" ),
basicInfoItem("订单编号::", widget?.arguments["orderCode"] ?? (ticketDetails.code.replaceAll("T","")) ?? ""),
],
),
);
@ -294,7 +322,7 @@ class _OrderWriteOff extends State<OrderWriteOff> {
),
ListView.builder(
padding: EdgeInsets.zero,
itemCount: tickets?.length ?? 0,
itemCount: tickets != null ?(tickets?.length ?? 0):(ticketDetails?.ticketItemList?.length ?? 0),
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
@ -305,7 +333,7 @@ class _OrderWriteOff extends State<OrderWriteOff> {
nameIndex = position;
});
},
child: writeOffInfoItem(tickets[position]),
child: tickets != null ? writeOffInfoItem(tickets[position]):scanCodeInfoItem(ticketDetails.ticketItemList[position]),
);
},
)
@ -328,7 +356,8 @@ class _OrderWriteOff extends State<OrderWriteOff> {
);
}
Widget writeOffInfoItem(Tickets tickets) {
///
Widget writeOffInfoItem(business.Tickets tickets) {
return Container(
width: double.infinity,
child: Column(
@ -405,7 +434,88 @@ class _OrderWriteOff extends State<OrderWriteOff> {
);
}
Widget skuTicketsItem(TicketItemList ticketItemList) {
///
Widget scanCodeInfoItem(TicketItemList ticketItemList){
return Container(
width: double.infinity,
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Text(
ticketItemList?.name ?? "",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 14.sp,
color: ticketItemList.state == 1?Color(0xFF0D0D0D):Color(0xFFABACAB),
),
)),
Expanded(child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(padding: EdgeInsets.only(right:10.w),
child: Text(
(ticketItemList.state == 1)?"待核销":"已核销",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp,
color: (ticketItemList.state == 1)?Color(0xFF30415B):Color(0xFFACACAC),
),
),),
SizedBox(height:25.h,),
if(ticketItemList.state == 1)
Checkbox(
value: ticketItemList.isSelect,
onChanged: (a) {
setState(() {
ticketItemList.isSelect = !ticketItemList.isSelect;
});
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(2.0),
),
checkColor: Color(0xFFFFFFFF),
fillColor:MaterialStateProperty.all(Color(0xFF30415B)),
),
],
))
],
),
if(ticketItemList.state != 1)
Align(
alignment: Alignment.centerRight,
child:Container(
margin: EdgeInsets.only(right:10.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(
2,
),
border: Border.all(
color: Color(0xFFCFCFCF),
width: 1.w,
),
),
child: Icon(
Icons.check,
color: Color(0xFFCFCFCF),
size: 14.w,
)
),),
Container(
margin: EdgeInsets.only(bottom:11.h,top: 13.h),
width: double.infinity,
height: 1.h,
color: Color(0xFFEBECEF),
)
],
),
);
}
Widget skuTicketsItem(business.TicketItemList ticketItemList) {
return Container(
width: double.infinity,
child: Row(

2
lib/business_system/order/request_refund.dart

@ -119,7 +119,7 @@ class _RequestRefund extends State<RequestRefund> {
text: baseData?.data ?? "",
color: Color(0xFF30415B),
));
Navigator.of(context).pop();
Navigator.of(context).pop(refundState);
} else {
SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center);
}

208
lib/business_system/scan_code_page.dart

@ -0,0 +1,208 @@
import 'dart:ui';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:image_pickers/image_pickers.dart';
import 'package:scan/scan.dart';
import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/ticket_details.dart';
import '../../utils/business_instance.dart';
import '../view_widget/settlement_tips_dialog.dart';
class ScanCodePage extends StatefulWidget {
final Map<String, dynamic> arguments;
ScanCodePage({this.arguments});
@override
State<StatefulWidget> createState() {
return _ScanCodePage();
}
}
class _ScanCodePage extends State<ScanCodePage> {
ScanController controller = ScanController();
final screenWidth = window.physicalSize.width;
final screenHeight = window.physicalSize.height;
BusinessApiService businessService;
TicketDetails ticketDetails;
@override
void initState() {
super.initState();
}
@override
void dispose() {
if (this.controller != null) {
this.controller.pause();
}
super.dispose();
}
///
queryTicketDetails(code) async {
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.arguments["storeId"]);
}
BaseData<TicketDetails> baseData =
await businessService.ticketCode(code).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
ticketDetails = baseData.data;
Navigator.of(context)
.popAndPushNamed('/router/order_write_off', arguments: {
"ticketDetails": ticketDetails,
});
} else {
Navigator.of(context).pop();
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Positioned(
child: Column(
children: [
Expanded(
child: ScanView(
controller: controller,
scanAreaScale: 0.7,
scanLineColor: Colors.green.shade400,
onCapture: (data) {
if (data != null && data != "") {
queryTicketDetails(data);
}
},
),
flex: 1,
),
],
),
top: 0,
bottom: 0,
left: 0,
right: 0,
),
Positioned(
child: Container(
margin: EdgeInsets.only(left: 12.w, right: 16.w, top: 16.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pop();
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w),
alignment: Alignment.centerLeft,
child: Image.asset(
"assets/image/return_left.webp",
fit: BoxFit.fill,
color: Colors.white,
),
),
),
Spacer(),
// Expanded(child:Text(
// S.of(context).saoma,
// style: TextStyle(
// color: Colors.white,
// fontSize: 18.sp,
// fontWeight: FontWeight.bold,
// ),
// )),
// GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: () {
// pickImage();
// },
// child:Container(
// padding: EdgeInsets.symmetric(horizontal:10.w),
// child: Text(
// S.of(context).xiangce,
// style: TextStyle(
// color: Colors.white,
// fontSize: 18.sp,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
// ),
],
),
),
top: MediaQuery.of(context).padding.top,
left: 0,
right: 0,
),
Positioned(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
pickImage();
},
child: Container(
decoration: BoxDecoration(
color: Colors.white.withAlpha(35),
borderRadius: BorderRadius.circular(100),
),
padding: EdgeInsets.all(8.w),
margin: EdgeInsets.only(left: 12.w, right: 16.w, top: 16.h),
child:Icon(
Icons.image,
size: 25.w,
color: Colors.white,
),
),
),
right: 0,
bottom: 50.h,
),
],
),
);
}
pickImage() async {
List<Media> medias = await ImagePickers.pickerPaths(
galleryMode: GalleryMode.image,
selectCount: 1,
showGif: true,
showCamera: false,
compressSize: 500,
uiConfig: UIConfig(
uiThemeColor: Color(0xFFFFFFFF),
),
cropConfig: CropConfig(
enableCrop: false,
),
);
if (medias != null && medias.length > 0) {
String result = await Scan.parse(medias[0].path);
if (result != null && result != "") {
queryTicketDetails(result);
}else{
SmartDialog.show(
widget: SettlementTips(
() {
},
text: "照片中未识别到二维码/条码",
color: Color(0xFF30415B),
));
}
}
}
}

3
lib/main.dart

@ -106,6 +106,7 @@ import 'business_system/mine/shop_image_info.dart';
import 'business_system/order/business_order_detail.dart';
import 'business_system/order/order_write_off.dart';
import 'business_system/order/request_refund.dart';
import 'business_system/scan_code_page.dart';
import 'community/community_view/class_details.dart';
import 'community/headlines/headlines_column_details.dart';
import 'community/new_community_details.dart';
@ -509,4 +510,6 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
CustomPage(),
'/router/shop_image_info': (context, {arguments}) =>
ShopImageInfo(arguments:arguments),
'/router/scan_code_page': (context, {arguments}) =>
ScanCodePage(arguments:arguments),
};

4
lib/retrofit/business_api.dart

@ -23,6 +23,7 @@ import 'data/popular_sales_list.dart';
import 'data/product_group_list.dart';
import 'data/refund_reason_list.dart';
import 'data/single_sales_list.dart';
import 'data/ticket_details.dart';
import 'data/trade_summary_list.dart';
import 'data/upload_result.dart';
@ -257,4 +258,7 @@ abstract class BusinessApiService {
Future<BaseData> productSortTop(
@Body() Map<String, dynamic> param);
///
@GET("ticket/code/{code}")
Future<BaseData<TicketDetails>> ticketCode(@Path("code") String code);
}

82
lib/retrofit/business_api.g.dart

@ -38,7 +38,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@ -61,7 +61,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData<DayCount>.fromJson(
_result.data,
(json) => json == "" ? null : DayCount.fromJson(json),
(json) => (json ?? "") == "" ? null : DayCount.fromJson(json),
);
return value;
}
@ -225,7 +225,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData<TradeSummaryList>.fromJson(
_result.data,
(json) => json == "" ? null : TradeSummaryList.fromJson(json),
(json) => (json ?? "") == "" ? null : TradeSummaryList.fromJson(json),
);
return value;
}
@ -248,7 +248,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData<BusinessOrderList>.fromJson(
_result.data,
(json) => json == "" ? null : BusinessOrderList.fromJson(json),
(json) => (json ?? "") == "" ? null : BusinessOrderList.fromJson(json),
);
return value;
}
@ -271,7 +271,8 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData<BusinessOrderDetailInfo>.fromJson(
_result.data,
(json) => json == "" ? null : BusinessOrderDetailInfo.fromJson(json),
(json) =>
(json ?? "") == "" ? null : BusinessOrderDetailInfo.fromJson(json),
);
return value;
}
@ -293,7 +294,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData<RefundReasonList>.fromJson(
_result.data,
(json) => json == "" ? null : RefundReasonList.fromJson(json),
(json) => (json ?? "") == "" ? null : RefundReasonList.fromJson(json),
);
return value;
}
@ -316,7 +317,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@ -339,7 +340,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData<ProductGroupList>.fromJson(
_result.data,
(json) => json == "" ? null : ProductGroupList.fromJson(json),
(json) => (json ?? "") == "" ? null : ProductGroupList.fromJson(json),
);
return value;
}
@ -362,7 +363,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData<BusinessGoods>.fromJson(
_result.data,
(json) => json == "" ? null : BusinessGoods.fromJson(json),
(json) => (json ?? "") == "" ? null : BusinessGoods.fromJson(json),
);
return value;
}
@ -384,7 +385,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@ -396,7 +397,8 @@ class _BusinessApiService implements BusinessApiService {
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('product/putStatus',
final _result = await _dio.request<Map<String, dynamic>>(
'product/putStatus',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
@ -406,7 +408,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@ -418,7 +420,8 @@ class _BusinessApiService implements BusinessApiService {
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('product/delProduct',
final _result = await _dio.request<Map<String, dynamic>>(
'product/delProduct',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
@ -428,7 +431,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@ -440,7 +443,8 @@ class _BusinessApiService implements BusinessApiService {
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('productGroup/saveProductGroup',
final _result = await _dio.request<Map<String, dynamic>>(
'productGroup/saveProductGroup',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
@ -450,7 +454,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@ -462,7 +466,8 @@ class _BusinessApiService implements BusinessApiService {
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('productGroup/delProductCategory',
final _result = await _dio.request<Map<String, dynamic>>(
'productGroup/delProductCategory',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
@ -472,13 +477,14 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@override
Future<BaseData<BusinessStoreList>> getStoreList(tenantCode,pageIndex,pageSize) async {
Future<BaseData<BusinessStoreList>> getStoreList(
tenantCode, pageIndex, pageSize) async {
ArgumentError.checkNotNull(tenantCode, 'tenantCode');
ArgumentError.checkNotNull(pageIndex, 'pageIndex');
ArgumentError.checkNotNull(pageSize, 'pageSize');
@ -496,7 +502,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData<BusinessStoreList>.fromJson(
_result.data,
(json) => BusinessStoreList.fromJson(json),
(json) => BusinessStoreList.fromJson(json),
);
return value;
}
@ -518,7 +524,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@ -548,7 +554,7 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData<UploadResult>.fromJson(
_result.data,
(json) => UploadResult.fromJson(json),
(json) => UploadResult.fromJson(json),
);
return value;
}
@ -558,7 +564,8 @@ class _BusinessApiService implements BusinessApiService {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>('ticket/wipedBatchs',
final _result = await _dio.request<Map<String, dynamic>>(
'ticket/wipedBatchs',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
@ -568,7 +575,7 @@ class _BusinessApiService implements BusinessApiService {
data: param);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@ -580,7 +587,8 @@ class _BusinessApiService implements BusinessApiService {
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('product/productSortTop',
final _result = await _dio.request<Map<String, dynamic>>(
'product/productSortTop',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
@ -590,7 +598,29 @@ class _BusinessApiService implements BusinessApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@override
Future<BaseData<TicketDetails>> ticketCode(code) async {
ArgumentError.checkNotNull(code, 'code');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'ticket/code/$code',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<TicketDetails>.fromJson(
_result.data,
(json) => (json ?? "") == "" ? null : TicketDetails.fromJson(json),
);
return value;
}

477
lib/retrofit/data/ticket_details.dart

@ -0,0 +1,477 @@
/// id : "1720379729141301248"
/// createTime : "2023-11-03 17:57:45"
/// createUser : "0"
/// updateTime : "2023-11-03 17:57:45"
/// updateUser : "0"
/// mid : "1379254113602109440"
/// storeId : "1645318098540036096"
/// orderId : "1720379636644315136"
/// orderProductId : "1720379636782727168"
/// productId : "1645714128276291584"
/// productSkuId : "1645714128343400448"
/// ticketWipedTimeTemplateId : "0"
/// amount : "0.01"
/// name : "四神汤 "
/// code : "T202311031757452621760001"
/// useStartTime : "2023-11-03 00:00:00"
/// useEndTime : "2023-12-02 17:57:45"
/// finishTime : null
/// type : "NORMAL"
/// source : null
/// takeType : null
/// style : ""
/// state : 1
/// canSettlement : true
/// canSubscribe : true
/// isDelete : 0
/// tenantCode : "1195"
/// ticketItemList : [{"id":"1720379729216798720","createTime":"2023-11-03 17:57:45","createUser":"0","updateTime":"2023-11-03 17:57:45","updateUser":"0","ticketId":"1720379729141301248","relationType":"PRODUCT","relationId":"1645714128343400448","name":"测试规格222","showImage":"","state":1,"finishTime":null,"isDelete":0,"tenantCode":"1195","canWipedNumber":1},{"id":"1720379729195827200","createTime":"2023-11-03 17:57:45","createUser":"0","updateTime":"2023-11-03 17:57:45","updateUser":"0","ticketId":"1720379729141301248","relationType":"PRODUCT","relationId":"1645714128343400448","name":"测试规格","showImage":"","state":1,"finishTime":null,"isDelete":0,"tenantCode":"1195","canWipedNumber":1}]
/// userName : ""
/// userAvatar : ""
/// isogenyNumber : 1
/// businessStartDate : null
/// businessEndDate : null
class TicketDetails {
TicketDetails({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String mid,
String storeId,
String orderId,
String orderProductId,
String productId,
String productSkuId,
String ticketWipedTimeTemplateId,
String amount,
String name,
String code,
String useStartTime,
String useEndTime,
dynamic finishTime,
String type,
dynamic source,
dynamic takeType,
String style,
num state,
bool canSettlement,
bool canSubscribe,
num isDelete,
String tenantCode,
List<TicketItemList> ticketItemList,
String userName,
String userAvatar,
num isogenyNumber,
dynamic businessStartDate,
dynamic businessEndDate,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_mid = mid;
_storeId = storeId;
_orderId = orderId;
_orderProductId = orderProductId;
_productId = productId;
_productSkuId = productSkuId;
_ticketWipedTimeTemplateId = ticketWipedTimeTemplateId;
_amount = amount;
_name = name;
_code = code;
_useStartTime = useStartTime;
_useEndTime = useEndTime;
_finishTime = finishTime;
_type = type;
_source = source;
_takeType = takeType;
_style = style;
_state = state;
_canSettlement = canSettlement;
_canSubscribe = canSubscribe;
_isDelete = isDelete;
_tenantCode = tenantCode;
_ticketItemList = ticketItemList;
_userName = userName;
_userAvatar = userAvatar;
_isogenyNumber = isogenyNumber;
_businessStartDate = businessStartDate;
_businessEndDate = businessEndDate;
}
TicketDetails.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_mid = json['mid'];
_storeId = json['storeId'];
_orderId = json['orderId'];
_orderProductId = json['orderProductId'];
_productId = json['productId'];
_productSkuId = json['productSkuId'];
_ticketWipedTimeTemplateId = json['ticketWipedTimeTemplateId'];
_amount = json['amount'];
_name = json['name'];
_code = json['code'];
_useStartTime = json['useStartTime'];
_useEndTime = json['useEndTime'];
_finishTime = json['finishTime'];
_type = json['type'];
_source = json['source'];
_takeType = json['takeType'];
_style = json['style'];
_state = json['state'];
_canSettlement = json['canSettlement'];
_canSubscribe = json['canSubscribe'];
_isDelete = json['isDelete'];
_tenantCode = json['tenantCode'];
if (json['ticketItemList'] != null) {
_ticketItemList = [];
json['ticketItemList'].forEach((v) {
_ticketItemList.add(TicketItemList.fromJson(v));
});
}
_userName = json['userName'];
_userAvatar = json['userAvatar'];
_isogenyNumber = json['isogenyNumber'];
_businessStartDate = json['businessStartDate'];
_businessEndDate = json['businessEndDate'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _mid;
String _storeId;
String _orderId;
String _orderProductId;
String _productId;
String _productSkuId;
String _ticketWipedTimeTemplateId;
String _amount;
String _name;
String _code;
String _useStartTime;
String _useEndTime;
dynamic _finishTime;
String _type;
dynamic _source;
dynamic _takeType;
String _style;
num _state;
bool _canSettlement;
bool _canSubscribe;
num _isDelete;
String _tenantCode;
List<TicketItemList> _ticketItemList;
String _userName;
String _userAvatar;
num _isogenyNumber;
dynamic _businessStartDate;
dynamic _businessEndDate;
TicketDetails copyWith({ String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String mid,
String storeId,
String orderId,
String orderProductId,
String productId,
String productSkuId,
String ticketWipedTimeTemplateId,
String amount,
String name,
String code,
String useStartTime,
String useEndTime,
dynamic finishTime,
String type,
dynamic source,
dynamic takeType,
String style,
num state,
bool canSettlement,
bool canSubscribe,
num isDelete,
String tenantCode,
List<TicketItemList> ticketItemList,
String userName,
String userAvatar,
num isogenyNumber,
dynamic businessStartDate,
dynamic businessEndDate,
}) => TicketDetails( id: id ?? _id,
createTime: createTime ?? _createTime,
createUser: createUser ?? _createUser,
updateTime: updateTime ?? _updateTime,
updateUser: updateUser ?? _updateUser,
mid: mid ?? _mid,
storeId: storeId ?? _storeId,
orderId: orderId ?? _orderId,
orderProductId: orderProductId ?? _orderProductId,
productId: productId ?? _productId,
productSkuId: productSkuId ?? _productSkuId,
ticketWipedTimeTemplateId: ticketWipedTimeTemplateId ?? _ticketWipedTimeTemplateId,
amount: amount ?? _amount,
name: name ?? _name,
code: code ?? _code,
useStartTime: useStartTime ?? _useStartTime,
useEndTime: useEndTime ?? _useEndTime,
finishTime: finishTime ?? _finishTime,
type: type ?? _type,
source: source ?? _source,
takeType: takeType ?? _takeType,
style: style ?? _style,
state: state ?? _state,
canSettlement: canSettlement ?? _canSettlement,
canSubscribe: canSubscribe ?? _canSubscribe,
isDelete: isDelete ?? _isDelete,
tenantCode: tenantCode ?? _tenantCode,
ticketItemList: ticketItemList ?? _ticketItemList,
userName: userName ?? _userName,
userAvatar: userAvatar ?? _userAvatar,
isogenyNumber: isogenyNumber ?? _isogenyNumber,
businessStartDate: businessStartDate ?? _businessStartDate,
businessEndDate: businessEndDate ?? _businessEndDate,
);
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get mid => _mid;
String get storeId => _storeId;
String get orderId => _orderId;
String get orderProductId => _orderProductId;
String get productId => _productId;
String get productSkuId => _productSkuId;
String get ticketWipedTimeTemplateId => _ticketWipedTimeTemplateId;
String get amount => _amount;
String get name => _name;
String get code => _code;
String get useStartTime => _useStartTime;
String get useEndTime => _useEndTime;
dynamic get finishTime => _finishTime;
String get type => _type;
dynamic get source => _source;
dynamic get takeType => _takeType;
String get style => _style;
num get state => _state;
bool get canSettlement => _canSettlement;
bool get canSubscribe => _canSubscribe;
num get isDelete => _isDelete;
String get tenantCode => _tenantCode;
List<TicketItemList> get ticketItemList => _ticketItemList;
String get userName => _userName;
String get userAvatar => _userAvatar;
num get isogenyNumber => _isogenyNumber;
dynamic get businessStartDate => _businessStartDate;
dynamic get businessEndDate => _businessEndDate;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['mid'] = _mid;
map['storeId'] = _storeId;
map['orderId'] = _orderId;
map['orderProductId'] = _orderProductId;
map['productId'] = _productId;
map['productSkuId'] = _productSkuId;
map['ticketWipedTimeTemplateId'] = _ticketWipedTimeTemplateId;
map['amount'] = _amount;
map['name'] = _name;
map['code'] = _code;
map['useStartTime'] = _useStartTime;
map['useEndTime'] = _useEndTime;
map['finishTime'] = _finishTime;
map['type'] = _type;
map['source'] = _source;
map['takeType'] = _takeType;
map['style'] = _style;
map['state'] = _state;
map['canSettlement'] = _canSettlement;
map['canSubscribe'] = _canSubscribe;
map['isDelete'] = _isDelete;
map['tenantCode'] = _tenantCode;
if (_ticketItemList != null) {
map['ticketItemList'] = _ticketItemList.map((v) => v.toJson()).toList();
}
map['userName'] = _userName;
map['userAvatar'] = _userAvatar;
map['isogenyNumber'] = _isogenyNumber;
map['businessStartDate'] = _businessStartDate;
map['businessEndDate'] = _businessEndDate;
return map;
}
}
/// id : "1720379729216798720"
/// createTime : "2023-11-03 17:57:45"
/// createUser : "0"
/// updateTime : "2023-11-03 17:57:45"
/// updateUser : "0"
/// ticketId : "1720379729141301248"
/// relationType : "PRODUCT"
/// relationId : "1645714128343400448"
/// name : "测试规格222"
/// showImage : ""
/// state : 1
/// finishTime : null
/// isDelete : 0
/// tenantCode : "1195"
/// canWipedNumber : 1
class TicketItemList {
TicketItemList({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String ticketId,
String relationType,
String relationId,
String name,
String showImage,
num state,
dynamic finishTime,
num isDelete,
String tenantCode,
num canWipedNumber,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_ticketId = ticketId;
_relationType = relationType;
_relationId = relationId;
_name = name;
_showImage = showImage;
_state = state;
_finishTime = finishTime;
_isDelete = isDelete;
_tenantCode = tenantCode;
_canWipedNumber = canWipedNumber;
}
TicketItemList.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_ticketId = json['ticketId'];
_relationType = json['relationType'];
_relationId = json['relationId'];
_name = json['name'];
_showImage = json['showImage'];
_state = json['state'];
_finishTime = json['finishTime'];
_isDelete = json['isDelete'];
_tenantCode = json['tenantCode'];
_canWipedNumber = json['canWipedNumber'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _ticketId;
String _relationType;
String _relationId;
String _name;
String _showImage;
num _state;
dynamic _finishTime;
num _isDelete;
String _tenantCode;
num _canWipedNumber;
TicketItemList copyWith({ String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String ticketId,
String relationType,
String relationId,
String name,
String showImage,
num state,
dynamic finishTime,
num isDelete,
String tenantCode,
num canWipedNumber,
}) => TicketItemList( id: id ?? _id,
createTime: createTime ?? _createTime,
createUser: createUser ?? _createUser,
updateTime: updateTime ?? _updateTime,
updateUser: updateUser ?? _updateUser,
ticketId: ticketId ?? _ticketId,
relationType: relationType ?? _relationType,
relationId: relationId ?? _relationId,
name: name ?? _name,
showImage: showImage ?? _showImage,
state: state ?? _state,
finishTime: finishTime ?? _finishTime,
isDelete: isDelete ?? _isDelete,
tenantCode: tenantCode ?? _tenantCode,
canWipedNumber: canWipedNumber ?? _canWipedNumber,
);
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get ticketId => _ticketId;
String get relationType => _relationType;
String get relationId => _relationId;
String get name => _name;
String get showImage => _showImage;
num get state => _state;
dynamic get finishTime => _finishTime;
num get isDelete => _isDelete;
String get tenantCode => _tenantCode;
num get canWipedNumber => _canWipedNumber;
bool _isSelect = false;
bool get isSelect => _isSelect;
set isSelect(bool value) {
_isSelect = value;
}
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['ticketId'] = _ticketId;
map['relationType'] = _relationType;
map['relationId'] = _relationId;
map['name'] = _name;
map['showImage'] = _showImage;
map['state'] = _state;
map['finishTime'] = _finishTime;
map['isDelete'] = _isDelete;
map['tenantCode'] = _tenantCode;
map['canWipedNumber'] = _canWipedNumber;
return map;
}
}

8
lib/retrofit/min_api.g.dart

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

28
lib/retrofit/retrofit_api.g.dart

@ -90,7 +90,7 @@ class _ApiService implements ApiService {
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@ -133,7 +133,7 @@ class _ApiService implements ApiService {
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json == null ? null :json as dynamic,
(json) => ((json ?? "") == "") ? null : (json as dynamic),
);
return value;
}
@ -355,7 +355,7 @@ class _ApiService implements ApiService {
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json == null ? null : json as dynamic,
(json) => ((json ?? "") == "") ? null : (json as dynamic),
);
return value;
}
@ -588,9 +588,7 @@ class _ApiService implements ApiService {
data: _data);
final value = BaseData<List<Store>>.fromJson(
_result.data,
(json) => ((json ?? "") == "")
? null
: (json as List<dynamic>)
(json) => ((json ?? "") == "") ? null : (json as List<dynamic>)
.map<Store>((i) => Store.fromJson(i as Map<String, dynamic>))
.toList());
return value;
@ -910,7 +908,7 @@ class _ApiService implements ApiService {
data: _data);
final value = BaseData<OrderInfo>.fromJson(
_result.data,
(json) => json == null ? null : OrderInfo.fromJson(json),
(json) => (json ?? "") == "" ? null : OrderInfo.fromJson(json),
);
return value;
}
@ -1068,7 +1066,9 @@ class _ApiService implements ApiService {
extra: _extra,
baseUrl: baseUrl),
data: _data);
return (_result.data['repCode'] != '0000' || _result.data['repData'] == null || !_result.data['repData']['result']);
return (_result.data['repCode'] != '0000' ||
_result.data['repData'] == null ||
!_result.data['repData']['result']);
}
@override
@ -1312,7 +1312,7 @@ class _ApiService implements ApiService {
data: _data);
final value = BaseData<String>.fromJson(
_result.data,
(json) => json == null ? null : (json as String),
(json) => (json ?? "") == "" ? null : (json as String),
);
return value;
}
@ -1684,10 +1684,12 @@ class _ApiService implements ApiService {
data: _data);
final value = BaseData<List<VipBenefitList>>.fromJson(
_result.data,
(json) => ((json??"") == "")?null:(json as List<dynamic>)
.map<VipBenefitList>(
(i) => VipBenefitList.fromJson(i as Map<String, dynamic>))
.toList());
(json) => ((json ?? "") == "")
? null
: (json as List<dynamic>)
.map<VipBenefitList>(
(i) => VipBenefitList.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}

6
lib/settlement/settlement.dart

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

15
lib/settlement/settlement_view/coupon.dart

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

3
lib/union/union_select_city.dart

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

121
lib/view_widget/selector_store_dialog.dart

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

Loading…
Cancel
Save