|
|
@@ -72,15 +72,43 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
private val imageString: MutableLiveData<String> =
|
|
|
MutableLiveData<String>().apply { value = "" } // 文件地址
|
|
|
|
|
|
+ /**
|
|
|
+ * 身份证正面照片
|
|
|
+ */
|
|
|
+ private var frontIdCarduploadFile: String = "" // 上传成功后服务给的图片地址
|
|
|
+ private val frontIdCardimageString: MutableLiveData<String> =
|
|
|
+ MutableLiveData<String>().apply { value = "" } // 文件地址
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 身份证正面照片
|
|
|
+ */
|
|
|
+ private var backIdCarduploadFile: String = "" // 上传成功后服务给的图片地址
|
|
|
+ private val backIdCardimageString: MutableLiveData<String> =
|
|
|
+ MutableLiveData<String>().apply { value = "" } // 文件地址
|
|
|
+
|
|
|
lateinit var document_type_text: TextView
|
|
|
|
|
|
private var loadingDialog: Dialog? = null
|
|
|
|
|
|
lateinit var detailed_address: EditText
|
|
|
|
|
|
+ /**
|
|
|
+ * 纳税人识别号
|
|
|
+ */
|
|
|
+ lateinit var identification_number: EditText
|
|
|
|
|
|
/**
|
|
|
- * 企业名称
|
|
|
+ * 法定代表人(企业时输入)
|
|
|
+ */
|
|
|
+ lateinit var legal_representative: EditText
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业简称
|
|
|
+ */
|
|
|
+ lateinit var enterprise_referred: EditText
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业名称 (个人时是姓名 企业时是企业名称·)
|
|
|
*/
|
|
|
lateinit var enterprise_name: EditText
|
|
|
|
|
|
@@ -90,11 +118,16 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
lateinit var card_umber: EditText
|
|
|
|
|
|
/**
|
|
|
- * 手机号码
|
|
|
+ * 手机号码/个人时为手机号码,企业时为联系人手机号码
|
|
|
*/
|
|
|
lateinit var phone_number: EditText
|
|
|
|
|
|
/**
|
|
|
+ * 联系人
|
|
|
+ */
|
|
|
+ lateinit var the_contact: EditText
|
|
|
+
|
|
|
+ /**
|
|
|
* 联系电话
|
|
|
*/
|
|
|
lateinit var contact_number: EditText
|
|
|
@@ -147,7 +180,7 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
)
|
|
|
)
|
|
|
val addressList = arrayListOf<AddressItemData>()
|
|
|
- if (data.provinceid != 0){
|
|
|
+ if (data.provinceid != 0) {
|
|
|
val provinceidData = AddressItemData()
|
|
|
provinceidData.autoid = data.provinceid.toString()
|
|
|
val cityidData = AddressItemData()
|
|
|
@@ -160,6 +193,8 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
mData.postValue(addressList)
|
|
|
}
|
|
|
|
|
|
+ }else{
|
|
|
+ customerType.postValue(SelectData(id = "2",value = "企业"))
|
|
|
}
|
|
|
// 恢复数据
|
|
|
}
|
|
|
@@ -212,7 +247,7 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
val selectDataList = arrayListOf(
|
|
|
-// SelectData(id = "1", value = "个人"),
|
|
|
+ SelectData(id = "1", value = "个人"),
|
|
|
SelectData(id = "2", value = "企业")
|
|
|
)
|
|
|
creatBottomSheetDialog("请选择客户类型", selectDataList) {
|
|
|
@@ -247,6 +282,7 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
it.let {
|
|
|
text = it?.value
|
|
|
}
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
}
|
|
|
textResource = R.string.change_user_info_type
|
|
|
textSizeAuto = 31
|
|
|
@@ -285,7 +321,13 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- textResource = R.string.an_enterprise_name
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ text = "姓 名"
|
|
|
+ } else {
|
|
|
+ text = "企业名称"
|
|
|
+ }
|
|
|
+ }
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}.lparams(wrapContent, wrapContent) {
|
|
|
@@ -300,7 +342,67 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
isEnabled = false
|
|
|
}
|
|
|
enterprise_name = this
|
|
|
- hint = resources.getString(R.string.please_input_enterprise_name)
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ hint = "请输入姓名"
|
|
|
+ } else {
|
|
|
+ hint = "请输入企业名称"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_TEXT
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(autoSize(500), wrapContent) {
|
|
|
+ marginStart = autoSize(86)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(136))
|
|
|
+
|
|
|
+ viewItemUI()
|
|
|
+
|
|
|
+ // 企业名称
|
|
|
+ linearLayout {
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (status == "6") {
|
|
|
+ visibility = View.INVISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ text = "*"
|
|
|
+ textColorInt = R.color.rma_star_color
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(37)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "企业简称"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ editText {
|
|
|
+ if (status != "1") {
|
|
|
+ setText(data.customername)
|
|
|
+ }
|
|
|
+ if (status != "1" && status != "2") {
|
|
|
+ isEnabled = false
|
|
|
+ }
|
|
|
+ enterprise_referred = this
|
|
|
+ hint = "请输入企业简称"
|
|
|
background = null
|
|
|
inputType = EditorInfo.TYPE_CLASS_TEXT
|
|
|
hintColorStr = "#CCCCCC"
|
|
|
@@ -316,11 +418,19 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
|
|
|
// 证件类型
|
|
|
linearLayout {
|
|
|
+ customerType.bindOptional(context){
|
|
|
+ if (it?.id == "1"){
|
|
|
+ visibility = View.GONE
|
|
|
+ }else{
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
onThrottleFirstClick {
|
|
|
if (status != "1" && status != "2") {
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- val selectDataList = SelectIUtils.getCustomerDocumentType("certificatetype")
|
|
|
+ val selectDataList =
|
|
|
+ SelectIUtils.getCustomerDocumentType("certificatetype")
|
|
|
creatBottomSheetDialog("请选择证件类型", selectDataList) {
|
|
|
cardType.postValue(this)
|
|
|
}
|
|
|
@@ -366,7 +476,13 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
|
textView {
|
|
|
- textResource = R.string.card_number
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ text = "身份证号码"
|
|
|
+ } else {
|
|
|
+ text = "证件号码"
|
|
|
+ }
|
|
|
+ }
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}.lparams(wrapContent, wrapContent) {
|
|
|
@@ -381,7 +497,97 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
isEnabled = false
|
|
|
}
|
|
|
card_umber = this
|
|
|
- hint = resources.getString(R.string.please_input_card_number)
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ hint = "请输入身份证号码"
|
|
|
+ } else {
|
|
|
+ hint =
|
|
|
+ resources.getString(R.string.please_input_card_number)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_TEXT
|
|
|
+// setDecimalInputType()
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(autoSize(500), wrapContent) {
|
|
|
+ marginStart = autoSize(86)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(136))
|
|
|
+
|
|
|
+ viewItemUI()
|
|
|
+
|
|
|
+ // 法定代表人
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ text = "法定代表人"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(59)
|
|
|
+ }
|
|
|
+
|
|
|
+ editText {
|
|
|
+ if (status != "1") {
|
|
|
+ setText(data.cardnum?.isBlankString())
|
|
|
+ }
|
|
|
+ if (status != "1" && status != "2") {
|
|
|
+ isEnabled = false
|
|
|
+ }
|
|
|
+ legal_representative = this
|
|
|
+ hint = "请输入法定代表人"
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_TEXT
|
|
|
+// setDecimalInputType()
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(autoSize(500), wrapContent) {
|
|
|
+ marginStart = autoSize(86)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(136))
|
|
|
+
|
|
|
+ viewItemUI()
|
|
|
+
|
|
|
+ // 纳税人识别号
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ text = "纳税人识别号"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(59)
|
|
|
+ }
|
|
|
+
|
|
|
+ editText {
|
|
|
+ if (status != "1") {
|
|
|
+ setText(data.cardnum?.isBlankString())
|
|
|
+ }
|
|
|
+ if (status != "1" && status != "2") {
|
|
|
+ isEnabled = false
|
|
|
+ }
|
|
|
+ identification_number = this
|
|
|
+ hint = "请输入纳税人识别号"
|
|
|
background = null
|
|
|
inputType = EditorInfo.TYPE_CLASS_TEXT
|
|
|
// setDecimalInputType()
|
|
|
@@ -400,6 +606,14 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
textView {
|
|
|
textResource = R.string.business_license
|
|
|
textSizeAuto = 31
|
|
|
@@ -458,9 +672,6 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
) {
|
|
|
/*[{"originalName":"tem.jpg","fileName":"201907161657044712.jpg","fileSize":"0KB","fileType":"image/jpeg","filePath":"./uploadFile/20190716/201907161657044712.jpg","submitName":null}]*/
|
|
|
try {
|
|
|
-// if (!isFinishing) {
|
|
|
-// viewModel.loadingDialogStatus.value
|
|
|
-// }
|
|
|
viewModel.loadingDialogStatus.value =
|
|
|
TaskUiModel.success()
|
|
|
val jsonArray = JSONArray(response)
|
|
|
@@ -479,13 +690,265 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
} catch (e: JSONException) {
|
|
|
e.printStackTrace()
|
|
|
}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 10000.0,
|
|
|
+ SPUtils.getInstance().getString(Constant.uploadUrl)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ textResource = R.string.update
|
|
|
+ textColorInt = R.color.rma_item_click_color
|
|
|
+ backgroundResource = R.drawable.rma_item_text_bg
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(autoSize(134), autoSize(53)) {
|
|
|
+ marginStart = autoSize(86)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查看附件
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val path = imageString.value.guard {
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ PhotoUtils().showImageViewer(
|
|
|
+ this@AddCustomerDataActivity,
|
|
|
+ 1,
|
|
|
+ arrayListOf(path)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ textResource = R.string.check_the_attachment
|
|
|
+ textColorInt = R.color.rma_yellow_text_color
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(86)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(136))
|
|
|
+
|
|
|
+ viewItemUI()
|
|
|
+
|
|
|
+ // 身份证正面照
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "2") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "身份证正面照"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(59)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (status != "1" || status == "2") {
|
|
|
+ if (data.attachment1.isNullOrEmpty()) {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ frontIdCardimageString.bindOptional(context) {
|
|
|
+ visibility = if (it.isNullOrEmpty()) {
|
|
|
+ View.VISIBLE
|
|
|
+ } else {
|
|
|
+ View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ onThrottleFirstClick {
|
|
|
+ //审核,停用,复用,详情不需要点击
|
|
|
+ if (status != "1" && status != "2") {
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ PhotoUtils().showPicker(this@AddCustomerDataActivity) {
|
|
|
+ it.firstOrNull()?.let {
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.inFlight()
|
|
|
+ UpLoadUtils(this@AddCustomerDataActivity).uploadPicture(
|
|
|
+ File(it),
|
|
|
+ object : StringCallback() {
|
|
|
+ override fun onError(
|
|
|
+ call: Call,
|
|
|
+ e: Exception,
|
|
|
+ id: Int
|
|
|
+ ) {
|
|
|
+ LogUtils.e("hidahdashdsdasd", e.message)
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.failed(
|
|
|
+ InteractiveException(
|
|
|
+ errorMessage = e.message ?: ""
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onResponse(
|
|
|
+ response: String,
|
|
|
+ id: Int
|
|
|
+ ) {
|
|
|
+ /*[{"originalName":"tem.jpg","fileName":"201907161657044712.jpg","fileSize":"0KB","fileType":"image/jpeg","filePath":"./uploadFile/20190716/201907161657044712.jpg","submitName":null}]*/
|
|
|
+ try {
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.success()
|
|
|
+ val jsonArray = JSONArray(response)
|
|
|
+ LogUtils.eTag(
|
|
|
+ "图片",
|
|
|
+ JSON.toJSONString(jsonArray)
|
|
|
+ )
|
|
|
+ for (i in 0 until jsonArray.length()) {
|
|
|
+ frontIdCarduploadFile =
|
|
|
+ (jsonArray.get(i) as JSONObject).getString(
|
|
|
+ "filePath"
|
|
|
+ )
|
|
|
+ frontIdCardimageString.value = it
|
|
|
|
|
|
+ }
|
|
|
+ } catch (e: JSONException) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
10000.0,
|
|
|
SPUtils.getInstance().getString(Constant.uploadUrl)
|
|
|
)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ textResource = R.string.update
|
|
|
+ textColorInt = R.color.rma_item_click_color
|
|
|
+ backgroundResource = R.drawable.rma_item_text_bg
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(autoSize(134), autoSize(53)) {
|
|
|
+ marginStart = autoSize(86)
|
|
|
+ }
|
|
|
|
|
|
+ // 查看附件
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ val path = frontIdCardimageString.value.guard {
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ PhotoUtils().showImageViewer(
|
|
|
+ this@AddCustomerDataActivity,
|
|
|
+ 1,
|
|
|
+ arrayListOf(path)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ textResource = R.string.check_the_attachment
|
|
|
+ textColorInt = R.color.rma_yellow_text_color
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(86)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(136))
|
|
|
+
|
|
|
+ viewItemUI()
|
|
|
+
|
|
|
+ // 身份证反面照
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "2") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "身份证反面照"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(59)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (status != "1" || status == "2") {
|
|
|
+ if (data.attachment1.isNullOrEmpty()) {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ backIdCardimageString.bindOptional(context) {
|
|
|
+ visibility = if (it.isNullOrEmpty()) {
|
|
|
+ View.VISIBLE
|
|
|
+ } else {
|
|
|
+ View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ onThrottleFirstClick {
|
|
|
+ //审核,停用,复用,详情不需要点击
|
|
|
+ if (status != "1" && status != "2") {
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ PhotoUtils().showPicker(this@AddCustomerDataActivity) {
|
|
|
+ it.firstOrNull()?.let {
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.inFlight()
|
|
|
+ UpLoadUtils(this@AddCustomerDataActivity).uploadPicture(
|
|
|
+ File(it),
|
|
|
+ object : StringCallback() {
|
|
|
+ override fun onError(
|
|
|
+ call: Call,
|
|
|
+ e: Exception,
|
|
|
+ id: Int
|
|
|
+ ) {
|
|
|
+ LogUtils.e("hidahdashdsdasd", e.message)
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.failed(
|
|
|
+ InteractiveException(
|
|
|
+ errorMessage = e.message ?: ""
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onResponse(
|
|
|
+ response: String,
|
|
|
+ id: Int
|
|
|
+ ) {
|
|
|
+ /*[{"originalName":"tem.jpg","fileName":"201907161657044712.jpg","fileSize":"0KB","fileType":"image/jpeg","filePath":"./uploadFile/20190716/201907161657044712.jpg","submitName":null}]*/
|
|
|
+ try {
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.success()
|
|
|
+ val jsonArray = JSONArray(response)
|
|
|
+ LogUtils.eTag(
|
|
|
+ "图片",
|
|
|
+ JSON.toJSONString(jsonArray)
|
|
|
+ )
|
|
|
+ for (i in 0 until jsonArray.length()) {
|
|
|
+ backIdCarduploadFile =
|
|
|
+ (jsonArray.get(i) as JSONObject).getString(
|
|
|
+ "filePath"
|
|
|
+ )
|
|
|
+ backIdCardimageString.value = it
|
|
|
+
|
|
|
+ }
|
|
|
+ } catch (e: JSONException) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 10000.0,
|
|
|
+ SPUtils.getInstance().getString(Constant.uploadUrl)
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -501,7 +964,7 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
// 查看附件
|
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
|
- val path = imageString.value.guard {
|
|
|
+ val path = backIdCardimageString.value.guard {
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
PhotoUtils().showImageViewer(
|
|
|
@@ -522,10 +985,17 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
|
|
|
// 手机号码
|
|
|
linearLayout {
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
|
textView {
|
|
|
- textResource = R.string.phone_number
|
|
|
+ text = "联系人"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}.lparams(wrapContent, wrapContent) {
|
|
|
@@ -539,8 +1009,55 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
if (status != "1" && status != "2") {
|
|
|
isEnabled = false
|
|
|
}
|
|
|
+ the_contact = this
|
|
|
+ hint = "请输入联系人"
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_PHONE
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(autoSize(500), wrapContent) {
|
|
|
+ marginStart = autoSize(86)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(136))
|
|
|
+
|
|
|
+ viewItemUI()
|
|
|
+
|
|
|
+ // 手机号码
|
|
|
+ linearLayout {
|
|
|
+
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ textView {
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ text = "手机号码"
|
|
|
+ } else {
|
|
|
+ text = "联系人手机号码"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(59)
|
|
|
+ }
|
|
|
+
|
|
|
+ editText {
|
|
|
+ if (status != "1") {
|
|
|
+ setText(data.mobile?.isBlankString())
|
|
|
+ }
|
|
|
+ if (status != "1" && status != "2") {
|
|
|
+ isEnabled = false
|
|
|
+ }
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ hint = "请输入手机号码"
|
|
|
+ } else {
|
|
|
+ hint = "请输入联系人手机号码"
|
|
|
+ }
|
|
|
+ }
|
|
|
phone_number = this
|
|
|
- hint = resources.getString(R.string.please_input_phone_number)
|
|
|
background = null
|
|
|
inputType = EditorInfo.TYPE_CLASS_PHONE
|
|
|
hintColorStr = "#CCCCCC"
|
|
|
@@ -556,10 +1073,17 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
|
|
|
// 联系电话
|
|
|
linearLayout {
|
|
|
+ customerType.bindOptional(context) {
|
|
|
+ if (it?.id == "1") {
|
|
|
+ visibility = View.GONE
|
|
|
+ } else {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
|
textView {
|
|
|
- textResource = R.string.contact_phone_number
|
|
|
+ text = "联系电话"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}.lparams(wrapContent, wrapContent) {
|
|
|
@@ -574,8 +1098,7 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
isEnabled = false
|
|
|
}
|
|
|
contact_number = this
|
|
|
- hint =
|
|
|
- resources.getString(R.string.please_input_contact_phone_number)
|
|
|
+ hint = "请输入联系电话"
|
|
|
background = null
|
|
|
inputType = EditorInfo.TYPE_CLASS_PHONE
|
|
|
// setDecimalInputType()
|
|
|
@@ -621,7 +1144,10 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
if (it?.get(0)?.addressName.isNullOrEmpty()) {
|
|
|
val builder = StringBuilder()
|
|
|
it?.forEach { data ->
|
|
|
- builder.append(DataBase.getInstance().addressDao().getAddressData(data.autoid).divisionname)
|
|
|
+ builder.append(
|
|
|
+ DataBase.getInstance().addressDao()
|
|
|
+ .getAddressData(data.autoid).divisionname
|
|
|
+ )
|
|
|
builder.append(" ")
|
|
|
}
|
|
|
text = builder
|
|
|
@@ -817,7 +1343,7 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
onThrottleFirstClick {
|
|
|
if (status == "5") {//停用
|
|
|
viewModel.updateUserAccountStatus(
|
|
|
- userID = data.userid ?: 0,
|
|
|
+ userID = data.userid?.toInt() ?: 0,
|
|
|
accountStatus = 6
|
|
|
) { isCompleted, err ->
|
|
|
if (!isCompleted) {
|
|
|
@@ -835,7 +1361,7 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
}
|
|
|
} else {//恢复
|
|
|
viewModel.updateUserAccountStatus(
|
|
|
- userID = data.userid ?: 0,
|
|
|
+ userID = data.userid?.toInt() ?: 0,
|
|
|
accountStatus = 4
|
|
|
) { isCompleted, err ->
|
|
|
if (!isCompleted) {
|
|
|
@@ -913,13 +1439,27 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
* @return Boolean 检验是否成功
|
|
|
*/
|
|
|
private fun checkInput(): Boolean {
|
|
|
- if (customerType.value?.id?.isNullOrEmpty() == true) {
|
|
|
- ToastUtils.showLong("请选择客户类型")
|
|
|
- return false
|
|
|
- }
|
|
|
- if (enterprise_name.text.isNullOrEmpty()) {
|
|
|
- ToastUtils.showLong("请输入企业名称")
|
|
|
- return false
|
|
|
+
|
|
|
+ if (customerType.value?.id == "1"){//判断个人的必填项
|
|
|
+ if (enterprise_name.text.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入姓名")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (phone_number.text.toString().isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请输入手机号码")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }else{//判断企业的必填项
|
|
|
+ if (enterprise_name.text.isNullOrEmpty()) {
|
|
|
+ ToastUtils.showLong("请输入企业名称")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (enterprise_referred.text.isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请输入企业简称")
|
|
|
+ return false
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return true
|
|
|
@@ -939,13 +1479,12 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
private fun addUserInfo(isDraft: Boolean) {
|
|
|
// 客户资料参数
|
|
|
val params = mutableMapOf<String, Any>()
|
|
|
- if (data.userid == 0) {
|
|
|
+ if (data.userid?.toInt() == 0) {
|
|
|
params["userid"] = 1
|
|
|
} else {
|
|
|
params["userid"] = data.userid ?: 1
|
|
|
}
|
|
|
|
|
|
- // FIXME: - 客户类型暂时写死为"企业"
|
|
|
params["userinfotype"] = customerType.value?.id?.toInt() ?: 0
|
|
|
// 企业名称
|
|
|
params["customername"] = enterprise_name.text.toString()
|
|
|
@@ -967,10 +1506,39 @@ class AddCustomerDataActivity : BaseActivity<CustomerDataViewModel>() {
|
|
|
if (!card_umber.text.isNullOrEmpty()) {
|
|
|
params["cardnum"] = card_umber.text.toString()
|
|
|
}
|
|
|
- // 营业执照
|
|
|
- if (!uploadFile.isNullOrEmpty()) {
|
|
|
- params["cardfrontphotourl"] = uploadFile
|
|
|
+
|
|
|
+ if (customerType.value?.id == "1"){//个人
|
|
|
+ // 身份证正面照
|
|
|
+ if (!frontIdCarduploadFile.isNullOrEmpty()) {
|
|
|
+ params["cardfrontphotourl"] = frontIdCarduploadFile
|
|
|
+ }
|
|
|
+ //身份证背面照
|
|
|
+ if (!backIdCarduploadFile.isNullOrEmpty()) {
|
|
|
+ params["cardbackphotourl"] = backIdCarduploadFile
|
|
|
+ }
|
|
|
+ }else{//企业
|
|
|
+ // 营业执照
|
|
|
+ if (!uploadFile.isNullOrEmpty()) {
|
|
|
+ params["cardfrontphotourl"] = uploadFile
|
|
|
+ }
|
|
|
+ //企业简称
|
|
|
+ if (enterprise_referred.text.toString().isNotEmpty()){
|
|
|
+ params["nickname"] = enterprise_referred.text.toString()
|
|
|
+ }
|
|
|
+ //法定代表人
|
|
|
+ if (legal_representative.text.toString().isNotEmpty()){
|
|
|
+ params["legalpersonname"] = legal_representative.text.toString()
|
|
|
+ }
|
|
|
+ //纳税人识别号
|
|
|
+ if (identification_number.text.toString().isNotEmpty()){
|
|
|
+ params["taxpayernum"] = identification_number.text.toString()
|
|
|
+ }
|
|
|
+ //联系人
|
|
|
+ if (the_contact.text.toString().isNotEmpty()){
|
|
|
+ params["contactname"] = the_contact.text.toString()
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
// 手机号码
|
|
|
if (!phone_number.text.isNullOrEmpty()) {
|
|
|
params["mobilephone"] = phone_number.text.toString()
|