支付组件

This commit is contained in:
aixianling
2023-09-26 17:56:17 +08:00
parent 6f3c2a05cc
commit 0a33fe480f
12 changed files with 338 additions and 8060 deletions

View File

@@ -3,10 +3,8 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"build-watch": "vue-cli-service --env.NODE_ENV=development build-watch --mode development"
"dev": "vue-cli-service --env.NODE_ENV=development build-watch --mode development",
"build": "vue-cli-service build"
},
"dependencies": {
"@antv/g2plot": "^2.4.31",
@@ -17,6 +15,7 @@
"element-ui": "^2.15.13",
"vue": "^2.6.14",
"vue-json-excel": "^0.3.0",
"vue-qr": "^4.0.9",
"vue-router": "^3.2.0",
"vuex": "^3.4.0",
"vuex-persistedstate": "^4.1.0"
@@ -30,8 +29,8 @@
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"javascript-obfuscator": "2.6.0",
"sass": "^1.62.1",
"sass-loader": "7.2.0",
"sass": "^1.68.0",
"sass-loader": "^7.3.1",
"vue-cli-plugin-chrome-extension-cli": "~1.1.4",
"vue-template-compiler": "^2.6.14",
"webpack-obfuscator": "2.6.0"

View File

@@ -1,4 +1,4 @@
@import "./styles.scss";
@font-face {
font-family: 'iconfont'; /* project id 1995974 */
src: url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.eot');
@@ -8,8 +8,9 @@
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.ttf') format('truetype'),
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.svg#iconfont') format('svg');
}
.iconfont{
font-family: "iconfont"!important;
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
@@ -33,7 +34,7 @@ h1 {
hr {
-webkit-box-sizing: content-box;
box-sizing: content-box; /* 1 */
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
@@ -51,7 +52,7 @@ abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted; /* 2 */
text-decoration: underline dotted; /* 2 */
}
b,
@@ -146,7 +147,7 @@ fieldset {
legend {
-webkit-box-sizing: border-box;
box-sizing: border-box; /* 1 */
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
@@ -165,9 +166,10 @@ textarea {
[type="checkbox"],
[type="radio"] {
-webkit-box-sizing: border-box;
box-sizing: border-box; /* 1 */
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
@@ -265,7 +267,7 @@ img {
display: flex;
}
.flex-align {
.flex-align, .flex-center {
display: flex;
align-items: center;
}
@@ -295,6 +297,7 @@ img {
.fade-enter-active, .fade-leave-active {
transition: opacity .3s ease-in-out;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
@@ -329,15 +332,16 @@ img {
}
.el-button--primary:focus {
background: #1FBAD6!important;
border-color: #1FBAD6!important;
background: #1FBAD6 !important;
border-color: #1FBAD6 !important;
}
.link-hover {
cursor: pointer;
transition: all ease .5s;
&:hover {
color: #1FBAD6!important;
color: #1FBAD6 !important;
}
}
@@ -384,8 +388,8 @@ img {
}
.text-disabled {
color: #bbb!important;
cursor: not-allowed!important;
color: #bbb !important;
cursor: not-allowed !important;
}
.btn-disabled {
@@ -404,25 +408,25 @@ img {
&:hover {
opacity: 0.3;
color: #1FBAD6!important;
background: #fff!important;
color: #1FBAD6 !important;
background: #fff !important;
}
}
.el-button--primary {
color: #fff!important;
color: #fff !important;
border-color: #1FBAD6;
background-color: #1FBAD6;
}
.el-button--danger:focus, .el-button.el-button--danger.is-link:not(.is-disabled):hover{
color: #fff!important;
.el-button--danger:focus, .el-button.el-button--danger.is-link:not(.is-disabled):hover {
color: #fff !important;
border-color: #FA5555;
background-color: #FA5555;
}
.el-input-group__append .el-button {
background-color: #1FBAD6!important;
background-color: #1FBAD6 !important;
}
.admin-main {
@@ -438,11 +442,11 @@ img {
}
.el-menu--inline .el-menu-item {
padding-left: 55px!important;
padding-left: 55px !important;
}
.el-menu {
border: none!important;
border: none !important;
}
.el-menu .el-menu-item i {
@@ -468,4 +472,4 @@ img {
input {
width: 240px;
}
}
}

View File

@@ -0,0 +1,29 @@
@each $c in (333, 666, 999, red) {
@each $t, $v in (c:color, bg:background) {
.#{$t}-#{$c} {
#{$v}: #{'#'+$c};
}
}
}
@for $i from 1 through 30 {
@each $p, $pv in (margin:m, padding:p) {
.#{$pv}-#{$i} {
#{$p}: #{$i}px;
}
.#{$pv}v-#{$i} {
#{$p}-top: #{$i}px;
#{$p}-bottom: #{$i}px;
}
.#{$pv}h-#{$i} {
#{$p}-left: #{$i}px;
#{$p}-right: #{$i}px;
}
@each $pos, $v in (left:l, right:r, top:t, bottom:b) {
.#{$pv+$v}-#{$i} {
#{$p}-#{$pos}: #{$i}px;
}
}
}
}

BIN
src/assets/wechat_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -1,333 +0,0 @@
<template>
<div class="ai-article">
<div v-html="value"></div>
</div>
</template>
<script>
export default {
name: 'AiArticle',
props: {
value: {
type: String
}
}
}
</script>
<style lang="scss" scoped>
.ai-article {
width: 100%;
line-height: 1.75;
font-weight: 400;
color: #333;
font-size: 14px;
text-align: justify;
overflow-x: auto;
word-break: break-word;
:deep( h1 ){
margin: 1.3rem 0;
line-height: 1.2
}
:deep( p ){
line-height: 2.27rem
}
:deep( hr ){
border: none;
border-top: 1px solid #ddd;
margin-top: 2.7rem;
margin-bottom: 2.7rem
}
:deep( img:not(.equation)), :deep( iframe), :deep( embed), :deep( video ){
display: block;
margin: 18px auto;
max-width: 100% !important;
}
:deep( img.equation ){
margin: 0 .1em;
max-width: 100% !important;
vertical-align: middle
}
:deep( figure ){
margin: 2.7rem auto;
text-align: center
}
:deep( img:not(.equation) ){
cursor: zoom-in
}
:deep( figure figcaption ){
text-align: center;
font-size: 1rem;
line-height: 2.7rem;
color: #909090
}
:deep( pre ){
line-height: 1.93rem;
overflow: auto
}
:deep( code),
:deep( pre ){
font-family: Menlo, Monaco, Consolas, Courier New, monospace
}
:deep( code ){
font-size: 1rem;
padding: .26rem .53em;
word-break: break-word;
color: #4e5980;
background-color: #f8f8f8;
border-radius: 2px;
overflow-x: auto
}
:deep( pre>code ){
font-size: 1rem;
padding: .67rem 1.3rem;
margin: 0;
word-break: normal;
display: block
}
:deep( a ){
color: #259
}
:deep( a:active),
:deep( a:hover ){
color: #275b8c
}
:deep( table ){
width: 100%;
margin-top: 18px;
margin-bottom: 18px;
overflow: auto;
font-size: 1rem;
text-align: center;
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
}
:deep( thead ){
background: #f6f6f6;
color: #000;
text-align: left
}
:deep( td),
:deep( th ){
padding: 3px 5px;
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc;
}
:deep( td ){
min-width: 10rem
}
:deep( blockquote ){
margin: 1em 0;
border-left: 4px solid #ddd;
padding: 0 1.3rem
}
:deep( blockquote>p ){
margin: .6rem 0
}
:deep( ol),
:deep( ul ){
padding-left: 2.7rem
}
:deep( ol li),
:deep( ul li ){
margin-bottom: .6rem
}
:deep( ol ol),
:deep( ol ul),
:deep( ul ol),
:deep( ul ul ){
margin-top: .27rem
}
:deep( pre>code ){
overflow-x: auto;
-webkit-overflow-scrolling: touch;
color: #333;
background: #f8f8f8
}
:deep( p ){
line-height: inherit;
margin-top: 18px;
margin-bottom: 18px
}
:deep( p:first-child){
margin-top: 0!important;
}
:deep( img ){
max-height: none
}
:deep( a ){
color: #0269c8;
border-bottom: 1px solid #d1e9ff
}
:deep( code ){
background-color: #fff5f5;
color: #ff502c;
font-size: .87em;
padding: .065em .4em
}
:deep( blockquote ){
color: #666;
padding: 1px 23px;
margin: 18px 0;
border-left: 4px solid #cbcbcb;
background-color: #f8f8f8
}
:deep( blockquote:after ){
display: block;
content: ""
}
:deep( blockquote>p ){
margin: 10px 0
}
:deep( blockquote.warning ){
position: relative;
border-left-color: #f75151;
margin-left: 8px
}
:deep( blockquote.warning:before ){
position: absolute;
top: 14px;
left: -12px;
background: #f75151;
border-radius: 50%;
content: "!";
width: 20px;
height: 20px;
color: #fff;
display: flex;
align-items: center;
justify-content: center
}
:deep( ol),
:deep( ul ){
padding-left: 28px
}
:deep( ol li),
:deep( ul li ){
margin-bottom: 0;
list-style: inherit
}
:deep( ol li.task-list-item),
:deep( ul li.task-list-item ){
list-style: none
}
:deep( ol li.task-list-item ol),
:deep( ol li.task-list-item ul),
:deep( ul li.task-list-item ol),
:deep( ul li.task-list-item ul ){
margin-top: 0
}
:deep( ol li ){
padding-left: 6px
}
:deep( pre ){
position: relative;
line-height: 1.75
}
:deep( pre>code ){
padding: 15px 12px
}
:deep( pre>code.hljs[lang] ){
padding: 18px 15px 12px
}
:deep( h1),
:deep( h2),
:deep( h3),
:deep( h4),
:deep( h5),
:deep( h6 ){
color: #333;
line-height: 1.5;
margin-top: 35px;
margin-bottom: 10px;
padding-bottom: 5px;
font-weight: 500;
}
:deep( h1 ){
font-size: 30px;
margin-bottom: 5px
}
:deep( h2 ){
padding-bottom: 12px;
font-size: 24px;
border-bottom: 1px solid #ececec
}
:deep( h3 ){
font-size: 18px;
padding-bottom: 0
}
:deep( h4 ){
font-size: 16px
}
:deep( h5 ){
font-size: 15px
}
:deep( h6 ){
margin-top: 5px
}
:deep( h1.heading+h2.heading ){
margin-top: 20px
}
:deep( h1.heading+h3.heading ){
margin-top: 15px
}
:deep( .heading+.heading ){
margin-top: 0
}
:deep( h1+:not(.heading) ){
margin-top: 25px
}
}
</style>

View File

@@ -0,0 +1,180 @@
<template>
<section class="AiPayment">
<el-tabs type="card" stretch v-model="search.module" @tab-click="getPayments">
<el-tab-pane label="基础会员" name="0"/>
<el-tab-pane label="金币充值" name="1"/>
</el-tabs>
<div class="content">
<div class="payments mb-16">
<div class="card" v-for="pay in payments" :key="pay.id" :class="{active:pay.id==selected}"
@click="getQrcode(pay.id)">
<div v-text="pay.title"/>
<div class="c-red mt-16" v-text="`¥${pay.price}`"/>
</div>
</div>
<el-row type="flex" align="middle">
<ul class="fill">
<li v-for="(desc,i) in descriptions" :key="i" v-text="desc"/>
</ul>
<div class="fill flex-center">
<vue-qr v-if="qrcode" :text="qrcode" :size="120" :margin="8" :logoSrc="wechatLogo"/>
<div v-else class="qrcode c-666">请选择<br>支付方案</div>
<div class="c-999 ml-16">
<div class="flex-center mb-16">
应付金额{{ amount }}
</div>
<div class="wechat flex-center">
微信扫码支付
</div>
</div>
</div>
</el-row>
<div class="bottom flex-center">
<el-button size="small">取消支付</el-button>
<el-button size="small">已扫码支付</el-button>
</div>
</div>
</section>
</template>
<script>
import VueQr from "vue-qr"
export default {
name: "AiPayment",
components: {VueQr},
props: {},
data() {
return {
search: {module: "0"},
show: true,
descriptions: ["抢仓发货", "数据下载", "复制商品", "会员服务"],
payments: [],
qrcode: "",
amount: 0,
selected: ""
}
},
computed: {
wechatLogo: v => require("../assets/wechat_logo.png")
},
methods: {
getPayments() {
this.$http.post("/api/priceConfig/page", null, {
params: {...this.search}
}).then(res => {
if (res?.data) {
this.payments = res.data.records || []
}
})
},
getQrcode(priceConfigId) {
this.selected = priceConfigId
this.$http.post("/api/order/createOrder", null, {
params: {priceConfigId}
}).then(res => {
if (res?.data?.id) {
return res.data.id
}
}).then(id => this.$http.post("/api/order/createPrepayOrder", null, {
params: {id}
})).then(res => {
if (res?.data) {
this.qrcode = res.data.codeUrl
}
})
}
},
created() {
this.getPayments()
}
}
</script>
<style scoped lang="scss">
.AiPayment {
font-size: 16px;
:deep(.el-tabs) {
z-index: 4;
.is-active {
border-bottom-color: transparent;
}
}
ul {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 16px;
li {
list-style-type: circle;
}
}
.payments {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-gap: 32px;
.card {
user-select: none;
text-align: center;
border: 1px solid #ddd;
padding: 32px 64px;
border-radius: 4px;
&.active {
border-color: #26f;
position: relative;
&:after {
position: absolute;
right: 8px;
bottom: 8px;
display: block;
text-align: center;
line-height: 20px;
width: 20px;
height: 20px;
font-size: 16px;
content: "✔";
color: white;
background: #26f;
border-radius: 50%;
}
}
}
}
.content {
padding: 16px 32px;
margin-top: -16px;
border: 1px solid #ddd;
z-index: 9;
.qrcode {
width: 120px;
height: 120px;
background-color: #eee;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
}
.wechat {
line-height: 20px;
padding-left: 28px;
background-image: url("../assets/wechat_logo.png");
background-repeat: no-repeat;
background-position: left center;
background-size: 20px 20px;
}
.bottom {
justify-content: right;
}
}
</style>

View File

@@ -7,79 +7,78 @@ import router from '@/router'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
token: '',
mallId: '',
mallName: '',
mallList: [],
activeDlgShow: false,
userInfo: {}
},
mutations: {
setToken (state, token) {
state.token = token
},
setMallId (state, mallId) {
state.mallId = mallId
},
setMallName (state, mallName) {
state.mallName = mallName
},
setMallList (state, mallList) {
state.mallList = mallList
},
logout (state) {
state.token = ''
state.userInfo = {}
state.mallList = []
state.mallName = ''
state.mallId = ''
setTimeout(() => {
router.push('/login')
}, 200)
},
setUserInfo (state, userInfo) {
state.userInfo = userInfo
},
setActiveDlgShow (state, flag) {
state.activeDlgShow = flag
}
},
actions: {
getUserInfo (store) {
return new Promise(resolve => {
request.post('/api/malluser/info').then(res => {
if (res.code === 0) {
store.commit('setUserInfo', res.data)
resolve(res.data)
}
})
})
},
SignOut (store, isClear) {
if (isClear) {
store.commit('logout')
return false
}
request.post('/api/token/logout').then(res => {
if (res.code === 0) {
store.commit('logout')
}
})
}
state: {
token: '',
mallId: '',
mallName: '',
mallList: [],
activeDlgShow: false,
userInfo: {}
},
getters: {
isLogin: state => {
return !!state.token
}
},
mutations: {
setToken(state, token) {
state.token = token
},
setMallId(state, mallId) {
state.mallId = mallId
},
setMallName(state, mallName) {
state.mallName = mallName
},
setMallList(state, mallList) {
state.mallList = mallList
},
logout(state) {
state.token = ''
state.userInfo = {}
state.mallList = []
state.mallName = ''
state.mallId = ''
setTimeout(() => {
router.push('/login')
}, 200)
},
setUserInfo(state, userInfo) {
state.userInfo = userInfo
},
setActiveDlgShow(state, flag) {
state.activeDlgShow = flag
}
},
actions: {
getUserInfo(store) {
return new Promise(resolve => {
request.post('/api/malluser/info').then(res => {
if (res.code === 0) {
store.commit('setUserInfo', res.data)
resolve(res.data)
}
})
})
},
SignOut(store, isClear) {
if (isClear) {
store.commit('logout')
return false
}
request.post('/api/token/logout').then(res => {
if (res.code === 0) {
store.commit('logout')
}
})
}
},
getters: {
isLogin: state => {
return !!state.token
}
},
plugins: [preState()]
})

View File

@@ -90,28 +90,8 @@
:close-on-click-modal="false"
width="30%"
:before-close="handleClose">
<el-form :model="form" label-position="top" ref="form" label-width="100px" class="form">
<el-form-item
prop="mallName"
label="当前绑定账号"
:rules="[{ required: true, message: '请先登录拼多多跨境卖家中心', trigger: 'blur' }]">
<el-input readonly placeholder="请先登录拼多多跨境卖家中心" v-model="form.mallName"></el-input>
</el-form-item>
<el-form-item
prop="mallId"
v-show="false"
:rules="[{ message: '请输入商城ID', trigger: 'blur' }]">
<el-input placeholder="请输入商城ID" v-model="form.mallId"></el-input>
</el-form-item>
<el-form-item
prop="code"
label="激活码"
:rules="[{ required: true, message: '请输入激活码', trigger: 'blur' }]">
<el-input placeholder="请输入激活码" v-model="form.code"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="$store.commit('setActiveDlgShow', false)"> </el-button>
<el-button @click="setActiveDlgShow(false)"> </el-button>
<el-button type="primary" @click="active"> </el-button>
</span>
</el-dialog>
@@ -119,9 +99,11 @@
</template>
<script>
import { mapState } from 'vuex'
import {mapMutations, mapState} from 'vuex'
import AiPayment from "@/components/AiPayment.vue";
export default {
components: {AiPayment},
data () {
return {
isCollapse: false,
@@ -168,6 +150,7 @@
},
methods: {
...mapMutations(['setActiveDlgShow']),
handleClick (e) {
if (e === 'logout') {
this.$store.dispatch('SignOut', false)
@@ -181,10 +164,10 @@
this.form.mallId = "";
this.form.mallName = "";
this.form.code = "";
this.$store.commit('setActiveDlgShow', false)
this.setActiveDlgShow(false)
},
toActive() {
this.$store.commit('setActiveDlgShow', true)
this.setActiveDlgShow(true)
},
getMessage(type) {
return `你使用的是“${this.vipType[type]}”兑换券,确定兑换?`;
@@ -212,7 +195,7 @@
if (res.code == 0) {
this.$message.success('激活成功')
this.$store.dispatch('getUserInfo')
this.$store.commit('setActiveDlgShow', false)
this.setActiveDlgShow(false)
}
})
})

View File

@@ -32,6 +32,7 @@
</div>
</ai-card>
</div>
<ai-payment/>
<ai-card title="常用工具" v-if="false">
<div class="">
dsad
@@ -58,9 +59,11 @@
</template>
<script>
import AiPayment from "@/components/AiPayment.vue";
export default {
name: 'AdminHome',
components: {AiPayment},
data () {
return {
noticeList: [],

View File

@@ -51,6 +51,6 @@ export default {
}
</script>
<style>
<style lang="scss">
@import '../assets/css/index.scss';
</style>

View File

@@ -7,8 +7,7 @@ const obfuscateConfig = require('./obfuscator.config')
const pages = {}
function getEntryFile (entryPath) {
let files = fs.readdirSync(entryPath)
return files
return fs.readdirSync(entryPath)
}
const chromeName = getEntryFile(path.resolve(`src/entry`))
@@ -32,20 +31,20 @@ module.exports = {
pages,
filenameHashing: false,
chainWebpack: (config) => {
config.plugin('copy').use(require('copy-webpack-plugin'), [
{
patterns: [
{
from: path.resolve(`src/manifest.${process.env.NODE_ENV}.json`),
to: `${path.resolve('dist')}/manifest.json`
},
{
from: path.resolve(`public/`),
to: `${path.resolve('dist')}/`
}
]
}
])
// config.plugin('copy').use(require('copy-webpack-plugin'), [
// {
// patterns: [
// {
// from: path.resolve(`src/manifest.${process.env.NODE_ENV}.json`),
// to: `${path.resolve('dist')}/manifest.json`
// },
// {
// from: path.resolve(`public/`),
// to: `${path.resolve('dist')}/`
// }
// ]
// }
// ])
},
devServer: {
port: 8080,

7585
yarn.lock

File diff suppressed because it is too large Load Diff