|
|
@@ -20,6 +20,7 @@ import { cryptoFramework } from '@kit.CryptoArchitectureKit';
|
|
|
import json from '@ohos.util.json';
|
|
|
import UserUtil, { VipFeature, VipPlanApi, VipPlanListApiResponse, WeChatPrepayId } from '../common/util/UserUtil';
|
|
|
import { Utility } from '../common/util/Utility';
|
|
|
+import { pinyin4js } from '@ohos/pinyin4js';
|
|
|
|
|
|
|
|
|
// 微信支付相关工具方法
|
|
|
@@ -144,6 +145,7 @@ export struct UserCenter {
|
|
|
@StorageProp('themeColor') themeColor: string = CommonConstants.DEFAULT_THEME_COLOR;
|
|
|
@State isDarkMode: boolean = false
|
|
|
@State webUrl: string = CommonConstants.NEW_MEMBER_AGREEMENTS
|
|
|
+ @State appName:string = ''
|
|
|
@StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
|
|
|
@StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
|
|
|
ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
|
|
|
@@ -243,6 +245,9 @@ export struct UserCenter {
|
|
|
.padding(16)
|
|
|
}
|
|
|
aboutToAppear(): void {
|
|
|
+ Utility.getAppName(getContext(this)).then((appName:string)=>{
|
|
|
+ this.appName = appName
|
|
|
+ })
|
|
|
this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
|
|
|
let themeColor = PreferencesUtil.getStringSync('THEME_COLOR', CommonConstants.DEFAULT_THEME_COLOR);
|
|
|
this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
|
|
|
@@ -1003,7 +1008,7 @@ export struct UserCenter {
|
|
|
const appName = PreferencesUtil.getStringSync('appName', 'TTMusic');
|
|
|
hilog.info(0x0000, 'UserCenter', `doWxPay: current this.userId is ${this.userId}`);
|
|
|
const prepayId = await createWeChatOrder(CommonConstants.WX_PAY_APPID, CommonConstants.WX_PAY_MCHID,
|
|
|
- appName, Number(plan.price) * 100, CommonConstants.OUT_TRADE_NO_PRE, this.userId, plan.id);
|
|
|
+ appName, Number(plan.price) * 100, pinyin4js.getShortPinyin(this.appName), this.userId, plan.id);
|
|
|
if (prepayId) {
|
|
|
await this.wechatPay(prepayId);
|
|
|
} else {
|