Commit 4f318c48 by 刘鹏

Merge branch 'feat/lp/lp_sub_pay' into 'd/v4.4.05'

咨询支付流程/预约时间体验优化

See merge request app_android_lib/YDL-Component!271
parents a518e9b8 61bdb26b
......@@ -20,8 +20,8 @@ import java.util.List;
*/
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
// public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
@Override
......
package com.ydl.component.service.web;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Rect;
......@@ -11,20 +12,13 @@ import com.ydl.confide.home.event.ChangeAnotherExpertEvent;
import com.ydl.webview.H5JsBean;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydl_router.manager.YDLRouterParams;
import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.consultant.preview.GPreviewBuilder;
import com.yidianling.consultant.preview.UserViewInfo;
import com.yidianling.im.api.service.IImService;
import com.yidianling.muse.activity.ChooseMusicActivity;
//import static com.ydl.ydlcommon.router.IYDLRouterConstant.ROUTER_MUSE_PLAY;
import de.greenrobot.event.EventBus;
import com.yidianling.im.event.CloseBottomWebviewEvent;
import com.yidianling.muse.activity.ChooseMusicActivity;
import java.util.ArrayList;
import java.util.List;
......@@ -571,6 +565,15 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
}
}
/**
* 打开时间选择器
*/
@SuppressLint("CheckResult")
@Override
public void openTimePicker(String jsCallBackName, String day, String doctorId, String orderId) {
}
@Override
public void showCommentArticleDialog(H5JsBean.H5JsCmd.Params params) {
......
......@@ -14,6 +14,7 @@ import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.user.UserHelper
......@@ -459,6 +460,13 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
"switch_push_status" -> {
wvEnventPro?.switchPushStatus(jsData.cmd?.params)
}
// 打开时间选择器
"requestSelectTime"->{
if (Utils.isFastClick()){
return
}
wvEnventPro?.openTimePicker(jsData.cmd?.params?.callBack,jsData.cmd?.params?.day,jsData.cmd?.params?.doctorId.toString(),jsData.cmd?.params?.orderId)
}
"open_article_comment_dialog" -> {
wvEnventPro?.showCommentArticleDialog(jsData.cmd?.params)
......
......@@ -211,4 +211,8 @@ public interface WebViewClientClickListener {
void resourceToPreview(H5JsBean.H5JsCmd.Params params);
void showDocBooking(H5JsBean.H5JsCmd.Params params);
// 打开时间选择器
void openTimePicker(String jsCallBackName,String day,String doctorId,String orderId);
}
......@@ -43,6 +43,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'in.xiandan:count-down-timer:1.0.3'
kapt 'com.alibaba:arouter-compiler:1.2.2'
implementation rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
api rootProject.ext.dependencies["ydl-user-router"]
......
......@@ -82,6 +82,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
YDLImageCacheManager.showImage(this, url, imgView, ops)
}
override fun showPromptPayment(promptPaymentBean: PromptPaymentBean) {
}
override fun showImage(
url: String?,
imgView: ImageView,
......
......@@ -31,9 +31,11 @@ import com.ydl.ydlcommon.base.BaseMvpFragment
import com.ydl.ydlcommon.base.config.ChannelConfig
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.ui.LogoLoadingView
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.DisplayUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
......@@ -42,8 +44,8 @@ import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.adapter.ExpertSearchAdapter
import com.yidianling.consultant.bean.FunctionWordConsultBean
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.dialog.ConsultSubPayDialog
import com.yidianling.consultant.listener.OnCategoriesSelectedListener
import com.yidianling.consultant.listener.OnExpertClickListener
import com.yidianling.consultant.listener.OnFilterConfirmListener
......@@ -57,6 +59,7 @@ import com.yidianling.consultant.ui.view.FilterPopupWindow
import com.yidianling.consultant.ui.view.SortPopupWindow
import com.yidianling.consultant.ui.view.topView.RecommendListView
import com.yidianling.home.api.event.HomeModuleTabEvent
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -69,6 +72,7 @@ import kotlinx.android.synthetic.main.consultant_layout_search_toolbar.*
import org.json.JSONObject
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import kotlin.collections.ArrayList
@Route(path = "/consultant/consultant")
class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPresenter>(),
......@@ -81,6 +85,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
var endTime = 0L
private var mIdssign1: String = "" // 列表埋点咨询师列表id拼接参数
var bottomWordDisposable: Disposable? = null
var isShow: Boolean = false
private lateinit var bottomWordlist: List<FunctionWordBean>
override fun layoutResId(): Int {
return R.layout.consultant_activity_expert_search_list
......@@ -125,6 +130,19 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
var consultSubPayDialog: ConsultSubPayDialog? = null
override fun showPromptPayment(promptPaymentBean: PromptPaymentBean) {
if (promptPaymentBean.toPayTime != 0L) {
//有订单
consultSubPayDialog = activity?.let { ConsultSubPayDialog(it, promptPaymentBean) }
consultSubPayDialog?.show()
consultSubPayDialog?.setOnDismissListener {
consultSubPayDialog = null
}
}
}
override fun showImage(
url: String?,
imgView: ImageView,
......@@ -306,6 +324,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
isShow = isVisibleToUser
if (isVisibleToUser && isResumed) {
startTime = System.currentTimeMillis()
} else {
......@@ -1465,6 +1484,22 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//
needRefresh = true
}
val orderToPayTime = SharedPreferencesEditor.getString("orderToPayTime")
var timeLimit = if (TextUtils.isEmpty(orderToPayTime)) {
0L
} else {
orderToPayTime.toLong()
}
if (isShow && !(consultSubPayDialog != null && consultSubPayDialog?.isShowing == true)) {
if (findRouteService(IUserService::class.java).isLogin() && System.currentTimeMillis() > timeLimit) {
getPresenter().fetchPromptPayment()
}
}
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_PAGE_VISIT)
ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit", "6")
}
......
......@@ -278,4 +278,21 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
}
})
}
@SuppressLint("CheckResult")
fun fetchPromptPayment() {
SearchApi.getSearchApi()
.promptPayment()
.compose(RxLifecycleUtils.bindToLifecycle(mView))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
mView.showPromptPayment(resp)
}, { t ->
HttpErrorUtils.handleError(BaseApp.getApp(), t)
mView.fetchFailed(t.message)
})
}
}
\ No newline at end of file
......@@ -4,10 +4,7 @@ import android.widget.ImageView
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydlcommon.mvp.base.IView
import com.yidianling.consultant.bean.FunctionWordConsultBean
import com.yidianling.consultant.model.bean.ExpertServiceItem
import com.yidianling.consultant.model.bean.Extras
import com.yidianling.consultant.model.bean.FunctionWordBean
import com.yidianling.consultant.model.bean.HeadData
import com.yidianling.consultant.model.bean.*
/**
* Created by zqk on 17-9-19.
......@@ -38,4 +35,6 @@ interface IExpertSearchView : IView {
*/
fun showImage(url : String?, imgView : ImageView, ops : SimpleImageOpConfiger)
fun showPromptPayment(promptPaymentBean: PromptPaymentBean)
}
\ No newline at end of file
package com.yidianling.consultant.dialog
import `in`.xiandan.countdowntimer.CountDownTimerSupport
import `in`.xiandan.countdowntimer.OnCountDownTimerListener
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.text.TextUtils
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.R
import com.yidianling.consultant.model.bean.PromptPaymentBean
import java.text.DecimalFormat
import java.text.SimpleDateFormat
import java.util.*
/**
* 咨询助理浮层
* Created by xj on 2019/10/30.
*/
class ConsultSubPayDialog(
private val mContext: Context,
private val promptPaymentBean: PromptPaymentBean
) : Dialog(mContext, R.style.dialog_default_style) {
var mTimer: CountDownTimerSupport? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.consultant_expert_consult_sub_pay_dialog)
val params = window.attributes
params.width = WindowManager.LayoutParams.WRAP_CONTENT
params.height = WindowManager.LayoutParams.WRAP_CONTENT
params.gravity = Gravity.CENTER
window.attributes = params
setCanceledOnTouchOutside(false)
initView();
}
private fun initView() {
var titleTv = findViewById<TextView>(R.id.tv_title)
var timeTv = findViewById<TextView>(R.id.tv_time)
titleTv.paint.isFakeBoldText = true
Glide.with(mContext)
.load(promptPaymentBean.smallImage).into(findViewById<ImageView>(R.id.avaterIv))
findViewById<TextView>(R.id.nameTv).text = promptPaymentBean.name
findViewById<TextView>(R.id.desTv).text = promptPaymentBean.productName
val decimalFormat = DecimalFormat("###.##")
val price = decimalFormat.format(promptPaymentBean.price)
findViewById<TextView>(R.id.priceTv).text = "¥$price"
var format = SimpleDateFormat("HH:mm:ss");
format.timeZone = TimeZone.getTimeZone("GMT+0");
var millisInFuture = promptPaymentBean.currentTime?:0 - (promptPaymentBean.toPayTime?:0L)
mTimer = CountDownTimerSupport(millisInFuture, 1000)
mTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) {
val time = format.format(millisUntilFinished)
timeTv.text = time
}
override fun onFinish() {
var nextShowTime = System.currentTimeMillis() + 24 * 60 * 60 * 1000
SharedPreferencesEditor.putString("orderToPayTime", nextShowTime.toString())
dismiss()
}
override fun onCancel() {
// 倒计时手动停止
}
})
mTimer?.start()
findViewById<TextView>(R.id.tv_close).setOnClickListener {
var nextShowTime = System.currentTimeMillis() + 24 * 60 * 60 * 1000
SharedPreferencesEditor.putString("orderToPayTime", nextShowTime.toString())
mTimer?.stop()
dismiss()
}
findViewById<View>(R.id.pay).setOnClickListener {
if (!TextUtils.isEmpty(promptPaymentBean.orderDetailUrl)) {
val h5Params = H5Params(promptPaymentBean.orderDetailUrl!!, null)
NewH5Activity.start(context, h5Params)
dismiss()
} else {
ToastUtil.toastShort("跳转失败")
dismiss()
}
var nextShowTime = System.currentTimeMillis() + 24 * 60 * 60 * 1000
SharedPreferencesEditor.putString("orderToPayTime", nextShowTime.toString())
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
if (mTimer != null) {
mTimer?.stop()
mTimer = null
}
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.yidianling.consultant.bean.*
import com.yidianling.consultant.model.bean.ExpertBean
import com.yidianling.consultant.model.bean.FunctionWordBean
import com.yidianling.consultant.model.bean.HeadData
import com.yidianling.consultant.model.bean.PromptPaymentBean
import io.reactivex.Observable
import retrofit2.http.*
......@@ -112,4 +113,10 @@ interface SearchApi {
): Observable<BaseAPIResponse<Long>>
//搜索条件
@GET("consult/user/order/promptPayment")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun promptPayment(): Observable<BaseAPIResponse<PromptPaymentBean>>
}
\ No newline at end of file
package com.yidianling.consultant.model.bean
data class PromptPaymentBean(
var uid: String? = "",
var orderId: String? = "",
var toPayTime: Long? = 0,
var smallImage: String? = "",
var name: String? = "",
var price: Float? = 0.00f,
var productName: String? = "",
var doctorId: String? = "",
var productId: String? = "",
var createTime: String? = "",
var orderToPayTime: Long? = 0,
var orderDetailUrl: String? = "",
var currentTime: Long? = 0
)
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/platform_dp_20" />
<solid android:color="#FF6B5D" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="4dp"/>
<solid android:color="#F6F6F7" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12dp"/>
<solid android:color="#ffffff" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="307dp"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/white"
app:cardCornerRadius="12dp"
android:layout_centerInParent="true">
<RelativeLayout
android:layout_width="307dp"
android:layout_height="wrap_content"
android:background="@color/white"
android:layout_centerInParent="true">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/platform_dp_16"
android:text="你还有订单等待付款"
android:textColor="#1C1F28"
android:textSize="18sp" />
<LinearLayout
android:id="@+id/ll_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_4"
android:layout_below="@+id/tv_title"
android:layout_centerHorizontal="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="还剩"
android:textColor="#1C1F28"
android:textSize="@dimen/platform_sp_14" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00:12:21"
android:layout_marginLeft="@dimen/platform_dp_2"
android:layout_marginRight="@dimen/platform_dp_2"
android:textColor="#FF9534"
android:textSize="@dimen/platform_sp_14" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="订单将关闭"
android:textColor="#1C1F28"
android:textSize="@dimen/platform_sp_14" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_content"
android:layout_below="@+id/ll_time"
android:layout_width="match_parent"
android:layout_height="66dp"
android:background="@drawable/consultant_bg_sub_pay"
android:layout_marginTop="@dimen/platform_dp_16"
android:layout_marginLeft="@dimen/platform_dp_16"
android:layout_marginRight="@dimen/platform_dp_16"
android:orientation="horizontal">
<ImageView
android:id="@+id/avaterIv"
android:layout_width="41dp"
android:layout_height="41dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/platform_dp_12"
android:layout_marginRight="@dimen/platform_dp_8"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/nameTv"
android:layout_marginTop="@dimen/platform_dp_11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#1C1F28"
android:maxLines="1"
android:ellipsize="end"
android:layout_marginRight="@dimen/platform_dp_12"
/>
<TextView
android:id="@+id/desTv"
android:layout_marginTop="@dimen/platform_dp_6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#62636F"
android:maxLines="1"
android:ellipsize="end"
android:layout_marginBottom="@dimen/platform_dp_11"
android:layout_marginRight="@dimen/platform_dp_12"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/pay"
android:layout_below="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="@dimen/platform_dp_40"
android:padding="@dimen/platform_dp_9"
android:layout_marginLeft="@dimen/platform_dp_16"
android:layout_marginRight="@dimen/platform_dp_16"
android:gravity="center"
android:background="@drawable/consultant_bg_radius_red_20"
android:layout_marginTop="@dimen/platform_dp_28">
<TextView
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="@dimen/sp_16"
android:text="去付款"
/>
<TextView
android:id="@+id/priceTv"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="@dimen/sp_16"
android:layout_marginLeft="@dimen/platform_dp_5"
android:text="¥200"
/>
</LinearLayout>
<TextView
android:id="@+id/tv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="稍后再说"
android:layout_below="@+id/pay"
android:layout_centerHorizontal="true"
android:textSize="@dimen/platform_sp_14"
android:paddingLeft="@dimen/platform_dp_5"
android:paddingRight="@dimen/platform_dp_5"
android:paddingBottom="@dimen/platform_dp_3"
android:paddingTop="@dimen/platform_dp_3"
android:textColor="#62636F"
android:layout_marginTop="@dimen/platform_dp_16"
android:layout_marginBottom="@dimen/platform_dp_16"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
......@@ -45,4 +45,12 @@
</style>
<style name="dialog_default_style" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/consultant_bg_sub_pay_dialog</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
</resources>
......@@ -44,6 +44,7 @@ import com.yidianling.im.session.extension.CustomAttachConsult;
import com.yidianling.im.session.extension.CustomAttachConsultCallStatus;
import com.yidianling.im.session.extension.CustomAttachConsultPerfectData;
import com.yidianling.im.session.extension.CustomAttachConsultSubScript;
import com.yidianling.im.session.extension.CustomAttachConsultSubScriptPayment;
import com.yidianling.im.session.extension.CustomAttachLingXiJumpConfideList;
import com.yidianling.im.session.extension.CustomAttachLingxiAnswerQuestion;
import com.yidianling.im.session.extension.CustomAttachLingxiFirstQuestion;
......@@ -85,6 +86,7 @@ import com.yidianling.im.session.viewholder.MsgViewHolderConfirmOrder;
import com.yidianling.im.session.viewholder.MsgViewHolderConsult;
import com.yidianling.im.session.viewholder.MsgViewHolderConsultCallStatus;
import com.yidianling.im.session.viewholder.MsgViewHolderConsultSubScribe;
import com.yidianling.im.session.viewholder.MsgViewHolderConsultSubScribePayment;
import com.yidianling.im.session.viewholder.MsgViewHolderCustomTip;
import com.yidianling.im.session.viewholder.MsgViewHolderCustomerServiceCard;
import com.yidianling.im.session.viewholder.MsgViewHolderDefCustom;
......@@ -479,6 +481,7 @@ public class SessionHelper {
NimUIKit.registerMsgItemViewHolder(CustomAttachLingxiAnswerQuestion.class, MsgViewHolderLingxiAnswerQuestion.class);//灵犀2.0-回答问题
NimUIKit.registerMsgItemViewHolder(CustomAttachLingxiFirstQuestion.class, MsgViewHolderLingxiFirstQuestion.class);//灵犀2.0-首问语
NimUIKit.registerMsgItemViewHolder(CustomAttachLingXiJumpConfideList.class, MsgViewHolderLingXiJumpConfideList.class);//灵犀2.0-倾诉列表
NimUIKit.registerMsgItemViewHolder(CustomAttachConsultSubScriptPayment.class, MsgViewHolderConsultSubScribePayment.class);//咨询预约支付
}
......
package com.yidianling.im.session.extension;
import com.alibaba.fastjson.JSONObject;
/**
* 确认预约时间
* Created by harvie on 2017/1/10.
*/
public class CustomAttachConsultSubScriptPayment extends CustomAttachment {
private String TITLE = "title";
private String PRODUCT_NAME = "productName";
private String CONSULT_DATE = "bookingTime";
private String CONSULT_TIME = "consultDuration";
private String CONSULT_TYPE = "serviceType";
private String FLAG = "flag";
private String URL = "url";
private String IS_PACKAGE = "isPackage";
private static final String NEWSORDERID = "newOrderId";//用于跳转新版订单详情
private static final String STATUS = "status";//状态,1代表已确认,0代表待确认
private String FROM_CONTENT = "from_content";
private String TO_CONTENT = "to_content";
public String title; //自定义消息标题
public String productName;//商品名称
public String consultDate;//咨询时间
public String consultTime;//咨询时长
public String consultType;//咨询方式
public String url;//跳转url
public int flag;//0 未确认 1已确认
public byte isPackage = 0; //是否套餐 1单次 2套餐
/***新订单*/
public String newOrderId;
public String from_content;
public String to_content;
public CustomAttachConsultSubScriptPayment() {
super(CustomAttachmentType.TYPE_CONSULT_SUBSCRIBE_PAY);
}
@Override
protected void parseData(JSONObject data) {
title = data.getString(TITLE);
productName = data.getString(PRODUCT_NAME);
consultDate = data.getString(CONSULT_DATE);
consultTime = data.getString(CONSULT_TIME);
consultType = data.getString(CONSULT_TYPE);
url = data.getString(URL);
flag = data.getInteger(FLAG);
isPackage = data.getByte(IS_PACKAGE);
this.newOrderId = data.getString(NEWSORDERID);
from_content = data.getString(FROM_CONTENT);
to_content = data.getString(TO_CONTENT);
}
@Override
protected JSONObject packData() {
JSONObject data = new JSONObject();
data.put(TITLE,title);
data.put(PRODUCT_NAME,productName);
data.put(CONSULT_DATE,consultDate);
data.put(CONSULT_TIME,consultTime);
data.put(CONSULT_TYPE,consultType);
data.put(URL,url);
data.put(FLAG,flag);
data.put(IS_PACKAGE,isPackage);
data.put(NEWSORDERID, newOrderId);
data.put(FROM_CONTENT, from_content);
data.put(TO_CONTENT, to_content);
return data;
}
}
......@@ -158,6 +158,9 @@ public class CustomAttachParser implements MsgAttachmentParser {
case CustomAttachmentType.TYPE_LINGXI_FIRST_QUESTION: //首问语
attachment = new CustomAttachLingxiFirstQuestion();
break;
case CustomAttachmentType.TYPE_CONSULT_SUBSCRIBE_PAY:
attachment = new CustomAttachConsultSubScriptPayment();
break;
default:
attachment = new DefaultCustomAttachment();
break;
......
......@@ -55,6 +55,9 @@ public interface CustomAttachmentType {
int TYPE_LINGXI_ANSWER_QUESTION=56;//回答消息
int TYPE_LINGXI_TEST_QUESTION=60;//测评结果
int TYPE_LINGXI_JUMP_CONFIDE_LIST = 73; // 跳转倾诉列表
int TYPE_CONSULT_SUBSCRIBE_PAY = 74; // 预约支付
}
......@@ -103,10 +103,8 @@ public class MsgViewHolderConsultSubScribe extends MsgViewHolderBase {
if (flag==1){
img_icon.setVisibility(View.VISIBLE);
tv_title.setTextColor(ContextCompat.getColor(context,R.color.im_color_00CC88));
}else {
img_icon.setVisibility(View.GONE);
tv_title.setTextColor(ContextCompat.getColor(context,R.color.platform_color_242424));
}
hideItemBg();
......
package com.yidianling.im.session.viewholder;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.yidianling.im.R;
import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.session.extension.CustomAttachConsultSubScriptPayment;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
/**
* author : harvie
* 确认咨询预约消息
*/
public class MsgViewHolderConsultSubScribePayment extends MsgViewHolderBase {
private TextView tv_title,tv_content,tv_date,tv_time_long,tv_type,tv_package;
private ImageView img_icon;
private View lin_root;
public String title; //自定义消息标题
public String productName;//商品名称
public String consultDate;//咨询时间
public String consultTime;//咨询时长
public String consultType;//咨询方式
public String url;//跳转url
public int flag;//0 未确认 1已确认
public byte isPackage;
/***新订单id*/
public String newOrderId;
public String from_content;
public String to_content;
public MsgViewHolderConsultSubScribePayment(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.im_ui_message_custom_consult_subscribe;
}
@Override
protected void inflateContentView() {
lin_root = view.findViewById(R.id.lin_root);
tv_title = view.findViewById(R.id.tv_title);
tv_content = view.findViewById(R.id.tv_content);
tv_date = view.findViewById(R.id.tv_date);
tv_time_long = view.findViewById(R.id.tv_time_long);
tv_type = view.findViewById(R.id.tv_type);
img_icon = view.findViewById(R.id.img_icon);
tv_package = view.findViewById(R.id.tv_package);
if (isReceivedMessage()){
setAvatarRightInVisibity();
lin_root.setBackgroundResource(R.drawable.im_bg_radius_no_topleft_white_8);
}else {
setAvatarLeftInVisibity();
lin_root.setBackgroundResource(R.drawable.im_bg_radius_no_topright_white_8);
}
}
@Override
protected void bindContentView() {
if (isReceivedMessage()){
setAvatarRightInVisibity();
}else {
setAvatarLeftInVisibity();
}
MsgAttachment attachment = message.getAttachment();
if (attachment instanceof CustomAttachConsultSubScriptPayment) {
title = ((CustomAttachConsultSubScriptPayment) attachment).title;
productName = ((CustomAttachConsultSubScriptPayment) attachment).productName;
consultDate = ((CustomAttachConsultSubScriptPayment) attachment).consultDate;
consultTime = ((CustomAttachConsultSubScriptPayment) attachment).consultTime;
consultType = ((CustomAttachConsultSubScriptPayment) attachment).consultType;
url = ((CustomAttachConsultSubScriptPayment) attachment).url;
flag = ((CustomAttachConsultSubScriptPayment) attachment).flag;
isPackage = ((CustomAttachConsultSubScriptPayment) attachment).isPackage;
newOrderId = ((CustomAttachConsultSubScriptPayment) attachment).newOrderId;
from_content = ((CustomAttachConsultSubScriptPayment) attachment).from_content;
to_content = ((CustomAttachConsultSubScriptPayment) attachment).to_content;
}
tv_title.setText(to_content);
tv_date.setText(consultDate);
tv_time_long.setText(consultTime);
tv_type.setText(consultType);
if (isPackage == 2){
tv_package.setVisibility(View.VISIBLE);
tv_content.setText("\u3000\u3000"+productName);
}else {
tv_package.setVisibility(View.GONE);
tv_content.setText(productName);
}
if (flag==1){
img_icon.setVisibility(View.VISIBLE);
}else {
img_icon.setVisibility(View.GONE);
}
hideItemBg();
}
@Override
protected void onItemClick() {
if (TextUtils.isEmpty(url)&& newOrderId == null){
return;
}
if (newOrderId == null || newOrderId.isEmpty()) {
NewH5Activity.start(context, new H5Params(url, null));
} else {
//跳转新订单详情页
H5Params orderParams = new H5Params(
ImConstants.Companion.getORDER_DETAIL() + (newOrderId.isEmpty() ? "" : newOrderId), null);
NewH5Activity.start(context, orderParams);
}
}
}
......@@ -18,7 +18,7 @@
android:layout_marginRight="4dp"
android:layout_alignTop="@+id/tv_title"
android:layout_alignBottom="@+id/tv_title"
android:src="@mipmap/im_consult_data_sure"
android:src="@mipmap/im_cunsult_data_sure_gary"
android:visibility="gone"
tools:visibility="gone"/>
......@@ -27,6 +27,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dp"
android:textStyle="bold"
android:textColor="@color/im_color_242424"
android:layout_toRightOf="@+id/img_icon"
tools:text="请确认我的预约消息"/>
......@@ -47,7 +48,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="14dp"
android:textStyle="bold"
android:textColor="@color/im_color_242424"
tools:text="\u3000\u3000幸福宝典fghrt ertyherthhtrht"/>
......@@ -68,7 +68,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_666666"
android:textSize="10dp"
android:textSize="12dp"
android:layout_marginTop="5.8dp"
android:layout_below="@+id/tv_content"
tools:text="咨询时间:2019-12-55 12:00:00"/>
......@@ -78,7 +78,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_999999"
android:textSize="10dp"
android:textSize="12dp"
android:layout_marginTop="2dp"
android:layout_below="@+id/tv_date"
tools:text="咨询时长:30分钟"/>
......@@ -88,7 +88,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_999999"
android:textSize="10dp"
android:textSize="12dp"
android:layout_marginTop="2dp"
android:layout_below="@+id/tv_time_long"
tools:text="咨询方式:电话"/>
......
......@@ -1226,6 +1226,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
});
} else {
if (h5Params.getUrl()!=null && h5Params.getUrl().contains("user/payment/detail")){
//付款详情页 付款详情页_返回点击
ActionCountUtils.Companion.count("consult_order_pay_details_page|return_click");
}
if (h5Params.isSplash()) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
......
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