yinds 4 giorni fa
parent
commit
728df23a8b

+ 12 - 11
app/src/main/java/com/hw/nativeapp/ui/activity/PaymentMethodActivity.java

@@ -35,6 +35,7 @@ import com.hw.nativeapp.utils.ActivityUtils;
 import com.hw.nativeapp.utils.ImageUtils;
 import com.hw.nativeapp.utils.MaskUtil;
 import com.hw.nativeapp.utils.RxUtil;
+import com.hw.nativeapp.utils.StringUtils;
 import com.squareup.picasso.Picasso;
 
 import butterknife.BindView;
@@ -51,6 +52,9 @@ public class PaymentMethodActivity extends BaseActivity  {
 
     @BindView(R.id.wechat_pay)
     ImageView wechat_pay;
+    @BindView(R.id.tx_totalAmount)
+    TextView tx_totalAmount;
+
 
 
     private int isPage = 0;
@@ -89,7 +93,8 @@ public class PaymentMethodActivity extends BaseActivity  {
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_payment_method);
-        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
+        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                WindowManager.LayoutParams.FLAG_FULLSCREEN);
     }
     @Override
     protected void onStart() {
@@ -129,8 +134,12 @@ public class PaymentMethodActivity extends BaseActivity  {
         total = transmitIntent.getStringExtra("total");
         totalPeice = transmitIntent.getStringExtra("totalPeice");
         viewerList = JSONArray.parseArray(transmitIntent.getStringExtra("viewerList"));
+        if (!StringUtils.isEmpty(totalPeice)){
+            tx_totalAmount.setText("¥" + totalPeice);
+        }
     }
     // 订单支付
+    @SuppressLint("CheckResult")
     private void getGotoNativePay(){
         JSONObject options = new JSONObject();
         options.put("orderId", orderId);
@@ -144,16 +153,6 @@ public class PaymentMethodActivity extends BaseActivity  {
                             //微信支付
                             Bitmap weiEQ = ImageUtils.createQRImage(payInfo, 500, 500);
                             wechat_pay.setImageBitmap(weiEQ);
-//                            String payType = "alipay";
-//                            if(payType.equals("alipay")){
-//                                //支付宝支付
-//
-//                            } else {
-//                                //微信支付
-//                                Bitmap weiEQ = ImageUtils.createQRImage(payInfo, 600, 600);
-//                                wechat_pay.setImageBitmap(weiEQ);
-//                            }
-                            // 开始循环查询订单状态
                             orderCountDownTimer();
                         }
                     }
@@ -165,6 +164,7 @@ public class PaymentMethodActivity extends BaseActivity  {
                 }, new ErrorConsumer());
     }
     // 订单支付
+    @SuppressLint("CheckResult")
     private void getPayQuery(){
         JSONObject options = new  JSONObject();
         options.put("orderId", orderId);
@@ -215,6 +215,7 @@ public class PaymentMethodActivity extends BaseActivity  {
         }
     };
     // 扫码订单支付
+    @SuppressLint("CheckResult")
     private void gotoMicroPay(String authCode){
         JSONObject options = new JSONObject();
         options.put("orderId", orderId);

+ 11 - 0
app/src/main/res/layout/activity_payment_method.xml

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -129,6 +130,16 @@
                                         android:textColor="@color/black"
                                         android:textFontWeight="800"
                                         android:textSize="@dimen/inedx_btn_size" />
+
+                                    <TextView
+                                        android:id="@+id/tx_totalAmount"
+                                        android:layout_width="wrap_content"
+                                        android:layout_height="wrap_content"
+                                        android:gravity="center"
+                                        tools:text="¥33.0"
+                                        android:layout_marginStart="10sp"
+                                        android:textColor="@color/red"
+                                        android:textSize="@dimen/inedx_btn_size" />
                                 </LinearLayout>
                             </LinearLayout>
                         </LinearLayout>