feat:首字母查询、医院支付方、扫一扫支付

This commit is contained in:
dzc committed 2025-08-13 19:05:55 +08:00
1 parent 9c6585e245
commit c2707899db
19 files changed
+102 -20

No files matched your search

@@ -1,5 +1,6 @@
import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
import 'package:pinyin/pinyin.dart';
import 'package:pj_supermarket_cloud/common/index.dart';
@@ -382,6 +383,11 @@ abstract class SyncProductTool {
updateTime: DateTime.now(),
delFlag: false,
);
// 计算一下拼音
final productNamePy = await transitionPy(item.productName);
if (ObjectUtil.isNotEmpty(productNamePy)) {
item.productNamePy = productNamePy;
}
if (isUpdate) {
final detail = await productDao.getByCode(item.serviceUniqueCode);
if (ObjectUtil.isEmpty(detail)) continue;
@@ -475,4 +481,20 @@ abstract class SyncProductTool {
// **************************************************************************
// 同步食堂商品 spu end
// **************************************************************************
// 中文转拼音
static Future<String?> transitionPy(String str) async {
try {
if (ObjectUtil.isEmpty(str)) return "";
// 尝试转换为数字,如果是数字,返回空
if (double.tryParse(str) != null) return "";
final py = PinyinHelper.getShortPinyin(str);
logger.d("|$_tag|中文转拼音|中文:|$str|转换到拼音:|$py|");
// 去除所有空格
final pyNoSpace = py.replaceAll(" ", "");
return pyNoSpace;
} catch (error, stack) {
logger.e("|$_tag|添加超市spu detail 错误error:|$error|stack:|$stack|");
}
}
}