Commit 59d2fcbc by 刘鹏

feat : 支付部分提交,1.支持药品支付,跳转订单详情,2.订单详情跳转未添加

parent aa3203dd
......@@ -11,6 +11,12 @@
android:name=".MedicalPayActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<!--支付成功界面-->
<activity
android:name=".MedicalPaySuccessActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
</application>
</manifest>
\ No newline at end of file
......@@ -40,9 +40,11 @@ class MedicalPayActivity : BaseActivity() {
private const val PRICE_KEY = "price"
private const val ORDER_KEY = "orderId"
private const val DOCTORUID_KEY = "doctorUid"
private const val Medical_KEY = "isMedical"
private lateinit var mPrice: String
private lateinit var mOrderId: String
private lateinit var mDoctorUid: String
private var mIsMedical: Boolean = false
private var timer: CountDownTimer? = null
......@@ -58,6 +60,7 @@ class MedicalPayActivity : BaseActivity() {
private var payType = PAY_WECHAT
/**
* 医疗图文问诊支付
* @param price 价格
* @param orderId 订单id
* */
......@@ -69,6 +72,15 @@ class MedicalPayActivity : BaseActivity() {
.putExtra(DOCTORUID_KEY, doctorUid)
context.startActivity(starter)
}
@JvmStatic
fun start(context: Context, price: String, orderId: String, doctorUid: String,isMedical :Boolean) {
val starter = Intent(context, MedicalPayActivity::class.java)
.putExtra(PRICE_KEY, price)
.putExtra(ORDER_KEY, orderId)
.putExtra(DOCTORUID_KEY, doctorUid)
.putExtra(Medical_KEY, isMedical)
context.startActivity(starter)
}
@SuppressLint("HandlerLeak")
private val mHandler: Handler = object : Handler() {
......@@ -112,6 +124,7 @@ class MedicalPayActivity : BaseActivity() {
mPrice = intent.getStringExtra(PRICE_KEY)
mOrderId = intent.getStringExtra(ORDER_KEY)
mDoctorUid = intent.getStringExtra(DOCTORUID_KEY)
mIsMedical = intent.getBooleanExtra(Medical_KEY,false)
payType = PAY_WECHAT
price.text = mPrice
......@@ -279,8 +292,13 @@ class MedicalPayActivity : BaseActivity() {
fun onEvent(event: MedicalWXPayEvent) {
if (event.status.success) {
if (mIsMedical){
MedicalPaySuccessActivity.start(this@MedicalPayActivity, mPrice, mOrderId)
}else{
MedicalPayIn.mainIntentMessage(this@MedicalPayActivity, mDoctorUid)
ToastUtil.toastShort("支付成功")
}
finish()
} else {
ToastUtil.toastShort("支付失败")
......
package com.medical.ydl.medical.pay
import android.content.Context
import android.content.Intent
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.utils.StatusBarUtils
import kotlinx.android.synthetic.main.medical_pay_success_activity.*
import java.util.*
/**
* 医疗 成功页
* */
class MedicalPaySuccessActivity : BaseActivity() {
companion object {
private const val PRICE_KEY = "price"
private const val ORDER_KEY = "orderId"
private lateinit var mPrice: String
private lateinit var mOrderId: String
/**
* @param price 价格
* @param orderId 订单id
* */
@JvmStatic
fun start(context: Context, price: String, orderId: String) {
val starter = Intent(context, MedicalPaySuccessActivity::class.java)
.putExtra(PRICE_KEY, price)
.putExtra(ORDER_KEY, orderId)
context.startActivity(starter)
}
}
override fun layoutResId(): Int {
return R.layout.medical_pay_success_activity
}
override fun initDataAndEvent() {
initStatus()
mPrice = intent.getStringExtra(PRICE_KEY)
mOrderId = intent.getStringExtra(ORDER_KEY)
price.text = mPrice
iv_back.setOnClickListener {
finish()
}
to_order.setOnClickListener {
//查看订单
}
}
private fun initStatus() {
StatusBarUtils.setTransparentForImageView(this@MedicalPaySuccessActivity, null)
StatusBarUtils.statusBarLightMode(this@MedicalPaySuccessActivity)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F6F7F9"
tools:context=".MedicalPayActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="96dp"
android:background="@color/white"
android:elevation="0dp"
android:gravity="bottom"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="56dp"
android:ellipsize="end"
android:gravity="center"
android:maxEms="10"
android:maxLines="1"
android:text="支付订单"
android:textColor="#10233a"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_back"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:src="@mipmap/medical_icon_title_back" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
<ImageView
android:id="@+id/success_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginTop="100dp"
android:src="@mipmap/medical_pay_check"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
<TextView
android:id="@+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="28dp"
android:textColor="#ff0c1d31"
android:textSize="32sp"
android:textStyle="bold"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toRightOf="@id/price_unit"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/success_icon"
tools:text="99" />
<TextView
android:id="@+id/price_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥"
android:textColor="#ff0c1d31"
android:textSize="24sp"
app:layout_constraintBaseline_toBaselineOf="@id/price"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/price" />
<TextView
android:id="@+id/hold_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="支付成功"
android:textColor="#ff0c1d31"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/price" />
<LinearLayout
android:id="@+id/ll_to_order"
android:layout_width="match_parent"
android:layout_height="98dp"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:orientation="horizontal"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/to_order"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/medical_bg_3464ec_8dp"
android:gravity="center"
android:text="查看订单"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment