Browse Source

safety

master
fmk 3 years ago
parent
commit
cb9a6a91ba
  1. 6
      lib/retrofit/data/findMiNiGroupList.dart
  2. 12
      lib/retrofit/min_api.dart
  3. 8
      lib/retrofit/retrofit_api.dart
  4. 30
      lib/store/store_order.dart
  5. 16
      lib/store/store_view/store_order_list.dart
  6. 1
      lib/union/union_page.dart

6
lib/retrofit/data/findMiNiGroupList.dart

@ -15,7 +15,7 @@ class FindMiNiGroupList {
List<ProductListBean> productList; List<ProductListBean> productList;
dynamic productPageVO; dynamic productPageVO;
static FindMiNiGroupList fromMap(Map<String, dynamic> map) { static FindMiNiGroupList fromJson(Map<String, dynamic> map) {
if (map == null) return null; if (map == null) return null;
FindMiNiGroupList findMiNiGroupListBean = FindMiNiGroupList(); FindMiNiGroupList findMiNiGroupListBean = FindMiNiGroupList();
findMiNiGroupListBean.id = map['id']; findMiNiGroupListBean.id = map['id'];
@ -24,7 +24,7 @@ class FindMiNiGroupList {
findMiNiGroupListBean.groupImg = map['groupImg']; findMiNiGroupListBean.groupImg = map['groupImg'];
findMiNiGroupListBean.sort = map['sort']; findMiNiGroupListBean.sort = map['sort'];
findMiNiGroupListBean.productList = List()..addAll( findMiNiGroupListBean.productList = List()..addAll(
(map['productList'] as List ?? []).map((o) => ProductListBean.fromMap(o)) (map['productList'] as List ?? []).map((o) => ProductListBean.fromJson(o))
); );
findMiNiGroupListBean.productPageVO = map['productPageVO']; findMiNiGroupListBean.productPageVO = map['productPageVO'];
return findMiNiGroupListBean; return findMiNiGroupListBean;
@ -100,7 +100,7 @@ class ProductListBean {
String printerFlag; String printerFlag;
dynamic markProductNone; dynamic markProductNone;
static ProductListBean fromMap(Map<String, dynamic> map) { static ProductListBean fromJson(Map<String, dynamic> map) {
if (map == null) return null; if (map == null) return null;
ProductListBean productListBean = ProductListBean(); ProductListBean productListBean = ProductListBean();
productListBean.id = map['id']; productListBean.id = map['id'];

12
lib/retrofit/min_api.dart

@ -18,8 +18,8 @@ part 'min_api.g.dart';
// const base_url = "https://pos.platform.lotus-wallet.com/app/"; /// // const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; /// // const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
const base_url = "http://192.168.10.236:8766/app/"; /// const base_url = "http://192.168.10.236:8765/app/"; ///
const baseUrl = "http://192.168.10.236:8766/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/";
@ -31,17 +31,21 @@ abstract class MinApiService {
String baseUrl, String baseUrl,
BuildContext context, BuildContext context,
String token, String token,
String tenant,
bool showLoading = true, bool showLoading = true,
bool pay = false, bool pay = false,
}) { }) {
Map<String, dynamic> headers = Map<String, dynamic> headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"}; (token == null || token == "") ? {} : {'token': "Bearer $token"};
if (tenant != null && tenant != "") {
headers["tenant"] = tenant;
}
if (pay) { if (pay) {
headers["Environment"] = "app"; headers["Environment"] = "app";
} }
dio.options = BaseOptions( dio.options = BaseOptions(
connectTimeout: 60000, connectTimeout: 10000,
receiveTimeout: 60000, receiveTimeout: 10000,
headers: headers, headers: headers,
responseType: ResponseType.json, responseType: ResponseType.json,
); );

8
lib/retrofit/retrofit_api.dart

@ -37,11 +37,11 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.dart'; part 'retrofit_api.g.dart';
const base_url = "https://pos.platform.lotus-wallet.com/app/"; /// // const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; /// // const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
// 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/";

30
lib/store/store_order.dart

@ -8,6 +8,7 @@ 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/order_info.dart'; import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/data/user_entity.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/store_view/store_activity.dart'; import 'package:huixiang/store/store_view/store_activity.dart';
@ -63,7 +64,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
StoreOrderListPage( StoreOrderListPage(
widget.arguments, widget.activitys, storeInfo, controller), widget.arguments, widget.activitys, storeInfo, controller),
///, ///,
StoreActivity( StoreActivity(
widget.arguments, widget.arguments,
@ -74,27 +74,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
queryStoreInfo(); queryStoreInfo();
} }
///
minLogin() {
apiService
.minLogin(widget.arguments["id"])
.catchError((onError) {})
.then((baseData) {
if (baseData != null && baseData.isSuccess) {
UserEntity userEntity = UserEntity.fromJson(baseData.data);
String minToken = userEntity.token;
SharedPreferences.getInstance().then((value) => {
value.setString('minToken', minToken),
});
minService = MinApiService(
Dio(),
context: context,
token: minToken,
);
}
});
}
/// ///
queryStoreInfo() async { queryStoreInfo() async {
final SharedPreferences value = await SharedPreferences.getInstance(); final SharedPreferences value = await SharedPreferences.getInstance();
@ -104,8 +83,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
token: value.getString('token'), token: value.getString('token'),
); );
minLogin();
BaseData baseData = await apiService BaseData baseData = await apiService
.queryStoreInfo(widget.arguments["id"]) .queryStoreInfo(widget.arguments["id"])
.catchError((error) { .catchError((error) {
@ -243,7 +220,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
], ],
), ),
), ),
backgroundColor: Color(0xFFFAFAFA), backgroundColor: Color(0x33FAFAFA),
centerTitle: false, centerTitle: false,
elevation: 0, elevation: 0,
bottom: PreferredSize( bottom: PreferredSize(
@ -548,7 +525,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
); );
} }
Widget shoppGoodsItem() { Widget shoppGoodsItem(ProductList pro, position) {
return Container( return Container(
padding: EdgeInsets.only(bottom: 10), padding: EdgeInsets.only(bottom: 10),
child: Row( child: Row(
@ -698,6 +675,7 @@ class _Title extends State<Title> {
} }
if (alpha != alphatemp && mounted) { if (alpha != alphatemp && mounted) {
alpha = alphatemp; alpha = alphatemp;
print("object: $alpha");
setState(() {}); setState(() {});
} }
}); });

16
lib/store/store_view/store_order_list.dart

@ -79,15 +79,18 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
apiService.minLogin(widget.arguments["id"]) apiService.minLogin(widget.arguments["id"])
.catchError((onError){}).then((baseData) { .catchError((onError){}).then((baseData) {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
UserEntity userEntity = UserEntity.fromJson(baseData.data); Map<String, dynamic> minStoreInfo = baseData.data;
String minToken = userEntity.token; String minToken = minStoreInfo["token"];
String tenant = widget.arguments["tenant"];
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
value.setString('minToken', minToken), value.setString('minToken', minToken),
value.setString('tenant', tenant),
}); });
minService = MinApiService( minService = MinApiService(
Dio(), Dio(),
context: context, context: context,
token: minToken, token: minToken,
tenant: tenant,
); );
appletGoods(); appletGoods();
} }
@ -115,17 +118,18 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h),
margin: EdgeInsets.only(top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight)),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Container( Container(
width: 100.w, width: 100.w,
height: MediaQuery.of(context).size.height,
child: ListView.builder( child: ListView.builder(
itemCount: appletProducts == null ? 0 : appletProducts.length, itemCount: appletProducts == null ? 0 : appletProducts.length,
controller: widget.controller, controller: controller1,
padding: EdgeInsets.zero,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return orderItem(appletProducts[position],position); return orderItem(appletProducts[position],position);
}, },
@ -136,6 +140,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
child: ListView.builder( child: ListView.builder(
itemCount: productListBeans == null ? 0 : productListBeans.length, itemCount: productListBeans == null ? 0 : productListBeans.length,
// controller: widget.controller, // controller: widget.controller,
padding: EdgeInsets.zero,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return goodsItem(productListBeans[position], position); return goodsItem(productListBeans[position], position);
}, },
@ -151,7 +156,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
Widget orderItem(FindMiNiGroupList findMiNiGroupList,int index) { Widget orderItem(FindMiNiGroupList findMiNiGroupList,int index) {
return Container( return Container(
padding: EdgeInsets.only(top:100.h),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,

1
lib/union/union_page.dart

@ -279,6 +279,7 @@ class _UnionPage extends State<UnionPage>
'/router/store_order', '/router/store_order',
arguments: { arguments: {
"id": storeList[position].id, "id": storeList[position].id,
"tenant": storeList[position].tenantCode,
"storeName": storeList[position].storeName "storeName": storeList[position].storeName
}, },
); );

Loading…
Cancel
Save