//
|
// ValuationRuleVC.swift
|
// OKProject
|
//
|
// Created by 无故事王国 on 2022/6/30.
|
// Copyright © 2022 yangwang. All rights reserved.
|
//
|
|
import UIKit
|
|
class ValuationRuleVC:YYViewController {
|
|
var attribute = AttributedStringbuilder()
|
var type:Int = 0 // 10:拼座 11:独享 12:一口价
|
// var model:YYCarTypeModel?
|
// var model:YYSpecialCarModel?
|
var model:Any?
|
var textView:UITextView! = UITextView()
|
|
private var contentPutOne:CarTypeContent!
|
private var contentNotOne:CarTypeContent!
|
private var contentPutTwo:CarTypeContent!
|
private var contentNotTwo:CarTypeContent!
|
private var contentPutThree:CarTypeContent!
|
private var contentNotThree:CarTypeContent!
|
private var contentExclusive:CarTypeContent!
|
private var contentPrice:CarTypeContent!
|
private var fareTypeNote1:String = ""
|
private var fareTypeNote2:String = ""
|
private var fareTypeNote3:String = ""
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
title = "计价规则"
|
|
view.addSubview(textView)
|
textView.isEditable = false
|
textView.snp.makeConstraints { make in
|
make.edges.equalToSuperview().inset(UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10))
|
}
|
|
let titleFront = UIFont.systemFont(ofSize: 15, weight: .medium)
|
let contentFront = UIFont.systemFont(ofSize: 14)
|
|
guard model != nil else {return}
|
|
if let m = model as? YYCarTypeModel{
|
contentPutOne = m.contentPutOne
|
contentNotOne = m.contentNotOne
|
contentPutTwo = m.contentPutTwo
|
contentNotTwo = m.contentNotTwo
|
contentPutThree = m.contentPutThree
|
contentNotThree = m.contentNotThree
|
contentExclusive = m.contentExclusive
|
contentPrice = m.contentPrice
|
fareTypeNote1 = m.fareTypeNote1
|
fareTypeNote2 = m.fareTypeNote2
|
fareTypeNote3 = m.fareTypeNote3
|
}
|
|
if let m = model as? YYSpecialCarModel{
|
contentPutOne = m.contentPutOne
|
contentNotOne = m.contentNotOne
|
contentPutTwo = m.contentPutTwo
|
contentNotTwo = m.contentNotTwo
|
contentPutThree = m.contentPutThree
|
contentNotThree = m.contentNotThree
|
contentExclusive = m.contentExclusive
|
contentPrice = m.contentPrice
|
fareTypeNote1 = m.fareTypeNote1
|
fareTypeNote2 = m.fareTypeNote2
|
fareTypeNote3 = m.fareTypeNote3
|
}
|
|
|
|
if type == 10{
|
attribute = attribute.add(string: "1人拼成\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: mutableText(contentPutOne), withFont: contentFront, withColor: .black,lineSpace: 4)
|
attribute = attribute.add(string: "\n\n1人未拼成\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: mutableText(contentNotOne), withFont: contentFront, withColor: .black,lineSpace: 4)
|
attribute = attribute.add(string: "\n\n2人拼成\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: mutableText(contentPutTwo), withFont: contentFront, withColor: .black,lineSpace: 4)
|
attribute = attribute.add(string: "\n\n2人未拼成\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: mutableText(contentNotTwo), withFont: contentFront, withColor: .black,lineSpace: 4)
|
attribute = attribute.add(string: "\n\n3人拼成\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: mutableText(contentPutThree), withFont: contentFront, withColor: .black,lineSpace: 4)
|
attribute = attribute.add(string: "\n\n3人未拼成\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: mutableText(contentNotThree), withFont: contentFront, withColor: .black,lineSpace: 4)
|
attribute = attribute.add(string: "\n\n计价说明\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: fareTypeNote1, withFont: contentFront, withColor: .black,lineSpace: 4)
|
}
|
if type == 11{
|
attribute = attribute.add(string: "独享\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: mutableText(contentExclusive), withFont: contentFront, withColor: .black,lineSpace: 4)
|
attribute = attribute.add(string: "\n\n计价说明\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: fareTypeNote2, withFont: contentFront, withColor: .black,lineSpace: 4)
|
}
|
|
if type == 12{
|
attribute = attribute.add(string: "一口价\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: mutableText(contentPrice), withFont: contentFront, withColor: .black,lineSpace: 4)
|
attribute = attribute.add(string: "\n\n计价说明\n", withFont: titleFront, withColor: .black,lineSpace: 10)
|
attribute = attribute.add(string: fareTypeNote3, withFont: contentFront, withColor: .black,lineSpace: 4)
|
}
|
|
textView.attributedText = attribute.mutableAttributedString
|
}
|
|
private func mutableText(_ content:CarTypeContent)->String{
|
var text = String()
|
text = text.appending("起步价:起步价为")
|
text = text.appending("\(content.num1)元,起步包含")
|
text = text.appending("\(content.num2)公里,最多")
|
text = text.appending("\(content.num3)分钟\n里程费:超过起步里程后每公里")
|
text = text.appending("\(content.num4)元\n时长费:超过起步时长后每分钟")
|
text = text.appending("\(content.num5)元\n远途费:总里程超过")
|
text = text.appending("\(content.num6)公里不足")
|
text = text.appending("\(content.num7)公里,超过部分每公里加收")
|
text = text.appending("\(content.num8)元,超过")
|
text = text.appending("\(content.num9)公里不足")
|
text = text.appending("\(content.num10)公里时,超出部分每公里加收")
|
text = text.appending("\(content.num11)元超过")
|
text = text.appending("\(content.num12)公里以后,超出部分每公里加收")
|
text = text.appending("\(content.num13)元\n夜间行驶费:")
|
text = text.appending("\(content.num14)点位夜间行驶时间,起步价变为")
|
text = text.appending("\(content.num15)元,里程费每公里")
|
text = text.appending("\(content.num16)元,时长费每分钟")
|
text = text.appending("\(content.num17)元,远途费每公里加收")
|
text = text.appending("\(content.num18),")
|
text = text.appending("\(content.num19),")
|
text = text.appending("\(content.num20)元\n高峰期费用:")
|
text = text.appending("\(content.num21)和")
|
text = text.appending("\(content.num22)为高峰期行车时间,起步价变成")
|
text = text.appending("\(content.num23)元,里程费为每公里")
|
text = text.appending("\(content.num24)元,时长费为每分钟")
|
text = text.appending("\(content.num25)元,远途费为每公里加收")
|
text = text.appending("\(content.num26),")
|
text = text.appending("\(content.num27),")
|
text = text.appending("\(content.num28)元")
|
return text
|
}
|
|
}
|