Commit 29f9ccc3 authored by 刘俊宏's avatar 刘俊宏

对接新增商品ing

parent e4cda593
......@@ -325,6 +325,7 @@
F933F6CF2452C68B00189561 /* PKHUDErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6BE2452C68B00189561 /* PKHUDErrorView.swift */; };
F933F6D22452DAE100189561 /* TabBarContentClassView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6D12452DAE000189561 /* TabBarContentClassView.swift */; };
F93E31F724721C4200524DFC /* EditOGPAdModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93E31F624721C4200524DFC /* EditOGPAdModel.swift */; };
F93E31FD24727A2D00524DFC /* ShowTimeSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93E31FC24727A2D00524DFC /* ShowTimeSelectView.swift */; };
F94A314724624E9500FEC38E /* GetGelipayInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F94A314624624E9500FEC38E /* GetGelipayInfoModel.swift */; };
F94A314924624FA400FEC38E /* ShopAdministratorInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F94A314824624FA400FEC38E /* ShopAdministratorInfoModel.swift */; };
F94A314B246250DB00FEC38E /* GoodsDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F94A314A246250DB00FEC38E /* GoodsDetailModel.swift */; };
......@@ -812,6 +813,7 @@
F933F6BF2452C68B00189561 /* PKHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKHUD.h; sourceTree = "<group>"; };
F933F6D12452DAE000189561 /* TabBarContentClassView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBarContentClassView.swift; sourceTree = "<group>"; };
F93E31F624721C4200524DFC /* EditOGPAdModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditOGPAdModel.swift; sourceTree = "<group>"; };
F93E31FC24727A2D00524DFC /* ShowTimeSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowTimeSelectView.swift; sourceTree = "<group>"; };
F94A314624624E9500FEC38E /* GetGelipayInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetGelipayInfoModel.swift; sourceTree = "<group>"; };
F94A314824624FA400FEC38E /* ShopAdministratorInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopAdministratorInfoModel.swift; sourceTree = "<group>"; };
F94A314A246250DB00FEC38E /* GoodsDetailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoodsDetailModel.swift; sourceTree = "<group>"; };
......@@ -1972,6 +1974,7 @@
F950FDE92451920200C40530 /* DIYCalendarCell.swift */,
F9956B1B2463D941001A617D /* WorkSelectTimeView.xib */,
F9956B1D2463D94E001A617D /* WorkSelectTimeView.swift */,
F93E31FC24727A2D00524DFC /* ShowTimeSelectView.swift */,
);
path = TimeSelectView;
sourceTree = "<group>";
......@@ -2684,6 +2687,7 @@
F950FDA92451613500C40530 /* GetMobileModel.swift in Sources */,
F94A314724624E9500FEC38E /* GetGelipayInfoModel.swift in Sources */,
E0B5307E247266F400FFCC15 /* DKXDAdrCell.swift in Sources */,
F93E31FD24727A2D00524DFC /* ShowTimeSelectView.swift in Sources */,
E0B94623245671E100FBEC9A /* DaiKeXiaDanGouWuViewController.swift in Sources */,
E0A320C52456D01300AF321C /* DaiKeXiaDanFooterView.swift in Sources */,
E0336DD5244EC40000380BE9 /* CreatNewSpecsViewController.swift in Sources */,
......
......@@ -124,7 +124,7 @@ func isPurnInt(string: String) -> Bool {
return scan.scanInt(&val) && scan.isAtEnd
}
//MARK:--是否是正确的数值
func isPurnNumber(str:String)-> Bool{
if isPurnInt(string: str) || isPurnFloat(string: str){
return true
......
......@@ -36,6 +36,7 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
var tempNum:Int?
var tempArr:Array<Int>? = []
var selectLblText:String? = ""
var isShangPinType:Bool = false
var kuWeiArr = Array<Any>(){
didSet{
var tbvH = CGFloat(kuWeiArr.count * 49)
......
//
// ShowTimeSelectView.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/5/18.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
protocol ShowTimeSelectViewDelegate {
func showTimeSelectByData(timeStr:String,beginDate: Date, endginDate: Date)
}
class ShowTimeSelectView: UIView ,TimeSelectViewDelgate{
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = UIColor.clear
blackView.backgroundColor = UIColor.init(named: "提示视图背景色")
blackView.addTarget(self, action: #selector(hideAction(sender:)), for: .touchUpInside)
self.addSubview(blackView)
blackView.snp.makeConstraints { (make) in
make.left.top.bottom.right.equalToSuperview()
}
self.addSubview(contetV)
self.addSubview(sureBtn)
contetV.backgroundColor = UIColor.white
contetV.layer.cornerRadius = 5
contetV.snp.makeConstraints { (make) in
make.left.right.equalToSuperview()
make.bottom.equalTo(sureBtn.snp_top).offset(3*glscale)
make.height.equalTo(340*glscale)
}
sureBtn.snp.makeConstraints { (make) in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(TabHeight)
}
sureBtn.setTitle("确定", for: .normal)
sureBtn.addTarget(self, action: #selector(sureAction(sender:)), for: .touchUpInside)
sureBtn.backgroundColor = UIColor.init(named: "蓝色字体颜色")
sureBtn.setTitleColor(UIColor.white, for: .normal)
sureBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 17)
titleLbl.text = "选择时间段"
titleLbl.textColor = UIColor.init(named: "标题字颜色")
titleLbl.font = UIFont.boldSystemFont(ofSize: 15)
contetV.addSubview(titleLbl)
titleLbl.snp.makeConstraints { (make) in
make.top.equalTo(15*glscale)
make.centerX.equalToSuperview()
}
let lineV = UIView()
lineV.backgroundColor = UIColor.init(named: "灰色分界线")
contetV.addSubview(lineV)
lineV.snp.makeConstraints { (make) in
make.left.right.equalToSuperview()
make.top.equalTo(titleLbl.snp_bottom).offset(15*glscale)
make.height.equalTo(1)
}
let kuangV = UIView()
kuangV.layer.borderColor = UIColor.init(named: "灰色字体颜色")?.cgColor
kuangV.layer.borderWidth = 1
kuangV.layer.cornerRadius = 3
contetV.addSubview(kuangV)
kuangV.snp.makeConstraints { (make) in
make.height.equalTo(32*glscale)
make.width.equalTo(180*glscale)
make.left.equalTo(15*glscale)
make.top.equalTo(lineV.snp_bottom).offset(15*glscale)
}
clearBtn.setImage(UIImage.init(named: "workTimeDel"), for: .normal)
clearBtn.addTarget(self, action: #selector(clearBtnAction(sender:)), for: .touchUpInside)
contetV.addSubview(clearBtn)
clearBtn.snp.makeConstraints { (make) in
make.right.equalTo(kuangV.snp_right).offset(-7*glscale)
make.centerY.equalTo(kuangV)
}
timeLbl.text = "-"
timeLbl.font = UIFont.systemFont(ofSize: 13)
timeLbl.textColor = UIColor.init(named: "标题字颜色")
contetV.addSubview(timeLbl)
timeLbl.snp.makeConstraints { (make) in
make.centerY.equalTo(kuangV)
make.left.equalTo(kuangV.snp_left).offset(10*glscale)
}
calendarV.moreSelection = true
contetV.addSubview(calendarV)
calendarV.delegate = self
}
let blackView = UIButton(type: .custom)
let sureBtn = UIButton(type: .custom)
let contetV = UIView()
let titleLbl = UILabel()
let timeLbl = UILabel()
let clearBtn = UIButton(type: .custom)
let calendarV = TimeSelectView(frame: CGRect(x: 0, y: 105*glscale, width: fullScreenWidth, height: 235*glscale))
var delegate : ShowTimeSelectViewDelegate?
var BeginDate: Date! = nil
var EndDate: Date! = nil
func selectMoreDate(beginDate: Date, endginDate: Date) {
print("选择日期·····")
let timeInterval:TimeInterval = beginDate.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = endginDate.timeIntervalSince1970
timeLbl.text = dayByDouble(sender: timeInterval) + "-" + dayByDouble(sender: timeIntervalEnd)
EndDate = endginDate
BeginDate = beginDate
}
@objc func sureAction(sender:UIButton) {
print("确定日期·····")
if EndDate == nil {
HUD.flash(.label("请选择时间段"), delay: 1.2)
return
}
self.delegate?.showTimeSelectByData(timeStr: timeLbl.text!, beginDate: BeginDate, endginDate: EndDate)
self.removeFromSuperview()
}
@objc func clearBtnAction(sender:UIButton){
print("清除日期·····")
EndDate = nil
BeginDate = nil
timeLbl.text = "-"
calendarV.clearTheSelect()
}
@objc func hideAction(sender:UIButton){
self.removeFromSuperview()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}
......@@ -355,6 +355,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
item = jieTiArr[indexPath.row] as! NSString
}
if item != "" {
//MARK:--阶梯价格切割
let arr = item.components(separatedBy: "_")
cell.priceTF.text = arr[0]
cell.countTF.text = arr[1]
......
......@@ -8,7 +8,7 @@
import UIKit
import Dollar
class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource {
class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource, CBPeripheralDelegate {
......@@ -64,6 +64,13 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
self.selectDataArray.insert(peripheral!, at: 0)
self.tableView.reloadData()
HUD.flash(.labeledSubSuccess(subtitle: "连接成功"),delay: 1.5)
//停在扫描?
self.baby?.cancelScan()
peripheral?.delegate = self
//[peripheral discoverServices:@[[CBUUID UUIDWithString:SERVICE_UUID]]];
//外设发现服务,传nil代表不过滤,一次性读出外设的所有服务
peripheral?.discoverServices(nil)
})
baby?.setBlockOnFailToConnect({ (central, peripheral, error) in
......@@ -80,6 +87,57 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
})
//获取外围设备服务和特征1
// baby?.discoverServices()//发现Services
// baby?.setBlockOnDiscoverServices({ (peripheral, error) in
// //遍历服务
// peripheral?.services?.forEach({ (service) in
// print("遍历发现的服务\(service)")
// peripheral?.discoverCharacteristics(nil, for: service)
// })
// })
}
//MARK:--发现外围设备服务1
func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
//遍历服务
print("-发现外围设备服务1")
peripheral.services?.forEach({ (service) in
print("遍历发现的服务\(service)")
peripheral.discoverCharacteristics(nil, for: service) //服务注册
})
}
//MARK:--发现外围设备特征2
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
print("-发现外围设备特征2")
if error == nil {
service.characteristics?.forEach({ (characteristic) in
print("遍历特征\(characteristic.uuid)") //要跟UUID
peripheral.setNotifyValue(true, for: characteristic)//特征注册
})
}
}
//MARK:--外设返回数据(回调)
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
let data = characteristic.value
let resultByte = data?.bytes
print("外设回调数据----\(data)==\(resultByte)")
if data!.count >= 1 {
if resultByte![0] == 16 {
print("---打印机打开--")
}else if resultByte![0] == 1 {
print("---打印机缺纸--")
}
}
}
func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: Error?) {
print("写入数据的回调么")
}
......@@ -87,8 +145,16 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
@IBAction func searchAction(_ sender: Any) {
print("搜索")
baby?.scanForPeripherals()
baby?.begin()
//临时处理给外设写入数据
let byte = [0x1B,0x68]
let data = Data.init(bytes: byte, count: 3)
let currPeripheral:CBPeripheral = self.selectDataArray[0]
//写入数据
// currPeripheral.writeValue(data, for: <#T##CBCharacteristic#>, type: CBCharacteristicWriteType)
// baby?.scanForPeripherals()
// baby?.begin()
}
//MARK: -Cell delegate
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment