diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 173f6c23..56de748a 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -95,6 +95,9 @@
lineauth
line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)
alipay
+ iosamap
+ qqmap
+ baidumap
LSRequiresIPhoneOS
@@ -177,11 +180,5 @@
location
- LSApplicationQueriesSchemes
-
- iosamap
- qqmap
- baidumap
-
diff --git a/lib/business_system/business_page.dart b/lib/business_system/business_page.dart
index f0101c45..f9e0e651 100644
--- a/lib/business_system/business_page.dart
+++ b/lib/business_system/business_page.dart
@@ -7,6 +7,7 @@ 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 {
@@ -49,10 +50,10 @@ class _BusinessPage extends State
selectStoreIndex = index;
});
}),
- if (choiceIndex == 1) BusinessOrderPage(),
- if (choiceIndex == 2) BusinessOrderPage(),
- if (choiceIndex == 3) BusinessGoodsPage(),
- if (choiceIndex == 4) BusinessMinePage(),
+ if (choiceIndex == 1) BusinessOrderPage(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
+ if (choiceIndex == 2) BusinessScanCode(),
+ if (choiceIndex == 3) BusinessGoodsPage(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
+ if (choiceIndex == 4) BusinessMinePage(businessLoginInfo,businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
Align(
alignment: Alignment.bottomCenter,
child: Container(
diff --git a/lib/business_system/business_scan_code.dart b/lib/business_system/business_scan_code.dart
new file mode 100644
index 00000000..be02bc49
--- /dev/null
+++ b/lib/business_system/business_scan_code.dart
@@ -0,0 +1,138 @@
+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 createState() {
+ return _BusinessScanCode();
+ }
+}
+
+class _BusinessScanCode extends State
+ 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.spaceBetween,
+ 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.black,
+ fontSize: 18.sp,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ top:MediaQuery.of(context).padding.top,
+ left: 0,
+ right: 0,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ pickImage() async {
+ List 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;
+}
diff --git a/lib/business_system/date_select/custom_page.dart b/lib/business_system/date_select/custom_page.dart
index 1d10d4b0..b3017292 100644
--- a/lib/business_system/date_select/custom_page.dart
+++ b/lib/business_system/date_select/custom_page.dart
@@ -21,9 +21,9 @@ class _CustomPage extends State{
setState(() {
if (args.value is PickerDateRange) {
customDate =
- DateFormat('yyyy年MM月dd日').format(args.value.startDate).toString() +
+ DateFormat('yyyy年MM月dd日 HH:mm:ss').format(args.value.startDate).toString() +
' 至 ' +
- DateFormat('yyyy年MM月dd日')
+ DateFormat('yyyy年MM月dd日 23:59:59')
.format(args.value.endDate ?? args.value.startDate)
.toString();
}
diff --git a/lib/business_system/goods/business_goods_page.dart b/lib/business_system/goods/business_goods_page.dart
index 28ce619f..c9a1c962 100644
--- a/lib/business_system/goods/business_goods_page.dart
+++ b/lib/business_system/goods/business_goods_page.dart
@@ -9,6 +9,9 @@ import '../../view_widget/my_tab.dart';
import 'on_sale/on_sale_page.dart';
class BusinessGoodsPage extends StatefulWidget {
+ final String storeId;
+
+ BusinessGoodsPage(this.storeId);
@override
State createState() {
@@ -68,7 +71,7 @@ class _BusinessGoodsPage extends State
),
body: TabBarView(
children: [
- OnSalePage(),
+ OnSalePage(widget.storeId),
OffShelfPage(),],
),
),
diff --git a/lib/business_system/goods/on_sale/on_sale_page.dart b/lib/business_system/goods/on_sale/on_sale_page.dart
index 6c2ce485..6ab96843 100644
--- a/lib/business_system/goods/on_sale/on_sale_page.dart
+++ b/lib/business_system/goods/on_sale/on_sale_page.dart
@@ -1,14 +1,26 @@
+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/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';
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_goods.dart';
+import '../../../retrofit/data/product_group_list.dart';
+import '../../../utils/business_instance.dart';
+import '../../../utils/flutter_utils.dart';
import '../../../utils/font_weight.dart';
class OnSalePage extends StatefulWidget {
+ final String storeId;
+ OnSalePage(this.storeId);
@override
State createState() {
return _OnSalePage();
@@ -19,6 +31,9 @@ class _OnSalePage extends State {
final RefreshController _refreshController = RefreshController();
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics();
final ScrollController controller = ScrollController();
+ BusinessApiService businessService;
+ ProductGroupList productGroupList;
+ BusinessGoods businessGoods;
@override
void dispose() {
@@ -30,8 +45,77 @@ class _OnSalePage extends State {
void initState() {
super.initState();
}
+ _onRefresh({bool isShowLoad = true}) async {
+ if (isShowLoad)
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai,
+ maskType: EasyLoadingMaskType.black);
+ await queryGroupList();
+ await queryGoodsList();
+ EasyLoading.dismiss();
+ if (!mounted) return;
+ if (_refreshController.isRefresh) _refreshController.refreshCompleted();
+ setState(() {});
+ }
- _onRefresh() async {}
+ ///分组列表
+ queryGroupList() async {
+ if (businessService == null) {
+ businessService = BusinessApiService(Dio(),
+ context: context,
+ token: BusinessInstance.instance.businessToken,
+ tenant: BusinessInstance.instance.businessTenant,
+ storeId: widget.storeId);
+ }
+ BaseData baseData =
+ await businessService.productGroup({
+ "current":1,
+ "map": {},
+ "model": {
+ "groupImg":"",
+ "groupName":"",
+ "isDelete":""
+ },
+ "size":50,
+ "sort":"sort"
+ }).catchError((error) {
+ SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
+ alignment: Alignment.center);
+ });
+ if (!mounted) return;
+ if (baseData != null && baseData.isSuccess) {
+ productGroupList = baseData.data;
+ } else {
+ SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
+ }
+ }
+
+ ///商品列表
+ queryGoodsList() async {
+ if (businessService == null) {
+ businessService = BusinessApiService(Dio(),
+ context: context,
+ token: BusinessInstance.instance.businessToken,
+ tenant: BusinessInstance.instance.businessTenant,
+ storeId: widget.storeId);
+ }
+ BaseData baseData =
+ await businessService.findAdminProductLis({
+ "groupId": "",
+ "hasStock": 1,
+ "keyword": "",
+ "pageIndex": 1,
+ "pageSize": 10,
+ "status": "1",
+ }).catchError((error) {
+ });
+ if (!mounted) return;
+ if (baseData != null && baseData.isSuccess) {
+ businessGoods = baseData.data;
+ } else {
+ SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
+ }
+ }
@override
Widget build(BuildContext context) {
@@ -65,11 +149,7 @@ class _OnSalePage extends State {
return MyFooter(mode);
},
),
- onRefresh: () {
- setState(() {
- _onRefresh();
- });
- },
+ onRefresh: _onRefresh(),
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Container(
diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart
index 1dd2da17..2a4ec070 100644
--- a/lib/business_system/home/business_home_page.dart
+++ b/lib/business_system/home/business_home_page.dart
@@ -566,16 +566,15 @@ class _BusinessHomePage extends State
height: 18.h,
),
if (lineChartSample2Data.isNotEmpty)
- // (lineChartSample2Data.isNotEmpty)
- // ? NoDataView(
- // src: "assets/image/xiao_fei.webp",
- // isShowBtn: false,
- // text: "暂无数据",
- // fontSize: 16.sp,
- // margin: EdgeInsets.all(20.h),
- // )
- // :
- LineChartSample2(lineChartSample2Data, "销售量"),
+ (lineChartSample2Data.isNotEmpty)
+ ? NoDataView(
+ src: "assets/image/bs_no data_logo.webp",
+ isShowBtn: false,
+ text: "暂无数据",
+ fontSize: 16.sp,
+ margin: EdgeInsets.all(20.h),
+ )
+ : LineChartSample2(lineChartSample2Data, "销售量"),
],
),
);
diff --git a/lib/business_system/home/overview/trade_goods.dart b/lib/business_system/home/overview/trade_goods.dart
index da896561..1ec48dde 100644
--- a/lib/business_system/home/overview/trade_goods.dart
+++ b/lib/business_system/home/overview/trade_goods.dart
@@ -71,14 +71,101 @@ class _TradeGoods extends State {
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
- querySingleSales(
- dayDate.replaceAll("年", "-").replaceAll("月", "-").replaceAll("日", ""),
- dayDate.replaceAll("年", "-").replaceAll("月", "-").replaceAll("日", ""),
- isSing: false);
- queryGoodsSalesList(
- dayDate.replaceAll("年", "-").replaceAll("月", "-").replaceAll("日", ""),
- dayDate.replaceAll("年", "-").replaceAll("月", "-").replaceAll("日", ""),
- isSing: false);
+ if (dateIndex == 0) {
+ querySingleSales(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ isSing: false);
+ queryGoodsSalesList(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ isSing: false);
+ } else if (dateIndex == 1) {
+ querySingleSales(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(12, 23),
+ isSing: false);
+ queryGoodsSalesList(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(12, 23),
+ isSing: false);
+ } else if (dateIndex == 2) {
+ querySingleSales(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "",
+ isSing: false);
+ queryGoodsSalesList(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "",
+ isSing: false);
+ } else if (dateIndex == 3) {
+ querySingleSales(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(timeDate().length <= 15 ? 0 : 12,
+ timeDate().length <= 15 ? 10 : 23),
+ isSing: false);
+ queryGoodsSalesList(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(timeDate().length <= 15 ? 0 : 12,
+ timeDate().length <= 15 ? 10 : 23),
+ isSing: false);
+ }
});
}
@@ -597,7 +684,7 @@ class _TradeGoods extends State {
} else if (dateIndex == 3) {
return (customDate == "" || customDate == null)
? "${customDateNum ?? ""}(今日)"
- : customDate;
+ : ("${customDate.substring(0,11)} ""${customDate.substring(21,34)}");
}
}
diff --git a/lib/business_system/home/overview/trade_order.dart b/lib/business_system/home/overview/trade_order.dart
index 5b85f02c..33602302 100644
--- a/lib/business_system/home/overview/trade_order.dart
+++ b/lib/business_system/home/overview/trade_order.dart
@@ -1,15 +1,30 @@
+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/my_footer.dart';
import 'package:intl/intl.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+import '../../../generated/l10n.dart';
+import '../../../retrofit/business_api.dart';
+import '../../../retrofit/data/base_data.dart';
+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 {
+ final storeId;
+
+ TradeOrder(this.storeId);
+
@override
State createState() {
return _TradeOrder();
@@ -19,32 +34,38 @@ class TradeOrder extends StatefulWidget {
class _TradeOrder extends State {
final RefreshController _refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
- List lineChartSample2DataAmount =
- [LineChartSample2Data(0,10,"2023-03-09"),
- LineChartSample2Data(1,10,"2023-03-10"),
- LineChartSample2Data(2,60,"2023-03-11"),
- LineChartSample2Data(3,35,"2023-03-12"),
- LineChartSample2Data(4,20,"2023-03-13"),
- LineChartSample2Data(5,55,"2023-03-14"),
- LineChartSample2Data(6,99,"2023-03-15")];
- List lineChartSample2DataNum =
- [LineChartSample2Data(0,60,"2023-03-09"),
- LineChartSample2Data(1,30,"2023-03-10"),
- LineChartSample2Data(2,50,"2023-03-11"),
- LineChartSample2Data(3,80,"2023-03-12"),
- LineChartSample2Data(4,5,"2023-03-13"),
- LineChartSample2Data(5,55,"2023-03-14"),
- LineChartSample2Data(6,98,"2023-03-15")];
+ List lineChartSample2DataOrderAmount = [
+ LineChartSample2Data(0, 0, "2023-03-09"),
+ LineChartSample2Data(1, 0, "2023-03-10"),
+ LineChartSample2Data(2, 0, "2023-03-11"),
+ LineChartSample2Data(3, 0, "2023-03-12"),
+ LineChartSample2Data(4, 0, "2023-03-13"),
+ LineChartSample2Data(5, 0, "2023-03-14"),
+ LineChartSample2Data(6, 0, "2023-03-15")
+ ];
+ List lineChartSample2DataOrderNum = [
+ LineChartSample2Data(0, 0, "2023-03-09"),
+ LineChartSample2Data(1, 0, "2023-03-10"),
+ LineChartSample2Data(2, 0, "2023-03-11"),
+ LineChartSample2Data(3, 0, "2023-03-12"),
+ LineChartSample2Data(4, 0, "2023-03-13"),
+ LineChartSample2Data(5, 0, "2023-03-14"),
+ LineChartSample2Data(6, 0, "2023-03-15")
+ ];
int dateIndex = 0;
String selectedDate = "";
String dayDate = "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
- String weekDate ="";
- String weekDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now().subtract(Duration(days:6)))} 至 "
+ String weekDate = "";
+ String weekDateNum =
+ "${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月").format(DateTime.now())}";
- String customDate ="";
+ String monthlyDate = "";
+ String monthlyDateNum = "${DateFormat("yyyy年MM月dd").format(DateTime.now())}";
+ String customDate = "";
String customDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
+ int _loadCount = 0;
+ BusinessApiService businessService;
+ TradeSummaryList tradeSummaryList;
@override
void dispose() {
@@ -55,9 +76,137 @@ class _TradeOrder extends State {
@override
void initState() {
super.initState();
+ _onRefresh();
}
_onRefresh() async {
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
+ SharedPreferences.getInstance().then((value) {
+ businessService = BusinessApiService(Dio(),
+ context: context,
+ token: BusinessInstance.instance.businessToken,
+ tenant: BusinessInstance.instance.businessTenant,
+ storeId: widget.storeId);
+ if (dateIndex == 0) {
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "day",
+ isSing: false);
+ } else if (dateIndex == 1) {
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(12, 23),
+ "week",
+ isSing: false);
+ } else if (dateIndex == 2) {
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "month",
+ isSing: false);
+ } else if (dateIndex == 3) {
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(timeDate().length <= 15 ? 0 : 12,
+ timeDate().length <= 15 ? 10 : 23),
+ "custom",
+ isSing: false);
+ }
+ });
+ }
+
+ addLoadCount() {
+ _loadCount += 1;
+ if (_loadCount == 1) {
+ _loadCount = 0;
+ EasyLoading.dismiss();
+ if (_refreshController.isRefresh) _refreshController.refreshCompleted();
+ if (mounted) setState(() {});
+ }
+ }
+
+ ///订单分析/订单量趋势
+ queryBusinessAnalysis(selectDay, selectEndDay, queryRange,
+ {isSing = true}) async {
+ if (isSing)
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai,
+ maskType: EasyLoadingMaskType.black);
+ try {
+ BaseData baseData = await businessService
+ .saleBusinessAnalysis({
+ "selectDay": selectDay,
+ "selectEndDay": selectEndDay,
+ "queryRange": queryRange
+ }).catchError((error) {
+ SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
+ alignment: Alignment.center);
+ });
+ if (baseData != null && baseData.isSuccess) {
+ int amountIndex = 0;
+ int numIndex = 0;
+ if (baseData.data.saleBusinessAnalysisVOS.isNotEmpty) {
+ lineChartSample2DataOrderAmount.clear();
+ lineChartSample2DataOrderNum.clear();
+ }
+ tradeSummaryList = baseData.data;
+ tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
+ lineChartSample2DataOrderAmount.add(LineChartSample2Data(
+ amountIndex.toDouble(),
+ double.tryParse(element.localDateBigDecimal.toString()),
+ element.localDateTime.substring(0, 10)));
+ amountIndex += 1;
+ });
+ tradeSummaryList.saleBusinessAnalysisVOS.forEach((element) {
+ lineChartSample2DataOrderNum.add(LineChartSample2Data(
+ numIndex.toDouble(),
+ double.tryParse(element.localDateCount.toString()),
+ element.localDateTime.substring(0, 10)));
+ numIndex += 1;
+ });
+ }
+ } finally {
+ if (isSing) {
+ setState(() {});
+ EasyLoading.dismiss();
+ } else {
+ addLoadCount();
+ }
+ }
}
@override
@@ -71,302 +220,457 @@ class _TradeOrder extends State {
width: double.infinity,
height: 1.h,
),
- Expanded(child: SmartRefresher(
- controller: _refreshController,
- enablePullDown: true,
- enablePullUp: false,
- header: MyHeader(),
- physics: BouncingScrollPhysics(),
- scrollController: scrollController,
- footer: CustomFooter(
- builder: (context, mode) {
- return MyFooter(mode);
- },
- ),
- onRefresh: () {
- setState(() {
- _onRefresh();
- });
- },
- child: SingleChildScrollView(
- physics: NeverScrollableScrollPhysics(),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- color: Color(0xFFF6F6F6),
- borderRadius: BorderRadius.circular(2),
- border: Border.all(color: Color(0xFFCFD0D1),
- width: 1.w),
- ),
- margin: EdgeInsets.only(
- top: 16.h, right: 20.w, left: 20.w, bottom: 12.h),
- child: Row(
- children: [
- Expanded(child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- setState((){
+ Expanded(
+ child: SmartRefresher(
+ controller: _refreshController,
+ enablePullDown: true,
+ enablePullUp: false,
+ header: MyHeader(),
+ physics: BouncingScrollPhysics(),
+ scrollController: scrollController,
+ footer: CustomFooter(
+ builder: (context, mode) {
+ return MyFooter(mode);
+ },
+ ),
+ onRefresh: _onRefresh,
+ child: SingleChildScrollView(
+ physics: NeverScrollableScrollPhysics(),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Container(
+ decoration: BoxDecoration(
+ color: Color(0xFFF6F6F6),
+ borderRadius: BorderRadius.circular(2),
+ border:
+ Border.all(color: Color(0xFFCFD0D1), width: 1.w),
+ ),
+ margin: EdgeInsets.only(
+ top: 16.h, right: 20.w, left: 20.w, bottom: 12.h),
+ child: Row(
+ children: [
+ Expanded(
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
dateIndex = 0;
- });
- },
- child: Container(
- alignment: Alignment.center,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(2),
- color: dateIndex == 0 ? Color(0xFF30415B):Colors.transparent,
- ),
- padding: EdgeInsets.symmetric(vertical: 9.h),
- child: Text(
- "日报",
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.medium,
- color: dateIndex == 0 ? Colors.white:Color(0xFF30415B),
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "day");
+ },
+ child: Container(
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(2),
+ color: dateIndex == 0
+ ? Color(0xFF30415B)
+ : Colors.transparent,
+ ),
+ padding: EdgeInsets.symmetric(vertical: 9.h),
+ child: Text(
+ "日报",
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.medium,
+ color: dateIndex == 0
+ ? Colors.white
+ : Color(0xFF30415B),
+ ),
),
),
- ),
- )),
- Expanded(child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- setState((){
+ )),
+ Expanded(
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
dateIndex = 1;
- });},
- child: Container(
- alignment: Alignment.center,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(2),
- color: dateIndex == 1 ? Color(0xFF30415B):Colors.transparent,
- ),
- padding: EdgeInsets.symmetric(vertical: 9.h),
- child: Text(
- "周报",
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.medium,
- color: dateIndex == 1 ? Colors.white:Color(0xFF30415B),
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(12, 23),
+ "week");
+ },
+ child: Container(
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(2),
+ color: dateIndex == 1
+ ? Color(0xFF30415B)
+ : Colors.transparent,
+ ),
+ padding: EdgeInsets.symmetric(vertical: 9.h),
+ child: Text(
+ "周报",
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.medium,
+ color: dateIndex == 1
+ ? Colors.white
+ : Color(0xFF30415B),
+ ),
),
),
- ),)),
- Expanded(child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- setState((){
+ )),
+ Expanded(
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
dateIndex = 2;
- });
- },
- child: Container(
- alignment: Alignment.center,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(2),
- color: dateIndex == 2 ? Color(0xFF30415B):Colors.transparent,
- ),
- padding: EdgeInsets.symmetric(vertical: 9.h),
- child: Text(
- "月报",
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.medium,
- color: dateIndex == 2 ? Colors.white:Color(0xFF30415B),
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "month");
+ },
+ child: Container(
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(2),
+ color: dateIndex == 2
+ ? Color(0xFF30415B)
+ : Colors.transparent,
+ ),
+ padding: EdgeInsets.symmetric(vertical: 9.h),
+ child: Text(
+ "月报",
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.medium,
+ color: dateIndex == 2
+ ? Colors.white
+ : Color(0xFF30415B),
+ ),
),
),
- ),)),
- Expanded(child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- setState((){
+ )),
+ Expanded(
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
dateIndex = 3;
- });
- },
- child: Container(
- alignment: Alignment.center,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(2),
- color: dateIndex == 3 ? Color(0xFF30415B):Colors.transparent,
- ),
- padding: EdgeInsets.symmetric(vertical: 9.h),
- child: Text(
- "自定义",
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.medium,
- color: dateIndex == 3 ? Colors.white:Color(0xFF30415B),
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(
+ timeDate().length <= 15 ? 0 : 12,
+ timeDate().length <= 15 ? 10 : 23),
+ "custom");
+ },
+ child: Container(
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(2),
+ color: dateIndex == 3
+ ? Color(0xFF30415B)
+ : Colors.transparent,
),
- ),
- ),)),
- ],
- ),
- ),
- Align(alignment: Alignment.center,
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- if(dateIndex == 0){
- Navigator.of(context).pushNamed('/router/day_report_page').then((value) {
- setState((){
- selectedDate = value;
- });
- });
- }
- else if(dateIndex == 1){
- Navigator.of(context).pushNamed('/router/week_report_page').then((value) {
- setState((){
- weekDate = value;
- });
- });
- }
- else if(dateIndex == 2){
- Navigator.of(context).pushNamed('/router/monthly_report_page').then((value) {
- setState((){
- monthlyDate = value;
- });
- });
- }
- else if(dateIndex == 3){
- Navigator.of(context).pushNamed('/router/custom_page').then((value){
- setState((){
- customDate = value;
- });
- });
- }
- },
- child: Container(
- width: 194.w,
- alignment: Alignment.center,
- padding: EdgeInsets.all(8),
- decoration: BoxDecoration(
- color: Color(0xFFF6F6F6),
- borderRadius: BorderRadius.circular(2),
- ),
- margin: EdgeInsets.only(bottom:16.h),
- child: Row(
- children: [
- Expanded(child:Container(
- alignment: Alignment.center,
- child: Text(
- timeDate(),
- style: TextStyle(
- fontSize: 10.sp,
- fontWeight: MyFontWeight.regular,
- color: Colors.black,
+ padding: EdgeInsets.symmetric(vertical: 9.h),
+ child: Text(
+ "自定义",
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.medium,
+ color: dateIndex == 3
+ ? Colors.white
+ : Color(0xFF30415B),
+ ),
),
),
)),
- Image.asset(
- "assets/image/bs_calendar_logo.webp",
- width:15,
- height:15,
- ),
],
),
),
- ),),
- Padding(padding:EdgeInsets.only(left:16.w,bottom:15.h),
- child:Text(
- "订单分析",
- style: TextStyle(
- fontSize: 18.sp,
- fontWeight: MyFontWeight.semi_bold,
- color: Colors.black,
+ Align(
+ alignment: Alignment.center,
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ if (dateIndex == 0) {
+ Navigator.of(context)
+ .pushNamed('/router/day_report_page')
+ .then((value) {
+ selectedDate = value;
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "day");
+ });
+ } else if (dateIndex == 1) {
+ Navigator.of(context)
+ .pushNamed('/router/week_report_page')
+ .then((value) {
+ weekDate = value;
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(12, 23),
+ "week");
+ });
+ } else if (dateIndex == 2) {
+ Navigator.of(context)
+ .pushNamed('/router/monthly_report_page')
+ .then((value) {
+ monthlyDate = value;
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "month");
+ });
+ } else if (dateIndex == 3) {
+ Navigator.of(context)
+ .pushNamed('/router/custom_page')
+ .then((value) {
+ customDate = value;
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(12, 23),
+ "custom");
+ });
+ }
+ },
+ child: Container(
+ width: 194.w,
+ alignment: Alignment.center,
+ padding: EdgeInsets.all(8),
+ decoration: BoxDecoration(
+ color: Color(0xFFF6F6F6),
+ borderRadius: BorderRadius.circular(2),
+ ),
+ margin: EdgeInsets.only(bottom: 16.h),
+ child: Row(
+ children: [
+ Expanded(
+ child: Container(
+ alignment: Alignment.center,
+ child: Text(
+ dateIndex == 2
+ ? ((monthlyDateNum.substring(0, 8) ==
+ timeDate().substring(0, 8))
+ ? "${timeDate().substring(0, 8)}(当月)"
+ : timeDate().substring(0, 8))
+ : timeDate(),
+ style: TextStyle(
+ fontSize: 10.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Colors.black,
+ ),
+ ),
+ )),
+ Image.asset(
+ "assets/image/bs_calendar_logo.webp",
+ width: 15,
+ height: 15,
+ ),
+ ],
+ ),
+ ),
+ ),
),
- )),
- orderAmount(),
- orderNumTrend(),
- ],
- )),
- ),)
+ Padding(
+ padding: EdgeInsets.only(left: 16.w, bottom: 15.h),
+ child: Text(
+ "订单分析",
+ style: TextStyle(
+ fontSize: 18.sp,
+ fontWeight: MyFontWeight.semi_bold,
+ color: Colors.black,
+ ),
+ )),
+ orderAmount(),
+ orderNumTrend(),
+ ],
+ )),
+ ),
+ )
],
),
);
}
- String timeDate(){
- if(dateIndex == 0){
- return (selectedDate == "" || selectedDate == null) ? "${dayDate ?? ""}(今日)":(dayDate == DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate))
- ?"${DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate))}(今日)":DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate)));
- }
- else if(dateIndex == 1){
- return (weekDate == "" || weekDate == null) ? weekDateNum : weekDate;}
- else if(dateIndex == 2){
- return (monthlyDate == "" || monthlyDate == null) ? "${monthlyDateNum ?? ""}(当月)":
- (monthlyDateNum == (DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)).substring(0,8))?
- "${(DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)).substring(0,8))}(当月)"
- :DateFormat("yyyy年MM月dd日").format(DateTime.parse(monthlyDate)).substring(0,8));
+ String timeDate() {
+ if (dateIndex == 0) {
+ return (selectedDate == "" || selectedDate == null)
+ ? "${dayDate ?? ""}(今日)"
+ : (dayDate ==
+ DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate))
+ ? "${DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate))}(今日)"
+ : DateFormat("yyyy年MM月dd日").format(DateTime.parse(selectedDate)));
+ } else if (dateIndex == 1) {
+ return (weekDate == "" || weekDate == null) ? weekDateNum : weekDate;
+ } else if (dateIndex == 2) {
+ 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)));
+ } else if (dateIndex == 3) {
+ return (customDate == "" || customDate == null)
+ ? "${customDateNum ?? ""}(今日)"
+ : ("${customDate.substring(0,11)} ""${customDate.substring(21,34)}");
}
- else if(dateIndex == 3){
- return (customDate == "" || customDate == null) ? "${customDateNum??""}(今日)" : customDate;}
}
///订单金额
- Widget orderAmount(){
+ Widget orderAmount() {
return Column(
children: [
- Padding(padding:EdgeInsets.only(left:16.w,bottom: 15.h),
- child:Row(
+ Padding(
+ padding: EdgeInsets.only(left: 16.w, bottom: 15.h),
+ child: Row(
children: [
Container(
width: 4.w,
height: 16.h,
color: Color(0xFF30415B),
- margin: EdgeInsets.only(right:12.w),
+ margin: EdgeInsets.only(right: 12.w),
),
Text(
"订单金额",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
- color:Color(0xFF0D0D0D),
+ color: Color(0xFF0D0D0D),
),
),
- SizedBox(width:8.w,),
+ SizedBox(
+ width: 8.w,
+ ),
Text(
"近12周",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
- color:Color(0xFF666666),
+ color: Color(0xFF666666),
),
)
],
)),
- Padding(padding: EdgeInsets.symmetric(horizontal: 20.w),
- child:LineChartSample2(lineChartSample2DataAmount,"金额"),),
- SizedBox(height:16.h,),
+ (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, "金额"),
+ ),
+ SizedBox(
+ height: 16.h,
+ ),
],
);
}
///订单量趋势
- Widget orderNumTrend(){
+ Widget orderNumTrend() {
return Container(
- padding: EdgeInsets.only(top:12.h,bottom: 33.h),
+ padding: EdgeInsets.only(top: 12.h, bottom: 33.h),
child: Column(
children: [
- Padding(padding:EdgeInsets.only(left:16.w,bottom: 15.h),
- child:Row(
+ Padding(
+ padding: EdgeInsets.only(left: 16.w, bottom: 15.h),
+ child: Row(
children: [
Container(
width: 4.w,
height: 16.h,
color: Color(0xFF30415B),
- margin: EdgeInsets.only(right:12.w),
+ margin: EdgeInsets.only(right: 12.w),
),
Text(
"订单量趋势",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
- color:Color(0xFF0D0D0D),
+ color: Color(0xFF0D0D0D),
),
)
],
)),
- Padding(padding: EdgeInsets.symmetric(horizontal: 20.w),
- child:LineChartSample2(lineChartSample2DataNum,"订单量"),),
- SizedBox(height:16.h,),
-
+ (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(lineChartSample2DataOrderNum, "订单量"),
+ ),
+ SizedBox(
+ height: 16.h,
+ ),
],
),
);
diff --git a/lib/business_system/home/overview/trade_overview_page.dart b/lib/business_system/home/overview/trade_overview_page.dart
index e47bda0e..d387ed07 100644
--- a/lib/business_system/home/overview/trade_overview_page.dart
+++ b/lib/business_system/home/overview/trade_overview_page.dart
@@ -70,7 +70,7 @@ class _TradeOverviewPage extends State with SingleTickerProvi
body: TabBarView(
children: [
TradeSummary(storeId),
- TradeOrder(),
+ TradeOrder(storeId),
TradeGoods(storeId),],
),
),
diff --git a/lib/business_system/home/overview/trade_summary.dart b/lib/business_system/home/overview/trade_summary.dart
index b253ac6c..4ae543c3 100644
--- a/lib/business_system/home/overview/trade_summary.dart
+++ b/lib/business_system/home/overview/trade_summary.dart
@@ -92,11 +92,64 @@ class _TradeSummary extends State {
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
- queryBusinessAnalysis(
- dayDate.replaceAll("年", "-").replaceAll("月", "-").replaceAll("日", ""),
- dayDate.replaceAll("年", "-").replaceAll("月", "-").replaceAll("日", ""),
- "day",
- isSing: false);
+ if (dateIndex == 0) {
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "day",
+ isSing: false);
+ } else if (dateIndex == 1) {
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(12, 23),
+ "week",
+ isSing: false);
+ } else if (dateIndex == 2) {
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ "month",
+ isSing: false);
+ } else if (dateIndex == 3) {
+ queryBusinessAnalysis(
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(0, 10),
+ timeDate()
+ .replaceAll("年", "-")
+ .replaceAll("月", "-")
+ .replaceAll("日", "")
+ .substring(timeDate().length <= 15 ? 0 : 12,
+ timeDate().length <= 15 ? 10 : 23),
+ "custom",
+ isSing: false);
+ }
});
}
@@ -528,7 +581,7 @@ class _TradeSummary extends State {
} else if (dateIndex == 3) {
return (customDate == "" || customDate == null)
? "${customDateNum ?? ""}(今日)"
- : customDate;
+ : ("${customDate.substring(0,11)} ""${customDate.substring(21,34)}");
}
}
@@ -621,24 +674,33 @@ class _TradeSummary extends State {
margin: EdgeInsets.only(bottom: 30.h),
),
if (operateSelect == 0)
- // lineChartSample2DataAmount.isNotEmpty
- // ? NoDataView(
- // src: "assets/image/bs_no data_logo.webp",
- // isShowBtn: false,
- // text: "暂无数据",
- // fontSize: 16.sp,
- // margin: EdgeInsets.all(20.h),
- // )
- // :
- Container(
+ (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, "金额"),
),
if (operateSelect == 1)
- Padding(
- padding: EdgeInsets.symmetric(horizontal: 20.w),
- child: LineChartSample2(lineChartSample2DataNum, "交易笔数"),
- ),
+ (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(lineChartSample2DataNum, "交易笔数"),
+ ),
SizedBox(
height: 16.h,
),
@@ -751,53 +813,77 @@ class _TradeSummary extends State {
),
),
if (expensesSelect == 0)
- Container(
- height: 150.h,
- child: DonutAutoLabelChart([
- new charts.Series(
- id: 'Sales',
- colorFn: (LinearSales sales, __) => sales.color,
- domainFn: (LinearSales sales, _) => sales.year,
- measureFn: (LinearSales sales, _) => sales.sales,
- data: [
- new LinearSales(
- 0,
- int.parse((tradeSummaryList?.collectionAmount ?? "0")
- .replaceAll(".", "")),
- charts.Color.fromHex(code: "#313CA9")),
- new LinearSales(
- 1,
- int.parse((tradeSummaryList?.refundAmount ?? "0")
- .replaceAll(".", "")),
- charts.Color.fromHex(code: "#30415B"))
- ],
- // Set a label accessor to control the text of the arc label.
- labelAccessorFn: (LinearSales row, _) =>
- '${(row.sales / 100)}',
- )
- ]),
- ),
+ (tradeSummaryList == null ||
+ tradeSummaryList.collectionAmount == null ||
+ tradeSummaryList.refundAmount == null)
+ ? NoDataView(
+ src: "assets/image/bs_no data_logo.webp",
+ isShowBtn: false,
+ text: "暂无数据",
+ fontSize: 16.sp,
+ margin: EdgeInsets.all(20.h),
+ )
+ : Container(
+ height: 150.h,
+ child: DonutAutoLabelChart([
+ new charts.Series(
+ id: 'Sales',
+ colorFn: (LinearSales sales, __) => sales.color,
+ domainFn: (LinearSales sales, _) => sales.year,
+ measureFn: (LinearSales sales, _) => sales.sales,
+ data: [
+ new LinearSales(
+ 0,
+ int.parse(
+ (tradeSummaryList?.collectionAmount ?? "0")
+ .replaceAll(".", "")),
+ charts.Color.fromHex(code: "#313CA9")),
+ new LinearSales(
+ 1,
+ int.parse((tradeSummaryList?.refundAmount ?? "0")
+ .replaceAll(".", "")),
+ charts.Color.fromHex(code: "#30415B"))
+ ],
+ // Set a label accessor to control the text of the arc label.
+ labelAccessorFn: (LinearSales row, _) =>
+ '${(row.sales / 100)}',
+ )
+ ]),
+ ),
if (expensesSelect == 1)
- Container(
- height: 150.h,
- child: DonutAutoLabelChart([
- new charts.Series(
- id: 'Sales',
- colorFn: (LinearSales sales, __) => sales.color,
- domainFn: (LinearSales sales, _) => sales.year,
- measureFn: (LinearSales sales, _) => sales.sales,
+ (tradeSummaryList == null ||
+ tradeSummaryList.collectionCount == null ||
+ tradeSummaryList.refundCount == null)
+ ? NoDataView(
+ src: "assets/image/bs_no data_logo.webp",
+ isShowBtn: false,
+ text: "暂无数据",
+ fontSize: 16.sp,
+ margin: EdgeInsets.all(20.h),
+ )
+ : Container(
+ height: 150.h,
+ child: DonutAutoLabelChart([
+ new charts.Series(
+ id: 'Sales',
+ colorFn: (LinearSales sales, __) => sales.color,
+ domainFn: (LinearSales sales, _) => sales.year,
+ measureFn: (LinearSales sales, _) => sales.sales,
- data: [
- new LinearSales(0, tradeSummaryList?.collectionCount ?? 0,
- charts.Color.fromHex(code: "#313CA9")),
- new LinearSales(2, tradeSummaryList?.refundCount ?? 0,
- charts.Color.fromHex(code: "#30415B")),
- ],
- // Set a label accessor to control the text of the arc label.
- labelAccessorFn: (LinearSales row, _) => '${(row.sales)} 笔',
- ),
- ]),
- ),
+ data: [
+ new LinearSales(
+ 0,
+ tradeSummaryList?.collectionCount ?? 0,
+ charts.Color.fromHex(code: "#313CA9")),
+ new LinearSales(2, tradeSummaryList?.refundCount ?? 0,
+ charts.Color.fromHex(code: "#30415B")),
+ ],
+ // Set a label accessor to control the text of the arc label.
+ labelAccessorFn: (LinearSales row, _) =>
+ '${(row.sales)} 笔',
+ ),
+ ]),
+ ),
],
),
);
diff --git a/lib/business_system/mine/account_information.dart b/lib/business_system/mine/account_information.dart
index 0fcbc581..27504d47 100644
--- a/lib/business_system/mine/account_information.dart
+++ b/lib/business_system/mine/account_information.dart
@@ -3,11 +3,16 @@ 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 '../../retrofit/data/business_login_info.dart';
+import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
class AccountInformation extends StatefulWidget {
+ final Map arguments;
+
+ AccountInformation({this.arguments});
@override
State createState() {
return _AccountInformation();
@@ -16,10 +21,12 @@ class AccountInformation extends StatefulWidget {
class _AccountInformation extends State {
final RefreshController refreshController = RefreshController();
+ BusinessLoginInfo businessLoginInfo;
@override
void initState() {
super.initState();
+ businessLoginInfo = widget.arguments["businessLoginInfo"];
}
@override
@@ -72,21 +79,21 @@ class _AccountInformation extends State {
padding: EdgeInsets.only(top: 16.h,left: 16.w,right: 16.w,),
child: Column(
children: [
- textItem("账号名称","134****7777"),
+ textItem("账号名称", businessLoginInfo?.name),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFFEBECEF),
margin: EdgeInsets.only(top:2.h,bottom: 16.h)
),
- textItem("账号","22221ff"),
+ textItem("账号",AppUtils.phoneEncode(businessLoginInfo?.account ?? "")),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFFEBECEF),
margin: EdgeInsets.only(top:2.h,bottom: 16.h)
),
- textItem("电话","13466667777"),
+ textItem("电话",businessLoginInfo?.mobile?? ""),
],
),
),
diff --git a/lib/business_system/mine/business_mine_page.dart b/lib/business_system/mine/business_mine_page.dart
index d5b624eb..ebd87c9d 100644
--- a/lib/business_system/mine/business_mine_page.dart
+++ b/lib/business_system/mine/business_mine_page.dart
@@ -1,13 +1,19 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/view_widget/classic_header.dart';
+import 'package:huixiang/view_widget/custom_image.dart';
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 '../../retrofit/data/business_login_info.dart';
import '../../utils/font_weight.dart';
class BusinessMinePage extends StatefulWidget {
+ final BusinessLoginInfo businessLoginInfo;
+ final String storeId;
+
+ BusinessMinePage(this.businessLoginInfo,this.storeId);
@override
State createState() {
return _BusinessMinePage();
@@ -39,7 +45,7 @@ class _BusinessMinePage extends State
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
- header: MyHeader(),
+ header: MyHeader(color:Color(0xFF30415B)),
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
@@ -47,7 +53,10 @@ class _BusinessMinePage extends State
},
),
onRefresh: () {
- setState(() {});
+ if(widget.businessLoginInfo != null)
+ refreshController.refreshCompleted();
+ else
+ refreshController.refreshFailed();
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
@@ -98,41 +107,49 @@ class _BusinessMinePage extends State
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
- Navigator.of(context).pushNamed('/router/account_information');
+ Navigator.of(context).pushNamed('/router/account_information',arguments: {
+ "businessLoginInfo":widget.businessLoginInfo,
+ });
},
child: Container(
padding: EdgeInsets.only(
top: MediaQuery.of(context).padding.top + 50, left: 16.w),
child: Row(
children: [
- Image.asset(
- "assets/image/bs_mine_heading.webp",
- width: 69,
- height: 69,
- fit: BoxFit.fill,
+ MImage(
+ widget?.businessLoginInfo?.avatar ?? "",
+ fit: BoxFit.cover,
+ width: 69.h,
+ height: 69.h,
+ radius: BorderRadius.circular(100),
+ errorSrc: "assets/image/bs_mine_heading.webp",
+ fadeSrc: "assets/image/bs_mine_heading.webp",
),
SizedBox(
width: 10.w,
),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Text(
- '海峡姐妹茶',
- style: TextStyle(
- fontSize: 18.sp,
- color: Color(0xFF374C6C),
- fontWeight: MyFontWeight.semi_bold),
- ),
- Text(
- 'ID:gsy2022',
- style: TextStyle(
- fontSize: 16.sp,
- color: Color(0xFF374C6C),
- fontWeight: MyFontWeight.regular),
- ),
- ],
+ Container(
+ height: 69.h,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ Text(
+ widget?.businessLoginInfo?.name ?? "",
+ style: TextStyle(
+ fontSize: 18.sp,
+ color: Color(0xFF374C6C),
+ fontWeight: MyFontWeight.semi_bold),
+ ),
+ Text(
+ 'ID:${widget?.businessLoginInfo?.account ?? ""}',
+ style: TextStyle(
+ fontSize: 16.sp,
+ color: Color(0xFF374C6C),
+ fontWeight: MyFontWeight.regular),
+ ),
+ ],
+ ),
)
],
),
@@ -170,10 +187,12 @@ class _BusinessMinePage extends State
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
- Navigator.of(context).pushNamed('/router/merchant_info');
+ Navigator.of(context).pushNamed('/router/merchant_info',arguments:{
+ "storeId":widget.storeId,
+ });
},
child:
- commonFunctionsItem("assets/image/bs_store_info_logo.webp", "商户信息", "一心回乡农场"),
+ commonFunctionsItem("assets/image/bs_store_info_logo.webp", "商户信息", widget?.businessLoginInfo?.name ?? ""),
),
Container(
width: double.infinity,
@@ -191,7 +210,9 @@ class _BusinessMinePage extends State
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
- Navigator.of(context).pushNamed('/router/security_setting');
+ Navigator.of(context).pushNamed('/router/security_setting',arguments:{
+ "storeId":widget.storeId,
+ });
},
child: commonFunctionsItem("assets/image/bs_secure.webp", "安全设置", "登录手机号/密码")
),
diff --git a/lib/business_system/mine/merchant_info.dart b/lib/business_system/mine/merchant_info.dart
index 97ae9a36..9ad96abd 100644
--- a/lib/business_system/mine/merchant_info.dart
+++ b/lib/business_system/mine/merchant_info.dart
@@ -8,6 +8,9 @@ import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
class MerchantInfo extends StatefulWidget {
+ final Map arguments;
+
+ MerchantInfo({this.arguments});
@override
State createState() {
return _MerchantInfo();
diff --git a/lib/business_system/mine/security_setting.dart b/lib/business_system/mine/security_setting.dart
index 54bef572..f3ba1683 100644
--- a/lib/business_system/mine/security_setting.dart
+++ b/lib/business_system/mine/security_setting.dart
@@ -8,6 +8,9 @@ import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
class SecuritySetting extends StatefulWidget {
+ final Map arguments;
+
+ SecuritySetting({this.arguments});
@override
State createState() {
return _SecuritySetting();
diff --git a/lib/business_system/order/business_order_detail.dart b/lib/business_system/order/business_order_detail.dart
index a0cadb92..2f9889f6 100644
--- a/lib/business_system/order/business_order_detail.dart
+++ b/lib/business_system/order/business_order_detail.dart
@@ -1,13 +1,27 @@
+import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_easyloading/flutter_easyloading.dart';
+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/utils/font_weight.dart';
+import 'package:huixiang/view_widget/custom_image.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_detail_info.dart';
+import '../../utils/business_instance.dart';
+import '../../utils/flutter_utils.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
class BusinessOrderDetail extends StatefulWidget {
+ final Map arguments;
+
+ BusinessOrderDetail({this.arguments});
@override
State createState() {
return _BusinessOrderDetail();
@@ -16,10 +30,49 @@ class BusinessOrderDetail extends StatefulWidget {
class _BusinessOrderDetail extends State {
final RefreshController refreshController = RefreshController();
+ BusinessApiService businessService;
+ BusinessOrderDetailInfo orderDetailInfo;
@override
void initState() {
super.initState();
+ queryOrderDetail();
+ }
+
+ @override
+ void dispose() {
+ super.dispose();
+ refreshController.dispose();
+ }
+
+ ///查询订单详情
+ queryOrderDetail() async {
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
+ try {
+ if (businessService == null) {
+ businessService = BusinessApiService(Dio(),
+ context: context,
+ token: BusinessInstance.instance.businessToken,
+ tenant: BusinessInstance.instance.businessTenant,
+ storeId: widget.arguments["storeId"]);
+ }
+ BaseData baseData = await businessService.getAdminOrderDetail({
+ "id": widget.arguments["id"],
+ }).catchError((error) {
+ SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
+ alignment: Alignment.center);
+ });
+ if (baseData != null && baseData.isSuccess) {
+ orderDetailInfo = baseData.data;
+ } else {
+ SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center);
+ }
+ } finally {
+ EasyLoading.dismiss();
+ if (refreshController.isRefresh) refreshController.refreshCompleted();
+ setState(() {});
+ }
}
@override
@@ -38,14 +91,14 @@ class _BusinessOrderDetail extends State {
enablePullDown: true,
enablePullUp: false,
header: MyHeader(
- color: Colors.white,
+ color: Color(0xFF30415B),
),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
- onRefresh: () {},
+ onRefresh:(){queryOrderDetail();},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: SingleChildScrollView(
@@ -98,7 +151,7 @@ class _BusinessOrderDetail extends State {
fontWeight: MyFontWeight.semi_bold),
)),
Text(
- "已完成",
+ status()?? "",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFFFA5151),
@@ -111,14 +164,14 @@ class _BusinessOrderDetail extends State {
),
ListView.builder(
padding: EdgeInsets.zero,
- itemCount: 5,
+ itemCount: orderDetailInfo?.orderProductDTOList?.length ?? 0,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
- child: goodsInfoItem(),
+ child: goodsInfoItem(orderDetailInfo.orderProductDTOList[position]),
);
},
)
@@ -127,16 +180,16 @@ class _BusinessOrderDetail extends State {
);
}
- Widget goodsInfoItem() {
+ Widget goodsInfoItem(OrderProductDtoList orderProductDTOList) {
return Container(
margin: EdgeInsets.only(bottom: 12.h),
height: 77.h,
child: Row(
children: [
- Image.asset(
- "assets/image/hot_list.webp",
- width: 77,
- height: 77,
+ MImage(
+ orderProductDTOList?.skuImg ?? "",
+ width: 77.h,
+ height: 77.h,
fit: BoxFit.fill,
),
SizedBox(
@@ -146,7 +199,7 @@ class _BusinessOrderDetail extends State {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: Text(
- "御林古桑园啤酒节大肠包小肠美味...",
+ orderProductDTOList?.productName ?? "",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
@@ -156,7 +209,7 @@ class _BusinessOrderDetail extends State {
Row(
children: [
Expanded(child: Text(
- "×1",
+ "×${orderProductDTOList?.buyNum ?? 0}",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
@@ -164,7 +217,7 @@ class _BusinessOrderDetail extends State {
),
)),
Text(
- "¥12",
+ "¥${orderProductDTOList?.sellPrice ?? ""}",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
@@ -221,57 +274,64 @@ class _BusinessOrderDetail extends State {
SizedBox(
height: 12.h,
),
- Row(
- children: [
- Expanded(
- child: Text(
- "订单号",
- style: TextStyle(
- fontWeight: MyFontWeight.regular,
- fontSize: 14.sp,
- color: Color(0xFF808080),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: (){
+ copyOrderCode(orderDetailInfo?.orderCode ?? "");
+ SmartDialog.showToast("复制成功!",
+ alignment: Alignment.center);
+ },
+ child:Row(
+ children: [
+ Expanded(
+ child: Text(
+ "订单号",
+ style: TextStyle(
+ fontWeight: MyFontWeight.regular,
+ fontSize: 14.sp,
+ color: Color(0xFF808080),
+ ),
+ )),
+ Text(
+ orderDetailInfo?.orderCode ?? "",
+ textAlign: TextAlign.end,
+ style: TextStyle(
+ fontSize: 14.sp,
+ color: Color(0xFF1A1A1A),
+ fontWeight: MyFontWeight.regular),
),
- )),
- Text(
- "1222222222222222",
- textAlign: TextAlign.end,
- style: TextStyle(
- fontSize: 14.sp,
- color: Color(0xFF1A1A1A),
- fontWeight: MyFontWeight.regular),
- ),
- Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(
- 2,
+ Container(
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.circular(
+ 2,
+ ),
+ border: Border.all(
+ color: Color(0xFF30415B),
+ width: 1.w,
+ ),
),
- border: Border.all(
- color: Color(0xFF30415B),
- width: 1.w,
+ padding: EdgeInsets.symmetric(horizontal: 7.w, vertical: 2.h),
+ margin: EdgeInsets.only(left: 4.w),
+ child: Text(
+ "复制",
+ style: TextStyle(
+ fontSize: 10.sp,
+ color: Color(0xFF30415B),
+ fontWeight: MyFontWeight.regular),
),
),
- padding: EdgeInsets.symmetric(horizontal: 7.w, vertical: 2.h),
- margin: EdgeInsets.only(left: 4.w),
- child: Text(
- "复制",
- style: TextStyle(
- fontSize: 10.sp,
- color: Color(0xFF30415B),
- fontWeight: MyFontWeight.regular),
- ),
- ),
- ],
+ ],
+ )
),
- orderInfoItem("创建时间", "2022-08-09 12:33:12"),
- orderInfoItem("门店", "海峡姐妹茶"),
- orderInfoItem("用户名", "2233"),
- orderInfoItem("手机号", "17671877666"),
- orderInfoItem("订单金额", "766"),
- orderInfoItem("创建时间", "海峡姐妹茶"),
- orderInfoItem("优惠金额", "22.33"),
- orderInfoItem("实付金额", "2233.00"),
- orderInfoItem("预约时间", "2022-08-09 12:33:12"),
+ orderInfoItem("创建时间", orderDetailInfo?.createTime ?? "无"),
+ orderInfoItem("门店", orderDetailInfo?.storeName ?? "无"),
+ orderInfoItem("用户名", orderDetailInfo?.memberInfo?.name ?? "无"),
+ orderInfoItem("手机号", orderDetailInfo?.memberInfo?.phone ?? "无"),
+ orderInfoItem("订单金额", orderDetailInfo?.orderSum ?? "0.00"),
+ orderInfoItem("优惠金额", orderDetailInfo?.discountAmount ??"0.00"),
+ orderInfoItem("实付金额", orderDetailInfo?.paySum ?? "0.00"),
+ orderInfoItem("预约时间", orderDetailInfo?.subcribeTime ?? "无"),
],
),
);
@@ -308,4 +368,32 @@ class _BusinessOrderDetail extends State {
),
);
}
+
+ ///复制订单号
+ copyOrderCode(String orderCode) {
+ print(orderCode);
+ Clipboard.setData(ClipboardData(text: orderCode));
+ }
+
+ String status (){
+ if(orderDetailInfo?.orderStatus == -1){
+ return "错误订单";
+ }else {
+ if(orderDetailInfo?.orderStatus == 1){
+ return "未付款";
+ }else if(orderDetailInfo?.orderStatus == 5){
+ return "已取消";
+ }else if(orderDetailInfo?.payStatus == 1 && orderDetailInfo?.refundStatus == 2){
+ return "退款待审核";
+ }else if(orderDetailInfo?.orderStatus == 3 && orderDetailInfo?.refundStatus == 1){
+ return "已退款";
+ }else if(orderDetailInfo?.orderStatus == 4){
+ return "已完成";
+ }else if(orderDetailInfo?.orderStatus == 2){
+ return "已付款";
+ }else if(orderDetailInfo?.orderStatus == 3){
+ return "已确认";
+ }
+ }
+ }
}
diff --git a/lib/business_system/order/business_order_page.dart b/lib/business_system/order/business_order_page.dart
index 8d024d32..567cbbe5 100644
--- a/lib/business_system/order/business_order_page.dart
+++ b/lib/business_system/order/business_order_page.dart
@@ -1,19 +1,19 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
-import 'package:huixiang/view_widget/classic_header.dart';
-import 'package:huixiang/view_widget/my_footer.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';
-import '../goods/off_shelf/off_shelf_page.dart';
-import '../goods/on_sale/on_sale_page.dart';
import 'order_list.dart';
class BusinessOrderPage extends StatefulWidget {
+ final String storeId;
+
+ BusinessOrderPage(this.storeId);
@override
State createState() {
@@ -28,9 +28,11 @@ class _BusinessOrderPage extends State
final TextEditingController editingController = TextEditingController();
FocusNode _focusNode = FocusNode();
bool isKeyBoardShow = false;
- String selectTimeDate ="";
- String selectTimeDateNum = "${DateFormat("yyyy年MM月dd日").format(DateTime.now().subtract(Duration(days:1)))} 至 "
- "${DateFormat("yyyy年MM月dd日").format(DateTime.now())}";
+ List _allKey = [];
+ String selectTimeDate = "";
+ String selectTimeDateNum =
+ "${DateFormat("yyyy年MM月dd日 00:00:00").format(DateTime.now().subtract(Duration(days: 2)))} 至 "
+ "${DateFormat("yyyy年MM月dd日 23:59:59").format(DateTime.now())}";
@override
void initState() {
@@ -49,6 +51,12 @@ class _BusinessOrderPage extends State
}
});
});
+ loadFinish();
+ }
+
+ loadFinish() {
+ _allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()];
+ setState(() {});
}
///离开页面记着销毁和清除
@@ -63,25 +71,25 @@ class _BusinessOrderPage extends State
super.build(context);
return GestureDetector(
behavior: HitTestBehavior.opaque,
- onTap: (){
+ onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: Column(
children: [
orderSearch(),
Expanded(
- child:
- Stack(
+ child: Stack(
children: [
DefaultTabController(
- length:4,
+ length: 4,
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
- title:"",
+ title: "",
leading: false,
background: Colors.white,
- toolbarHeight: kToolbarHeight+MediaQuery.of(context).padding.top,
+ toolbarHeight:
+ kToolbarHeight + MediaQuery.of(context).padding.top,
bottom: TabBar(
// isScrollable: true, //可滚动
//去掉按钮阴影
@@ -95,27 +103,31 @@ class _BusinessOrderPage extends State
unselectedLabelStyle: TextStyle(
fontSize: 15.sp,
fontWeight: FontWeight.normal,
- color: Color(0xFF666666)
- ),
+ color: Color(0xFF666666)),
// controller: tabController,
//未选中文字颜色
unselectedLabelColor: Color(0xffA29E9E),
indicatorSize: TabBarIndicatorSize.label,
//指示器与文字等宽
tabs: [
- MyTab(text:"全部"),
+ MyTab(text: "全部"),
MyTab(text: "未付款"),
- MyTab(text:"已付款"),
+ MyTab(text: "已付款"),
MyTab(text: "已退款"),
],
),
),
body: TabBarView(
children: [
- OrderList(0),
- OrderList(1),
- OrderList(2),
- OrderList(3),],
+ OrderList(_allKey[0], 0, widget.storeId,
+ editingController.text, selectTime()),
+ OrderList(_allKey[1], 1, widget.storeId,
+ editingController.text, selectTime()),
+ OrderList(_allKey[2], 2, widget.storeId,
+ editingController.text, selectTime()),
+ OrderList(_allKey[3], 3, widget.storeId,
+ editingController.text, selectTime()),
+ ],
),
),
),
@@ -142,7 +154,11 @@ class _BusinessOrderPage extends State
color: Colors.white,
child: Container(
height: 40.h,
- margin: EdgeInsets.only(left: 18.w,right: 18.w,top:55.h,),
+ margin: EdgeInsets.only(
+ left: 18.w,
+ right: 18.w,
+ top: 55.h,
+ ),
decoration: BoxDecoration(
color: Color(0xFFF7F8FA),
borderRadius: BorderRadius.circular(2),
@@ -152,6 +168,7 @@ class _BusinessOrderPage extends State
textInputAction: TextInputAction.search,
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode());
+ loadFinish();
},
style: TextStyle(
fontSize: 15.sp,
@@ -164,12 +181,10 @@ class _BusinessOrderPage extends State
hintStyle: TextStyle(
color: Color(0xFF808080),
fontSize: 15.sp,
- fontWeight: MyFontWeight.regular
- ),
+ fontWeight: MyFontWeight.regular),
contentPadding: EdgeInsets.symmetric(
vertical: 12.h,
),
-
prefixIcon: Image.asset(
"assets/image/bs_goods_search.webp",
width: 20,
@@ -178,52 +193,39 @@ class _BusinessOrderPage extends State
border: InputBorder.none,
),
),
- ),),
+ ),
+ ),
);
}
- Widget timeSelect(){
+ Widget timeSelect() {
return Container(
color: Colors.white,
child: GestureDetector(
- onTap: (){
- Navigator.of(context).pushNamed('/router/custom_page').then((value){
- setState((){
+ onTap: () {
+ Navigator.of(context).pushNamed('/router/custom_page').then((value) {
selectTimeDate = value;
+ loadFinish();
});
- });},
+ },
child: Container(
decoration: BoxDecoration(
color: Color(0xFFF7F8FA),
borderRadius: BorderRadius.circular(2),
),
- margin: EdgeInsets.only(left: 18.w,right: 18.w,top: 12.h,bottom: 16.h),
- padding: EdgeInsets.symmetric(horizontal: 14.w,vertical: 12.h),
+ margin:
+ EdgeInsets.only(left: 18.w, right: 18.w, top: 12.h, bottom: 16.h),
+ padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 12.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
- (selectTimeDate == "" || selectTimeDate == null) ? selectTimeDateNum : selectTimeDate,
+ ("${selectTime().substring(0, 11)} ${selectTime().substring(21, 34)}"),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.regular),
),
- // Padding(padding:EdgeInsets.only(left:22.w,right: 26.w),
- // child: Text(
- // '至',
- // style: TextStyle(
- // fontSize: 14.sp,
- // color: Color(0xFF30415B),
- // fontWeight: MyFontWeight.regular),
- // ),),
- // Text(
- // '2022-08-24 16:50',
- // style: TextStyle(
- // fontSize: 14.sp,
- // color: Color(0xFF30415B),
- // fontWeight: MyFontWeight.regular),
- // ),
],
),
),
@@ -231,6 +233,13 @@ class _BusinessOrderPage extends State
);
}
+ String selectTime() {
+ if (selectTimeDate == "" || selectTimeDate == null) {
+ return selectTimeDateNum;
+ } else
+ return selectTimeDate;
+ }
+
@override
bool get wantKeepAlive => true;
}
diff --git a/lib/business_system/order/order_list.dart b/lib/business_system/order/order_list.dart
index 83619d9e..37eddd30 100644
--- a/lib/business_system/order/order_list.dart
+++ b/lib/business_system/order/order_list.dart
@@ -1,15 +1,31 @@
+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/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:shared_preferences/shared_preferences.dart';
import '../../../utils/font_weight.dart';
+import '../../generated/l10n.dart';
+import '../../retrofit/business_api.dart';
+import '../../retrofit/data/base_data.dart';
+import '../../retrofit/data/business_order_list.dart';
+import '../../utils/business_instance.dart';
+import '../../utils/flutter_utils.dart';
+import '../../view_widget/no_data_view.dart';
class OrderList extends StatefulWidget {
final int status;
- OrderList(this.status);
+ final String storeId;
+ final String keyword;
+ final String time;
+
+ OrderList(Key key, this.status, this.storeId, this.keyword, this.time)
+ : super(key: key);
@override
State createState() {
@@ -21,6 +37,9 @@ class _OrderList extends State {
final RefreshController _refreshController = RefreshController();
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics();
final ScrollController controller = ScrollController();
+ BusinessApiService businessService;
+ List adminOrderDTOList = [];
+ int _pageIndex = 1;
@override
void dispose() {
@@ -31,17 +50,78 @@ class _OrderList extends State {
@override
void initState() {
super.initState();
+ _onRefresh();
+ }
+
+ _onRefresh({bool isShowLoad = true}) async {
+ if (isShowLoad)
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai,
+ maskType: EasyLoadingMaskType.black);
+ await queryOrderList();
+ EasyLoading.dismiss();
+ if (!mounted) return;
+ if (_refreshController.isRefresh) _refreshController.refreshCompleted();
+ setState(() {});
}
- _onRefresh() async {}
+ ///订单列表
+ queryOrderList() async {
+ if (businessService == null) {
+ SharedPreferences value = await SharedPreferences.getInstance();
+ businessService = BusinessApiService(Dio(),
+ context: context,
+ token: BusinessInstance.instance.businessToken,
+ tenant: BusinessInstance.instance.businessTenant,
+ storeId: widget.storeId);
+ }
+ BaseData 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);
+ });
+ 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);
+ }
+ }
@override
Widget build(BuildContext context) {
return SmartRefresher(
controller: _refreshController,
enablePullDown: true,
- enablePullUp: false,
- header: MyHeader(),
+ enablePullUp: adminOrderDTOList.length == 0 ? false : true,
+ header: MyHeader(color: Color(0xFF30415B)),
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
@@ -49,224 +129,274 @@ class _OrderList extends State {
},
),
onRefresh: () {
- setState(() {
- _onRefresh();
- });
+ _pageIndex = 1;
+ adminOrderDTOList.clear();
+ _onRefresh();
},
- child:Padding(padding:EdgeInsets.symmetric(vertical: 16.w),
- child: ListView.builder(
- itemCount: 5,
- physics: BouncingScrollPhysics(),
- shrinkWrap: true,
- itemBuilder: (context, position) {
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () {
- Navigator.of(context).pushNamed('/router/business_order_detail');
- },
- child: orderItem(),
- );
- },
- ),),
+ onLoading: () {
+ _pageIndex++;
+ _onRefresh();
+ },
+ child: (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.symmetric(vertical: 16.w),
+ child: ListView.builder(
+ itemCount: adminOrderDTOList?.length ?? 0,
+ physics: BouncingScrollPhysics(),
+ shrinkWrap: true,
+ itemBuilder: (context, position) {
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ Navigator.of(context)
+ .pushNamed('/router/business_order_detail',arguments: {"id":adminOrderDTOList[position].id,"storeId":widget.storeId});
+ },
+ child: orderItem(adminOrderDTOList[position]),
+ );
+ },
+ ),
+ ),
);
}
- Widget orderItem() {
+ Widget orderItem(AdminOrderDtoList adminOrderDtoList) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
- margin: EdgeInsets.only(left: 16.w,right: 16.w,bottom: 16.h),
- padding:EdgeInsets.symmetric(vertical: 12.h),
+ margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h),
+ padding: EdgeInsets.symmetric(vertical: 12.h),
child: Column(
children: [
- Padding(padding:EdgeInsets.only(bottom:12.h,left: 12.w,right: 12.w),
- child: Row(
- children: [
- Image.asset(
- "assets/image/bs_switch_shop.webp",
- width:16,
- height:16,
- ),
- SizedBox(width: 3.w,),
- Expanded(child: Text(
- "海峡姐妹奶茶",
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 14.sp,
- color: Color(0xFF0D0D0D),
- fontWeight: MyFontWeight.semi_bold
+ Padding(
+ padding: EdgeInsets.only(bottom: 12.h, left: 12.w, right: 12.w),
+ child: Row(
+ children: [
+ Image.asset(
+ "assets/image/bs_switch_shop.webp",
+ width: 16,
+ height: 16,
),
- )),
- Text(
- widget.status == 0 ?"全部":widget.status == 1 ? "未付款":widget.status == 2 ? "已付款":"已退款",
- style: TextStyle(
- fontSize: 14.sp,
- color: Color(0xFFFA5151),
- fontWeight: MyFontWeight.semi_bold
+ SizedBox(
+ width: 3.w,
),
- )
- ],
- ),),
+ Expanded(
+ child: Text(
+ adminOrderDtoList?.storeName ?? "",
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(
+ fontSize: 14.sp,
+ color: Color(0xFF0D0D0D),
+ fontWeight: MyFontWeight.semi_bold),
+ )),
+ Text(
+ widget.status == 0
+ ? "全部"
+ : widget.status == 1
+ ? "未付款"
+ : widget.status == 2
+ ? "已付款"
+ : "已退款",
+ style: TextStyle(
+ fontSize: 14.sp,
+ color: Color(0xFFFA5151),
+ fontWeight: MyFontWeight.semi_bold),
+ )
+ ],
+ ),
+ ),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFFF4F6F7),
),
- Padding(padding:EdgeInsets.symmetric(horizontal: 12.w),
- child: Column(
- children: [
- Container(
- height:170.h,
- margin: EdgeInsets.only(top: 17.h,bottom:13.h),
- child:
- ListView.builder(
- padding: EdgeInsets.zero,
- itemCount:6,
- scrollDirection: Axis.vertical,
- shrinkWrap: true,
- physics: BouncingScrollPhysics(),
- itemBuilder: (context, position) {
- return GestureDetector(
- onTap: () {
- },
- child: orderGoodsList(),
- );
- },
- ),
- ),
- Row(children: [
- Text(
- "订单编号:",
- style: TextStyle(
- fontSize: 12.sp,
- color: Color(0xFF7A797F),
- fontWeight: MyFontWeight.regular
+ Padding(
+ padding: EdgeInsets.symmetric(horizontal: 12.w),
+ child: Column(
+ children: [
+ Container(
+ margin: EdgeInsets.only(top: 17.h, bottom: 13.h),
+ child: ListView.builder(
+ padding: EdgeInsets.zero,
+ itemCount: adminOrderDtoList?.orderProductList?.length ?? 0,
+ scrollDirection: Axis.vertical,
+ shrinkWrap: true,
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return GestureDetector(
+ onTap: () {},
+ child: orderGoodsList(
+ adminOrderDtoList.orderProductList[position]),
+ );
+ },
),
),
- Padding(padding:EdgeInsets.only(left: 14.w),
- child:
- Text(
- "1223211111112333333",
- style: TextStyle(
- fontSize: 12.sp,
- color: Color(0xFF7A797F),
- fontWeight: MyFontWeight.regular
+ Row(
+ children: [
+ Text(
+ "订单编号:",
+ style: TextStyle(
+ fontSize: 12.sp,
+ color: Color(0xFF7A797F),
+ fontWeight: MyFontWeight.regular),
),
- ),),
- ],),
- SizedBox(height: 4.h,),
- Row(children: [
- Text(
- "支付时间::",
- style: TextStyle(
- fontSize: 12.sp,
- color: Color(0xFF7A797F),
- fontWeight: MyFontWeight.regular
- ),
+ Padding(
+ padding: EdgeInsets.only(left: 14.w),
+ child: Text(
+ adminOrderDtoList?.orderCode ?? "",
+ style: TextStyle(
+ fontSize: 12.sp,
+ color: Color(0xFF7A797F),
+ fontWeight: MyFontWeight.regular),
+ ),
+ ),
+ ],
),
- SizedBox(width: 14.w,),
- Expanded(child: Text(
- "2022-08-09 12:33:12",
- style: TextStyle(
- fontSize: 12.sp,
- color: Color(0xFF7A797F),
- fontWeight: MyFontWeight.regular
- ),
- ),),
- Text(
- "¥245",
- style: TextStyle(
- fontSize: 14.sp,
- color: Color(0xFF181818),
- fontWeight: MyFontWeight.medium
- ),
+ SizedBox(
+ height: 4.h,
),
- ],),
- SizedBox(height:20.h,),
- Row(
- children: [
- Spacer(),
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- Navigator.of(context).pushNamed('/router/order_write_off');
- },
- child: Container(
- decoration: BoxDecoration(
- color: Color(0xFF30415B),
- borderRadius: BorderRadius.circular(4),
- ),
- padding: EdgeInsets.symmetric(vertical: 5.h,horizontal: 26.w),
- margin: EdgeInsets.only(right:20.h),
- child:Text(
- "核销",
+ Row(
+ children: [
+ Text(
+ "支付时间:",
+ style: TextStyle(
+ fontSize: 12.sp,
+ color: Color(0xFF7A797F),
+ fontWeight: MyFontWeight.regular),
+ ),
+ SizedBox(
+ width: 14.w,
+ ),
+ Expanded(
+ child: Text(
+ adminOrderDtoList?.createTime ?? "",
style: TextStyle(
fontSize: 12.sp,
- color: Colors.white,
- fontWeight: MyFontWeight.regular
- ),
+ color: Color(0xFF7A797F),
+ fontWeight: MyFontWeight.regular),
),
),
- ),GestureDetector(
+ Text(
+ adminOrderDtoList?.paySum ?? "",
+ style: TextStyle(
+ fontSize: 14.sp,
+ color: Color(0xFF181818),
+ fontWeight: MyFontWeight.medium),
+ ),
+ ],
+ ),
+ SizedBox(
+ height: 20.h,
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ // Spacer(),
+ GestureDetector(
behavior: HitTestBehavior.opaque,
- onTap: (){
- Navigator.of(context).pushNamed('/router/request_refund');
+ onTap: () {
+ Navigator.of(context)
+ .pushNamed('/router/order_write_off');
},
child: Container(
decoration: BoxDecoration(
- color: Colors.white,
+ color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(4),
- border: Border.all(
- color: Color(0xFF30415B),
- width: 1,
- ),
),
- padding: EdgeInsets.symmetric(vertical: 5.h,horizontal: 14.w),
- child:Text(
- "申请退款",
+ 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(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ Navigator.of(context)
+ .pushNamed('/router/request_refund', arguments: {
+ "refundAmount": adminOrderDtoList?.paySum ?? "",
+ "mid": adminOrderDtoList?.mid ?? "",
+ "orderId": adminOrderDtoList?.id ?? "",
+ "storeId": widget.storeId ?? "",
+ }).then((value) => {
+ _pageIndex = 1,
+ adminOrderDTOList.clear(),
+ _onRefresh(isShowLoad: false),
+ });
+ },
+ child: Container(
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.circular(4),
+ border: Border.all(
color: Color(0xFF30415B),
- fontWeight: MyFontWeight.regular
+ width: 1,
+ ),
+ ),
+ padding: EdgeInsets.symmetric(
+ vertical: 5.h, horizontal: 14.w),
+ child: Text(
+ "申请退款",
+ style: TextStyle(
+ fontSize: 12.sp,
+ color: Color(0xFF30415B),
+ fontWeight: MyFontWeight.regular),
),
),
),
- ),
- ],
- )
-
- ],
- ),),
+ ],
+ )
+ ],
+ ),
+ ),
],
),
);
}
- Widget orderGoodsList(){
+ Widget orderGoodsList(OrderProductList orderProductList) {
return Container(
margin: EdgeInsets.only(bottom: 13.h),
child: Row(
children: [
- Expanded(child: Text(
- "葡萄榨汁饮料",
+ Expanded(
+ child: Text(
+ orderProductList?.productName ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
- fontWeight: MyFontWeight.medium
- ),
+ fontWeight: MyFontWeight.medium),
)),
Text(
- "x1",
+ "x${(orderProductList?.buyNum ?? 0).toString()}",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF000000),
- fontWeight: MyFontWeight.regular
- ),
+ fontWeight: MyFontWeight.regular),
)
],
),
diff --git a/lib/business_system/order/request_refund.dart b/lib/business_system/order/request_refund.dart
index 9317b52d..70db15cb 100644
--- a/lib/business_system/order/request_refund.dart
+++ b/lib/business_system/order/request_refund.dart
@@ -1,16 +1,28 @@
+import 'package:dio/dio.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/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 'package:shared_preferences/shared_preferences.dart';
import '../../generated/l10n.dart';
+import '../../retrofit/business_api.dart';
+import '../../retrofit/data/base_data.dart';
+import '../../retrofit/data/refund_reason_list.dart';
+import '../../utils/business_instance.dart';
+import '../../utils/flutter_utils.dart';
import '../../view_widget/border_text.dart';
-import '../../view_widget/classic_header.dart';
-import '../../view_widget/my_footer.dart';
import '../../view_widget/round_button.dart';
+import '../../view_widget/settlement_tips_dialog.dart';
class RequestRefund extends StatefulWidget {
+ final Map arguments;
+
+ RequestRefund({this.arguments});
+
@override
State createState() {
return _RequestRefund();
@@ -24,6 +36,10 @@ class _RequestRefund extends State {
bool isKeyBoardShow = false;
int modifyAmountState = 0;
int refundState = 0;
+ RefundReasonList reasonReasonList;
+ BusinessApiService businessService;
+ String refundAmount;
+ String selectRefundReason;
@override
void initState() {
@@ -42,6 +58,8 @@ class _RequestRefund extends State {
}
});
});
+ refundAmount = widget.arguments["refundAmount"];
+ queryRefundReason();
}
///离开页面记着销毁和清除
@@ -51,10 +69,73 @@ class _RequestRefund extends State {
super.dispose();
}
+ ///退款原因
+ queryRefundReason() async {
+ if (businessService == null) {
+ businessService = BusinessApiService(Dio(),
+ context: context,
+ token: BusinessInstance.instance.businessToken,
+ tenant: BusinessInstance.instance.businessTenant,
+ storeId: widget.arguments["storeId"]);
+ }
+ BaseData baseData = await businessService.refundReason({
+ "current": 1,
+ "model": {"type": 3},
+ "size": 20
+ }).catchError((error) {
+ SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
+ alignment: Alignment.center);
+ });
+ if (baseData != null && baseData.isSuccess) {
+ reasonReasonList = baseData.data;
+ }
+ }
+
+ ///申请退款
+ orderRefund() async {
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
+ try {
+ if (businessService == null) {
+ businessService = BusinessApiService(Dio(),
+ context: context,
+ token: BusinessInstance.instance.businessToken,
+ tenant: BusinessInstance.instance.businessTenant,
+ storeId: widget.arguments["storeId"]);
+ }
+ BaseData baseData = await businessService.refundOrder({
+ "tenant_code": BusinessInstance.instance.businessTenant,
+ "orderId": widget.arguments["orderId"],
+ "mid": widget.arguments["mid"],
+ "reason": selectRefundReason,
+ "backMoney": modifyAmountController.text == ""
+ ? refundAmount
+ : modifyAmountController.text,
+ }).catchError((error) {});
+ if (baseData != null && baseData.isSuccess) {
+ SmartDialog.show(
+ widget: SettlementTips(
+ () {},
+ text: baseData?.data ?? "",
+ color: Color(0xFF30415B),
+ ));
+ Navigator.of(context).pop();
+ } else {
+ SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center);
+ }
+ } finally {
+ EasyLoading.dismiss();
+ }
+ }
+
@override
Widget build(BuildContext context) {
- return
- Scaffold(
+ return GestureDetector(
+ behavior: HitTestBehavior.translucent,
+ onTap: () {
+ FocusScope.of(context).requestFocus(FocusNode());
+ },
+ child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Color(0xFFF8F8FA),
appBar: MyAppBar(
@@ -65,8 +146,8 @@ class _RequestRefund extends State {
brightness: Brightness.dark,
),
body: Container(
- margin: EdgeInsets.only(top: 24.h,left: 16.w,right: 16.w),
- child:Column(
+ margin: EdgeInsets.only(top: 24.h, left: 16.w, right: 16.w),
+ child: Column(
children: [
Container(
decoration: BoxDecoration(
@@ -81,7 +162,11 @@ class _RequestRefund extends State {
),
],
),
- padding: EdgeInsets.only(top: 16.h,left: 16.w,right: 16.w,),
+ padding: EdgeInsets.only(
+ top: 16.h,
+ left: 16.w,
+ right: 16.w,
+ ),
child: Column(
children: [
Row(
@@ -90,7 +175,7 @@ class _RequestRefund extends State {
width: 2.w,
height: 16.h,
color: Color(0xFF30415B),
- margin: EdgeInsets.only(right:6.w),
+ margin: EdgeInsets.only(right: 6.w),
),
Text(
"申请金额",
@@ -102,11 +187,14 @@ class _RequestRefund extends State {
),
],
),
- SizedBox(height:32.h,),
+ SizedBox(
+ height: modifyAmountState == 0 ? 32.h : 16.h,
+ ),
Row(
children: [
- if(modifyAmountState == 0)
- Expanded(child:Text.rich(
+ if (modifyAmountState == 0)
+ Expanded(
+ child: Text.rich(
TextSpan(
children: [
TextSpan(
@@ -118,7 +206,7 @@ class _RequestRefund extends State {
),
),
TextSpan(
- text: "1112.33",
+ text: refundAmount ?? "",
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 24.sp,
@@ -128,7 +216,7 @@ class _RequestRefund extends State {
],
),
)),
- if(modifyAmountState == 1)
+ if (modifyAmountState == 1)
Text(
"¥",
style: TextStyle(
@@ -137,30 +225,30 @@ class _RequestRefund extends State {
fontWeight: MyFontWeight.semi_bold,
),
),
- if(modifyAmountState == 1)
- Expanded(child: TextField(
- controller: modifyAmountController,
- decoration: InputDecoration(
- hintText: "请输入修改金额",
- hintStyle: TextStyle(
- color: Color(0xFF0D0D0D),
- fontSize: 14.sp,
- fontWeight: MyFontWeight.regular
+ if (modifyAmountState == 1)
+ Expanded(
+ child: TextField(
+ controller: modifyAmountController,
+ decoration: InputDecoration(
+ hintText: "请输入修改金额",
+ hintStyle: TextStyle(
+ color: Color(0xFF0D0D0D),
+ fontSize: 14.sp,
+ fontWeight: MyFontWeight.regular),
+ border: InputBorder.none,
),
- border: InputBorder.none,
- ),
- keyboardType: TextInputType.phone,
- style: TextStyle(
- color: Color(0xFF0D0D0D),
- fontSize: 24.sp,
- fontWeight: MyFontWeight.medium
+ keyboardType: TextInputType.phone,
+ style: TextStyle(
+ color: Color(0xFF0D0D0D),
+ fontSize: 24.sp,
+ fontWeight: MyFontWeight.medium),
),
- ),),
+ ),
GestureDetector(
behavior: HitTestBehavior.opaque,
- onTap: (){
+ onTap: () {
// showModifyAmountDialog();
- setState((){
+ setState(() {
modifyAmountState = 1;
});
},
@@ -169,10 +257,12 @@ class _RequestRefund extends State {
Image.asset(
"assets/image/bs_edit.webp",
fit: BoxFit.cover,
- width:16,
- height:16,
+ width: 16,
+ height: 16,
+ ),
+ SizedBox(
+ width: 4.w,
),
- SizedBox(width: 4.w,),
Text(
"修改金额",
style: TextStyle(
@@ -190,7 +280,44 @@ class _RequestRefund extends State {
height: 1.h,
width: double.infinity,
color: Color(0xFFEBECEF),
- margin: EdgeInsets.only(bottom: 50.h),
+ margin: EdgeInsets.only(bottom: 24.h),
+ ),
+ Padding(
+ padding: EdgeInsets.only(bottom: 25.h),
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ showRefundReason();
+ },
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ "退款原因",
+ style: TextStyle(
+ color: Color(0xFF7A797F),
+ fontSize: 14.sp,
+ fontWeight: MyFontWeight.regular,
+ ),
+ )),
+ Text(
+ selectRefundReason ?? "请选择退款原因",
+ style: TextStyle(
+ color: Color(0xFF0D0D0D),
+ fontSize: 14.sp,
+ fontWeight: MyFontWeight.regular,
+ ),
+ ),
+ Padding(
+ padding: EdgeInsets.only(left: 8.w),
+ child: Image.asset(
+ "assets/image/bs_right.webp",
+ width: 8.w,
+ height: 12.h,
+ )),
+ ],
+ ),
+ ),
)
],
),
@@ -198,22 +325,25 @@ class _RequestRefund extends State {
Spacer(),
GestureDetector(
behavior: HitTestBehavior.opaque,
- onTap: (){
- if(refundState == 1){
- Navigator.of(context).pop();
- }else{
- showModifyAmountDialog();
+ onTap: () {
+ if (refundState == 1) {
+ orderRefund();
+ } else {
+ if (selectRefundReason == null) {
+ SmartDialog.showToast("请选择退款原因",
+ alignment: Alignment.center);
+ } else
+ showModifyAmountDialog();
}
},
child: Container(
width: double.infinity,
alignment: Alignment.center,
- margin: EdgeInsets.only(bottom:55.h,top: 125.h),
- padding: EdgeInsets.symmetric(vertical:16.h),
+ margin: EdgeInsets.only(bottom: 55.h, top: 125.h),
+ padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(27),
- color: Color(0xFF30415B)
- ),
+ color: Color(0xFF30415B)),
child: Text(
"确定退款",
style: TextStyle(
@@ -227,7 +357,8 @@ class _RequestRefund extends State {
],
),
),
- );
+ ),
+ );
}
///修改金额提示
@@ -300,7 +431,7 @@ class _RequestRefund extends State {
fontWeight: FontWeight.bold,
),
onTap: () {
- setState((){
+ setState(() {
refundState = 1;
Navigator.of(context).pop();
});
@@ -318,4 +449,111 @@ class _RequestRefund extends State {
);
}
+ ///退款原因
+ showRefundReason() {
+ showModalBottomSheet(
+ context: context,
+ backgroundColor: Colors.transparent,
+ builder: (context) {
+ return Container(
+ width: double.infinity,
+ height: 309.h,
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(8),
+ topRight: Radius.circular(8),
+ ),
+ ),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Expanded(
+ child: Container(
+ alignment: Alignment.center,
+ margin: EdgeInsets.symmetric(vertical: 12),
+ child: Text(
+ "退款原因",
+ style: TextStyle(
+ fontWeight: MyFontWeight.bold,
+ fontSize: 17.sp,
+ color: Color(0xFF1A1A1A),
+ ),
+ ),
+ )),
+ GestureDetector(
+ onTap: () {
+ setState(() {
+ Navigator.of(context).pop();
+ });
+ },
+ child: Padding(
+ padding: EdgeInsets.only(right: 16.w),
+ child: Image.asset(
+ "assets/image/cancel.webp",
+ width: 25.h,
+ height: 25.h,
+ ),
+ ),
+ ),
+ ],
+ ),
+ Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16.w),
+ child: ListView.builder(
+ padding: EdgeInsets.zero,
+ itemCount: reasonReasonList?.records?.length ?? 0,
+ scrollDirection: Axis.vertical,
+ shrinkWrap: true,
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ setState(() {
+ selectRefundReason =
+ reasonReasonList.records[position].reason;
+ });
+ Navigator.of(context).pop();
+ },
+ child: refundReasonItem(
+ reasonReasonList.records[position]),
+ );
+ },
+ ),
+ )
+ ],
+ ),
+ );
+ });
+ }
+
+ refundReasonItem(Records records) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: EdgeInsets.symmetric(vertical: 16.h),
+ child: Text(
+ records?.reason ?? "",
+ style: TextStyle(
+ fontWeight: MyFontWeight.bold,
+ fontSize: 14.sp,
+ color: Color(0xFF0D0D0D),
+ ),
+ ),
+ ),
+ Container(
+ width: double.infinity,
+ height: 1.h,
+ color: Color(0xFFEBEBEB),
+ )
+ ],
+ );
+ }
}
diff --git a/lib/main.dart b/lib/main.dart
index 11d4d355..6498a4ea 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -491,17 +491,17 @@ Map routers = {
'/router/batch_shelf': (context, {arguments}) =>
BatchShelf(),
'/router/business_order_detail': (context, {arguments}) =>
- BusinessOrderDetail(),
+ BusinessOrderDetail(arguments: arguments),
'/router/order_write_off': (context, {arguments}) =>
OrderWriteOff(),
'/router/security_setting': (context, {arguments}) =>
- SecuritySetting(),
+ SecuritySetting(arguments: arguments),
'/router/merchant_info': (context, {arguments}) =>
- MerchantInfo(),
+ MerchantInfo(arguments: arguments),
'/router/account_information': (context, {arguments}) =>
- AccountInformation(),
+ AccountInformation(arguments: arguments),
'/router/request_refund': (context, {arguments}) =>
- RequestRefund(),
+ RequestRefund(arguments:arguments),
'/router/day_report_page': (context, {arguments}) =>
DayReportPage(),
'/router/week_report_page': (context, {arguments}) =>
diff --git a/lib/qr/qr_code_scan.dart b/lib/qr/qr_code_scan.dart
index 9376b6a1..fbee0778 100644
--- a/lib/qr/qr_code_scan.dart
+++ b/lib/qr/qr_code_scan.dart
@@ -1,12 +1,9 @@
import 'dart:ui';
import 'package:flutter/material.dart';
-// import 'package:flutter_scankit/scan_kit_widget.dart';
import 'package:huixiang/generated/l10n.dart';
-import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:image_pickers/image_pickers.dart';
-import 'package:permission_handler/permission_handler.dart';
import 'package:scan/scan.dart';
class QrCodeScanPage extends StatefulWidget {
diff --git a/lib/retrofit/business_api.dart b/lib/retrofit/business_api.dart
index fa2dbf6c..785f4a54 100644
--- a/lib/retrofit/business_api.dart
+++ b/lib/retrofit/business_api.dart
@@ -12,9 +12,14 @@ import 'package:huixiang/retrofit/data/vip_counts_info.dart';
import 'package:retrofit/retrofit.dart';
import 'data/base_data.dart';
+import 'data/business_goods.dart';
+import 'data/business_order_detail_info.dart';
+import 'data/business_order_list.dart';
import 'data/day_flow_list.dart';
import 'data/goods_type_sales_list.dart';
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/trade_summary_list.dart';
@@ -22,6 +27,7 @@ part 'business_api.g.dart';
///本地
const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/";
+
///测试
// const localBaseUrl = "http://test-merchant.lotus-wallet.com/test-merchant/";
@@ -147,8 +153,7 @@ abstract class BusinessApiService {
///会员数量统计/用户概览
@GET("largeScreenReport/getDayCounts?date={date}")
- Future> vipCounts(
- @Path("date") String date);
+ Future> vipCounts(@Path("date") String date);
///今日流水/isMonth=0(当月数据),isMonth=1(当日数据)
@GET("dashBoard/order?yearMonth={yearMonth}&isMonth={isMonth}")
@@ -157,14 +162,46 @@ abstract class BusinessApiService {
///每日单品销量/单品销量报表
@POST("audit/salesLeaderboard")
- Future>> singleSales(@Body() Map param);
+ Future>> singleSales(
+ @Body() Map param);
///各类商品销售状况统计/商品种类销售数据
@POST("audit/allKindsSalesStatistics")
- Future>> goodsSalesList(@Body() Map param);
+ Future>> goodsSalesList(
+ @Body() Map param);
///经营分析/查询范围 day week month custom
@POST("largeScreenReport/saleBusinessAnalysis")
- Future> saleBusinessAnalysis(@Body() Map param);
+ Future> saleBusinessAnalysis(
+ @Body() Map param);
+
+ ///订单列表
+ @POST("order/findAdminOrderList")
+ Future> findAdminOrderList(
+ @Body() Map param);
+
+ ///订单详情
+ @POST("order/getAdminOrderDetail")
+ Future> getAdminOrderDetail(
+ @Body() Map param);
+
+ ///退款原因列表
+ @POST("reason/page")
+ Future> refundReason(
+ @Body() Map param);
+
+ ///申请退款
+ @POST("order/refundOrder")
+ Future refundOrder(@Body() Map param);
+
+ ///商品分页列表查询/商品分组列表
+ @POST("productGroup/page")
+ Future> productGroup(
+ @Body() Map param);
+
+ ///后台查询商品列表/商品列表
+ @POST("product/findAdminProductListNew")
+ Future> findAdminProductLis(
+ @Body() Map param);
}
diff --git a/lib/retrofit/business_api.g.dart b/lib/retrofit/business_api.g.dart
index c5845d4d..6aec7c5a 100644
--- a/lib/retrofit/business_api.g.dart
+++ b/lib/retrofit/business_api.g.dart
@@ -28,8 +28,7 @@ class _BusinessApiService implements BusinessApiService {
final queryParameters = {};
final _data = {};
_data.addAll(param ?? {});
- final _result = await _dio.request