Browse Source

会员码页面优化;

选套餐待解决
wr_2023_new_business_new
wurong 4 months ago
parent
commit
667f31c7e8
  1. 44
      lib/mine/vip_pay_code.dart
  2. 9
      lib/retrofit/data/miNiDetail.dart
  3. 11
      lib/store/shop_details_page.dart
  4. 1086
      lib/store/store_view/product_meals_sku.dart
  5. 2
      lib/store/store_view/shop_goods.dart
  6. 1
      lib/store/store_view/store_order_list.dart

44
lib/mine/vip_pay_code.dart

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
@ -27,7 +28,9 @@ class _VipPayCode extends State<VipPayCode> {
@override
void dispose() {
super.dispose();
refreshController.dispose();
refreshController?.dispose();
_timer?.cancel();
isDispose = true;
}
@override
@ -44,40 +47,47 @@ class _VipPayCode extends State<VipPayCode> {
///
queryUser() async {
try{
SharedPreferences value = await SharedPreferences.getInstance();
SharedPreferences prefs;
try {
prefs = await SharedPreferences.getInstance();
if (prefs.getString("bannerData") != null) {
userInfo = UserInfo.fromJson(jsonDecode(prefs.getString('userInfo')));
setState(() {});
}
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
token: prefs.getString("token"),
showLoading: true
);
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {
refreshController.refreshFailed();});
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
userInfo = baseData.data;
SharedPreferences.getInstance().then((value) => {
value.setString('user', jsonEncode(baseData.data)),
});
prefs.setString('userInfo', jsonEncode(baseData.data));
setState(() {});
refreshController.refreshCompleted();
}else{
} else {
refreshController.refreshFailed();
}
}finally{
} finally {
refreshCode();
EasyLoading.dismiss();
}
}
refreshCode(){
if (_timer != null) return;
const oneSec = const Duration(minutes: 2);
var callback = ((timer) {
if (isDispose) return;
_timer = Timer.periodic(oneSec, (timer) {
if (isDispose) {
timer.cancel();
return;
}
queryUser();
});
_timer = Timer.periodic(oneSec, callback);
}
@override
@ -132,9 +142,7 @@ class _VipPayCode extends State<VipPayCode> {
),
SizedBox(height: 30.h,),
QrImage(
data: userInfo != null
? (userInfo?.vipScanNo ?? "")
: "",
data:userInfo?.vipScanNo ?? "622868c3c2c5a02508ed7064c7c27387a1c2c0cb2052ba344d82266a64feb1cfc75014532616b2fb179024c83a6066757cf2639efca8f2731c54a24859e200ca",
version: QrVersions.auto,
size: 200.w,
gapless: true,

9
lib/retrofit/data/miNiDetail.dart

@ -416,6 +416,7 @@ class ProductSetMeals {
int _totalNumber;
int _optionalNumber;
List<ProductInfoList> _productInfoList;
int checkIndex = 0;
ProductSetMeals copyWith({
String groupName,
@ -686,16 +687,19 @@ class SkuInfoList {
SkuInfoList({
String id,
String skuName,
String skuPrice,
List<ProductSkuAttrList> productSkuAttrList,
}) {
_id = id;
_skuName = skuName;
_skuPrice = skuPrice;
_productSkuAttrList = productSkuAttrList;
}
SkuInfoList.fromJson(dynamic json) {
_id = json['id'];
_skuName = json['skuName'];
_skuPrice = json['skuPrice'];
if (json['productSkuAttrList'] != null) {
_productSkuAttrList = [];
json['productSkuAttrList'].forEach((v) {
@ -706,17 +710,20 @@ class SkuInfoList {
String _id;
String _skuName;
String _skuPrice;
bool _isSelected = false;
List<ProductSkuAttrList> _productSkuAttrList;
SkuInfoList copyWith({
String id,
String skuName,
String skuPrice,
List<ProductSkuAttrList> productSkuAttrList,
}) =>
SkuInfoList(
id: id ?? _id,
skuName: skuName ?? _skuName,
skuPrice: skuPrice ?? _skuPrice,
productSkuAttrList: productSkuAttrList ?? _productSkuAttrList,
);
@ -724,6 +731,8 @@ class SkuInfoList {
String get skuName => _skuName;
String get skuPrice => _skuPrice;
List<ProductSkuAttrList> get productSkuAttrList => _productSkuAttrList;
bool get isSelected => _isSelected;

11
lib/store/shop_details_page.dart

@ -77,13 +77,13 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
GlobalKey _key = GlobalKey();
Offset _endOffset;
double rightOffset = 23.0;
int _jumpType = -1;
@override
void initState() {
super.initState();
id = widget.arguments["id"];
storeId = widget.arguments["storeId"];
isSetMeal = widget.arguments["isSetMeal"] ?? false;
scrollController.addListener(() {
if(scIndex == 0 && scrollController.offset > (MediaQuery.of(context).size.height >= 750 ? 392.h : 400.h)){
setState(() {
@ -206,6 +206,11 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
miNiDetail = baseData.data;
miNiDetail.attrList.forEach((element) {
selectSkus.add(element.attrValueList[0].attrValue);
if (baseData.data.productSkuVOList[0].productSetMeals.length == 0) {
_jumpType = 0;
} else {
_jumpType = 1;
}
});
});
SharedPreferences.getInstance().then(
@ -944,7 +949,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (storeInfo.posType.code == "NORMALSTORE" &&
tableId == 0) {
showDeleteDialog();
} else if (isSetMeal == true) {
} else if (_jumpType == 1) {
await Navigator.of(context).pushNamed(
'/router/product_meals_sku',
arguments: {
@ -1111,7 +1116,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (storeInfo.posType.code == "NORMALSTORE" &&
tableId == 0) {
showDeleteDialog();
} else if (isSetMeal == true) {
} else if (_jumpType == 1) {
await Navigator.of(context).pushNamed(
'/router/product_meals_sku',
arguments: {

1086
lib/store/store_view/product_meals_sku.dart

File diff suppressed because it is too large Load Diff

2
lib/store/store_view/shop_goods.dart

@ -430,6 +430,7 @@ class _ShopGoods extends State<ShopGoods> {
// SmartDialog.showToast("库存不足",
// alignment: Alignment.center);
// } else
if(_jumpType != 1){
/// widget overlayEntry
var _overlayEntry = OverlayEntry(builder: (_) {
RenderBox box = context.findRenderObject();
@ -446,6 +447,7 @@ class _ShopGoods extends State<ShopGoods> {
_overlayEntry.remove();
_overlayEntry = null;
});
}
if (_jumpType == -1)
queryMiNiDetail(widget.productListBean.id);
else if (_jumpType == 0)

1
lib/store/store_view/store_order_list.dart

@ -213,7 +213,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
.pushNamed('/router/shop_details_page', arguments: {
"id": e.id,
"storeId": e.storeId,
"isSetMeal":e.isSetMeal,
"minQty":e.minQty,
});
widget.queryShoppingCart();

Loading…
Cancel
Save