import JsbSystem from "../../../mk/system/JsbSystem"; import { TCashList } from "../../data/module/CashNormalData"; const { ccclass, property } = cc._decorator; /** * 红包码条目 * @author 薛鸿潇 */ @ccclass export default class RedBagCodeItem extends cc.Component { @property({ displayName: 'lbl红包码', type: cc.Label }) private lbl_code: cc.Label = null; @property({ displayName: 'lbl时间', type: cc.Label }) private lbl_time: cc.Label = null; @property({ displayName: 'lbl毛币', type: cc.Label }) private lbl_rmb: cc.Label = null; private item_data: TCashList = null; /** * 初始化数据 */ public async setItemData(item_data) { await this.initItem(item_data); } /** * 初始化样式 */ private initItem(item_data: TCashList) { this.item_data = item_data; this.lbl_rmb.string = ((item_data.amount / 100).toFixed(2)) + '元'; this.lbl_time.string = mk.time.getNowDayString(item_data.applyTime * 1000); this.lbl_code.string = item_data.withdrawalCode ? '红包码:' + item_data.withdrawalCode : ''; } /** * 复制按钮 */ private clickCopy() { JsbSystem.setClipboard(this.item_data.withdrawalCode) mk.tip.pop('复制成功') } // update (dt) {} }