Browse Source

首页数据显示完成;

搜索页面完成;专区活动完成;
详情页未完成;购物车未完成;
zyh
w-R 3 years ago
parent
commit
ed942f9b72
  1. 2
      lib/community/community_details.dart
  2. 4
      lib/main.dart
  3. 1
      lib/mine/mine_wallet_page.dart
  4. 416
      lib/retrofit/data/home_recommend_list.dart
  5. 6
      lib/retrofit/data/miNiDetail.dart
  6. 1
      lib/retrofit/data/shoppingCart.dart
  7. 740
      lib/retrofit/data/shopping_home_config.dart
  8. 26
      lib/retrofit/min_api.dart
  9. 69
      lib/retrofit/min_api.g.dart
  10. 12
      lib/retrofit/retrofit_api.dart
  11. 25
      lib/retrofit/retrofit_api.g.dart
  12. 521
      lib/store/shopping/activity_prefecture_details.dart
  13. 203
      lib/store/shopping/shopping_cart/shopping_cart_page.dart
  14. 781
      lib/store/shopping/shopping_goods_details.dart
  15. 135
      lib/store/shopping/shopping_home/activity_banner.dart
  16. 45
      lib/store/shopping/shopping_home/classify_list.dart
  17. 57
      lib/store/shopping/shopping_home/recommend_goods_list_view.dart
  18. 640
      lib/store/shopping/shopping_home/search_page.dart
  19. 495
      lib/store/shopping/shopping_home/shopping_acticvity.dart
  20. 217
      lib/store/shopping/shopping_home/shopping_home_page.dart
  21. 17
      lib/store/shopping/shopping_home/shopping_title_tab.dart
  22. 243
      lib/store/shopping/shopping_mall_home.dart
  23. 7
      lib/store/store_order.dart
  24. 400
      lib/store/store_view/product_sku.dart
  25. 2
      pubspec.lock

2
lib/community/community_details.dart

@ -211,7 +211,7 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
"content": content, "content": content,
"parentId": parenId, "parentId": parenId,
"relationalId": comunity.id, "relationalId": comunity.id,
"relationalType":4 "relationalType":1
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
CommentListState state = commentKey.currentState; CommentListState state = commentKey.currentState;

4
lib/main.dart

@ -283,9 +283,9 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/activity_prefecture_details': (context, {arguments}) => '/router/activity_prefecture_details': (context, {arguments}) =>
ActivityPrefectureDetails(arguments: arguments), ActivityPrefectureDetails(arguments: arguments),
'/router/shopping_goods_details': (context, {arguments}) => '/router/shopping_goods_details': (context, {arguments}) =>
ShoppingGoodsDetails(), ShoppingGoodsDetails(arguments: arguments),
'/router/search_page': (context, {arguments}) => '/router/search_page': (context, {arguments}) =>
SearchPage(), SearchPage(arguments:arguments),
'/router/vip_balance': (context, {arguments}) => '/router/vip_balance': (context, {arguments}) =>
VipBalancePage(arguments: arguments), VipBalancePage(arguments: arguments),
'/router/exchange_order_details': (context, {arguments}) => '/router/exchange_order_details': (context, {arguments}) =>

1
lib/mine/mine_wallet_page.dart

