Bläddra i källkod

观影人改造

yinds 4 dagar sedan
förälder
incheckning
46bcb0c063

+ 4 - 0
app/src/main/java/com/hw/nativeapp/httpnet/entity/SeatGoodsEntity.java

@@ -19,4 +19,8 @@ public class SeatGoodsEntity {
      * 座位类型库存
      */
     public String stockNum;
+    /**
+     * 商品包含人数
+     */
+    public Integer personnelNum;
 }

+ 7 - 0
app/src/main/java/com/hw/nativeapp/httpnet/entity/TouristEntity.java

@@ -0,0 +1,7 @@
+package com.hw.nativeapp.httpnet.entity;
+
+public class TouristEntity {
+
+    public String name;
+    public String idcard;
+}

+ 27 - 15
app/src/main/java/com/hw/nativeapp/ui/activity/InfoInputActivity.java

@@ -89,13 +89,14 @@ public class InfoInputActivity extends BaseActivity  {
             }
         });
         getPageTransmitParams();
-        startCountDownTimer();
+
     }
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_info_input);
-        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
+        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                WindowManager.LayoutParams.FLAG_FULLSCREEN);
         //1 屏蔽掉系统默认输入法
         et_idcard.setInputType(InputType.TYPE_NULL);
 
@@ -122,10 +123,18 @@ public class InfoInputActivity extends BaseActivity  {
     public void onClick(View v){
         switch (v.getId()){
             case R.id.input_btn:
-                factorAuth();
+//                factorAuth();
+                successFu();
                 break;
         }
     }
+
+    @Override
+    protected void onStart() {
+        super.onStart();
+        startCountDownTimer();
+    }
+
     //获取页面传递参数
     private void getPageTransmitParams(){
         Intent transmitIntent = getIntent();
@@ -151,22 +160,25 @@ public class InfoInputActivity extends BaseActivity  {
     private void stopCountDownTimer(){
         if (timer != null){
             timer.cancel();
+            timer = null;
         }
     }
     private void startCountDownTimer(){
-        timer = new CountDownTimer(COUNTDOWN_TIME, 1000) {
-            @SuppressLint("SetTextI18n")
-            @Override
-            public void onTick(long millisUntilFinished) {
-                titleBar.setRightTitle(millisUntilFinished / 1000 + "s");
-            }
+        if (timer == null){
+            timer = new CountDownTimer(COUNTDOWN_TIME, 1000) {
+                @SuppressLint("SetTextI18n")
+                @Override
+                public void onTick(long millisUntilFinished) {
+                    titleBar.setRightTitle(millisUntilFinished / 1000 + "s");
+                }
 
-            @Override
-            public void onFinish() {
-                jumpToLogin();
-            }
-        };
-        timer.start();
+                @Override
+                public void onFinish() {
+                    jumpToLogin();
+                }
+            };
+            timer.start();
+        }
     }
 
     // 二要数认证

+ 138 - 90
app/src/main/java/com/hw/nativeapp/ui/activity/PurchaseInfoActivity.java

@@ -10,6 +10,7 @@ import android.util.Log;
 import android.view.Gravity;
 import android.view.View;
 import android.view.WindowManager;
+import android.widget.EditText;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -20,7 +21,6 @@ import androidx.recyclerview.widget.RecyclerView;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.blankj.utilcode.util.ToastUtils;
 import com.hjq.bar.OnTitleBarListener;
 import com.hjq.bar.TitleBar;
 import com.hw.nativeapp.MApplication;
@@ -28,16 +28,21 @@ import com.hw.nativeapp.R;
 import com.hw.nativeapp.httpnet.ErrorConsumer;
 import com.hw.nativeapp.httpnet.ResponseConsumer;
 import com.hw.nativeapp.httpnet.entity.PageAsk;
+import com.hw.nativeapp.httpnet.entity.TouristEntity;
 import com.hw.nativeapp.httpnet.entity.handleBean;
 import com.hw.nativeapp.ui.activity.adapters.PurchaseInfoAdapter;
 import com.hw.nativeapp.ui.activity.adapters.TicketCollectionAdapter;
 import com.hw.nativeapp.utils.ActivityUtils;
+import com.hw.nativeapp.utils.IdNumberUtils;
 import com.hw.nativeapp.utils.MaskUtil;
 import com.hw.nativeapp.utils.RxUtil;
+import com.hw.nativeapp.utils.StringUtils;
+import com.hw.nativeapp.utils.ToastUtils;
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
 import com.scwang.smartrefresh.layout.header.ClassicsHeader;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -58,8 +63,16 @@ public class PurchaseInfoActivity extends BaseActivity  {
     TextView tx_num;
     @BindView(R.id.tx_total)
     TextView tx_total;
-
-    public static final Integer COUNTDOWN_TIME = 120000;
+    @BindView(R.id.et_tourist_name)
+    EditText touristName;
+    @BindView(R.id.et_tourist_idcard)
+    EditText touristIdcard;
+    @BindView(R.id.tx_player)
+    TextView tx_player;
+    @BindView(R.id.tx_personnelNum)
+    TextView tx_personnelNum;
+
+    public static final Integer COUNTDOWN_TIME = 240000;
     private CountDownTimer timer;
     private TitleBar titleBar;
 
@@ -74,6 +87,8 @@ public class PurchaseInfoActivity extends BaseActivity  {
     private String auditoriumId = "";
     private String date = "";
     private String goodsId = "";
+    private Integer personnelNum = 1;
+    private Integer goodsSaleNum = 1;
     private String salePeice = "";
     private String performTimeId = "";
     private String seatTypeId = "";
@@ -82,9 +97,9 @@ public class PurchaseInfoActivity extends BaseActivity  {
     private String total = "";
     private String totalPeice = "";
     private String idcard = "";
-    private JSONArray viewerList = new JSONArray();
 
-    private JSONArray dataList = new JSONArray();
+    private List<TouristEntity> touristList = new ArrayList<>();
+
     @Override
     void initView() {
         titleBar = findViewById(R.id.tb_main_bar);
@@ -109,7 +124,7 @@ public class PurchaseInfoActivity extends BaseActivity  {
         getPageTransmitParams();
         initListView();
         getDataList(true);;
-        startCountDownTimer();
+
     }
 
 
@@ -117,12 +132,14 @@ public class PurchaseInfoActivity extends BaseActivity  {
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_purchase_info);
-        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
+        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                WindowManager.LayoutParams.FLAG_FULLSCREEN);
     }
 
     @Override
     protected void onStart() {
         super.onStart();
+        startCountDownTimer();
     }
 
     @Override
@@ -130,19 +147,50 @@ public class PurchaseInfoActivity extends BaseActivity  {
         super.onDestroy();
     }
 
-    @OnClick({R.id.determine_btn, R.id.continue_btn})
+    @OnClick({R.id.determine_btn, R.id.ll_add_tourist})
     public void onClick(View v){
         switch (v.getId()){
             case R.id.determine_btn:
                 orderSubmit();
                 break;
-            case R.id.continue_btn:
-                jumpPage();
+            case R.id.ll_add_tourist:
+                addTourist();
                 break;
         }
     }
+
+    private void addTourist(){
+        String name = touristName.getText().toString();
+        String idcard = touristIdcard.getText().toString();
+        if (StringUtils.isEmpty(name)){
+            ToastUtils.showShortToast(this, "用户姓名为空");
+            return;
+        }
+        if (StringUtils.isEmpty(idcard)){
+            ToastUtils.showShortToast(this, "身份证信息为空");
+            return;
+        }
+        if (!IdNumberUtils.isValidatedAllIdcard(idcard)){
+            ToastUtils.showShortToast(this, "身份证格式错误");
+            return;
+        }
+        TouristEntity touristEntity = new TouristEntity();
+        touristEntity.name = name;
+        touristEntity.idcard = idcard;
+        touristList.add(touristEntity);
+
+        initLoadData();
+        touristName.setText("");
+        touristIdcard.setText("");
+    }
+
     // 订单提交
+    @SuppressLint("CheckResult")
     private void orderSubmit(){
+        if (touristList.isEmpty()){
+            ToastUtils.showLongToast(this, "提交观影人信息为空");
+            return;
+        }
         JSONObject options = new  JSONObject();
         options.put("performId", performId);
         options.put("auditoriumId", auditoriumId);
@@ -150,50 +198,42 @@ public class PurchaseInfoActivity extends BaseActivity  {
         options.put("seatTypeId", seatTypeId);
         options.put("source", "8");
         options.put("channelType", "self");
-        options.put("totalPrice", Double.valueOf(salePeice) * viewerList.size());
-
 
         //观影人信息
         List<JSONObject> tourists = new ArrayList<>();
-        for (Object obj : viewerList){
-            JSONObject objJson = (JSONObject) obj;
+        for (TouristEntity obj : touristList){
             JSONObject touristItem = new JSONObject();
             touristItem.put("realType", 1);
-            touristItem.put("name", objJson.getString("name"));
+            touristItem.put("name", obj.name);
             touristItem.put("mobile", mMobile);
-            touristItem.put("idcard", objJson.getString("idcard"));
+            touristItem.put("idcard", obj.idcard);
             tourists.add(touristItem);
         }
 
+        //观影人数量
+        int touristNum = touristList.size();
+        //需要的观影人数量
+        int needTouristNum = goodsSaleNum * personnelNum;
+        if (touristNum < needTouristNum){
+            ToastUtils.showLongToast(this, "订单需要观影人数与提交不符");
+            return;
+        }
         // 商品列表
         JSONArray goodsList = new  JSONArray();
         JSONObject goods = new  JSONObject();
         goods.put("goodsId", goodsId);
-        goods.put("saleNum", tourists.size());
+        goods.put("saleNum", goodsSaleNum);
         goods.put("tourists", tourists);
         goodsList.add(goods);
         options.put("goodsList", goodsList);
 
         // 购票人信息
         JSONObject purchaser = new  JSONObject();
-        purchaser.put("name", name);
-        purchaser.put("idcard", idcard);
+        purchaser.put("name", touristList.get(0).name);
+        purchaser.put("idcard", touristList.get(0).idcard);
         purchaser.put("mobile", mMobile);
         options.put("purchaser", purchaser);
 
-        // 观影人列表
-//        JSONArray viewerList1 = new  JSONArray();
-//        if(viewerList != null && viewerList.size() > 0){
-//            for (int i = 0; i < viewerList.size(); i++) {
-//                JSONObject viewer = new  JSONObject();
-//                viewer.put("name", viewerList.getJSONObject(i).getString("name"));
-//                viewer.put("idcard", viewerList.getJSONObject(i).getString("idcard"));
-//                viewer.put("salePrice", salePeice);
-//                viewer.put("realPrice", salePeice);
-//                viewerList1.add(viewer);
-//            }
-//        }
-//        options.put("viewerList", viewerList1);
         progressDialog = MaskUtil.showProgressDialog( "正在提交...", PurchaseInfoActivity.this);
         new Handler().postDelayed(() -> {
             if(progressDialog != null){
@@ -231,25 +271,25 @@ public class PurchaseInfoActivity extends BaseActivity  {
         bundle.putString("idcard", idcard);
         bundle.putString("total", total);
         bundle.putString("totalPeice", totalPeice);
-        bundle.putString("viewerList", JSONArray.toJSONString(viewerList));
+        bundle.putString("viewerList", JSONArray.toJSONString(touristList));
         ActivityUtils.launchActivity(this,PaymentMethodActivity.class, bundle);
     }
     // 继续添加观影人
-    private void jumpPage () {
-        Bundle bundle = new Bundle();
-        bundle.putString("performId", performId);
-        bundle.putString("auditoriumId", auditoriumId);
-        bundle.putString("performTimeId", performTimeId);
-        bundle.putString("seatTypeId", seatTypeId);
-        bundle.putString("goodsId", goodsId);
-        bundle.putString("mobile", mMobile);
-        bundle.putString("salePeice", salePeice);
-        bundle.putString("type", "2");
-        bundle.putString("name", name);
-        bundle.putString("idcard", idcard);
-        bundle.putString("viewerList", JSONArray.toJSONString(viewerList));
-        ActivityUtils.launchActivity(this,InfoInputActivity.class, bundle);
-    }
+//    private void jumpPage () {
+//        Bundle bundle = new Bundle();
+//        bundle.putString("performId", performId);
+//        bundle.putString("auditoriumId", auditoriumId);
+//        bundle.putString("performTimeId", performTimeId);
+//        bundle.putString("seatTypeId", seatTypeId);
+//        bundle.putString("goodsId", goodsId);
+//        bundle.putString("mobile", mMobile);
+//        bundle.putString("salePeice", salePeice);
+//        bundle.putString("type", "2");
+//        bundle.putString("name", name);
+//        bundle.putString("idcard", idcard);
+//        bundle.putString("viewerList", JSONArray.toJSONString(touristList));
+//        ActivityUtils.launchActivity(this,InfoInputActivity.class, bundle);
+//    }
     //获取页面传递参数
     private void getPageTransmitParams(){
         Intent transmitIntent = getIntent();
@@ -257,13 +297,15 @@ public class PurchaseInfoActivity extends BaseActivity  {
         mMobile = transmitIntent.getStringExtra("mobile");
         auditoriumId = transmitIntent.getStringExtra("auditoriumId");
         goodsId = transmitIntent.getStringExtra("goodsId");
+        personnelNum = transmitIntent.getIntExtra("personnelNum",1);
         salePeice = transmitIntent.getStringExtra("salePeice");
         performTimeId = transmitIntent.getStringExtra("performTimeId");
         seatTypeId = transmitIntent.getStringExtra("seatTypeId");
         type = transmitIntent.getStringExtra("type");
-        name = transmitIntent.getStringExtra("name");
-        idcard = transmitIntent.getStringExtra("idcard");
-        viewerList = JSONArray.parseArray(transmitIntent.getStringExtra("viewerList"));
+        if (!StringUtils.isEmpty(mMobile)){
+            tx_player.setText(mMobile);
+        }
+        tx_personnelNum.setText(String.valueOf(personnelNum));
     }
 
     private void reflashFinish(){
@@ -282,16 +324,11 @@ public class PurchaseInfoActivity extends BaseActivity  {
         adapter = new PurchaseInfoAdapter(this);
 
         adapter.setOnOutBtnClickListerer((bean, position) -> {
-            if(viewerList.size() > 1) {
-                viewerList.remove(position);
+            if(touristList.size() > 1) {
+                touristList.remove(position);
                 initLoadData();
             } else {
-//                Toast.makeText(this, "至少保留一个观影人", Toast.LENGTH_SHORT).show();
-                ToastUtils Toast = new ToastUtils();
-                Toast.setGravity(Gravity.TOP, 0, 200);
-                Toast.setTextSize(32);
-                Toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
-                Toast.show("至少保留一个观影人");
+                ToastUtils.showShortToast(this, "至少保留一个观影人");
             }
         });
 
@@ -317,21 +354,36 @@ public class PurchaseInfoActivity extends BaseActivity  {
 
     private void getDataList(boolean cleaned){
         JSONArray rows = new  JSONArray();
-        if(viewerList != null && viewerList.size() > 0) {
-            for (int i = 0; i < viewerList.size(); i++) {
+        if(!touristList.isEmpty()) {
+            int index = 1;
+            for (TouristEntity t : touristList){
                 JSONObject obj1 =  new JSONObject();
-                obj1.put("id", i+1);
-                obj1.put("name", viewerList.getJSONObject(i).getString("name"));
-                obj1.put("idcard", viewerList.getJSONObject(i).getString("idcard"));
+                obj1.put("id", index);
+                obj1.put("name", t.name);
+                obj1.put("idcard", t.idcard);
                 rows.add(obj1);
+                index++;
             }
         }
-        dataList = rows;
-        tx_num.setText("共" + rows.size() + "张, 合计");
-        tx_total.setText("¥" + (rows.size() * Double.valueOf(salePeice)));
-        total = String.valueOf(rows.size());
-        totalPeice = String.valueOf(rows.size() * Double.valueOf(salePeice));
-        if (rows != null && !rows.isEmpty()){
+        int touristNum = touristList.size();
+        //除数
+        int divisorNum = touristNum/personnelNum;
+        //余数
+        int remainderNum = touristNum%personnelNum;
+        //购买商品数量
+        goodsSaleNum = divisorNum;
+        if (personnelNum > 1 && remainderNum > 0){
+            goodsSaleNum += 1;
+        }
+
+        BigDecimal saleAmount = new BigDecimal(salePeice);
+        BigDecimal totalAmount = saleAmount.multiply(BigDecimal.valueOf(goodsSaleNum));
+        tx_num.setText("共" + touristNum + "人, 累计");
+        tx_total.setText("¥" + totalAmount);
+
+        total = String.valueOf(touristNum);
+        totalPeice = String.valueOf(totalAmount);
+        if (!rows.isEmpty()){
             List<handleBean> rowbeans = JSONArray.parseArray(JSON.toJSONString(rows), handleBean.class);
             reflashLoadData(rowbeans, cleaned);
             emptyShow(false);
@@ -353,13 +405,6 @@ public class PurchaseInfoActivity extends BaseActivity  {
 
     }
 
-    private void pageHandle(int total, int page, int pageCount){
-        if (pageAsk.pageNum <= pageCount){
-            pageAsk.pageNum++;
-        }
-        pageAsk.pageCount = pageCount;
-        pageAsk.total = total;
-    }
     private void reflashLoadData(List<handleBean> rows, boolean cleared){
         if (adapter == null){
             return;
@@ -378,22 +423,25 @@ public class PurchaseInfoActivity extends BaseActivity  {
     private void stopCountDownTimer(){
         if (timer != null){
             timer.cancel();
+            timer = null;
         }
     }
     private void startCountDownTimer(){
-        timer = new CountDownTimer(COUNTDOWN_TIME, 1000) {
-            @SuppressLint("SetTextI18n")
-            @Override
-            public void onTick(long millisUntilFinished) {
-                titleBar.setRightTitle(millisUntilFinished / 1000 + "s");
-            }
-
-            @Override
-            public void onFinish() {
-                jumpToLogin();
-            }
-        };
-        timer.start();
+        if (timer == null){
+            timer = new CountDownTimer(COUNTDOWN_TIME, 1000) {
+                @SuppressLint("SetTextI18n")
+                @Override
+                public void onTick(long millisUntilFinished) {
+                    titleBar.setRightTitle(millisUntilFinished / 1000 + "s");
+                }
+
+                @Override
+                public void onFinish() {
+                    jumpToLogin();
+                }
+            };
+            timer.start();
+        }
     }
 
 }

+ 65 - 21
app/src/main/java/com/hw/nativeapp/ui/activity/SelectV2InfoActivity.java

@@ -75,6 +75,8 @@ public class SelectV2InfoActivity extends BaseActivity  {
     private String seatTypeId = "";
     private Boolean btnStatus = false;
 
+    private SeatGoodsEntity selectGoodsItem;
+
     private JSONObject auditorium = new JSONObject();
 
     @Override
@@ -98,7 +100,7 @@ public class SelectV2InfoActivity extends BaseActivity  {
             }
         });
         getPageTransmitParams();
-        startCountDownTimer();
+
         getPerform();
     }
     //获取页面传递参数
@@ -113,6 +115,12 @@ public class SelectV2InfoActivity extends BaseActivity  {
         getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
     }
 
+    @Override
+    protected void onStart() {
+        super.onStart();
+        startCountDownTimer();
+    }
+
     @OnClick({R.id.select_btn})
     public void onClick(View v){
         switch (v.getId()){
@@ -126,7 +134,7 @@ public class SelectV2InfoActivity extends BaseActivity  {
                                     ToastUtils.showShortToast(this, "手机号号码格式不正确");
                                 }else {
                                     dialog.dismiss();
-                                    jumpInput(mobile);
+                                    jumpInputList(mobile);
                                 }
 
                             })
@@ -138,25 +146,52 @@ public class SelectV2InfoActivity extends BaseActivity  {
         }
     }
 
-    private void jumpInput(String mobile){
+//    private void jumpInput(String mobile){
+//        if (StringUtils.isEmpty(mobile)){
+//            ToastUtils.showShortToast(this, "输入的手机号为空");
+//            return;
+//        }
+//        Bundle bundle = new Bundle();
+//        if(performId.isEmpty()||auditoriumId.isEmpty()||performTimeId.isEmpty()||seatTypeId.isEmpty()||goodsId.isEmpty()||salePeice.isEmpty()){
+//            ToastUtils.showShortToast(this, "提交数据不完整,请重新进入!");
+//            return;
+//        }
+//        bundle.putString("performId", performId);
+//        bundle.putString("auditoriumId", auditoriumId);
+//        bundle.putString("performTimeId", performTimeId);
+//        bundle.putString("seatTypeId", seatTypeId);
+//        bundle.putString("goodsId", goodsId);
+//        bundle.putString("salePeice", salePeice);
+//        bundle.putString("type", "1");
+//        bundle.putString("mobile", mobile);
+//        ActivityUtils.launchActivity(this, InfoInputActivity.class, bundle);
+//    }
+
+    private void jumpInputList (String mobile) {
         if (StringUtils.isEmpty(mobile)){
             ToastUtils.showShortToast(this, "输入的手机号为空");
             return;
         }
         Bundle bundle = new Bundle();
-        if(performId.isEmpty()||auditoriumId.isEmpty()||performTimeId.isEmpty()||seatTypeId.isEmpty()||goodsId.isEmpty()||salePeice.isEmpty()){
+        if(performId.isEmpty()||auditoriumId.isEmpty()||
+                performTimeId.isEmpty()||seatTypeId.isEmpty()||
+                goodsId.isEmpty()||salePeice.isEmpty()){
             ToastUtils.showShortToast(this, "提交数据不完整,请重新进入!");
             return;
         }
+        if (selectGoodsItem == null){
+            ToastUtils.showShortToast(this, "选择商品数据错误!");
+            return;
+        }
         bundle.putString("performId", performId);
         bundle.putString("auditoriumId", auditoriumId);
         bundle.putString("performTimeId", performTimeId);
         bundle.putString("seatTypeId", seatTypeId);
-        bundle.putString("goodsId", goodsId);
-        bundle.putString("salePeice", salePeice);
-        bundle.putString("type", "1");
+        bundle.putString("goodsId", selectGoodsItem.goodsId);
+        bundle.putInt("personnelNum", selectGoodsItem.personnelNum);
+        bundle.putString("salePeice", selectGoodsItem.salePrice);
         bundle.putString("mobile", mobile);
-        ActivityUtils.launchActivity(this, InfoInputActivity.class, bundle);
+        ActivityUtils.launchActivity(this,PurchaseInfoActivity.class, bundle);
     }
 
     // 获取演艺厅信息
@@ -288,22 +323,26 @@ public class SelectV2InfoActivity extends BaseActivity  {
     private void stopCountDownTimer(){
         if (timer != null){
             timer.cancel();
+            timer = null;
         }
     }
     private void startCountDownTimer(){
-        timer = new CountDownTimer(COUNTDOWN_TIME, 1000) {
-            @SuppressLint("SetTextI18n")
-            @Override
-            public void onTick(long millisUntilFinished) {
-                titleBar.setRightTitle(millisUntilFinished / 1000 + "s");
-            }
+        if (timer == null){
+            timer = new CountDownTimer(COUNTDOWN_TIME, 1000) {
+                @SuppressLint("SetTextI18n")
+                @Override
+                public void onTick(long millisUntilFinished) {
+                    titleBar.setRightTitle(millisUntilFinished / 1000 + "s");
+                }
+
+                @Override
+                public void onFinish() {
+                    jumpToLogin();
+                }
+            };
+            timer.start();
+        }
 
-            @Override
-            public void onFinish() {
-                jumpToLogin();
-            }
-        };
-        timer.start();
     }
 
     // 时间判断是否已经开场
@@ -444,7 +483,6 @@ public class SelectV2InfoActivity extends BaseActivity  {
             // 设置LinearLayout的布局参数
             LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                     LinearLayout.LayoutParams.MATCH_PARENT);
-//            layoutParams.width = 420;
             layoutParams.setMargins(0, 30, 50, 20);
             linearLayout.setPadding(50, 20, 50, 20);
             linearLayout.setOrientation(LinearLayout.VERTICAL);
@@ -481,6 +519,7 @@ public class SelectV2InfoActivity extends BaseActivity  {
 
             salePeice = goodsList.get(0).salePrice;
             goodsId = goodsList.get(0).goodsId;
+            selectGoodsItem = goodsList.get(0);
 
             int finalI = i;
             linearLayout.setOnClickListener(v -> {
@@ -489,11 +528,16 @@ public class SelectV2InfoActivity extends BaseActivity  {
                     linearLayout1.setBackgroundResource(R.drawable.bg_box_01);
                     TextView textView1 = (TextView) linearLayout1.getChildAt(0);
                     textView1.setTextColor(getResources().getColor(R.color.black));
+
+                    TextView textView2 = (TextView) linearLayout1.getChildAt(1);
+                    textView2.setTextColor(getResources().getColor(R.color.black));
                 }
                 linearLayout.setBackgroundResource(R.drawable.bg_box_02);
                 goodsId = goodsList.get(finalI).goodsId;
                 salePeice = goodsList.get(finalI).salePrice;
+                selectGoodsItem = goodsList.get(finalI);
                 textView.setTextColor(getResources().getColor(R.color.login_bk));
+                textViewAmount.setTextColor(getResources().getColor(R.color.red));
 //                getSelectRegion();
             });
 

+ 0 - 3
app/src/main/java/com/hw/nativeapp/ui/activity/TakeUserInfoActivity.java

@@ -115,9 +115,6 @@ public class TakeUserInfoActivity extends BaseActivity  {
         switch (v.getId()){
             case R.id.determine_btn:
                 ActivityUtils.launchActivity(this, IssueTicketsActivity.class);
-                break;
-            case R.id.continue_btn:
-
                 break;
         }
     }

+ 19 - 15
app/src/main/java/com/hw/nativeapp/ui/activity/TicketPurchaseActivity.java

@@ -62,7 +62,6 @@ public class TicketPurchaseActivity extends BaseActivity {
     private TicketPurchaseAdapter adapter;
     private String getId;
 
-    private JSONArray dataList = new JSONArray();
     private int initNum = 0;
 
     @Override
@@ -88,7 +87,7 @@ public class TicketPurchaseActivity extends BaseActivity {
         });
         getPageTransmitParams();
         initListView();
-        startCountDownTimer();
+
     }
 
 
@@ -104,6 +103,7 @@ public class TicketPurchaseActivity extends BaseActivity {
     protected void onStart() {
         super.onStart();
         initLoadData();
+        startCountDownTimer();
     }
 
     @Override
@@ -140,6 +140,7 @@ public class TicketPurchaseActivity extends BaseActivity {
         adapter.setOnOutBtnClickListerer((bean, position) -> {
             Bundle bundle = new Bundle();
             bundle.putString("performId", bean.id);
+            stopCountDownTimer();
             ActivityUtils.launchActivity(this, SelectV2InfoActivity.class, bundle);
         });
         listStock.setAdapter(adapter);
@@ -185,7 +186,6 @@ public class TicketPurchaseActivity extends BaseActivity {
                     public void onSuccess(JSONObject data) {
 //                        pageHandle(data.getInteger("total"), data.getInteger("page"),data.getInteger("pages"));
                         JSONArray rows = data.getJSONArray("list");
-                        dataList = rows;
                         if (rows != null && !rows.isEmpty()){
                             List<handleBean> rowbeans = JSONArray.parseArray(JSON.toJSONString(rows), handleBean.class);
                             reflashLoadData(rowbeans, cleaned);
@@ -233,21 +233,25 @@ public class TicketPurchaseActivity extends BaseActivity {
     private void stopCountDownTimer(){
         if (timer != null){
             timer.cancel();
+            timer = null;
         }
     }
     private void startCountDownTimer(){
-        timer = new CountDownTimer(COUNTDOWN_TIME, 1000) {
-            @SuppressLint("SetTextI18n")
-            @Override
-            public void onTick(long millisUntilFinished) {
-                titleBar.setRightTitle(millisUntilFinished / 1000 + "s");
-            }
+        if (timer == null){
+            timer = new CountDownTimer(COUNTDOWN_TIME, 1000) {
+                @SuppressLint("SetTextI18n")
+                @Override
+                public void onTick(long millisUntilFinished) {
+                    titleBar.setRightTitle(millisUntilFinished / 1000 + "s");
+                }
+
+                @Override
+                public void onFinish() {
+                    jumpToLogin();
+                }
+            };
+            timer.start();
+        }
 
-            @Override
-            public void onFinish() {
-                jumpToLogin();
-            }
-        };
-        timer.start();
     }
 }

+ 1 - 3
app/src/main/java/com/hw/nativeapp/ui/activity/adapters/PurchaseInfoAdapter.java

@@ -20,10 +20,8 @@ import java.util.List;
 
 public class PurchaseInfoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
 
-
     private Context mContext;
     private List<handleBean> mDatas ;
-    private OnBtnClickListerer mOnReplenishBtnClickListerer;
     private OnBtnClickListerer mOnOutBtnClickListerer;
 
 
@@ -62,7 +60,7 @@ public class PurchaseInfoAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
         }
         normalHolder.tv_name.setText(detailBean.name);
         normalHolder.tv_id_card.setText(StringUtils.idCardAddStar(detailBean.idcard));
-        normalHolder.btn_del.setOnClickListener(v -> {
+        normalHolder.img_del.setOnClickListener(v -> {
             mOnOutBtnClickListerer.onClick(detailBean, position);
         });
     }

+ 5 - 5
app/src/main/java/com/hw/nativeapp/ui/activity/holders/PurchaseInfoHolder.java

@@ -1,6 +1,7 @@
 package com.hw.nativeapp.ui.activity.holders;
 
 import android.view.View;
+import android.widget.ImageView;
 import android.widget.TextView;
 
 import androidx.annotation.NonNull;
@@ -12,13 +13,12 @@ public class PurchaseInfoHolder extends RecyclerView.ViewHolder{
 
     public TextView tv_name;
     public TextView tv_id_card;
-    public TextView btn_del;
+    public ImageView img_del;
 
     public PurchaseInfoHolder(@NonNull View itemView) {
         super(itemView);
-
-        tv_name = (TextView) itemView.findViewById(R.id.tv_name);
-        tv_id_card = (TextView) itemView.findViewById(R.id.tv_id_card);
-        btn_del = (TextView) itemView.findViewById(R.id.btn_del);
+        tv_name =  itemView.findViewById(R.id.tv_name);
+        tv_id_card =  itemView.findViewById(R.id.tv_id_card);
+        img_del = itemView.findViewById(R.id.img_del);
     }
 }

+ 658 - 0
app/src/main/java/com/hw/nativeapp/utils/IdNumberUtils.java

@@ -0,0 +1,658 @@
+package com.hw.nativeapp.utils;
+
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * 世纪恒通
+ * 功能描述: 身份证基本验证
+ * 创建者:Administrator
+ * 创建时间:2019/8/9 0009 14:16
+ * car-service-parent
+ * com.sjht.car.common.util
+ */
+public class IdNumberUtils {
+
+    /**
+     * 中国公民身份证号码最小长度。
+     */
+    public static final int CHINA_ID_MIN_LENGTH = 15;
+
+    /**
+     * 中国公民身份证号码最大长度。
+     */
+    public static final int CHINA_ID_MAX_LENGTH = 18;
+
+    /**
+     * <pre>
+     * 省、直辖市代码表:
+     *     11 : 北京  12 : 天津  13 : 河北       14 : 山西  15 : 内蒙古
+     *     21 : 辽宁  22 : 吉林  23 : 黑龙江  31 : 上海  32 : 江苏
+     *     33 : 浙江  34 : 安徽  35 : 福建       36 : 江西  37 : 山东
+     *     41 : 河南  42 : 湖北  43 : 湖南       44 : 广东  45 : 广西      46 : 海南
+     *     50 : 重庆  51 : 四川  52 : 贵州       53 : 云南  54 : 西藏
+     *     61 : 陕西  62 : 甘肃  63 : 青海       64 : 宁夏  65 : 新疆
+     *     71 : 台湾
+     *     81 : 香港  82 : 澳门
+     *     91 : 国外
+     * </pre>
+     */
+    private static String[] cityCode = {"11", "12", "13", "14", "15", "21", "22", "23", "31", "32", "33", "34", "35", "36", "37", "41", "42", "43", "44", "45", "46", "50", "51", "52", "53", "54", "61", "62", "63", "64", "65", "71", "81", "82", "91"};
+    /**
+     * 每位加权因子
+     */
+    private static int power[] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
+
+    /**
+     * 验证所有的身份证的合法性
+     *
+     * @param idcard 身份证
+     * @return 合法返回true,否则返回false
+     */
+    public static boolean isValidatedAllIdcard(String idcard) {
+        if (idcard == null || "".equals(idcard)) {
+            return false;
+        }
+        if (!isIdCard(idcard)) {
+            return false;
+        }
+        if (idcard.length() == CHINA_ID_MIN_LENGTH) {
+            return validate15IDCard(idcard);
+        }
+        if (idcard.length() == CHINA_ID_MAX_LENGTH) {
+            return validate18Idcard(idcard);
+        }
+        return false;
+
+    }
+
+    /**
+     * 验证所有的身份证的合法性
+     *
+     * @param idcard 身份证
+     * @return 合法返回true,否则返回false
+     */
+    public static boolean isValidatedAllIdcard(String idcard, Integer source) {
+        if (idcard == null || "".equals(idcard)) {
+            return false;
+        }
+        if (!isIdCard(idcard)) {
+            return false;
+        }
+        if (idcard.length() == CHINA_ID_MIN_LENGTH) {
+            return validate15IDCard(idcard, source);
+        }
+        if (idcard.length() == CHINA_ID_MAX_LENGTH) {
+            return validate18Idcard(idcard,source);
+        }
+        return false;
+    }
+
+    /**
+     * 判断身份证过期
+     *
+     * @param validDate
+     * @return
+     */
+    public static boolean validityVerify(String validDate) {
+        if (StringUtils.isEmpty(validDate)) {
+            return false;
+        }
+        String[] idtimes = validDate.split("-");
+        if (idtimes.length < 2) {
+            return false;
+        }
+
+        if (idtimes[1].equalsIgnoreCase("长期")) {//截止日期为长期,则未过期
+            return true;
+        }
+        try {
+            SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
+            Date overdueTime = format.parse(idtimes[1]);
+            if (overdueTime.before(new Date())) {//过期时间比当前时间还要靠前,则过期
+                return false;
+            }
+        } catch (Exception e) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 判断身份证为长期
+     *
+     * @param validDate
+     * @return
+     */
+    public static Boolean isLongItem(String validDate) {
+        if (StringUtils.isEmpty(validDate)) {
+            return false;
+        }
+        String[] idtimes = validDate.split("-");
+        if (idtimes[1].equalsIgnoreCase("长期")) {//截止日期为长期,则未过期
+            return true;
+        }
+        return false;
+    }
+
+
+    public static Boolean isIdCard(String idCard) {
+        if (StringUtils.isEmpty(idCard)) {
+            return false;
+        }
+        //第一代身份证正则表达式(15位)
+        String isIDCard1 = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$";
+        //第二代身份证正则表达式(18位)
+        String isIDCard2 = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])((\\d{4})|\\d{3}[A-Z])$";
+        //验证身份证
+        if (idCard.matches(isIDCard1) || idCard.matches(isIDCard2)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 根据身份编号获取年龄
+     *
+     * @param idCard 身份编号
+     * @return 年龄
+     */
+    public static int getAgeByIdCard(String idCard) {
+        int iAge = 0;
+        Calendar cal = Calendar.getInstance();
+        String year = idCard.substring(6, 10);
+        int iCurrYear = cal.get(Calendar.YEAR);
+        iAge = iCurrYear - Integer.valueOf(year);
+        return iAge;
+    }
+
+    public static Integer getAgeForDate(Date date) {
+        int iAge = 0;
+        Calendar cal = Calendar.getInstance();
+        int iCurrYear = cal.get(Calendar.YEAR);
+        iAge = iCurrYear - (date.getYear() + 1900);
+        return iAge;
+    }
+
+    /**
+     * 根据身份编号获取生日
+     *
+     * @param idCard 身份编号
+     * @return 生日(yyyyMMdd)
+     */
+    public static String getBirthByIdCard(String idCard) {
+        return idCard.substring(6, 14);
+    }
+
+    public static Date getBirthDateByIdCard(String idCard) {
+        String birth = idCard.substring(6, 14);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        try {
+            Date date = sdf.parse(birth);
+            return date;
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 根据身份编号获取生日年
+     *
+     * @param idCard 身份编号
+     * @return 生日(yyyy)
+     */
+    public static Short getYearByIdCard(String idCard) {
+        return Short.valueOf(idCard.substring(6, 10));
+    }
+
+    /**
+     * 根据身份编号获取生日月
+     *
+     * @param idCard 身份编号
+     * @return 生日(MM)
+     */
+    public static Short getMonthByIdCard(String idCard) {
+        return Short.valueOf(idCard.substring(10, 12));
+    }
+
+    /**
+     * 根据身份编号获取生日天
+     *
+     * @param idCard 身份编号
+     * @return 生日(dd)
+     */
+    public static Short getDateByIdCard(String idCard) {
+        return Short.valueOf(idCard.substring(12, 14));
+    }
+
+    /**
+     * 根据身份编号获取性别
+     *
+     * @param idCard 身份编号
+     * @return 性别(M - 男 , F - 女 , N - 未知)
+     */
+    public static String getGenderByIdCard(String idCard) {
+        String sGender = "0";
+
+        String sCardNum = idCard.substring(16, 17);
+        if (Integer.parseInt(sCardNum) % 2 != 0) {
+            sGender = "1";//男
+        } else {
+            sGender = "2";//女
+        }
+        return sGender;
+    }
+
+    public static boolean validate18Idcard(String idcard) {
+        if (idcard == null) {
+            return false;
+        }
+
+        // 非18位为假
+        if (idcard.length() != CHINA_ID_MAX_LENGTH) {
+            return false;
+        }
+        // 获取前17位
+        String idcard17 = idcard.substring(0, 17);
+
+        // 前17位全部为数字
+        if (!isDigital(idcard17)) {
+            return false;
+        }
+
+        String provinceid = idcard.substring(0, 2);
+        // 校验省份
+        if (!checkProvinceid(provinceid)) {
+            return false;
+        }
+
+        // 校验出生日期
+        String birthday = idcard.substring(6, 14);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+
+        try {
+            Date birthDate = sdf.parse(birthday);
+            String tmpDate = sdf.format(birthDate);
+            // 出生年月日不正确
+            if (!tmpDate.equals(birthday)) {
+                return false;
+            }
+
+        } catch (ParseException e1) {
+            return false;
+        }
+
+        // 获取第18位
+        String idcard18Code = idcard.substring(17, 18);
+
+        char c[] = idcard17.toCharArray();
+
+        int bit[] = converCharToInt(c);
+
+        int sum17 = 0;
+
+        sum17 = getPowerSum(bit);
+
+        // 将和值与11取模得到余数进行校验码判断
+        String checkCode = getCheckCodeBySum(sum17);
+        if (null == checkCode) {
+            return false;
+        }
+        // 将身份证的第18位与算出来的校码进行匹配,不相等就为假
+        if (!idcard18Code.equalsIgnoreCase(checkCode)) {
+            return false;
+        }
+        return true;
+    }
+
+    public static boolean validate18Idcard(String idcard, Integer source) {
+        if (idcard == null) {
+            return false;
+        }
+
+        // 非18位为假
+        if (idcard.length() != CHINA_ID_MAX_LENGTH) {
+            return false;
+        }
+        // 获取前17位
+        String idcard17 = idcard.substring(0, 17);
+
+        // 前17位全部为数字
+        if (!isDigital(idcard17)) {
+            return false;
+        }
+        String provinceid = idcard.substring(0, 2);
+        // 校验省份
+        if (!checkProvinceid(provinceid)) {
+            return false;
+        }
+
+        // 校验出生日期
+        String birthday = idcard.substring(6, 14);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+
+        try {
+            Date birthDate = sdf.parse(birthday);
+            String tmpDate = sdf.format(birthDate);
+            // 出生年月日不正确
+            if (!tmpDate.equals(birthday)) {
+                return false;
+            }
+
+        } catch (ParseException e1) {
+            return false;
+        }
+
+        // 获取第18位
+        String idcard18Code = idcard.substring(17, 18);
+
+        char c[] = idcard17.toCharArray();
+
+        int bit[] = converCharToInt(c);
+
+        int sum17 = 0;
+
+        sum17 = getPowerSum(bit);
+
+        // 将和值与11取模得到余数进行校验码判断
+        String checkCode = getCheckCodeBySum(sum17);
+        if (null == checkCode) {
+            return false;
+        }
+        // 将身份证的第18位与算出来的校码进行匹配,不相等就为假
+        if (!idcard18Code.equalsIgnoreCase(checkCode)) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 校验15位身份证
+     *
+     * <pre>
+     * 只校验省份和出生年月日
+     * </pre>
+     *
+     * @param idcard
+     * @return
+     */
+    public static boolean validate15IDCard(String idcard) {
+        if (idcard == null) {
+            return false;
+        }
+        // 非15位为假
+        if (idcard.length() != CHINA_ID_MIN_LENGTH) {
+            return false;
+        }
+
+        // 15全部为数字
+        if (!isDigital(idcard)) {
+            return false;
+        }
+
+        String provinceid = idcard.substring(0, 2);
+        // 校验省份
+        if (!checkProvinceid(provinceid)) {
+            return false;
+        }
+
+        String birthday = idcard.substring(6, 12);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
+
+        try {
+            Date birthDate = sdf.parse(birthday);
+            String tmpDate = sdf.format(birthDate);
+            // 身份证日期错误
+            if (!tmpDate.equals(birthday)) {
+                return false;
+            }
+
+        } catch (ParseException e1) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * 校验15位身份证
+     *
+     * <pre>
+     * 只校验省份和出生年月日
+     * </pre>
+     *
+     * @param idcard
+     * @return
+     */
+    public static boolean validate15IDCard(String idcard, Integer source) {
+        if (idcard == null) {
+            return false;
+        }
+        // 非15位为假
+        if (idcard.length() != CHINA_ID_MIN_LENGTH) {
+            return false;
+        }
+
+        // 15全部为数字
+        if (!isDigital(idcard)) {
+            return false;
+        }
+
+        String provinceid = idcard.substring(0, 2);
+        // 校验省份
+        if (!checkProvinceid(provinceid)) {
+            return false;
+        }
+
+        String birthday = idcard.substring(6, 12);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
+
+        try {
+            Date birthDate = sdf.parse(birthday);
+            String tmpDate = sdf.format(birthDate);
+            // 身份证日期错误
+            if (!tmpDate.equals(birthday)) {
+                return false;
+            }
+
+        } catch (ParseException e1) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * 将15位的身份证转成18位身份证
+     *
+     * @param idcard
+     * @return
+     */
+    public static String convertIdcarBy15bit(String idcard) {
+        if (idcard == null) {
+            return null;
+        }
+
+        // 非15位身份证
+        int s = 15;
+        if (idcard.length() != s) {
+            return null;
+        }
+
+        // 15全部为数字
+        if (!isDigital(idcard)) {
+            return null;
+        }
+
+        String provinceid = idcard.substring(0, 2);
+        // 校验省份
+        if (!checkProvinceid(provinceid)) {
+            return null;
+        }
+
+        String birthday = idcard.substring(6, 12);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
+
+        Date birthdate = null;
+        try {
+            birthdate = sdf.parse(birthday);
+            String tmpDate = sdf.format(birthdate);
+            // 身份证日期错误
+            if (!tmpDate.equals(birthday)) {
+                return null;
+            }
+
+        } catch (ParseException e1) {
+            return null;
+        }
+
+        Calendar cday = Calendar.getInstance();
+        cday.setTime(birthdate);
+        String year = String.valueOf(cday.get(Calendar.YEAR));
+
+        String idcard17 = idcard.substring(0, 6) + year + idcard.substring(8);
+
+        char c[] = idcard17.toCharArray();
+        String checkCode = "";
+
+        // 将字符数组转为整型数组
+        int bit[] = converCharToInt(c);
+
+        int sum17 = 0;
+        sum17 = getPowerSum(bit);
+
+        // 获取和值与11取模得到余数进行校验码
+        checkCode = getCheckCodeBySum(sum17);
+
+        // 获取不到校验位
+        if (null == checkCode) {
+            return null;
+        }
+        // 将前17位与第18位校验码拼接
+        idcard17 += checkCode;
+        return idcard17;
+    }
+
+    /**
+     * 校验省份
+     *
+     * @param provinceid
+     * @return 合法返回TRUE,否则返回FALSE
+     */
+    private static boolean checkProvinceid(String provinceid) {
+        for (String id : cityCode) {
+            if (id.equals(provinceid)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 数字验证
+     *
+     * @param str
+     * @return
+     */
+    private static boolean isDigital(String str) {
+        return str.matches("^[0-9]*$");
+    }
+
+    /**
+     * 将身份证的每位和对应位的加权因子相乘之后,再得到和值
+     *
+     * @param bit
+     * @return
+     */
+    private static int getPowerSum(int[] bit) {
+
+        int sum = 0;
+
+        if (power.length != bit.length) {
+            return sum;
+        }
+
+        for (int i = 0; i < bit.length; i++) {
+            for (int j = 0; j < power.length; j++) {
+                if (i == j) {
+                    sum = sum + bit[i] * power[j];
+                }
+            }
+        }
+        return sum;
+    }
+
+    /**
+     * 将和值与11取模得到余数进行校验码判断
+     *
+     * @param sum17
+     * @return 校验位
+     */
+    private static String getCheckCodeBySum(int sum17) {
+        String checkCode = null;
+        switch (sum17 % 11) {
+            case 10:
+                checkCode = "2";
+                break;
+            case 9:
+                checkCode = "3";
+                break;
+            case 8:
+                checkCode = "4";
+                break;
+            case 7:
+                checkCode = "5";
+                break;
+            case 6:
+                checkCode = "6";
+                break;
+            case 5:
+                checkCode = "7";
+                break;
+            case 4:
+                checkCode = "8";
+                break;
+            case 3:
+                checkCode = "9";
+                break;
+            case 2:
+                checkCode = "x";
+                break;
+            case 1:
+                checkCode = "0";
+                break;
+            case 0:
+                checkCode = "1";
+                break;
+            default:
+        }
+        return checkCode;
+    }
+
+    /**
+     * 将字符数组转为整型数组
+     *
+     * @param c
+     * @return
+     * @throws NumberFormatException
+     */
+    private static int[] converCharToInt(char[] c) throws NumberFormatException {
+        int[] a = new int[c.length];
+        int k = 0;
+        for (char temp : c) {
+            a[k++] = Integer.parseInt(String.valueOf(temp));
+        }
+        return a;
+    }
+
+
+}

+ 102 - 123
app/src/main/res/layout/activity_payment_method.xml

@@ -5,161 +5,140 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@mipmap/page_bj">
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:gravity="center"
-        android:orientation="vertical">
-
-        <ImageView
-            android:id="@+id/main_img"
-            android:layout_width="match_parent"
-            android:layout_height="550dp"
-            android:scaleType="fitXY"
-            android:src="@mipmap/main_top" />
 
-    </LinearLayout>
-    <LinearLayout
+    <ScrollView
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="550dp">
-        <com.hjq.bar.TitleBar
-            android:id="@+id/tb_main_bar"
-            android:layout_width="match_parent"
-            android:layout_height="80dp"
-            android:background="@color/login_bk"
-            app:leftColor="@color/white"
-            app:leftIcon="@mipmap/left_44_icon"
-            app:leftSize="@dimen/inedx_btn_size"
-            app:leftTitle="返回"
-            app:rightColor="@color/white"
-            app:rightSize="@dimen/inedx_btn_size"
-            app:rightTitle="120s"
-            app:title="支付方式"
-            app:titleColor="@color/white"
-            app:titleSize="@dimen/text_30dp_size" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="top"
-        android:layout_marginTop="600dp"
-        android:orientation="vertical"
-        android:padding="60dp">
+        android:layout_height="match_parent">
 
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:layout_marginTop="20sp"
-            android:layout_weight="1"
-            android:background="@drawable/bg_take"
-            android:orientation="vertical"
-            android:padding="15sp">
+            android:gravity="center"
+            android:orientation="vertical">
+
 
             <LinearLayout
                 android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:layout_marginTop="40dp"
+                android:layout_height="wrap_content"
                 android:gravity="center"
+                android:orientation="vertical">
+
+                <ImageView
+                    android:id="@+id/main_img"
+                    android:layout_width="match_parent"
+                    android:layout_height="550dp"
+                    android:scaleType="fitXY"
+                    android:src="@mipmap/main_top" />
+
+            </LinearLayout>
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <com.hjq.bar.TitleBar
+                    android:id="@+id/tb_main_bar"
+                    android:layout_width="match_parent"
+                    android:layout_height="80dp"
+                    android:background="@color/login_bk"
+                    app:leftColor="@color/white"
+                    app:leftIcon="@mipmap/left_44_icon"
+                    app:leftSize="@dimen/inedx_btn_size"
+                    app:leftTitle="返回"
+                    app:rightColor="@color/white"
+                    app:rightSize="@dimen/inedx_btn_size"
+                    app:rightTitle="120s"
+                    app:title="支付方式"
+                    app:titleColor="@color/white"
+                    app:titleSize="@dimen/text_30dp_size" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_gravity="top"
                 android:orientation="vertical"
-                android:paddingBottom="30sp">
-<!--                选择支付方式-->
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="60dp"
-                    android:layout_weight="1"
-                    android:gravity="center"
-                    android:text="请扫码支付"
-                    android:textColor="@color/black"
-                    android:textFontWeight="800"
-                    android:textSize="@dimen/text_30dp_size" />
+                android:padding="60dp">
 
                 <LinearLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_marginTop="30dp"
-                    android:gravity="center"
-                    android:orientation="horizontal">
+                    android:layout_gravity="center"
+                    android:layout_marginTop="20sp"
+                    android:layout_weight="1"
+                    android:background="@drawable/bg_take"
+                    android:orientation="vertical"
+                    android:padding="15sp">
 
                     <LinearLayout
                         android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
+                        android:layout_height="match_parent"
+                        android:layout_marginTop="40dp"
                         android:gravity="center"
-                        android:layout_weight="1"
-                        android:layout_marginRight="15sp"
-                        android:orientation="vertical">
-                        <LinearLayout
-                            android:layout_width="350dp"
-                            android:layout_height="350dp"
+                        android:orientation="vertical"
+                        android:paddingBottom="30sp">
+                        <!--                选择支付方式-->
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="60dp"
+                            android:layout_weight="1"
                             android:gravity="center"
-                            android:background="@mipmap/eq_code_box"
-                            android:orientation="horizontal">
-                            <ImageView
-                                android:id="@+id/wechat_pay"
-                                android:layout_width="300dp"
-                                android:layout_height="300dp"
-                                android:src="@mipmap/eq_code_ing"
-                                android:scaleType="fitXY" />
-                        </LinearLayout>
+                            android:text="请扫码支付"
+                            android:textColor="@color/black"
+                            android:textFontWeight="800"
+                            android:textSize="@dimen/text_30dp_size" />
+
                         <LinearLayout
                             android:layout_width="match_parent"
-                            android:layout_height="match_parent"
-                            android:layout_marginTop="60sp"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="30dp"
                             android:gravity="center"
                             android:orientation="horizontal">
 
-                            <TextView
-                                android:layout_width="wrap_content"
+                            <LinearLayout
+                                android:layout_width="match_parent"
                                 android:layout_height="wrap_content"
                                 android:gravity="center"
-                                android:text="扫码支付"
-                                android:layout_marginLeft="5dp"
-                                android:textColor="@color/black"
-                                android:textFontWeight="800"
-                                android:textSize="@dimen/inedx_btn_size" />
+                                android:layout_weight="1"
+                                android:layout_marginRight="15sp"
+                                android:orientation="vertical">
+                                <LinearLayout
+                                    android:layout_width="350dp"
+                                    android:layout_height="350dp"
+                                    android:gravity="center"
+                                    android:background="@mipmap/eq_code_box"
+                                    android:orientation="horizontal">
+                                    <ImageView
+                                        android:id="@+id/wechat_pay"
+                                        android:layout_width="300dp"
+                                        android:layout_height="300dp"
+                                        android:src="@mipmap/eq_code_ing"
+                                        android:scaleType="fitXY" />
+                                </LinearLayout>
+                                <LinearLayout
+                                    android:layout_width="match_parent"
+                                    android:layout_height="match_parent"
+                                    android:layout_marginTop="60sp"
+                                    android:gravity="center"
+                                    android:orientation="horizontal">
+
+                                    <TextView
+                                        android:layout_width="wrap_content"
+                                        android:layout_height="wrap_content"
+                                        android:gravity="center"
+                                        android:text="扫码支付"
+                                        android:layout_marginLeft="5dp"
+                                        android:textColor="@color/black"
+                                        android:textFontWeight="800"
+                                        android:textSize="@dimen/inedx_btn_size" />
+                                </LinearLayout>
+                            </LinearLayout>
                         </LinearLayout>
                     </LinearLayout>
-<!--                    <LinearLayout-->
-<!--                        android:layout_width="match_parent"-->
-<!--                        android:layout_height="wrap_content"-->
-<!--                        android:gravity="center"-->
-<!--                        android:layout_marginLeft="15sp"-->
-<!--                        android:layout_weight="1"-->
-<!--                        android:orientation="vertical">-->
-<!--                        <ImageView-->
-<!--                            android:layout_width="wrap_content"-->
-<!--                            android:layout_height="wrap_content"-->
-<!--                            android:scaleType="fitXY"-->
-<!--                            android:src="@mipmap/qr_code" />-->
-<!--                        <LinearLayout-->
-<!--                            android:id="@+id/test_btn"-->
-<!--                            android:layout_width="match_parent"-->
-<!--                            android:layout_height="match_parent"-->
-<!--                            android:layout_marginTop="25sp"-->
-<!--                            android:gravity="center"-->
-<!--                            android:orientation="horizontal">-->
-<!--                            <ImageView-->
-<!--                                android:layout_width="wrap_content"-->
-<!--                                android:layout_height="wrap_content"-->
-<!--                                android:scaleType="fitXY"-->
-<!--                                android:layout_marginRight="5sp"-->
-<!--                                android:src="@mipmap/zfb_icon" />-->
-<!--                            <TextView-->
-<!--                                android:layout_width="wrap_content"-->
-<!--                                android:layout_height="wrap_content"-->
-<!--                                android:gravity="center"-->
-<!--                                android:text="支付宝支付"-->
-<!--                                android:textColor="@color/black"-->
-<!--                                android:textFontWeight="800"-->
-<!--                                android:textSize="18sp" />-->
-<!--                        </LinearLayout>-->
-<!--                    </LinearLayout>-->
+
                 </LinearLayout>
             </LinearLayout>
 
         </LinearLayout>
-    </LinearLayout>
+    </ScrollView>
+
 
 </RelativeLayout>

+ 115 - 17
app/src/main/res/layout/activity_purchase_info.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"
@@ -56,11 +57,12 @@
                 android:layout_height="wrap_content"
                 android:layout_gravity="top"
                 android:orientation="vertical">
+
+
                 <ScrollView
                     android:layout_marginBottom="30dp"
                     android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_below="@+id/tb_main_bar">
+                    android:layout_height="match_parent">
                     <LinearLayout
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
@@ -75,9 +77,105 @@
                             android:background="@drawable/bg_take"
                             android:orientation="vertical"
                             android:padding="60dp">
+                            <LinearLayout
+                                android:layout_width="match_parent"
+                                android:layout_height="match_parent"
+                                android:gravity="left"
+                                android:orientation="vertical">
+
+                                <LinearLayout
+                                    android:layout_width="match_parent"
+                                    android:layout_height="wrap_content"
+                                    android:orientation="horizontal">
+
+                                    <TextView
+                                        android:text="观影人信息:"
+                                        android:layout_width="wrap_content"
+                                        android:layout_height="wrap_content"
+                                        android:textColor="@color/black"
+                                        android:textStyle="bold"
+                                        android:textSize="40sp" />
+
+                                    <TextView
+                                        android:id="@+id/tx_player"
+                                        tools:text="18586814704"
+                                        android:layout_width="match_parent"
+                                        android:layout_height="wrap_content"
+                                        android:textColor="@color/gray"
+                                        android:layout_marginStart="10sp"
+                                        android:textSize="40sp" />
+                                </LinearLayout>
+
+
+
+                                <EditText
+                                    android:layout_marginTop="20sp"
+                                    android:id="@+id/et_tourist_name"
+                                    android:text=""
+                                    android:layout_width="match_parent"
+                                    android:layout_height="70dp"
+                                    android:textSize="36sp"
+                                    android:background="@android:drawable/edit_text"
+                                    android:hint="请输入观影人姓名" />
+
+
+                                <EditText
+                                    android:id="@+id/et_tourist_idcard"
+                                    android:text=""
+                                    android:layout_marginTop="10sp"
+                                    android:layout_width="match_parent"
+                                    android:layout_height="70dp"
+                                    android:textSize="36sp"
+                                    android:background="@android:drawable/edit_text"
+                                    android:hint="请输入观影人身份证" />
+
+                                <LinearLayout
+                                    android:id="@+id/ll_add_tourist"
+                                    android:layout_width="wrap_content"
+                                    android:orientation="horizontal"
+                                    android:gravity="center"
+                                    android:padding="10sp"
+                                    android:layout_marginTop="20sp"
+                                    android:background="@color/msg_item_gray"
+                                    android:layout_height="wrap_content">
+                                    <ImageView
+                                        android:layout_width="wrap_content"
+                                        android:layout_height="wrap_content"
+                                        android:src="@mipmap/img_add"/>
+                                    <TextView
+                                        android:layout_width="match_parent"
+                                        android:layout_height="wrap_content"
+                                        android:textSize="36sp"
+                                        android:textColor="@color/black"
+                                        android:layout_marginStart="10sp"
+                                        android:text="新增观影人"/>
+
+                                    <TextView
+                                        android:layout_width="match_parent"
+                                        android:layout_height="wrap_content"
+                                        android:textSize="20sp"
+                                        android:textColor="@color/blue"
+                                        android:layout_marginStart="20sp"
+                                        android:text="每张票需要"/>
+                                    <TextView
+                                        android:id="@+id/tx_personnelNum"
+                                        android:layout_width="match_parent"
+                                        android:layout_height="wrap_content"
+                                        android:textSize="26sp"
+                                        android:textColor="@color/red"
+                                        android:text="2"/>
+                                    <TextView
+                                        android:layout_width="match_parent"
+                                        android:layout_height="wrap_content"
+                                        android:textSize="20sp"
+                                        android:textColor="@color/blue"
+                                        android:text="观影人信息"/>
+                                </LinearLayout>
+                            </LinearLayout>
 
                             <ScrollView
                                 android:id="@+id/sv"
+                                android:layout_marginTop="20sp"
                                 android:layout_width="match_parent"
                                 android:layout_height="match_parent"
                                 android:layout_below="@+id/tb_main_bar">
@@ -130,7 +228,7 @@
                                     android:layout_width="wrap_content"
                                     android:layout_height="wrap_content"
                                     android:id="@+id/tx_num"
-                                    android:text="共2张, 计"
+                                    android:text="共2张, 计"
                                     android:textColor="@color/black"
                                     android:textFontWeight="800"
                                     android:textSize="@dimen/text_30dp_size" />
@@ -140,7 +238,7 @@
                                     android:layout_height="wrap_content"
                                     android:text="¥488"
                                     android:paddingRight="10dp"
-                                    android:textColor="@color/login_bk"
+                                    android:textColor="@color/red"
                                     android:textFontWeight="800"
                                     android:textSize="@dimen/text_30dp_size" />
                             </LinearLayout>
@@ -153,19 +251,19 @@
                                 android:paddingBottom="30sp"
                                 android:orientation="horizontal">
 
-                                <TextView
-                                    android:id="@+id/continue_btn"
-                                    android:layout_width="match_parent"
-                                    android:layout_height="match_parent"
-                                    android:layout_weight="1"
-                                    android:background="@drawable/bg_btn_01"
-                                    android:gravity="center"
-                                    android:padding="10sp"
-                                    android:layout_marginRight="20sp"
-                                    android:text="继续添加观影人"
-                                    android:textColor="@color/white"
-                                    android:textFontWeight="800"
-                                    android:textSize="@dimen/text_30dp_size" />
+<!--                                <TextView-->
+<!--                                    android:id="@+id/continue_btn"-->
+<!--                                    android:layout_width="match_parent"-->
+<!--                                    android:layout_height="match_parent"-->
+<!--                                    android:layout_weight="1"-->
+<!--                                    android:background="@drawable/bg_btn_01"-->
+<!--                                    android:gravity="center"-->
+<!--                                    android:padding="10sp"-->
+<!--                                    android:layout_marginRight="20sp"-->
+<!--                                    android:text="继续添加观影人"-->
+<!--                                    android:textColor="@color/white"-->
+<!--                                    android:textFontWeight="800"-->
+<!--                                    android:textSize="@dimen/text_30dp_size" />-->
                                 <TextView
                                     android:id="@+id/determine_btn"
                                     android:layout_width="match_parent"

+ 1 - 1
app/src/main/res/layout/activity_select_v2.xml

@@ -232,7 +232,7 @@
                                     android:layout_width="match_parent"
                                     android:layout_height="wrap_content"
                                     android:isScrollContainer="true"
-                                    android:orientation="vertical"
+                                    android:orientation="horizontal"
                                     android:paddingTop="10dp"
                                     android:paddingBottom="10dp">
 

+ 97 - 71
app/src/main/res/layout/item_purchase_info.xml

@@ -10,80 +10,106 @@
         android:layout_margin="20sp"
         android:layout_width="match_parent"
         android:orientation="horizontal"
-        android:padding="30dp"
+        android:padding="20dp"
+        android:gravity="center"
         android:background="@drawable/bg_info_01"
         android:layout_height="wrap_content">
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:orientation="vertical"
-            android:layout_weight="1"
-            android:layout_height="wrap_content">
-            <LinearLayout
-                android:orientation="horizontal"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content">
-                <TextView
-                    android:layout_weight="1"
-                    android:layout_width="wrap_content"
-                    android:layout_height="match_parent"
-                    android:gravity="left"
-                    android:text="姓名"
-                    android:textColor="@color/black"
-                    android:textFontWeight="800"
-                    android:textSize="@dimen/text_30dp_size" />
-                <TextView
-                    android:id="@+id/tv_name"
-                    android:layout_weight="3"
-                    android:layout_width="wrap_content"
-                    android:layout_height="match_parent"
-                    android:gravity="right"
-                    android:text="张三"
-                    android:textColor="@color/black"
-                    android:textFontWeight="800"
-                    android:textSize="@dimen/text_30dp_size" />
-            </LinearLayout>
-            <LinearLayout
-                android:layout_marginTop="30sp"
-                android:orientation="horizontal"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content">
-                <TextView
-                    android:layout_weight="1"
-                    android:layout_width="wrap_content"
-                    android:layout_height="match_parent"
-                    android:gravity="left"
-                    android:text="身份证"
-                    android:textColor="@color/black"
-                    android:textFontWeight="800"
-                    android:textSize="@dimen/text_30dp_size" />
-                <TextView
-                    android:id="@+id/tv_id_card"
-                    android:layout_weight="3"
-                    android:layout_width="wrap_content"
-                    android:layout_height="match_parent"
-                    android:gravity="right"
-                    android:text="520************4153"
-                    android:textColor="@color/black"
-                    android:textFontWeight="800"
-                    android:textSize="@dimen/text_30dp_size" />
-            </LinearLayout>
-        </LinearLayout>
-        <LinearLayout
+
+        <ImageView
+            android:id="@+id/img_del"
+            android:layout_width="84sp"
+            android:layout_height="84sp"
+            android:src="@mipmap/img_del"/>
+
+        <TextView
+            android:id="@+id/tv_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:gravity="right"
+            android:layout_marginStart="10sp"
+            tools:text="张三"
+            android:textColor="@color/black"
+            android:textSize="38sp" />
+
+        <TextView
+            android:id="@+id/tv_id_card"
             android:layout_width="match_parent"
-            android:orientation="vertical"
-            android:layout_weight="5"
+            android:layout_height="wrap_content"
             android:gravity="right"
-            android:layout_height="wrap_content">
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:gravity="right"
-                android:id="@+id/btn_del"
-                android:layout_marginTop="50dp"
-                android:text="删除"
-                android:textColor="@color/red"
-                android:textFontWeight="800"
-                android:textSize="@dimen/text_30dp_size" />
-        </LinearLayout>
+            tools:text="520************4153"
+            android:textColor="@color/gray"
+            android:textSize="38sp" />
+<!--        <LinearLayout-->
+<!--            android:layout_width="match_parent"-->
+<!--            android:orientation="vertical"-->
+<!--            android:layout_weight="1"-->
+<!--            android:layout_height="wrap_content">-->
+<!--            <LinearLayout-->
+<!--                android:orientation="horizontal"-->
+<!--                android:layout_width="match_parent"-->
+<!--                android:layout_height="wrap_content">-->
+<!--                <TextView-->
+<!--                    android:layout_weight="1"-->
+<!--                    android:layout_width="wrap_content"-->
+<!--                    android:layout_height="match_parent"-->
+<!--                    android:gravity="left"-->
+<!--                    android:text="姓名"-->
+<!--                    android:textColor="@color/black"-->
+<!--                    android:textFontWeight="800"-->
+<!--                    android:textSize="@dimen/text_30dp_size" />-->
+<!--                <TextView-->
+<!--                    android:id="@+id/tv_name"-->
+<!--                    android:layout_weight="3"-->
+<!--                    android:layout_width="wrap_content"-->
+<!--                    android:layout_height="match_parent"-->
+<!--                    android:gravity="right"-->
+<!--                    android:text="张三"-->
+<!--                    android:textColor="@color/black"-->
+<!--                    android:textFontWeight="800"-->
+<!--                    android:textSize="@dimen/text_30dp_size" />-->
+<!--            </LinearLayout>-->
+<!--            <LinearLayout-->
+<!--                android:layout_marginTop="30sp"-->
+<!--                android:orientation="horizontal"-->
+<!--                android:layout_width="match_parent"-->
+<!--                android:layout_height="wrap_content">-->
+<!--                <TextView-->
+<!--                    android:layout_weight="1"-->
+<!--                    android:layout_width="wrap_content"-->
+<!--                    android:layout_height="match_parent"-->
+<!--                    android:gravity="left"-->
+<!--                    android:text="身份证"-->
+<!--                    android:textColor="@color/black"-->
+<!--                    android:textFontWeight="800"-->
+<!--                    android:textSize="@dimen/text_30dp_size" />-->
+<!--                <TextView-->
+<!--                    android:id="@+id/tv_id_card"-->
+<!--                    android:layout_weight="3"-->
+<!--                    android:layout_width="wrap_content"-->
+<!--                    android:layout_height="match_parent"-->
+<!--                    android:gravity="right"-->
+<!--                    android:text="520************4153"-->
+<!--                    android:textColor="@color/black"-->
+<!--                    android:textFontWeight="800"-->
+<!--                    android:textSize="@dimen/text_30dp_size" />-->
+<!--            </LinearLayout>-->
+<!--        </LinearLayout>-->
+<!--        <LinearLayout-->
+<!--            android:layout_width="match_parent"-->
+<!--            android:orientation="vertical"-->
+<!--            android:layout_weight="5"-->
+<!--            android:gravity="right"-->
+<!--            android:layout_height="wrap_content">-->
+<!--            <TextView-->
+<!--                android:layout_width="wrap_content"-->
+<!--                android:layout_height="match_parent"-->
+<!--                android:gravity="right"-->
+<!--                android:id="@+id/btn_del"-->
+<!--                android:layout_marginTop="50dp"-->
+<!--                android:text="删除"-->
+<!--                android:textColor="@color/red"-->
+<!--                android:textFontWeight="800"-->
+<!--                android:textSize="@dimen/text_30dp_size" />-->
+<!--        </LinearLayout>-->
     </LinearLayout>
 </LinearLayout>

BIN
app/src/main/res/mipmap-hdpi/img_add.png


BIN
app/src/main/res/mipmap-hdpi/img_del.png