needcode 2 ani în urmă
părinte
comite
ea924942ba
2 a modificat fișierele cu 8 adăugiri și 11 ștergeri
  1. 4 11
      src/api/user.ts
  2. 4 0
      src/pages-user/profile/profile.vue

+ 4 - 11
src/api/user.ts

@@ -66,14 +66,7 @@ declare const wx: any;
 
 export function insertMoney(amount: number) {
   return userHttp
-    .post<{
-      appId: string;
-      nonceStr: string;
-      package: string;
-      paySign: string;
-      signType: string;
-      timestamp: string;
-    }>("/payment/pay", {
+    .post("/payment/wxPay", {
       data: {
         amount: parseInt(`${amount * 100}`),
         openid: getApp<any>().globalData.user.openid,
@@ -83,10 +76,10 @@ export function insertMoney(amount: number) {
       return new Promise((resolve, reject) => {
         // #ifdef MP-WEIXIN
         wx.requestPayment({
-          timeStamp: res.timestamp,
+          timeStamp: `${res.timestamp}`,
           nonceStr: res.nonceStr,
-          package: res.package,
-          signType: "MD5",
+          package: res.packageVal,
+          signType: res.signType,
           paySign: res.paySign,
           success(res: any) {
             resolve(res);

+ 4 - 0
src/pages-user/profile/profile.vue

@@ -128,6 +128,10 @@ const chooseAvatar = (e: any) => {
         })
           .then(() => {
             uni.hideLoading();
+            uni.showToast({
+              title: '已更新',
+              icon: 'success'
+            });
             avatar.value = res.url;
           })
           .catch((err) => {