@ -200,7 +200,6 @@ class _MineWalletPage extends State<MineWalletPage> {
Expanded( Expanded(
flex: 1, flex: 1,
child: Container( child: Container(
height: 34.h,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

416
lib/retrofit/data/home_recommend_list.dart

@ -0,0 +1,416 @@
/// id : "1473532263365869568"
/// createTime : "2021-12-22 13:54:03"
/// createUser : "1364043181062094848"
/// updateTime : "2021-12-22 13:54:03"
/// updateUser : "1364043181062094848"
/// supplierName : "测试"
/// storeId : "1364043181120815104"
/// categoryId : "1343391656220557312"
/// groupId : "1473531667711787008"
/// shortName : "可爱"
/// productName : "回乡牛公仔"
/// sellDesc : ""
/// productCode : "PRO202112221354030000000000004"
/// weight : "0"
/// applyPrice : "0.00"
/// price : "49.00"
/// stock : 0
/// sellCount : 0
/// needLogistics : 1
/// oversold : 1
/// organic : 0
/// status : 1
/// posShow : true
/// productType : 0
/// productNumber : 1
/// setMeal : 1
/// attrStyle : 0
/// detail : ""
/// isDelete : 0
/// printerFlag : "DEFAULT"
/// materialId : null
/// imgs : ["https://pos.upload.gznl.top/1179/2021/12/1bff0936-f2a2-401e-befd-e00b416763ad.png"]
/// productSkuList : [{"id":"1473532264519303168","createTime":"2021-12-22 13:54:03","createUser":"1364043181062094848","updateTime":"2021-12-22 13:54:03","updateUser":"1364043181062094848","storeId":"1364043181120815104","skuCode":"P202112221354035","skuNameStr":"","productId":"1473532263365869568","skuPrice":"49.00","applyPrice":"0.00","vipPrice":null,"skuImg":null,"skuStock":0,"sort":50,"setMeal":"","weight":0.0,"volume":0.0,"isDelete":0,"material":null,"version":0}]
class HomeRecommendList {
HomeRecommendList({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String supplierName,
String storeId,
String categoryId,
String groupId,
String shortName,
String productName,
String sellDesc,
String productCode,
String weight,
String applyPrice,
String price,
int stock,
int sellCount,
int needLogistics,
int oversold,
int organic,
int status,
bool posShow,
int productType,
int productNumber,
int setMeal,
int attrStyle,
String detail,
int isDelete,
String printerFlag,
dynamic materialId,
List<String> imgs,
List<ProductSkuList> productSkuList,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_supplierName = supplierName;
_storeId = storeId;
_categoryId = categoryId;
_groupId = groupId;
_shortName = shortName;
_productName = productName;
_sellDesc = sellDesc;
_productCode = productCode;
_weight = weight;
_applyPrice = applyPrice;
_price = price;
_stock = stock;
_sellCount = sellCount;
_needLogistics = needLogistics;
_oversold = oversold;
_organic = organic;
_status = status;
_posShow = posShow;
_productType = productType;
_productNumber = productNumber;
_setMeal = setMeal;
_attrStyle = attrStyle;
_detail = detail;
_isDelete = isDelete;
_printerFlag = printerFlag;
_materialId = materialId;
_imgs = imgs;
_productSkuList = productSkuList;
}
HomeRecommendList.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_supplierName = json['supplierName'];
_storeId = json['storeId'];
_categoryId = json['categoryId'];
_groupId = json['groupId'];
_shortName = json['shortName'];
_productName = json['productName'];
_sellDesc = json['sellDesc'];
_productCode = json['productCode'];
_weight = json['weight'];
_applyPrice = json['applyPrice'];
_price = json['price'];
_stock = json['stock'];
_sellCount = json['sellCount'];
_needLogistics = json['needLogistics'];
_oversold = json['oversold'];
_organic = json['organic'];
_status = json['status'];
_posShow = json['posShow'];
_productType = json['productType'];
_productNumber = json['productNumber'];
_setMeal = json['setMeal'];
_attrStyle = json['attrStyle'];
_detail = json['detail'];
_isDelete = json['isDelete'];
_printerFlag = json['printerFlag'];
_materialId = json['materialId'];
_imgs = json['imgs'] != null ? json['imgs'].cast<String>() : [];
if (json['productSkuList'] != null) {
_productSkuList = [];
json['productSkuList'].forEach((v) {
_productSkuList.add(ProductSkuList.fromJson(v));
});
}
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _supplierName;
String _storeId;
String _categoryId;
String _groupId;
String _shortName;
String _productName;
String _sellDesc;
String _productCode;
String _weight;
String _applyPrice;
String _price;
int _stock;
int _sellCount;
int _needLogistics;
int _oversold;
int _organic;
int _status;
bool _posShow;
int _productType;
int _productNumber;
int _setMeal;
int _attrStyle;
String _detail;
int _isDelete;
String _printerFlag;
dynamic _materialId;
List<String> _imgs;
List<ProductSkuList> _productSkuList;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get supplierName => _supplierName;
String get storeId => _storeId;
String get categoryId => _categoryId;
String get groupId => _groupId;
String get shortName => _shortName;
String get productName => _productName;
String get sellDesc => _sellDesc;
String get productCode => _productCode;
String get weight => _weight;
String get applyPrice => _applyPrice;
String get price => _price;
int get stock => _stock;
int get sellCount => _sellCount;
int get needLogistics => _needLogistics;
int get oversold => _oversold;
int get organic => _organic;
int get status => _status;
bool get posShow => _posShow;
int get productType => _productType;
int get productNumber => _productNumber;
int get setMeal => _setMeal;
int get attrStyle => _attrStyle;
String get detail => _detail;
int get isDelete => _isDelete;
String get printerFlag => _printerFlag;
dynamic get materialId => _materialId;
List<String> get imgs => _imgs;
List<ProductSkuList> get productSkuList => _productSkuList;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['supplierName'] = _supplierName;
map['storeId'] = _storeId;
map['categoryId'] = _categoryId;
map['groupId'] = _groupId;
map['shortName'] = _shortName;
map['productName'] = _productName;
map['sellDesc'] = _sellDesc;
map['productCode'] = _productCode;
map['weight'] = _weight;
map['applyPrice'] = _applyPrice;
map['price'] = _price;
map['stock'] = _stock;
map['sellCount'] = _sellCount;
map['needLogistics'] = _needLogistics;
map['oversold'] = _oversold;
map['organic'] = _organic;
map['status'] = _status;
map['posShow'] = _posShow;
map['productType'] = _productType;
map['productNumber'] = _productNumber;
map['setMeal'] = _setMeal;
map['attrStyle'] = _attrStyle;
map['detail'] = _detail;
map['isDelete'] = _isDelete;
map['printerFlag'] = _printerFlag;
map['materialId'] = _materialId;
map['imgs'] = _imgs;
if (_productSkuList != null) {
map['productSkuList'] = _productSkuList.map((v) => v.toJson()).toList();
}
return map;
}
}
/// id : "1473532264519303168"
/// createTime : "2021-12-22 13:54:03"
/// createUser : "1364043181062094848"
/// updateTime : "2021-12-22 13:54:03"
/// updateUser : "1364043181062094848"
/// storeId : "1364043181120815104"
/// skuCode : "P202112221354035"
/// skuNameStr : ""
/// productId : "1473532263365869568"
/// skuPrice : "49.00"
/// applyPrice : "0.00"
/// vipPrice : null
/// skuImg : null
/// skuStock : 0
/// sort : 50
/// setMeal : ""
/// weight : 0.0
/// volume : 0.0
/// isDelete : 0
/// material : null
/// version : 0
class ProductSkuList {
ProductSkuList({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String storeId,
String skuCode,
String skuNameStr,
String productId,
String skuPrice,
String applyPrice,
dynamic vipPrice,
dynamic skuImg,
int skuStock,
int sort,
String setMeal,
double weight,
double volume,
int isDelete,
dynamic material,
int version,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_storeId = storeId;
_skuCode = skuCode;
_skuNameStr = skuNameStr;
_productId = productId;
_skuPrice = skuPrice;
_applyPrice = applyPrice;
_vipPrice = vipPrice;
_skuImg = skuImg;
_skuStock = skuStock;
_sort = sort;
_setMeal = setMeal;
_weight = weight;
_volume = volume;
_isDelete = isDelete;
_material = material;
_version = version;
}
ProductSkuList.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_storeId = json['storeId'];
_skuCode = json['skuCode'];
_skuNameStr = json['skuNameStr'];
_productId = json['productId'];
_skuPrice = json['skuPrice'];
_applyPrice = json['applyPrice'];
_vipPrice = json['vipPrice'];
_skuImg = json['skuImg'];
_skuStock = json['skuStock'];
_sort = json['sort'];
_setMeal = json['setMeal'];
_weight = json['weight'];
_volume = json['volume'];
_isDelete = json['isDelete'];
_material = json['material'];
_version = json['version'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _storeId;
String _skuCode;
String _skuNameStr;
String _productId;
String _skuPrice;
String _applyPrice;
dynamic _vipPrice;
dynamic _skuImg;
int _skuStock;
int _sort;
String _setMeal;
double _weight;
double _volume;
int _isDelete;
dynamic _material;
int _version;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get storeId => _storeId;
String get skuCode => _skuCode;
String get skuNameStr => _skuNameStr;
String get productId => _productId;
String get skuPrice => _skuPrice;
String get applyPrice => _applyPrice;
dynamic get vipPrice => _vipPrice;
dynamic get skuImg => _skuImg;
int get skuStock => _skuStock;
int get sort => _sort;
String get setMeal => _setMeal;
double get weight => _weight;
double get volume => _volume;
int get isDelete => _isDelete;
dynamic get material => _material;
int get version => _version;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['storeId'] = _storeId;
map['skuCode'] = _skuCode;
map['skuNameStr'] = _skuNameStr;
map['productId'] = _productId;
map['skuPrice'] = _skuPrice;
map['applyPrice'] = _applyPrice;
map['vipPrice'] = _vipPrice;
map['skuImg'] = _skuImg;
map['skuStock'] = _skuStock;
map['sort'] = _sort;
map['setMeal'] = _setMeal;
map['weight'] = _weight;
map['volume'] = _volume;
map['isDelete'] = _isDelete;
map['material'] = _material;
map['version'] = _version;
return map;
}
}

6
lib/retrofit/data/miNiDetail.dart

@ -61,12 +61,14 @@ class MiNiDetail {
int sellCount; int sellCount;
int needLogistics; int needLogistics;
int oversold; int oversold;
int organic;
int status; int status;
bool posShow; bool posShow;
int productType; int productType;
int productNumber; int productNumber;
int setMeal; int setMeal;
int attrStyle; int attrStyle;
String detail;
int isDelete; int isDelete;
String printerFlag; String printerFlag;
dynamic materialId; dynamic materialId;
@ -106,12 +108,14 @@ class MiNiDetail {
miNiDetailBean.sellCount = map['sellCount']; miNiDetailBean.sellCount = map['sellCount'];
miNiDetailBean.needLogistics = map['needLogistics']; miNiDetailBean.needLogistics = map['needLogistics'];
miNiDetailBean.oversold = map['oversold']; miNiDetailBean.oversold = map['oversold'];
miNiDetailBean.organic = map['organic'];
miNiDetailBean.status = map['status']; miNiDetailBean.status = map['status'];
miNiDetailBean.posShow = map['posShow']; miNiDetailBean.posShow = map['posShow'];
miNiDetailBean.productType = map['productType']; miNiDetailBean.productType = map['productType'];
miNiDetailBean.productNumber = map['productNumber']; miNiDetailBean.productNumber = map['productNumber'];
miNiDetailBean.setMeal = map['setMeal']; miNiDetailBean.setMeal = map['setMeal'];
miNiDetailBean.attrStyle = map['attrStyle']; miNiDetailBean.attrStyle = map['attrStyle'];
miNiDetailBean.detail = map['detail'];
miNiDetailBean.isDelete = map['isDelete']; miNiDetailBean.isDelete = map['isDelete'];
miNiDetailBean.printerFlag = map['printerFlag']; miNiDetailBean.printerFlag = map['printerFlag'];
miNiDetailBean.materialId = map['materialId']; miNiDetailBean.materialId = map['materialId'];
@ -157,12 +161,14 @@ class MiNiDetail {
"sellCount": sellCount, "sellCount": sellCount,
"needLogistics": needLogistics, "needLogistics": needLogistics,
"oversold": oversold, "oversold": oversold,
"organic" : organic,
"status": status, "status": status,
"posShow": posShow, "posShow": posShow,
"productType": productType, "productType": productType,
"productNumber": productNumber, "productNumber": productNumber,
"setMeal": setMeal, "setMeal": setMeal,
"attrStyle": attrStyle, "attrStyle": attrStyle,
"detail" :detail,
"isDelete": isDelete, "isDelete": isDelete,
"printerFlag": printerFlag, "printerFlag": printerFlag,
"materialId": materialId, "materialId": materialId,

1
lib/retrofit/data/shoppingCart.dart

@ -18,6 +18,7 @@ class ShoppingCart {
int selectDiscount; int selectDiscount;
String storeName; String storeName;
String tableId; String tableId;
bool isSelect;
List<PromotionInfoListBean> promotionInfoList; List<PromotionInfoListBean> promotionInfoList;
List<CouponListBean> couponList; List<CouponListBean> couponList;

740
lib/retrofit/data/shopping_home_config.dart

File diff suppressed because one or more lines are too long

26
lib/retrofit/min_api.dart

@ -14,10 +14,13 @@ import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:retrofit/retrofit.dart'; import 'package:retrofit/retrofit.dart';
import 'data/activity_area_list.dart';
import 'data/findMiNiGroupList.dart'; import 'data/findMiNiGroupList.dart';
import 'data/home_recommend_list.dart';
import 'data/miNiDetail.dart'; import 'data/miNiDetail.dart';
import 'data/settleOrderInfo.dart'; import 'data/settleOrderInfo.dart';
import 'data/shoppingCart.dart'; import 'data/shoppingCart.dart';
import 'data/shopping_home_config.dart';
part 'min_api.g.dart'; part 'min_api.g.dart';
@ -28,14 +31,14 @@ part 'min_api.g.dart';
// const base_url = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 // const base_url = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222
// const baseUrl = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222
// const base_url = "http://192.168.10.236:8765/app/";/// const base_url = "http://192.168.10.236:8765/app/";///
// const baseUrl = "http://192.168.10.236:8765/app/";/// const baseUrl = "http://192.168.10.236:8765/app/";///
// const base_url = "http://192.168.10.37:8766/app/"; // const base_url = "http://192.168.10.37:8766/app/";
// const baseUrl = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/";
const base_url = "http://192.168.10.142:8765/app/";/// // const base_url = "http://192.168.10.142:8765/app/";///
const baseUrl = "http://192.168.10.142:8765/app/";/// // const baseUrl = "http://192.168.10.142:8765/app/";///
/// ///
@RestApi(baseUrl: baseUrl) @RestApi(baseUrl: baseUrl)
@ -199,8 +202,21 @@ abstract class MinApiService {
@POST("store/getStore") @POST("store/getStore")
Future<BaseData> queryStoreInfo1(@Body() Map<String, dynamic> param); Future<BaseData> queryStoreInfo1(@Body() Map<String, dynamic> param);
// ///
@GET("order/getParentInfo?tableId={tableId}") @GET("order/getParentInfo?tableId={tableId}")
Future<BaseData> getParentInfo(@Path("tableId") String tableId); Future<BaseData> getParentInfo(@Path("tableId") String tableId);
/// /
@GET("product/recommendList")
Future<BaseData<List<HomeRecommendList>>> recommendList();
///
@GET("store/homeConfig")
Future<BaseData<ShoppingHomeConfig>> homeConfig();
///,,,
@GET("/actTemplate/findActListByType?allDay={allDay}&type={type}")
Future<BaseData<ActivityAreaList>> findActListByType(@Path("allDay") bool allDay,
@Path("type") String type);
} }

69
lib/retrofit/min_api.g.dart

@ -9,7 +9,7 @@ part of 'min_api.dart';
class _MinApiService implements MinApiService { class _MinApiService implements MinApiService {
_MinApiService(this._dio, {this.baseUrl}) { _MinApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio'); ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://192.168.10.142:8765/app/'; baseUrl ??= 'http://192.168.10.236:8765/app/';
} }
final Dio _dio; final Dio _dio;
@ -400,4 +400,71 @@ class _MinApiService implements MinApiService {
); );
return value; return value;
} }
@override
Future<BaseData<List<HomeRecommendList>>> recommendList() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'product/recommendList',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<HomeRecommendList>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<HomeRecommendList>((i) => HomeRecommendList.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
@override
Future<BaseData<ShoppingHomeConfig>> homeConfig() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'store/homeConfig',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<ShoppingHomeConfig>.fromJson(
_result.data,
(json) => ShoppingHomeConfig.fromJson(json),
);
return value;
}
@override
Future<BaseData<ActivityAreaList>> findActListByType(allDay,type) async {
ArgumentError.checkNotNull(allDay, 'allDay');
ArgumentError.checkNotNull(type, 'type');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/actTemplate/findActListByType?allDay=$allDay&type=$type',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<ActivityAreaList>.fromJson(
_result.data,
(json) => ActivityAreaList.fromJson(json),
);
return value;
}
} }

12
lib/retrofit/retrofit_api.dart

@ -60,15 +60,15 @@ part 'retrofit_api.g.dart';
// const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222
// const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222
// const base_url = "http://192.168.10.236:8766/app/"; /// const base_url = "http://192.168.10.236:8766/app/"; ///
// const baseUrl = "http://192.168.10.236:8766/app/"; /// const baseUrl = "http://192.168.10.236:8766/app/"; ///
// const base_url = "http://192.168.10.37:8766/app/"; // const base_url = "http://192.168.10.37:8766/app/";
// const baseUrl = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/";
const base_url = "http://192.168.10.142:8766/app/";/// // const base_url = "http://192.168.10.142:8766/app/";///
const baseUrl = "http://192.168.10.142:8766/app/";/// // const baseUrl = "http://192.168.10.142:8766/app/";///
@RestApi(baseUrl: baseUrl) @RestApi(baseUrl: baseUrl)
abstract class ApiService { abstract class ApiService {
@ -482,9 +482,7 @@ abstract class ApiService {
@GET("/information/category/{id}") @GET("/information/category/{id}")
Future<BaseData<HeadlinesListDetails>> headlinesDetails(@Path("id") String id); Future<BaseData<HeadlinesListDetails>> headlinesDetails(@Path("id") String id);
///,,,
@GET("/actTemplate/findActListByType?allDay={allDay}&type={type}")
Future<BaseData<ActivityAreaList>> findActListByType(@Path("allDay") bool allDay, @Path("type") int type);
} }

25
lib/retrofit/retrofit_api.g.dart

@ -9,7 +9,7 @@ part of 'retrofit_api.dart';
class _ApiService implements ApiService { class _ApiService implements ApiService {
_ApiService(this._dio, {this.baseUrl}) { _ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio'); ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://192.168.10.142:8766/app/'; baseUrl ??= 'http://192.168.10.236:8766/app/';
} }
final Dio _dio; final Dio _dio;
@ -1773,27 +1773,4 @@ class _ApiService implements ApiService {
return value; return value;
} }
@override
Future<BaseData<ActivityAreaList>> findActListByType(allDay,type) async {
ArgumentError.checkNotNull(allDay, 'allDay');
ArgumentError.checkNotNull(type, 'type');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/actTemplate/findActListByType?allDay=$allDay&type=$type',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<ActivityAreaList>.fromJson(
_result.data,
(json) => ActivityAreaList.fromJson(json),
);
return value;
}
} }

521
lib/store/shopping/activity_prefecture_details.dart

@ -1,9 +1,15 @@
import 'dart:async';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/activity_area_list.dart'; import 'package:huixiang/retrofit/data/activity_area_list.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/product.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
@ -23,6 +29,7 @@ class ActivityPrefectureDetails extends StatefulWidget {
class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> { class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
ApiService apiService; ApiService apiService;
MinApiService minService;
int seckillIndex = 0; int seckillIndex = 0;
RefreshController refreshController = RefreshController(); RefreshController refreshController = RefreshController();
ScrollController _scrollController; ScrollController _scrollController;
@ -30,9 +37,30 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
bool scrollFlag = false; bool scrollFlag = false;
List<TimeProductList> actTimeList = []; List<TimeProductList> actTimeList = [];
List<ProductList> productList = []; List<ProductList> productList = [];
List<Activity> activitys;
ActTemplate actTemplate; ActTemplate actTemplate;
int actTimeListIndex = 0; int actTimeListIndex = 0;
int pageType = 1; StoreInfo storeInfo;
String pageType = "1";
String storeId;
String tenant;
String minToken;
Timer _timer;
String testTime = "2021-12-30 10:00:00";
int tempDay = 0;
int tempHour = 0;
int tempM = 0;
int tempS = 0;
bool isDispose = false;
@override
void dispose() {
super.dispose();
isDispose = true;
if (_timer != null) {
_timer.cancel();
}
}
@override @override
void initState() { void initState() {
@ -48,28 +76,78 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
} }
}); });
}); });
pageType =widget.arguments["type"];
// testTime = "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} 08:00:20";
pageType = widget.arguments["type"];
storeId = widget.arguments["storeId"];
tenant = widget.arguments["tenant"];
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
apiService = minLogin(value);
ApiService(Dio(), context: context, token: value.getString("token")); queryStoreInfo();
});
}
///
minLogin(SharedPreferences shared) async {
EasyLoading.show(status: S.of(context).zhengzaijiazai);
apiService = ApiService(
Dio(),
context: context,
token: shared.getString('token'),
showLoading: false,
);
apiService.minLogin(storeId).catchError((onError) {
debugPrint(onError);
}).then((baseData) {
if (baseData != null && baseData.isSuccess) {
Map<String, dynamic> minStoreInfo = baseData.data;
minToken = minStoreInfo["token"];
queryStoreInfo();
SharedPreferences.getInstance().then(
(value) => {
value.setString('minToken', minToken),
value.setString('tenant', tenant),
value.setString('storeId', storeId),
},
);
minService = MinApiService(
Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
showLoading: false,
);
queryFindActListByType(pageType == "2" ?false:true);
EasyLoading.dismiss();
}
});
}
queryFindActListByType(pageType == 2 ?false:true); ///
queryStoreInfo() async {
BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) {
debugPrint(error);
}); });
if (baseData != null && baseData.isSuccess) {
storeInfo = StoreInfo.fromJson(baseData.data);
activitys = storeInfo.informationVOPageVO.list
.map((e) => Activity.fromJson(e))
.toList();
if (mounted) {
setState(() {});
}
}
EasyLoading.dismiss();
} }
///// /////
queryFindActListByType(allDay) async { queryFindActListByType(allDay) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<ActivityAreaList> baseData = BaseData<ActivityAreaList> baseData =
await apiService.findActListByType(allDay,pageType).catchError((error) { await minService.findActListByType(allDay,pageType).catchError((error) {
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
setState(() { setState(() {
@ -89,6 +167,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
} }
if (actTimeList.length > actTimeListIndex) if (actTimeList.length > actTimeListIndex)
productList.addAll(actTimeList[actTimeListIndex].productList); productList.addAll(actTimeList[actTimeListIndex].productList);
startCountdownTimer();
refreshController.refreshCompleted(); refreshController.refreshCompleted();
}); });
} else { } else {
@ -96,6 +175,32 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
} }
} }
///
startCountdownTimer() {
if(_timer != null)
return;
const oneSec = const Duration(seconds: 1);
var callback = ((timer){
if(isDispose)
return;
setState(() {
var tempDateTime = DateTime.parse(actTemplate.endTime).difference(DateTime.now());
if(tempDateTime.inSeconds <0){
tempDay = 0;
tempHour = 0;
tempM = 0;
tempS = 0;
return;
}
tempDay = tempDateTime.inDays;
tempHour = tempDateTime.inHours - (tempDateTime.inDays * 24);
tempM = tempDateTime.inMinutes - (tempDateTime.inHours *60);
tempS = tempDateTime.inSeconds - (tempDateTime.inMinutes*60);
});
});
_timer = Timer.periodic(oneSec, callback);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SingleChildScrollView( return SingleChildScrollView(
@ -130,7 +235,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
child: Column( child: Column(
children: [ children: [
swiper(), swiper(),
pageType == 2?(seckillIndex == 0 pageType == "2"?(seckillIndex == 0
? Container( ? Container(
width: double.infinity, width: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
@ -200,7 +305,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
), ),
), ),
TextSpan( TextSpan(
text: "0", text: tempDay.toString(),
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -235,7 +340,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
color: Color(0xFFFB312B), color: Color(0xFFFB312B),
borderRadius: BorderRadius.circular(1)), borderRadius: BorderRadius.circular(1)),
child: Text( child: Text(
"22", tempHour.toString(),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14.sp, fontSize: 14.sp,
@ -263,7 +368,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
color: Color(0xFFFB312B), color: Color(0xFFFB312B),
borderRadius: BorderRadius.circular(1)), borderRadius: BorderRadius.circular(1)),
child: Text( child: Text(
"22", tempM.toString(),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14.sp, fontSize: 14.sp,
@ -292,7 +397,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
color: Color(0xFFFB312B), color: Color(0xFFFB312B),
borderRadius: BorderRadius.circular(1)), borderRadius: BorderRadius.circular(1)),
child: Text( child: Text(
"22", tempS.toString(),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14.sp, fontSize: 14.sp,
@ -311,6 +416,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
); );
} }
///
Widget swiper() { Widget swiper() {
return Container( return Container(
child: AspectRatio( child: AspectRatio(
@ -341,7 +447,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
), ),
), ),
), ),
pageType == 2 ? pageType == "2" ?
Align( Align(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: Container( child: Container(
@ -351,7 +457,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
color: Color.fromRGBO(0, 0, 0, 69000000), color: Color.fromRGBO(0, 0, 0, 69000000),
), ),
width: 160.w, width: 160.w,
height: 30.h, height:35.h,
child: Row( child: Row(
children: [ children: [
GestureDetector( GestureDetector(
@ -364,7 +470,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
width: 72.w, width: 72.w,
height: 22.h, height: 25.h,
margin: EdgeInsets.only(left: 6.w), margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: new LinearGradient( gradient: new LinearGradient(
@ -409,7 +515,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
width: 72.w, width: 72.w,
height: 22.h, height: 25.h,
margin: EdgeInsets.only(left: 6.w), margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: new LinearGradient( gradient: new LinearGradient(
@ -456,13 +562,26 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
/// ///
Widget seckilList() { Widget seckilList() {
// var tStatus = timeFlag(actTimeList[actTimeListIndex].actTime.startHour);
return Container( return Container(
height: MediaQuery.of(context).size.height - height: MediaQuery.of(context).size.height -
62.h - 62.h -
MediaQuery.of(context).padding.top, MediaQuery.of(context).padding.top,
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
color: Colors.white, color: Colors.white,
child: ListView.builder( child: productList.length == 0 ?
Container(
width: double.infinity,
alignment: Alignment.topCenter,
child:Text(
"暂无商品参与活动",
style: TextStyle(
fontSize:18.sp,
fontWeight: MyFontWeight.medium,
color: Colors.black,
),
),
):ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: productList?.length ?? 0, itemCount: productList?.length ?? 0,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
@ -472,6 +591,14 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
Navigator.of(context).pushNamed(
'/router/shopping_goods_details',
arguments: {
"id":productList[position].id,
"storeId":storeId,
"tenant":tenant,
},
);
}); });
}, },
child: seckilItem(productList[position]), child: seckilItem(productList[position]),
@ -482,6 +609,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
} }
int timeFlag(String time) { int timeFlag(String time) {
if(time == null)
return 0;
var now = DateTime.now().hour; var now = DateTime.now().hour;
var tHour = int.tryParse(time.substring(0, 2)); var tHour = int.tryParse(time.substring(0, 2));
if (now < tHour) if (now < tHour)
@ -501,7 +630,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
actTimeList.actTime.startHour, actTimeList?.actTime?.startHour ?? "",
style: TextStyle( style: TextStyle(
fontSize: 17.sp, fontSize: 17.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -608,6 +737,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
Widget seckilItem(ProductList productList) { Widget seckilItem(ProductList productList) {
var tStatus = timeFlag(actTimeList[actTimeListIndex].actTime.startHour); var tStatus = timeFlag(actTimeList[actTimeListIndex].actTime.startHour);
return Container( return Container(
// height:94.h,
margin: EdgeInsets.only(right: 12.w, top: 12.h, bottom: 12.h), margin: EdgeInsets.only(right: 12.w, top: 12.h, bottom: 12.h),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -625,7 +755,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
width: 12.w, width: 12.w,
), ),
Expanded( Expanded(
child: Column( child:Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -647,43 +777,70 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
color: Color(0xFF4D4D4D), color: Color(0xFF4D4D4D),
), ),
), ),
Row( if(pageType == "2")
children: [ Row(
ClipRRect( children: [
borderRadius: BorderRadius.circular(6.5), ClipRRect(
child: Stack( borderRadius: BorderRadius.circular(6.5),
children: [ child: Stack(
Container( children: [
width: 180.w, Container(
height: 8.h, width: 180.w,
color: Color(0xFFF5F5F5), height: 8.h,
), color: Color(0xFFF5F5F5),
Container( ),
width: 100.w, Container(
height: 8.h, width: 100.w,
decoration: BoxDecoration( height: 8.h,
gradient: LinearGradient( decoration: BoxDecoration(
begin: Alignment.centerLeft, gradient: LinearGradient(
end: Alignment.centerRight, begin: Alignment.centerLeft,
colors: [ end: Alignment.centerRight,
Color(0xFFFDBA56), colors: [
Color(0xFFFB2B2B) Color(0xFFFDBA56),
])), Color(0xFFFB2B2B)
) ])),
], )
)), ],
SizedBox( )),
width: 5, SizedBox(
), width: 5,
Text(
"已售${productList.sellCount}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF353535),
), ),
), Text(
], "已售${productList.sellCount}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF353535),
),
),
],
),
if(pageType == "3")
Row(
children: [
Container(
padding: EdgeInsets.only(left: 2, right: 2),
height: 22.h,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFFFCD00),
),
child: Text(
"最高可砍50元",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
),
),
),
Spacer(),
],
),
if(pageType == "1")
Container(
height: 22.h,
), ),
Row( Row(
children: [ children: [
@ -695,7 +852,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFFB2E2C), color: pageType == "3" ?Color(0xFF9476F7) : Color(0xFFFB2E2C),
), ),
), ),
TextSpan( TextSpan(
@ -703,7 +860,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFFB2E2C), color:pageType == "3" ?Color(0xFF9476F7) : Color(0xFFFB2E2C),
), ),
), ),
], ],
@ -713,91 +870,169 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
child: Text( child: Text(
productList.productPrice, productList.productPrice,
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize:11.sp,
decoration: TextDecoration.lineThrough, decoration: TextDecoration.lineThrough,
decorationColor: Color(0xFF585858), decorationColor: Color(0xFF353535),
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
), ),
), ),
tStatus == 0 if(pageType == "2")
? Container( (seckillIndex == 0 ?
alignment: Alignment.center, (tStatus == 0
width: 60.w, ? Container(
height: 24.h, alignment: Alignment.center,
decoration: BoxDecoration( width: 60.w,
color: Color(0xFFE2F6EA), height: 24.h,
borderRadius: BorderRadius.circular(12), decoration: BoxDecoration(
boxShadow: [ color: Color(0xFFE2F6EA),
BoxShadow( borderRadius: BorderRadius.circular(12),
color: Colors.black.withAlpha(12), boxShadow: [
offset: Offset(0, 3), BoxShadow(
blurRadius: 14, color: Colors.black.withAlpha(12),
spreadRadius: 0, offset: Offset(0, 3),
), blurRadius: 14,
], spreadRadius: 0,
), ),
child: Text( ],
"即将开始", ),
style: TextStyle( child: Text(
fontSize: 12.sp, "即将开始",
fontWeight: MyFontWeight.medium, style: TextStyle(
color: Color(0xFF52AF79), fontSize: 12.sp,
), fontWeight: MyFontWeight.medium,
color: Color(0xFF52AF79),
),
),
)
: (tStatus == 1
? Container(
alignment: Alignment.center,
width: 60.w,
height: 24.h,
decoration: BoxDecoration(
color: Color(0xFFFB312B),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
), ),
) ],
: (tStatus == 1 ),
? Container( child: Text(
alignment: Alignment.center, "马上抢",
width: 60.w, style: TextStyle(
height: 24.h, fontSize: 12.sp,
decoration: BoxDecoration( fontWeight: MyFontWeight.medium,
color: Color(0xFFFB312B), color: Colors.white,
borderRadius: BorderRadius.circular(12), ),
boxShadow: [ ),
BoxShadow( )
color: Colors.black.withAlpha(12), : Container(
offset: Offset(0, 3), alignment: Alignment.center,
blurRadius: 14, width: 60.w,
spreadRadius: 0, height: 24.h,
), decoration: BoxDecoration(
], color: Colors.transparent,
), borderRadius: BorderRadius.circular(12),
child: Text( boxShadow: [
"马上抢", BoxShadow(
style: TextStyle( color: Colors.black.withAlpha(12),
fontSize: 12.sp, offset: Offset(0, 3),
fontWeight: MyFontWeight.medium, blurRadius: 14,
color: Colors.white, spreadRadius: 0,
), ),
), ],
) ),
: Container( child: Text(
alignment: Alignment.center, "已结束",
width: 60.w, style: TextStyle(
height: 24.h, fontSize: 12.sp,
decoration: BoxDecoration( fontWeight: MyFontWeight.medium,
color: Colors.transparent, color: Color(0xFFADADAD),
borderRadius: BorderRadius.circular(12), ),
boxShadow: [ ),
BoxShadow( ))) : Container(
color: Colors.black.withAlpha(12), alignment: Alignment.center,
offset: Offset(0, 3), width: 60.w,
blurRadius: 14, height: 24.h,
spreadRadius: 0, decoration: BoxDecoration(
), color: Color(0xFFFB312B),
], borderRadius: BorderRadius.circular(12),
), boxShadow: [
child: Text( BoxShadow(
"已结束", color: Colors.black.withAlpha(12),
style: TextStyle( offset: Offset(0, 3),
fontSize: 12.sp, blurRadius: 14,
fontWeight: MyFontWeight.medium, spreadRadius: 0,
color: Color(0xFFADADAD), ),
), ],
), ),
)), child: Text(
"马上抢",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
)),
if(pageType == "1")
Container(
alignment: Alignment.center,
width: 60.w,
height: 24.h,
decoration: BoxDecoration(
color: Color(0xFFFB2E2C),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Text(
"立即开团",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
if(pageType == "3")
Container(
alignment: Alignment.center,
width: 60.w,
height: 24.h,
decoration: BoxDecoration(
color: Color(0xFF9476F7),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Text(
"我要砍价",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
)
], ],
), ),
], ],

203
lib/store/shopping/shopping_cart/shopping_cart_page.dart

@ -1,9 +1,12 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart'; import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/shopping/shopping_home/recommend_goods_list_view.dart'; import 'package:huixiang/store/shopping/shopping_home/recommend_goods_list_view.dart';
@ -13,10 +16,16 @@ import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'cart_goods_list.dart'; import 'cart_goods_list.dart';
class ShoppingCartPage extends StatefulWidget { class ShoppingCartPage extends StatefulWidget {
final String minToken;
final String storeId;
final String tenant;
ShoppingCartPage(this.minToken,this.storeId, this.tenant);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _ShoppingCartPage(); return _ShoppingCartPage();
@ -27,17 +36,30 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
MinApiService minService; MinApiService minService;
ShoppingCart shopCarGoods; // ShoppingCart shopCarGoods;
List<ShoppingCart> shopCarGoods = [];
String pName; String pName;
String pid; String pid;
String cName; String cName;
String cid; String cid;
int tableId = 0; int tableId = 0;
bool topIndex = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
SharedPreferences.getInstance().then((value) {
minService = MinApiService(
Dio(),
context: context,
token: widget.minToken,
tenant: widget.tenant,
storeId: widget.storeId,
showLoading: false,
);
queryShopCar();
});
} }
/// ///
@ -49,77 +71,94 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
} }
} }
/// ///
Future<ShoppingCart> queryShopCar() async { queryShopCar() async {
pName="";// BaseData<List<ShoppingCart>> baseData =
pid="";// await minService.getShoppingCart(tableId).catchError((error) {
cName="";// refreshController.refreshFailed();
cid="";// });
BaseData<List<ShoppingCart>> baseDate = if (baseData != null && baseData.isSuccess) {
await minService.getShoppingCart(tableId); setState(() {
if (baseDate != null && shopCarGoods.clear();
baseDate.isSuccess && shopCarGoods.addAll(baseData.data);
baseDate.data != null && refreshController.refreshCompleted();
baseDate.data.length > 0) { });
if( baseDate.data[0].selectDiscount ==1){
baseDate.data[0].couponList.forEach((element) {
if(element.isMaxCoupon){
cName = element.promotionName;
cid = element.id;
}
});
}else if(baseDate.data[0].selectDiscount==2){
baseDate.data[0].promotionInfoList.forEach((element) {
if(element.isMaxPromotion){
pName=element.name;
pid=element.id;
}
});
}
return baseDate.data[0];
} else { } else {
return null; refreshController.refreshFailed();
} }
} }
///
// Future<ShoppingCart> queryShopCar() async {
// pName="";//
// pid="";//
// cName="";//
// cid="";//
// BaseData<List<ShoppingCart>> baseDate =
// await minService.getShoppingCart(tableId);
// if (baseDate != null &&
// baseDate.isSuccess &&
// baseDate.data != null &&
// baseDate.data.length > 0) {
// if( baseDate.data[0].selectDiscount ==1){
// baseDate.data[0].couponList.forEach((element) {
// if(element.isMaxCoupon){
// cName = element.promotionName;
// cid = element.id;
// }
// });
// }else if(baseDate.data[0].selectDiscount==2){
// baseDate.data[0].promotionInfoList.forEach((element) {
// if(element.isMaxPromotion){
// pName=element.name;
// pid=element.id;
// }
// });
// }
// return baseDate.data[0];
// } else {
// return null;
// }
// }
/// key,UI /// key,UI
GlobalKey shopCartKey = GlobalKey(); GlobalKey shopCartKey = GlobalKey();
///1 ///1
Future<ShoppingCart> shopCartAdd( // Future<ShoppingCart> shopCartAdd(
ShoppingCartSkuItemListBean cartSkuItem) async { // ShoppingCartSkuItemListBean cartSkuItem) async {
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); // Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
cartSkuItem.buyNum += 1; // cartSkuItem.buyNum += 1;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; // shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate = // BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp); // await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) { // if (baseDate.isSuccess) {
this.shopCarGoods = await queryShopCar(); // this.shopCarGoods = await queryShopCar();
if (shopCartKey != null) { // if (shopCartKey != null) {
shopCartKey.currentState.setState(() {}); // shopCartKey.currentState.setState(() {});
} // }
setState(() {}); // setState(() {});
} // }
return this.shopCarGoods; // return this.shopCarGoods;
} // }
//
///1 // ///1
Future<ShoppingCart> shopCartReduce( // Future<ShoppingCart> shopCartReduce(
ShoppingCartSkuItemListBean cartSkuItem) async { // ShoppingCartSkuItemListBean cartSkuItem) async {
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); // Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
cartSkuItem.buyNum -= 1; // cartSkuItem.buyNum -= 1;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; // shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate = // BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp); // await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) { // if (baseDate.isSuccess) {
this.shopCarGoods = await queryShopCar(); // this.shopCarGoods = await queryShopCar();
if (shopCartKey != null) { // if (shopCartKey != null) {
shopCartKey.currentState.setState(() {}); // shopCartKey.currentState.setState(() {});
} // }
setState(() {}); // setState(() {});
} // }
return this.shopCarGoods; // return this.shopCarGoods;
} // }
final SwiperController controller = SwiperController(); final SwiperController controller = SwiperController();
@ -144,14 +183,16 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
leadingColor: Colors.black, leadingColor: Colors.black,
background: Colors.transparent, background: Colors.transparent,
actions: [ actions: [
Container( GestureDetector(
alignment: Alignment.center, onTap: (){
margin: EdgeInsets.only(right: 12.w), setState(() {
child: GestureDetector( topIndex = !topIndex;
onTap: () { });
},
}, child: Container(
child: Text("管理", alignment: Alignment.center,
margin: EdgeInsets.only(right: 12.w),
child: Text(topIndex ? "管理" :S.of(context).quxiao,
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -159,23 +200,7 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
), ),
), ),
), ),
), )
// Container(
// alignment: Alignment.center,
// margin: EdgeInsets.only(right: 12.w),
// child: GestureDetector(
// onTap: () {
//
// },
// child: Text(S.of(context).quxiao,
// style: TextStyle(
// fontSize: 18.sp,
// fontWeight: MyFontWeight.semi_bold,
// color:Colors.black,
// ),
// ),
// ),
// ),
], ],
), ),
Expanded( Expanded(

781
lib/store/shopping/shopping_goods_details.dart

@ -3,21 +3,34 @@ import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_html/image_render.dart'; import 'package:flutter_html/image_render.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/goods.dart'; import 'package:huixiang/retrofit/data/goods.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/store_view/product_sku.dart';
import 'package:huixiang/store/store_view/store_order_list.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:url_launcher/url_launcher.dart';
class ShoppingGoodsDetails extends StatefulWidget { class ShoppingGoodsDetails extends StatefulWidget {
final Map<String, dynamic> arguments;
ShoppingGoodsDetails({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _ShoppingGoodsDetails(); return _ShoppingGoodsDetails();
@ -26,17 +39,205 @@ class ShoppingGoodsDetails extends StatefulWidget {
class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> { class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
ApiService apiService; ApiService apiService;
MinApiService minService;
String tenant;
String storeId;
String minToken;
String id;
StoreInfo storeInfo;
MiNiDetail miNiDetail;
bool dialogShowing = false;
String skuId1;
String skuValue1;
int count1 = 0;
int tableId = 0;
String parentId = "";
String parentCode = "";
int numberOfPeople = 0;
List<Activity> activitys;
ProductSkuVOListBean productSku;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
storeId = widget.arguments["storeId"];
tenant = widget.arguments["tenant"];
id = widget.arguments["id"];
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
apiService = minService = MinApiService(
ApiService(Dio(), context: context, token: value.getString("token")); Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
showLoading: false,
);
minLogin(value);
queryStoreInfo();
queryMiNiDetail(id);
});
}
///
minLogin(SharedPreferences shared) async {
EasyLoading.show(status: S.of(context).zhengzaijiazai);
apiService = ApiService(
Dio(),
context: context,
token: shared.getString('token'),
showLoading: false,
);
apiService.minLogin(storeId).catchError((onError) {
debugPrint(onError);
}).then((baseData) {
if (baseData != null && baseData.isSuccess) {
Map<String, dynamic> minStoreInfo = baseData.data;
minToken = minStoreInfo["token"];
queryStoreInfo();
SharedPreferences.getInstance().then(
(value) => {
value.setString('minToken', minToken),
value.setString('tenant', tenant),
value.setString('storeId', storeId),
},
);
minService = MinApiService(
Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
showLoading: false,
);
EasyLoading.dismiss();
}
});
}
///
queryStoreInfo() async {
BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) {
debugPrint(error);
}); });
if (baseData != null && baseData.isSuccess) {
storeInfo = StoreInfo.fromJson(baseData.data);
activitys = storeInfo.informationVOPageVO.list
.map((e) => Activity.fromJson(e))
.toList();
if (mounted) {
setState(() {});
}
}
EasyLoading.dismiss();
}
///
queryMiNiDetail(id) async {
EasyLoading.show(status: S.current.zhengzaijiazai);
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
if (baseData != null && baseData.isSuccess) {
miNiDetail = baseData.data;
}
EasyLoading.dismiss();
}
///
showStoreSelector(MiNiDetail miNiDetail, String id,int count) async {
if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1
&& miNiDetail.attrList[0].attrValueList.length == 1) {
_addShopCar(miNiDetail, [], count);
} else {
EasyLoading.dismiss();
dialogShowing = true;
SmartDialog.show(
widget: ProductSku(
miNiDetail,
null,
id,
_addShopCar,
add,
reduce,
buttonType: 1,
),
onDismiss: () {
dialogShowing = false;
},
alignmentTemp: Alignment.bottomCenter,
);
}
}
///
Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async {
if (selectSkus!= null && selectSkus.length == 0) {
productSku = miNiDetail.productSkuVOList.first;
} else {
productSku = miNiDetail.productSkuVOList.firstWhere((element) {
bool gg = true;
selectSkus.forEach((element1) {
if (element.skuNameStr.indexOf(element1) < 0) {
gg = false;
return gg;
}
});
return gg;
});
}
if (productSku == null) return;
String skuId = productSku.id;
String skuValue = selectSkus
.toString()
.replaceAll("[", "")
.replaceAll("]", "")
.replaceAll(",", "");
setState(() {
skuId1 = skuId;
skuValue1 = skuValue;
count1 = count;
});
}
///1
add(MiNiDetail miNiDetail, selectSkus) async {
}
///1
reduce(MiNiDetail miNiDetail, selectSkus) async {
}
///
addShoppingCar() async {
BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({
"storeId":storeId,
"storeName": storeInfo?.storeName ?? "",
"numberOfPeople": numberOfPeople,
"tableId": tableId,
"parentId": parentId,
"parentCode": parentCode,
"shoppingCartSkuItemList": [
{
"buyNum": count1,
"id":skuId1,
"productId": miNiDetail.id,
"productName": miNiDetail.productName,
"skuName": skuValue1,
"storeId":storeId,
"skuPrice": productSku.skuPrice,
"skuStock": productSku.skuStock,
"tableId": tableId,
},
],
});
EasyLoading.dismiss();
if (baseDate != null && baseDate.isSuccess) {
SmartDialog.showToast("添加购物车成功", alignment: Alignment.center);
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return Stack(
@ -89,8 +290,9 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
), ),
Container( Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(bottom:72.h),
child: Html( child: Html(
data: "", data:miNiDetail?.detail ?? "",
customImageRenders: { customImageRenders: {
networkSourceMatcher(): networkImageRender( networkSourceMatcher(): networkImageRender(
loadingWidget: () { loadingWidget: () {
@ -162,7 +364,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
// showCallMobile)(); showCallMobile();
}); });
}, },
child: Column( child: Column(
@ -199,12 +401,76 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
return Container( return Container(
child: Row( child: Row(
children: [ children: [
GestureDetector(
onTap: (){
setState(() {
addShoppingCar();
});
},
child:Container(
alignment: Alignment.center,
width: 120.w,
height:37.h,
margin: EdgeInsets.only(left:6.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
border: Border.all(
width: 1,
color: Color(0xFF32A060),
style: BorderStyle.solid,
),
),
child: Text(
"加入购物车",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF32A060),
),
),
),
),
GestureDetector(
onTap: (){
// toDownOrder();
},
child: Container(
alignment: Alignment.center,
width: 120.w,
height:37.h,
margin: EdgeInsets.only(left:6.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Text(
"立即购买",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),
)
),
///
// GestureDetector( // GestureDetector(
// child:Container( // onTap: (){
// Navigator.of(context).popAndPushNamed('/router/group_details');
// },
// child: Container(
// alignment: Alignment.center, // alignment: Alignment.center,
// width: 120.w, // width: 120.w,
// height:37.h, // height:40.h,
// margin: EdgeInsets.only(left:6.w), // margin: EdgeInsets.only(left: 6.w),
// decoration: BoxDecoration( // decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(16), // borderRadius: BorderRadius.circular(16),
// border: Border.all( // border: Border.all(
@ -213,161 +479,276 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
// style: BorderStyle.solid, // style: BorderStyle.solid,
// ), // ),
// ), // ),
// child: Text( // child: Column(
// "加入购物车", // children: [
// style: TextStyle( // Text.rich(
// fontSize: 16.sp, // TextSpan(
// fontWeight: MyFontWeight.regular, // children: [
// color: Color(0xFF32A060), // TextSpan(
// ), // text: "",
// style: TextStyle(
// fontSize: 7.sp,
// fontWeight: MyFontWeight.medium,
// color: Color(0xFF32A060),
// ),
// ),
// TextSpan(
// text: "284.00",
// style: TextStyle(
// fontSize: 10.sp,
// fontWeight: MyFontWeight.medium,
// color: Color(0xFF32A060),
// ),
// ),
// ],
// ),
// ),
// Expanded(child:
// Text(
// "原价购买",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Color(0xFF32A060),
// ),
// )),
// ],
// ), // ),
// ), // ),
// ), // ),
// GestureDetector( // GestureDetector(
// onTap: (){
// Navigator.of(context).popAndPushNamed('/router/bargain_details');
// },
// child: Container(
// alignment: Alignment.center,
// width: 120.w,
// height: 40.h,
// margin: EdgeInsets.only(left: 6.w),
// decoration: BoxDecoration(
// color: Color(0xFF32A060),
// borderRadius: BorderRadius.circular(16),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// ),
// ],
// ),
// child: Column(
// children: [
// Text.rich(
// TextSpan(
// children: [
// TextSpan(
// text: "",
// style: TextStyle(
// fontSize: 7.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// TextSpan(
// text: "284.00",
// style: TextStyle(
// fontSize: 10.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// ],
// ),
// ),
// Expanded(child:
// Text(
// "我要秒杀",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),),
// ],
// ),
// )),
///
// GestureDetector(
// onTap: (){
// Navigator.of(context).popAndPushNamed('/router/bargain_details');
// },
// child: Container(
// alignment: Alignment.center,
// width: 120.w,
// height: 40.h,
// margin: EdgeInsets.only(left: 6.w),
// decoration: BoxDecoration(
// color: Color(0xFF32A060),
// borderRadius: BorderRadius.circular(16),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// ),
// ],
// ),
// child: Column(
// children: [
// Text.rich(
// TextSpan(
// children: [
// TextSpan(
// text: "",
// style: TextStyle(
// fontSize: 7.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// TextSpan(
// text: "284.00",
// style: TextStyle(
// fontSize: 10.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// ],
// ),
// ),
// Expanded(child:
// Text(
// "我要砍价",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),),
// ],
// ),
// )),
///
// GestureDetector(
// onTap: (){
// Navigator.of(context).popAndPushNamed('/router/group_details');
// },
// child: Container( // child: Container(
// alignment: Alignment.center, // alignment: Alignment.center,
// width: 120.w, // width: 120.w,
// height:37.h, // height:40.h,
// margin: EdgeInsets.only(left:6.w), // margin: EdgeInsets.only(left: 6.w),
// decoration: BoxDecoration( // decoration: BoxDecoration(
// color: Color(0xFF32A060),
// borderRadius: BorderRadius.circular(16), // borderRadius: BorderRadius.circular(16),
// boxShadow: [ // border: Border.all(
// BoxShadow( // width: 1,
// color: Colors.black.withAlpha(12), // color: Color(0xFF32A060),
// offset: Offset(0, 3), // style: BorderStyle.solid,
// blurRadius: 14, // ),
// spreadRadius: 0, // ),
// child: Column(
// children: [
// Text.rich(
// TextSpan(
// children: [
// TextSpan(
// text: "",
// style: TextStyle(
// fontSize: 7.sp,
// fontWeight: MyFontWeight.medium,
// color: Color(0xFF32A060),
// ),
// ),
// TextSpan(
// text: "284.00",
// style: TextStyle(
// fontSize: 10.sp,
// fontWeight: MyFontWeight.medium,
// color: Color(0xFF32A060),
// ),
// ),
// ],
// ),
// ), // ),
// Expanded(child:
// Text(
// "单人购买",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Color(0xFF32A060),
// ),
// )),
// ], // ],
// ), // ),
// child: Text( // ),
// "立即购买",
// style: TextStyle(
// fontSize: 16.sp,
// fontWeight: MyFontWeight.regular,
// color: Colors.white,
// ),
// ),
// )
// ), // ),
/// // GestureDetector(
GestureDetector( // onTap: (){
onTap: (){ // Navigator.of(context).popAndPushNamed('/router/bargain_details');
Navigator.of(context).popAndPushNamed('/router/group_details'); // },
}, // child: Container(
child: Container( // alignment: Alignment.center,
alignment: Alignment.center, // width: 120.w,
width: 120.w, // height: 40.h,
height:40.h, // margin: EdgeInsets.only(left: 6.w),
margin: EdgeInsets.only(left: 6.w), // decoration: BoxDecoration(
decoration: BoxDecoration( // color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(16), // borderRadius: BorderRadius.circular(16),
border: Border.all( // boxShadow: [
width: 1, // BoxShadow(
color: Color(0xFF32A060), // color: Colors.black.withAlpha(12),
style: BorderStyle.solid, // offset: Offset(0, 3),
), // blurRadius: 14,
), // spreadRadius: 0,
child: Column( // ),
children: [ // ],
Text.rich( // ),
TextSpan( // child: Column(
children: [ // children: [
TextSpan( // Text.rich(
text: "", // TextSpan(
style: TextStyle( // children: [
fontSize: 7.sp, // TextSpan(
fontWeight: MyFontWeight.medium, // text: "",
color: Color(0xFF32A060), // style: TextStyle(
), // fontSize: 7.sp,
), // fontWeight: MyFontWeight.medium,
TextSpan( // color: Colors.white,
text: "284.00", // ),
style: TextStyle( // ),
fontSize: 10.sp, // TextSpan(
fontWeight: MyFontWeight.medium, // text: "284.00",
color: Color(0xFF32A060), // style: TextStyle(
), // fontSize: 10.sp,
), // fontWeight: MyFontWeight.medium,
], // color: Colors.white,
), // ),
), // ),
Expanded(child: // ],
Text( // ),
"原价购买", // ),
style: TextStyle( // Expanded(child:
fontSize: 12.sp, // Text(
fontWeight: MyFontWeight.medium, // "我要开团",
color: Color(0xFF32A060), // style: TextStyle(
), // fontSize: 12.sp,
)), // fontWeight: MyFontWeight.medium,
], // color: Colors.white,
), // ),
), // ),),
), // ],
GestureDetector( // ),
onTap: (){ // )),
Navigator.of(context).popAndPushNamed('/router/bargain_details');
},
child: Container(
alignment: Alignment.center,
width: 120.w,
height: 40.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontSize: 7.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
TextSpan(
text: "284.00",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
],
),
),
Expanded(child:
Text(
"我要秒杀",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),),
],
),
)),
], ],
), ),
); );
} }
///top
Widget buildColumn() { Widget buildColumn() {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -413,7 +794,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
), ),
), ),
TextSpan( TextSpan(
text: "282.00", text:miNiDetail?.price ?? "",
style: TextStyle( style: TextStyle(
fontSize: 28.sp, fontSize: 28.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -439,7 +820,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
), ),
), ),
Text( Text(
"已售12", "已售${miNiDetail?.sellCount ?? 0}",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
fontSize: 10.sp, fontSize: 10.sp,
@ -455,7 +836,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -463,7 +844,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"[前进麦味]全麦吐司250g", miNiDetail?.productName ?? "",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
fontSize: 15.sp, fontSize: 15.sp,
@ -481,7 +862,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
color: Color(0xFF5A5A5A), color: Color(0xFF5A5A5A),
), ),
child: Text( child: Text(
"中国大陆5仓", miNiDetail?.supplierName ?? "",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -495,7 +876,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
height: 8.h, height: 8.h,
), ),
Text( Text(
"人生没有标准答案,一切答案都在行动中,前进卖完也是一样,用真诚行动践行标准的定义", miNiDetail?.shortName ?? "",
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -531,16 +912,16 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
), ),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return return
// goods == null miNiDetail == null
// ? ?
Container() Container()
// : Image.network( : Image.network(
// goods.viceImgPaths.elementAt(position), miNiDetail.imgs.elementAt(position),
// fit: BoxFit.cover, fit: BoxFit.cover,
// ) )
; ;
}, },
itemCount: 3, itemCount:miNiDetail?.imgs?.length ?? 0,
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
@ -638,7 +1019,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
), ),
Expanded( Expanded(
child: Text( child: Text(
"250ml/瓶*2(礼盒装)", ( skuValue1 ?? "请选择規格") + (count1 > 0 ? "x${count1}" : ""),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 2, maxLines: 2,
style: TextStyle( style: TextStyle(
@ -649,7 +1030,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
), ),
), ),
GestureDetector( GestureDetector(
onTap: () {}, onTap: () {
setState(() {
showStoreSelector(miNiDetail, id,1);
});
},
child: Icon( child: Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
color: Colors.black, color: Colors.black,
@ -1192,44 +1577,44 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
} }
/// ///
// showCallMobile() { showCallMobile() {
// showCupertinoModalPopup( showCupertinoModalPopup(
// context: context, context: context,
// builder: (context) { builder: (context) {
// return CupertinoActionSheet( return CupertinoActionSheet(
// title: Text(S.of(context).bodadianhua), title: Text(S.of(context).bodadianhua),
// actions: [ actions: [
// if (widget.storeInfo != null && if (storeInfo != null &&
// widget.storeInfo.tel != null && storeInfo.tel != null &&
// widget.storeInfo.tel != "") storeInfo.tel != "")
// CupertinoActionSheetAction( CupertinoActionSheetAction(
// child: Text(widget.storeInfo.tel), child: Text(storeInfo.tel),
// onPressed: () { onPressed: () {
// callMobile(widget.storeInfo.tel); callMobile(storeInfo.tel);
// Navigator.of(context).pop(); Navigator.of(context).pop();
// }, },
// isDefaultAction: true, isDefaultAction: true,
// isDestructiveAction: false, isDestructiveAction: false,
// ), ),
// ], ],
// cancelButton: CupertinoActionSheetAction( cancelButton: CupertinoActionSheetAction(
// onPressed: () { onPressed: () {
// Navigator.of(context).pop(); Navigator.of(context).pop();
// }, },
// child: Text(S.of(context).quxiao), child: Text(S.of(context).quxiao),
// isDestructiveAction: true, isDestructiveAction: true,
// ), ),
// ); );
// }); });
// } }
//
// callMobile(mobile) async { callMobile(mobile) async {
// String url = "tel:$mobile"; String url = "tel:$mobile";
// if (await canLaunch(url)) { if (await canLaunch(url)) {
// await launch(url); await launch(url);
// } else { } else {
// throw 'Could not launch $url'; throw 'Could not launch $url';
// } }
// } }
} }

135
lib/store/shopping/shopping_home/activity_banner.dart

@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/retrofit/data/banner.dart'; import 'package:huixiang/retrofit/data/banner.dart';
import 'package:huixiang/retrofit/data/shopping_home_config.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -10,10 +11,12 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class ActivityBanner extends StatefulWidget { class ActivityBanner extends StatefulWidget {
final List<BannerData> bannerData; final List<SpecialArea> specialArea;
final SwiperController controller; final String minToken;
final String storeId;
final String tenant;
ActivityBanner(this.bannerData, this.controller); ActivityBanner(this.specialArea,this.minToken,this.storeId,this.tenant);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -24,17 +27,21 @@ class ActivityBanner extends StatefulWidget {
class _ActivityBanner extends State<ActivityBanner> { class _ActivityBanner extends State<ActivityBanner> {
ApiService apiService; ApiService apiService;
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
List<BannerData> bannerData = [];
@override
void initState() {
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: EdgeInsets.only(bottom:10), margin: EdgeInsets.only(bottom:10),
child: AspectRatio( child: AspectRatio(
aspectRatio: 1.23, aspectRatio: 1.32,
child: Swiper( child: Swiper(
viewportFraction: 0.9, viewportFraction: 0.9,
scale: 0.73, scale: 0.7,
pagination: SwiperPagination( pagination: SwiperPagination(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
builder: DotSwiperPaginationBuilder( builder: DotSwiperPaginationBuilder(
@ -51,29 +58,26 @@ class _ActivityBanner extends State<ActivityBanner> {
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
bannerClick(widget.bannerData[position]); setState(() {
});
}, },
child: child: ClipRRect(
// MImage( child:Image.network(
// (widget.bannerData != null && widget?.specialArea[position]?.img ?? "",
// position < widget.bannerData.length) width: double.infinity,
// ? widget.bannerData[position].imgUrl height: 165.h,
// : "",
// width:double.infinity,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_2_1.png",
// fadeSrc: "assets/image/default_2_1.png",
// ),
Image.asset(
"assets/image/icon_story_td.png",
height:185,
width:double.infinity,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0),
),
)
), ),
// Expanded(child: child)
Container( Container(
height: 138, height: 143,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.vertical(bottom: Radius.circular(8)), borderRadius: BorderRadius.vertical(bottom: Radius.circular(8)),
@ -82,16 +86,20 @@ class _ActivityBanner extends State<ActivityBanner> {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 12), padding: EdgeInsets.symmetric(horizontal: 12),
itemCount: 4, itemCount:widget?.specialArea[position]?.productList?.length ?? 0,
itemBuilder: (context, position) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/shopping_goods_details', '/router/shopping_goods_details',
arguments: {}, arguments: {
"id":widget.specialArea[position].productList[index].id,
"storeId":widget.storeId,
"tenant":widget.tenant,
},
); );
}, },
child: activityBannerItem(), child: activityBannerItem(widget.specialArea[position].productList[index]),
); );
}, },
), ),
@ -99,41 +107,38 @@ class _ActivityBanner extends State<ActivityBanner> {
], ],
); );
}, },
itemCount: itemCount:widget?.specialArea?.length ?? 0,
(widget.bannerData != null && widget.bannerData.length > 0) ),
? widget.bannerData.length
: 1),
), ),
); );
} }
Widget activityBannerItem() { Widget activityBannerItem(ProductList productList) {
return Container( return Container(
margin: EdgeInsets.only(right:7.w,left:7.w), margin: EdgeInsets.only(right:7.w,left:7.w),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
// MImage( Container(
// "assets/image/icon_story_td.png", decoration: BoxDecoration(
// isCircle: true, borderRadius: BorderRadius.vertical(top: Radius.circular(8)),
// width: 70.w, ),
// height: 70.h, child:
// fit: BoxFit.cover, MImage(
// errorSrc: "assets/image/default_1.png", productList?.productImg ?? "",
// fadeSrc: "assets/image/default_1.png", isCircle: true,
// ),
Image.asset(
"assets/image/icon_story_td.png",
width: 70, width: 70,
height: 70, height: 70,
fit: BoxFit.cover, fit: BoxFit.cover,
), errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
)),
SizedBox( SizedBox(
height: 4, height: 4,
), ),
Text( Text(
"[一心回乡]甄果", productList?.productName ?? "",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -152,7 +157,7 @@ class _ActivityBanner extends State<ActivityBanner> {
), ),
), ),
TextSpan( TextSpan(
text: "12.60", text:productList?.price ?? "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -166,40 +171,4 @@ class _ActivityBanner extends State<ActivityBanner> {
), ),
); );
} }
/// contentType 0123,4:,5:
bannerClick(BannerData bannerData) async {
switch (bannerData.contentType) {
case 1:
Navigator.of(context).pushNamed('/router/integral_store_page',
arguments: {"goodsId": bannerData.content});
break;
case 2:
Navigator.of(context).pushNamed('/router/web_page', arguments: {
"activityId": bannerData.content,
});
break;
case 3:
Navigator.of(context).pushNamed('/router/web_page', arguments: {
"articleId": bannerData.content,
});
break;
case 4:
String router = bannerData.content;
if (router.contains("?")) {
String params = router.substring(router.indexOf("?"));
params = params.replaceAll("?", "");
Map map = jsonDecode(params);
Navigator.of(context).pushNamed(router, arguments: map);
} else {
Navigator.of(context).pushNamed(router);
}
break;
case 5:
Navigator.of(context).pushNamed('/router/class_details', arguments: {
"id": bannerData.content,
});
break;
}
}
} }

45
lib/store/shopping/shopping_home/classify_list.dart

@ -1,11 +1,19 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:huixiang/retrofit/data/shopping_home_config.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/custom_image.dart';
class ClassifyList extends StatefulWidget { class ClassifyList extends StatefulWidget {
final List<GroupList> groupList;
final String minToken;
final String storeId;
final String tenant;
ClassifyList(this.groupList,this.minToken,this.storeId,this.tenant);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -15,9 +23,6 @@ class ClassifyList extends StatefulWidget {
class _ClassifyList extends State<ClassifyList> { class _ClassifyList extends State<ClassifyList> {
ApiService apiService; ApiService apiService;
BMFCoordinate latLng;
final TextEditingController editingController = TextEditingController();
@override @override
void initState() { void initState() {
@ -46,44 +51,44 @@ class _ClassifyList extends State<ClassifyList> {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 14), padding: EdgeInsets.symmetric(horizontal: 14),
itemCount:15, itemCount:widget?.groupList?.length ?? 0,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/search_page'); .pushNamed('/router/search_page',
arguments: {
"minToken": widget.minToken,
"tenant": widget.tenant,
"storeId": widget.storeId,
"searchKey":widget.groupList[position].groupName,
});
}, },
child: classifyItem(), child: classifyItem(widget.groupList[position]),
); );
}, },
), ),
); );
} }
Widget classifyItem() { Widget classifyItem(GroupList groupList) {
return Container( return Container(
// height:94.h, height:94.h,
margin: EdgeInsets.only(right: 19.w), margin: EdgeInsets.only(right: 19.w),
child: Column( child: Column(
children: [ children: [
// MImage( MImage(
// "assets/image/icon_story_td.png", groupList?.groupImg ?? "",
// isCircle: true, isCircle: true,
// width: 48.w,
// height: 48.h,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
Image.asset(
"assets/image/icon_story_td.png",
width: 48, width: 48,
height: 48, height: 48,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
), ),
SizedBox(height: 4,), SizedBox(height: 4,),
Text( Text(
"时令水果", groupList?.groupName ?? "",
style: TextStyle( style: TextStyle(
fontSize: 11.sp, fontSize: 11.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,

57
lib/store/shopping/shopping_home/recommend_goods_list_view.dart

@ -1,9 +1,19 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/data/home_recommend_list.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/custom_image.dart';
class RecommendGoodsListView extends StatefulWidget { class RecommendGoodsListView extends StatefulWidget {
final List<HomeRecommendList> homeRecommendList;
final String storeId;
final String tenant;
RecommendGoodsListView(this.homeRecommendList,this.storeId,this.tenant);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _RecommendGoodsListView(); return _RecommendGoodsListView();
@ -11,6 +21,12 @@ class RecommendGoodsListView extends StatefulWidget {
} }
class _RecommendGoodsListView extends State<RecommendGoodsListView> { class _RecommendGoodsListView extends State<RecommendGoodsListView> {
@override
void initState() {
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
@ -31,7 +47,7 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
height: 5.h, height: 5.h,
), ),
GridView.builder( GridView.builder(
itemCount: 6, itemCount:widget.homeRecommendList == null ? 0 : widget.homeRecommendList.length,
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 16.w, left: 16.w,
right: 16.w, right: 16.w,
@ -56,10 +72,14 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/shopping_goods_details', '/router/shopping_goods_details',
arguments: {}, arguments: {
"id":widget.homeRecommendList[index].id,
"storeId":widget.storeId,
"tenant":widget.tenant,
},
); );
}, },
child: goodsListItem(), child: goodsListItem(widget.homeRecommendList[index]),
); );
}, },
) )
@ -67,7 +87,7 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
); );
} }
Widget goodsListItem() { Widget goodsListItem(HomeRecommendList homeRecommendList) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.vertical(
@ -102,19 +122,14 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
], ],
), ),
child: child:
// MImage( MImage(
// "", homeRecommendList.imgs[0],
// width: double.infinity, width: double.infinity,
// height: 166, height: 166,
// fit: BoxFit.cover, fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png", errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png",
// ), ),
Image.asset(
"assets/image/icon_story_td.png",
width: double.infinity,
fit: BoxFit.cover,
),
), ),
Expanded( Expanded(
child: Container( child: Container(
@ -137,7 +152,7 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
color: Color(0xFF5A5A5A), color: Color(0xFF5A5A5A),
), ),
child: Text( child: Text(
"中国大陆5仓", homeRecommendList?.supplierName ?? "",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -146,7 +161,7 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
), ),
), ),
Text( Text(
"已售12", "已售${homeRecommendList?.sellCount ?? 0}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -156,7 +171,7 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
], ],
), ),
Text( Text(
"SWISSGEAR瑞士军刀联名款马克杯", homeRecommendList?.productName ?? "",
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -181,7 +196,7 @@ class _RecommendGoodsListView extends State<RecommendGoodsListView> {
), ),
), ),
TextSpan( TextSpan(
text: "284.00", text:homeRecommendList?.price ??"",
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,

640
lib/store/shopping/shopping_home/search_page.dart

@ -1,48 +1,162 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/vip_rule_details.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/min.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/item_input_widget.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class SearchPage extends StatefulWidget { class SearchPage extends StatefulWidget {
final Map<String, dynamic> arguments;
SearchPage({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _SearchPage(); return _SearchPage();
} }
} }
class _SearchPage extends State<SearchPage> { class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin, WidgetsBindingObserver {
ApiService apiService; ApiService apiService;
TextEditingController controller = TextEditingController(); MinApiService minService;
final TextEditingController editingController = TextEditingController();
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
int optionIndex = 0; int optionIndex = 0;
bool isKeyBoardShow = false;
List<ProductListBean> productListBeans = [];
List<String> hotSearch =[];
List<String> historySearch = [];
FocusNode _focusNode = FocusNode();
bool hasFocus = true;
@override
void didChangeMetrics() {
super.didChangeMetrics();
WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {
print("object: ${MediaQuery.of(context).viewInsets.bottom}");
if (MediaQuery.of(context).viewInsets.bottom == 0) {
if (isKeyBoardShow) {
isKeyBoardShow = false;
//
FocusScope.of(context).requestFocus(FocusNode());
}
} else {
isKeyBoardShow = true;
}
});
});
}
///
@override
void dispose() {
_focusNode.unfocus();
super.dispose();
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
setState(() {
if(widget.arguments["hotSearch"] != null)
hotSearch.addAll(widget.arguments["hotSearch"]);
});
_focusNode.addListener((){
setState(() {
hasFocus = _focusNode.hasFocus;
});
});
if(widget.arguments["searchKey"] != null){
setState(() {
editingController.text =widget.arguments["searchKey"];
});
appletGoods(widget.arguments["searchKey"]);
}
}
///
getHistorySearch()async{
SharedPreferences value = await SharedPreferences.getInstance();
var str = value.getString("historySearch");
if(str == null )
return;
var strArr = str.split("&");
strArr.removeAt(strArr.length - 1);
setState(() {
historySearch.clear();
historySearch.addAll(strArr);
});
}
///
setHistorySearch(String text)async{
SharedPreferences value = await SharedPreferences.getInstance();
var str = value.getString("historySearch");
if(str == null )
str = "";
var strArr = str.split("&");
if(strArr.length >30){
str = strArr.getRange(0, 29).join("&");
} else{
str = strArr.join("&");
}
str += text + "&";
value.setString("historySearch", str);
getHistorySearch();
}
///
delHistorySearch()async{
SharedPreferences value = await SharedPreferences.getInstance();
value.setString("historySearch", "");
getHistorySearch();
}
///
appletGoods(String text) async {
if(minService == null)
minService = MinApiService(
Dio(),
context: context,
token: widget.arguments["minToken"],
tenant:widget.arguments["tenant"],
storeId: widget.arguments["storeId"],
);
BaseData<List<FindMiNiGroupList>> baseData =
await minService.findMiNiGroupList({
"id":widget.arguments["storeId"],
"searchKey" :text,
}).catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
refreshController.refreshCompleted();
setState(() {
productListBeans.clear();
if(baseData.data.length > 0)
productListBeans.addAll(baseData.data[0].productList);
});
} else {
refreshController.refreshFailed();
}
SharedPreferences.getInstance().then((value) { setHistorySearch(text);
apiService = ApiService(Dio(), setState(() {
context: context, token: value.getString("token"), pay: true); hasFocus = false;
FocusScope.of(context).requestFocus(FocusNode());
}); });
} }
@ -86,60 +200,117 @@ class _SearchPage extends State<SearchPage> {
child: Row( child: Row(
children: [ children: [
GestureDetector( GestureDetector(
onTap: (){ onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: Icon( child: Icon(
Icons.arrow_back_ios, Icons.arrow_back_ios,
size: 24, size: 24,
color: Colors.black, color: Colors.black,
), ),
), ),
Expanded( Expanded(
child: Container( child:
height: 30.h, Container(
margin: EdgeInsets.fromLTRB(0.w, 0, 8.w, 0.h), height: 36.h,
padding: EdgeInsets.fromLTRB(12.w, 7.h, 0, 7.h), margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0),
decoration: BoxDecoration( padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h),
color: Colors.white, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18), color: Colors.white,
boxShadow: [ borderRadius: BorderRadius.circular(4),
BoxShadow( boxShadow: [
color: Colors.black.withAlpha(12), BoxShadow(
offset: Offset(0, 3), color: Colors.black.withAlpha(12),
blurRadius: 14, offset: Offset(0, 3),
spreadRadius: 0, blurRadius: 14,
spreadRadius: 0,
),
],
), ),
], child: TextField(
), focusNode:_focusNode,
child: GestureDetector( textInputAction: TextInputAction.search,
onTap: () {}, onEditingComplete: () {
child: Row( // startLocation();
children: [ },
Icon( controller: editingController,
Icons.search, cursorHeight: 30.h,
size: 16, decoration: InputDecoration(
color: Color(0xFFABACAB), contentPadding: EdgeInsets.symmetric(
), vertical: 12.h,
SizedBox( ),
width: 3.w, prefixIcon: Icon(
), Icons.search,
Text( size: 24,
"前进麦味", color: Colors.black,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF727272),
), ),
suffixIcon: InkWell(
onTap: () {
editingController.clear();
},
child: Icon(
Icons.close,
size: 19,
color: Colors.grey,
),
),
border: InputBorder.none,
), ),
], ),
), )
), // Container(
)), // height: 30.h,
// margin: EdgeInsets.fromLTRB(0.w, 0, 8.w, 0.h),
// padding: EdgeInsets.fromLTRB(12.w, 7.h, 0, 0.h),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(18),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// ),
// ],
// ),
// child: GestureDetector(
// onTap: () {},
// child: Row(
// children: [
// Icon(
// Icons.search,
// size: 16,
// color: Color(0xFFABACAB),
// ),
// SizedBox(
// width: 3.w,
// ),
// Text(
// "前进麦味",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Color(0xFF727272),
// ),
// ),
// ],
// ),
// ),
// )
),
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
child: GestureDetector( child: GestureDetector(
onTap: () {}, onTap: () {
setState(() {
if(editingController.text.trim() == ""){
SmartDialog.showToast("请输入搜索内容", alignment: Alignment.center);
return;
}
appletGoods(editingController.text);
});
},
child: Text( child: Text(
"搜索", "搜索",
style: TextStyle( style: TextStyle(
@ -165,7 +336,8 @@ class _SearchPage extends State<SearchPage> {
topRight: Radius.circular(8), topRight: Radius.circular(8),
), ),
), ),
padding: EdgeInsets.only(left: 17.w, top: 16.h,right: 17.w), padding:
EdgeInsets.only(left: 17.w, top: 16.h, right: 17.w),
child: SmartRefresher( child: SmartRefresher(
controller: refreshController, controller: refreshController,
enablePullDown: true, enablePullDown: true,
@ -182,8 +354,11 @@ class _SearchPage extends State<SearchPage> {
builder: (context, snapshot) { builder: (context, snapshot) {
return Column( return Column(
children: [ children: [
// hotSearch(), if(hasFocus)
// historySearch(), hotSearchWords(),
if(hasFocus)
historySearchWords(),
if(!hasFocus)
searchList() searchList()
], ],
); );
@ -202,7 +377,7 @@ class _SearchPage extends State<SearchPage> {
} }
/// ///
Widget hotSearch() { Widget hotSearchWords() {
return Container( return Container(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
@ -219,13 +394,13 @@ class _SearchPage extends State<SearchPage> {
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
GridView.builder( GridView.builder(
itemCount: 6, itemCount:hotSearch?.length ?? 0,
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量 //Widget数量
crossAxisCount: 4, crossAxisCount:4,
//Widget之间间距 //Widget之间间距
crossAxisSpacing: 6.w, crossAxisSpacing: 6.w,
//Widget之间间距 //Widget之间间距
@ -235,8 +410,9 @@ class _SearchPage extends State<SearchPage> {
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
onTap: () {}, onTap: () {
child: hotSearchItem(), },
child: hotSearchItem(hotSearch[index]),
); );
}, },
), ),
@ -245,16 +421,16 @@ class _SearchPage extends State<SearchPage> {
); );
} }
Widget hotSearchItem() { Widget hotSearchItem(String hotSearch) {
return Container( return Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
RoundButton( RoundButton(
width: 68.w, padding: EdgeInsets.only(left: 4, right: 4),
height: 29.h, height: 29.h,
text: "稻田里的书店", text:hotSearch,
textColor: Color(0xFF181818), textColor: Color(0xFF181818),
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
radius: 4, radius: 4,
@ -267,7 +443,7 @@ class _SearchPage extends State<SearchPage> {
} }
/// ///
Widget historySearch() { Widget historySearchWords() {
return Container( return Container(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
@ -276,7 +452,8 @@ class _SearchPage extends State<SearchPage> {
children: [ children: [
Row( Row(
children: [ children: [
Expanded(child:Text( Expanded(
child: Text(
"历史搜索", "历史搜索",
style: TextStyle( style: TextStyle(
fontSize: 15.sp, fontSize: 15.sp,
@ -287,28 +464,34 @@ class _SearchPage extends State<SearchPage> {
Image.asset( Image.asset(
"assets/image/icon_delete.png", "assets/image/icon_delete.png",
width: 22.w, width: 22.w,
height:20.h, height: 20.h,
), ),
Text( GestureDetector(
"删除", onTap: (){
style: TextStyle( setState(() {
fontSize: 15.sp, delHistorySearch();
fontWeight: MyFontWeight.semi_bold, });
color: Color(0xFF181818), },
child:Text(
"删除",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF181818),
),
), ),
), )
], ],
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
GridView.builder( GridView.builder(
itemCount: 6, itemCount:historySearch?.length ?? 0,
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量 //Widget数量
crossAxisCount: 4, crossAxisCount:4,
//Widget之间间距 //Widget之间间距
crossAxisSpacing: 6.w, crossAxisSpacing: 6.w,
//Widget之间间距 //Widget之间间距
@ -318,10 +501,8 @@ class _SearchPage extends State<SearchPage> {
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {},
child: historySearchItem(historySearch[index]),
},
child: historySearchItem(),
); );
}, },
), ),
@ -330,16 +511,16 @@ class _SearchPage extends State<SearchPage> {
); );
} }
Widget historySearchItem() { Widget historySearchItem(String historySearch) {
return Container( return Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
RoundButton( RoundButton(
width: 68.w, padding: EdgeInsets.only(left: 4, right: 4),
height: 29.h, height: 29.h,
text: "稻田里的书店", text:historySearch,
textColor: Color(0xFF181818), textColor: Color(0xFF181818),
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
radius: 4, radius: 4,
@ -364,69 +545,87 @@ class _SearchPage extends State<SearchPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
GestureDetector( GestureDetector(
onTap: (){ onTap: () {
setState(() { setState(() {
optionIndex = 0 ; optionIndex = 0;
}); });
}, },
child: Text( child: Text(
"默认推荐", "默认推荐",
style: TextStyle( style: TextStyle(
fontSize: optionIndex == 0 ? 15.sp :14.sp, fontSize: optionIndex == 0 ? 15.sp : 14.sp,
fontWeight: optionIndex == 0 ? MyFontWeight.semi_bold : MyFontWeight.regular, fontWeight: optionIndex == 0
color: optionIndex == 0 ? Color(0xFF181818) : Color(0xFF4D4D4D), ? MyFontWeight.semi_bold
: MyFontWeight.regular,
color: optionIndex == 0
? Color(0xFF181818)
: Color(0xFF4D4D4D),
), ),
), ),
), ),
GestureDetector( GestureDetector(
onTap: (){ onTap: () {
setState(() { setState(() {
optionIndex = 1 ; optionIndex = 1;
}); });
}, },
child:Text( child: Text(
"销量", "销量",
style: TextStyle( style: TextStyle(
fontSize: optionIndex == 1 ? 15.sp :14.sp, fontSize: optionIndex == 1 ? 15.sp : 14.sp,
fontWeight: optionIndex == 1 ? MyFontWeight.semi_bold : MyFontWeight.regular, fontWeight: optionIndex == 1
color: optionIndex == 1 ? Color(0xFF181818) : Color(0xFF4D4D4D), ? MyFontWeight.semi_bold
: MyFontWeight.regular,
color: optionIndex == 1
? Color(0xFF181818)
: Color(0xFF4D4D4D),
), ),
), ),
), ),
GestureDetector( GestureDetector(
onTap: (){ onTap: () {
setState(() { setState(() {
optionIndex = 2 ; optionIndex = 2;
}); });
}, },
child:Row(children: [ child: Row(
Text( children: [
"价格", Text(
style: TextStyle( "价格",
fontSize: optionIndex == 2 ? 15.sp :14.sp, style: TextStyle(
fontWeight: optionIndex == 2 ? MyFontWeight.semi_bold : MyFontWeight.regular, fontSize: optionIndex == 2 ? 15.sp : 14.sp,
color: optionIndex == 2 ? Color(0xFF181818) : Color(0xFF4D4D4D), fontWeight: optionIndex == 2
? MyFontWeight.semi_bold
: MyFontWeight.regular,
color: optionIndex == 2
? Color(0xFF181818)
: Color(0xFF4D4D4D),
),
), ),
), Image.asset(
Image.asset( "assets/image/jg.png",
"assets/image/jg.png", width: 16,
width:16, height: 16,
height:16, ),
), ],
],), ),
), ),
GestureDetector( GestureDetector(
onTap: (){ onTap: () {
setState(() { setState(() {
optionIndex = 3 ; optionIndex = 3;
}); });
}, },
child: Text( child: Text(
"专区", "专区",
style: TextStyle( style: TextStyle(
fontSize: optionIndex == 3 ? 15.sp :14.sp, fontSize: optionIndex == 3 ? 15.sp : 14.sp,
fontWeight: optionIndex == 3 ? MyFontWeight.semi_bold : MyFontWeight.regular, fontWeight: optionIndex == 3
color: optionIndex == 3 ? Color(0xFF181818) : Color(0xFF4D4D4D), ? MyFontWeight.semi_bold
: MyFontWeight.regular,
color: optionIndex == 3
? Color(0xFF181818)
: Color(0xFF4D4D4D),
), ),
), ),
), ),
@ -434,28 +633,33 @@ class _SearchPage extends State<SearchPage> {
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
GridView.builder( GridView.builder(
itemCount:6, itemCount:productListBeans?.length ?? 0,
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量 //Widget数量
crossAxisCount:2, crossAxisCount: 2,
//Widget之间间距 //Widget之间间距
crossAxisSpacing: 11.w, crossAxisSpacing: 11.w,
//Widget之间间距 //Widget之间间距
mainAxisSpacing: 16.w, mainAxisSpacing: 16.w,
//Widget宽高比例 0.59 //Widget宽高比例 0.59
childAspectRatio: childAspectRatio:
185 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)), 185 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)),
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/shopping_mall_home',arguments: { Navigator.of(context).pushNamed(
"type" : 1, '/router/shopping_goods_details',
}); arguments: {
"id":productListBeans[index].id,
"storeId":widget.arguments["storeId"],
"tenant":widget.arguments["tenant"],
},
);
}, },
child: searchListItem(), child: searchListItem(productListBeans[index]),
); );
}, },
) )
@ -464,7 +668,7 @@ class _SearchPage extends State<SearchPage> {
); );
} }
Widget searchListItem() { Widget searchListItem(ProductListBean productListBeans) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
@ -497,111 +701,111 @@ class _SearchPage extends State<SearchPage> {
], ],
), ),
child: child:
// MImage( MImage(
// "", productListBeans?.imgPath ??"",
// width: double.infinity, width: double.infinity,
// height: 166, height: 166,
// fit: BoxFit.cover, fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png", errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png",
// ), ),
Image.asset(
"assets/image/icon_story_td.png",
width:double.infinity,
fit: BoxFit.cover,
),
), ),
Expanded(child:Container( Expanded(
padding: EdgeInsets.only(left:8.w,right:8.w), child: Container(
child: Column( padding: EdgeInsets.only(left: 8.w, right: 8.w),
mainAxisAlignment: MainAxisAlignment.spaceAround, child: Column(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Row( children: [
mainAxisAlignment: MainAxisAlignment.spaceBetween, Row(
crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ crossAxisAlignment: CrossAxisAlignment.end,
Container( children: [
margin: EdgeInsets.only(top: 8, right: 8), Container(
padding: EdgeInsets.only(left: 2, right: 2), margin: EdgeInsets.only(top: 8, right: 8),
height: 17.h, padding: EdgeInsets.only(left: 2, right: 2),
alignment: Alignment.center, height: 17.h,
decoration: BoxDecoration( alignment: Alignment.center,
borderRadius: BorderRadius.circular(2), decoration: BoxDecoration(
color: Color(0xFF5A5A5A), borderRadius: BorderRadius.circular(2),
color: Color(0xFF5A5A5A),
),
child: Text(
productListBeans.supplierName,
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),
), ),
child: Text( Text(
"中国大陆5仓", "已售${productListBeans?.sellCount ?? 0}",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Colors.white, color: Color(0xFF5D5D5D),
), ),
), ),
],
),
Text(
productListBeans?.productName ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
), ),
Text(
"已售12件",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF5D5D5D),
),
),
],
),
Text(
"SWISSGEAR瑞士军刀联名款马克杯",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
), ),
), Row(
Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end, children: [
children: [ Text.rich(
Text.rich( TextSpan(
TextSpan( children: [
children: [ TextSpan(
TextSpan( text: "",
text: "", style: TextStyle(
style: TextStyle( fontSize: 12.sp,
fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold,
fontWeight: MyFontWeight.semi_bold, color: Color(0xFF32A060),
color: Color(0xFF32A060), ),
), ),
), TextSpan(
TextSpan( text:productListBeans?.price ?? "",
text: "284.00", style: TextStyle(
style: TextStyle( fontSize: 18.sp,
fontSize:18.sp, fontWeight: MyFontWeight.semi_bold,
fontWeight: MyFontWeight.semi_bold, color: Color(0xFF32A060),
color: Color(0xFF32A060), ),
), ),
), ],
], ),
), ),
), Text(
Text( "¥283.00",
"¥283.00", style: TextStyle(
style: TextStyle( fontSize: 14.sp,
fontSize:14.sp, decoration: TextDecoration.lineThrough,
decoration: TextDecoration.lineThrough, decorationColor: Color(0xFF585858),
decorationColor: Color(0xFF585858), fontWeight: MyFontWeight.regular,
fontWeight: MyFontWeight.regular, color: Color(0xFFA2A2A2),
color: Color(0xFFA2A2A2), ),
), ),
), ],
], ),
), ],
], ),
), ),
),) )
], ],
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

