|
...
|
...
|
@@ -23,10 +23,13 @@ import 'package:one_key/widgets/round_button.dart'; |
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
|
|
|
|
|
|
|
|
class IfNeedCreateStore extends StatefulWidget {
|
|
|
|
final List<CheckSellerAccSunModel> data;
|
|
|
|
IfNeedCreateStore({Key key, this.data}) : super(key: key);
|
|
|
|
final bool changeStatus;
|
|
|
|
IfNeedCreateStore({Key key, this.data, this.changeStatus = false})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_IfNeedCreateStoreState createState() => _IfNeedCreateStoreState();
|
|
...
|
...
|
@@ -122,183 +125,211 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> |
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
otherLoginProvider = Provider.of<OtherLoginProvider>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'',
|
|
|
|
// leftTitle: '上一步',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Container(
|
|
|
|
// margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(40)),
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(70)),
|
|
|
|
child: Consumer<OtherLoginProvider>(builder: (context, model, _) {
|
|
|
|
if (model.pageState != PageState.Success) {
|
|
|
|
if (model.pageState == PageState.Empty) {
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
|
|
|
|
child:
|
|
|
|
Column(crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
return WillPopScope(
|
|
|
|
onWillPop: () async {
|
|
|
|
if (widget.changeStatus) {
|
|
|
|
EventBus().emit('changeStatusColor');
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
child: Scaffold(
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'',
|
|
|
|
// leftTitle: '上一步',
|
|
|
|
onTap: () {
|
|
|
|
if (widget.changeStatus) {
|
|
|
|
EventBus().emit('changeStatusColor');
|
|
|
|
}
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Container(
|
|
|
|
// margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(40)),
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(70)),
|
|
|
|
child:
|
|
|
|
Consumer<OtherLoginProvider>(builder: (context, model, _) {
|
|
|
|
if (model.pageState != PageState.Success) {
|
|
|
|
if (model.pageState == PageState.Empty) {
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
VEmptyView(80),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('not_member'),
|
|
|
|
width: ScreenUtil().setWidth(120),
|
|
|
|
height: ScreenUtil().setWidth(120),
|
|
|
|
),
|
|
|
|
VEmptyView(60),
|
|
|
|
Text(
|
|
|
|
'您还没有绑定任何店铺',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
VEmptyView(172),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// if (!App.sp.containsKey('openid') ||
|
|
|
|
// App.sp.get("openid") == null ||
|
|
|
|
// App.sp.get("openid") == '') {
|
|
|
|
//跳转小程序
|
|
|
|
Utils.goMiniProgramCreatePage(context);
|
|
|
|
// } else {
|
|
|
|
// //跳转至新建店铺流程
|
|
|
|
// NavigatorUtil.goEnterStoreNamePage(context);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
vertical: ScreenUtil().setWidth(18)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_24A4A8,
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(10))),
|
|
|
|
child: Text(
|
|
|
|
'创建店铺',
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(34)),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageState,
|
|
|
|
callback: () {
|
|
|
|
_checkSellerAcc(showLoading: true);
|
|
|
|
},
|
|
|
|
emptyMsg: "",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(40),
|
|
|
|
Text(
|
|
|
|
'请选择您要进入的店铺',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setWidth(32),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
VEmptyView(100),
|
|
|
|
Expanded(
|
|
|
|
child: GridView.builder(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(50)),
|
|
|
|
// controller: widget.scrollController,
|
|
|
|
// padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: model.sellerList.length + 1,
|
|
|
|
cacheExtent: ScreenUtil().setWidth(197 * 2),
|
|
|
|
//SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
|
|
|
|
gridDelegate:
|
|
|
|
SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
//横轴元素个数
|
|
|
|
crossAxisCount: 2,
|
|
|
|
//纵轴间距
|
|
|
|
mainAxisSpacing: ScreenUtil().setWidth(50),
|
|
|
|
//横轴间距
|
|
|
|
crossAxisSpacing: ScreenUtil().setWidth(50),
|
|
|
|
//子组件宽高长度比例
|
|
|
|
childAspectRatio: 140 / 197),
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
if (index == model.sellerList.length) {
|
|
|
|
return InkWell(
|
|
|
|
VEmptyView(80),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('not_member'),
|
|
|
|
width: ScreenUtil().setWidth(120),
|
|
|
|
height: ScreenUtil().setWidth(120),
|
|
|
|
),
|
|
|
|
VEmptyView(60),
|
|
|
|
Text(
|
|
|
|
'您还没有绑定任何店铺',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
VEmptyView(172),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// if (!App.sp.containsKey('openid') ||
|
|
|
|
// App.sp.get("openid") == null ||
|
|
|
|
// App.sp.get("openid") == '') {
|
|
|
|
// //跳转小程序
|
|
|
|
// Utils.goMiniProgramCreatePage(context);
|
|
|
|
//跳转小程序
|
|
|
|
Utils.goMiniProgramCreatePage(context);
|
|
|
|
// } else {
|
|
|
|
//跳转至新建店铺流程
|
|
|
|
NavigatorUtil.goEnterStoreNamePage(
|
|
|
|
context);
|
|
|
|
// //跳转至新建店铺流程
|
|
|
|
// NavigatorUtil.goEnterStoreNamePage(context);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
child: DottedBorder(
|
|
|
|
dashPattern: [5, 5, 5, 5],
|
|
|
|
borderType: BorderType.RRect,
|
|
|
|
radius: Radius.circular(
|
|
|
|
ScreenUtil().setWidth(10)),
|
|
|
|
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
color: MyColours.color_cccccc,
|
|
|
|
strokeWidth: ScreenUtil().setWidth(2),
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(12)),
|
|
|
|
child: Container(
|
|
|
|
height:
|
|
|
|
ScreenUtil().setWidth(197 * 2),
|
|
|
|
width: ScreenUtil().setWidth(140 * 2),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('add_store'),
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(32)),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text(
|
|
|
|
'创建店铺',
|
|
|
|
style: TextStyle(
|
|
|
|
color:
|
|
|
|
MyColours.color_999999,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(24)),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
vertical: ScreenUtil().setWidth(18)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_24A4A8,
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(10))),
|
|
|
|
child: Text(
|
|
|
|
'创建店铺',
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(34)),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
_loginStore(context, model.sellerList[index]);
|
|
|
|
},
|
|
|
|
child: IfNeedCreateStoreItem(
|
|
|
|
model: model.sellerList[index]),
|
|
|
|
);
|
|
|
|
})),
|
|
|
|
// VEmptyView(40),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})));
|
|
|
|
)),
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageState,
|
|
|
|
callback: () {
|
|
|
|
_checkSellerAcc(showLoading: true);
|
|
|
|
},
|
|
|
|
emptyMsg: "",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(40),
|
|
|
|
Text(
|
|
|
|
'请选择您要进入的店铺',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setWidth(32),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
VEmptyView(100),
|
|
|
|
Expanded(
|
|
|
|
child: GridView.builder(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(50)),
|
|
|
|
// controller: widget.scrollController,
|
|
|
|
// padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: model.sellerList.length + 1,
|
|
|
|
cacheExtent: ScreenUtil().setWidth(197 * 2),
|
|
|
|
//SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
|
|
|
|
gridDelegate:
|
|
|
|
SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
//横轴元素个数
|
|
|
|
crossAxisCount: 2,
|
|
|
|
//纵轴间距
|
|
|
|
mainAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(50),
|
|
|
|
//横轴间距
|
|
|
|
crossAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(50),
|
|
|
|
//子组件宽高长度比例
|
|
|
|
childAspectRatio: 140 / 197),
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
if (index == model.sellerList.length) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// if (!App.sp.containsKey('openid') ||
|
|
|
|
// App.sp.get("openid") == null ||
|
|
|
|
// App.sp.get("openid") == '') {
|
|
|
|
// //跳转小程序
|
|
|
|
// Utils.goMiniProgramCreatePage(context);
|
|
|
|
// } else {
|
|
|
|
//跳转至新建店铺流程
|
|
|
|
NavigatorUtil.goEnterStoreNamePage(
|
|
|
|
context);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
child: DottedBorder(
|
|
|
|
dashPattern: [5, 5, 5, 5],
|
|
|
|
borderType: BorderType.RRect,
|
|
|
|
radius: Radius.circular(
|
|
|
|
ScreenUtil().setWidth(10)),
|
|
|
|
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
color: MyColours.color_cccccc,
|
|
|
|
strokeWidth: ScreenUtil().setWidth(2),
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(12)),
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil()
|
|
|
|
.setWidth(197 * 2),
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(140 * 2),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
'add_store'),
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(32)),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text(
|
|
|
|
'创建店铺',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours
|
|
|
|
.color_999999,
|
|
|
|
fontSize: ScreenUtil()
|
|
|
|
.setSp(24)),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
return InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
UserModel userModel =
|
|
|
|
Provider.of<UserModel>(context,
|
|
|
|
listen: false);
|
|
|
|
bool success = await userModel
|
|
|
|
.loginOutOnly(context, {
|
|
|
|
"seller_code":
|
|
|
|
userModel.user.sellercode,
|
|
|
|
"account": userModel.user.account
|
|
|
|
});
|
|
|
|
if (success) {
|
|
|
|
_loginStore(
|
|
|
|
context, model.sellerList[index]);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: IfNeedCreateStoreItem(
|
|
|
|
model: model.sellerList[index]),
|
|
|
|
);
|
|
|
|
})),
|
|
|
|
// VEmptyView(40),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}))));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|