Browse Source

新建商品-设置多规格商品详情数据交互完成;

编辑多规格详情数据更改;
设置商品规格页面数据传值处理;
wr_2023_new_business
wurong 1 year ago
parent
commit
bfc6c59c52
  1. 677
      lib/business_system/goods/add_goods/add_goods_page.dart
  2. 8
      lib/business_system/goods/add_goods/edit_specs_detail.dart
  3. 22
      lib/business_system/goods/add_goods/set_goods_specs.dart
  4. 512
      lib/business_system/goods/on_sale/batch_shelf.dart

677
lib/business_system/goods/add_goods/add_goods_page.dart

@ -53,6 +53,7 @@ class _AddGoodsPage extends State<AddGoodsPage> {
bool isKeyBoardShow = false; bool isKeyBoardShow = false;
FocusNode _focusNode = FocusNode(); FocusNode _focusNode = FocusNode();
List<dynamic> mealDetails = []; List<dynamic> mealDetails = [];
List<dynamic> goodsSpecsDetails = [];
@override @override
void initState() { void initState() {
@ -82,14 +83,12 @@ class _AddGoodsPage extends State<AddGoodsPage> {
} }
_onRefresh() async { _onRefresh() async {
EasyLoading.show( EasyLoading.show(
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
maskType: EasyLoadingMaskType.black);
await queryProductGroupList(); await queryProductGroupList();
await queryCategorize(); await queryCategorize();
EasyLoading.dismiss(); EasyLoading.dismiss();
if (mounted) if (mounted) setState(() {});
setState(() {});
} }
/// ///
@ -128,7 +127,8 @@ class _AddGoodsPage extends State<AddGoodsPage> {
tenant: BusinessInstance.instance.businessTenant, tenant: BusinessInstance.instance.businessTenant,
storeId: widget.arguments["storeId"]); storeId: widget.arguments["storeId"]);
} }
BaseData<List<GoodsCategoryList>> baseData = await businessService.findCategoryListByDepth().catchError((error) {}); BaseData<List<GoodsCategoryList>> baseData =
await businessService.findCategoryListByDepth().catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
goodsCategoryList = baseData.data; goodsCategoryList = baseData.data;
} }
@ -146,41 +146,53 @@ class _AddGoodsPage extends State<AddGoodsPage> {
} }
BaseData baseData = await businessService.productSave({ BaseData baseData = await businessService.productSave({
"storeId": widget.arguments["storeId"], "storeId": widget.arguments["storeId"],
"attrStyle": isAttrStyle == true ? 0:1,//1- 0- "attrStyle": isAttrStyle == true ? 0 : 1, //1- 0-
"categoryId": "1343391656220557312",//id "categoryId": "1343391656220557312", //id
"oversold": isOversold == true ? 1:0,//1- 0- "oversold": isOversold == true ? 1 : 0, //1- 0-
"setMeal": isSetMeal == true ? 0:1,// 0 1 "setMeal": isSetMeal == true ? 0 : 1, // 0 1
"groupId": "1693436138259218432",//id "groupId": "1693436138259218432", //id
"imgs": [ "imgs": [
{ {
"imgPath": "https://pos.upload.lotus-wallet.com/1195/2023/10/1ba87000-d940-49e5-a6ca-f15623d5f841.jpg" "imgPath":
"https://pos.upload.lotus-wallet.com/1195/2023/10/1ba87000-d940-49e5-a6ca-f15623d5f841.jpg"
} }
],// ], //
"needLogistics": isLogistics == true ? 1:0,//1- 0- "needLogistics": isLogistics == true ? 1 : 0, //1- 0-
"productName": "新建商品",// "productName": "新建商品", //
"productType": 0,//01app新增商品用不到0 "productType": 0, //01app新增商品用不到0
"shortName": "商品简介",// "shortName": "商品简介", //
"skuAttrList": [ "skuAttrList": [
{ {
"attrCode": "",//,app新增商品用不到"" "attrCode": "", //,app新增商品用不到""
"attrName": "",//,app新增商品用不到"" "attrName": "", //,app新增商品用不到""
"needImg": 0,//,app新增商品用不到0 "needImg": 0, //,app新增商品用不到0
"attrValueList": [ "attrValueList": [
{"attrValue": "商品规格",// {
"attrValue": "商品规格", //
"attrValueCode": "", //,app新增商品用不到"" "attrValueCode": "", //,app新增商品用不到""
}]// }
] //
} }
],// ], //
"skuList": [ "skuList": [
{ {
"applyPrice": "234",// "applyPrice": "234",
"skuAttrCodeDTOList": [{"attrCode": "", "attrValueCode": ""}],//sku对应的规格编码,app新增商品用不到 //
"skuPrice": "123",// "skuAttrCodeDTOList": [
"packagingFee": "789",// {"attrCode": "", "attrValueCode": ""}
"skuStock": "666",// ],
"weight": "222"// //sku对应的规格编码,app新增商品用不到
}],//sku列表 "skuPrice": "123",
"status":isGround == true ? 1:0 //1- 0- //
"packagingFee": "789",
//
"skuStock": "666",
//
"weight": "222"
//
}
], //sku列表
"status": isGround == true ? 1 : 0 //1- 0-
}).catchError((error) { }).catchError((error) {
networkError = AppUtils.dioErrorTypeToString(error.type); networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1; networkStatus = -1;
@ -190,19 +202,19 @@ class _AddGoodsPage extends State<AddGoodsPage> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
SmartDialog.show( SmartDialog.show(
widget: SettlementTips( widget: SettlementTips(
() {}, () {},
text: "新建商品成功", text: "新建商品成功",
color: Color(0xFF30415B), color: Color(0xFF30415B),
)); ));
networkStatus = 1; networkStatus = 1;
setState(() {}); setState(() {});
} else { } else {
SmartDialog.show( SmartDialog.show(
widget: SettlementTips( widget: SettlementTips(
() {}, () {},
text: baseData.msg, text: baseData.msg,
color: Color(0xFF30415B), color: Color(0xFF30415B),
)); ));
} }
} finally {} } finally {}
} }
@ -249,17 +261,19 @@ class _AddGoodsPage extends State<AddGoodsPage> {
children: [ children: [
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: (){ onTap: () {
officialCategory(); officialCategory();
}, },
child:textSelectItem("官方分类",categoryName == "" ? "请选择":categoryName), child: textSelectItem(
"官方分类", categoryName == "" ? "请选择" : categoryName),
), ),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: (){ onTap: () {
goodsGroup(); goodsGroup();
}, },
child:textSelectItem("商品分组",groupName == "" ? "请选择":groupName)), child: textSelectItem(
"商品分组", groupName == "" ? "请选择" : groupName)),
], ],
), ),
), ),
@ -269,7 +283,9 @@ class _AddGoodsPage extends State<AddGoodsPage> {
margin: EdgeInsets.only(top: 12.h), margin: EdgeInsets.only(top: 12.h),
child: Column( child: Column(
children: [ children: [
Padding(padding: EdgeInsets.only(top: 18.h,left: 16.w,right: 16.w), Padding(
padding:
EdgeInsets.only(top: 18.h, left: 16.w, right: 16.w),
child: Row( child: Row(
children: [ children: [
Padding( Padding(
@ -284,13 +300,15 @@ class _AddGoodsPage extends State<AddGoodsPage> {
)), )),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap:(){ onTap: () {
setState((){ setState(() {
isAttrStyle = !isAttrStyle; isAttrStyle = !isAttrStyle;
}); });
}, },
child: Image.asset( child: Image.asset(
isAttrStyle == true ? "assets/image/reservation_switch.webp":"assets/image/reservation_unswitch.webp", isAttrStyle == true
? "assets/image/reservation_switch.webp"
: "assets/image/reservation_unswitch.webp",
width: 44.w, width: 44.w,
height: 24.h, height: 24.h,
), ),
@ -301,133 +319,152 @@ class _AddGoodsPage extends State<AddGoodsPage> {
width: double.infinity, width: double.infinity,
height: 1.w, height: 1.w,
color: Color(0x14000000), color: Color(0x14000000),
margin: EdgeInsets.only(top: 16.h,left: 16.w,right: 16.w), margin:
EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w),
), ),
isAttrStyle == true ? GestureDetector( isAttrStyle == true
behavior: HitTestBehavior.opaque, ? GestureDetector(
onTap: (){ behavior: HitTestBehavior.opaque,
Navigator.of(context).pushNamed( onTap: () {
'/router/set_goods_specs'); Navigator.of(context).pushNamed(
}, '/router/set_goods_specs',
child:Container( arguments: {
padding: EdgeInsets.only(left: 16.w,right: 16.w,top: 16.h), "goodsSpecsDetails": goodsSpecsDetails
child:Column( }).then((value) {
crossAxisAlignment: CrossAxisAlignment.start, if (value != null) {
children: [ goodsSpecsDetails.clear();
Row( goodsSpecsDetails.addAll(value);
crossAxisAlignment: CrossAxisAlignment.center, setState(() {});
mainAxisAlignment: MainAxisAlignment.start, }
children: [ });
Expanded(child:Text( },
"商品规格", child: Container(
style: TextStyle( padding: EdgeInsets.only(
color: Color(0xFF0D0D0D), left: 16.w, right: 16.w, top: 16.h),
fontSize: 14.sp, child: Column(
fontWeight: FontWeight.bold, crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
"商品规格",
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 14.sp,
fontWeight: FontWeight.bold,
),
)),
Text(
"请设置商品规格",
style: TextStyle(
color: Color(0xFF7A797F),
fontSize: 14.sp,
fontWeight: FontWeight.bold,
),
),
Image.asset(
"assets/image/bs_right.webp",
width: 16.h,
height: 16.h,
),
],
), ),
)), Container(
Text( margin: EdgeInsets.only(top: 16.h),
"请设置商品规格", color: Color(0x14000000),
style: TextStyle( height: 1.h,
color: Color(0xFF7A797F), width: double.infinity,
fontSize: 14.sp,
fontWeight: FontWeight.bold,
), ),
), ],
Image.asset( ),
"assets/image/bs_right.webp",
width: 16.h,
height: 16.h,
),
],
),
Container(
margin: EdgeInsets.only(top: 16.h),
color: Color(0x14000000),
height: 1.h,
width: double.infinity,
), ),
], )
), : textItem("商品规格", skuController, "请输入商品规格"),
), if (isAttrStyle == false)
): textItem("商品规格", skuController, "请输入商品规格"), textItem("商品重量", heftController, "请输入商品重量"),
if(isAttrStyle == false) if (isAttrStyle == false)
textItem("商品重量", heftController, "请输入商品重量"), textItem("商品售价", priceController, "请输入商品售卖价格"),
if(isAttrStyle == false) if (isAttrStyle == false)
textItem("商品售价", priceController, "请输入商品售卖价格"), textItem("商品原价", originalPriceController, "请输入商品划线价格"),
if(isAttrStyle == false) if (isAttrStyle == false)
textItem("商品原价", originalPriceController, "请输入商品划线价格"), textItem("打包费", packingChargeController, "请输入商品打包费用"),
if(isAttrStyle == false) if (isAttrStyle == false)
textItem("打包费", packingChargeController, "请输入商品打包费用"), textItem("商品库存", stockController, "请输入商品库存"),
if(isAttrStyle == false) if (isAttrStyle == false)
textItem("商品库存", stockController, "请输入商品库存"), GestureDetector(
if(isAttrStyle == false) behavior: HitTestBehavior.opaque,
GestureDetector( onTap: () {
behavior: HitTestBehavior.opaque, Navigator.of(context).pushNamed('/router/set_meal',
onTap:(){ arguments: {
Navigator.of(context).pushNamed( "mealDetails": mealDetails
'/router/set_meal',arguments:{"storeId":widget.arguments["storeId"],"mealDetails":mealDetails}).then((value){ }).then((value) {
if (value != null){ if (value != null) {
mealDetails.clear(); mealDetails.clear();
mealDetails.addAll(value); mealDetails.addAll(value);
setState((){}); setState(() {});
} }
}); });
}, },
child: Padding(padding: EdgeInsets.symmetric(horizontal: 16.w,vertical:16.h), child: Padding(
child: Column( padding: EdgeInsets.symmetric(
children: [ horizontal: 16.w, vertical: 16.h),
Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, children: [
mainAxisAlignment: MainAxisAlignment.center, Row(
children: [ crossAxisAlignment: CrossAxisAlignment.center,
Expanded( mainAxisAlignment: MainAxisAlignment.center,
child:Text( children: [
"设置套餐", Expanded(
child: Text(
"设置套餐",
style: TextStyle(
color: Color(0xD9000000),
fontSize: 14.sp,
fontWeight: FontWeight.bold,
),
),
),
Text(
"套餐选择",
style: TextStyle( style: TextStyle(
color: Color(0xD9000000), color: Color(0xFF7A797F),
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), Image.asset(
Text( "assets/image/bs_right.webp",
"套餐选择", width: 16.h,
style: TextStyle( height: 16.h,
color: Color(0xFF7A797F),
fontSize: 14.sp,
fontWeight: FontWeight.bold,
), ),
), ],
Image.asset( ),
"assets/image/bs_right.webp", Container(
width: 16.h, margin: EdgeInsets.only(top: 16.h),
height: 16.h, color: Color(0x14000000),
), height: 1.h,
], width: double.infinity,
), ),
Container( ],
margin:EdgeInsets.only(top: 16.h), ),
color: Color(0x14000000), ),
height: 1.h, ),
width: double.infinity,
),
],
),),
),
Container( Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 16.h), padding: EdgeInsets.symmetric(vertical: 16.h),
margin: EdgeInsets.only(top: 111.h, bottom: 34.h,left:16.w,right:16.w), margin: EdgeInsets.only(
top: 111.h, bottom: 34.h, left: 16.w, right: 16.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF30415B), color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(27), borderRadius: BorderRadius.circular(27),
), ),
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
S S.of(context).baocun,
.of(context)
.baocun,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 16.sp, fontSize: 16.sp,
@ -541,36 +578,36 @@ class _AddGoodsPage extends State<AddGoodsPage> {
), ),
Expanded( Expanded(
child: Container( child: Container(
padding: EdgeInsets.only(left: 8.w), padding: EdgeInsets.only(left: 8.w),
margin: EdgeInsets.only(left: 22.w, bottom: 16.h), margin: EdgeInsets.only(left: 22.w, bottom: 16.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFCFCFC), color: Color(0xFFFCFCFC),
border: Border.all( border: Border.all(
color: Color(0xFFEBEBEB), color: Color(0xFFEBEBEB),
width: 1, width: 1,
), ),
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
), ),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: TextField( child: TextField(
maxLines: 5, maxLines: 5,
controller: profileController, controller: profileController,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
// textLength = value.length; // textLength = value.length;
}); });
}, },
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
hintText: "请输入商品商品简介", hintText: "请输入商品商品简介",
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.bold, fontWeight: MyFontWeight.bold,
color: Color(0xFF7A797F), color: Color(0xFF7A797F),
),
),
), ),
)) ),
),
))
], ],
), ),
], ],
@ -588,7 +625,7 @@ class _AddGoodsPage extends State<AddGoodsPage> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child:Row( child: Row(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(right: 20.h), padding: EdgeInsets.only(right: 20.h),
@ -602,13 +639,15 @@ class _AddGoodsPage extends State<AddGoodsPage> {
)), )),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap:(){ onTap: () {
setState((){ setState(() {
isLogistics = !isLogistics; isLogistics = !isLogistics;
}); });
}, },
child: Image.asset( child: Image.asset(
isLogistics == true ? "assets/image/reservation_switch.webp":"assets/image/reservation_unswitch.webp", isLogistics == true
? "assets/image/reservation_switch.webp"
: "assets/image/reservation_unswitch.webp",
width: 44.w, width: 44.w,
height: 24.h, height: 24.h,
), ),
@ -617,7 +656,7 @@ class _AddGoodsPage extends State<AddGoodsPage> {
), ),
), ),
Expanded( Expanded(
child:Row( child: Row(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(right: 20.h), padding: EdgeInsets.only(right: 20.h),
@ -631,13 +670,15 @@ class _AddGoodsPage extends State<AddGoodsPage> {
)), )),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap:(){ onTap: () {
setState((){ setState(() {
isGround = !isGround; isGround = !isGround;
}); });
}, },
child: Image.asset( child: Image.asset(
isGround == true ? "assets/image/reservation_switch.webp":"assets/image/reservation_unswitch.webp", isGround == true
? "assets/image/reservation_switch.webp"
: "assets/image/reservation_unswitch.webp",
width: 44.w, width: 44.w,
height: 24.h, height: 24.h,
), ),
@ -656,7 +697,7 @@ class _AddGoodsPage extends State<AddGoodsPage> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child:Row( child: Row(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(right: 20.h), padding: EdgeInsets.only(right: 20.h),
@ -670,20 +711,23 @@ class _AddGoodsPage extends State<AddGoodsPage> {
)), )),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap:(){ onTap: () {
setState((){ setState(() {
isOversold = !isOversold; isOversold = !isOversold;
}); });
}, },
child: Image.asset( child: Image.asset(
isOversold == true ? "assets/image/reservation_switch.webp":"assets/image/reservation_unswitch.webp", isOversold == true
? "assets/image/reservation_switch.webp"
: "assets/image/reservation_unswitch.webp",
width: 44.w, width: 44.w,
height: 24.h, height: 24.h,
), ),
), ),
], ],
), ),
), Expanded( ),
Expanded(
child: Row( child: Row(
children: [ children: [
Padding( Padding(
@ -698,13 +742,15 @@ class _AddGoodsPage extends State<AddGoodsPage> {
)), )),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap:(){ onTap: () {
setState((){ setState(() {
isSetMeal = !isSetMeal; isSetMeal = !isSetMeal;
}); });
}, },
child: Image.asset( child: Image.asset(
isSetMeal == true ? "assets/image/reservation_switch.webp":"assets/image/reservation_unswitch.webp", isSetMeal == true
? "assets/image/reservation_switch.webp"
: "assets/image/reservation_unswitch.webp",
width: 44.w, width: 44.w,
height: 24.h, height: 24.h,
), ),
@ -725,7 +771,7 @@ class _AddGoodsPage extends State<AddGoodsPage> {
); );
} }
Widget textSelectItem(left,selectName) { Widget textSelectItem(left, selectName) {
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 16.w), padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column( child: Column(
@ -787,72 +833,72 @@ class _AddGoodsPage extends State<AddGoodsPage> {
Widget mustTextItem(left, rightController, right) { Widget mustTextItem(left, rightController, right) {
return Container( return Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Row( Expanded(
crossAxisAlignment: CrossAxisAlignment.center, child: Text.rich(
mainAxisAlignment: MainAxisAlignment.center, TextSpan(
children: [ children: [
Expanded(
child: Text.rich(
TextSpan( TextSpan(
children: [ text: "*",
TextSpan( style: TextStyle(
text: "*", color: Color(0xFFE02020),
style: TextStyle( fontSize: 14.sp,
color: Color(0xFFE02020), fontWeight: FontWeight.w500,
fontSize: 14.sp, ),
fontWeight: FontWeight.w500,
),
),
TextSpan(
text: left,
style: TextStyle(
color: Color(0xD9000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
),
],
), ),
), TextSpan(
), text: left,
Expanded( style: TextStyle(
child: TextField( color: Color(0xD9000000),
controller: rightController,
decoration: InputDecoration(
hintText: right ?? "",
hintTextDirection: TextDirection.rtl,
hintStyle: TextStyle(
color: Color(0xFF7A797F),
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.bold, fontWeight: MyFontWeight.bold,
), ),
border: InputBorder.none,
), ),
textAlign: TextAlign.right, ],
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold),
),
flex: 2,
), ),
], ),
), ),
Container( Expanded(
margin: EdgeInsets.only(bottom: 16.h), child: TextField(
color: Color(0x14000000), controller: rightController,
height: 1.h, decoration: InputDecoration(
width: double.infinity, hintText: right ?? "",
hintTextDirection: TextDirection.rtl,
hintStyle: TextStyle(
color: Color(0xFF7A797F),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
border: InputBorder.none,
),
textAlign: TextAlign.right,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold),
),
flex: 2,
), ),
], ],
)); ),
Container(
margin: EdgeInsets.only(bottom: 16.h),
color: Color(0x14000000),
height: 1.h,
width: double.infinity,
),
],
));
} }
Widget textItem(left, rightController, right) { Widget textItem(left, rightController, right) {
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 16.w), padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -909,9 +955,9 @@ class _AddGoodsPage extends State<AddGoodsPage> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return StatefulBuilder(builder: ( return StatefulBuilder(builder: (
context, context,
state, state,
) { ) {
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 365.h, height: 365.h,
@ -932,18 +978,18 @@ class _AddGoodsPage extends State<AddGoodsPage> {
children: [ children: [
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 12.h, bottom: 12.h, left: 41.w), top: 12.h, bottom: 12.h, left: 41.w),
child: Text( child: Text(
"选择官方分类", "选择官方分类",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.bold, fontWeight: MyFontWeight.bold,
fontSize: 16.sp, fontSize: 16.sp,
color: Color(0xFF1A1A1A), color: Color(0xFF1A1A1A),
), ),
), ),
)), )),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
state(() { state(() {
@ -961,9 +1007,10 @@ class _AddGoodsPage extends State<AddGoodsPage> {
), ),
], ],
), ),
Expanded(child:ListView.builder( Expanded(
child: ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: goodsCategoryList?.length ??0, itemCount: goodsCategoryList?.length ?? 0,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -974,21 +1021,24 @@ class _AddGoodsPage extends State<AddGoodsPage> {
categoryIndex = position; categoryIndex = position;
}); });
}, },
child: categoryItem(goodsCategoryList[position],position), child:
categoryItem(goodsCategoryList[position], position),
); );
}, },
)), )),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
categoryName = goodsCategoryList[categoryIndex].categoryName; categoryName =
goodsCategoryList[categoryIndex].categoryName;
Navigator.of(context).pop(); Navigator.of(context).pop();
}); });
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.symmetric(vertical:25.h,horizontal:16.w), margin: EdgeInsets.symmetric(
vertical: 25.h, horizontal: 16.w),
padding: EdgeInsets.symmetric(vertical: 16.h), padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(27), borderRadius: BorderRadius.circular(27),
@ -1010,10 +1060,10 @@ class _AddGoodsPage extends State<AddGoodsPage> {
}); });
} }
Widget categoryItem(GoodsCategoryList goodsCategoryList,index){ Widget categoryItem(GoodsCategoryList goodsCategoryList, index) {
return Container( return Container(
height: 52.h, height: 52.h,
margin: EdgeInsets.only(bottom: 12,left:16.w,right: 16.w), margin: EdgeInsets.only(bottom: 12, left: 16.w, right: 16.w),
child: Stack( child: Stack(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
children: [ children: [
@ -1026,17 +1076,13 @@ class _AddGoodsPage extends State<AddGoodsPage> {
: Color(0xFFF7F7F7), : Color(0xFFF7F7F7),
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
border: Border.all( border: Border.all(
color: categoryIndex == index color:
? Color(0xFF30415B) categoryIndex == index ? Color(0xFF30415B) : Colors.white,
: Colors.white,
width: categoryIndex == index ? 1.w : 0, width: categoryIndex == index ? 1.w : 0,
), ),
), ),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 16.h, top: 16.h, bottom: 16.h, left: 16.w, right: 17.w),
bottom: 16.h,
left: 16.w,
right: 17.w),
child: Text( child: Text(
goodsCategoryList?.categoryName ?? "", goodsCategoryList?.categoryName ?? "",
style: TextStyle( style: TextStyle(
@ -1066,9 +1112,9 @@ class _AddGoodsPage extends State<AddGoodsPage> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return StatefulBuilder(builder: ( return StatefulBuilder(builder: (
context, context,
state, state,
) { ) {
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 365.h, height: 365.h,
@ -1089,18 +1135,18 @@ class _AddGoodsPage extends State<AddGoodsPage> {
children: [ children: [
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 12.h, bottom: 12.h, left: 41.w), top: 12.h, bottom: 12.h, left: 41.w),
child: Text( child: Text(
"选择官方分类", "选择官方分类",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.bold, fontWeight: MyFontWeight.bold,
fontSize: 16.sp, fontSize: 16.sp,
color: Color(0xFF1A1A1A), color: Color(0xFF1A1A1A),
), ),
), ),
)), )),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
state(() { state(() {
@ -1118,7 +1164,8 @@ class _AddGoodsPage extends State<AddGoodsPage> {
), ),
], ],
), ),
Expanded(child:ListView.builder( Expanded(
child: ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: productGroupList?.records?.length ?? 0, itemCount: productGroupList?.records?.length ?? 0,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
@ -1131,21 +1178,25 @@ class _AddGoodsPage extends State<AddGoodsPage> {
groupIndex = position; groupIndex = position;
}); });
}, },
child: groupItem(productGroupList.records[position],position), child: groupItem(
productGroupList.records[position], position),
); );
}, },
)), )),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
groupName = productGroupList?.records[groupIndex]?.groupName ?? ""; groupName =
productGroupList?.records[groupIndex]?.groupName ??
"";
Navigator.of(context).pop(); Navigator.of(context).pop();
}); });
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.symmetric(vertical:25.h,horizontal:16.w), margin: EdgeInsets.symmetric(
vertical: 25.h, horizontal: 16.w),
padding: EdgeInsets.symmetric(vertical: 16.h), padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(27), borderRadius: BorderRadius.circular(27),
@ -1167,10 +1218,10 @@ class _AddGoodsPage extends State<AddGoodsPage> {
}); });
} }
Widget groupItem(Records records,index){ Widget groupItem(Records records, index) {
return Container( return Container(
height: 52.h, height: 52.h,
margin: EdgeInsets.only(bottom: 12,left:16.w,right: 16.w), margin: EdgeInsets.only(bottom: 12, left: 16.w, right: 16.w),
child: Stack( child: Stack(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
children: [ children: [
@ -1178,24 +1229,18 @@ class _AddGoodsPage extends State<AddGoodsPage> {
height: 52.h, height: 52.h,
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: groupIndex == index color:
? Color(0xFFEFF5FF) groupIndex == index ? Color(0xFFEFF5FF) : Color(0xFFF7F7F7),
: Color(0xFFF7F7F7),
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
border: Border.all( border: Border.all(
color: groupIndex == index color: groupIndex == index ? Color(0xFF30415B) : Colors.white,
? Color(0xFF30415B)
: Colors.white,
width: groupIndex == index ? 1.w : 0, width: groupIndex == index ? 1.w : 0,
), ),
), ),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 16.h, top: 16.h, bottom: 16.h, left: 16.w, right: 17.w),
bottom: 16.h,
left: 16.w,
right: 17.w),
child: Text( child: Text(
records?.groupName ?? "", records?.groupName ?? "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,

8
lib/business_system/goods/add_goods/edit_specs_detail.dart

@ -125,10 +125,10 @@ class _EditSpecsDetail extends State<EditSpecsDetail> {
specsDetail.add({ specsDetail.add({
"skuName": element.specsDetailName, "skuName": element.specsDetailName,
"goodPrice": element.goodPriceController.text, "goodPrice": element.goodPriceController.text,
"originalPrice": element.originalPriceController.text, "originalPrice": element.originalPriceController.text == "" ? "0" :element.originalPriceController.text,
"packagingFee": element.packagingFeeController.text, "packagingFee": element.packagingFeeController.text == "" ? "0" :element.packagingFeeController.text,
"specsWeight": element.specsWeightController.text, "specsWeight": element.specsWeightController.text == "" ? "0" :element.specsWeightController.text,
"skuStock": element.skuStockController.text "skuStock": element.skuStockController.text == "" ? "0" :element.skuStockController.text
}); });
}); });
if (flag) { if (flag) {

22
lib/business_system/goods/add_goods/set_goods_specs.dart

@ -3,7 +3,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../retrofit/business_api.dart'; import '../../../retrofit/business_api.dart';
import '../../../retrofit/data/edit_specs_detail_list.dart';
import '../../../retrofit/data/set_specs_list.dart'; import '../../../retrofit/data/set_specs_list.dart';
import '../../../utils/font_weight.dart'; import '../../../utils/font_weight.dart';
import '../../../view_widget/settlement_tips_dialog.dart'; import '../../../view_widget/settlement_tips_dialog.dart';
@ -43,6 +42,14 @@ class _SetGoodsSpecs extends State<SetGoodsSpecs> {
} }
}); });
}); });
List<dynamic> goodsSpecsDetails = widget?.arguments["goodsSpecsDetails"] ??[];
goodsSpecsDetails.forEach((element) {
var tempValue = SetSpecsList();
tempValue.specsNameController.text = element["specsName"];
tempValue.specsValues = element["specsValue"];
specsDetails.addAll(element["valueDetail"]);
specs.add(tempValue);
});
} }
/// ///
@ -257,6 +264,7 @@ class _SetGoodsSpecs extends State<SetGoodsSpecs> {
onTap: () { onTap: () {
bool flag = false; bool flag = false;
String tipText = ""; String tipText = "";
List<dynamic> goodsSpecsDetail = [];
specs.forEach((element) { specs.forEach((element) {
if (element.specsNameController.text if (element.specsNameController.text
.trim() == .trim() ==
@ -270,7 +278,16 @@ class _SetGoodsSpecs extends State<SetGoodsSpecs> {
flag = true; flag = true;
tipText = "未添加规格值,请先添加规格值"; tipText = "未添加规格值,请先添加规格值";
return; return;
}else if(specsDetails.length == 0){
flag = true;
tipText = "请设置规格明细";
return;
} }
goodsSpecsDetail.add({
"specsName": element.specsNameController.text,
"specsValue":element.specsValues,
"valueDetail":specsDetails
});
}); });
if (flag) { if (flag) {
SmartDialog.show( SmartDialog.show(
@ -281,7 +298,8 @@ class _SetGoodsSpecs extends State<SetGoodsSpecs> {
color: Color(0xFF30415B), color: Color(0xFF30415B),
)); ));
} else { } else {
// Navigator.of(context).pop(); print(goodsSpecsDetail);
Navigator.of(context).pop(goodsSpecsDetail);
} }
}, },
child: Container( child: Container(

512
lib/business_system/goods/on_sale/batch_shelf.dart

@ -27,6 +27,7 @@ class BatchShelf extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
BatchShelf({this.arguments}); BatchShelf({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _BatchShelf(); return _BatchShelf();
@ -66,13 +67,17 @@ class _BatchShelf extends State<BatchShelf> {
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
businessService = BusinessApiService(Dio(), businessService = BusinessApiService(
Dio(),
context: context, context: context,
token: BusinessInstance.instance.businessToken, token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant, tenant: BusinessInstance.instance.businessTenant,
storeId: widget.arguments["storeId"],); storeId: widget.arguments["storeId"],
);
queryProductGroupList(); queryProductGroupList();
queryGoodsList(groupIndex != -1 ? productGroupList.records[groupIndex].id : "", isSing: false); queryGoodsList(
groupIndex != -1 ? productGroupList.records[groupIndex].id : "",
isSing: false);
}); });
} }
@ -97,8 +102,7 @@ class _BatchShelf extends State<BatchShelf> {
"order": "ascending", "order": "ascending",
"size": 100, "size": 100,
"sort": "sort" "sort": "sort"
}).catchError((error) { }).catchError((error) {});
});
if (!mounted) return; if (!mounted) return;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
productGroupList = baseData.data; productGroupList = baseData.data;
@ -114,7 +118,7 @@ class _BatchShelf extends State<BatchShelf> {
queryGoodsList(groupId, {isSing = true}) async { queryGoodsList(groupId, {isSing = true}) async {
try { try {
BaseData<BusinessGoods> baseData = BaseData<BusinessGoods> baseData =
await businessService.findAdminProductLis({ await businessService.findAdminProductLis({
"groupId": groupId, "groupId": groupId,
"hasStock": "", "hasStock": "",
"keyword": "", "keyword": "",
@ -150,7 +154,7 @@ class _BatchShelf extends State<BatchShelf> {
} }
queryGoodsUpdate() async { queryGoodsUpdate() async {
try{ try {
EasyLoading.show( EasyLoading.show(
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black);
@ -169,16 +173,17 @@ class _BatchShelf extends State<BatchShelf> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
_pageIndex = 1; _pageIndex = 1;
adminProductVoList.clear(); adminProductVoList.clear();
await queryGoodsList(groupIndex == -1 await queryGoodsList(
? "" groupIndex == -1
: productGroupList?.records[groupIndex]?.id ?? "", isSing: false); ? ""
: productGroupList?.records[groupIndex]?.id ?? "",
isSing: false);
setState(() {}); setState(() {});
SmartDialog.showToast("商品下架成功", alignment: Alignment.center); SmartDialog.showToast("商品下架成功", alignment: Alignment.center);
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
} } finally {
finally{
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
} }
@ -195,24 +200,21 @@ class _BatchShelf extends State<BatchShelf> {
brightness: Brightness.dark, brightness: Brightness.dark,
action: GestureDetector( action: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: (){ onTap: () {
List<Map<String, String>> goodsMeal = []; List<Map<String, String>> goodsMeal = [];
if(titleName == "批量下架"){ if (titleName == "批量下架") {
if (productIds.length != 0) if (productIds.length != 0) productIds.clear();
productIds.clear();
adminProductVoList.forEach((element) { adminProductVoList.forEach((element) {
if (element.isSelect) productIds.add(element.id); if (element.isSelect) productIds.add(element.id);
}); });
if (productIds.length == 0) { if (productIds.length == 0) {
SmartDialog.showToast("请选择要下架的商品", SmartDialog.showToast("请选择要下架的商品", alignment: Alignment.center);
alignment: Alignment.center);
return; return;
} else { } else {
showGoodsStateDialog(); showGoodsStateDialog();
} }
}else{ } else {
if(goodsMeal.length != 0) if (goodsMeal.length != 0) goodsMeal.clear();
goodsMeal.clear();
adminProductVoList.forEach((element) { adminProductVoList.forEach((element) {
if (element.isSelect) if (element.isSelect)
goodsMeal.add({ goodsMeal.add({
@ -222,8 +224,7 @@ class _BatchShelf extends State<BatchShelf> {
}); });
Navigator.of(context).pop(goodsMeal); Navigator.of(context).pop(goodsMeal);
if (goodsMeal.length == 0) { if (goodsMeal.length == 0) {
SmartDialog.showToast("请选择要增加的商品", SmartDialog.showToast("请选择要增加的商品", alignment: Alignment.center);
alignment: Alignment.center);
return; return;
} }
} }
@ -241,105 +242,108 @@ class _BatchShelf extends State<BatchShelf> {
), ),
), ),
), ),
body: networkStatus == -1 ? noNetwork() : Row( body: networkStatus == -1
mainAxisAlignment: MainAxisAlignment.start, ? noNetwork()
crossAxisAlignment: CrossAxisAlignment.start, : Row(
children: [ mainAxisAlignment: MainAxisAlignment.start,
Container( crossAxisAlignment: CrossAxisAlignment.start,
width: 100.w, children: [
height: double.infinity, Container(
padding: EdgeInsets.only(bottom: 70.h), width: 100.w,
color: Color(0xFFFAFAFA), height: double.infinity,
child:networkStatus == 0 padding: EdgeInsets.only(bottom: 70.h),
? ListView.builder( color: Color(0xFFFAFAFA),
itemCount: 10, child: networkStatus == 0
physics: BouncingScrollPhysics(), ? ListView.builder(
shrinkWrap: true, itemCount: 10,
itemBuilder: (context, position) { physics: BouncingScrollPhysics(),
return shelfLeftItemSm(); shrinkWrap: true,
}, itemBuilder: (context, position) {
) return shelfLeftItemSm();
: ListView.builder( },
itemCount: productGroupList?.records?.length ?? 0, )
physics: BouncingScrollPhysics(), : ListView.builder(
shrinkWrap: true, itemCount: productGroupList?.records?.length ?? 0,
itemBuilder: (context, position) { physics: BouncingScrollPhysics(),
return GestureDetector( shrinkWrap: true,
behavior: HitTestBehavior.opaque, itemBuilder: (context, position) {
onTap: () { return GestureDetector(
groupIndex = position; behavior: HitTestBehavior.opaque,
_pageIndex = 1; onTap: () {
adminProductVoList.clear(); groupIndex = position;
queryGoodsList(productGroupList?.records[position].id,); _pageIndex = 1;
}, adminProductVoList.clear();
child: shelfLeftItem( queryGoodsList(
productGroupList.records[position], productGroupList?.records[position].id,
position), );
); },
}, child: shelfLeftItem(
), 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,
header: MyHeader(
color: Color(0xFF30415B),
),
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
), ),
onLoading: () { Container(
_pageIndex++; width: MediaQuery.of(context).size.width - 100.w,
queryGoodsList(groupIndex == -1 child: SmartRefresher(
? "" controller: _refreshController,
: productGroupList?.records[groupIndex].id); enablePullDown: true,
}, enablePullUp:
onRefresh: () { adminProductVoList.length != 0 ? true : false,
_pageIndex = 1; header: MyHeader(
adminProductVoList.clear(); color: Color(0xFF30415B),
_onRefresh(isShowLoad: false); ),
},
child: Container(
color: Colors.white,
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, footer: CustomFooter(
itemBuilder: (context, position) { builder: (context, mode) {
return shelfGoodsItemSm(); return MyFooter(mode);
},
),
onLoading: () {
_pageIndex++;
queryGoodsList(groupIndex == -1
? ""
: productGroupList?.records[groupIndex].id);
}, },
) onRefresh: () {
: ((adminProductVoList == null || _pageIndex = 1;
adminProductVoList.length == 0) adminProductVoList.clear();
? NoDataView( _onRefresh(isShowLoad: false);
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 shelfGoodsItem(adminProductVoList[position]);
}, },
)))), child: Container(
), color: Colors.white,
], child: networkStatus == 0
), ? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return shelfGoodsItemSm();
},
)
: ((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 shelfGoodsItem(
adminProductVoList[position]);
},
)))),
),
],
),
); );
} }
@ -419,7 +423,7 @@ class _BatchShelf extends State<BatchShelf> {
} }
///list ///list
Widget shelfLeftItem(Records records, index){ Widget shelfLeftItem(Records records, index) {
return Container( return Container(
color: groupIndex == index ? Colors.white : Color(0xFFFAFAFA), color: groupIndex == index ? Colors.white : Color(0xFFFAFAFA),
alignment: Alignment.center, alignment: Alignment.center,
@ -430,25 +434,25 @@ class _BatchShelf extends State<BatchShelf> {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
records?.groupName ?? "", records?.groupName ?? "",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: color:
groupIndex == index ? Color(0xFF30415B) : Color(0xFF626264), groupIndex == index ? Color(0xFF30415B) : Color(0xFF626264),
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: groupIndex == index fontWeight: groupIndex == index
? MyFontWeight.semi_bold ? MyFontWeight.semi_bold
: MyFontWeight.regular, : MyFontWeight.regular,
), ),
)), )),
], ],
), ),
); );
} }
Widget shelfGoodsItem(AdminProductVoList adminProductVoList){ Widget shelfGoodsItem(AdminProductVoList adminProductVoList) {
return Container( return Container(
margin: EdgeInsets.only(bottom: 21.h,left: 16.w), margin: EdgeInsets.only(bottom: 21.h, left: 16.w),
child: Row( child: Row(
children: [ children: [
MImage( MImage(
@ -458,21 +462,25 @@ class _BatchShelf extends State<BatchShelf> {
fit: BoxFit.cover, fit: BoxFit.cover,
radius: BorderRadius.circular(4), radius: BorderRadius.circular(4),
), ),
SizedBox(width:12.w,), SizedBox(
Expanded(child:Column( width: 12.w,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding(padding:EdgeInsets.only(top: 2.h), Padding(
child:Text( padding: EdgeInsets.only(top: 2.h),
adminProductVoList?.productName ?? "", child: Text(
maxLines:1, adminProductVoList?.productName ?? "",
overflow: TextOverflow.ellipsis, maxLines: 1,
style: TextStyle( overflow: TextOverflow.ellipsis,
fontSize: 14.sp, style: TextStyle(
fontWeight: MyFontWeight.medium, fontSize: 14.sp,
color: Color(0xFF000000), fontWeight: MyFontWeight.medium,
), color: Color(0xFF000000),
)), ),
)),
Row( Row(
children: [ children: [
Text( Text(
@ -483,8 +491,11 @@ class _BatchShelf extends State<BatchShelf> {
color: Color(0xFFA29E9E), color: Color(0xFFA29E9E),
), ),
), ),
SizedBox(width: 8.w,), SizedBox(
Expanded(child: Text( width: 8.w,
),
Expanded(
child: Text(
"销量${adminProductVoList?.sellCount ?? 0}", "销量${adminProductVoList?.sellCount ?? 0}",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
@ -496,7 +507,8 @@ class _BatchShelf extends State<BatchShelf> {
value: adminProductVoList.isSelect, value: adminProductVoList.isSelect,
onChanged: (a) { onChanged: (a) {
setState(() { setState(() {
adminProductVoList.isSelect = !adminProductVoList.isSelect; adminProductVoList.isSelect =
!adminProductVoList.isSelect;
}); });
}, },
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -507,10 +519,13 @@ class _BatchShelf extends State<BatchShelf> {
), ),
], ],
), ),
SizedBox(height:7.h,), SizedBox(
height: 7.h,
),
Row( Row(
children: [ children: [
Expanded(child:Text.rich( Expanded(
child: Text.rich(
TextSpan( TextSpan(
children: [ children: [
TextSpan( TextSpan(
@ -532,48 +547,49 @@ class _BatchShelf extends State<BatchShelf> {
], ],
), ),
)), )),
if(titleName == "选择商品") if (titleName == "选择商品")
GestureDetector( GestureDetector(
behavior:HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap:(){ onTap: () {
setState((){ setState(() {
if(adminProductVoList.goodsNumber <= 1) if (adminProductVoList.goodsNumber <= 1) return;
return; adminProductVoList?.goodsNumber =
adminProductVoList?.goodsNumber = adminProductVoList.goodsNumber - 1; adminProductVoList.goodsNumber - 1;
});
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: Icon(
Icons.remove_circle_outline,
color: Color(0xFF30415B),
size: 24,
))),
if (titleName == "选择商品")
Text(
adminProductVoList?.goodsNumber?.toString() ?? "",
style: TextStyle(
color: Color(0xD9000000),
fontSize: 20.sp,
fontWeight: MyFontWeight.regular,
),
),
if (titleName == "选择商品")
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
adminProductVoList.goodsNumber =
adminProductVoList.goodsNumber + 1;
}); });
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal:10.w), padding: EdgeInsets.symmetric(horizontal: 10.w),
child: Icon( child: Icon(
Icons.remove_circle_outline, Icons.add_circle,
color: Color(0xFF30415B), color: Color(0xFF30415B),
size: 24, size: 24,
))), )),
if(titleName == "选择商品")
Text(
adminProductVoList?.goodsNumber?.toString() ?? "",
style: TextStyle(
color: Color(0xD9000000),
fontSize: 20.sp,
fontWeight: MyFontWeight.regular,
), ),
),
if(titleName == "选择商品")
GestureDetector(
behavior:HitTestBehavior.opaque,
onTap:(){
setState((){
adminProductVoList.goodsNumber = adminProductVoList.goodsNumber + 1;
});
},
child: Container(
padding: EdgeInsets.symmetric(horizontal:10.w),
child: Icon(
Icons.add_circle,
color: Color(0xFF30415B),
size: 24,
)),
),
], ],
), ),
], ],
@ -624,69 +640,39 @@ class _BatchShelf extends State<BatchShelf> {
), ),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(bottom: 11.h, top: 2.h), padding: EdgeInsets.only(bottom: 11.h, top: 2.h),
child: Shimmer.fromColors( child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8), baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8), highlightColor: Color(0XFFD8D8D8),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0XFFD8D8D8), color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
),
width: 124.w,
height: 20.h,
),
), ),
width: 124.w,
height: 20.h,
), ),
Row( ),
children: [ ),
Shimmer.fromColors( Row(
baseColor: Color(0XFFD8D8D8), children: [
highlightColor: Color(0XFFD8D8D8), Shimmer.fromColors(
child: Container( baseColor: Color(0XFFD8D8D8),
decoration: BoxDecoration( highlightColor: Color(0XFFD8D8D8),
color: Color(0XFFD8D8D8), child: Container(
borderRadius: BorderRadius.circular(2), decoration: BoxDecoration(
), color: Color(0XFFD8D8D8),
width: 43.w, borderRadius: BorderRadius.circular(2),
height: 18.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,
),
),
Spacer(),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 16.h,
height: 16.h,
),
), ),
], width: 43.w,
height: 18.h,
),
), ),
SizedBox( SizedBox(
height: 7.h, width: 8.w,
), ),
Shimmer.fromColors( Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8), baseColor: Color(0XFFD8D8D8),
@ -696,12 +682,42 @@ class _BatchShelf extends State<BatchShelf> {
color: Color(0XFFD8D8D8), color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
), ),
width: 28.w, width: 43.w,
height: 20.h, height: 18.h,
),
),
Spacer(),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 16.h,
height: 16.h,
), ),
), ),
], ],
)), ),
SizedBox(
height: 7.h,
),
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,
),
),
],
)),
], ],
), ),
); );

Loading…
Cancel
Save