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

7
lib/retrofit/data/miNiDetail.dart

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

23
lib/settlement/settlement.dart

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

3
lib/settlement/settlement_view/activity_coupon_remarks.dart

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

167
lib/store/store_view/product_meals_sku.dart

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

9
lib/store/store_view/shop_goods_car.dart

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

Loading…
Cancel
Save