StorePayPropView.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System.Threading.Tasks;
  2. using ET;
  3. using FairyGUI;
  4. using UI.Store;
  5. namespace GFGGame
  6. {
  7. public class StorePayPropView : BaseWindow
  8. {
  9. private UI_StorePayPropUI _ui;
  10. //商品id
  11. private int _goodsId;
  12. //临时订单id
  13. private long _tempOrderId;
  14. //订单金额
  15. private long _price;
  16. public override void Dispose()
  17. {
  18. if (_ui != null)
  19. {
  20. _ui.Dispose();
  21. }
  22. _ui = null;
  23. base.Dispose();
  24. }
  25. protected override void OnHide()
  26. {
  27. base.OnHide();
  28. }
  29. protected override void OnInit()
  30. {
  31. base.OnInit();
  32. packageName = UI_StorePayPropUI.PACKAGE_NAME;
  33. _ui = UI_StorePayPropUI.Create();
  34. this.viewCom = _ui.target;
  35. this.viewCom.Center();
  36. this.modal = true;
  37. viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  38. _ui.m_payVxBtn.onClick.Add(OnVxBtnBuyClick);
  39. _ui.m_payAliBtn.onClick.Add(OnAliBtnBuyClick);
  40. _ui.m_payClose.onClick.Add(OnCloseClick);
  41. }
  42. protected override void OnShown()
  43. {
  44. base.OnShown();
  45. _goodsId = (int)(this.viewData as object[])[0];
  46. _tempOrderId = (int)(this.viewData as object[])[1];
  47. _price = (int)(this.viewData as object[])[2];
  48. ShopCfg cfg = ShopCfgArray.Instance.GetCfg(_goodsId);
  49. _ui.m_txtTotal.text = _price + "元";
  50. _ui.m_txtShopName.text = cfg.productName;
  51. _ui.m_txtXzf.text = _price + "元";
  52. }
  53. private async void OnVxBtnBuyClick()
  54. {
  55. S2C_CreateAliOrder response = await ShopSProxy.ReqCreateAliOrder(_tempOrderId);
  56. if (response == null || string.IsNullOrEmpty(response.AliOrderStr))
  57. {
  58. //TODO 提示调起支付宝失败
  59. return;
  60. }
  61. AliManagerr.Instance.Pay(response.AliOrderStr);
  62. }
  63. private async void OnAliBtnBuyClick()
  64. {
  65. }
  66. private async void OnCloseClick()
  67. {
  68. }
  69. }
  70. }