| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import SetGray from "../../component/SetGray";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class CashOutBillItem extends cc.Component {
- @property({ displayName: "金额", type: cc.Label })
- lab_value: cc.Label = null;
- @property({ displayName: "状态", type: cc.Label })
- lab_status: cc.Label = null;
- @property({ displayName: "操作描述", type: cc.Label })
- lab_operate: cc.Label = null;
- @property({ displayName: "操作按钮", type: SetGray })
- node_setGray: SetGray = null;
- private mData_ = null;
- private mIsGray_;
- setItemData(data) {
- this.mData_ = data;
- let index= this.node["index"];
- console.log("----");
- //this.initUI();
- }
- initUI() {
- this.lab_value.string = this.mData_.amount / 100 + '';
- if (this.mData_.amount == this.mData_.payAmount) {
- this.lab_status.string = "提现到账";
- this.lab_operate.string = "已到账";
- this.node_setGray.setGray(true);
- this.mIsGray_ = true;
- }else{
- let currentDay = new Date();
- let currentTimestamp = mk.time.dateToTimestamp(currentDay);
- let unlockDay= new Date(this.mData_.unlockDate);
- if(currentTimestamp >= this.mData_.unlockDate){
- this.lab_operate.string = "提现";
- this.node_setGray.setGray(false);
- this.mIsGray_ = false;
- this.lab_status.string = "已提现" + this.mData_.payAmount / 100 + "元";
- }else{
- let dayOffset = unlockDay.getDate() - currentDay.getDate();
- if(dayOffset == 1){
- this.lab_operate.string = "次日提现";
- }else{
- this.lab_operate.string = "待提现";
- }
- if(this.mData_.payAmount > 0){
- this.lab_status.string = "已提现" + this.mData_.payAmount / 100 + "元";
- }else{
- this.lab_status.string = dayOffset + "天内到账";
- }
- this.node_setGray.setGray(true);
- this.mIsGray_ = true;
- }
- }
- }
- clickBtn() {
- if(!this.mIsGray_){
- this.billCashOut();
- }
- }
- async billCashOut() {
- let data: any = {};
- data.partnerTradeNo = this.mData_.partnerTradeNo;
- let response = await mk.http.sendData('bill/billCash', data);
- if (response.errcode != 0) {
- return null;
- }
- let index= this.node["index"];
- let billData = response.data.billOrderInfoView;
- if(billData && billData.billDetailInfoList.length > index){
- let updateData = billData.billDetailInfoList[index];
- this.mData_.unlockDate = updateData.unlockDate;
- this.mData_.payAmount = updateData.payAmount;
- this.initUI();
- console.log(`billCashOut===${updateData.unlockDate}==${updateData.amount}==${updateData.payAmount}`);
- }
- }
- // update (dt) {}
- }
|