无故事王国
2023-11-14 2a7b12af07d814030c1326f56fec6ebf0d11619f
修复BUG
13个文件已修改
581 ■■■■ 已修改文件
WanPai/Model/CommonModels.swift 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Network/Services.swift 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Activity/TCell/ActivityInfoTCell.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Activity/VC/ActivityDetailApplyVC.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseDetailApplyVC.swift 443 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseDetailVC.swift 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseInfoVC.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Home/Model/HomeModel.swift 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Home/VC/HomeVC.swift 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Other/View/StudentChooseView.swift 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/VC/WelfareRedeemGoodsDetailVC.swift 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.xib 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Model/CommonModels.swift
@@ -198,6 +198,7 @@
    var storeName: String = ""
    var storeInfos = [ActivityDetailStoreModel]()
    var hasPass = 0 // 0:正常,1:截止
    var isReal:Int = 0
}
struct ActivityDetailStoreModel:HandyJSON{
WanPai/Network/Services.swift
@@ -1076,9 +1076,11 @@
        /// 获取参赛人员列表
    class func queryParticipantList(isAuth:Int? = nil)->Observable<BaseResponse<[ActivityDetailPartModel]>>{
        let params = ParamsAppender.build(url: All_Url)
        var params = ParamsAppender.build(url: All_Url)
            .interface(url: "competition/api/participant/queryParticipantList")
            .append(key: "isPre", value: isAuth)
        if isAuth == 1{
            params.append(key: "isPre", value: isAuth)
        }
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
WanPai/Root/Activity/TCell/ActivityInfoTCell.swift
@@ -13,7 +13,7 @@
    var activityListModel:ActivityListModel?{
        didSet{
            if let m = activityListModel{
                img_profile.sd_setImage(with: URL(string: m.coverDrawing)!,placeholderImage: UIImage(named: "placeholder_1"))
                img_profile.sd_setImage(with: URL(string: m.coverDrawing),placeholderImage: UIImage(named: "placeholder_1"))
                label_title.text = m.name
                var temp = [String]()
WanPai/Root/Activity/VC/ActivityDetailApplyVC.swift
@@ -115,7 +115,7 @@
    }
    @IBAction func addStudentAction(_ sender: QMUIButton) {
        StudentChooseView.show(itemType: .activity, defaultStu: students) { [weak self] studs in
        StudentChooseView.show(itemType: .activity, defaultStu: students,isAuth: activityDetailModel.isReal) { [weak self] studs in
            self?.students = studs as! [ActivityDetailPartModel]
            self?.cons_tableHei.constant = Double(self?.students.count ?? 0) * 100
            self?.tableView.reloadData()
WanPai/Root/Course/VC/CourseDetailApplyVC.swift
@@ -1,9 +1,9 @@
    //
    //  CourseDetailApplyVC.swift
    //  WanPai
    //
    //  Created by 杨锴 on 2023/6/9.
    //
    //
    //  CourseDetailApplyVC.swift
    //  WanPai
    //
    //  Created by 杨锴 on 2023/6/9.
    //
import UIKit
import JQTools
@@ -11,27 +11,27 @@
class CourseDetailApplyVC: BaseVC {
    @IBOutlet weak var collectionView: UICollectionView!
    @IBOutlet weak var cons_collectHei: NSLayoutConstraint!
    @IBOutlet weak var btn_addStudent: QMUIButton!
    @IBOutlet weak var tableView: UITableView!
    @IBOutlet weak var cons_collHei: NSLayoutConstraint!
    @IBOutlet weak var cons_tableHei: NSLayoutConstraint!
    @IBOutlet weak var btn_coupon: TapBtn!
    @IBOutlet weak var collectionView: UICollectionView!
    @IBOutlet weak var cons_collectHei: NSLayoutConstraint!
    @IBOutlet weak var btn_addStudent: QMUIButton!
    @IBOutlet weak var tableView: UITableView!
    @IBOutlet weak var cons_collHei: NSLayoutConstraint!
    @IBOutlet weak var cons_tableHei: NSLayoutConstraint!
    @IBOutlet weak var btn_coupon: TapBtn!
    @IBOutlet weak var view_banner: CommonBannerView!
    @IBOutlet weak var label_title: UILabel!
    @IBOutlet weak var label_listenWeek: UILabel!
    @IBOutlet weak var label_listenTime: UILabel!
    @IBOutlet weak var label_store: UILabel!
    @IBOutlet weak var label_address: UILabel!
    @IBOutlet weak var label_listenWeek: UILabel!
    @IBOutlet weak var label_listenTime: UILabel!
    @IBOutlet weak var label_store: UILabel!
    @IBOutlet weak var label_address: UILabel!
    @IBOutlet weak var label_price: UILabel!
    @IBOutlet weak var label_originPrice: UILabel!
    @IBOutlet weak var label_vipPrice: UILabel!
    @IBOutlet weak var label_coin: UILabel!
    @IBOutlet weak var btn_hasCoupon: TapBtn!
    @IBOutlet weak var btn_couponInfo: UIButton!
    @IBOutlet weak var label_price: UILabel!
    @IBOutlet weak var label_originPrice: UILabel!
    @IBOutlet weak var label_vipPrice: UILabel!
    @IBOutlet weak var label_coin: UILabel!
    @IBOutlet weak var btn_hasCoupon: TapBtn!
    @IBOutlet weak var btn_couponInfo: UIButton!
    @IBOutlet weak var label_courseType: UILabel!
    @IBOutlet weak var view_vaildTime: UIView!
@@ -41,18 +41,18 @@
    @IBOutlet weak var btn_handleBtn: UIButton!
    @IBOutlet weak var view_teach: UIView!
    private var detailModel:CourseDetailModel?
    private var selectClassIndex:Int = 0
    private var detailModel:CourseDetailModel?
    private var selectClassIndex:Int = 0
    private var isExtend:Bool = false
    private var CellW:Double!
    private var CellH:Double!
    private var studentModels = [CourseDetailStudentModel]()
    private var couponModels = [CouponInfoModel]()
    private var selectCouponModel:CouponInfoModel?
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "运动营详情"
    private var CellW:Double!
    private var CellH:Double!
    private var studentModels = [CourseDetailStudentModel]()
    private var couponModels = [CouponInfoModel]()
    private var selectCouponModel:CouponInfoModel?
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "运动营详情"
        if let m = detailModel{
            label_title.text = m.name
@@ -108,96 +108,96 @@
        }
    }
    override func setUI() {
    }
        btn_hasCoupon.isHidden = true
        CellW = (JQ_ScreenW - 155) / 3.0
        CellH = CellW * 0.439
        cons_tableHei.constant = 76
        collectionView.delegate = self
        collectionView.dataSource = self
        collectionView.register(UINib(nibName: "Common_1_CCell", bundle: nil), forCellWithReuseIdentifier: "_Common_1_CCell")
        studentTableView.dataSource = self
        studentTableView.separatorStyle = .none
        studentTableView.register(UINib(nibName: "StudentInfoTCell", bundle: nil), forCellReuseIdentifier: "_StudentInfoTCell")
        btn_addStudent.imagePosition = .right
        btn_addStudent.spacingBetweenImageAndTitle = 3
    }
    override func setUI() {
        btn_hasCoupon.isHidden = true
        CellW = (JQ_ScreenW - 155) / 3.0
        CellH = CellW * 0.439
        cons_tableHei.constant = 76
        collectionView.delegate = self
        collectionView.dataSource = self
        collectionView.register(UINib(nibName: "Common_1_CCell", bundle: nil), forCellWithReuseIdentifier: "_Common_1_CCell")
        studentTableView.dataSource = self
        studentTableView.separatorStyle = .none
        studentTableView.register(UINib(nibName: "StudentInfoTCell", bundle: nil), forCellReuseIdentifier: "_StudentInfoTCell")
        btn_addStudent.imagePosition = .right
        btn_addStudent.spacingBetweenImageAndTitle = 3
    }
    init(detailModel:CourseDetailModel,isExtend:Bool = false) {
        super.init(nibName: nil, bundle: nil)
        self.detailModel = detailModel
        super.init(nibName: nil, bundle: nil)
        self.detailModel = detailModel
        self.isExtend = isExtend
    }
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func setRx() {
        NotificationCenter.default.rx.notification(StudentUpdate_Nofi).take(until: self.rx.deallocated).subscribe {[weak self] noti in
            guard let weakSelf = self else { return }
            //重新唤起添加学生
                //重新唤起添加学生
            weakSelf.studentAction(weakSelf.btn_addStudent)
        }.disposed(by: disposeBag)
    }
    @IBAction func couponAction(_ sender: TapBtn) {
        CouponChooseView.show(couponModels,defaultModel: selectCouponModel) {[weak self] m in
    @IBAction func couponAction(_ sender: TapBtn) {
        CouponChooseView.show(couponModels,defaultModel: selectCouponModel) {[weak self] m in
            guard let weakSelf = self else { return }
            weakSelf.selectCouponModel = m
            guard m != nil else {
            guard m != nil else {
                weakSelf.btn_couponInfo.setTitle("去选择", for: .normal);return
            }
            }
            weakSelf.btn_couponInfo.setTitle("-\(m!.favorable.currency())", for: .normal)
            weakSelf.changePrice(weakSelf.selectClassIndex)
        }
    }
    @IBAction func studentAction(_ sender: QMUIButton) {
        StudentChooseView.show(itemType: .course, defaultStu: studentModels) { [weak self] studs in
            guard let weakSelf = self else { return }
            weakSelf.studentModels = studs as! [CourseDetailStudentModel]
            weakSelf.tableView.reloadData()
            weakSelf.cons_tableHei.constant = CGFloat((weakSelf.studentModels.count) * 87)
            weakSelf.changePrice(weakSelf.selectClassIndex)
        } needAddClouse: { [weak self] () in
            let vc = AddStudentVC(type: .course)
            self?.push(vc: vc)
        }
    }
    @IBAction func paymentAction(_ sender: UIButton) {
        guard detailModel != nil else {return}
        guard studentModels.count != 0 else {alertError(msg: "请选择运动营成员");return}
        StoresInfoView.show(detailModel!) { [weak self] status in
            guard let weakSelf = self else { return }
            if status{
                if let model = weakSelf.detailModel?.list[weakSelf.selectClassIndex]{
        }
    }
    @IBAction func studentAction(_ sender: QMUIButton) {
        StudentChooseView.show(itemType: .course, defaultStu: studentModels) { [weak self] studs in
            guard let weakSelf = self else { return }
            weakSelf.studentModels = studs as! [CourseDetailStudentModel]
            weakSelf.tableView.reloadData()
            weakSelf.cons_tableHei.constant = CGFloat((weakSelf.studentModels.count) * 87)
            weakSelf.changePrice(weakSelf.selectClassIndex)
        } needAddClouse: { [weak self] () in
            let vc = AddStudentVC(type: .course)
            self?.push(vc: vc)
        }
    }
    @IBAction func paymentAction(_ sender: UIButton) {
        guard detailModel != nil else {return}
        guard studentModels.count != 0 else {alertError(msg: "请选择运动营成员");return}
        StoresInfoView.show(detailModel!) { [weak self] status in
            guard let weakSelf = self else { return }
            if status{
                if let model = weakSelf.detailModel?.list[weakSelf.selectClassIndex]{
                    var price:Double = 0
                    //是否是会员
                        //是否是会员
                    if weakSelf.detailModel?.isVip == 1 && model.vipPrice != 0{
                        price = model.vipPrice
                    }else{
                        price = model.paymentPrice
                    }
                    //计算人数总价
                        //计算人数总价
                    price = price * Double(weakSelf.studentModels.count)
                    //减去优惠
                        //减去优惠
                    let discountPrice = price - (weakSelf.selectCouponModel?.favorable ?? 0)
                    let coin = model.playPaiCoin * weakSelf.studentModels.count
                    PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil,integral:nil)) { [weak self] payType in
                        guard let weakSelf = self else { return }
                    PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil,integral:nil)) { [weak self] payType in
                        guard let weakSelf = self else { return }
                        var paymentPrice:Double = 0
                        switch payType {
@@ -208,36 +208,36 @@
                            case .courseNum,.integral:break
                        }
                        Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: paymentPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in
                        Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: paymentPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in
                            if data.code == 200{
                                switch payType {
                                    case .aliPay:
                                switch payType {
                                    case .aliPay:
                                        YYPaymentManager.shared.sendPaymentRequest(YYAlipayRequest(orderString: data.data!.orderString)) { [weak self] result in
                                            switch result {
                                                case .success:
                                                    let vc = PaymentResultVC(result: .success, objType: .courseApply,handleVC: self,courseConfigId: model.id)
                                            switch result {
                                                case .success:
                                                    let vc = PaymentResultVC(result: .success, objType: .courseApply,handleVC: self,courseConfigId: model.id)
                                                    vc.isExtend = self?.isExtend ?? false
                                                    self?.push(vc: vc)
                                                case .cancel:
                                                    alert(msg: "已取消")
                                                case .failure(_):
                                                case .cancel:
                                                    alert(msg: "已取消")
                                                case .failure(_):
                                                    let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .courseApply)
                                                    self?.push(vc: vc)
                                            }
                                        }
                                    case .wechat:
                                            }
                                        }
                                    case .wechat:
                                        self?.navigationController?.popViewController(animated: false)
                                        break
                                    case .coin:
//                                        self?.navigationController?.popViewController(animated: false)
                                    case .coin:
                                            //                                        self?.navigationController?.popViewController(animated: false)
                                        let vc = PaymentResultVC(result: .success, objType: .courseApply,handleVC: self,courseConfigId: model.id)
                                        vc.isExtend = self?.isExtend ?? false
                                        self?.push(vc: vc)
                                    case .courseNum,.integral:break
                                }
                            }else{
                                alertError(msg: data.msg)
                            }
                                }
                            }else{
                                alertError(msg: data.msg)
                            }
                        },onError: { error in
                            if let er = error as? NetworkRequest.NetRequestError{
                                switch er {
@@ -251,19 +251,19 @@
                            }
                        }).disposed(by: weakSelf.disposeBag)
                    }
                }
            }else{
                self?.navigationController?.popToRootViewController(animated: true)
                    }
                }
            }else{
                self?.navigationController?.popToRootViewController(animated: true)
                NotificationCenter.default.post(name: ChooseHomeStore_Noti, object: nil)
            }
        }
    }
            }
        }
    }
    //计算价格
    private func changePrice(_ index:Int){
        if let subM = detailModel?.list[index]{
        //计算价格
    private func changePrice(_ index:Int){
        if let subM = detailModel?.list[index]{
            var studentCount:Double = 0
            if studentModels.count == 0{
                studentCount = 1
@@ -278,10 +278,10 @@
                    label_price.isHidden = true
                    label_originPrice.isHidden = true
                    label_vipPrice.isHidden = true
                    //纯玩湃币没有优惠券项
                    label_coin.isHidden = false
                        //纯玩湃币没有优惠券项
                    btn_hasCoupon.isHidden = true
                    label_coin.isHidden = false
                        //玩湃币
                    label_coin.attributedText = AttributedStringbuilder.build()
                        .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
@@ -295,8 +295,8 @@
                    }else{
                        label_originPrice.isHidden = false
                    }
//                    label_originPrice.isHidden = (subM.paymentPrice == subM.originalPrice && subM.paymentPrice != 0 && subM.originalPrice != 0)
                        //                    label_originPrice.isHidden = (subM.paymentPrice == subM.originalPrice && subM.paymentPrice != 0 && subM.originalPrice != 0)
                    label_coin.isHidden = false
                        //玩湃币
                    label_coin.attributedText = AttributedStringbuilder.build()
                        .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
@@ -307,76 +307,87 @@
                    label_originPrice.attributedText = attribute.mutableAttributedString
                    if UserInfoModel.get()?.isVip == 1{
                            //会员
                        label_vipPrice.isHidden = true
                        if subM.paymentPrice < subM.vipPrice && subM.paymentPrice != 0{
                            label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                        }else if subM.vipPrice < subM.paymentPrice && subM.vipPrice != 0{
                            label_price.text = (subM.vipPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                        }else if subM.vipPrice != 0 &&  subM.paymentPrice != 0{
                            let price = min(subM.vipPrice, subM.paymentPrice)
                            label_price.text = (price * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                        }else{
                            label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                        if subM.payType != .coin{
                                //会员
                            label_vipPrice.isHidden = true
                            if subM.paymentPrice < subM.vipPrice && subM.paymentPrice != 0{
                                label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                            }else if subM.vipPrice < subM.paymentPrice && subM.vipPrice != 0{
                                label_price.text = (subM.vipPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                            }else if subM.vipPrice != 0 &&  subM.paymentPrice != 0{
                                let price = min(subM.vipPrice, subM.paymentPrice)
                                label_price.text = (price * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                            }else{
                                label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                            }
                        }
                    }else{
                            //非会员
                        label_vipPrice.isHidden = subM.vipPrice == 0 || subM.vipPrice == subM.paymentPrice
                        let vipAttribute = AttributedStringbuilder.build()
                            .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                            .add(string: (subM.vipPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
                        label_vipPrice.attributedText = vipAttribute.mutableAttributedString
                        if subM.payType != .coin{
                                //非会员
                            label_vipPrice.isHidden = subM.vipPrice == 0 || subM.vipPrice == subM.paymentPrice
                            let vipAttribute = AttributedStringbuilder.build()
                                .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                                .add(string: (subM.vipPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
                            label_vipPrice.attributedText = vipAttribute.mutableAttributedString
                        if subM.originalPrice != 0 && subM.paymentPrice == 0{
                            label_price.text = (subM.originalPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                        }else if subM.originalPrice == 0 && subM.paymentPrice != 0{
                            label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                        }else if subM.originalPrice != 0 && subM.paymentPrice != 0{
                            var money = min(subM.originalPrice,subM.paymentPrice)
                            money = money - (selectCouponModel?.favorable ?? 0)
                            label_price.text = (money * studentCount).currency()
                        }else{
                            label_price.text = (subM.originalPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                            if subM.originalPrice != 0 && subM.paymentPrice == 0{
                                label_price.text = (subM.originalPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                            }else if subM.originalPrice == 0 && subM.paymentPrice != 0{
                                label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                            }else if subM.originalPrice != 0 && subM.paymentPrice != 0{
                                var money = min(subM.originalPrice,subM.paymentPrice)
                                money = money - (selectCouponModel?.favorable ?? 0)
                                label_price.text = (money * studentCount).currency()
                            }else{
                                label_price.text = (subM.originalPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
                            }
                        }
                    }
            }
            if detailModel?.type == .experience{
                label_price.text = subM.paymentPrice.currency()
                if subM.paymentPrice != 0{
                    label_price.text = subM.paymentPrice.currency()
                    label_price.isHidden = false
                }
                view_teach.isHidden = true
                label_originPrice.isHidden = true
                label_vipPrice.isHidden = true
            }
            if label_originPrice.isHidden && label_vipPrice.isHidden && label_coin.isHidden{
                label_coin.alpha = 0
            }
        }
    }
                //            if label_originPrice.isHidden && label_vipPrice.isHidden && label_coin.isHidden{
                //                label_coin.alpha = 0
                //            }
        }
    }
    //查询优惠券
        //查询优惠券
    private func queryCouponInfo(complete:(()->Void)? = nil){
        if let subM = detailModel?.list[selectClassIndex]{
        if let subM = detailModel?.list[selectClassIndex]{
            var price:Double?
            switch subM.payType{
            var price:Double?
            switch subM.payType{
                case .cash,.cashCoin:
                    price = subM.originalPrice == 0 ? subM.vipPrice : subM.originalPrice
                case .coin:
                    price = subM.originalPrice == 0 ? subM.vipPrice : subM.originalPrice
                case .coin:
                    price = Double(subM.playPaiCoin)
            }
            guard price != nil else {
                LogError("会员优惠价格出现问题:nil");return
            }
            guard price != nil else {
                LogError("会员优惠价格出现问题:nil");return
            }
            Services.queryAvaiableCopons(id: detailModel!.id, price: price!).subscribe(onNext: { [weak self] data in
            Services.queryAvaiableCopons(id: detailModel!.id, price: price!).subscribe(onNext: { [weak self] data in
                guard let weakSelf = self else { return }
                self?.btn_hasCoupon.isHidden = (data.data?.count ?? 0) == 0
                self?.couponModels = data.data ?? []
                self?.btn_hasCoupon.isHidden = (data.data?.count ?? 0) == 0
                self?.couponModels = data.data ?? []
                //重新获取优惠券,在切换套餐时触发
                    //重新获取优惠券,在切换套餐时触发
                if let selectCoupon = self?.selectCouponModel{
                    if !weakSelf.couponModels.contains(where: {$0.id == selectCoupon.id}){
                        weakSelf.selectCouponModel = nil
@@ -384,9 +395,9 @@
                    }
                }
                complete?()
            }).disposed(by: disposeBag)
        }
    }
            }).disposed(by: disposeBag)
        }
    }
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
@@ -396,55 +407,55 @@
}
extension CourseDetailApplyVC:UICollectionViewDelegate{
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        selectClassIndex = indexPath.row
        collectionView.reloadData()
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        selectClassIndex = indexPath.row
        collectionView.reloadData()
        queryCouponInfo {[weak self] () in
            self?.changePrice(indexPath.row)
        }
    }
    }
}
extension CourseDetailApplyVC:UICollectionViewDataSource{
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let m = detailModel!.list[indexPath.row]
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_Common_1_CCell", for: indexPath) as! Common_1_CCell
        cell.isSelected = indexPath.row == selectClassIndex
        cell.courseDetailListModel = m
        return cell
    }
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return detailModel?.list.count ?? 0
    }
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let m = detailModel!.list[indexPath.row]
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_Common_1_CCell", for: indexPath) as! Common_1_CCell
        cell.isSelected = indexPath.row == selectClassIndex
        cell.courseDetailListModel = m
        return cell
    }
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return detailModel?.list.count ?? 0
    }
}
extension CourseDetailApplyVC:UICollectionViewDelegateFlowLayout{
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
        return 21
    }
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
        return 21
    }
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        return CGSize(width: CellW, height: CellH)
    }
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
        return 21
    }
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
        return 21
    }
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        return CGSize(width: CellW, height: CellH)
    }
}
extension CourseDetailApplyVC:UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return studentModels.count
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "_StudentInfoTCell") as! StudentInfoTCell
        cell.indexPath = indexPath
        cell.studentModel = studentModels[indexPath.row]
        cell.deleClouse = { [weak self] index in
            guard let weakSelf = self else { return }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return studentModels.count
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "_StudentInfoTCell") as! StudentInfoTCell
        cell.indexPath = indexPath
        cell.studentModel = studentModels[indexPath.row]
        cell.deleClouse = { [weak self] index in
            guard let weakSelf = self else { return }
            if weakSelf.studentModels.count > 1{
                tableView.beginUpdates()
                weakSelf.studentModels.remove(at: index)
@@ -456,8 +467,8 @@
            }else{
                alert(msg: "至少选择一位运动营成员")
            }
        }
        }
        cell.btn_handle.isHidden = isExtend
        return cell
    }
        return cell
    }
}
WanPai/Root/Course/VC/CourseDetailVC.swift
@@ -73,7 +73,7 @@
                            label_price.isHidden = true
                            label_originPrice.isHidden = true
                            label_vipPrice.isHidden = true
                            label_coin.isHidden = false
                            //玩湃币
                            label_coin.attributedText = AttributedStringbuilder.build()
                                .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
