Commit 7287623f authored by liangliang.wang01's avatar liangliang.wang01 🤸🏽

增加创建二维码功能

parent fbf02a98
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</template> </template>
<script> <script>
import QRCode from 'qrcode' import QRCode from 'qrcodejs2'
export default { export default {
data () { data () {
return { return {
...@@ -83,11 +83,11 @@ export default { ...@@ -83,11 +83,11 @@ export default {
}, },
created () { created () {
// 当数据拿到之后给checked初始值; // 当数据拿到之后给checked初始值;
var name = this.$route.query.contractno var name = this.$route.query.contractno;
console.log('传值', name) console.log('传值', name);
// this.contractno = "L20RJ00313"; this.contractno = "L20RJ00313";
this.contractno = "R21WS00007" // this.contractno = name;
this.getData() this.getData();
}, },
beforeMount () { beforeMount () {
}, },
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
var dataInfo = JSON.parse(res.result.json) var dataInfo = JSON.parse(res.result.json)
// console.log('请求成功', dataInfo.lists) // console.log('请求成功', dataInfo.lists)
vm.ListNum = dataInfo.lists.length vm.ListNum = dataInfo.lists.length
// 给checked初始值 // 给checked和unchecked初始值
for (let i = 0; i < vm.ListNum; i++) { for (let i = 0; i < vm.ListNum; i++) {
// console.log('给checked初始值'); // console.log('给checked初始值');
vm.checked[i] = false vm.checked[i] = false
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
}) })
// console.log(vm.Lists); // console.log(vm.Lists);
}, },
//点击支付
pay () { pay () {
let vm = this let vm = this
let $input = document.getElementById('payamount') let $input = document.getElementById('payamount')
...@@ -165,13 +165,22 @@ export default { ...@@ -165,13 +165,22 @@ export default {
'recamt_id': this.recamt_id, 'recamt_id': this.recamt_id,
} }
console.log('params', params); console.log('params', params);
var qrcode = new QRCode(document.getElementById("qrcode"), dataInfo);
vm.$post(url, params).then(function (res) { vm.$post(url, params).then(function (res) {
console.log(res); console.log(res);
document.getElementById("qrcode").innerHTML = "";
if (res.respCode == 'SUCCESS') { if (res.respCode == 'SUCCESS') {
let dataInfo = res.qrCode; let dataInfo = res.qrCode;
qrcode.clear(); let qrcode = new QRCode("qrcode",
qrcode.makeCode(dataInfo); {
text: dataInfo,
width: 128,
height: 128,
colorDark : '#000000',
colorLight : '#ffffff',
correctLevel: QRCode.CorrectLevel.H // 容错等级
}
);
console.log(qrcode);
} else { } else {
vm.hlsPopup.showLongCenter(res.respMsg) vm.hlsPopup.showLongCenter(res.respMsg)
} }
...@@ -181,10 +190,11 @@ export default { ...@@ -181,10 +190,11 @@ export default {
}, },
close () { close () {
// 点击关闭二维码页面 // 点击关闭二维码页面;
this.bottomType = 0 this.bottomType = 0
this.getData();
}, },
//选择账单后把总计金额显示在底部
onClickHander (index) { onClickHander (index) {
if (this.Lists[index].select_flag == 'N') { if (this.Lists[index].select_flag == 'N') {
return return
...@@ -196,12 +206,11 @@ export default { ...@@ -196,12 +206,11 @@ export default {
} else if (this.checked[index] == true) { } else if (this.checked[index] == true) {
num -= this.Lists[index].recdueamt_total num -= this.Lists[index].recdueamt_total
} }
// 保留两位 this.total = num;
this.total = num document.getElementById('payamount').value = num;
document.getElementById('payamount').value = num console.log(index);
console.log(index)
}, },
//根据getData时 生成的 unchecked:[] 给checkbox添加样式,true为不可选
addClass () { addClass () {
// console.log("add"); // console.log("add");
for (var i = 0; i < this.ListNum; i++) { for (var i = 0; i < this.ListNum; i++) {
...@@ -366,9 +375,9 @@ input[type="checkbox"] { ...@@ -366,9 +375,9 @@ input[type="checkbox"] {
border-top-right-radius: 18px; border-top-right-radius: 18px;
p { p {
font-weight: 700; font-weight: 700;
margin-top: 10px; margin-top: 15px;
padding-right: 30px; padding-right: 20px;
font-size: 14px; font-size: 16px;
text-align: center; text-align: center;
} }
.close { .close {
...@@ -395,18 +404,14 @@ input[type="checkbox"] { ...@@ -395,18 +404,14 @@ input[type="checkbox"] {
} }
} }
#qrcode{ #qrcode{
width:160px; position: absolute;
height:160px; width: 128px;
margin-top:15px; height: 128px;
} top: 30%;
// img { left: 50%;
// position: absolute; transform: translateX(-50%);
// width: 40%; // background-color:#72a03c ;
// height: 55%; }
// top: 20%;
// left: 50%;
// transform: translateX(-50%);
// }
// .load{ // .load{
// // ../../../assets\image // // ../../../assets\image
// background-image: url(../../../assets\image); // background-image: url(../../../assets\image);
...@@ -423,7 +428,6 @@ input[type="checkbox"] { ...@@ -423,7 +428,6 @@ input[type="checkbox"] {
} }
.payPagebox { .payPagebox {
position: absolute; position: absolute;
z-index: 9;
width: 80%; width: 80%;
height: 40%; height: 40%;
top: 25%; top: 25%;
......
...@@ -6591,6 +6591,11 @@ qr.js@0.0.0: ...@@ -6591,6 +6591,11 @@ qr.js@0.0.0:
resolved "https://registry.yarnpkg.com/qr.js/-/qr.js-0.0.0.tgz#cace86386f59a0db8050fa90d9b6b0e88a1e364f" resolved "https://registry.yarnpkg.com/qr.js/-/qr.js-0.0.0.tgz#cace86386f59a0db8050fa90d9b6b0e88a1e364f"
integrity sha1-ys6GOG9ZoNuAUPqQ2baw6IoeNk8= integrity sha1-ys6GOG9ZoNuAUPqQ2baw6IoeNk8=
qrcodejs2@^0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/qrcodejs2/-/qrcodejs2-0.0.2.tgz#465afe5e39f19facecb932c11f7a186109146ae1"
integrity sha1-Rlr+Xjnxn6zsuTLBH3oYYQkUauE=
qs@6.7.0: qs@6.7.0:
version "6.7.0" version "6.7.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
......
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