Pay.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { _decorator, Component, EditBox, game, instantiate, Label, Node, Prefab } from 'cc';
  2. import { UtilsPanel } from '../../scene/script/UtilsPanel';
  3. import { Generate } from '../../scene/script/components/Generate';
  4. import { nav_info } from '../../scene/script/NavInfo';
  5. const { ccclass, property } = _decorator;
  6. const Urls = [
  7. "",
  8. ""
  9. ]
  10. const Urls_Test = [
  11. "http://139.224.253.42:8089/livepay/getProducts?H5Extra=666888",
  12. "http://139.224.253.42:8089/livepay/payOrder"
  13. ];
  14. @ccclass('Pay')
  15. export class Pay extends Component {
  16. private node_descid: Node = null;
  17. private node_buy: Node = null;
  18. private gene_items: Generate = null;
  19. private lb_money: Label = null;
  20. private edit_id: EditBox = null;
  21. private urls = null;
  22. private select_index = 0;
  23. protected onLoad(){
  24. UtilsPanel.getAllNeedCom(this, this.node, false);
  25. UtilsPanel.addBtnEvent(this.node_buy, this.onBuy, this);
  26. // @ts-ignore
  27. game.on("select_item", this.onSelect, this);
  28. this.urls = nav_info.is_test ? Urls_Test : Urls;
  29. }
  30. protected start(): void {
  31. this.gene_items.initData(new Array(6));
  32. }
  33. private onEditChange(){
  34. this.node_descid.active = this.edit_id.string.length == 0;
  35. }
  36. private onSelect(index:number){
  37. this.lb_money.string = index * 1000 + "";
  38. }
  39. private onBuy(){
  40. }
  41. }