|
|
|
@ -1,17 +1,24 @@
|
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
|
|
|
|
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; |
|
|
|
|
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; |
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/store/scan.dart'; |
|
|
|
|
import 'package:huixiang/utils/location.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/store.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/border_text.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/item_title.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/request_permission.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
|
import 'package:permission_handler/permission_handler.dart'; |
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
|
|
class QuickOrder extends StatefulWidget { |
|
|
|
@ -168,14 +175,18 @@ class _QuickOrder extends State<QuickOrder> {
|
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/store_order', |
|
|
|
|
arguments: { |
|
|
|
|
"id": storeList[position].id, |
|
|
|
|
"tenant": storeList[position].tenantCode, |
|
|
|
|
"storeName": storeList[position].storeName |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
if (storeList[position].posType.code == "NORMALSTORE") { |
|
|
|
|
showDeleteDialog(); |
|
|
|
|
} else { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/store_order', |
|
|
|
|
arguments: { |
|
|
|
|
"id": storeList[position].id, |
|
|
|
|
"tenant": storeList[position].tenantCode, |
|
|
|
|
"storeName": storeList[position].storeName |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
child: storeItem(storeList[position],position), |
|
|
|
|
); |
|
|
|
@ -254,22 +265,23 @@ class _QuickOrder extends State<QuickOrder> {
|
|
|
|
|
errorSrc: "assets/image/default_1.png", |
|
|
|
|
fadeSrc: "assets/image/default_1.png", |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
Padding(padding: EdgeInsets.only(left: 10,right: 10),child:Text( |
|
|
|
|
store.storeName, |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontSize: 13.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Colors.black, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
store?.remark ??"", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF868686), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
// Text( |
|
|
|
|
// store?.remark ??"", |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize: 10.sp, |
|
|
|
|
// fontWeight: MyFontWeight.medium, |
|
|
|
|
// color: Color(0xFF868686), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 5, |
|
|
|
|
), |
|
|
|
@ -281,4 +293,122 @@ class _QuickOrder extends State<QuickOrder> {
|
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///扫码提示弹窗 |
|
|
|
|
showDeleteDialog() { |
|
|
|
|
showDialog( |
|
|
|
|
context: context, |
|
|
|
|
builder: (context) { |
|
|
|
|
return AlertDialog( |
|
|
|
|
content: Container( |
|
|
|
|
width: MediaQuery.of(context).size.width - 84, |
|
|
|
|
height: 110.h, |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
"您即将进行扫码点餐", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 17.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
color: Colors.black, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 30.h, |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: InkWell( |
|
|
|
|
child: BorderText( |
|
|
|
|
text: "取消", |
|
|
|
|
textColor: Color(0xFF32A060), |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
borderColor: Color(0xFF32A060), |
|
|
|
|
radius: 4, |
|
|
|
|
padding: EdgeInsets.all(12), |
|
|
|
|
borderWidth: 1, |
|
|
|
|
), |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
flex: 1, |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 16.w, |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: InkWell( |
|
|
|
|
child: RoundButton( |
|
|
|
|
text: "确定", |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
radius: 4, |
|
|
|
|
padding: EdgeInsets.all(12), |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
), |
|
|
|
|
onTap: () { |
|
|
|
|
toScan(); |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
flex: 1, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///扫码 |
|
|
|
|
toScan() async { |
|
|
|
|
if (await Permission.camera.isPermanentlyDenied) { |
|
|
|
|
showCupertinoDialog( |
|
|
|
|
context: context, |
|
|
|
|
builder: (context) { |
|
|
|
|
return RequestPermission( |
|
|
|
|
"assets/image/icon_camera_permission_tips.png", |
|
|
|
|
S.of(context).ninxiangjiquanxianweikaiqi, |
|
|
|
|
S.of(context).weilekaipaizhaoxuanzhetouxiang, |
|
|
|
|
S.of(context).kaiqiquanxian, |
|
|
|
|
(result) async { |
|
|
|
|
if (result) { |
|
|
|
|
await openAppSettings(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
heightRatioWithWidth: 0.82, |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
} else if (await Permission.camera.isGranted) { |
|
|
|
|
// http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512 |
|
|
|
|
var result = await Navigator.of(context).pushNamed('/router/qr_scan'); |
|
|
|
|
// String result = await scanner.scan(); |
|
|
|
|
Uri uri = Uri.parse(result); |
|
|
|
|
String tableId = uri.queryParameters["tableId"]; |
|
|
|
|
String tenantCode = uri.queryParameters["tenantCode"]; |
|
|
|
|
String shopId = uri.queryParameters["shopId"]; |
|
|
|
|
if (tableId != null && tableId != "" && tenantCode != null && tenantCode != "" && shopId != null && shopId != "") { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/store_order', |
|
|
|
|
arguments: { |
|
|
|
|
"id": shopId, |
|
|
|
|
"tenant": tenantCode, |
|
|
|
|
"storeName": "", |
|
|
|
|
"tableId": int.tryParse(tableId), |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
await Permission.camera.request(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|