@@ -87,6 +87,7 @@
                            }else{
                                label_originPrice.isHidden = false
                            }
                            label_coin.isHidden = false
                                //玩湃币
                            label_coin.attributedText = AttributedStringbuilder.build()
                                .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
@@ -97,50 +98,59 @@
                            label_originPrice.attributedText = attribute.mutableAttributedString
                            if UserInfoModel.get()?.isVip == 1{
                                    //会员
                                label_vipPrice.isHidden = true
                                //优惠价比会员价更优惠
                                if subM.paymentPrice < subM.vipPrice && subM.paymentPrice != 0{
                                    label_price.text = subM.paymentPrice.currency()
                                }
                                //会员价比优惠价更优惠
                                else if subM.vipPrice < subM.paymentPrice && subM.vipPrice != 0{
                                    label_price.text = subM.vipPrice.currency()
                                }else if subM.vipPrice != 0 && subM.paymentPrice != 0{
                                    //会员价和优惠价一样
                                    label_price.text = min(subM.vipPrice,subM.paymentPrice).currency()
                                }else{
                                    label_price.text = subM.paymentPrice.currency()
                                if subM.payType != .coin{
                                        //会员
                                    label_vipPrice.isHidden = true
                                        //优惠价比会员价更优惠
                                    if subM.paymentPrice < subM.vipPrice && subM.paymentPrice != 0{
                                        label_price.text = subM.paymentPrice.currency()
                                    }
                                        //会员价比优惠价更优惠
                                    else if subM.vipPrice < subM.paymentPrice && subM.vipPrice != 0{
                                        label_price.text = subM.vipPrice.currency()
                                    }else if subM.vipPrice != 0 && subM.paymentPrice != 0{
                                            //会员价和优惠价一样
                                        label_price.text = min(subM.vipPrice,subM.paymentPrice).currency()
                                    }else{
                                        label_price.text = subM.paymentPrice.currency()
                                    }
                                }
                            }else{
                                    //非会员
                                label_vipPrice.isHidden = subM.vipPrice == 0 || subM.vipPrice == subM.paymentPrice
                                let vipAttribute = AttributedStringbuilder.build()
                                    .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                                    .add(string: subM.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
                                label_vipPrice.attributedText = vipAttribute.mutableAttributedString
                                if subM.payType != .coin{
                                        //非会员
                                    label_vipPrice.isHidden = subM.vipPrice == 0 || subM.vipPrice == subM.paymentPrice
                                    let vipAttribute = AttributedStringbuilder.build()
                                        .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                                        .add(string: subM.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
                                    label_vipPrice.attributedText = vipAttribute.mutableAttributedString
                                if subM.originalPrice != 0 && subM.paymentPrice == 0{
                                    label_price.text = subM.originalPrice.currency()
                                }else if subM.originalPrice == 0 && subM.paymentPrice != 0{
                                    label_price.text = subM.paymentPrice.currency()
                                }else if subM.originalPrice != 0 && subM.paymentPrice != 0{
                                    label_price.text = min(subM.originalPrice,subM.paymentPrice).currency()
                                }else{
                                    label_price.text = subM.originalPrice.currency()
                                    if subM.originalPrice != 0 && subM.paymentPrice == 0{
                                        label_price.text = subM.originalPrice.currency()
                                    }else if subM.originalPrice == 0 && subM.paymentPrice != 0{
                                        label_price.text = subM.paymentPrice.currency()
                                    }else if subM.originalPrice != 0 && subM.paymentPrice != 0{
                                        label_price.text = min(subM.originalPrice,subM.paymentPrice).currency()
                                    }else{
                                        label_price.text = subM.originalPrice.currency()
                                    }
                                }
                            }
                    }
                }
                if m.type == .experience{
                    label_price.text = (m.list.first?.paymentPrice ?? 0).currency()
                    if  m.list.first?.paymentPrice != 0{
                        label_price.text = (m.list.first!.paymentPrice).currency()
                        label_price.isHidden = false
                    }
                    label_vaildTime.text = "购买当天有效"
                    label_originPrice.isHidden = true
                    label_vipPrice.isHidden = true
                    view_listen.isHidden = true
                    label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0
//                    label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0
                }
                    //体验课,假期课不展示
@@ -149,9 +159,9 @@
                    cons_handleHei.constant = 0
                }
                if label_originPrice.isHidden && label_vipPrice.isHidden && label_coin.isHidden{
                    label_coin.alpha = 0
                }
//                if label_originPrice.isHidden && label_vipPrice.isHidden && label_coin.isHidden{
//                    label_coin.alpha = 0
//                }
            }
        }
    }
