|
@@ -87,83 +87,111 @@ class OrderDetailBottomView: BaseView {
|
|
|
var orderModel: OrderModel? {
|
|
|
didSet {
|
|
|
switch orderModel?.status {
|
|
|
- case 0: //待付款
|
|
|
- leftButton.isHidden = false
|
|
|
- leftButton.setTitle("取消订单", for: UIControl.State.normal)
|
|
|
- leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
-
|
|
|
- oneButton.isHidden = false
|
|
|
- oneButton.setTitle("去付款", for: UIControl.State.normal)
|
|
|
- oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
- oneButton.backgroundColor = kFFA42FColor
|
|
|
- case 1,3,4: //待发货/配送中/待自提
|
|
|
- leftButton.isHidden = false
|
|
|
- leftButton.setTitle("申请退款", for: UIControl.State.normal)
|
|
|
- leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
-
|
|
|
- oneButton.isHidden = false
|
|
|
- oneButton.setTitle("再次购买", for: UIControl.State.normal)
|
|
|
- oneButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
- oneButton.backgroundColor = UIColor.white
|
|
|
- oneButton.layer.borderColor = k333333Color.cgColor
|
|
|
- oneButton.layer.borderWidth = 1
|
|
|
- case 2: //待收货
|
|
|
- leftButton.isHidden = false
|
|
|
- leftButton.setTitle("申请退款", for: UIControl.State.normal)
|
|
|
- leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
-
|
|
|
- oneButton.isHidden = false
|
|
|
- oneButton.setTitle("确认收货", for: UIControl.State.normal)
|
|
|
- oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
- oneButton.backgroundColor = kFFA42FColor
|
|
|
-
|
|
|
- twoButton.isHidden = false
|
|
|
- twoButton.setTitle("查看物流", for: UIControl.State.normal)
|
|
|
- twoButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
- twoButton.backgroundColor = UIColor.white
|
|
|
- twoButton.layer.borderColor = k333333Color.cgColor
|
|
|
- twoButton.layer.borderWidth = 1
|
|
|
- case 5: //已自提
|
|
|
- leftButton.isHidden = false
|
|
|
- leftButton.setTitle("申请退款", for: UIControl.State.normal)
|
|
|
- leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
-
|
|
|
- oneButton.isHidden = false
|
|
|
- oneButton.setTitle("确认收货", for: UIControl.State.normal)
|
|
|
- oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
- oneButton.backgroundColor = kFFA42FColor
|
|
|
-
|
|
|
- twoButton.isHidden = false
|
|
|
- twoButton.setTitle("再次购买", for: UIControl.State.normal)
|
|
|
- twoButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
- twoButton.backgroundColor = UIColor.white
|
|
|
- twoButton.layer.borderColor = k333333Color.cgColor
|
|
|
- twoButton.layer.borderWidth = 1
|
|
|
- case 6: //已完成
|
|
|
+ case 0: //待付款
|
|
|
+ leftButton.isHidden = false
|
|
|
+ leftButton.setTitle("取消订单", for: UIControl.State.normal)
|
|
|
+ leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
+
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "去付款", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
|
|
|
- oneButton.isHidden = false
|
|
|
- oneButton.setTitle("去评价", for: UIControl.State.normal)
|
|
|
- oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
- oneButton.backgroundColor = kFFA42FColor
|
|
|
-
|
|
|
- twoButton.isHidden = false
|
|
|
- twoButton.setTitle("再次购买", for: UIControl.State.normal)
|
|
|
- twoButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
- twoButton.backgroundColor = UIColor.white
|
|
|
- twoButton.layer.borderColor = k333333Color.cgColor
|
|
|
- twoButton.layer.borderWidth = 1
|
|
|
- case 7: //已关闭
|
|
|
- oneButton.isHidden = false
|
|
|
- oneButton.setTitle("再次购买", for: UIControl.State.normal)
|
|
|
- oneButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
- oneButton.backgroundColor = UIColor.white
|
|
|
- oneButton.layer.borderColor = k333333Color.cgColor
|
|
|
- oneButton.layer.borderWidth = 1
|
|
|
- default:
|
|
|
- break
|
|
|
+ case 1://待发货
|
|
|
+ if orderModel?.feedbackStatus == 0 {
|
|
|
+ leftButton.isHidden = false
|
|
|
+ leftButton.setTitle("申请退款", for: UIControl.State.normal)
|
|
|
+ leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+
|
|
|
+ }else {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "退款详情", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: twoButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }
|
|
|
+
|
|
|
+ break
|
|
|
+ case 2: //待收货
|
|
|
+
|
|
|
+ if orderModel?.feedbackStatus == 0 {
|
|
|
+ leftButton.isHidden = false
|
|
|
+ leftButton.setTitle("申请退款", for: UIControl.State.normal)
|
|
|
+ leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "确认收货", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: twoButton, title: "查看物流", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }else {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "确认收货", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: twoButton, title: "退款详情", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: threeButton, title: "查看物流", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ case 3: //配送中
|
|
|
+
|
|
|
+ if orderModel?.feedbackStatus == 0 {
|
|
|
+ leftButton.isHidden = false
|
|
|
+ leftButton.setTitle("申请退款", for: UIControl.State.normal)
|
|
|
+ leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "再次购买", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ }else {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "退款详情", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: twoButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }
|
|
|
+ case 4://待自提
|
|
|
+ if orderModel?.feedbackStatus == 0 {
|
|
|
+ leftButton.isHidden = false
|
|
|
+ leftButton.setTitle("申请退款", for: UIControl.State.normal)
|
|
|
+ leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+
|
|
|
+ }else {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "退款详情", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: threeButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }
|
|
|
+ case 5: //已自提
|
|
|
+
|
|
|
+ if orderModel?.feedbackStatus == 0 {
|
|
|
+ leftButton.isHidden = false
|
|
|
+ leftButton.setTitle("申请退款", for: UIControl.State.normal)
|
|
|
+ leftButton.setTitleColor(k333333Color, for: UIControl.State.normal)
|
|
|
+
|
|
|
+ if orderModel?.isComment == 0 {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "去评价", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: twoButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }else {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if orderModel?.isComment == 0 {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "去评价", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: twoButton, title: "退款详情", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: threeButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }else {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "退款详情", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: twoButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ case 6: //已完成
|
|
|
+ if orderModel?.isComment == 0 {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "去评价", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: twoButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ setButton(isHidden: false, button: threeButton, title: "查看物流", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }else {
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "再次购买", titleColor: kffffffColor, backgroundColor: kFFA42FColor, borderColor: kFFA42FColor)
|
|
|
+ setButton(isHidden: false, button: twoButton, title: "查看物流", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: kbfbfbfColor)
|
|
|
+ }
|
|
|
+ case 7: //已关闭
|
|
|
+ setButton(isHidden: false, button: oneButton, title: "再次购买", titleColor: k333333Color, backgroundColor: UIColor.white, borderColor: k333333Color)
|
|
|
+ default:
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ func setButton(isHidden:Bool,button:UIButton,title:String,titleColor:UIColor,backgroundColor:UIColor,borderColor:UIColor) {
|
|
|
+ button.isHidden = isHidden
|
|
|
+ button.setTitle(title, for: UIControl.State.normal)
|
|
|
+ button.setTitleColor(titleColor, for: UIControl.State.normal)
|
|
|
+ button.backgroundColor = backgroundColor
|
|
|
+ button.layer.borderColor = borderColor.cgColor
|
|
|
+ button.layer.borderWidth = 1
|
|
|
+ }
|
|
|
|
|
|
}
|