diff --git a/lib/business_system/business_scan_code.dart b/lib/business_system/business_scan_code.dart index be02bc49..bc6113e6 100644 --- a/lib/business_system/business_scan_code.dart +++ b/lib/business_system/business_scan_code.dart @@ -53,7 +53,6 @@ class _BusinessScanCode extends State onCapture: (data) { if (data != null && data != "") { // Navigator.of(context).pop(data); - } }, ), @@ -70,17 +69,17 @@ class _BusinessScanCode extends State child: Container( margin: EdgeInsets.only(left:12.w,right: 16.w,top: 16.h), child:Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded(child:Text( - S.of(context).saoma, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.bold, - ), - )), + // Expanded(child:Text( + // S.of(context).saoma, + // style: TextStyle( + // color: Colors.white, + // fontSize: 18.sp, + // fontWeight: FontWeight.bold, + // ), + // )), GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { @@ -91,7 +90,7 @@ class _BusinessScanCode extends State child: Text( S.of(context).xiangce, style: TextStyle( - color: Colors.black, + color: Colors.white, fontSize: 18.sp, fontWeight: FontWeight.bold, ), diff --git a/lib/business_system/goods/goods_search_page.dart b/lib/business_system/goods/goods_search_page.dart index 2e1b2738..0ee8cca6 100644 --- a/lib/business_system/goods/goods_search_page.dart +++ b/lib/business_system/goods/goods_search_page.dart @@ -137,6 +137,10 @@ class _GoodsSearchPage extends State ///商品下架 queryGoodsUpdate() async { + try{ + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); if (businessService == null) { businessService = BusinessApiService(Dio(), context: context, @@ -153,10 +157,12 @@ class _GoodsSearchPage extends State if (baseData != null && baseData.isSuccess) { _pageIndex = 1; adminProductVoList.clear(); - await _onRefresh(); + await _onRefresh(isShowLoad: false); SmartDialog.showToast(widget.arguments["onSaleStatus"] == "1"?"商品下架成功":"商品上架成功", alignment: Alignment.center); } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + }}finally{ + EasyLoading.dismiss(); } } diff --git a/lib/business_system/goods/on_sale/add_assort.dart b/lib/business_system/goods/on_sale/add_assort.dart index 60ebb6fa..d802510b 100644 --- a/lib/business_system/goods/on_sale/add_assort.dart +++ b/lib/business_system/goods/on_sale/add_assort.dart @@ -61,6 +61,7 @@ class _AddAssort extends State { ///商品分类-新增分类/编辑分类 querySaveProductGroup() async { + try{ EasyLoading.show( status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); if (businessService == null) { @@ -80,7 +81,6 @@ class _AddAssort extends State { editingSortController.text == "" ? "1" : editingSortController.text, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { - EasyLoading.dismiss(); Navigator.of(context).pop(); if (name == "添加分类") showProductTipDialog(); @@ -89,6 +89,8 @@ class _AddAssort extends State { alignment: Alignment.center); } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + }}finally{ + EasyLoading.dismiss(); } } diff --git a/lib/business_system/goods/on_sale/batch_shelf.dart b/lib/business_system/goods/on_sale/batch_shelf.dart index 1e540bd7..f28728ea 100644 --- a/lib/business_system/goods/on_sale/batch_shelf.dart +++ b/lib/business_system/goods/on_sale/batch_shelf.dart @@ -154,27 +154,36 @@ class _BatchShelf extends State { } queryGoodsUpdate() async { - if (businessService == null) { - businessService = BusinessApiService(Dio(), - context: context, - token: BusinessInstance.instance.businessToken, - tenant: BusinessInstance.instance.businessTenant, - storeId: widget.arguments["storeId"]); + try{ + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService.goodsUpdate({ + "productId": 0, + "productIds": productIds ?? [], + "sell": false, + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + _pageIndex = 1; + adminProductVoList.clear(); + await queryGoodsList(groupIndex == -1 + ? "" + : productGroupList?.records[groupIndex]?.id ?? "", isSing: false); + setState(() {}); + SmartDialog.showToast("商品下架成功", alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } } - BaseData baseData = await businessService.goodsUpdate({ - "productId": 0, - "productIds": productIds ?? [], - "sell": false, - }).catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - _pageIndex = 1; - adminProductVoList.clear(); - await queryGoodsList(groupIndex == -1 - ? "" - : productGroupList?.records[groupIndex]?.id ?? ""); - SmartDialog.showToast("商品下架成功", alignment: Alignment.center); - } else { - SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + finally{ + EasyLoading.dismiss(); } } diff --git a/lib/business_system/goods/on_sale/goods_sort.dart b/lib/business_system/goods/on_sale/goods_sort.dart index d50e21b8..4fbd5545 100644 --- a/lib/business_system/goods/on_sale/goods_sort.dart +++ b/lib/business_system/goods/on_sale/goods_sort.dart @@ -20,11 +20,13 @@ import '../../../view_widget/classic_header.dart'; import '../../../view_widget/custom_image.dart'; import '../../../view_widget/my_footer.dart'; import '../../../view_widget/no_data_view.dart'; +import '../../../view_widget/settlement_tips_dialog.dart'; class GoodsSort extends StatefulWidget { final Map arguments; GoodsSort({this.arguments}); + @override State createState() { return _GoodsSort(); @@ -42,7 +44,6 @@ class _GoodsSort extends State { int groupIndex = -1; bool _shimmer = true; - @override void initState() { super.initState(); @@ -61,13 +62,17 @@ class _GoodsSort extends State { 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.arguments["storeId"],); + businessService = BusinessApiService( + Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"], + ); queryProductGroupList(); - queryGoodsList(groupIndex != -1 ? productGroupList.records[groupIndex].id : "", isSing: false); + queryGoodsList( + groupIndex != -1 ? productGroupList.records[groupIndex].id : "", + isSing: false); }); } @@ -118,7 +123,7 @@ class _GoodsSort extends State { maskType: EasyLoadingMaskType.black); try { BaseData baseData = - await businessService.findAdminProductLis({ + await businessService.findAdminProductLis({ "groupId": groupId, "hasStock": "", "keyword": "", @@ -153,6 +158,37 @@ class _GoodsSort extends State { } } + ///商品排序/一键置顶 + goodsSortTop(id) async { + try{ + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService.productSortTop({ + "id": id, + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + _pageIndex = 1; + adminProductVoList.clear(); + await queryGoodsList(groupIndex == -1 + ? "" + : productGroupList?.records[groupIndex]?.id ?? "",isSing: false); + SmartDialog.showToast("商品置顶成功", alignment: Alignment.center); + setState(() {}); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + }finally{ + EasyLoading.dismiss(); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -164,7 +200,7 @@ class _GoodsSort extends State { leadingColor: Colors.black, brightness: Brightness.dark, ), - body:Row( + body: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -175,40 +211,40 @@ class _GoodsSort extends State { color: Color(0xFFFAFAFA), child: (_shimmer) ? ListView.builder( - itemCount: 10, - physics: BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return sortLeftItemSm(); - }, - ) + itemCount: 10, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return sortLeftItemSm(); + }, + ) : ListView.builder( - itemCount: productGroupList?.records?.length ?? 0, - physics: BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - groupIndex = position; - _pageIndex = 1; - adminProductVoList.clear(); - queryGoodsList(productGroupList?.records[position].id,); - }, - child: sortLeftItem( - productGroupList.records[position], - position), - ); - }, - ), + itemCount: productGroupList?.records?.length ?? 0, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + groupIndex = position; + _pageIndex = 1; + adminProductVoList.clear(); + queryGoodsList( + productGroupList?.records[position].id, + ); + }, + child: sortLeftItem( + productGroupList.records[position], position), + ); + }, + ), ), Container( width: MediaQuery.of(context).size.width - 100.w, child: SmartRefresher( controller: _refreshController, enablePullDown: true, - enablePullUp: - adminProductVoList.length != 0 ? true : false, + enablePullUp: adminProductVoList.length != 0 ? true : false, header: MyHeader( color: Color(0xFF30415B), ), @@ -233,42 +269,40 @@ class _GoodsSort extends State { color: Colors.white, child: (_shimmer) ? ListView.builder( - itemCount: 10, - physics: BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return sortGoodsItemSm(); - }, - ) + itemCount: 10, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return sortGoodsItemSm(); + }, + ) : ((adminProductVoList == null || - adminProductVoList.length == 0) - ? NoDataView( - src: - "assets/image/bs_no data_logo.webp", - isShowBtn: false, - text: "该分组暂无添加商品", - fontSize: 16.sp, - margin: EdgeInsets.all(20.h), - ) - : ListView.builder( - itemCount: - adminProductVoList?.length ?? 0, - controller: controller, - physics: BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return sortGoodsItem(adminProductVoList[position]); - }, - )))), + adminProductVoList.length == 0) + ? NoDataView( + src: "assets/image/bs_no data_logo.webp", + isShowBtn: false, + text: "该分组暂无添加商品", + fontSize: 16.sp, + margin: EdgeInsets.all(20.h), + ) + : ListView.builder( + itemCount: adminProductVoList?.length ?? 0, + controller: controller, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return sortGoodsItem( + adminProductVoList[position]); + }, + )))), ), ], ), - ); } ///左边list - Widget sortLeftItem(Records records, index){ + Widget sortLeftItem(Records records, index) { return Container( color: groupIndex == index ? Colors.white : Color(0xFFFAFAFA), alignment: Alignment.center, @@ -279,24 +313,24 @@ class _GoodsSort extends State { children: [ Expanded( child: Text( - records?.groupName ?? "", - textAlign: TextAlign.center, - style: TextStyle( - color: + records?.groupName ?? "", + textAlign: TextAlign.center, + style: TextStyle( + color: groupIndex == index ? Color(0xFF30415B) : Color(0xFF626264), - fontSize: 12.sp, - fontWeight: groupIndex == index - ? MyFontWeight.semi_bold - : MyFontWeight.regular, - ), - )), + fontSize: 12.sp, + fontWeight: groupIndex == index + ? MyFontWeight.semi_bold + : MyFontWeight.regular, + ), + )), ], ), ); } ///右边List - Widget sortGoodsItem(AdminProductVoList adminProductVoList){ + Widget sortGoodsItem(AdminProductVoList adminProductVoList) { return Container( margin: EdgeInsets.only(bottom: 21.h), padding: EdgeInsets.only(left: 16.w, right: 14.w), @@ -309,16 +343,21 @@ class _GoodsSort extends State { fit: BoxFit.cover, radius: BorderRadius.circular(4), ), - SizedBox(width:12.w,), - Expanded(child:Column( + SizedBox( + width: 12.w, + ), + Expanded( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding(padding:EdgeInsets.only(bottom:11.h,top: 2.h), + Padding( + padding: EdgeInsets.only(bottom: 11.h, top: 2.h), child: Row( children: [ - Expanded(child: Text( + Expanded( + child: Text( adminProductVoList?.productName ?? "", - maxLines:1, + maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 14.sp, @@ -326,16 +365,34 @@ class _GoodsSort extends State { color: Color(0xFF000000), ), )), - Text( - "置顶", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFFF4524D), - ), - ) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (widget.arguments["storeId"] == "0") { + SmartDialog.show( + widget: SettlementTips( + () {}, + text: "当前为所有门店状态,置顶商品时,请将门店切换至对应门店操作!", + color: Color(0xFF30415B), + )); + } else { + goodsSortTop(adminProductVoList.id); + } + }, + child: Padding( + padding: EdgeInsets.only(left:10.w,top: 2.h,bottom: 2.h), + child: Text( + "置顶", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFF4524D), + ), + ), + )) ], - ),), + ), + ), Row( children: [ Text( @@ -346,7 +403,9 @@ class _GoodsSort extends State { color: Color(0xFFA29E9E), ), ), - SizedBox(width: 8.w,), + SizedBox( + width: 8.w, + ), Text( "销量${adminProductVoList?.sellCount ?? 0}", style: TextStyle( @@ -357,7 +416,9 @@ class _GoodsSort extends State { ), ], ), - SizedBox(height:7.h,), + SizedBox( + height: 7.h, + ), Text.rich( TextSpan( children: [ @@ -428,93 +489,95 @@ class _GoodsSort extends State { ), Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 11.h, top: 2.h), - child: Row( - children: [Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), - ), - width: 120.w, - height: 20.h, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 11.h, top: 2.h), + child: Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), ), + width: 120.w, + height: 20.h, ), - SizedBox( - width:10.w, - ), - Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), - ), - width: 24.w, - height: 20.h, - ), - ),], ), - ), - Row( - children: [ - Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), - ), - width: 43.w, - height: 18.h, + SizedBox( + width: 10.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), ), + width: 24.w, + height: 20.h, ), - SizedBox( - width: 8.w, - ), - Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), - ), - width: 43.w, - height: 18.h, - ), + ), + ], + ), + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), ), - ], + width: 43.w, + height: 18.h, + ), ), SizedBox( - height: 7.h, + width: 8.w, ), - Row( - children: [ - Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), - ), - width: 28.w, - height: 20.h, - ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), ), - Spacer(), - ], - ) + width: 43.w, + height: 18.h, + ), + ), ], - )), + ), + SizedBox( + height: 7.h, + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 28.w, + height: 20.h, + ), + ), + Spacer(), + ], + ) + ], + )), ], ), ); 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 dd7e8a4e..d1c3780e 100644 --- a/lib/business_system/goods/on_sale/on_sale_page.dart +++ b/lib/business_system/goods/on_sale/on_sale_page.dart @@ -309,7 +309,10 @@ class _OnSalePage extends State { behavior: HitTestBehavior.opaque, onTap: () { Navigator.of(context).pushNamed('/router/goods_assort', - arguments: {"storeId": widget.storeId}); + arguments: {"storeId": widget.storeId}).then((value) { + adminProductVoList.clear(); + _onRefresh(); + }); }, child: Container( color: Color(0xFFEDEDED), @@ -346,7 +349,10 @@ class _OnSalePage extends State { behavior: HitTestBehavior.opaque, onTap: () { Navigator.of(context).pushNamed('/router/goods_sort', - arguments: {"storeId": widget.storeId}); + arguments: {"storeId": widget.storeId}).then((value) { + adminProductVoList.clear(); + _onRefresh(); + }); }, child: Container( color: Color(0xFFEDEDED), @@ -383,7 +389,10 @@ class _OnSalePage extends State { behavior: HitTestBehavior.opaque, onTap: () { Navigator.of(context).pushNamed('/router/batch_shelf', - arguments: {"storeId": widget.storeId}); + arguments: {"storeId": widget.storeId}).then((value) { + adminProductVoList.clear(); + _onRefresh(); + }); }, child: Container( color: Color(0xFFEDEDED), @@ -434,7 +443,9 @@ class _OnSalePage extends State { }).then((value) => { _pageIndex = 1, adminProductVoList.clear(), - _onRefresh(isShowLoad: false), + queryGoodsList(groupIndex == -1 + ? "" + : productGroupList?.records[groupIndex]?.id ?? "") }); }, child: Container( diff --git a/lib/business_system/home/home_view/donut_auto_label_chart.dart b/lib/business_system/home/home_view/donut_auto_label_chart.dart index a7d7612a..b32327df 100644 --- a/lib/business_system/home/home_view/donut_auto_label_chart.dart +++ b/lib/business_system/home/home_view/donut_auto_label_chart.dart @@ -10,8 +10,9 @@ import 'my_arc_label_decorator.dart'; class DonutAutoLabelChart extends StatelessWidget { final List seriesList; final bool animate; + final List defaultLabelText; - DonutAutoLabelChart(this.seriesList, {this.animate = false}); + DonutAutoLabelChart(this.seriesList,this.defaultLabelText, {this.animate = false}); @override Widget build(BuildContext context) { @@ -21,7 +22,7 @@ class DonutAutoLabelChart extends StatelessWidget { arcWidth: 15, strokeWidthPx: 0, arcRendererDecorators: [ - new MyArcLabelDecorator(MediaQuery.of(context).size.width) + new MyArcLabelDecorator(MediaQuery.of(context).size.width,defaultLabelText) ])); } } diff --git a/lib/business_system/home/home_view/my_arc_label_decorator.dart b/lib/business_system/home/home_view/my_arc_label_decorator.dart index 61f32e87..73e43d87 100644 --- a/lib/business_system/home/home_view/my_arc_label_decorator.dart +++ b/lib/business_system/home/home_view/my_arc_label_decorator.dart @@ -49,7 +49,7 @@ class MyArcLabelDecorator extends ArcRendererDecorator { Color.fromHex(code: "#21CCFF"), Color.fromHex(code: "#313CA9") ]; - static final _defaultLabelText = ["收款(0.00%)", "退款(0.00%)"]; + // static final _defaultLabelText = ["收款(0.00%)", "退款(0.00%)"]; static final _defaultOutsideLabelStyle = TextStyleSpec(fontSize: 14, color: Color.fromHex(code: "#333333"),); static final _defaultTextLabelStyle = @@ -89,7 +89,10 @@ class MyArcLabelDecorator extends ArcRendererDecorator { final double mediaQueryWidth; + final List defaultLabelText; + MyArcLabelDecorator(this.mediaQueryWidth, + this.defaultLabelText, {TextStyleSpec insideLabelStyleSpec, TextStyleSpec outsideLabelStyleSpec, ArcLabelLeaderLineStyleSpec leaderLineStyleSpec, @@ -193,7 +196,7 @@ class MyArcLabelDecorator extends ArcRendererDecorator { ..maxWidthStrategy = MaxWidthStrategy.ellipsize; final labelTextElement = graphicsFactory - .createTextElement(_defaultLabelText[i]) + .createTextElement(defaultLabelText[i]) ..maxWidthStrategy = MaxWidthStrategy.ellipsize; var calculatedLabelPosition = calculateLabelPosition( diff --git a/lib/business_system/home/home_view/my_line_chart.dart b/lib/business_system/home/home_view/my_line_chart.dart index 30421be0..2666feb1 100644 --- a/lib/business_system/home/home_view/my_line_chart.dart +++ b/lib/business_system/home/home_view/my_line_chart.dart @@ -8,7 +8,8 @@ class LineChartSample2 extends StatefulWidget { final List lineChartSample2Data; final String tipName; - LineChartSample2(this.lineChartSample2Data,this.tipName, {Key key}) : super(key: key); + LineChartSample2(this.lineChartSample2Data, this.tipName, {Key key}) + : super(key: key); @override State createState() => _LineChartSample2State(); @@ -28,9 +29,12 @@ class _LineChartSample2State extends State { } Widget bottomTitleWidgets(double value, TitleMeta meta) { - if(value%1 != 0) + if ((meta.appliedInterval <= 1 && + double.parse(meta.formattedValue) % 1 != 0) || + (meta.appliedInterval > 1 && + double.parse(meta.formattedValue) % meta.appliedInterval != 0)) return Text(""); - String text = widget.lineChartSample2Data[value.toInt()].time ?? ""; + String text = widget.lineChartSample2Data[int.parse(meta.formattedValue)].time ?? ""; if (text.length == 10) text = text.substring(5, 10); else if (text.length == 7) text = text.substring(2, 7); @@ -73,13 +77,15 @@ class _LineChartSample2State extends State { } else { text = value.toInt().toString(); } - return Padding(padding:EdgeInsets.only(right:2.w), - child: Text(text, - style: const TextStyle( - fontWeight: MyFontWeight.light, - fontSize: 10, - color: Color(0xFF999999)), - textAlign: TextAlign.right),); + return Padding( + padding: EdgeInsets.only(right: 2.w), + child: Text(text, + style: const TextStyle( + fontWeight: MyFontWeight.light, + fontSize: 10, + color: Color(0xFF999999)), + textAlign: TextAlign.right), + ); } LineChartData mainData() { @@ -168,14 +174,15 @@ class _LineChartSample2State extends State { }, touchTooltipData: LineTouchTooltipData( tooltipBgColor: Color(0xFF3D3D3D), - tooltipPadding: const EdgeInsets.symmetric(vertical:5,horizontal:6), + tooltipPadding: + const EdgeInsets.symmetric(vertical: 5, horizontal: 6), tooltipMargin: 5, tooltipRoundedRadius: 2, tooltipHorizontalAlignment: FLHorizontalAlignment.center, getTooltipItems: (touchedSpots) { return touchedSpots.map((LineBarSpot touchedSpot) { return LineTooltipItem( - '${(widget.lineChartSample2Data[touchedSpot.x.toInt()].time ?? "").substring(5,10)}', + '${(widget.lineChartSample2Data[touchedSpot.x.toInt()].time ?? "").substring(5, 10)}', const TextStyle( color: Colors.white, fontWeight: MyFontWeight.light, @@ -183,7 +190,7 @@ class _LineChartSample2State extends State { textAlign: TextAlign.start, children: [ TextSpan( - text: '\n${widget?.tipName??""}: ', + text: '\n${widget?.tipName ?? ""}: ', style: const TextStyle( color: Colors.white, fontWeight: MyFontWeight.medium, @@ -209,7 +216,7 @@ class _LineChartSample2State extends State { .toList(), isCurved: false, color: Color(0xFF165DFF), - barWidth:2.5, + barWidth: 2.5, dotData: FlDotData( show: false, getDotPainter: (spot, percent, barData, index) { diff --git a/lib/business_system/home/overview/trade_goods.dart b/lib/business_system/home/overview/trade_goods.dart index 201dcf76..4989758c 100644 --- a/lib/business_system/home/overview/trade_goods.dart +++ b/lib/business_system/home/overview/trade_goods.dart @@ -601,7 +601,7 @@ class _TradeGoods extends State { } }, child: Container( - width: 194.w, + width: 200.w, alignment: Alignment.center, padding: EdgeInsets.all(8), decoration: BoxDecoration( diff --git a/lib/business_system/home/overview/trade_order.dart b/lib/business_system/home/overview/trade_order.dart index a8bda8b9..a4e07fc1 100644 --- a/lib/business_system/home/overview/trade_order.dart +++ b/lib/business_system/home/overview/trade_order.dart @@ -52,6 +52,7 @@ class _TradeOrder extends State { 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())}"; @@ -76,7 +77,7 @@ class _TradeOrder extends State { @override void initState() { super.initState(); - _onRefresh(); + // _onRefresh(); } _onRefresh() async { @@ -246,8 +247,7 @@ class _TradeOrder extends State { border: Border.all(color: Color(0xFFCFD0D1), width: 1.w), ), - margin: EdgeInsets.only( - top: 16.h, right: 20.w, left: 20.w, bottom: 12.h), + margin: EdgeInsets.only(top: 16.h, right: 20.w, left: 20.w, bottom: 12.h), child: Row( children: [ Expanded( @@ -618,7 +618,8 @@ class _TradeOrder extends State { fontSize: 16.sp, margin: EdgeInsets.all(20.h), ) - : Padding( + : + Padding( padding: EdgeInsets.symmetric(horizontal: 20.w), child: LineChartSample2(lineChartSample2DataOrderAmount, "金额"), ), diff --git a/lib/business_system/home/overview/trade_summary.dart b/lib/business_system/home/overview/trade_summary.dart index 4ae543c3..788e5522 100644 --- a/lib/business_system/home/overview/trade_summary.dart +++ b/lib/business_system/home/overview/trade_summary.dart @@ -497,7 +497,7 @@ class _TradeSummary extends State { } }, child: Container( - width: 194.w, + width: 200.w, alignment: Alignment.center, padding: EdgeInsets.all(8), decoration: BoxDecoration( @@ -581,7 +581,8 @@ class _TradeSummary extends State { } else if (dateIndex == 3) { return (customDate == "" || customDate == null) ? "${customDateNum ?? ""}(今日)" - : ("${customDate.substring(0,11)} ""${customDate.substring(21,34)}"); + : ("${customDate.substring(0, 11)} " + "${customDate.substring(21, 34)}"); } } @@ -848,6 +849,9 @@ class _TradeSummary extends State { labelAccessorFn: (LinearSales row, _) => '${(row.sales / 100)}', ) + ], [ + "收款(${AppUtils.calculateDouble((tradeSummaryList?.collectionAmount == "0" && tradeSummaryList?.refundAmount == "0") ? 50 : (double.parse(tradeSummaryList?.collectionAmount ?? "0") / (double.parse(tradeSummaryList?.collectionAmount ?? "0") + double.parse(tradeSummaryList?.refundAmount ?? "0")) * 100))}%)", + "退款(${AppUtils.calculateDouble((tradeSummaryList?.collectionAmount == "0" && tradeSummaryList?.refundAmount == "0") ? 50 : (double.parse(tradeSummaryList?.refundAmount ?? "0") / (double.parse(tradeSummaryList?.collectionAmount ?? "0") + double.parse(tradeSummaryList?.refundAmount ?? "0")) * 100))}%)" ]), ), if (expensesSelect == 1) @@ -869,12 +873,12 @@ class _TradeSummary extends State { 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")), + 0, + tradeSummaryList?.collectionCount ?? 0, + charts.Color.fromHex(code: "#313CA9"), + ), new LinearSales(2, tradeSummaryList?.refundCount ?? 0, charts.Color.fromHex(code: "#30415B")), ], @@ -882,6 +886,9 @@ class _TradeSummary extends State { labelAccessorFn: (LinearSales row, _) => '${(row.sales)} 笔', ), + ], [ + "收款(${AppUtils.calculateDouble((tradeSummaryList?.collectionCount == 0 && tradeSummaryList?.refundCount == 0) ? 50 : ((tradeSummaryList?.collectionCount ?? 0) / ((tradeSummaryList?.collectionCount ?? 0) + (tradeSummaryList?.refundCount ?? 0)) * 100))}%)", + "退款(${AppUtils.calculateDouble((tradeSummaryList?.collectionCount == 0 && tradeSummaryList?.refundCount == 0) ? 50 : ((tradeSummaryList?.refundCount ?? 0) / ((tradeSummaryList?.collectionCount ?? 0) + (tradeSummaryList?.refundCount ?? 0)) * 100))}%)" ]), ), ], diff --git a/lib/business_system/mine/business_mine_page.dart b/lib/business_system/mine/business_mine_page.dart index 437e2eb6..f292f799 100644 --- a/lib/business_system/mine/business_mine_page.dart +++ b/lib/business_system/mine/business_mine_page.dart @@ -38,7 +38,6 @@ class _BusinessMinePage extends State List records = []; double visiblePercentage; - @override void initState() { super.initState(); @@ -55,28 +54,29 @@ class _BusinessMinePage extends State // EasyLoading.show( // status: S.current.zhengzaijiazai, // maskType: EasyLoadingMaskType.black); - if (businessService == null) { - businessService = BusinessApiService(Dio(), - context: context, - token: BusinessInstance.instance.businessToken, - tenant: BusinessInstance.instance.businessTenant, - storeId: widget.storeId); - } - BaseData baseData = - await businessService.getStoreList(BusinessInstance.instance.businessTenant,"1","100").catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); - refreshController.refreshFailed(); - refreshController.loadFailed(); - }); - if (!mounted) return; - if (baseData != null && baseData.isSuccess) { - records = baseData.data.records ?? []; - refreshController.refreshCompleted(); - // EasyLoading.dismiss(); - } else { - SmartDialog.showToast(baseData.msg, alignment: Alignment.center); - } + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.storeId); + } + BaseData baseData = await businessService + .getStoreList(BusinessInstance.instance.businessTenant, "1", "100") + .catchError((error) { + SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), + alignment: Alignment.center); + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (!mounted) return; + if (baseData != null && baseData.isSuccess) { + records = baseData.data.records ?? []; + refreshController.refreshCompleted(); + // EasyLoading.dismiss(); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } } @override @@ -86,60 +86,58 @@ class _BusinessMinePage extends State key: Key('my-widget-key'), onVisibilityChanged: (visibilityInfo) { visiblePercentage = visibilityInfo.visibleFraction; - if(visiblePercentage == 1) - queryStoreList(); + if (visiblePercentage == 1) queryStoreList(); }, child: Column( - children: [ - Expanded( - child: Container( - child: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: false, - header: MyHeader(color: Color(0xFF30415B)), - physics: BouncingScrollPhysics(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, - ), - onRefresh: () { - if (widget.businessLoginInfo != null){ - queryStoreList(); - } - else - refreshController.refreshFailed(); - }, - child: SingleChildScrollView( - physics: NeverScrollableScrollPhysics(), - child: Container( - child: Column( - children: [ - mineInfo(), - commonFunctions(), - otherFunctions(), - SizedBox( - height: 54.h, - ), - Text( - "@回乡信息公司", - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF30415B), - fontWeight: MyFontWeight.medium), + children: [ + Expanded( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(color: Color(0xFF30415B)), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + if (widget.businessLoginInfo != null) { + queryStoreList(); + } else + refreshController.refreshFailed(); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: Container( + child: Column( + children: [ + mineInfo(), + commonFunctions(), + otherFunctions(), + SizedBox( + height: 54.h, + ), + Text( + "@回乡信息公司", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF30415B), + fontWeight: MyFontWeight.medium), + ), + ], ), - ], - ), - )), + )), + ), + ), ), - ), - ), - SizedBox( - height: 76.h, - ), - ], - )); + SizedBox( + height: 76.h, + ), + ], + )); } Widget mineInfo() { @@ -267,22 +265,20 @@ class _BusinessMinePage extends State GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - if(widget.businessLoginInfo.storeList.length > 1){ - Navigator.of(context) - .pushNamed('/router/select_shop', arguments: { - "routeSource":"门店设置", - "records":records - }); - }else{ + if (widget.businessLoginInfo.storeList.length > 1) { + Navigator.of(context).pushNamed('/router/select_shop', + arguments: {"routeSource": "门店设置", "records": records}); + } else { Navigator.of(context) - .pushNamed('/router/merchant_info',arguments: { + .pushNamed('/router/merchant_info', arguments: { "storeId": widget.storeId, "storeName": records[0].storeName, "records": records[0], }); } }, - child: commonFunctionsItem("assets/image/bs_shop_logo.webp", "门店设置",""), + child: commonFunctionsItem( + "assets/image/bs_shop_logo.webp", "门店设置", ""), ), Container( width: double.infinity, @@ -374,7 +370,13 @@ class _BusinessMinePage extends State SizedBox( height: 20.h, ), - commonFunctionsItem("assets/image/bs_user.webp", "关于我们", ""), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pushNamed('/router/user_service_page'); + }, + child: + commonFunctionsItem("assets/image/bs_user.webp", "关于我们", "")) ], ), ); diff --git a/lib/business_system/order/business_order_page.dart b/lib/business_system/order/business_order_page.dart index 567cbbe5..9d27cbcd 100644 --- a/lib/business_system/order/business_order_page.dart +++ b/lib/business_system/order/business_order_page.dart @@ -120,13 +120,13 @@ class _BusinessOrderPage extends State body: TabBarView( children: [ OrderList(_allKey[0], 0, widget.storeId, - editingController.text, selectTime()), + editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), OrderList(_allKey[1], 1, widget.storeId, - editingController.text, selectTime()), + editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), OrderList(_allKey[2], 2, widget.storeId, - editingController.text, selectTime()), + editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), OrderList(_allKey[3], 3, widget.storeId, - editingController.text, selectTime()), + editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), ], ), ), diff --git a/lib/business_system/order/order_list.dart b/lib/business_system/order/order_list.dart index db6f7ae3..2ba576e1 100644 --- a/lib/business_system/order/order_list.dart +++ b/lib/business_system/order/order_list.dart @@ -23,8 +23,9 @@ class OrderList extends StatefulWidget { final String storeId; final String keyword; final String time; + final bool isKeyBoardShow; - OrderList(Key key, this.status, this.storeId, this.keyword, this.time) + OrderList(Key key, this.status, this.storeId, this.keyword, this.time,this.isKeyBoardShow) : super(key: key); @override @@ -169,12 +170,15 @@ class _OrderList extends State { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { + if(widget.isKeyBoardShow){ + return; + }else{ Navigator.of(context).pushNamed( '/router/business_order_detail', arguments: { "id": adminOrderDTOList[position].id, "storeId": widget.storeId - }); + });} }, child: orderItem(adminOrderDTOList[position]), ); diff --git a/lib/retrofit/business_api.dart b/lib/retrofit/business_api.dart index e0c74cc4..c2afebc4 100644 --- a/lib/retrofit/business_api.dart +++ b/lib/retrofit/business_api.dart @@ -252,4 +252,9 @@ abstract class BusinessApiService { Future wipedBatchs( @Body() String param); + ///商品排序/一键置顶 + @POST("product/productSortTop") + Future productSortTop( + @Body() Map param); + } diff --git a/lib/retrofit/business_api.g.dart b/lib/retrofit/business_api.g.dart index ed7b51fe..ed46a054 100644 --- a/lib/retrofit/business_api.g.dart +++ b/lib/retrofit/business_api.g.dart @@ -572,4 +572,26 @@ class _BusinessApiService implements BusinessApiService { ); return value; } + + @override + Future productSortTop(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('product/productSortTop', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json == null ? null : json, + ); + return value; + } } diff --git a/lib/view_widget/icon_text.dart b/lib/view_widget/icon_text.dart index 19cdbd38..342f8151 100644 --- a/lib/view_widget/icon_text.dart +++ b/lib/view_widget/icon_text.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'custom_image.dart'; @@ -38,7 +39,7 @@ class IconText extends StatelessWidget { if (leftIcon != null) { widgets.add( Padding( - padding: EdgeInsets.only(left: 2), + padding: EdgeInsets.only(left: 2.w), child: Icon( leftIcon, size: iconSize, @@ -48,7 +49,7 @@ class IconText extends StatelessWidget { ); } else if (leftImage != null && leftImage != "") { widgets.add(Padding( - padding: EdgeInsets.only(left: 2), + padding: EdgeInsets.only(left: 2.w), child: leftImage.startsWith("http") ? MImage( leftImage, @@ -79,7 +80,7 @@ class IconText extends StatelessWidget { child: Text( text, overflow: overFlow, - maxLines: 2, + // maxLines: 2, textAlign: TextAlign.start, style: textStyle, ), @@ -100,7 +101,7 @@ class IconText extends StatelessWidget { if (rightIcon != null) { widgets.add( Padding( - padding: EdgeInsets.only(left: 2), + padding: EdgeInsets.only(left: 2.w), child: Icon( rightIcon, size: iconSize, @@ -111,7 +112,7 @@ class IconText extends StatelessWidget { } else if (rightImage != null && rightImage != "") { widgets.add( Padding( - padding: EdgeInsets.only(left: 2), + padding: EdgeInsets.only(left: 2.w), child: rightImage.startsWith("http") ? Image.network( rightImage,