WanPai/Root/Course/VC/CourseInfoVC.swift
@@ -117,7 +117,7 @@
    override func setUI() {
        cons_menuHeight.constant = 0
        scrollView.contentInset = UIEdgeInsets( top: 265 - JQ_NavBarHeight, left: 0, bottom: 0, right: 0)
        scrollView.contentInset = UIEdgeInsets( top: UIDevice.jq_safeEdges.top  + 158, left: 0, bottom: 0, right: 0)
        scrollView.delegate = self
        scrollView.bringSubviewToFront(img_header)
WanPai/Root/Home/Model/HomeModel.swift
@@ -30,8 +30,6 @@
    var sort:Int = 0
    var backgroundImage:String = ""
    var cellHeight:Double = 270
}
class HomeStoreTopBannerModel:HandyJSON{
@@ -44,8 +42,7 @@
    var type:String = "" //类型
    var turnId:Int?
    var model = ""
    var sort = 0
    var cellHeight:Double = 270
}
WanPai/Root/Home/VC/HomeVC.swift
@@ -11,10 +11,6 @@
import RxCocoa
import SDWebImage
    //http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4
    //http://vjs.zencdn.net/v/oceans.mp4
    //https://media.w3.org/2010/05/sintel/trailer.mp4
let ChooseHomeStore_Noti = Notification.Name.init("ChooseHomeStore_Noti")
let UpdateCurrentStore_Noti = Notification.Name.init("UpdateCurrentStore_Noti")
@@ -58,7 +54,6 @@
        }).disposed(by: disposeBag)
        Services.bannerList(position: .homeTop).subscribe(onNext: {[weak self] data in
            guard let weakSelf = self else { return }
            if let models = data.data{
                var bannerResources = [CommonBannerModel]()
                for (i,item) in models.enumerated() {
@@ -117,7 +112,6 @@
    private func getStoreItemList(){
//        showHUD()
        items.removeAll()
        Services.homeStoreConfig(storeId: storeId!).subscribe(onNext: {[weak self] data in
@@ -185,6 +179,18 @@
        }
        group.notify(queue: .main) {
            self.items = self.items.sorted { v1, v2 in
                var v1Sort = 0
                var v2Sort = 0
                v1Sort = (v1 as? HomeStoreConfigModel)?.sort ?? 0
                v2Sort = (v2 as? HomeStoreConfigModel)?.sort ?? 0
                v1Sort = (v1 as? HomeStoreTopBannerModel)?.sort ?? 0
                v2Sort = (v2 as? HomeStoreTopBannerModel)?.sort ?? 0
                return v1Sort < v2Sort
            }
            self.layout.collectionView?.reloadData()
            self.collectionView.reloadData()
        }
WanPai/Root/Other/View/StudentChooseView.swift
@@ -19,8 +19,9 @@
}
class ActivityViewModel:RefreshModel<ActivityDetailPartModel>{
    var isAuth = BehaviorRelay<Int?>.init(value: nil)
    override func api() -> (Observable<BaseResponse<[ActivityDetailPartModel]>>)? {
        return Services.queryParticipantList(isAuth: 1)
        return Services.queryParticipantList(isAuth: isAuth.value)
    }
    
}
@@ -63,7 +64,7 @@
        setRx()
    }
    
    static func show(itemType:ItemType,defaultStu:[Any]? = nil,clickClouse:@escaping ([Any])->Void,needAddClouse:@escaping ()->Void){
    static func show(itemType:ItemType,defaultStu:[Any]? = nil,isAuth:Int? = nil,clickClouse:@escaping ([Any])->Void,needAddClouse:@escaping ()->Void){
        let studentChooseView = StudentChooseView.jq_loadNibView()
        if defaultStu != nil{
            studentChooseView.selectStudents = defaultStu!
@@ -88,6 +89,7 @@
            studentChooseView.stuViewModel.beginRefresh()
        }else{
            studentChooseView.actViewModel.configure(studentChooseView.tableView,needMore: false)
            studentChooseView.actViewModel.isAuth.accept(isAuth)
            studentChooseView.actViewModel.beginRefresh()
            studentChooseView.cons_tableLeading.constant = 0
            studentChooseView.cons_tableTrailing.constant = 0
WanPai/Root/Welfare/VC/WelfareRedeemGoodsDetailVC.swift
@@ -236,11 +236,11 @@
        switch exchangeGoodsModel!.exchangeType{
            case .cash:
                attribute.add(string: (exchangeGoodsModel!.cash * Double(num)).currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8))
                attribute.add(string: (exchangeGoodsModel!.cash * Double(studentModels.count) * Double(num)).currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8))
            case .cashAndCoin:
                attribute.add(string: String(format: "%ld积分和%@", exchangeGoodsModel!.integral * num,(exchangeGoodsModel!.cash * Double(num)).currency()), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8))
                attribute.add(string: String(format: "%ld积分和%@", exchangeGoodsModel!.integral * num * studentModels.count,(exchangeGoodsModel!.cash * Double(num) * Double(studentModels.count)).currency()), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8))
            case .coin:
                attribute.add(string: "\(exchangeGoodsModel!.integral * num)积分", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8))
                attribute.add(string: "\(exchangeGoodsModel!.integral * num * studentModels.count)积分", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8))
        }
        attribute.add(string: "兑换此商品吗?", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.9))
WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift
@@ -43,6 +43,7 @@
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "运动营详情"
        label_vip.isHidden = true
        Services.weekBenefitDetail(id: id).subscribe(onNext: {[weak self] data in
            guard let weakSelf = self else { return }
@@ -56,10 +57,13 @@
                weakSelf.label_attendWeeks.text = model.weekTime
                weakSelf.label_datetime.text = model.time
                weakSelf.label_distance.text = String(format: "距离我%.2lfkm", model.distance)
                weakSelf.label_vip.isHidden  = model.discountPrice == 0
                weakSelf.label_coin.isHidden = model.wanpaiGold == 0
                weakSelf.label_originPrice.isHidden = model.costPrice == 0
                weakSelf.label_originPrice.attributedText = AttributedStringbuilder.build().add(string: model.costPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).delLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).mutableAttributedString
                weakSelf.label_price.text = model.discountPrice.currency()
                weakSelf.img_intro.sd_setImage(with: URL(string: model.detailDrawing)) {[weak self] image, error, type, url in
                    if let img = image{
                        self?.img_intro.image = img
WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.xib
@@ -157,8 +157,8 @@
                                                <constraint firstAttribute="height" constant="1" id="Ctc-XK-pWb"/>
                                            </constraints>
                                        </view>
                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="赠送课时数:" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IWq-FM-yEj">
                                            <rect key="frame" x="14" y="14" width="86" height="20"/>
                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="额外赠送:" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IWq-FM-yEj">
                                            <rect key="frame" x="14" y="14" width="71.666666666666671" height="20"/>
                                            <constraints>
                                                <constraint firstAttribute="height" constant="20" id="Vgb-AO-v9r"/>
                                            </constraints>
@@ -167,7 +167,7 @@
                                            <nil key="highlightedColor"/>
                                        </label>
                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0课时" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mQE-9m-7Uc">
                                            <rect key="frame" x="105" y="14" width="37.333333333333343" height="20"/>
                                            <rect key="frame" x="90.666666666666671" y="14" width="37.333333333333329" height="20"/>
                                            <constraints>
                                                <constraint firstAttribute="height" constant="20" id="y12-6z-YGI"/>
                                            </constraints>