From 2004d0578480d12cd69c4d42d414ffd11828d0f1 Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期四, 31 十月 2024 20:18:47 +0800 Subject: [PATCH] fix bug --- XQMuse/Root/Home/VC/PaymentOrderVC.swift | 26 +++++++++++++++++++++----- 1 files changed, 21 insertions(+), 5 deletions(-) diff --git a/XQMuse/Root/Home/VC/PaymentOrderVC.swift b/XQMuse/Root/Home/VC/PaymentOrderVC.swift index f4832e9..bae25cc 100644 --- a/XQMuse/Root/Home/VC/PaymentOrderVC.swift +++ b/XQMuse/Root/Home/VC/PaymentOrderVC.swift @@ -160,13 +160,26 @@ @IBAction func completeAction(_ sender: UIButton) { - guard let m = courseModel else {return} + + var money:Double = 0 + var id:Int = 0 + + if let m = courseModel{ + money = m.generalPrice + id = m.id + } + + if let m = museModel{ + money = m.generalPrice + id = m.id + } + + guard btn_isRead.isSelected else { alertError(msg: "请先阅读并同意《课程/疗愈音频购买协议》");return } if giftToOther { - guard !tf_phone.text!.isEmpty else { alertError(msg: "请输入您要赠送人的手机号");return } @@ -176,7 +189,7 @@ } } - guard balance > m.generalPrice else{ + guard balance > money else{ CommonAlertView.show(title: "提示", content: "当前余额不足,请先充值", cancelStr: "暂不充值", completeStr: "去充值", isSingle: false) { state in if state{ @@ -185,7 +198,10 @@ return } - let vc = PaymentOrderResultVC(courseId: id, price: m.generalPrice) - push(vc: vc) + Services.gvieCourse(orderForm: type, targetId: id,receiverId: giftUserId).subscribe(onNext: {[weak self]data in + guard let weakSelf = self else { return } + let vc = PaymentOrderResultVC(type: weakSelf.type, id: id, price: money) + self?.push(vc: vc) + }).disposed(by: disposeBag) } } -- Gitblit v1.7.1