function GateParam(option) {
var _el = option.el
var _priceParam = option.priceParam
var _controlParam = option.controlParam
var _gateDoorArray = option.gateDoorArray
var app = (this.app = new Vue({
el: _el,
template: `
计费配置
?
控制配置
?
名称
{{obj.doorName}}
`,
data: {
info: {
price: 0,
cycle: 0,
in: 0,
out: 0,
freeHour: 0,
maxFee: 0,
inDoor: {},
outDoor: {},
showDoors: false,
gateDoorArray: [],
curChoiceId: '',
},
},
mounted: function () {
var that = this
that.initPackages()
},
methods: {
initPackages: function () {
var that = this
console.log(_gateDoorArray)
if (!_gateDoorArray || _gateDoorArray.length === 0) {
mui.confirm('尚未配置账号,是否需要跳转配置账号?', '温馨提示', ['取消', '确定'], function (e) {
if (e.index === 1) {
that.toSetAccount()
}
})
}
// 初始化参数
this.info.price = _priceParam.price || this.info.price
this.info.cycle = _priceParam.cycle || this.info.cycle
this.info.maxFee = _priceParam.maxFee || this.info.maxFee
this.info.freeHour = _priceParam.freeHour || this.info.freeHour
this.info.inDoor = _controlParam.in || this.info.inDoor
this.info.outDoor = _controlParam.out || this.info.outDoor
this.info.in = this.info.inDoor.doorName || this.info.in
this.info.out = this.info.outDoor.doorName || this.info.out
this.info.gateDoorArray = _gateDoorArray
},
toSetAccount: function () {
var logicalCode = getQueryString('logicalCode') || ''
var code = getQueryString('code') || ''
var typeName = getQueryString('type') || ''
console.log(logicalCode)
console.log(code)
console.log(typeName)
var url = '/app/device-param/accountParam-110602.html'
var option = {
logicalCode: logicalCode,
type: typeName,
code: code,
}
if (url) {
goPage(url, option)
}
},
choiceDoor: function (currentTarget) {
this.info.showDoors = true
this.curChoiceId = currentTarget
},
closeChoice: function (item) {
this.info[this.curChoiceId] = item.doorName
this.info.showDoors = false
this.info[this.curChoiceId + 'Door'] = { doorID: item.doorID, doorName: item.doorName }
}
},
}))
}
// 获取设置的计费参数
GateParam.prototype.getPriceParam = function () {
return {
price: this.app.info.price,
cycle: this.app.info.cycle,
maxFee: this.app.info.maxFee,
freeHour: this.app.info.freeHour,
}
}
GateParam.prototype.getControlParam = function () {
return { in: this.app.info.inDoor, out: this.app.info.outDoor }
}