Browse Source

Merge branch 'new_revision_app' into dev

new_revision_app
wurong 2 years ago
parent
commit
f5510c46d0
  1. 21
      lib/mine/mine_view/mine_item.dart
  2. 7
      lib/retrofit/data/miNiDetail.dart
  3. 23
      lib/settlement/settlement.dart
  4. 3
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  5. 167
      lib/store/store_view/product_meals_sku.dart
  6. 9
      lib/store/store_view/shop_goods_car.dart

21
lib/mine/mine_view/mine_item.dart

@ -252,16 +252,16 @@ class _MineItem extends State<MineItem> {
// ), // ),
// ),), // ),),
/// ///
Expanded(child: InkWell( // Expanded(child: InkWell(
onTap: () { // onTap: () {
SmartDialog.showToast("该功能暂未开放!", // SmartDialog.showToast("该功能暂未开放!",
alignment: Alignment.center); // alignment: Alignment.center);
}, // },
child: mineItem( // child: mineItem(
S.of(context).shanghuruzhu, // S.of(context).shanghuruzhu,
"assets/image/settled.webp", // "assets/image/settled.webp",
), // ),
),), // ),),
/// ///
Expanded(child: InkWell( Expanded(child: InkWell(
onTap: () { onTap: () {
@ -283,6 +283,7 @@ class _MineItem extends State<MineItem> {
), ),
),), ),),
Expanded(child:Container(),), Expanded(child:Container(),),
Expanded(child:Container(),),
// /// // ///
// Expanded(child: InkWell( // Expanded(child: InkWell(
// onTap: () { // onTap: () {

7
lib/retrofit/data/miNiDetail.dart

@ -649,6 +649,7 @@ class SkuInfoList {
} }
String _id; String _id;
String _skuName; String _skuName;
bool _isSelected = false;
List<ProductSkuAttrList> _productSkuAttrList; List<ProductSkuAttrList> _productSkuAttrList;
SkuInfoList copyWith({ String id, SkuInfoList copyWith({ String id,
String skuName, String skuName,
@ -661,6 +662,12 @@ class SkuInfoList {
String get skuName => _skuName; String get skuName => _skuName;
List<ProductSkuAttrList> get productSkuAttrList => _productSkuAttrList; List<ProductSkuAttrList> get productSkuAttrList => _productSkuAttrList;
bool get isSelected => _isSelected;
set isSelected(bool value) {
_isSelected = value;
}
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
map['id'] = _id; map['id'] = _id;

23
lib/settlement/settlement.dart

@ -535,7 +535,7 @@ class _Settlement extends State<Settlement> {
this.downOrder = DownOrder.fromJson(baseData.data); this.downOrder = DownOrder.fromJson(baseData.data);
querySettlement(); querySettlement();
} else { } else {
orderButton = false; // orderButton = false;
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
} }
} else { } else {
@ -562,7 +562,7 @@ class _Settlement extends State<Settlement> {
}); });
} }
} }
orderButton = false; // orderButton = false;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
placeOrder = true; placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data); this.downOrder = DownOrder.fromJson(baseData.data);
@ -570,7 +570,7 @@ class _Settlement extends State<Settlement> {
queryOrderDetails(parentId); queryOrderDetails(parentId);
setState(() {}); setState(() {});
} else { } else {
orderButton = false; // orderButton = false;
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
} }
} }
@ -597,7 +597,7 @@ class _Settlement extends State<Settlement> {
.catchError((error) { .catchError((error) {
print(error); print(error);
}); });
orderButton = false; // orderButton = false;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data; WxPay wxPay = baseData.data;
await registerWxApi( await registerWxApi(
@ -621,12 +621,13 @@ class _Settlement extends State<Settlement> {
.catchError((error) { .catchError((error) {
print(error); print(error);
}); });
orderButton = false; // orderButton = false;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast(baseData.data, alignment: Alignment.center); SmartDialog.showToast(baseData.data, alignment: Alignment.center);
toOrderDetails(placeOrderFirst.id); toOrderDetails(placeOrderFirst.id);
} else { } else {
SmartDialog.show( SmartDialog.show(
clickBgDismissTemp: false,
widget: SettlementTips( widget: SettlementTips(
() { () {
toOrderDetails(placeOrderFirst.id); toOrderDetails(placeOrderFirst.id);
@ -895,12 +896,12 @@ class _Settlement extends State<Settlement> {
vertical: 5.h, vertical: 5.h,
), ),
callback: () { callback: () {
if (orderButton) { // if (orderButton) {
SmartDialog.showToast("订单正在提交中...", // SmartDialog.showToast("订单正在提交中...",
alignment: Alignment.center); // alignment: Alignment.center);
return; // return;
} else // } else
orderButton = true; // orderButton = true;
pageType != null pageType != null
? bargainOrderId != null ? bargainOrderId != null
? activityPay() ? activityPay()

3
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -112,7 +112,6 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
// (widget.coupons != null && widget.coupons != ""||widget.promotions != null && widget.promotions != "") ? false:vipSelect,
if ((widget?.settleOrderInfo?.memberVO?.isVip ?? false)) { if ((widget?.settleOrderInfo?.memberVO?.isVip ?? false)) {
vipSelect = !vipSelect; vipSelect = !vipSelect;
widget.vipPriceSelect(vipSelect); widget.vipPriceSelect(vipSelect);
@ -126,7 +125,7 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
padding: EdgeInsets.only(bottom: 18.w), padding: EdgeInsets.only(bottom: 18.w),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
vipSelect ((widget.coupons != null && widget.coupons != ""||widget.promotions != null && widget.promotions != "") ? false:vipSelect)
? "assets/image/vip_price.webp" ? "assets/image/vip_price.webp"
: "assets/image/vip_unprice.webp", : "assets/image/vip_unprice.webp",
width: 38.w, width: 38.w,

167
lib/store/store_view/product_meals_sku.dart

@ -84,17 +84,18 @@ class _ProductMealsSku extends State<ProductMealsSku> {
/// ///
addShopCar() async { addShopCar() async {
List<dynamic> setMealDataList = []; List<dynamic> setMealDataList = [];
productSetMeals.forEach((element) { productSetMeals.forEach((element) {
List<dynamic> productInfoListBean = []; List<dynamic> productInfoListBean = [];
element.productInfoList.forEach((ele) { element.productInfoList.forEach((ele) {
if(ele.count > 0) if (ele.count > 0) {
productInfoListBean.add({ productInfoListBean.add({
"productId": ele.productId, "productId": ele.productId,
"skuId":(ele.productAttrInfoList[0].attrName == "") ? (ele.skuInfoList[0].productSkuAttrList[0].skuId): "skuId": ele.skuInfoList.length == 1
(ele.skuInfoList.firstWhere((e1) => e1.skuName == ele.productAttrInfoList[0].selectSku).id) ? ele.skuInfoList.first.id
: ele.skuInfoList.firstWhere((e2) => e2.isSelected).id
}); });
}
}); });
setMealDataList.add({ setMealDataList.add({
"groupName": element.groupName, "groupName": element.groupName,
@ -119,7 +120,8 @@ class _ProductMealsSku extends State<ProductMealsSku> {
], ],
}; };
BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart(requestData); BaseData<List<ShoppingCart>> baseDate =
await minService.addShoppingCart(requestData);
EasyLoading.dismiss(); EasyLoading.dismiss();
if (baseDate != null && baseDate.isSuccess) { if (baseDate != null && baseDate.isSuccess) {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -210,8 +212,7 @@ class _ProductMealsSku extends State<ProductMealsSku> {
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return productMealsList( return productMealsList(position);
position);
}, },
), ),
], ],
@ -335,7 +336,10 @@ class _ProductMealsSku extends State<ProductMealsSku> {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
productSetMeals[position].productInfoList[index].productName ?? "", productSetMeals[position]
.productInfoList[index]
.productName ??
"",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
@ -345,7 +349,11 @@ class _ProductMealsSku extends State<ProductMealsSku> {
), ),
), ),
), ),
if (productSetMeals[position].productInfoList[index].productAttrInfoList[0].attrName != "") if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName !=
"")
GestureDetector( GestureDetector(
child: Text( child: Text(
"选规格", "选规格",
@ -359,7 +367,11 @@ class _ProductMealsSku extends State<ProductMealsSku> {
showSkuDialog(position, index); showSkuDialog(position, index);
}, },
), ),
if (productSetMeals[position].productInfoList[index].productAttrInfoList[0].attrName != "") if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName !=
"")
GestureDetector( GestureDetector(
onTap: () { onTap: () {
showSkuDialog(position, index); showSkuDialog(position, index);
@ -375,10 +387,20 @@ class _ProductMealsSku extends State<ProductMealsSku> {
SizedBox(height: 8.h), SizedBox(height: 8.h),
Row( Row(
children: [ children: [
if (productSetMeals[position].productInfoList[index].productAttrInfoList[0].attrName != "" if (productSetMeals[position]
&& productSetMeals[position].productInfoList[index].count > 0) .productInfoList[index]
.skuInfoList
.where((element) => element.isSelected)
.isNotEmpty &&
productSetMeals[position].productInfoList[index].count >
0)
Text( Text(
productSetMeals[position].productInfoList[index].productAttrInfoList[0].selectSku ?? "", productSetMeals[position]
.productInfoList[index]
.skuInfoList
.firstWhere((element) => element.isSelected)
.skuName ??
"",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
@ -391,8 +413,13 @@ class _ProductMealsSku extends State<ProductMealsSku> {
InkWell( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
if (productSetMeals[position].productInfoList[index].count >= 1) if (productSetMeals[position]
productSetMeals[position].productInfoList[index].count -= 1; .productInfoList[index]
.count >=
1)
productSetMeals[position]
.productInfoList[index]
.count -= 1;
}); });
}, },
child: Image.asset( child: Image.asset(
@ -405,7 +432,10 @@ class _ProductMealsSku extends State<ProductMealsSku> {
width: 30, width: 30,
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
productSetMeals[position].productInfoList[index].count.toString(), productSetMeals[position]
.productInfoList[index]
.count
.toString(),
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 14.sp, fontSize: 14.sp,
@ -416,21 +446,33 @@ class _ProductMealsSku extends State<ProductMealsSku> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
if(productSetMeals[position].productInfoList[index].productAttrInfoList[0].attrName != ""){ if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[0]
.attrName !=
"") {
showSkuDialog(position, index); showSkuDialog(position, index);
return; return;
} }
int total = 0; int total = 0;
productSetMeals[position].productInfoList.forEach((element) { productSetMeals[position]
.productInfoList
.forEach((element) {
total += element.count; total += element.count;
}); });
if (total >= productSetMeals[position].optionalNumber) { if (total >=
productSetMeals[position].optionalNumber) {
SmartDialog.showToast("抱歉,无法加购更多", SmartDialog.showToast("抱歉,无法加购更多",
alignment: Alignment.center); alignment: Alignment.center);
return; return;
} }
if (productSetMeals[position].productInfoList[index].count == 0) if (productSetMeals[position]
productSetMeals[position].productInfoList[index].count += 1; .productInfoList[index]
.count ==
0)
productSetMeals[position]
.productInfoList[index]
.count += 1;
}); });
}, },
child: Image.asset( child: Image.asset(
@ -453,15 +495,27 @@ class _ProductMealsSku extends State<ProductMealsSku> {
} }
Widget porAttrItem(int position, int index, int pos, state) { Widget porAttrItem(int position, int index, int pos, state) {
if (productSetMeals[position].productInfoList[index].productAttrInfoList[pos].attrValueList != null && if (productSetMeals[position]
productSetMeals[position].productInfoList[index].productAttrInfoList[pos].attrValueList.length > 0) .productInfoList[index]
.productAttrInfoList[pos]
.attrValueList !=
null &&
productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[pos]
.attrValueList
.length >
0)
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(top: 16, bottom: 16), padding: EdgeInsets.only(top: 16, bottom: 16),
child: Text( child: Text(
productSetMeals[position].productInfoList[index].productAttrInfoList[pos].attrName, productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[pos]
.attrName,
style: TextStyle( style: TextStyle(
color: Color(0xFFB3B3B3), color: Color(0xFFB3B3B3),
fontSize: 14.sp, fontSize: 14.sp,
@ -481,19 +535,32 @@ class _ProductMealsSku extends State<ProductMealsSku> {
return Wrap( return Wrap(
runSpacing: 10.0, runSpacing: 10.0,
spacing: 10.0, spacing: 10.0,
children: productSetMeals[position].productInfoList[index].productAttrInfoList[pos].attrValueList children: productSetMeals[position]
.take(productSetMeals[position].productInfoList[index].productAttrInfoList[pos].attrValueList.length) .productInfoList[index]
.productAttrInfoList[pos]
.attrValueList
.take(productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[pos]
.attrValueList
.length)
.map<Widget>((AttrValueList tag) { .map<Widget>((AttrValueList tag) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
state(() { state(() {
productSetMeals[position].productInfoList[index].productAttrInfoList[pos].selectSku = productSetMeals[position]
tag.attrName; .productInfoList[index]
.productAttrInfoList[pos]
.selectSku = tag.attrName;
}); });
}, },
child: sweetnessItem( child: sweetnessItem(
tag.attrName, tag.attrName,
(productSetMeals[position].productInfoList[index].productAttrInfoList[pos].selectSku == tag.attrName), (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList[pos]
.selectSku ==
tag.attrName),
)); ));
}).toList()); }).toList());
} }
@ -542,18 +609,15 @@ class _ProductMealsSku extends State<ProductMealsSku> {
children: [ children: [
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: productSetMeals[position].productInfoList[index] itemCount: productSetMeals[position]
.productInfoList[index]
.productAttrInfoList .productAttrInfoList
.length, .length,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, pos) { itemBuilder: (context, pos) {
return porAttrItem( return porAttrItem(position, index, pos, state);
position,index,
pos,
state
);
}, },
), ),
), ),
@ -564,20 +628,45 @@ class _ProductMealsSku extends State<ProductMealsSku> {
onTap: () { onTap: () {
setState(() { setState(() {
int total = 0; int total = 0;
productSetMeals[position].productInfoList.forEach((element) { productSetMeals[position]
.productInfoList
.forEach((element) {
total += element.count; total += element.count;
}); });
if(productSetMeals[position].productInfoList[index].productAttrInfoList[0].selectSku == null){ if (productSetMeals[position]
.productInfoList[index]
.productAttrInfoList
.where((element) => element.selectSku == null)
.isNotEmpty) {
SmartDialog.showToast("请先选择规格", SmartDialog.showToast("请先选择规格",
alignment: Alignment.center); alignment: Alignment.center);
return; return;
} }
if (total >= productSetMeals[position].optionalNumber && productSetMeals[position].productInfoList[index].count != 1) { if (total >= productSetMeals[position].optionalNumber &&
productSetMeals[position]
.productInfoList[index]
.count !=
1) {
SmartDialog.showToast("抱歉,无法加购更多", SmartDialog.showToast("抱歉,无法加购更多",
alignment: Alignment.center); alignment: Alignment.center);
return; return;
} }
productSetMeals[position].productInfoList[index].count = 1; productSetMeals[position].productInfoList[index].count =
1;
productSetMeals[position]
.productInfoList[index]
.skuInfoList
.forEach((element) {
bool flag = true;
productSetMeals[position]
.productInfoList[index]
.productAttrInfoList
.forEach((e1) {
if (!element.skuName.contains(e1.selectSku))
flag = false;
});
element.isSelected = flag;
});
Navigator.of(context).pop(); Navigator.of(context).pop();
}); });
}, },

9
lib/store/store_view/shop_goods_car.dart

@ -291,7 +291,7 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
flex: 3, flex:2,
child: Text( child: Text(
setMealDataList.productInfoList[0].productName, setMealDataList.productInfoList[0].productName,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -303,7 +303,7 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
), ),
), ),
), ),
Expanded(flex: 2, Expanded(flex:3,
child: Text( child: Text(
"${(setMealDataList.productInfoList[0].skuName == "") ? "默认": setMealDataList.productInfoList[0].skuName}", "${(setMealDataList.productInfoList[0].skuName == "") ? "默认": setMealDataList.productInfoList[0].skuName}",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -315,9 +315,7 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
), ),
), ),
), ),
Expanded( Text(
flex: 1,
child: Text(
setMealDataList.productInfoList[0].buyNumber.toString(), setMealDataList.productInfoList[0].buyNumber.toString(),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
@ -327,7 +325,6 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
), ),
), ),
),
], ],
), ),
); );

Loading…
Cancel
Save