购买增值服务页面

This commit is contained in:
gxwebsoft
2023-11-30 23:12:19 +08:00
parent 65d70f4039
commit 4fe3719f37
+350 -289
View File
@@ -1,317 +1,378 @@
<template> <template>
<el-card> <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>会员等级</span> <span>购买增值服务</span>
</div> </div>
<div class="grade-list"> <div class="grade-list">
<div class="item" v-for="(item, index) in gradeList" :key="index" :class="index === gradeIndex ? 'active' : ''" @click="onChange(index)"> <div class="item">
<div class="item-box"> <div class="item-box" style="background-color: #f7f7f7">
<div class="title">{{ item.name }}</div> <div class="title">业务编号</div>
<div class="info"> <div class="title">服务项目</div>
<text class="price" v-if="item.price">¥{{ item.price }}</text> <div class="title">计价方式</div>
</div> <div class="title">收费标准</div>
</div> <div class="title">检查单位</div>
<div class="select"> <div class="title">选择服务</div>
<div class="icon"> <div class="title">备注</div>
<i class="el-icon-check"></i> </div>
</div> </div>
</div> <div class="item" v-for="(item, index) in gradeList" :key="index" @click="onChange(index)">
</div> <div class="item-box">
<div class="title">{{ item.code }}</div>
<div class="title">{{ item.name }}</div>
<div class="title">{{ item.type }}</div>
<div class="title">{{ item.price }}</div>
<div class="title">{{ item.company }}</div>
<div class="title"><el-radio v-model="item.select" :label="1" @click.stop="onSelect(index)">{{ item.select === 1 ? '已选' : ''}}</el-radio></div>
<div class="title">{{ item.comments }}</div>
</div>
</div>
</div>
<div class="payment">
<div class="sub-title">支付方式</div>
<div class="content">
<el-radio-group v-model="paymentIndex" class="ml-4">
<el-radio v-for="(item,index) in payment" :key="index" :label="index"
size="large">{{ item }}</el-radio>
</el-radio-group>
</div>
</div>
<div class="pay-price">
<div class="sub-title">支付金额:¥{{ money }}元</div>
</div> </div>
<div class="payment">
<div class="sub-title">支付方式</div>
<div class="content">
<el-radio-group v-model="paymentIndex" class="ml-4">
<el-radio v-for="(item,index) in payment" :key="index" :label="index"
size="large">{{ item }}</el-radio>
</el-radio-group>
</div>
</div>
<div class="pay-price">
<div class="sub-title">支付金额:¥{{ money }}元</div>
</div>
<div class="pay-price"> <div class="pay-price">
<div class="sub-desc">购买即代表同意<text>《用户购买协议》</text></div> <div class="sub-desc">购买即代表同意<text>《用户购买协议》</text></div>
</div> </div>
<div class="pay-price" v-if="billQRCode"> <div class="pay-price" v-if="billQRCode">
<uv-qrcode ref="qrcode" size="240px" :value="billQRCode"></uv-qrcode> <uv-qrcode ref="qrcode" size="240px" :value="billQRCode"></uv-qrcode>
<div class="pay-desc">请打开手机微信,扫一扫完成支付</div> <div class="pay-desc">请打开手机微信,扫一扫完成支付</div>
<el-button type="success" @click="onPayStatus">已完成支付</el-button> <el-button type="success" @click="onPayStatus">已完成支付</el-button>
</div> </div>
<el-button v-else type="danger" @click="onPay">立即支付</el-button> <el-button v-else type="danger" @click="onPay">立即支付</el-button>
</el-card> </el-card>
</template> </template>
<script> <script>
import UQRCode from 'uqrcodejs'; import UQRCode from 'uqrcodejs';
const OpenSdk = require('../lib/base').default; const OpenSdk = require('../lib/base').default;
// const OpenSdk = require('ums-sdk-nodejs').default; // const OpenSdk = require('ums-sdk-nodejs').default;
const sdk = new OpenSdk({ const sdk = new OpenSdk({
appId: '10037e6f6823b20801682b6a5e5a0006', appId: '10037e6f6823b20801682b6a5e5a0006',
appKey: '1c4e3b16066244ae9b236a09e5b312e8' appKey: '1c4e3b16066244ae9b236a09e5b312e8'
}) })
export default { export default {
components: {}, components: {},
data() { data() {
return { return {
paymentIndex: 0, paymentIndex: 0,
payment: ["银联支付"], payment: ["银联支付"],
money: 5000, money: 5000,
showQrcode: false, showQrcode: false,
billQRCode: '', billQRCode: '',
gradeIndex: 0, gradeIndex: 0,
gradeList: [ gradeList: [
{ {
id: 1, id: 1,
name: '黄金vip', code: 'JJX001',
price: 669, name: '供应商实力考查',
comments: '' type: '元/次',
}, price: 150,
{ company: '金久信',
id: 2, select: 1,
name: '铂金vip', comments: '实现视频并记录存档,收集相关纸质文件'
price: 1999, },
comments: '' {
}, id: 2,
{ code: 'JJX002',
id: 3, name: '供应商实力考查',
name: '钻石vip', type: '元/次',
price: 2999, price: 150,
comments: '' company: '金久信',
}, select: 0,
{ comments: '实现视频并记录存档,收集相关纸质文件'
id: 4, },
name: '实力厂家', {
price: 20000, id: 3,
comments: '' code: 'JJX003',
}, name: '供应商实力考查',
{ type: '元/次',
id: 5, price: 150,
name: '实力加工厂', company: '金久信',
price: 1999, select: 0,
comments: '' comments: '实现视频并记录存档,收集相关纸质文件'
}, },
{ {
id: 6, id: 4,
name: '实力采购商', code: 'JJX004',
price: 1999, name: '供应商实力考查',
comments: '' type: '元/次',
price: 150,
company: '金久信',
select: 0,
comments: '实现视频并记录存档,收集相关纸质文件'
},
{
id: 5,
code: 'JJX005',
name: '供应商实力考查',
type: '元/次',
price: 150,
company: '金久信',
select: 1,
comments: '实现视频并记录存档,收集相关纸质文件'
},
{
id: 6,
code: 'JJX006',
name: '供应商实力考查',
type: '元/次',
price: 150,
company: '金久信',
select: 0,
comments: '实现视频并记录存档,收集相关纸质文件'
},
{
id: 7,
code: 'JJX007',
name: '供应商实力考查',
type: '元/次',
price: 150,
company: '金久信',
select: 0,
comments: '实现视频并记录存档,收集相关纸质文件'
},
{
id: 8,
code: 'JJX008',
name: '供应商实力考查',
type: '元/次',
price: 150,
company: '金久信',
select: 0,
comments: '实现视频并记录存档,收集相关纸质文件'
}
]
}
},
created() {},
methods: {
getUserInfo() {
vk.userCenter.getCurrentUserInfo({
success: (data) => {
if (data.userInfo.businessCard) {
this.form1.data = data.userInfo.businessCard
} }
] // 成功后的逻辑
} console.log('用户信息: ', data);
}, }
created() {}, });
methods: {
getUserInfo() {
vk.userCenter.getCurrentUserInfo({
success: (data) => {
if (data.userInfo.businessCard) {
this.form1.data = data.userInfo.businessCard
}
// 成功后的逻辑
console.log('用户信息: ', data);
}
});
}, },
onChange(index) { onChange(index) {
this.gradeIndex = index this.gradeIndex = index
}, },
onPay() { onSelect(index){
const date = new Date() if(this.gradeList[index].select === 1){
const requestTimestamp = this.dateFormat('YYYY-mm-dd HH:MM:SS', date) this.gradeList[index].select = 0
const timestamp = this.dateFormat('YYYYmmddHHMMSS', date) }else{
console.log(timestamp) this.gradeList[index].select = 1
console.log(requestTimestamp) }
let data = { },
queryUrl: 'https://test-api-open.chinaums.com/v1/netpay/bills/get-qrcode', onPay() {
timestamp, const date = new Date()
nonce: 'rp84ufhfn20yneo3tp', const requestTimestamp = this.dateFormat('YYYY-mm-dd HH:MM:SS', date)
content: { const timestamp = this.dateFormat('YYYYmmddHHMMSS', date)
requestTimestamp, console.log(timestamp)
mid: '898201612345678', console.log(requestTimestamp)
tid: '88880001', let data = {
instMid: 'QRPAYDEFAULT', queryUrl: 'https://test-api-open.chinaums.com/v1/netpay/bills/get-qrcode',
totalAmount: 1, timestamp,
notifyUrl: 'https://static-mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5.next.bspapp.com/#/' nonce: 'rp84ufhfn20yneo3tp',
} content: {
} requestTimestamp,
/** mid: '898201612345678',
* 调用函数 tid: '88880001',
*/ instMid: 'QRPAYDEFAULT',
sdk.exec(data).then(res => { totalAmount: 1,
const h = this.$createElement; notifyUrl: 'https://static-mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5.next.bspapp.com/#/'
const result = JSON.parse(res); }
if (result.errCode === 'SUCCESS') { }
this.showQrcode = true /**
this.billQRCode = result.billQRCode * 调用函数
// this.$alert('', '请打开手机微信,扫一扫完成支付', { */
// confirmButtonText: '确定', sdk.exec(data).then(res => {
// callback: action => { const h = this.$createElement;
// this.$message({ const result = JSON.parse(res);
// type: 'success', if (result.errCode === 'SUCCESS') {
// message: `已完成支付` this.showQrcode = true
// }); this.billQRCode = result.billQRCode
// } // this.$alert('', '请打开手机微信,扫一扫完成支付', {
// }); // confirmButtonText: '确定',
} // callback: action => {
}) // this.$message({
}, // type: 'success',
dateFormat(fmt, date) { // message: `已完成支付`
const opt = { // });
"Y+": date.getFullYear().toString(), // 年 // }
"m+": (date.getMonth() + 1).toString(), // 月 // });
"d+": date.getDate().toString(), // 日 }
"H+": date.getHours().toString(), // 时 })
"M+": date.getMinutes().toString(), // 分 },
"S+": date.getSeconds().toString() // 秒 dateFormat(fmt, date) {
// 有其他格式化字符需求可以继续添加,必须转化成字符串 const opt = {
}; "Y+": date.getFullYear().toString(), // 年
let ret "m+": (date.getMonth() + 1).toString(), // 月
for (let k in opt) { "d+": date.getDate().toString(), // 日
ret = new RegExp("(" + k + ")").exec(fmt) "H+": date.getHours().toString(), // 时
if (ret) { "M+": date.getMinutes().toString(), // 分
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) "S+": date.getSeconds().toString() // 秒
}; // 有其他格式化字符需求可以继续添加,必须转化成字符串
}; };
return fmt let ret
} for (let k in opt) {
} ret = new RegExp("(" + k + ")").exec(fmt)
} if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
};
};
return fmt
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.clearfix { .clearfix {
font-weight: bold; font-weight: bold;
font-size: 18px; font-size: 18px;
} }
.grade-list { .grade-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-size: 12px;
.item { .item {
position: relative; position: relative;
border: 1px solid #eee; border: 1px solid #eee;
.item-box { .item-box {
display: flex; display: flex;
font-size: 16px; font-size: 16px;
.title { .title {
padding: 10px; padding: 10px;
border-right: 1px solid #eee; border-right: 1px solid #eee;
display: flex; display: flex;
align-items: center; align-items: center;
flex: 1; flex: 1;
justify-content: center; justify-content: center;
text-align: center; text-align: center;
} }
.info { .info {
padding: 10px; padding: 10px;
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 230px; width: 230px;
.price { .price {
} }
.desc { .desc {
color: #ccc; color: #ccc;
} }
} }
} }
.select { .select {
display: none; display: none;
}
}
.active {
border: 2px solid #bf2b28 !important;
.item-box {
.title {
color: #bf2b28;
}
.info {
.price {
color: #bf2b28;
}
.desc {
color: #ccc;
}
}
}
.select {
position: absolute;
right: 0;
bottom: 0;
border-top: 20px solid transparent;
border-right: 20px solid #bf2b28;
border-left: 20px solid transparent;
border-bottom: 20px solid #bf2b28;
display: flex;
.icon {
position: relative;
.el-icon-check {
position: absolute;
left: 0;
top: 0;
color: #fff;
}
}
}
}
}
.box-card {
margin-top: 20px;
border: none;
}
.sub-title {
color: #bf2b28;
font-size: 18px;
font-weight: bold;
border-left: 5px solid #bf2b28;
padding-left: 10px;
height: 20px;
line-height: 20px;
margin: 20px auto;
}
.sub-desc{
color: #808080;
margin-bottom: 20px;
text{
color: #bf2b28;
} }
} }
.bzj-readme { .active {
margin-top: 20px; border: 2px solid #bf2b28 !important;
}
.payment { .item-box {
margin-top: 20px; .title {
} color: #bf2b28;
}
.pay-price { .info {
margin-top: 20px; .price {
} color: #bf2b28;
}
.pay-desc { .desc {
font-size: 16px; color: #ccc;
line-height: 2em; }
} }
}
.select {
position: absolute;
right: 0;
bottom: 0;
border-top: 20px solid transparent;
border-right: 20px solid #bf2b28;
border-left: 20px solid transparent;
border-bottom: 20px solid #bf2b28;
display: flex;
.icon {
position: relative;
.el-icon-check {
position: absolute;
left: 0;
top: 0;
color: #fff;
}
}
}
}
}
.box-card {
margin-top: 20px;
border: none;
}
.sub-title {
color: #bf2b28;
font-size: 18px;
font-weight: bold;
border-left: 5px solid #bf2b28;
padding-left: 10px;
height: 20px;
line-height: 20px;
margin: 20px auto;
}
.sub-desc{
color: #808080;
margin-bottom: 20px;
text{
color: #bf2b28;
}
}
.bzj-readme {
margin-top: 20px;
}
.payment {
margin-top: 20px;
}
.pay-price {
margin-top: 20px;
}
.pay-desc {
font-size: 16px;
line-height: 2em;
}
</style> </style>