Commit c5e73b85 authored by mengcuiguang2's avatar mengcuiguang2

联调支付宝,支付界面修改

parent 26684d76
......@@ -70,14 +70,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="um.60e80209a6f90557b7b19aa7" />
</intent-filter>
</activity>
<activity android:name=".login.LoginActivity"></activity>
<activity
......
......@@ -52,7 +52,7 @@ class AppApplication : BaseApp() {
UmengManager.preInit()
// GroMore
CsjGroMoreManager.init(this)
// CsjGroMoreManager.init(this)
//百度地图
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
// 默认本地个性化地图初始化方法
......
......@@ -19,7 +19,7 @@ class GridPaymentAdapter(val context: Context, val list: List<VipBean.ListBean>)
//设置首次进来默认选中第一个
private var first: Int = 1
private var datalist: List<VipBean.ListBean>? = list
private var mposition: Int = -1
private var mposition: Int = 0
override fun onBindViewHolder(holder: BindingViewHolder<ItemGridPaymentAdpaterBinding>, position: Int) {
holder.binding.tvOldprice.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
......@@ -72,6 +72,7 @@ class GridPaymentAdapter(val context: Context, val list: List<VipBean.ListBean>)
override fun getLayoutId(viewType: Int) = R.layout.item_grid_payment_adpater
fun getPosition()=mposition
}
......@@ -54,7 +54,7 @@ interface MainApi {
/**
* 获取支付参数
*/
@POST("api/trade/getVipPayParams")
@POST("api/getVipPayParams")
fun getVipPayParams(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<WxPayParamBean>>>
/**
......
......@@ -7,12 +7,12 @@ class VipBean : Serializable {
inner class ListBean : Serializable {
var id: Int = 0 // 1
var price: Int = 0// 78
var price: Double = 0.0// 78
var days: Int = 0 // 365
var remarks: String = "" // 看更多地图
var title: String = ""// 包年会员
var activityType: Int = 0 // 0
var oldPrice: Int = 0 // 138
var oldPrice: Double = 0.0 // 138
var pid: String = ""// 1
}
}
......
......@@ -12,15 +12,15 @@ public class WxPayParamBean implements Serializable {
* tid : 2016514565805500001
*/
private ParamsBean params;
private ParamsBean appPayParams;
private long tid;
public ParamsBean getParams() {
return params;
return appPayParams;
}
public void setParams(ParamsBean params) {
this.params = params;
this.appPayParams = params;
}
public long getTid() {
......
......@@ -4,6 +4,7 @@ import android.app.Dialog
import android.graphics.Color
import android.os.Bundle
import android.text.TextUtils
import android.view.KeyEvent
import android.view.View
import androidx.lifecycle.Observer
import com.alibaba.android.vlayout.DelegateAdapter
......@@ -33,6 +34,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null
private var gridPaymentAdapter: GridPaymentAdapter? = null
private var vipList: MutableList<VipBean.ListBean>? = null
private var currentPayType=""
......@@ -46,7 +48,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
super.initData()
if(!TextUtils.isEmpty(UserManager.INSTANCE.getUserID())){
//获取vip福利信息
viewModel.openvipInfo()
viewModel.getVipProductsByType()
//获取支付方式
viewModel.getpaymentwey("android")
}
......@@ -63,58 +65,13 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
ly_alipay.setOnClickListener(this)
}
private fun initView() {
val layoutInflater = layoutInflater
// 初始化数据
// 初始化数据
val list: MutableList<View> = ArrayList()
val page1 = layoutInflater.inflate(R.layout.view_data_page1, null)
val page2 = layoutInflater.inflate(R.layout.view_data_page2, null)
val page3 = layoutInflater.inflate(R.layout.view_data_page3, null)
val page4 = layoutInflater.inflate(R.layout.view_data_page4, null)
val page5 = layoutInflater.inflate(R.layout.view_data_page5, null)
val page6 = layoutInflater.inflate(R.layout.view_data_page6, null)
val page7 = layoutInflater.inflate(R.layout.view_data_page7, null)
val page8 = layoutInflater.inflate(R.layout.view_data_page8, null)
list.add(page1)
list.add(page2)
list.add(page3)
list.add(page4)
list.add(page5)
list.add(page6)
list.add(page7)
list.add(page8)
//设置显示的数据
cfp_data_viewpager.setViewList(list)
//设置header样式
tv_title.text = "成为会员"
tv_title.setTextColor(Color.WHITE)
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back_white)
iv_left_icon.setPadding(AppUtils.dp2Px(this, 15F), AppUtils.dp2Px(this, 15F),
AppUtils.dp2Px(this, 15F), AppUtils.dp2Px(this, 15F))
iv_left_icon.visibility = View.VISIBLE
header_line.visibility = View.GONE
//recycleView管理(展示套餐推荐)
vLayout = VirtualLayoutManager(this)
mAdapter = DelegateAdapter(vLayout, false)
binding.listview.adapter = mAdapter
binding.listview.layoutManager = vLayout
}
override fun initViewObservable() {
super.initViewObservable()
viewModel.Vipdata.observe(this, Observer<VipBean> {
vipList = it.list as MutableList<VipBean.ListBean>?
//展示 推荐套餐内容
mAdapter?.addAdapter(GridPaymentAdapter(this, it.list!!))
gridPaymentAdapter=GridPaymentAdapter(this, it.list!!)
mAdapter?.addAdapter(gridPaymentAdapter)
})
viewModel.vippayParams.observe(this, Observer<WxPayParamBean> {
if (TextUtils.equals(currentPayType, "WEIXIN")) {
......@@ -162,6 +119,15 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
}
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
when (keyCode) {
KeyEvent.KEYCODE_BACK -> {
backvipDialog()
}
}
return true
}
private fun setfirstpaymentwey(paymentwey: String) {
if (paymentwey.equals("WEIXIN")) {
setOnChecked(1)
......@@ -174,7 +140,6 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
when (v?.id) {
R.id.iv_left_icon -> {
backvipDialog()
// finish()
}
R.id.ly_weixin -> {//微信支付
//设置选中样式
......@@ -187,13 +152,17 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
currentPayType="ALIPAY"
}
R.id.bt_try -> {//点击开通全球会员按钮
if (vipList != null && vipList!!.size > 0) {
if (TextUtils.equals("WEIXIN",currentPayType)) {
viewModel.getVipPayParams("WEIXIN", vipList!![0].pid)
} else {
viewModel.getVipPayParams("ALIPAY", vipList!![1].pid)
payVip()
}
}
}
private fun payVip(){
if (vipList != null && vipList!!.size > 0&&gridPaymentAdapter!=null) {
if (TextUtils.equals("WEIXIN",currentPayType)) {
viewModel.getVipPayParams("WEIXIN", vipList!![gridPaymentAdapter!!.getPosition()].pid)
} else {
viewModel.getVipPayParams("ALIPAY", vipList!![gridPaymentAdapter!!.getPosition()].pid)
}
}
}
......@@ -201,14 +170,15 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
private fun backvipDialog() {
DialogUtils.showbackvipDialog(this, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
when (v?.id) {
R.id.tv_payment -> {//继续支付
if (dialog != null && dialog.isShowing) {
dialog.dismiss()
}
when (v?.id) {
R.id.tv_payment -> {//继续支付
payVip()
}
R.id.tv_close -> {//取消
startActivityThenKill(MainActivity::class.java)
finish()
}
}
......@@ -248,8 +218,9 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
if (isPay) {
//支付成功
UserManager.INSTANCE.setVipFlag(true)
com.blankj.utilcode.util.ToastUtils.showShort("支付成功")
finish()
}
viewModel.queryVipOrder(wxParanBean.tid.toString())
}) { throwable ->
ToastUtils.showShort("支付异常,请联系管理员")
}
......@@ -261,13 +232,62 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
if (isPay) {
//支付成功
UserManager.INSTANCE.setVipFlag(true)
com.blankj.utilcode.util.ToastUtils.showShort("支付成功")
finish()
}
viewModel.queryVipOrder(wxParanBean.tid.toString())
// viewModel.queryVipOrder(wxParanBean.tid.toString())
com.blankj.utilcode.util.ToastUtils.showShort("支付成功")
finish()
}) { throwable ->
ToastUtils.showShort("支付异常,请联系管理员")
}
}
private fun initView() {
val layoutInflater = layoutInflater
// 初始化数据
// 初始化数据
val list: MutableList<View> = ArrayList()
val page1 = layoutInflater.inflate(R.layout.view_data_page1, null)
val page2 = layoutInflater.inflate(R.layout.view_data_page2, null)
val page3 = layoutInflater.inflate(R.layout.view_data_page3, null)
val page4 = layoutInflater.inflate(R.layout.view_data_page4, null)
val page5 = layoutInflater.inflate(R.layout.view_data_page5, null)
val page6 = layoutInflater.inflate(R.layout.view_data_page6, null)
val page7 = layoutInflater.inflate(R.layout.view_data_page7, null)
val page8 = layoutInflater.inflate(R.layout.view_data_page8, null)
list.add(page1)
list.add(page2)
list.add(page3)
list.add(page4)
list.add(page5)
list.add(page6)
list.add(page7)
list.add(page8)
//设置显示的数据
cfp_data_viewpager.setViewList(list)
//设置header样式
tv_title.text = "成为会员"
tv_title.setTextColor(Color.WHITE)
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back_white)
iv_left_icon.setPadding(AppUtils.dp2Px(this, 15F), AppUtils.dp2Px(this, 15F),
AppUtils.dp2Px(this, 15F), AppUtils.dp2Px(this, 15F))
iv_left_icon.visibility = View.VISIBLE
header_line.visibility = View.GONE
//recycleView管理(展示套餐推荐)
vLayout = VirtualLayoutManager(this)
mAdapter = DelegateAdapter(vLayout, false)
binding.listview.adapter = mAdapter
binding.listview.layoutManager = vLayout
}
}
......@@ -25,20 +25,19 @@ class OpenvipViewModel(application: Application) : BaseViewModel(application) {
*
* @param mobile
*/
fun openvipInfo() {
fun getVipProductsByType() {
val vo = HashMap<String, Any>()
vo["type"] = 1
ApiModel.openvip(lifecycleProvider, vo).safeSubscribe(
ApiModel.getVipProductsByType(lifecycleProvider, vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<VipBean>>(
this@OpenvipViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<VipBean>) {
Vipdata.value = response.result
KLog.e("openvip", response.result.toString())
}
override fun onError(e: Throwable) {
KLog.e("openvip", "发送验证码错误")
KLog.e("getVipProductsByType", e.printStackTrace())
}
})
}
......@@ -79,6 +78,7 @@ class OpenvipViewModel(application: Application) : BaseViewModel(application) {
}
override fun onError(e: Throwable) {
KLog.e("getVipPayParams", e.printStackTrace())
}
}
)
......
......@@ -41,7 +41,7 @@ object ApiModel {
/**
* 开通会员
*/
fun openvip(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>): Observable<Response<BaseResponse<VipBean>>> {
fun getVipProductsByType(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>): Observable<Response<BaseResponse<VipBean>>> {
return HttpManager.getInstance()
.execute(lifecycleProvider, MainApi.newInstance().getVipProductsByType(map))
}
......
......@@ -20,6 +20,8 @@ import com.mints.street.main.my.PermissionsActivity
import com.mints.street.manager.CsjGroMoreManager
import com.mints.street.manager.UserManager
import com.tencent.mmkv.MMKV
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
/**
* 描述:gromore开屏页
......@@ -28,7 +30,7 @@ import com.tencent.mmkv.MMKV
*/
class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
private var mSplashContainer: FrameLayout? = null
private var msplash: FrameLayout? = null
private var mTTSplashAd: TTSplashAd? = null
private val AD_TIME_OUT = 3000
private var onPaused = false
......@@ -48,7 +50,6 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
return
}
//校验App签名
checkAppSign()
}
......@@ -81,8 +82,8 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
mTTSplashAd?.destroy()
mTTSplashAd=null
mSplashContainer?.removeAllViews()
mSplashContainer=null
msplash?.removeAllViews()
msplash=null
}
/**
......@@ -94,7 +95,7 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
finish()
} else {
// try {
// mSplashContainer = findViewById(R.id.splash_container)
// msplash = findViewById(R.id.splash_container)
// //加载开屏广告
// loadSplashAd()
// } catch (e: Exception) {
......@@ -134,7 +135,7 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
}
override fun onSplashAdLoadSuccess() {
mTTSplashAd?.showAd(mSplashContainer)
mTTSplashAd?.showAd(msplash)
}
override fun onAdLoadTimeout() {
......
......@@ -29,10 +29,22 @@
android:id="@+id/item_phone"
layout="@layout/item_settings" />
<View
style="@style/view_line_E6E6E6"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_alignParentBottom="true" />
<include
android:id="@+id/item_userAgree"
layout="@layout/item_settings" />
<View
style="@style/view_line_E6E6E6"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_alignParentBottom="true" />
<include
android:id="@+id/item_privacyAgree"
layout="@layout/item_settings" />
......
......@@ -5,93 +5,8 @@
android:id="@+id/fl_splash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<!--这里模拟一张oneshot单的焦点图展示-->
<ImageView
android:id="@+id/oneshot_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="400px" />
<RelativeLayout
android:id="@+id/splash_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<!-- 广点通开屏广告支持“半屏/全屏”展示,开发者可以把Logo区域放在屏幕底部,然后在Logo上方提供一个容器来放置半开屏广告,请注意此容器高度不得小于400dp -->
<!-- 1.Logo区域:展示半开屏广告时使用,如果想展示全开屏广告,可以不需要这个Logo区域 -->
<!-- 注意:如需要这个Logo区域,建议开发者使用自己的Logo资源,而不是联盟的Logo资源@drawable/gdt_splash_logo,资源规格可参照@drawable/gdt_splash_logo -->
<FrameLayout
android:id="@+id/splash_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/app_logo" />
<!-- 2.预设开屏图片区域: -->
<!-- 开发者可以把自家App设计开屏图片摆放在这里,本示例中放置了一张静态图片。!-->
<!-- 注意1:直接将此图放在广告容器的下面即可,始终不要将广告容器splash_container的设为invisible,否则将不会展示广告无法计费,返回错误码600。-->
<!-- 注意2:建议开发者使用自己的开屏图片资源,而不是联盟的@drawable/splash_holder,资源规格可参照@drawable/splash_holder -->
<ImageView
android:id="@+id/splash_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/app_logo"
android:scaleType="fitXY" />
<!-- 3.开屏广告容器区域:-->
<!-- 注意:该区域高度不得小于400dp。在本示例中没有写死splash_container的高度值,是因为第1部分的app_logo区域是一个高度很小的图片。 -->
<ImageView
android:id="@+id/app_logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
/>
<!-- 4.自定义跳过按钮区域:开发者可以根据需要自己实现不同样式的跳过按钮 -->
<!-- 注意1:根据广告法规定,跳过按钮必须在屏幕当中出现。因此广告展示的时候,必须让将SkipView显示出来,即visible,否则将SDK将不展示广告,返回错误码608。。 -->
<!-- 注意2:SDK除了会检查跳过按钮的可见性,还将检测它的尺寸,其尺寸不得小于3dp*3dp,否则将SDK将不展示广告,返回错误码608。 -->
<TextView
android:id="@+id/skip_view"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_bg_circle"
android:gravity="center"
android:text="点击跳过"
android:textColor="@android:color/white"
android:textSize="14sp"
android:visibility="gone" />
<!-- 本示例省略了自定义的倒计时,和跳过按钮放在一起实现了。开发者也可以实现自己的倒计时View,方法是在onADTick回调中获得广告剩余的展示时间,并自由决定倒计时View的样式,SDK对倒计时的View没有要求。 -->
<!-- 自定义wifi预加载按钮,需设置状态为不显示,当素材为视频且视频开始播放时,SDK内部会处理为显示状态-->
<TextView
android:id="@+id/preload_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="16dp"
android:background="@drawable/shape_bg_circle"
android:gravity="center"
android:text="已Wi-Fi预加载"
android:textColor="@android:color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
android:background="@android:color/darker_gray">
</FrameLayout>
<data>
<variable
......
......@@ -123,7 +123,11 @@
<include
android:id="@+id/aboutus"
layout="@layout/item_settings" />
<View
style="@style/view_line_E6E6E6"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_alignParentBottom="true" />
<include
android:id="@+id/moresettings"
layout="@layout/item_settings" />
......
......@@ -32,8 +32,4 @@
android:layout_centerVertical="true"
android:visibility="gone" />
<View
style="@style/view_line_E6E6E6"
android:layout_alignParentBottom="true" />
</RelativeLayout>
\ 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