优化代码

This commit is contained in:
java110 2021-10-16 18:28:38 +08:00
parent 2bccf109c5
commit 9884cb388a
3 changed files with 46 additions and 6 deletions

View File

@ -57,5 +57,10 @@
<button class="btn btn-primary" type="button" :disabled="parkingAreaControlFeeInfo.pay==0"
v-on:click="saveTempFeeInfo()">临时车收费</button>
</div>
<!--收费二维码-->
<div class="form-group text-center " style="margin-top: 50px;">
<div id="qrcode" style="width:200px; height:200px;margin:0 auto "></div>
<div class="margin-top">收费二维码</div>
</div>
</div>
</div>

View File

@ -12,11 +12,14 @@
remark: "",
open: "",
openMsg: "",
machineId: ''
machineId: '-1',
showRefresh:'',
paId:''
}
},
_initMethod: function () {
$that.parkingAreaControlFeeInfo.paId = vc.getParam('paId');
$that._loadQrCodeUrl();
},
_initEvent: function () {
vc.on('parkingAreaControlFee', 'notify', function (_data) {
@ -33,13 +36,32 @@
vc.on('parkingAreaControlFee', 'changeMachine', function (_data) {
$that.parkingAreaControlFeeInfo.machineId = _data.machineId;
})
vc.on('parkingAreaControlFee', 'clear', function () {
$that.clearParkingAreaControlFeeInfo();
});
},
methods: {
_loadQrCodeUrl:function(){
//判断是否支付
var param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
paId: $that.parkingAreaControlFeeInfo.paId,
machineId: $that.parkingAreaControlFeeInfo.machineId,
}
};
//发送get请求
vc.http.apiGet('/machine.getCarMachineQrCodeUrl',
param,
function (json, res) {
let _info = JSON.parse(json);
$that._viewQr(_info.data)
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
saveTempFeeInfo: function () {
vc.emit('parkingAreaControlCustomCarInout', 'open', {
type: "1102", //1101 手动入场 1102 手动出场
@ -62,7 +84,19 @@
openMsg: "",
machineId: _machineId
}
}
},
_viewQr: function (_data) {
document.getElementById("qrcode").innerHTML = "";
let qrcode = new QRCode(document.getElementById("qrcode"), {
text: "临时车收费二维码", //你想要填写的文本
width: 200, //生成的二维码的宽度
height: 200, //生成的二维码的高度
colorDark: "#000000", // 生成的二维码的深色部分
colorLight: "#ffffff", //生成二维码的浅色部分
correctLevel: QRCode.CorrectLevel.H
});
qrcode.makeCode(_data.url);
},
}
});
})(window.vc);

View File

@ -116,9 +116,10 @@
outMachineId: _outMachineId
});
vc.emit('parkingAreaControlFee', 'changeMachine', {
machineId: _outMachineId
machineId: _outMachineId,
paId: $that.parkingAreaControlVideoInfo.paId
});
let paId = "";
$that.parkingAreaControlVideoInfo.outMachines.forEach((item) => {
if (item.machineId == _outMachineId) {