package com.shizhuang.duapp.modules.orderdetail.viewmodel; import android.app.Application; import android.os.SystemClock; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.SavedStateHandle; import b50.b; import bj1.e; import cd.c; import cd.k; import com.meituan.robust.ChangeQuickRedirect; import com.meituan.robust.PatchProxy; import com.meituan.robust.PatchProxyResult; import com.shizhuang.duapp.common.utils.livebus.BusLiveData; import com.shizhuang.duapp.modules.common.model.OrderProductModel; import com.shizhuang.duapp.modules.common.model.PriceDetailModel; import com.shizhuang.duapp.modules.du_mall_common.api.LoadResultKt; import com.shizhuang.duapp.modules.du_mall_common.utils.LiveDataHelper; import com.shizhuang.duapp.modules.du_mall_common.utils.vm.BaseViewModel; import com.shizhuang.duapp.modules.net.api.OrderApiV2; import com.shizhuang.duapp.modules.orderdetail.model.ExtraInfo; import com.shizhuang.duapp.modules.orderdetail.model.OdBasicOrderInfo; import com.shizhuang.duapp.modules.orderdetail.model.OdComposeModel; import com.shizhuang.duapp.modules.orderdetail.model.OdHoldOrderStatusInfo; import com.shizhuang.duapp.modules.orderdetail.model.OdKfModel; import com.shizhuang.duapp.modules.orderdetail.model.OdModel; import com.shizhuang.duapp.modules.orderdetail.model.OpStatusInfoV2; import com.shizhuang.duapp.modules.orderparticulars.model.OpQuestionAnswerModel; import com.shizhuang.duapp.modules.router.model.KfOrderDetail; import io.reactivex.schedulers.Schedulers; import java.util.Iterator; import java.util.List; import kotlin.Metadata; import kotlin.TuplesKt; import kotlin.Unit; import kotlin.jvm.functions.Function1; import kotlin.text.StringsKt__StringsKt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import t60.a; import td.j; import td.s; import vv0.d; import vv0.h; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000x\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0011\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0015\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\b\u0010F\u001a\u0004\u0018\u00010GJ\u0006\u0010H\u001a\u00020IJ\n\u0010J\u001a\u0004\u0018\u000101H\u0002R\u0014\u0010\b\u001a\b\u0012\u0004\u0012\u00020\u00020\tX\u0004¢\u0006\u0002\n\u0000R\u0013\u0010\n\u001a\u0004\u0018\u00010\u000b8F¢\u0006\u0006\u001a\u0004\b\f\u0010\rR\u0017\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\u00020\u000f8F¢\u0006\u0006\u001a\u0004\b\u0010\u0010\u0011R\u001a\u0010\u0012\u001a\u00020\u0013X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0015\"\u0004\b\u0016\u0010\u0017R\u0011\u0010\u0018\u001a\u00020\u00138F¢\u0006\u0006\u001a\u0004\b\u0018\u0010\u0015R\u001a\u0010\u0019\u001a\u00020\u0013X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0019\u0010\u0015\"\u0004\b\u001a\u0010\u0017R\u0013\u0010\u001b\u001a\u0004\u0018\u00010\u001c8F¢\u0006\u0006\u001a\u0004\b\u001d\u0010\u001eR\u0013\u0010\u001f\u001a\u0004\u0018\u00010 8F¢\u0006\u0006\u001a\u0004\b!\u0010\"R\u0017\u0010#\u001a\b\u0012\u0004\u0012\u00020 0$¢\u0006\b\n\u0000\u001a\u0004\b%\u0010&R\u0017\u0010'\u001a\b\u0012\u0004\u0012\u00020 0\u000f¢\u0006\b\n\u0000\u001a\u0004\b(\u0010\u0011R\u0013\u0010)\u001a\u0004\u0018\u00010*8F¢\u0006\u0006\u001a\u0004\b+\u0010,R\u0011\u0010-\u001a\u00020*8F¢\u0006\u0006\u001a\u0004\b.\u0010/R\u0011\u00100\u001a\u0002018F¢\u0006\u0006\u001a\u0004\b2\u00103R\u001e\u00106\u001a\u0002052\u0006\u00104\u001a\u000205@BX\u000e¢\u0006\b\n\u0000\u001a\u0004\b7\u00108R\u000e\u0010\u0005\u001a\u00020\u0006X\u0004¢\u0006\u0002\n\u0000R\u0011\u00109\u001a\u00020*8F¢\u0006\u0006\u001a\u0004\b:\u0010/R\u0011\u0010;\u001a\u00020\u00138F¢\u0006\u0006\u001a\u0004\b<\u0010\u0015R\u0013\u0010=\u001a\u0004\u0018\u0001058F¢\u0006\u0006\u001a\u0004\b>\u0010?R\u0011\u0010@\u001a\u0002018F¢\u0006\u0006\u001a\u0004\bA\u00103R\u0013\u0010B\u001a\u0004\u0018\u0001058F¢\u0006\u0006\u001a\u0004\bC\u0010?R\u0011\u0010D\u001a\u0002018F¢\u0006\u0006\u001a\u0004\bE\u00103¨\u0006K"}, d2 = {"Lcom/shizhuang/duapp/modules/orderdetail/viewmodel/OdViewModel;", "Lcom/shizhuang/duapp/modules/du_mall_common/utils/vm/BaseViewModel;", "Lcom/shizhuang/duapp/modules/orderdetail/model/OdComposeModel;", "application", "Landroid/app/Application;", "savedStateHandle", "Landroidx/lifecycle/SavedStateHandle;", "(Landroid/app/Application;Landroidx/lifecycle/SavedStateHandle;)V", "_composeModelLiveData", "Landroidx/lifecycle/MutableLiveData;", "answerModel", "Lcom/shizhuang/duapp/modules/orderparticulars/model/OpQuestionAnswerModel;", "getAnswerModel", "()Lcom/shizhuang/duapp/modules/orderparticulars/model/OpQuestionAnswerModel;", "composeModelLiveData", "Landroidx/lifecycle/LiveData;", "getComposeModelLiveData", "()Landroidx/lifecycle/LiveData;", "greetingCardIsShown", "", "getGreetingCardIsShown", "()Z", "setGreetingCardIsShown", "(Z)V", "isCancelPay", "isFirstRender", "setFirstRender", "kfModel", "Lcom/shizhuang/duapp/modules/orderdetail/model/OdKfModel;", "getKfModel", "()Lcom/shizhuang/duapp/modules/orderdetail/model/OdKfModel;", "model", "Lcom/shizhuang/duapp/modules/orderdetail/model/OdModel;", "getModel", "()Lcom/shizhuang/duapp/modules/orderdetail/model/OdModel;", "modelChanged", "Lcom/shizhuang/duapp/common/utils/livebus/BusLiveData;", "getModelChanged", "()Lcom/shizhuang/duapp/common/utils/livebus/BusLiveData;", "modelLiveData", "getModelLiveData", "orderStatusValue", "", "getOrderStatusValue", "()Ljava/lang/Integer;", "oversea", "getOversea", "()I", "pushTaskId", "", "getPushTaskId", "()Ljava/lang/String;", "<set-?>", "", "refreshTime", "getRefreshTime", "()J", "showGreetingCard", "getShowGreetingCard", "showScoreDialog", "getShowScoreDialog", "skuId", "getSkuId", "()Ljava/lang/Long;", "sourceName", "getSourceName", "spuId", "getSpuId", "subOrderNo", "getSubOrderNo", "buildKfOrderDetail", "Lcom/shizhuang/duapp/modules/router/model/KfOrderDetail;", "fetchDataV2", "", "getOrderCreateTime", "du_order_release"}, k = 1, mv = {1, 4, 2}) /* compiled from: OdViewModel.kt */ public final class OdViewModel extends BaseViewModel<OdComposeModel> { public static ChangeQuickRedirect changeQuickRedirect; public final MutableLiveData<OdComposeModel> _composeModelLiveData = new MutableLiveData<>(); private boolean greetingCardIsShown; private boolean isFirstRender = true; @NotNull private final BusLiveData<OdModel> modelChanged = new BusLiveData<>(); @NotNull private final LiveData<OdModel> modelLiveData = LiveDataHelper.f13601a.d(getComposeModelLiveData(), OdViewModel$modelLiveData$1.INSTANCE); public long refreshTime; private final SavedStateHandle savedStateHandle; public OdViewModel(@NotNull Application application, @NotNull SavedStateHandle savedStateHandle2) { super(application); this.savedStateHandle = savedStateHandle2; LoadResultKt.m(getPageResult(), null, new Function1<b.d<? extends OdComposeModel>, Unit>(this) { /* class com.shizhuang.duapp.modules.orderdetail.viewmodel.OdViewModel.AnonymousClass1 */ public static ChangeQuickRedirect changeQuickRedirect; public final /* synthetic */ OdViewModel this$0; { this.this$0 = r1; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kotlin.jvm.functions.Function1 public /* bridge */ /* synthetic */ Unit invoke(b.d<? extends OdComposeModel> dVar) { invoke((b.d<OdComposeModel>) dVar); return Unit.INSTANCE; } public final void invoke(@NotNull b.d<OdComposeModel> dVar) { OdComposeModel a5; OdModel odModel; if (!PatchProxy.proxy(new Object[]{dVar}, this, changeQuickRedirect, false, 247023, new Class[]{b.d.class}, Void.TYPE).isSupported && (odModel = (a5 = dVar.a()).getOdModel()) != null) { this.this$0.refreshTime = SystemClock.elapsedRealtime(); this.this$0._composeModelLiveData.setValue(a5); this.this$0.getModelChanged().setValue(odModel); ix0.b.f34095a.d("main", odModel); } } }, null, 5); } private final String getOrderCreateTime() { List<ExtraInfo> extraInfoList; T t; boolean z; PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247022, new Class[0], String.class); if (proxy.isSupported) { return (String) proxy.result; } OdModel model = getModel(); if (model == null || (extraInfoList = model.getExtraInfoList()) == null) { return null; } Iterator<T> it2 = extraInfoList.iterator(); while (true) { if (!it2.hasNext()) { t = null; break; } t = it2.next(); String title = t.getTitle(); if (title != null) { z = StringsKt__StringsKt.contains((CharSequence) title, (CharSequence) "创建时间", true); continue; } else { z = false; continue; } if (z) { break; } } T t4 = t; if (t4 != null) { return t4.getDesc(); } return null; } @Nullable public final KfOrderDetail buildKfOrderDetail() { OrderProductModel skuInfo; OdHoldOrderStatusInfo holdOrderStatusInfo; OpStatusInfoV2 statusInfoV2; String statusDesc; PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247021, new Class[0], KfOrderDetail.class); if (proxy.isSupported) { return (KfOrderDetail) proxy.result; } OdModel model = getModel(); String str = null; if (model == null || (skuInfo = model.getSkuInfo()) == null) { return null; } KfOrderDetail kfOrderDetail = new KfOrderDetail(); kfOrderDetail.setOrderNum(getSubOrderNo()); kfOrderDetail.setPicture(skuInfo.getSkuPic()); PriceDetailModel priceDetail = skuInfo.getPriceDetail(); kfOrderDetail.setPrice(k.n(priceDetail != null ? priceDetail.getPrice() : null, false, null, 3)); kfOrderDetail.setSkuQuantity(String.valueOf(skuInfo.getSkuQuantity())); kfOrderDetail.setSkuProp(skuInfo.getSkuProp()); kfOrderDetail.setTitle(skuInfo.getSkuTitle()); OdModel model2 = getModel(); if (model2 == null || (statusInfoV2 = model2.getStatusInfoV2()) == null || (statusDesc = statusInfoV2.getStatusDesc()) == null) { OdModel model3 = getModel(); if (!(model3 == null || (holdOrderStatusInfo = model3.getHoldOrderStatusInfo()) == null)) { str = holdOrderStatusInfo.getTitle(); } } else { str = statusDesc; } kfOrderDetail.setTradeStatus(str); kfOrderDetail.setRouteUrl("https://m.poizon.com/router/order/buyer/OrderDetail?orderNo=" + getSubOrderNo()); kfOrderDetail.setOrderSource(1); kfOrderDetail.setCreateTime(getOrderCreateTime()); return kfOrderDetail; } public final void fetchDataV2() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247020, new Class[0], Void.TYPE).isSupported) { h hVar = h.f39415a; String subOrderNo = getSubOrderNo(); BaseViewModel.a aVar = new BaseViewModel.a(this, true, true, null, 8, null); if (!PatchProxy.proxy(new Object[]{subOrderNo, "V2", aVar}, hVar, h.changeQuickRedirect, false, 234545, new Class[]{String.class, String.class, s.class}, Void.TYPE).isSupported) { j.doRequest(e.zip(((OrderApiV2) j.getJavaGoApi(OrderApiV2.class)).getBuyerOrderDetailV3(c.b(TuplesKt.to("subOrderNo", subOrderNo), TuplesKt.to("viewVersion", "V2"))).subscribeOn(Schedulers.io()), ((OrderApiV2) j.getJavaGoApi(OrderApiV2.class)).getOrderKfInfo(c.b(TuplesKt.to("orderId", subOrderNo), TuplesKt.to("channelId", "10001"), TuplesKt.to("sourceId", "10004"))).onErrorReturn(vv0.c.b).subscribeOn(Schedulers.io()), ((OrderApiV2) j.getJavaGoApi(OrderApiV2.class)).getQuestionAnswerInfo(c.b(TuplesKt.to("subOrderNo", subOrderNo))).onErrorReturn(d.b).subscribeOn(Schedulers.io()), vv0.b.f39414a), aVar); } } } @Nullable public final OpQuestionAnswerModel getAnswerModel() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247009, new Class[0], OpQuestionAnswerModel.class); if (proxy.isSupported) { return (OpQuestionAnswerModel) proxy.result; } OdComposeModel value = this._composeModelLiveData.getValue(); if (value != null) { return value.getAnswerModel(); } return null; } @NotNull public final LiveData<OdComposeModel> getComposeModelLiveData() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247006, new Class[0], LiveData.class); return proxy.isSupported ? (LiveData) proxy.result : this._composeModelLiveData; } public final boolean getGreetingCardIsShown() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247016, new Class[0], Boolean.TYPE); return proxy.isSupported ? ((Boolean) proxy.result).booleanValue() : this.greetingCardIsShown; } @Nullable public final OdKfModel getKfModel() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247011, new Class[0], OdKfModel.class); if (proxy.isSupported) { return (OdKfModel) proxy.result; } OdComposeModel value = this._composeModelLiveData.getValue(); if (value != null) { return value.getKfModel(); } return null; } @Nullable public final OdModel getModel() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247008, new Class[0], OdModel.class); if (proxy.isSupported) { return (OdModel) proxy.result; } OdComposeModel value = this._composeModelLiveData.getValue(); if (value != null) { return value.getOdModel(); } return null; } @NotNull public final BusLiveData<OdModel> getModelChanged() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247010, new Class[0], BusLiveData.class); return proxy.isSupported ? (BusLiveData) proxy.result : this.modelChanged; } @NotNull public final LiveData<OdModel> getModelLiveData() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247007, new Class[0], LiveData.class); return proxy.isSupported ? (LiveData) proxy.result : this.modelLiveData; } @Nullable public final Integer getOrderStatusValue() { OdBasicOrderInfo basicOrderInfo; PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247012, new Class[0], Integer.class); if (proxy.isSupported) { return (Integer) proxy.result; } OdModel model = getModel(); if (model == null || (basicOrderInfo = model.getBasicOrderInfo()) == null) { return null; } return basicOrderInfo.getSubOrderStatusValue(); } public final int getOversea() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247005, new Class[0], Integer.TYPE); if (proxy.isSupported) { return ((Integer) proxy.result).intValue(); } Integer num = (Integer) a.b(this.savedStateHandle, "oversea", Integer.class); if (num != null) { return num.intValue(); } return 0; } @NotNull public final String getPushTaskId() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247004, new Class[0], String.class); if (proxy.isSupported) { return (String) proxy.result; } String str = (String) a.b(this.savedStateHandle, "pushTaskId", String.class); return str != null ? str : ""; } public final long getRefreshTime() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247015, new Class[0], Long.TYPE); return proxy.isSupported ? ((Long) proxy.result).longValue() : this.refreshTime; } public final int getShowGreetingCard() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247001, new Class[0], Integer.TYPE); if (proxy.isSupported) { return ((Integer) proxy.result).intValue(); } Integer num = (Integer) a.b(this.savedStateHandle, "showGreetingCard", Integer.class); if (num != null) { return num.intValue(); } return 0; } public final boolean getShowScoreDialog() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247002, new Class[0], Boolean.TYPE); if (proxy.isSupported) { return ((Boolean) proxy.result).booleanValue(); } Boolean bool = (Boolean) a.b(this.savedStateHandle, "showShareEnjoy", Boolean.class); if (bool != null) { return bool.booleanValue(); } return false; } @Nullable public final Long getSkuId() { OrderProductModel skuInfo; PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247013, new Class[0], Long.class); if (proxy.isSupported) { return (Long) proxy.result; } OdModel model = getModel(); if (model == null || (skuInfo = model.getSkuInfo()) == null) { return null; } return skuInfo.getSkuId(); } @NotNull public final String getSourceName() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247000, new Class[0], String.class); if (proxy.isSupported) { return (String) proxy.result; } String str = (String) a.b(this.savedStateHandle, "sourceName", String.class); return str != null ? str : "其他"; } @Nullable public final Long getSpuId() { OrderProductModel skuInfo; PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247014, new Class[0], Long.class); if (proxy.isSupported) { return (Long) proxy.result; } OdModel model = getModel(); if (model == null || (skuInfo = model.getSkuInfo()) == null) { return null; } return skuInfo.getSpuId(); } @NotNull public final String getSubOrderNo() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 246999, new Class[0], String.class); if (proxy.isSupported) { return (String) proxy.result; } String str = (String) a.b(this.savedStateHandle, "orderNo", String.class); return str != null ? str : ""; } public final boolean isCancelPay() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247003, new Class[0], Boolean.TYPE); if (proxy.isSupported) { return ((Boolean) proxy.result).booleanValue(); } Boolean bool = (Boolean) a.b(this.savedStateHandle, "isCancelPay", Boolean.class); if (bool != null) { return bool.booleanValue(); } return false; } public final boolean isFirstRender() { PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 247018, new Class[0], Boolean.TYPE); return proxy.isSupported ? ((Boolean) proxy.result).booleanValue() : this.isFirstRender; } public final void setFirstRender(boolean z) { if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 247019, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) { this.isFirstRender = z; } } public final void setGreetingCardIsShown(boolean z) { if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 247017, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) { this.greetingCardIsShown = z; } } }