495
lib/store/shopping/shopping_home/shopping_acticvity.dart

@ -5,13 +5,20 @@ import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/data/shopping_home_config.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/item_title.dart'; import 'package:huixiang/view_widget/item_title.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class ShoppingActivity extends StatefulWidget { class ShoppingActivity extends StatefulWidget {
final String storeId;
final String tenant;
final List<QuickEntry> quickEntry;
ShoppingActivity(this.storeId,this.tenant,this.quickEntry);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _ShoppingActivity(); return _ShoppingActivity();
@ -26,6 +33,28 @@ class _ShoppingActivity extends State<ShoppingActivity> {
super.initState(); super.initState();
} }
///url跳转
jumpActivity(String url) {
var router = url.substring(0,url.contains("?")?url.indexOf("?") : (url.length - 1));
Map<String, dynamic> argumentsMap = Map();
argumentsMap["storeId"] =widget.storeId;
argumentsMap["tenant"] =widget.tenant;
if(url.contains("?")){
var data = url.substring(url.indexOf("?") + 1);
var dataArr = data.split("&");
dataArr.forEach((element) {
if(element.contains("=")){
var tempData = element.split("=");
if(tempData.length == 2){
argumentsMap[tempData[0]] = tempData[1];
}
}
});
}
Navigator.of(context).pushNamed(router,
arguments:argumentsMap);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
@ -39,88 +68,92 @@ class _ShoppingActivity extends State<ShoppingActivity> {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/activity_prefecture_details', jumpActivity(widget?.quickEntry[0].url);
arguments: {
"type":2
});
}, },
child: Container( child: Container(
margin: EdgeInsets.symmetric(horizontal: 5.w ), margin: EdgeInsets.symmetric(horizontal: 5.w ),
padding: EdgeInsets.only(left: 12.w), // padding: EdgeInsets.only(left: 12.w),
width: (MediaQuery.of(context).size.width - 42) / 2, width: (MediaQuery.of(context).size.width - 42) / 2,
height: 195.h, height: 195.h,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
color: Colors.white, color: Colors.white,
), ),
child: Column( child: MImage(
mainAxisAlignment: MainAxisAlignment.spaceAround, widget?.quickEntry[0]?.img ?? "",
crossAxisAlignment: CrossAxisAlignment.start, width:double.infinity,
children: [ fit: BoxFit.contain,
Text( errorSrc: "assets/image/default_2_1.png",
"回乡秒杀", fadeSrc: "assets/image/default_2_1.png",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: Colors.black,
),
),
Text(
"超多好物,等你来秒",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF7B7B7B),
),
),
GestureDetector(
onTap: (){
},
child: Container(
height:20.h,
width: 60.w,
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(11.5),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"10点场",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Colors.white,
),
],
),
),
),
Padding(padding: EdgeInsets.only(bottom: 10.h),child:
Image.asset(
"assets/image/icon_story_td.png",
width: 87,
height: 87,
fit: BoxFit.cover,
),)
],
), ),
// Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "回乡秒杀",
// style: TextStyle(
// fontSize: 15.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.black,
// ),
// ),
// Text(
// "超多好物,等你来秒",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Color(0xFF7B7B7B),
// ),
// ),
// GestureDetector(
// onTap: (){
// },
// child: Container(
// height:20.h,
// width: 60.w,
// decoration: BoxDecoration(
// color: Color(0xFF32A060),
// borderRadius: BorderRadius.circular(11.5),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// ),
// ],
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// "10点场",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Colors.white,
// ),
// ),
// Icon(
// Icons.keyboard_arrow_right,
// size: 16,
// color: Colors.white,
// ),
// ],
// ),
// ),
// ),
// Padding(padding: EdgeInsets.only(bottom: 10.h),child:
// Image.asset(
// "assets/image/icon_story_td.png",
// width: 87,
// height: 87,
// fit: BoxFit.cover,
// ),)
// ],
// ),
), ),
), ),
Expanded( Expanded(
@ -130,92 +163,100 @@ class _ShoppingActivity extends State<ShoppingActivity> {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/activity_prefecture_details', jumpActivity(widget?.quickEntry[1].url);
arguments: { "type":3});
}, },
child: Container( child: Container(
margin: EdgeInsets.symmetric(horizontal: 5.w), margin: EdgeInsets.symmetric(horizontal: 5.w),
padding: EdgeInsets.only(left: 12.w,right: 11.w), // padding: EdgeInsets.only(left: 12.w,right: 11.w),
width: (MediaQuery.of(context).size.width - 42) / 2, width: (MediaQuery.of(context).size.width - 42) / 2,
height: 195.h / 2, height: 195.h / 2,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
color: Colors.white, color: Colors.white,
), ),
child: Row( child: MImage(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, widget?.quickEntry[1]?.img ?? "",
crossAxisAlignment: CrossAxisAlignment.end, width:double.infinity,
children: [ fit: BoxFit.contain,
Expanded(child: Column( errorSrc: "assets/image/default_2_1.png",
mainAxisAlignment: MainAxisAlignment.spaceAround, fadeSrc: "assets/image/default_2_1.png",
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"好价我砍",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: Colors.black,
),
),
Text(
"拉友同优",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF7B7B7B),
),
),
GestureDetector(
onTap: (){
},
child: Container(
height: 18.h,
width: 48.w,
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(11.5),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"GO",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Colors.white,
),
],
),
),
),
],
),),
Padding(padding: EdgeInsets.only(bottom: 10.h),child:
Image.asset(
"assets/image/icon_story_td.png",
width: 44,
height: 44,
fit: BoxFit.cover,
),)
],
), ),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Expanded(child:
// Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "好价我砍",
// style: TextStyle(
// fontSize: 15.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.black,
// ),
// ),
// Text(
// "拉友同优",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Color(0xFF7B7B7B),
// ),
// ),
// GestureDetector(
// onTap: (){
// },
// child: Container(
// height: 18.h,
// width: 48.w,
// decoration: BoxDecoration(
// color: Color(0xFF32A060),
// borderRadius: BorderRadius.circular(11.5),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// ),
// ],
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// "GO",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Colors.white,
// ),
// ),
// Icon(
// Icons.keyboard_arrow_right,
// size: 16,
// color: Colors.white,
// ),
// ],
// ),
// ),
// ),
// ],
// ),
// ),
// Padding(padding: EdgeInsets.only(bottom: 10.h),child:
// Image.asset(
// "assets/image/icon_story_td.png",
// width: 44,
// height: 44,
// fit: BoxFit.cover,
// ),)
// ],
// ),
), ),
), ),
SizedBox( SizedBox(
@ -223,92 +264,98 @@ class _ShoppingActivity extends State<ShoppingActivity> {
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/activity_prefecture_details', jumpActivity(widget?.quickEntry[2].url);
arguments: { "type":1});
}, },
child: Container( child: Container(
margin: EdgeInsets.symmetric(horizontal: 5.w), margin: EdgeInsets.symmetric(horizontal: 5.w),
padding: EdgeInsets.only(left: 12.w,right: 11.w), // padding: EdgeInsets.only(left: 12.w,right: 11.w),
width: (MediaQuery.of(context).size.width - 42) / 2, width: (MediaQuery.of(context).size.width - 42) / 2,
height: 195.h / 2, height: 195.h / 2,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
color: Colors.white, color: Colors.white,
), ),
child: Row( child:MImage(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, widget?.quickEntry[2]?.img ?? "",
crossAxisAlignment: CrossAxisAlignment.end, width:double.infinity,
children: [ fit: BoxFit.contain,
Expanded(child: Column( errorSrc: "assets/image/default_2_1.png",
mainAxisAlignment: MainAxisAlignment.spaceAround, fadeSrc: "assets/image/default_2_1.png",
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"拼团专场",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: Colors.black,
),
),
Text(
"优惠齐享",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF7B7B7B),
),
),
GestureDetector(
onTap: (){
},
child: Container(
height: 18.h,
width: 48.w,
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(11.5),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"GO",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Colors.white,
),
],
),
),
),
],
),),
Padding(padding: EdgeInsets.only(bottom: 10.h),child:
Image.asset(
"assets/image/icon_story_td.png",
width: 44,
height: 44,
fit: BoxFit.cover,
),)
],
), ),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Expanded(child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "拼团专场",
// style: TextStyle(
// fontSize: 15.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.black,
// ),
// ),
// Text(
// "优惠齐享",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Color(0xFF7B7B7B),
// ),
// ),
// GestureDetector(
// onTap: (){
// },
// child: Container(
// height: 18.h,
// width: 48.w,
// decoration: BoxDecoration(
// color: Color(0xFF32A060),
// borderRadius: BorderRadius.circular(11.5),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// ),
// ],
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// "GO",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Colors.white,
// ),
// ),
// Icon(
// Icons.keyboard_arrow_right,
// size: 16,
// color: Colors.white,
// ),
// ],
// ),
// ),
// ),
// ],
// ),),
// Padding(padding: EdgeInsets.only(bottom: 10.h),child:
// Image.asset(
// "assets/image/icon_story_td.png",
// width: 44,
// height: 44,
// fit: BoxFit.cover,
// ),)
// ],
// ),
), ),
), ),
], ],

217
lib/store/shopping/shopping_home/shopping_home_page.dart

@ -1,24 +1,38 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/main.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/home_recommend_list.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart';
import 'package:huixiang/retrofit/data/shopping_home_config.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/shopping/shopping_home/recommend_goods_list_view.dart'; import 'package:huixiang/store/shopping/shopping_home/recommend_goods_list_view.dart';
import 'package:huixiang/store/shopping/shopping_home/shopping_acticvity.dart'; import 'package:huixiang/store/shopping/shopping_home/shopping_acticvity.dart';
import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/store/shopping/shopping_home/shopping_title_tab.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'activity_banner.dart';
import 'classify_list.dart'; import 'classify_list.dart';
class ShoppingHomePage extends StatefulWidget { class ShoppingHomePage extends StatefulWidget {
final String minToken;
final StoreInfo storeInfo; final StoreInfo storeInfo;
final String storeId;
final String tenant;
ShoppingHomePage(this.storeInfo); ShoppingHomePage(this.minToken, this.storeInfo, this.storeId, this.tenant);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -29,21 +43,73 @@ class ShoppingHomePage extends StatefulWidget {
class _ShoppingHomePage extends State<ShoppingHomePage> class _ShoppingHomePage extends State<ShoppingHomePage>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
MinApiService minService;
final SwiperController controller = SwiperController();
final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
ShoppingHomeConfig shoppingHomeConfig;
int checkNC = 0;
List<HomeRecommendList> homeRecommendList = [];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
SharedPreferences.getInstance().then((value) {
minService = MinApiService(
Dio(),
context: context,
token: widget.minToken,
tenant: widget.tenant,
storeId: widget.storeId,
showLoading: false,
);
queryHomeConfig();
queryRecommendList();
});
} }
final SwiperController controller = SwiperController();
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
if (refreshController != null) refreshController.dispose(); if (refreshController != null) refreshController.dispose();
} }
final RefreshController refreshController = RefreshController(); ///
queryHomeConfig() async {
BaseData<ShoppingHomeConfig> baseData =
await minService.homeConfig().catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
setState(() {
shoppingHomeConfig = baseData.data;
refreshController.refreshCompleted();
});
} else {
refreshController.refreshFailed();
}
}
///
queryRecommendList() async {
BaseData<List<HomeRecommendList>> baseData =
await minService.recommendList().catchError((onError) {
refreshController.loadFailed();
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
setState(() {
homeRecommendList.clear();
homeRecommendList.addAll(baseData.data);
});
}
EasyLoading.dismiss();
}
_onRefresh(){
queryHomeConfig();
queryRecommendList();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -64,39 +130,60 @@ class _ShoppingHomePage extends State<ShoppingHomePage>
enablePullUp: false, enablePullUp: false,
header: MyHeader(), header: MyHeader(),
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
scrollController: scrollController,
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () { onRefresh: () {
setState(() {}); setState(() {
_onRefresh();
});
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
child: FutureBuilder( child: Column(
// future: queryHome(), children: [
builder: (context, snapshot) { if(shoppingHomeConfig != null)
return Column( buildSearchItem(),
children: [
buildSearchItem(), buildSwiper(),
buildSwiper(), ///
if(shoppingHomeConfig != null)
/// ShoppingTitleTab(shoppingHomeConfig.categoryGroup,
// ShoppingTitleTab(), (index) {
setState(() {
/// checkNC = index;
ClassifyList(), });
}),
///
ShoppingActivity(), ///
if(shoppingHomeConfig != null)
/// ClassifyList(
// ActivityBanner(), shoppingHomeConfig.categoryGroup[checkNC].groupList,
widget.minToken,
/// widget.storeId,
RecommendGoodsListView(), widget.tenant
], ),
);
}, ///
), if(shoppingHomeConfig != null)
), ShoppingActivity(widget.storeId, widget.tenant,
shoppingHomeConfig.quickEntry),
///
if(shoppingHomeConfig != null)
ActivityBanner(shoppingHomeConfig.specialArea, widget.minToken,
widget.storeId,
widget.tenant),
///
RecommendGoodsListView(homeRecommendList,
widget.storeId, widget.tenant),
],
)),
), ),
), ),
), ),
@ -108,26 +195,31 @@ class _ShoppingHomePage extends State<ShoppingHomePage>
} }
Widget buildSearchItem() { Widget buildSearchItem() {
return Container( return GestureDetector(
height: 36.h, onTap: () {
margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h), Navigator.of(context).pushNamed('/router/search_page', arguments: {
padding: EdgeInsets.fromLTRB(12.w, 6.h, 0, 6.h), "minToken": widget.minToken,
decoration: BoxDecoration( "tenant": widget.tenant,
color: Colors.white, "storeId": widget.storeId,
borderRadius: BorderRadius.circular(18), "hotSearch":shoppingHomeConfig.hotSearch,
boxShadow: [ });
BoxShadow( },
color: Colors.black.withAlpha(12), child:Container(
offset: Offset(0, 3), height: 36.h,
blurRadius: 14, margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h),
spreadRadius: 0, padding: EdgeInsets.fromLTRB(12.w, 6.h, 0, 6.h),
), decoration: BoxDecoration(
], color: Colors.white,
), borderRadius: BorderRadius.circular(18),
child: GestureDetector( boxShadow: [
onTap: () { BoxShadow(
Navigator.of(context).pushNamed('/router/search_page'); color: Colors.black.withAlpha(12),
}, offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
@ -156,7 +248,7 @@ class _ShoppingHomePage extends State<ShoppingHomePage>
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 160.h, height: 160.h,
margin: EdgeInsets.only(left: 16,right: 16), margin: EdgeInsets.only(left: 16, right: 16),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
@ -175,8 +267,8 @@ class _ShoppingHomePage extends State<ShoppingHomePage>
return Container( return Container(
child: MImage( child: MImage(
(widget.storeInfo != null && (widget.storeInfo != null &&
widget.storeInfo.bannerList != null && widget.storeInfo.bannerList != null &&
position < widget.storeInfo.bannerList.length) position < widget.storeInfo.bannerList.length)
? widget.storeInfo.bannerList[position].imgUrl ? widget.storeInfo.bannerList[position].imgUrl
: "", : "",
fit: BoxFit.cover, fit: BoxFit.cover,
@ -186,9 +278,10 @@ class _ShoppingHomePage extends State<ShoppingHomePage>
), ),
); );
}, },
itemCount: (widget.storeInfo != null && widget.storeInfo.bannerList != null) itemCount:
? widget.storeInfo.bannerList.length (widget.storeInfo != null && widget.storeInfo.bannerList != null)
: 1, ? widget.storeInfo.bannerList.length
: 1,
), ),
); );
} }

