applyListInfoItem.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. snbAmount: {
  5. default: null,
  6. type: cc.Label,
  7. serializable: true,
  8. },
  9. applyItem: {
  10. default: null,
  11. serializable: false,
  12. visible: false
  13. },
  14. applyButton: {
  15. default: null,
  16. type: cc.Node,
  17. serializable: true,
  18. },
  19. parentScript:{
  20. default:null,
  21. visible:false
  22. }
  23. },
  24. setInfo(context) {
  25. let { item , parentScript} = context;
  26. this.applyItem = item;
  27. this.snbAmount.string = item.snb;
  28. if(1 === item.isState){
  29. this.applyButton.active = true;
  30. }
  31. this.parentScript = parentScript;
  32. },
  33. /**
  34. * 提现cnt
  35. */
  36. onApplyTranCnt() {
  37. //限制相关人员交易
  38. if (1 === GlobalD.UserInfo.limitTran) {
  39. GlobalD.GameData.showToast(
  40. cc.find('Canvas/UICamera'),
  41. '转换CNT通道关闭,请联系相关管理人员!',
  42. 1
  43. )
  44. return
  45. }
  46. if (0 === Number(this.applyItem.snb) || 0 != Number(this.applyItem.snb) % 5) {
  47. GlobalD.GameData.showToast(
  48. cc.find('Canvas/UICamera'),
  49. '请输入5的倍数兑换!',
  50. 1
  51. )
  52. return
  53. }
  54. console.log('发起兑换:' + Number(this.applyItem.snb))
  55. GlobalD.GameData.onSnbToCnt(Number(this.applyItem.snb), (data) => {
  56. //更新数据
  57. // console.log('res=', data)
  58. //更新审核列表
  59. this.parentScript.onchildrenUpdate();
  60. })
  61. }
  62. });