| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- cc.Class({
- extends: cc.Component,
- properties: {
- snbAmount: {
- default: null,
- type: cc.Label,
- serializable: true,
- },
- applyItem: {
- default: null,
- serializable: false,
- visible: false
- },
- applyButton: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- parentScript: {
- default: null,
- visible: false
- },
- isTrans: false
- },
- setInfo(context) {
- let { item, parentScript } = context;
- this.applyItem = item;
- this.snbAmount.string = item.snb;
- if (1 === item.isState) {
- this.applyButton.active = true;
- }else{
- this.applyButton.active = false;
- }
- this.parentScript = parentScript;
- },
- /**
- * 提现cnt
- */
- onApplyTranCnt() {
- //限制相关人员交易
- if (1 === GlobalD.UserInfo.limitTran) {
- GlobalD.GameData.showToast(
- cc.find('Canvas/UICamera'),
- '转换CNT通道关闭,请联系相关管理人员!',
- 1
- )
- return
- }
- if (0 === Number(this.applyItem.snb) || 0 != Number(this.applyItem.snb) % 5) {
- GlobalD.GameData.showToast(
- cc.find('Canvas/UICamera'),
- '请输入5的倍数兑换!',
- 1
- )
- return
- }
- // console.log('发起兑换:' + Number(this.applyItem.snb));
- console.log('this.applyItem', this.applyItem);
- //todo 这里先判断一次,对应的snb是否是审查的snb凭证
- if (this.isTrans) return;
- GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "兑换中", 10);
- this.isTrans = true;
- GlobalD.GameData.onCheckApplySnbToCnt(this.applyItem.id, (checkRes) => {
- this.isTrans = false;
- if (0 === checkRes.code) {
- console.log('发起兑换:' + Number(this.applyItem.snb),"== checkRes.data.snb:",checkRes.data.snb);
- GlobalD.GameData.onSnbToCnt(checkRes.data.snb, (data) => {
- //更新数据
- // console.log('res=', data)
- //更新审核列表
- this.parentScript.onchildrenUpdate();
- })
- } else {
- this.parentScript.onchildrenUpdate();
- GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), checkRes.msg, 3);
- }
- })
- }
- });
|