提交二维码支付

This commit is contained in:
java110 2020-09-17 00:54:40 +08:00
parent c5ee194c28
commit 3f6f8c871e
4 changed files with 160 additions and 1 deletions

View File

@ -0,0 +1,41 @@
<div id="rentingPayModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">租房服务费</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">支付对象</label>
<div class="col-sm-10">
<input v-model="rentingPayInfo.userRoleName" disabled="disabled" type="text" placeholder="必填,请填写支付对象"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">支付金额</label>
<div class="col-sm-10">
<input v-model="rentingPayInfo.payPrice" type="text" disabled="disabled" placeholder="必填,请填写支付金额" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">二维码</label>
<div class="col-sm-10">
<div id="qrcode" style="width:200px; height:200px; "></div>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="_judgePay()"><i
class="fa fa-check"></i>&nbsp;已支付</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,113 @@
(function (vc) {
vc.extends({
data: {
rentingPayInfo: {
rentingId: '',
userRole: '', // 角色
userRoleName: '',
payPrice: 0.0,
state: ''
}
},
_initMethod: function () {
},
_initEvent: function () {
vc.on('rentingPay', 'openRentingPayModal', function (_param) {
vc.copyObject(_param, $that.rentingPayInfo);
if (_param.hasOwnProperty('userRole') && _param.userRole == 'rent') {
$that.rentingPayInfo.userRoleName = '租客';
} else {
$that.rentingPayInfo.userRoleName = '业主';
}
$that._payOrder();
$('#rentingPayModel').modal('show');
});
},
methods: {
_payOrder: function () {
let _data = {
rentingId: $that.rentingPayInfo.rentingId
};
vc.http.apiPost(
'/payment/rentingToPay',
JSON.stringify(_data),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0 && _json.hasOwnProperty('codeUrl')) {
$that.rentingPayInfo.payPrice = _json.money;
$that._viewQr(_json.codeUrl);
}
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
_judgePay: function () {
//判断是否支付
var param = {
params: {
page: 1,
row: 1,
rentingId: $that.rentingPayInfo.rentingId,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/renting/queryRentingPool',
param,
function (json, res) {
var _rentingPoolManageInfo = JSON.parse(json);
let _rentingPool = _rentingPoolManageInfo.data[0];
if (_rentingPool.state == $that.rentingPayInfo.state) {
vc.toast('未支付完成');
return;
}
$that.clearRentingPayInfo();
$('#rentingPayModel').modal('show');
vc.emit('rentingPoolManage', 'listRentingPool', {});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
clearRentingPayInfo: function () {
vc.component.rentingPayInfo = {
rentingId: '',
userRole: '', // 角色
userRoleName: '',
payPrice: 0.0,
state: ''
};
},
_viewQr: function (_url) {
let qrcode = new QRCode(document.getElementById("qrcode"), {
text: "租房", //你想要填写的文本
width: 200, //生成的二维码的宽度
height: 200, //生成的二维码的高度
colorDark: "#000000", // 生成的二维码的深色部分
colorLight: "#ffffff", //生成二维码的浅色部分
correctLevel: QRCode.CorrectLevel.H
});
qrcode.makeCode(_url);
}
}
});
})(window.vc);

View File

@ -87,7 +87,7 @@
<div class="btn-group" if="rentingPool.state == '3'">
<button class="btn-white btn btn-xs"
v-on:click="_openDeleteRentingPoolModel(rentingPool)">租客支付</button>
v-on:click="_openRentingPayModel(rentingPool,'rent')">租客支付</button>
</div>
<div class="btn-group">
@ -124,5 +124,6 @@
<vc:create path="admin/addRentingPool" callBackListener="" callBackFunction=""></vc:create>
<vc:create path="admin/editRentingPool"></vc:create>
<vc:create path="admin/deleteRentingPool"></vc:create>
<vc:create path="admin/rentingPay"></vc:create>
</div>

View File

@ -78,6 +78,10 @@
} else {
vc.component.rentingPoolManageInfo.moreCondition = true;
}
},
_openRentingPayModel:function(_rentingPool,_userRole){
_rentingPool.userRole = _userRole;
vc.emit('rentingPay', 'openRentingPayModal',_rentingPool);
}