fix some issues

master
章文轩 4 years ago
parent f097002e5a
commit 77c4f953c1

@ -170,6 +170,8 @@ class UserAPI {
///
String get wechatUnboundhandle => '/v2/app/command/user/unbundling_wx';
}
class BenefitAPI {
@ -218,6 +220,12 @@ class GoodsAPI {
///
String get getJDCategoryList => '/v2/app/jcook/category';
///
String get getJDStock => '/v2/app/jcook/stock';
}
class _InvoiceAoi {

@ -147,6 +147,26 @@ class HomeDao {
}
}
//
static Future<num> getJDStock(num goodsId,String address) async {
ResultData result =
await HttpManager.post(APIV2.goodsAPI.getJDStock, {
'goods_id':goodsId,
'address':address,
'quantity':1
});
if (result.data != null) {
if (result.data['data'] != null) {
return result.data['data']["stock_state"];
}
else{
return -1;
}
}else{
return -1;
}
}
}

@ -99,7 +99,8 @@ class GoodsSimple {
originalPrice = json['originalPrice'];
discountPrice = json['discountPrice'];
commission = json['commission'];
tags = json['tags'].cast<String>();
tags =
json['tags'] != null ? json['tags'].cast<String>() : null;
percent = json['percent'];
startTime = json['startTime'];
endTime = json['endTime'];

@ -58,6 +58,7 @@ class _BrandGoodsListPageState extends BaseStoreState<BrandGoodsListPage>
int _filterIndex = 0;
GifController _gifController;
List<bool> _barBool = [false,false,false];
@override
void initState() {
@ -109,9 +110,9 @@ class _BrandGoodsListPageState extends BaseStoreState<BrandGoodsListPage>
height: rSize(40),
fontSize: 15 * 2.sp,
titles: [
FilterItemModel(type: FilterItemType.normal, title: "综合"),
FilterItemModel(type: FilterItemType.double, title: "价格"),
FilterItemModel(type: FilterItemType.double, title: "销量"),
FilterItemModel(type: FilterItemType.normal, title: "综合",selectedList:_barBool),
FilterItemModel(type: FilterItemType.double, title: "价格",selectedList:_barBool),
FilterItemModel(type: FilterItemType.double, title: "销量",selectedList:_barBool),
// FilterItemModel(type: FilterItemType.normal, title: "特卖优先")
],
trialing: _displayIcon(),

@ -10,6 +10,7 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:recook/base/base_store_state.dart';
import 'package:recook/constants/api.dart';
@ -24,6 +25,8 @@ import 'package:recook/widgets/custom_image_button.dart';
import 'package:recook/widgets/sc_grid_view.dart';
import 'package:recook/widgets/sc_tab_bar.dart';
import '../search_page.dart';
class ClassifyPage extends StatefulWidget {
final List<FirstCategory> data;
final String initValue;
@ -93,7 +96,8 @@ class _ClassifyPageState extends BaseStoreState<ClassifyPage>
),
child: CustomImageButton(
onPressed: () {
AppRouter.push(context, RouteName.SEARCH);
//AppRouter.push(context, RouteName.SEARCH);
Get.to(SearchPage(jdType: 1,));
},
direction: Direction.horizontal,
icon: Container(
@ -257,6 +261,7 @@ class _ClassifyPageState extends BaseStoreState<ClassifyPage>
arguments: GoodsListPage.setArguments(
title: firstTitle,
index: indexIn,
secondCategoryList: secondCategories,
isJD: widget.jdType==1?true:false));

@ -40,8 +40,8 @@ class CommodityDetailPage extends StatefulWidget {
this.liveId = 0,
}) : super(key: key);
static setArguments(int goodsID, {int liveStatus, int roomId}) {
return {"goodsID": goodsID, 'liveStatus': liveStatus, 'roomId': roomId};
static setArguments(int goodsID, {int liveStatus, int roomId,int gysId}) {
return {"goodsID": goodsID, 'liveStatus': liveStatus, 'roomId': roomId,'gysId':gysId};
}
@override
@ -60,6 +60,7 @@ class _CommodityDetailPageState extends BaseStoreState<CommodityDetailPage>
GoodsDetailModel _goodsDetail;
int _liveStatus;
int _roomId;
num _gysId;
@override
void initState() {
@ -67,6 +68,8 @@ class _CommodityDetailPageState extends BaseStoreState<CommodityDetailPage>
_goodsId = widget.arguments["goodsID"];
_liveStatus = widget.arguments["liveStatus"];
_roomId = widget.arguments["roomId"];
_gysId = widget.arguments["gysId"];
print(_gysId);
_tabController = TabController(length: 3, vsync: this);
_appBarController = AppBarController();
_bottomBarController = BottomBarController();
@ -163,6 +166,7 @@ class _CommodityDetailPageState extends BaseStoreState<CommodityDetailPage>
goodsId: _goodsId,
openSkuChoosePage: _openSkuChoosePage,
goodsDetail: _goodsDetail,
gysId: _gysId,
onScroll: (notification) {
// double maxScroll = notification.metrics.maxScrollExtent;
double offset = notification.metrics.pixels;
@ -269,6 +273,7 @@ class _CommodityDetailPageState extends BaseStoreState<CommodityDetailPage>
},
buyListener: () {
_openSkuChoosePage.value = true;
},
shareListener: () {
_showShare(context);

@ -75,6 +75,7 @@ class _GoodsImportListPageState extends BaseStoreState<GoodsImportListPage>
SortType _sortType = SortType.comprehensive;
int _filterIndex = 0;
List<bool> _barBool = [false,false,false];
GifController _gifController;
@override
@ -87,7 +88,7 @@ class _GoodsImportListPageState extends BaseStoreState<GoodsImportListPage>
period: Duration(milliseconds: 700),
);
int index = widget.index;
DPrint.printf("index=$index");
//DPrint.printf("index=$index");
_secondCategoryList = widget.secondCategoryList;
print(_secondCategoryList);
_category = _secondCategoryList[index];
@ -198,9 +199,9 @@ class _GoodsImportListPageState extends BaseStoreState<GoodsImportListPage>
height: rSize(40),
fontSize: 13 * 2.sp,
titles: [
FilterItemModel(type: FilterItemType.normal, title: "综合"),
FilterItemModel(type: FilterItemType.double, title: "价格"),
FilterItemModel(type: FilterItemType.double, title: "销量"),
FilterItemModel(type: FilterItemType.normal, title: "综合",selectedList:_barBool),
FilterItemModel(type: FilterItemType.double, title: "价格",selectedList:_barBool),
FilterItemModel(type: FilterItemType.double, title: "销量",selectedList:_barBool),
// FilterItemModel(type: FilterItemType.normal, title: "特卖优先")
],
trialing: _displayIcon(),

@ -69,10 +69,11 @@ class _GoodsListPageState extends BaseStoreState<GoodsListPage>
SortType _sortType = SortType.comprehensive;
int _JDType = 0; // 0 1JD 2JD 3JD pop
int _jDType = 0; // 0 1JD 2JD 3JD pop
bool _isJD = false;
String _jdTypeText = '全部';
int _filterIndex = 0;
List<bool> _barBool = [false,false,false];
GifController _gifController;
@override
@ -81,7 +82,9 @@ class _GoodsListPageState extends BaseStoreState<GoodsListPage>
_isJD = widget.arguments['isJD'];
}
if (_isJD) {
_JDType = 1;
_jDType = 1;
_sortType = SortType.priceAsc;
_barBool = [false,false];
}
int index = widget.arguments["index"];
_gifController = GifController(vsync: this)
@ -201,23 +204,32 @@ class _GoodsListPageState extends BaseStoreState<GoodsListPage>
fontSize: 13 * 2.sp,
titles: _isJD
? [
FilterItemModel(type: FilterItemType.double, title: "价格"),
FilterItemModel(type: FilterItemType.double, title: "销量"),
FilterItemModel(type: FilterItemType.double, title: "价格",selectedList:_barBool),
FilterItemModel(type: FilterItemType.double, title: "销量",selectedList:_barBool),
// FilterItemModel(type: FilterItemType.normal, title: "特卖优先")
]
: [
FilterItemModel(type: FilterItemType.normal, title: "综合"),
FilterItemModel(type: FilterItemType.double, title: "价格"),
FilterItemModel(type: FilterItemType.double, title: "销量"),
FilterItemModel(type: FilterItemType.normal, title: "综合",selectedList:_barBool),
FilterItemModel(type: FilterItemType.double, title: "价格",selectedList:_barBool),
FilterItemModel(type: FilterItemType.double, title: "销量",selectedList:_barBool),
// FilterItemModel(type: FilterItemType.normal, title: "特卖优先")
],
trialing: _displayIcon(),
startWidget: _jdTypeWidget(),
selectedColor: Theme.of(context).primaryColor,
listener: (index, item) {
if ((index != 1 && index != 2) && _filterIndex == index) {
print(index);
if(!_isJD){
if ((index != 1 && index != 2) && _filterIndex == index) {
return;
}
}else{
if ((index != 1 && index != 2&& index != 0) && _filterIndex == index) {
return;
}
}
// if (index != 1 && _filterIndex == index) {
// return;
// }
@ -225,6 +237,7 @@ class _GoodsListPageState extends BaseStoreState<GoodsListPage>
if (_isJD) {
switch (index) {
case 0:
print(item.topSelected);
if (item.topSelected) {
_sortType = SortType.priceAsc;
} else {
@ -232,6 +245,7 @@ class _GoodsListPageState extends BaseStoreState<GoodsListPage>
}
break;
case 1:
print(item.topSelected);
if (item.topSelected) {
_sortType = SortType.salesAsc;
} else {
@ -273,6 +287,7 @@ class _GoodsListPageState extends BaseStoreState<GoodsListPage>
// _presenter.fetchList(_category.id, 0, _sortType);
_listViewController.stopRefresh();
_listViewController.requestRefresh();
},
);
}
@ -338,11 +353,11 @@ class _GoodsListPageState extends BaseStoreState<GoodsListPage>
setState(() {
_jdTypeText = value;
if (value == '全部') {
_JDType = 1;
_jDType = 1;
} else if (value == '京东自营') {
_JDType = 2;
_jDType = 2;
} else if (value == '京东POP') {
_JDType = 3;
_jDType = 3;
}
print(value);
setState(() {});
@ -384,12 +399,18 @@ class _GoodsListPageState extends BaseStoreState<GoodsListPage>
type: ListViewType.grid,
refreshCallback: () {
// _presenter.fetchList(widget.category.id, 0, _sortType);
_presenter.fetchList(_category.id, 0, _sortType, null, JDType: _JDType);
_presenter.fetchList(_category.id, 0, _sortType, null, JDType: _jDType);
setState(() {
});
},
loadMoreCallback: (int page) {
// _presenter.fetchList(widget.category.id, page, _sortType);
_presenter.fetchList(_category.id, page, _sortType, null,
JDType: _JDType);
JDType: _jDType);
setState(() {
});
},
gridViewBuilder: () => _buildGridView(),
);
@ -430,6 +451,7 @@ class _GoodsListPageState extends BaseStoreState<GoodsListPage>
},
model: goods,
buildCtx: context,
type: _isJD?3:0,
)
// ? NormalGoodsItem(model: goods, buildCtx: context,)
: BrandDetailGridItem(goods: goods));

@ -17,6 +17,7 @@ import 'package:get/get.dart';
import 'package:recook/base/base_store_state.dart';
import 'package:recook/constants/api.dart';
import 'package:recook/constants/header.dart';
import 'package:recook/daos/home_dao.dart';
import 'package:recook/manager/http_manager.dart';
import 'package:recook/manager/user_manager.dart';
import 'package:recook/models/address_list_model.dart';
@ -24,6 +25,7 @@ import 'package:recook/models/base_model.dart';
import 'package:recook/models/goods_detail_images_model.dart';
import 'package:recook/models/goods_detail_model.dart';
import 'package:recook/models/order_preview_model.dart';
import 'package:recook/models/order_return_address_model.dart';
import 'package:recook/models/province_city_model.dart';
import 'package:recook/pages/home/classify/coupon_list_page.dart';
import 'package:recook/pages/home/classify/evaluation_list_page.dart';
@ -34,6 +36,7 @@ import 'package:recook/pages/home/classify/order_preview_page.dart';
import 'package:recook/pages/home/classify/sku_choose_page.dart';
import 'package:recook/pages/home/items/item_user_comment.dart';
import 'package:recook/pages/home/items/item_users_like.dart';
import 'package:recook/pages/home/model/address_model.dart';
import 'package:recook/pages/home/widget/good_price_view.dart';
import 'package:recook/pages/home/widget/goods_image_page_view.dart';
import 'package:recook/pages/shopping_cart/mvp/shopping_cart_model_impl.dart';
@ -58,9 +61,11 @@ typedef ScrollListener = Function(ScrollUpdateNotification notification);
class MyGlobals {
GlobalKey _scaffoldKey;
MyGlobals() {
_scaffoldKey = GlobalKey();
}
GlobalKey get scaffoldKey => _scaffoldKey;
}
@ -76,6 +81,10 @@ class GoodsPage extends StatefulWidget {
final int liveStatus;
final int roomId;
final num gysId;
const GoodsPage({
Key key,
this.onScroll,
@ -84,8 +93,10 @@ class GoodsPage extends StatefulWidget {
this.goodsDetail,
this.openbrandList,
// this.isLive = false,
// this.liveId = 0,
this.liveStatus, this.roomId,
// this.liveId = 0,
this.liveStatus,
this.roomId,
this.gysId,
}) : super(key: key);
@override
@ -96,6 +107,7 @@ class GoodsPage extends StatefulWidget {
class _GoodsPageState extends BaseStoreState<GoodsPage> {
MyGlobals myGlobals = MyGlobals();
// GoodsDetailModel widget.goodsDetail;
double width = DeviceInfo.screenWidth;
List<SelectedListItemModel> _itemModels;
@ -105,14 +117,49 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
GoodsDetailImagesModel _model;
ProvinceCityModel _overseaCityModel;
ProvinceCityModel _cityModel;
Address _address = Address.empty();
Address _cityAddress = Address.empty();
List<AddressDefaultModel> _addressList = [];
AddressDefaultModel _addressModel;
String _defaltAddress;
int _jDHaveGoods = -1;
@override
bool get wantKeepAlive => true;
@override
void initState() {
super.initState();
Future.delayed(Duration.zero, () async {
_addressList = await _getDefaultAddress();
if(_addressList!=null){
_addressList.forEach((element) {
if(element.isDefault==1)
_addressModel = element;
if(_addressModel!=null){
_defaltAddress = _addressModel.province+_addressModel.city+_addressModel.district;
if(_defaltAddress!=null){
Future.delayed(Duration.zero, () async {
_jDHaveGoods = await HomeDao.getJDStock(widget.goodsId,_defaltAddress);
_jDHaveGoods = 0;
if(_jDHaveGoods!=null){
print(_jDHaveGoods);
}
});
}
}
//
});
}
});
GoodsDetailModelImpl.getDetailImages(widget.goodsId)
.then((GoodsDetailImagesModel model) {
if (model.code != HttpStatus.SUCCESS) {
@ -124,10 +171,19 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
});
_shoppingCartModelImpl = ShoppingCartModelImpl();
widget.openSkuChoosePage.addListener(() {
print(widget.openSkuChoosePage.value);
if (_context != null &&
widget.goodsDetail != null &&
widget.openSkuChoosePage.value) {
_showSkuChoosePage(context);
if(_jDHaveGoods==1){
_showSkuChoosePage(context);
}else{
Toast.showInfo('本地区无货,请选择其他');
widget.openSkuChoosePage.value = false;
}
}
});
}
@ -151,14 +207,12 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
MediaQuery _buildBody(BuildContext context) {
_context = context;
return
MediaQuery.removePadding(
return MediaQuery.removePadding(
key: myGlobals.scaffoldKey,
context: context,
removeTop: true,
child: Stack(
children: [
Container(
color: AppColor.frenchColor,
child: NotificationListener<ScrollUpdateNotification>(
@ -175,15 +229,15 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
children: _detailListWidget(),
),
),
),
widget.goodsDetail.data.living!=null?widget.goodsDetail.data.living.status==1?
OverlayLivingBtnWidget(living: widget.goodsDetail.data.living):SizedBox():SizedBox(),
widget.goodsDetail.data.living != null
? widget.goodsDetail.data.living.status == 1
? OverlayLivingBtnWidget(
living: widget.goodsDetail.data.living)
: SizedBox()
: SizedBox(),
],
)
);
));
}
List<Widget> _detailListWidget() {
@ -382,6 +436,12 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
color: Colors.white,
child: _discountContent(context),
),
widget.gysId==1800||widget.gysId==2000?Container(
margin: EdgeInsets.only(bottom: 13),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
color: Colors.white,
child: _addressContent(context),
):SizedBox(),
widget.goodsDetail.data.storehouse == 2 ||
widget.goodsDetail.data.storehouse == 3
? Container(
@ -439,7 +499,10 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
// images.add(widget.goodsDetail.data.video);
// }
images.addAll(widget.goodsDetail.data.mainPhotos);
return ImagePageView(images: images,living:widget.goodsDetail.data.living,onScrolled: (index) {});
return ImagePageView(
images: images,
living: widget.goodsDetail.data.living,
onScrolled: (index) {});
}
///
@ -471,7 +534,12 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
margin: EdgeInsets.only(top: 10),
child: GestureDetector(
onTap: () {
_showSkuChoosePage(context);
if(_jDHaveGoods==1){
_showSkuChoosePage(context);
}else{
Toast.showInfo('本地区无货,请选择其他');
}
},
child: StatefulBuilder(
builder: (BuildContext context, partSetState) {
@ -510,6 +578,112 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
);
}
_addressContent(BuildContext context) {
return GestureDetector(
onTap: () async {
if (_cityModel == null) {
//final cancel = ReToast.loading();
bool result = await _getCityAddress();
//cancel();
if (result) {
_selectCityAddress(context);
// print(_defaltAddress);
// _jDHaveGoods = await HomeDao.getJDStock(widget.goodsId,_defaltAddress);
}
}else{
_selectCityAddress(context);
}
},
child: Container(
color: Colors.transparent,
child: Column(
children: [
Row(
children: [
Text(
'地址',
style: TextStyle(
color: Color(0xFFA4A4A4),
fontSize: rSP(13),
),
),
Container(
width: 20,
),
_cityModel == null
? _addressModel!=null?
Container(
width: 280.rw,
child: Text(
'${_addressModel.province}-${_addressModel.city}-${_addressModel.district}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF525252),
fontSize: rSP(13),
),
),
):
Text(
'您还没有配置地址',
style: TextStyle(
color: Color(0xFF525252),
fontSize: rSP(13),
),
)
:
Container(
width: 280.rw,
child: Text(
'${_cityAddress.province}-${_cityAddress.city}-${_cityAddress.district}',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Color(0xFF525252),
fontSize: rSP(13),
),
),
),
Spacer(),
Icon(
AppIcons.icon_next,
color: Colors.grey[400],
size: 16 * 2.sp,
),
],
),
Row(
children: [
Container(
width: 46.rw,
),
Text(
_jDHaveGoods==1?'有货':_jDHaveGoods==0?'无货':'',
style: TextStyle(
color: Color(0xFF525252),
fontSize: rSP(13),
),
),
],
),
],
),
),
);
}
_goodsInfoWidget(context) {
return Column(
children: <Widget>[
@ -625,6 +799,11 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
Expanded(
child: Row(
children: <Widget>[
widget.gysId==1800?Text(
"京东仓发货 | ",
style: AppTextStyle.generate(13 * 2.sp,
color: Color(0xff373737)),
):SizedBox(),
Text(
"正品保证",
style: AppTextStyle.generate(13 * 2.sp,
@ -760,6 +939,53 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
return true;
}
Future<bool> _getCityAddress() async {
FileOperationResult result =
await FileUtils.readJSON(AppPaths.path_province_city_json);
if (result.success &&
result.data != null &&
result.data.toString().length > 0) {
_cityModel = ProvinceCityModel.fromJson(json.decode(result.data));
return true;
}
ResultData res = await AddressModelImpl().fetchWholeProvince();
if (!res.result) {
Toast.showError(res.msg);
return false;
}
_cityModel = ProvinceCityModel.fromJson(res.data);
FileUtils.writeJSON(
AppPaths.path_province_city_json, json.encode(res.data));
return true;
}
Future<List<AddressDefaultModel>> _getDefaultAddress() async {
ResultData res = await HttpManager.post(UserApi.address_list, {
"userId":UserManager.instance.user.info.id,
});
if(res!=null){
if(res.data!=null){
print(res.data);
if(res.data["data"]!=null){
print(res.data["data"]);
return (res.data['data'] as List)
.map((e) => AddressDefaultModel.fromJson(e))
.toList();
}else
return null;
}else
return null;
}else
return null;
}
_selectAddress(BuildContext context) {
AddressSelectorHelper.show(
context,
@ -780,6 +1006,37 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
);
}
_selectCityAddress(BuildContext context) {
AddressSelectorHelper.show(
context,
model: _cityModel,
city: _cityAddress.city,
province: _cityAddress.province,
district: _cityAddress.district,
callback: (
String province,
String city,
String district,
) {
_cityAddress.city = city;
_cityAddress.province = province;
_cityAddress.district = district;
_defaltAddress = province+city+district;
Future.delayed(Duration.zero, () async {
_jDHaveGoods = await HomeDao.getJDStock(widget.goodsId,_defaltAddress);
if(_jDHaveGoods!=null){
print(_jDHaveGoods);
}
setState(() {});
});
if(_defaltAddress.length>3){
setState(() {});
}
},
);
}
_buildOverseaCityPicker() {
return GestureDetector(
onTap: () async {
@ -1377,9 +1634,10 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
}
if (skuModel.selectedIndex == 1) {
ReToast.loading(text: '');
if (widget.goodsDetail.data.living.status != 0||widget.goodsDetail.data.living.roomId!=0)
if (widget.goodsDetail.data.living.status != 0 ||
widget.goodsDetail.data.living.roomId != 0)
HttpManager.post(LiveAPI.buyGoodsInform, {
"liveItemId":widget.goodsDetail.data.living.roomId,
"liveItemId": widget.goodsDetail.data.living.roomId,
"goodsId": widget.goodsId,
});
_createOrder(

@ -635,7 +635,7 @@ class _GoodsOrderPageState extends BaseStoreState<GoodsOrderPage> {
_titleRow("商品金额", "",
"${_orderModel.data.goodsTotalAmount.toStringAsFixed(2)}",
rightTitleColor: Colors.black),
_titleRow("运费", "",
_titleRow("合计运费", "",
"+¥${_orderModel.data.expressTotalFee.toStringAsFixed(2)}",
rightTitleColor: Colors.black),
Builder(

@ -1086,7 +1086,7 @@ class _HomePageState extends BaseStoreState<HomePage>
AppConfig.commissionByRoleLevel
? Api.getImgUrl(kingCoinListModelList[6].url)
: Api.getImgUrl(kingCoinListModelList[1].url),
AppConfig.commissionByRoleLevel ? "精彩发现" : "家居生活",
AppConfig.commissionByRoleLevel ? "高佣特推" : "家居生活",
// '彩票兑换',
//2021 7,27 ios
//'精彩发现',
@ -1097,9 +1097,9 @@ class _HomePageState extends BaseStoreState<HomePage>
// UserManager.instance.selectTabbarIndex = 2;
// bool value = UserManager.instance.selectTabbar.value;
// UserManager.instance.selectTabbar.value = !value;
// UserManager.instance.selectTabbar.value = !value;
Get.to(() => ChooseTicketsTypePage());
//Get.to(() => ChooseTicketsTypePage()); //
//setState(() {});
} else {
AppRouter.push(context, RouteName.GOODS_LIST_TEMP,
@ -1129,10 +1129,10 @@ class _HomePageState extends BaseStoreState<HomePage>
: Api.getImgUrl(kingCoinListModelList[2].url),
AppConfig.commissionByRoleLevel
// ? "升级店主"
? "一键邀请"
? "特惠专区"
: "数码家电", onPressed: () {
if (AppConfig.commissionByRoleLevel) {
ShareTool().inviteShare(context, customTitle: Container());
//ShareTool().inviteShare(context, customTitle: Container());
} else {
AppRouter.push(context, RouteName.GOODS_LIST_TEMP,
arguments: GoodsListTempPage.setArguments(

@ -124,13 +124,32 @@ class BrandDetailGridItem extends StatelessWidget {
overflow: TextOverflow.ellipsis,
),
),
goods.gysId==1800||goods.gysId==2000?//jd 1800 pop 2000
Container(
width: 30.rw,
height: 14.rw,
alignment: Alignment.center,
margin: const EdgeInsets.only(
left: 0, right: 0, top: 5, bottom: 5),
decoration: BoxDecoration(
color: Color(0xFFC92219),
borderRadius: BorderRadius.all(Radius.circular(1.rw))
),
child: Text(
goods.gysId==1800?'自营':goods.gysId==2000?'POP':'',
style: TextStyle(height: 1.1),
),
):
TextUtil.isEmpty(this.goods.description)
? SizedBox()
: Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(
left: 0, right: 0, top: 5, bottom: 5),
child: this.goods.description == null
child:
this.goods.description == null
? Container()
: Text(
this.goods.description,
@ -358,7 +377,7 @@ class BrandDetailGridItem extends StatelessWidget {
buyClick();
} else {
AppRouter.push(context, RouteName.COMMODITY_PAGE,
arguments: CommodityDetailPage.setArguments(this.goods.id));
arguments: CommodityDetailPage.setArguments(this.goods.id,gysId: this.goods.gysId));
}
}

@ -0,0 +1,44 @@
class AddressDefaultModel {
int id;
String name;
String mobile;
String province;
String city;
String district;
String address;
int isDefault;
AddressDefaultModel(
{this.id,
this.name,
this.mobile,
this.province,
this.city,
this.district,
this.address,
this.isDefault});
AddressDefaultModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
mobile = json['mobile'];
province = json['province'];
city = json['city'];
district = json['district'];
address = json['address'];
isDefault = json['isDefault'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['mobile'] = this.mobile;
data['province'] = this.province;
data['city'] = this.city;
data['district'] = this.district;
data['address'] = this.address;
data['isDefault'] = this.isDefault;
return data;
}
}

@ -53,8 +53,10 @@ import 'package:recook/widgets/refresh_widget.dart';
class SearchPage extends StatefulWidget {
final int countryId;
final int jdType; //1 jd
const SearchPage({Key key, this.countryId, this.jdType}) : super(key: key);
const SearchPage({Key key, this.countryId}) : super(key: key);
@override
State<StatefulWidget> createState() {
return _SearchPageState();
@ -62,7 +64,7 @@ class SearchPage extends StatefulWidget {
}
class _SearchPageState extends BaseStoreState<SearchPage>
with MvpListViewDelegate<GoodsSimple>,TickerProviderStateMixin{
with MvpListViewDelegate<GoodsSimple>, TickerProviderStateMixin {
String _searchText = "";
FocusNode _contentFocusNode = FocusNode();
@ -77,6 +79,7 @@ class _SearchPageState extends BaseStoreState<SearchPage>
TextEditingController _textEditController;
List<String> _searchHistory = [];
List<bool> _barBool = [false, false, false];
bool _startSearch = false;
SortType _sortType = SortType.comprehensive;
@ -105,8 +108,16 @@ class _SearchPageState extends BaseStoreState<SearchPage>
if (mounted) setState(() {});
}
int _jDType = 0; // 0 1JD 2JD 3JD pop
String _jdTypeText = '全部';
@override
void initState() {
if (widget.jdType == 1) {
_jDType = 1;
_sortType = SortType.priceAsc;
_barBool = [false, false];
}
_gifController = GifController(vsync: this)
..repeat(
min: 0,
@ -121,6 +132,7 @@ class _SearchPageState extends BaseStoreState<SearchPage>
_listViewController = MvpListViewController(controller: _refreshController);
_getPromotionList();
}
@override
void dispose() {
_gifController.dispose();
@ -186,44 +198,97 @@ class _SearchPageState extends BaseStoreState<SearchPage>
controller: _filterController,
height: rSize(40),
fontSize: 13 * 2.sp,
titles: [
FilterItemModel(type: FilterItemType.normal, title: "综合"),
FilterItemModel(type: FilterItemType.double, title: "价格"),
FilterItemModel(type: FilterItemType.double, title: "销量"),
titles: widget.jdType == 1
? [
FilterItemModel(
type: FilterItemType.double,
title: "价格",
selectedList: _barBool),
FilterItemModel(
type: FilterItemType.double,
title: "销量",
selectedList: _barBool),
]
: [
FilterItemModel(
type: FilterItemType.normal,
title: "综合",
selectedList: _barBool),
FilterItemModel(
type: FilterItemType.double,
title: "价格",
selectedList: _barBool),
FilterItemModel(
type: FilterItemType.double,
title: "销量",
selectedList: _barBool),
// FilterItemModel(type: FilterItemType.normal, title: "特卖优先")
],
],
trialing: _displayIcon(),
startWidget: widget.jdType==1? _jdTypeWidget():null,
selectedColor: Theme.of(context).primaryColor,
listener: (index, item) {
if ((index != 1 && index != 2) && _filterIndex == index) {
return;
if (widget.jdType != 1) {
if ((index != 1 && index != 2) && _filterIndex == index) {
return;
}
} else {
if ((index != 1 && index != 2 && index != 0) &&
_filterIndex == index) {
return;
}
}
// if (index != 1 && _filterIndex == index) {
// return;
// }
_filterIndex = index;
switch (index) {
case 0:
_sortType = SortType.comprehensive;
break;
case 1:
if (item.topSelected) {
_sortType = SortType.priceAsc;
} else {
_sortType = SortType.priceDesc;
}
break;
case 2:
if (item.topSelected) {
_sortType = SortType.salesAsc;
} else {
_sortType = SortType.salesDesc;
}
// _sortType = SortType.sales;
break;
if (widget.jdType == 1) {
switch (index) {
case 0:
print(item.topSelected);
if (item.topSelected) {
_sortType = SortType.priceAsc;
} else {
_sortType = SortType.priceDesc;
}
break;
case 1:
print(item.topSelected);
if (item.topSelected) {
_sortType = SortType.salesAsc;
} else {
_sortType = SortType.salesDesc;
}
// _sortType = SortType.sales;
break;
// case 3:
// print("特卖优先");
// break;
}
} else {
switch (index) {
case 0:
_sortType = SortType.comprehensive;
break;
case 1:
if (item.topSelected) {
_sortType = SortType.priceAsc;
} else {
_sortType = SortType.priceDesc;
}
break;
case 2:
if (item.topSelected) {
_sortType = SortType.salesAsc;
} else {
_sortType = SortType.salesDesc;
}
// _sortType = SortType.sales;
break;
// case 3:
// print("特卖优先");
// break;
}
}
// _presenter.fetchList(widget.category.id, 0, _sortType);
// _presenter.fetchList(_category.id, 0, _sortType);
@ -273,6 +338,64 @@ class _SearchPageState extends BaseStoreState<SearchPage>
);
}
Widget _jdTypeWidget() {
return PopupMenuButton(
offset: Offset(0, 10),
color: Colors.white,
child: Row(
children: [
Text(_jdTypeText,
style: TextStyle(
fontSize: 14.rsp,
color: Color(0xFFD5101A),
)),
Icon(
Icons.arrow_drop_down,
color: Color(0xFFD5101A),
),
],
),
onSelected: (String value) {
setState(() {
_jdTypeText = value;
if (value == '全部') {
_jDType = 1;
} else if (value == '京东自营') {
_jDType = 2;
} else if (value == '京东POP') {
_jDType = 3;
}
print(value);
setState(() {});
_listViewController.stopRefresh();
_listViewController.requestRefresh();
});
},
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
PopupMenuItem(
value: "全部",
child: Text("全部",
style: TextStyle(
fontSize: 14.rsp,
color: Color(0xFF333333),
))),
PopupMenuItem(
value: "京东自营",
child: Text("京东自营",
style: TextStyle(
fontSize: 14.rsp,
color: Color(0xFF333333),
))),
PopupMenuItem(
value: "京东POP",
child: Text("京东POP",
style: TextStyle(
fontSize: 14.rsp,
color: Color(0xFF333333),
))),
]);
}
_buildList(BuildContext context) {
return MvpListView<GoodsSimple>(
noDataView: CustomScrollView(
@ -280,68 +403,68 @@ class _SearchPageState extends BaseStoreState<SearchPage>
SliverToBoxAdapter(
child: NoDataView(
title: "换个关键词搜索一下吧~",
height: 300,
),
),
SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.only(top: rSize(40), bottom: rSize(10)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: rSize(2),
color: Color(0xFFB8B8B8),
width: rSize(40),
),
rWBox(10),
Text(
'猜你喜欢',
style: TextStyle(
fontSize: rSP(15),
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
rWBox(10),
Container(
height: rSize(2),
color: Color(0xFFB8B8B8),
width: rSize(40),
),
],
),
),
),
SliverToBoxAdapter(
child: ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
PromotionGoodsModel model = _promotionGoodsList[index];
return Container(
padding: EdgeInsets.only(bottom: 5),
color: AppColor.frenchColor,
child: GoodsItemWidget.rowGoods(
gifController: _gifController,
isSingleDayGoods: false,
onBrandClick: () {
AppRouter.push(context, RouteName.BRANDGOODS_LIST_PAGE,
arguments: BrandGoodsListPage.setArguments(
model.brandId, model.brandName));
},
model: model,
buyClick: () {
AppRouter.push(context, RouteName.COMMODITY_PAGE,
arguments:
CommodityDetailPage.setArguments(model.goodsId));
},
),
);
},
itemCount: _promotionGoodsList.length,
height: 500,
),
),
// SliverToBoxAdapter(
// child: Padding(
// padding: EdgeInsets.only(top: rSize(40), bottom: rSize(10)),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Container(
// height: rSize(2),
// color: Color(0xFFB8B8B8),
// width: rSize(40),
// ),
// rWBox(10),
// Text(
// '猜你喜欢',
// style: TextStyle(
// fontSize: rSP(15),
// fontWeight: FontWeight.bold,
// color: Colors.black87,
// ),
// ),
// rWBox(10),
// Container(
// height: rSize(2),
// color: Color(0xFFB8B8B8),
// width: rSize(40),
// ),
// ],
// ),
// ),
// ),
// SliverToBoxAdapter(
// child: ListView.builder(
// shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(),
// itemBuilder: (context, index) {
// PromotionGoodsModel model = _promotionGoodsList[index];
// return Container(
// padding: EdgeInsets.only(bottom: 5),
// color: AppColor.frenchColor,
// child: GoodsItemWidget.rowGoods(
// gifController: _gifController,
// isSingleDayGoods: false,
// onBrandClick: () {
// AppRouter.push(context, RouteName.BRANDGOODS_LIST_PAGE,
// arguments: BrandGoodsListPage.setArguments(
// model.brandId, model.brandName));
// },
// model: model,
// buyClick: () {
// AppRouter.push(context, RouteName.COMMODITY_PAGE,
// arguments:
// CommodityDetailPage.setArguments(model.goodsId));
// },
// ),
// );
// },
// itemCount: _promotionGoodsList.length,
// ),
// ),
],
),
autoRefresh: false,
@ -358,13 +481,8 @@ class _SearchPageState extends BaseStoreState<SearchPage>
// _searchText,
// 0,
// );
_presenter.fetchList(
-99,
0,
_sortType,
widget.countryId,
keyword: _searchText,
);
_presenter.fetchList(-99, 0, _sortType, widget.countryId,
keyword: _searchText, JDType: _jDType);
},
loadMoreCallback: (int page) {
// _presenter.fetchSearchList(
@ -377,6 +495,7 @@ class _SearchPageState extends BaseStoreState<SearchPage>
_sortType,
widget.countryId,
keyword: _searchText,
JDType: _jDType,
onLoadDone: () {
Future.delayed(Duration(milliseconds: 100), () {
if (mounted) setState(() {});
@ -392,6 +511,7 @@ class _SearchPageState extends BaseStoreState<SearchPage>
List<Promotion> _promotionList = [];
List<dynamic> _promotionGoodsList = [];
_getPromotionList() async {
ResultData resultData = await HttpManager.post(HomeApi.promotion_list, {});
@ -479,7 +599,7 @@ class _SearchPageState extends BaseStoreState<SearchPage>
// ? BrandDetailListItem(goods: goods)
// ? NormalGoodsItem(model: goods, buildCtx: context,)
? GoodsItemWidget.normalGoodsItem(
gifController: _gifController,
gifController: _gifController,
onBrandClick: () {
AppRouter.push(
context, RouteName.BRANDGOODS_LIST_PAGE,
@ -488,6 +608,7 @@ class _SearchPageState extends BaseStoreState<SearchPage>
},
buildCtx: context,
model: goods,
type: widget.jdType == 1?3:0,
)
: BrandDetailGridItem(goods: goods));
},
@ -586,12 +707,12 @@ class _SearchPageState extends BaseStoreState<SearchPage>
// ? BrandDetailListItem(goods: goods)
// ? NormalGoodsItem(model: goods, buildCtx: context,)
? GoodsItemWidget.normalGoodsItem(
gifController: GifController(vsync: this)
..repeat(
min: 0,
max: 20,
period: Duration(milliseconds: 700),
),
gifController: GifController(vsync: this)
..repeat(
min: 0,
max: 20,
period: Duration(milliseconds: 700),
),
onBrandClick: () {
AppRouter.push(context, RouteName.BRANDGOODS_LIST_PAGE,
arguments: BrandGoodsListPage.setArguments(
@ -621,6 +742,7 @@ class _SearchPageState extends BaseStoreState<SearchPage>
_sortType,
widget.countryId,
keyword: _searchText,
JDType: _jDType,
);
cancel();
_startSearch = true;

@ -15,7 +15,7 @@ import 'package:recook/pages/home/classify/commodity_detail_page.dart';
import 'package:recook/utils/app_router.dart';
import 'package:recook/widgets/goods_item.dart';
enum GoodsListTempType { recookMake, homeAppliances, homeLife }
enum GoodsListTempType { recookMake, homeAppliances, homeLife ,highCommission,preferential }//
class GoodsListTempPage extends StatefulWidget {
final Map arguments;

@ -401,6 +401,7 @@ class _FilterToolBarState extends State<FilterToolBar>
if (widget.startWidget != null) {
items.add(SizedBox(width: 30.rw,));
items.add(widget.startWidget);
items.add(SizedBox(width: 10.rw,));
}
items.addAll(_buildToolBarItem());
if (widget.trialing != null) {
@ -459,9 +460,14 @@ class _FilterToolBarState extends State<FilterToolBar>
///
if (item.type == FilterItemType.double) {
if (widget.controller.selectedIndex != index) {
item.topSelected = true;
item.selectedList[index] = true;
item.topSelected = item.selectedList[index];
} else {
item.topSelected = !item.topSelected;
//print(item.topSelected);
//item.topSelected = !item.topSelected;
// print(widget.titles[index].topSelected);
item.selectedList[index] = ! item.selectedList[index];
item.topSelected = item.selectedList[index];
}
widget.listener(index, item);
}
@ -486,7 +492,7 @@ class _FilterToolBarState extends State<FilterToolBar>
style: AppTextStyle.generate(widget.fontSize,
color: color, fontWeight: FontWeight.w400),
),
_buildArrow(item, color, selected)
_buildArrow(item, color, selected,index)
],
),
),
@ -495,7 +501,7 @@ class _FilterToolBarState extends State<FilterToolBar>
}).toList();
}
_buildArrow(FilterItemModel item, color, bool selected) {
_buildArrow(FilterItemModel item, color, bool selected,int index) {
if (item.type == FilterItemType.list) {
return Icon(
selected
@ -512,7 +518,7 @@ class _FilterToolBarState extends State<FilterToolBar>
return Padding(
padding: const EdgeInsets.only(left: 2.0),
child: Icon(
item.topSelected ? AppIcons.icon_top : AppIcons.icon_down,
item.selectedList[index] ? AppIcons.icon_top : AppIcons.icon_down,
size: 7,
color: color,
),
@ -561,15 +567,17 @@ class FilterItemModel {
///
final List<String> subtitleShort;
List<bool> selectedList;
bool topSelected;
int selectedSubIndex = 0;
FilterItemModel({
@required this.type,
@required this.title,
this.selectedList,
this.subtitles,
this.subtitleShort,
this.topSelected = true,
this.topSelected = true,
}) : assert(
type == FilterItemType.list
? (subtitles != null && subtitles.length > 0)

@ -60,11 +60,13 @@ class GoodsItemWidget extends StatelessWidget {
// model.getPromotionStatus()
final PromotionStatus promotionStatus;
final Function onBrandClick;
final int type; //type = 4
final int type; //type = 4 type = 3
final String countryIcon;
final Living living;
final GifController gifController;
final num gysId;
const GoodsItemWidget({
Key key,
@ -93,7 +95,7 @@ class GoodsItemWidget extends StatelessWidget {
this.specialIcon,
this.type,
this.countryIcon,
this.living, this.gifController,
this.living, this.gifController, this.gysId,
//this.special_sale,
}) : widgetType = GoodsItemType.NONE,
super(key: key);
@ -131,6 +133,7 @@ class GoodsItemWidget extends StatelessWidget {
specialIcon = model.specialIcon,
countryIcon = model.countryIcon,
living = model.living,
gysId = model.gysId,
super(key: key);
///Hot List
@ -146,7 +149,7 @@ class GoodsItemWidget extends StatelessWidget {
this.specialSale,
this.specialIcon,
this.type,
this.living, this.gifController,
this.living, this.gifController, this.gysId,
}) : goodsName = data.goodsName,
brandName = data.brandName,
brandPictureUrl = data.brandImg,
@ -178,7 +181,7 @@ class GoodsItemWidget extends StatelessWidget {
@required this.buyClick,
PromotionGoodsModel model,
this.notShowAmount = false,
this.type, this.gifController,
this.type, this.gifController, this.gysId,
}) : goodsName = model.goodsName,
brandName = model.brandName,
brandPictureUrl = model.brandImg,
@ -213,7 +216,7 @@ class GoodsItemWidget extends StatelessWidget {
this.notShowAmount = false,
this.specialSale,
this.type, this.gifController, this.inventory, this.originalPrice, this.percent, this.coupon, this.commission, this.isImport, this.specialIcon, this.promotionStatus, this.living,
this.type, this.gifController, this.inventory, this.originalPrice, this.percent, this.coupon, this.commission, this.isImport, this.specialIcon, this.promotionStatus, this.living, this.gysId,
//this.special_sale,
}) : goodsName = model.goodsName,
brandName = model.brandName,
@ -399,9 +402,26 @@ class GoodsItemWidget extends StatelessWidget {
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 2),
child: this.description == null
child:
gysId==1800||gysId==2000?//jd 1800 pop 2000
Container(
width: 30.rw,
height: 14.rw,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFC92219),
borderRadius: BorderRadius.all(Radius.circular(1.rw))
),
child: Text(
gysId==1800?'自营':gysId==2000?'POP':'',
style: TextStyle(height: 1.1),
),
):
this.description == null
? Container()
: Text(
:
Text(
this.description,
maxLines: 1,
overflow: TextOverflow.ellipsis,
@ -467,25 +487,25 @@ class GoodsItemWidget extends StatelessWidget {
),
),
//
// Positioned(
// top: 0,
// right: 0,
// left: 0,
// bottom: 0,
// child: Offstage(
// offstage: this.inventory > 0,
// child: Container(
// color: Colors.black38,
// child: Center(
// child: Image.asset(
// 'assets/sellout_bg.png',
// width: rSize(70),
// height: rSize(70),
// ),
// ),
// ),
// ),
// ),
Positioned(
top: 0,
right: 0,
left: 0,
bottom: 0,
child: Offstage(
offstage: this.inventory > 0,
child: Container(
color: Colors.black38,
child: Center(
child: Image.asset(
'assets/sellout_bg.png',
width: rSize(70),
height: rSize(70),
),
),
),
),
),
living?.status == 1
? Positioned(
top: 6.rw,
@ -601,7 +621,7 @@ class GoodsItemWidget extends StatelessWidget {
_inventoryView() {
//
//bool sellout = this.inventory <= 0;
bool sellout = this.inventory <= 0;
Color priceColor = Color(0xffc70404);
return Container(
height: 20 * 2.h,
@ -738,8 +758,8 @@ class GoodsItemWidget extends StatelessWidget {
direction: Direction.horizontal,
height: 21,
//
//title: sellout ? "已售完" : "自购",
title: "自购",
title: sellout ? "已售完" : "自购",
style: TextStyle(
color: Colors.white,
fontSize: 13 * 2.sp,
@ -769,8 +789,8 @@ class GoodsItemWidget extends StatelessWidget {
// bottomRight: Radius.circular(40)),
backgroundColor:
//
//sellout ? AppColor.greyColor : _shareTextColor,
_shareTextColor,
sellout ? AppColor.greyColor : _shareTextColor,
pureDisplay: true,
),
onTap: () {
@ -970,6 +990,7 @@ class GoodsItemWidget extends StatelessWidget {
AppRouter.push(buildCtx, RouteName.COMMODITY_PAGE,
arguments: CommodityDetailPage.setArguments(
this.id,
gysId: gysId,
// liveStatus: living == null ? null : living.status,
// roomId: living == null ? null : living.roomId
));

Loading…
Cancel
Save