17
lib/store/shopping/shopping_home/shopping_title_tab.dart

@ -1,16 +1,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/shopping_home_config.dart';
import 'package:huixiang/retrofit/data/category_select_list.dart';
import 'package:huixiang/retrofit/data/goods_category.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_tab.dart'; import 'package:huixiang/view_widget/my_tab.dart';
class ShoppingTitleTab extends StatefulWidget { class ShoppingTitleTab extends StatefulWidget {
final List<CategorySelectList> classSelectList; final List<CategoryGroup> categoryGroup;
final Function notifyClassSelectList; final Function notifyClassSelectList;
ShoppingTitleTab(this.classSelectList,this.notifyClassSelectList); ShoppingTitleTab(this.categoryGroup,this.notifyClassSelectList);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -25,7 +23,6 @@ class _ClassTitleTab extends State<ShoppingTitleTab>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
} }
@override @override
@ -33,9 +30,7 @@ class _ClassTitleTab extends State<ShoppingTitleTab>
return Container( return Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: DefaultTabController( child: DefaultTabController(
length:widget.classSelectList == null length:widget?.categoryGroup?.length ?? 0,
? 0
: widget.classSelectList.length,
child: TabBar( child: TabBar(
isScrollable: true, isScrollable: true,
// //
@ -57,9 +52,9 @@ class _ClassTitleTab extends State<ShoppingTitleTab>
widget.notifyClassSelectList(index); widget.notifyClassSelectList(index);
}, },
// //
tabs:widget.classSelectList == null tabs:widget.categoryGroup == null
? [] ? []
: widget.classSelectList : widget.categoryGroup
.map((e) => MyTab(text: e.name)) .map((e) => MyTab(text: e.name))
.toList(), .toList(),
), ),

243
lib/store/shopping/shopping_mall_home.dart

@ -2,22 +2,15 @@ import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/banner.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/brand.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/shopping/shopping_cart/shopping_cart_page.dart'; import 'package:huixiang/store/shopping/shopping_cart/shopping_cart_page.dart';
import 'package:huixiang/store/shopping/shopping_home/shopping_home_page.dart'; import 'package:huixiang/store/shopping/shopping_home/shopping_home_page.dart';
import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -36,12 +29,7 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
MinApiService minService; MinApiService minService;
List<Brand> brands = [];
List<BannerData> bannerData = [];
int choiceIndex = 0; int choiceIndex = 0;
bool dialogShowing = false;
final RefreshController refreshController = RefreshController();
final SwiperController controller = SwiperController();
String storeId = ""; String storeId = "";
String tenant = ""; String tenant = "";
@ -98,6 +86,7 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
showLoading: false, showLoading: false,
); );
// queryShopCar().then((value) { // queryShopCar().then((value) {
// this.shopCarGoods = value; // this.shopCarGoods = value;
// setState(() {}); // setState(() {});
@ -128,11 +117,225 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
@override // ///
void dispose() { // _queryMiNiDetail(String id,int count) async {
super.dispose(); // EasyLoading.show(status: S.current.zhengzaijiazai);
if (refreshController != null) refreshController.dispose(); // BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
} // if (baseData != null && baseData.isSuccess) {
// showStoreSelector(baseData.data, id,count);
// }
// }
//
// ///
// showStoreSelector(MiNiDetail miNiDetail, String id,int count) async {
// if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1
// && miNiDetail.attrList[0].attrValueList.length == 1) {
// _addShopCar(miNiDetail, [], count);
// } else {
// EasyLoading.dismiss();
// dialogShowing = true;
// SmartDialog.show(
// widget: ProductSku(
// miNiDetail,
// shopCarGoods,
// id,
// _addShopCar,
// add,
// reduce,
// ),
// onDismiss: () {
// dialogShowing = false;
// },
// alignmentTemp: Alignment.bottomCenter,
// );
// }
// }
//
// ///
// Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async {
// ProductSkuVOListBean productSku;
// if (selectSkus!= null && selectSkus.length == 0) {
// productSku = miNiDetail.productSkuVOList.first;
// } else {
// productSku = miNiDetail.productSkuVOList.firstWhere((element) {
// bool gg = true;
// selectSkus.forEach((element1) {
// if (element.skuNameStr.indexOf(element1) < 0) {
// gg = false;
// return gg;
// }
// });
// return gg;
// });
// }
// if (productSku == null) return;
// String skuId = productSku.id;
// String skuValue = selectSkus
// .toString()
// .replaceAll("[", "")
// .replaceAll("]", "")
// .replaceAll(",", "");
//
// if (miNiDetail != null) {
// BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({
// "storeId": storeInfo.id,
// "storeName": storeInfo.storeName ?? "",
// "numberOfPeople": numberOfPeople,
// "tableId": tableId,
// "parentId": parentId,
// "parentCode": parentCode,
// "shoppingCartSkuItemList": [
// {
// "buyNum": count,
// "id": skuId,
// "productId": miNiDetail.id,
// "productName": miNiDetail.productName,
// "skuName": skuValue,
// "storeId": storeInfo.id,
// "skuPrice": productSku.skuPrice,
// "skuStock": productSku.skuStock,
// "tableId": tableId,
// },
// ],
// });
// EasyLoading.dismiss();
// if (baseDate != null && baseDate.isSuccess) {
// queryShopCar().then((value) {
// this.shopCarGoods = value;
// setState(() {});
// });
// }
// }
// }
//
// ///1
// add(MiNiDetail miNiDetail, selectSkus) async {
// ProductSkuVOListBean productSku =
// miNiDetail.productSkuVOList.firstWhere((element) {
// return skuY(element, selectSkus);
// });
//
// if (productSku == null) return;
// String skuId = productSku.id;
// if (shopCarGoods == null) {
// await _addShopCar(miNiDetail, selectSkus, 2);
// return;
// }
// int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
// .indexWhere((element) => skuId == element.id);
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
// shopCarGoods.tableId = "$tableId";
//
// if (shopSkuIndex >= 0) {
// shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum += 1;
// ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods
// .shoppingCartSkuItemList
// .firstWhere((element) => skuId == element.id);
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
// } else {
// await _addShopCar(miNiDetail, selectSkus, 2);
// return;
// }
//
// BaseData<List<ShoppingCart>> baseDate =
// await minService.shoppingCartSingle(shopCarTemp);
// if (baseDate.isSuccess) {
// queryShopCar().then((value) {
// this.shopCarGoods = value;
// setState(() {});
// });
// }
// }
//
// ///1
// reduce(MiNiDetail miNiDetail, selectSkus) async {
// ProductSkuVOListBean productSku =
// miNiDetail.productSkuVOList.firstWhere((element) {
// return skuY(element, selectSkus);
// });
//
// if (productSku == null) return;
// String skuId = productSku.id;
// if (shopCarGoods == null) {
// await _addShopCar(miNiDetail, selectSkus, 2);
// return;
// }
// ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods
// .shoppingCartSkuItemList
// .firstWhere((element) => skuId == element.skuId);
// int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
// .indexWhere((element) => skuId == element.skuId);
//
// if (shopSkuItem != null) {
// if (shopSkuItem.buyNum > 1) {
// shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1;
// }
// } else {
// await _addShopCar(miNiDetail, selectSkus, 2);
// return;
// }
// shopCarGoods.tableId = "$tableId";
//
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
// ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods
// .shoppingCartSkuItemList
// .firstWhere((element) => skuId == element.id);
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
//
// BaseData<List<ShoppingCart>> baseDate =
// await minService.shoppingCartSingle(shopCarTemp);
// if (baseDate.isSuccess) {
// queryShopCar().then((value) {
// this.shopCarGoods = value;
// setState(() {});
// });
// }
// }
//
// bool skuY(ProductSkuVOListBean productSku, selectSkus) {
// bool gg = true;
// selectSkus.forEach((element1) {
// if (productSku.skuNameStr.indexOf(element1) < 0) {
// gg = false;
// return gg;
// }
// });
// return gg;
// }
// ///
// Future<ShoppingCart> queryShopCar() async {
// pName="";//
// pid="";//
// cName="";//
// cid="";//
// BaseData<List<ShoppingCart>> baseDate =
// await minService.getShoppingCart(tableId);
// if (baseDate != null &&
// baseDate.isSuccess &&
// baseDate.data != null &&
// baseDate.data.length > 0) {
// if( baseDate.data[0].selectDiscount ==1){
// baseDate.data[0].couponList.forEach((element) {
// if(element.isMaxCoupon){
// cName = element.promotionName;
// cid = element.id;
// }
// });
// }else if(baseDate.data[0].selectDiscount==2){
// baseDate.data[0].promotionInfoList.forEach((element) {
// if(element.isMaxPromotion){
// pName=element.name;
// pid=element.id;
// }
// });
// }
// return baseDate.data[0];
// } else {
// return null;
// }
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -159,9 +362,15 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
), ),
if (choiceIndex == 0) if (choiceIndex == 0)
ShoppingHomePage( ShoppingHomePage(
minToken,
storeInfo, storeInfo,
storeId,
tenant,
), ),
if (choiceIndex == 1) ShoppingCartPage( if (choiceIndex == 1) ShoppingCartPage(
minToken,
storeId,
tenant,
), ),
Align( Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,

7
lib/store/store_order.dart

@ -283,7 +283,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
], ],
), ),
top: 0, top: 0,
bottom: 0, bottom:0,
left: 0, left: 0,
right: 0, right: 0,
), ),
@ -314,8 +314,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
], ],
), ),
), ),
top: 110.h, top:80.h,
bottom: 0, bottom:0,
left: 0, left: 0,
right: 0, right: 0,
), ),
@ -670,6 +670,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
_addShopCar, _addShopCar,
add, add,
reduce, reduce,
buttonType: 0,
), ),
onDismiss: () { onDismiss: () {
dialogShowing = false; dialogShowing = false;

400
lib/store/store_view/product_sku.dart

@ -16,6 +16,7 @@ class ProductSku extends StatefulWidget {
final Function(MiNiDetail miNiDetail, List<String> selectSkus) add; final Function(MiNiDetail miNiDetail, List<String> selectSkus) add;
final Function(MiNiDetail miNiDetail, List<String> selectSkus) reduce; final Function(MiNiDetail miNiDetail, List<String> selectSkus) reduce;
final ShoppingCart shopCarGoods; final ShoppingCart shopCarGoods;
final int buttonType;
ProductSku( ProductSku(
this.miNiDetail, this.miNiDetail,
@ -24,6 +25,7 @@ class ProductSku extends StatefulWidget {
this.addShopCar, this.addShopCar,
this.add, this.add,
this.reduce, this.reduce,
{ this.buttonType}
); );
@override @override
@ -269,20 +271,390 @@ class _ProductSku extends State<ProductSku> {
SizedBox( SizedBox(
height: 24, height: 24,
), ),
RoundButton( if(widget.buttonType == 0)
width: double.infinity, RoundButton(
height: 54.h, width: double.infinity,
text: "加入购物车", height: 54.h,
textColor: Colors.white, text: "加入购物车",
fontWeight: MyFontWeight.semi_bold, textColor: Colors.white,
radius: 27, fontWeight: MyFontWeight.semi_bold,
backgroup: Color(0xFF32A060), radius: 27,
fontSize: 16.sp, backgroup: Color(0xFF32A060),
callback: () { fontSize: 16.sp,
// Navigator.of(context).pop(); callback: () {
SmartDialog.dismiss(); // Navigator.of(context).pop();
widget.addShopCar(widget.miNiDetail, selectSkus, 1); SmartDialog.dismiss();
}, widget.addShopCar(widget.miNiDetail, selectSkus, 1);
},
),
if(widget.buttonType == 1)
RoundButton(
width: double.infinity,
height: 54.h,
text: "确认",
textColor: Colors.white,
fontWeight: MyFontWeight.semi_bold,
radius: 27,
backgroup: Color(0xFF32A060),
fontSize: 16.sp,
callback: () {
// Navigator.of(context).pop();
SmartDialog.dismiss();
widget.addShopCar(widget.miNiDetail, selectSkus,count);
},
),
///
if(widget.buttonType == 2)
Row(
children: [
Expanded(child: GestureDetector(
onTap: (){
Navigator.of(context).popAndPushNamed('/router/group_details');
},
child: Container(
alignment: Alignment.center,
width: 120.w,
height:40.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
border: Border.all(
width: 1,
color: Color(0xFF32A060),
style: BorderStyle.solid,
),
),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontSize: 7.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
TextSpan(
text: "284.00",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
],
),
),
Expanded(child:
Text(
"原价购买",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
)),
],
),
),
),),
Expanded(child: GestureDetector(
onTap: (){
Navigator.of(context).popAndPushNamed('/router/bargain_details');
},
child: Container(
alignment: Alignment.center,
width: 120.w,
height: 40.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontSize: 7.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
TextSpan(
text: "284.00",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
],
),
),
Expanded(child:
Text(
"我要砍价",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),),
],
),
)),),
],
),
///
if(widget.buttonType == 3)
Row(
children: [
Expanded(child:GestureDetector(
onTap: (){
Navigator.of(context).popAndPushNamed('/router/group_details');
},
child: Container(
alignment: Alignment.center,
width: 120.w,
height:40.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
border: Border.all(
width: 1,
color: Color(0xFF32A060),
style: BorderStyle.solid,
),
),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontSize: 7.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
TextSpan(
text: "284.00",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
],
),
),
Expanded(child:
Text(
"原价购买",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
)),
],
),
),
),),
Expanded(child:GestureDetector(
onTap: (){
Navigator.of(context).popAndPushNamed('/router/bargain_details');
},
child: Container(
alignment: Alignment.center,
width: 120.w,
height: 40.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontSize: 7.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
TextSpan(
text: "284.00",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
],
),
),
Expanded(child:
Text(
"我要秒杀",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),),
],
),
)),),
],
),
///
if(widget.buttonType == 4)
Row(
children: [
Expanded(child: GestureDetector(
onTap: (){
Navigator.of(context).popAndPushNamed('/router/group_details');
},
child: Container(
alignment: Alignment.center,
width: 120.w,
height:40.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
border: Border.all(
width: 1,
color: Color(0xFF32A060),
style: BorderStyle.solid,
),
),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontSize: 7.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
TextSpan(
text: "284.00",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
],
),
),
Expanded(child:
Text(
"单人购买",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
)),
],
),
),
)),
Expanded(child:GestureDetector(
onTap: (){
Navigator.of(context).popAndPushNamed('/router/bargain_details');
},
child: Container(
alignment: Alignment.center,
width: 120.w,
height: 40.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontSize: 7.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
TextSpan(
text: "284.00",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
],
),
),
Expanded(child:
Text(
"我要开团",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),),
],
),
)),),
],
), ),
SizedBox( SizedBox(
height: 21.h, height: 21.h,

2
pubspec.lock

@ -269,7 +269,7 @@ packages:
name: flutter_screenutil name: flutter_screenutil
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.1+3" version: "5.0.2"
flutter_smart_dialog: flutter_smart_dialog:
dependency: "direct main" dependency: "direct main"
description: description:

Loading…
Cancel
Save