|
|
@@ -1,6 +1,7 @@
|
|
|
package cn.muchinfo.rma.view.base.main
|
|
|
|
|
|
import android.Manifest
|
|
|
+import android.annotation.SuppressLint
|
|
|
import android.content.Intent
|
|
|
import android.content.pm.PackageManager
|
|
|
import android.os.Bundle
|
|
|
@@ -8,6 +9,7 @@ import android.view.Gravity
|
|
|
import android.view.LayoutInflater
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
+import android.widget.TextView
|
|
|
import androidx.core.app.ActivityCompat
|
|
|
import cn.muchinfo.rma.R
|
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
@@ -60,9 +62,11 @@ import org.jetbrains.anko.support.v4.UI
|
|
|
*/
|
|
|
class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>() {
|
|
|
|
|
|
+ lateinit var phone_num : TextView
|
|
|
+
|
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
|
- viewModel.initDataUsrAccount()
|
|
|
+ viewModel.getUserAccount()
|
|
|
viewModel.queryBrokerApply()
|
|
|
}
|
|
|
|
|
|
@@ -95,6 +99,7 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @SuppressLint("MissingPermission")
|
|
|
override fun onCreateView(
|
|
|
inflater: LayoutInflater,
|
|
|
container: ViewGroup?,
|
|
|
@@ -102,7 +107,7 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>() {
|
|
|
): View? {
|
|
|
EventBus.getDefault().register(this)
|
|
|
return UI {
|
|
|
-
|
|
|
+ viewModel.queryAreaFinanceConfig()
|
|
|
verticalLayout {
|
|
|
createLoadingDialog(hintStr = "请求中...").bindTaskStatus(
|
|
|
context,
|
|
|
@@ -198,19 +203,28 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>() {
|
|
|
linearLayout {
|
|
|
visibility = View.GONE
|
|
|
onThrottleFirstClick {
|
|
|
- if (viewModel.brokerApplyData.value?.applystatus == "1" || viewModel.brokerApplyData.value?.applystatus == "2"){//只展示
|
|
|
+ if (viewModel.brokerApplyData.value?.applystatus.isNullOrEmpty()){
|
|
|
val intent = Intent()
|
|
|
- intent.putExtra("type","3")
|
|
|
- intent.putExtra("data",viewModel.brokerApplyData.value)
|
|
|
+ intent.putExtra("type","1")
|
|
|
+ intent.putExtra("data",BrokerApplyData())
|
|
|
intent.setClass(context,ApplyPromotionCodeActivity::class.java)
|
|
|
ActivityUtils.startActivity(intent)
|
|
|
- }else if (viewModel.brokerApplyData.value?.applystatus == "3" || viewModel.brokerApplyData.value?.applystatus == "4"){//可修改
|
|
|
+ }else{
|
|
|
+ if (viewModel.brokerApplyData.value?.applystatus == "1" || viewModel.brokerApplyData.value?.applystatus == "2"){//只展示
|
|
|
+ val intent = Intent()
|
|
|
+ intent.putExtra("type","3")
|
|
|
+ intent.putExtra("data",viewModel.brokerApplyData.value)
|
|
|
+ intent.setClass(context,ApplyPromotionCodeActivity::class.java)
|
|
|
+ ActivityUtils.startActivity(intent)
|
|
|
+ }else if (viewModel.brokerApplyData.value?.applystatus == "3" || viewModel.brokerApplyData.value?.applystatus == "4"){//可修改
|
|
|
val intent = Intent()
|
|
|
intent.putExtra("type","2")
|
|
|
intent.putExtra("data",viewModel.brokerApplyData.value)
|
|
|
intent.setClass(context,ApplyPromotionCodeActivity::class.java)
|
|
|
ActivityUtils.startActivity(intent)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
viewModel.brokerApplyData.bindOptional(context){
|
|
|
if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.userinfotype == 2){
|
|
|
@@ -821,6 +835,12 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>() {
|
|
|
}.lparams(matchParent, autoSize(140))
|
|
|
|
|
|
linearLayout {
|
|
|
+ visibility = View.GONE
|
|
|
+ viewModel.areaFinanceConfigData.bindOptional(context){
|
|
|
+ if (it?.size ?: 0 > 0){
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
onThrottleFirstClick {
|
|
|
if (ActivityCompat.checkSelfPermission(
|
|
|
context,
|
|
|
@@ -836,7 +856,7 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>() {
|
|
|
// for ActivityCompat#requestPermissions for more details.
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- PhoneUtils.call("0755-36856253")
|
|
|
+ PhoneUtils.call(phone_num.text.toString())
|
|
|
}
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
|
@@ -849,10 +869,17 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>() {
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
|
|
|
textView {
|
|
|
- text = "0755-36856253"
|
|
|
+ phone_num = this
|
|
|
+ viewModel.areaFinanceConfigData.bindOptional(context){
|
|
|
+ if (it?.size ?: 0 > 0){
|
|
|
+ text = it?.get(0)?.customerservicenum
|
|
|
+ }
|
|
|
+ }
|
|
|
textSizeAuto = 29
|
|
|
textColorStr = "#FFA127"
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
+
|
|
|
+ emptyView()
|
|
|
}.lparams(matchParent, autoSize(80))
|
|
|
|
|
|
}.lparams(matchParent, matchParent)
|