Commit b2851209 by zhangxw

Merge remote-tracking branch 'origin/Saas+v4.14.0_1223' into v3.3.0

2 parents 5765221c 72feb1ac
import { http } from '@/main'
const defaultPath = 'entmicro.api.payment.'
const url = '/rop-scrm-entmicro/router'
// 获取支付商户列表数据
const getListApi = params => {
params.method = `${defaultPath}pageListPayment`
return http({
url: url,
method: 'POST',
data: params,
sign: true
})
}
// 获取所属商户数据
const getBusinessListApi = params => {
params.method = `${defaultPath}listMerchant`
return http({
url: url,
method: 'POST',
data: params,
sign: true
})
}
// 创建支付商户账号
const creatPayMerchantApi = params => {
params.method = `${defaultPath}createPayment`
return http({
url: url,
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 删除支付商户账号
const delPayMerchantApi = params => {
params.method = `${defaultPath}deleteById`
return http({
url: url,
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 生成收款测试公众号码
const creatBizQrcodeApi = params => {
params.method = `${defaultPath}createBizQrCode`
return http({
url: url,
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 生成收款测试微信小程序码
const createWeappQrcodeApi = params => {
params.method = `${defaultPath}createWeappQrcode`
return http({
url: url,
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 上传证书
const uploadCertApi = params => {
params.method = `${defaultPath}uploadCert`
return http({
url: url,
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 获取应用Id列表
const getlistAppInfoApi = params => {
params.method = `${defaultPath}listAppInfo`
return http({
url: url,
method: 'POST',
data: params,
sign: true
})
}
export default {
getListApi,
getBusinessListApi,
creatPayMerchantApi,
delPayMerchantApi,
creatBizQrcodeApi,
createWeappQrcodeApi,
uploadCertApi,
getlistAppInfoApi
}
......@@ -83,7 +83,7 @@ export default {
getList() {
var params = {
goodsStatus: 1,
// goodsSource: 1,
isActivityUsing: 1,
goodsSources: [1, 3],
pageNum: 1,
pageSize: 100000,
......
......@@ -62,6 +62,19 @@ const staticRoutes = Object.freeze([
path: '/seckillActivity/dataBoard',
component: resolve => require([`@/views/seckillActivity/dataBoard.vue`], resolve),
meta: {}
},
// 支付商户管理
{
name: '支付商户管理',
path: '/payMerchantsManage/index',
component: resolve => require([`@/views/payMerchantsManage/index.vue`], resolve),
meta: {}
},
{
name: '新增支付商户',
path: '/payMerchantsManage/addPayMerchant',
component: resolve => require([`@/views/payMerchantsManage/addPayMerchant.vue`], resolve),
meta: {}
}
])
export default staticRoutes
......@@ -17,6 +17,7 @@ export async function bootstrap({ history, common, messenger, globalState, route
Vue.prototype.$merchantId = merchantId
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$request = request
Vue.prototype.$common = common
Vue.prototype.$message = message
Vue.prototype.$messageBox = messageBox
......
<!-- 新增支付商户 -->
<template>
<div class="payMerchants marketing edit-box">
<!-- 基本信息 -->
<div class="container edit-container">
<p class="edit-title" id="basic">基本信息</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="affiliationMerchant" slot-scope="scope">
<el-select style="width: 432px" remote reserve-keyword :remote-method="remoteMethod" v-model="editForm[scope.scope.name]" @visible-change="visibleChange" placeholder="请选择所属商户" @change="changeSelect" filterable>
<el-option v-for="(subItem, subIndex) in merchantsList" :key="subIndex" :label="subItem['merchantName']" :value="subItem['merchantNo']"></el-option>
</el-select>
</template>
<template slot="applyIds" slot-scope="scope">
<el-checkbox-group v-model="editForm.applyIds">
<el-checkbox v-for="value in scope.scope.applyIdsList" :key="value.appType" :label="value.appType">{{ value.appName }}</el-checkbox>
</el-checkbox-group>
</template>
</glsx-combi-form>
</div>
<!-- 配置信息 -->
<div class="container edit-container crowd-config">
<p class="edit-title" id="config">配置信息</p>
<glsx-combi-form class="edit-form-container" ref="configEditFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="configEditFormData" :formRules="editRule">
<template slot="certificateFile" slot-scope="scope">
<div class="upload-box">
<p class="tips-text m-t-10">
请上传从微信支付平台获取的两个PEM格式的证书文件,如何获取证书串、密钥和证书文件,点击
<el-button style="padding: 0" @click="goLinkPage" type="text">查看操作指引</el-button>
</p>
<div class="upload-file-content">
<div>
<el-upload action="" drag class="upload-file" accept=".PEM, .pem" :show-file-list="false" :http-request="handleCertificateUpload" :before-upload="e => handleCertificateBeforeUpload(e, scope.scope, 1)" :file-list="fileKeyList">
<i class="el-icon-upload"></i>
<div class="el-upload__text">
<div>
将文件拖到此处,或
<el-button type="text" style="padding: 0">点击上传</el-button>
</div>
<div class="tips-upload">请上传后缀为_key.pem的证书</div>
</div>
</el-upload>
<div class="file-list-box" v-for="(item, index) in fileKeyList" :key="index">
<div class="file-name-box">{{ item.name }}</div>
<i class="el-icon-delete" @click="delFile(1)"></i>
</div>
</div>
<div>
<el-upload action="" drag class="upload-file" accept=".PEM, .pem" :show-file-list="false" :http-request="handleCertificateUpload" :before-upload="e => handleCertificateBeforeUpload(e, scope.scope, 2)" :file-list="fileCertList">
<i class="el-icon-upload"></i>
<div class="el-upload__text">
<div>
将文件拖到此处,或
<el-button type="text" style="padding: 0">点击上传</el-button>
</div>
<div class="tips-upload">请上传后缀为_cert.pem的证书</div>
</div>
</el-upload>
<div class="file-list-box" v-for="(item, index) in fileCertList" :key="index">
<div class="file-name-box">{{ item.name }}</div>
<i class="el-icon-delete" @click="delFile(2)"></i>
</div>
</div>
</div>
</div>
</template>
</glsx-combi-form>
</div>
<GLFooter>
<el-button @click="handleCancel" size="medium">取消</el-button>
<el-button type="primary" @click="handleConfirm" size="medium" :loading="loading">保存</el-button>
</GLFooter>
<!-- 支付测试弹窗 -->
<collectionTest :isShowTestDialog="isShowTestDialog" :dialogData="dialogData" @handleDialogClose="handleDialogClose"></collectionTest>
</div>
</template>
<script>
import collectionTest from './components/collectionTestDialog'
export default {
components: {
collectionTest
},
name: 'addPayMerchant',
data() {
var validatorFileList = (rule, value, cb) => {
if (!this.fileCertList.length || !this.fileKeyList.length) {
cb(new Error('请上传证书文件'))
} else {
cb()
}
}
return {
editForm: {
payMerchantAccount: '',
payMerchantName: '',
merchantType: '0',
affiliationMerchant: '',
applyIds: [],
certificateString: '',
secretKey: ''
},
editRule: {
payMerchantAccount: [{ required: true, message: '请输入微信支付商户号', trigger: 'change' }],
merchantType: [{ required: true, message: '请选择所属商户类型', trigger: 'change' }],
affiliationMerchant: [{ required: true, message: '请输入所属商户', trigger: 'change' }],
applyIds: [{ required: true, message: '请选择应用ID', trigger: 'change' }],
certificateString: [{ required: true, message: '请输入证书串', trigger: 'change' }],
secretKey: [{ required: true, message: '请输入密钥', trigger: 'change' }],
certificateFile: [{ required: true, validator: validatorFileList, trigger: 'change' }]
},
editFormData: [
{
label: '微信支付商户号',
name: 'payMerchantAccount',
type: 'input',
isDisabled: false
},
{
label: '微信支付商户名',
name: 'payMerchantName',
type: 'input',
isDisabled: false
},
{
label: '所属商户类型',
name: 'merchantType',
type: 'radio',
width: '320px',
optionId: 'confId',
optionLabel: 'confName',
optionList: [
{
confId: '0',
confName: '广联'
},
{
confId: '1',
confName: '服务商'
},
{
confId: '2',
confName: '流量方'
}
],
isDisabled: false,
handleRadioChange: (value, targetItem) => {
this.changeRadio(value)
}
},
{
label: '所属商户',
name: 'affiliationMerchant',
addHtml: 'affiliationMerchant',
isHide: true
},
{
label: '应用ID',
name: 'applyIds',
addHtml: 'applyIds',
optionId: 'appType',
optionLabel: 'appName',
isDisabled: false,
applyIdsList: []
}
],
configEditFormData: [
{
label: '证书串',
name: 'certificateString',
type: 'input',
isDisabled: false
},
{
label: '密钥',
name: 'secretKey',
type: 'input',
isDisabled: false
},
{
label: '证书文件',
name: 'certificateFile',
addHtml: 'certificateFile'
}
],
fileCertList: [],
fileKeyList: [],
editChildRef: 'editChildRef',
isShowTestDialog: false,
dialogData: [],
jumpH5Path: '',
merchantsList: [],
queryMerchantName: ''
}
},
mounted() {
// 获取应用id
this.$apis.payMerchantManage.getlistAppInfoApi({}).then(res => {
this.editFormData.find(v => v.name == 'applyIds').applyIdsList = res
})
if (process.env.NODE_ENV == 'development') {
// 本地打开修改dj-scrm-wx-work-main-xxx
this.jumpH5Path = `${this.$request.baseURL}/dj-scrm-wx-work-main-zxw/#/testPayMerchant/index`
} else {
this.jumpH5Path = `${window.location.origin}/scrm-wx-merchant-activity/#/testPayMerchant/index`
}
},
methods: {
remoteMethod(query) {
this.queryMerchantName = query
this.getMerchantsList(this.editForm['merchantType']) // 请求接口
},
changeRadio(value) {
this.merchantsList = []
this.queryMerchantName = ''
this.editForm.affiliationMerchant = ''
this.editFormData[3].isHide = !(value == '1' || value == '2')
if (value == '0') return
this.getMerchantsList(value)
},
getMerchantsList(value) {
this.$apis.payMerchantManage
.getBusinessListApi({
// 商户类型,2-流量方,7-服务商
merchantType: value == '1' ? 7 : value == '2' ? 2 : '',
currentPage: 1,
pageSize: 200,
merchantName: this.queryMerchantName
})
.then(res => {
this.merchantsList = res
})
},
changeSelect(val) {
this.editForm.merchantName = this.merchantsList.find(v => v.merchantNo == val).merchantName
},
visibleChange(data) {
// 获取焦点重新渲染下拉框数据
if (data) this.queryMerchantName = ''
},
handleConfirm() {
let validList = []
var validFlag = true
var flag = true
this.$nextTick(() => {
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid, errorObj) => {
validList = [
{ valid: !valid, errorObj: errorObj },
{ valid: !flag, errorObj: { goodsId: '' } }
]
this.$refs.configEditFormRef.$refs[this.editChildRef].validate((configValid, configErrorObj) => {
validList.push({ valid: !configValid, errorObj: configErrorObj })
if (this.checkValid(validList)) {
if (!this.fileCertList.length || !this.fileKeyList.length) {
validFlag = true
}
} else {
validFlag = false
}
validFlag && this.confirmEvent()
})
})
})
},
confirmEvent() {
let params = {
merchantNo: this.editForm.affiliationMerchant,
merchantName: this.editForm.merchantName,
mchId: this.editForm.payMerchantAccount,
mchName: this.editForm.payMerchantName,
mchBelong: this.editForm.merchantType,
appTypes: this.editForm.applyIds.join(','),
merchantSerialNo: this.editForm.certificateString,
apiKey: this.editForm.secretKey,
apiclientKeyPemPath: this.fileKeyList[0]?.url,
apiclientCertPemPath: this.fileCertList[0]?.url
}
this.$apis.payMerchantManage.creatPayMerchantApi(params).then(res => {
if (res.code == '0') {
this.secondConfirm('提示', '<p style="text-align: center;font-size:16px;font-weight: blod;">保存成功</p><p style="font-size:14px; color: #666;">为确保完成正常收款,请继续进行收款测试</p>', res.data)
} else {
this.$message({
message: res.message,
type: 'error'
})
}
})
},
secondConfirm(title, txt, data) {
this.$confirm(txt, title, {
confirmButtonText: '收款测试',
dangerouslyUseHTMLString: true,
iconClass: 'el-icon-warning',
showCancelButton: false,
distinguishCancelAndClose: true,
closeOnClickModal: false,
customClass: 'confirmDialog',
callback: action => {
if (action == 'confirm') {
this.dialogData = []
// 获取收款测试码
let fetchArr = []
let tilteList = this.editFormData.find(v => v.name == 'applyIds').applyIdsList
this.editForm.applyIds.forEach(val => {
if (val == 'MINIAPP') {
let itemTitle = tilteList.find(v => val == v.appType).appName
fetchArr.push(this.getWeappQrcode(data['MINIAPP'].payMannerId, itemTitle))
}
if (val == 'BIZ') {
let itemTitle = tilteList.find(v => val == v.appType).appName
fetchArr.push(this.getBizQrcode(data['BIZ'].payMannerId, itemTitle))
}
})
return new Promise(resolve => {
Promise.all(fetchArr).then(() => {
this.isShowTestDialog = !this.isShowTestDialog
resolve()
})
})
}
if (action == 'close') {
this.goback()
}
}
})
},
handleTestConfirm() {
this.isShowTestDialog = !this.isShowTestDialog
},
handleConfirmDialogClose() {
this.goback()
},
goback() {
this.$router.go(-1)
},
handleDialogClose() {
this.dialogData = []
this.isShowTestDialog = !this.isShowTestDialog
this.goback()
},
checkValid(validList) {
for (let i = 0; i < validList.length; i++) {
let item = validList[i]
if (item.valid) {
this.whereToGo(Object.keys(item.errorObj)[0])
return false
}
}
return true
},
whereToGo(id) {
document.getElementById(id).scrollIntoView()
},
// 获取微信小程序收款测试码
getWeappQrcode(payMannerId, itemTitle) {
return new Promise((resolve, reject) => {
this.$apis.payMerchantManage
.createWeappQrcodeApi({
appId: 'wxe10067a63c1856ac',
qrcodeType: 'QR_WXA_UNLIMIT',
path: 'pages/crowdfunding/testPayMerchant/testPayMerchant',
scene: `${payMannerId},1`,
channelName: 'DJ'
})
.then(res => {
if (res.code == '0') {
this.dialogData.push({
title: itemTitle,
url: res.data
})
resolve()
} else {
this.$message.error(res.message)
resolve()
}
})
})
},
// 获取公众号收款测试码
getBizQrcode(payMannerId, itemTitle) {
return new Promise((resolve, reject) => {
this.$apis.payMerchantManage
.creatBizQrcodeApi({
payMannerId: payMannerId,
path: this.jumpH5Path
})
.then(res => {
if (res.code == '0') {
this.dialogData.push({
title: itemTitle,
url: res.data
})
resolve()
} else {
this.$message.error(res.message)
resolve()
}
})
})
},
handleCertificateUpload() {},
handleCertificateBeforeUpload(file, targetItem, num) {
this.certificateUpload(file, targetItem, num)
},
// 上传文件
certificateUpload(e, targetItem, num) {
var reader = new FileReader()
var file = e
if (file.name.indexOf('.pem') == -1) {
return this.$message.error('上传的文件格式不对!')
}
// 默认1MB
const limitSize = 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传的文件大小不能超过' + limitSize + 'MB!')
this.fileList = []
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.loading = true
this.$apis.payMerchantManage.uploadCertApi({ file: base64 }).then(res => {
if (res.code == '0') {
if (num == 1) {
if (this.fileKeyList.length > 1) this.fileKeyList = []
this.fileKeyList.push({
name: file.name,
url: res.data
})
}
if (num == 2) {
if (this.fileCertList.length > 1) this.fileCertList = []
this.fileCertList.push({
name: file.name,
url: res.data
})
}
} else {
this.$message.error(res.message)
}
this.loading = false
})
}
},
// 删除证书文件
delFile(num) {
if (num == 1) {
this.fileKeyList.splice(0, 1)
} else {
this.fileCertList.splice(0, 1)
}
},
// 跳转操作指引
goLinkPage() {
window.open('https://img02.glsx.com.cn/weapp/resource/saas/scrm/pdf/获取证书、密钥操作指引.pdf')
}
}
}
</script>
<style lang="scss" scoped>
.upload-file {
margin: 12px 68px 0 0;
width: 300px;
height: 160px;
border: 1px;
}
.upload-file-content {
display: flex;
justify-content: space-between;
}
.upload-box {
width: 800px;
margin-top: -5px;
}
.tips-text {
font-size: 14px;
color: #999999;
height: 22px;
line-height: 22px;
}
.file-name-box {
display: inline-block;
width: 320px;
height: 24px;
margin-top: 8px;
line-height: 24px;
background: #f5f7fa;
border-radius: 4px;
padding: 0 12px;
margin-right: 10px;
}
</style>
<style lang="scss">
.confirmDialog {
.el-message-box__content {
.el-message-box__container {
.el-message-box__status.el-icon-warning {
color: var(--primaryColor, #5850ff);
}
.el-message-box__message {
padding: 95px 0 0 0;
}
}
}
.el-message-box__btns button:first-child {
color: #fff;
background-color: var(--primaryColor, #5850ff);
border-color: var(--primaryColor, #5850ff);
opacity: 1;
}
.el-message-box__btns button:first-child:hover {
opacity: 0.7;
}
// .el-message-box__btns {
// .el-button--primary {
// color: #fff;
// background-color: var(--primaryColor, #5850ff);
// border-color: var(--primaryColor, #5850ff);
// }
// }
}
.el-upload {
width: 100%;
height: 100%;
background: #f7f7f7;
border: 1px dashed #e5e5e5;
border-radius: 4px;
}
.el-upload-dragger {
border: none;
background: transparent;
height: 100%;
width: 100%;
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
.el-icon-upload {
margin: 0;
}
.el-upload__text {
font-weight: bold;
.tips-upload {
font-size: 14px;
color: #999999;
font-weight: 400;
}
}
}
</style>
<template>
<GLDialog title="收款测试" mode="mid" okText="关闭" :visible.sync="isShowTestDialog" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="handleDialogClose" :hasFooter="false">
<div class="dialog-look">
<div class="qrcode-box" v-for="(item, index) in dialogData" :key="index">
<div class="qrcode-tiltle">{{ item.title }}</div>
<div class="qrcode-tips">请扫码完成支付</div>
<img class="qrcode-img" :src="item.url" alt="" />
</div>
</div>
</GLDialog>
</template>
<script>
export default {
name: 'collection-test-dialog',
props: {
dialogData: {
type: Array,
default: () => []
},
isShowTestDialog: {
type: Boolean,
default: false
}
},
data() {
return {}
},
methods: {
handleDialogClose() {
this.$emit('handleDialogClose')
}
}
}
</script>
<style lang="scss" scoped>
.dialog-look {
padding: 24px 40px 48px 40px;
display: flex;
align-items: center;
justify-content: center;
.qrcode-box {
display: flex;
flex-flow: column;
align-items: center;
margin: 0 20px;
.qrcode-tiltle {
font-size: 16px;
color: #333;
}
.qrcode-tips {
font-size: 14px;
color: #666;
margin: 8px;
}
.qrcode-img {
width: 118px;
height: 118px;
}
}
}
</style>
\ No newline at end of file
<!-- 支付商户管理 -->
<template>
<div class="marketing">
<div class="m-b-20">
<GLButton :size="size" class="default-blue-btn el-icon-plus" type="default" @click="addPayMerchant()" fn="新增支付商户" mode="el-button">新增支付商户</GLButton>
</div>
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<!-- 表格区域 开始 -->
<GLTable ref="activity" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<span slot="testFlag" slot-scope="scope">
<span :class="{ circleStatusGray: scope.scope.testFlag === 0, circleStatusGreen: scope.scope.testFlag === 1 }"></span>
<span>{{ scope.scope.testFlag == '1' ? '已生效' : '待生效' }}</span>
</span>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
<collectionTest :isShowTestDialog="isShowTestDialog" :dialogData="dialogData" @handleDialogClose="handleDialogClose"></collectionTest>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import collectionTest from './components/collectionTestDialog'
export default {
name: 'activity',
components: {
collectionTest
},
data() {
return {
size: 'small',
url: url,
downForm: {
id: '',
offReason: '',
goodsStatus: 0
},
shareForm: {},
searchForm: {
merchantId: '',
merchantName: '',
mchId: '',
mchName: '',
appId: '',
testFlag: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '微信支付商户号',
name: 'mchId',
type: 'input',
width: '215px',
maxlength: 20
},
{
label: '微信支付商户名',
name: 'mchName',
type: 'input',
width: '215px',
maxlength: 20
},
{
label: '应用ID',
name: 'appId',
type: 'select',
width: '215px',
optionList: [],
optionId: 'appId',
optionLabel: 'appName',
optionsName: 'applyTypes'
},
{
label: '所属商户',
name: 'merchantName',
type: 'input',
width: '215px',
maxlength: 20
},
{
label: '商户号',
name: 'merchantId',
type: 'input',
width: '215px'
},
{
label: '状态',
name: 'testFlag',
type: 'select',
width: '215px',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'statusList'
}
],
// 表格按钮
tableButtonList: [
{
type: 'GLButton',
name: '收款测试',
attrs: {
type: 'text',
fn: '收款测试'
},
listeners: {
click: this.collectionTest
},
condition: row => {
return row.testFlag == '0' && row.appType
}
},
{
type: 'GLButton',
name: '删除',
attrs: {
type: 'text',
fn: '删除'
},
condition: row => {
return row.testFlag == '0'
},
listeners: {
click: this.del
}
}
],
// 表格
getListApi: this.$apis.payMerchantManage.getListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '微信支付商户号',
prop: 'mchId',
width: 220
},
{
label: '微信支付商户名',
prop: 'mchName',
width: 140
},
{
label: '应用ID',
prop: 'appPrincipal'
},
{
label: '所属商户',
prop: 'merchantName'
},
{
label: '商户号',
prop: 'merchantId'
},
{
label: '账号所属',
prop: 'mchBelong',
formatter: cellValue => {
return this.mchBelongList.find(item => item.confId == cellValue.mchBelong)?.confName
}
},
{
label: '创建人',
prop: 'createdBy'
},
{
label: '创建日期',
name: 'createdDate',
width: 200,
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '状态',
name: 'testFlag',
addHtml: 'testFlag'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
statusList: [
{
confId: '0',
confName: '待生效 '
},
{
confId: '1',
confName: '已生效'
}
],
applyTypes: []
},
isShowTestDialog: false,
dialogData: [],
jumpH5Path: '',
mchBelongList: [
{
confId: '0',
confName: '广联'
},
{
confId: '1',
confName: '服务商'
},
{
confId: '2',
confName: '流量方'
}
]
}
},
mounted() {
// 获取应用ID列表
this.$apis.payMerchantManage.getlistAppInfoApi({}).then(res => {
this.baseData.applyTypes = res
this.getOptionsList('searchFormData', true)
})
if (process.env.NODE_ENV == 'development') {
// 本地打开修改dj-scrm-wx-work-main-xxx
this.jumpH5Path = `${this.$request.baseURL}/dj-scrm-wx-work-main-zxw/#/testPayMerchant/index`
} else {
this.jumpH5Path = `${window.location.origin}/scrm-wx-merchant-activity/#/testPayMerchant/index`
}
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
// 收款测试
collectionTest(row) {
let fetchArr = []
row.appType?.split(',').forEach(val => {
if (val == 'MINIAPP') {
fetchArr.push(this.getWeappQrcode(row))
}
if (val == 'BIZ') {
fetchArr.push(this.getBizQrcode(row))
}
})
return new Promise(resolve => {
Promise.all(fetchArr).then(() => {
this.isShowTestDialog = !this.isShowTestDialog
resolve()
})
})
},
// 获取微信小程序收款测试码
getWeappQrcode(row) {
return new Promise((resolve, reject) => {
this.$apis.payMerchantManage
.createWeappQrcodeApi({
appId: 'wxe10067a63c1856ac',
qrcodeType: 'QR_WXA_UNLIMIT',
path: 'pages/crowdfunding/testPayMerchant/testPayMerchant',
scene: `${row.payMannerId},1`,
channelName: 'DJ'
})
.then(res => {
if (res.code == '0') {
this.dialogData.push({
title: row.appPrincipal,
url: res.data
})
resolve()
} else {
this.$message.error(res.message)
reject()
}
})
})
},
// 获取公众号收款测试码
getBizQrcode(row) {
return new Promise(resolve => {
this.$apis.payMerchantManage
.creatBizQrcodeApi({
payMannerId: row.payMannerId,
path: this.jumpH5Path
})
.then(res => {
if (res.code == '0') {
this.dialogData.push({
title: row.appPrincipal,
url: res.data
})
resolve()
} else {
this.$message.error(res.message)
}
})
})
},
handleDialogClose() {
this.dialogData = []
this.isShowTestDialog = !this.isShowTestDialog
},
//删除
del(row) {
var params = {}
params.payMannerId = row.payMannerId
this.secondConfirm('删除', '确定删除此支付商户?', 'payMerchantManage', 'delPayMerchantApi', params)
},
//新增支付商户
addPayMerchant() {
this.$router.push('/payMerchantsManage/addPayMerchant')
},
getOptionsList(formName, hasAll = false) {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
},
handleSearch() {
this.$refs.activity.refreshTable()
},
handleReset() {
this.searchForm = {
merchantId: '',
merchantName: '',
mchId: '',
mchName: '',
appId: '',
testFlag: ''
}
this.handleSearch()
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.activity.data.length ? (this.$refs.activity.tableHeightValues = '') : this.$refs.activity.setTableHeightFun()
}
}
}
</script>
<style scoped></style>
......@@ -3,34 +3,21 @@
<div class="data-board-box">
<p class="edit-title">数据看板</p>
<div class="p-20">
<GLCombiForm ref="dataRef"
:rowNumber="1"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"></GLCombiForm>
<GLCombiForm ref="dataRef" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch"></GLCombiForm>
<div class="data-view">
<template v-for="(item, index) in dataList">
<div :key="index"
class="item">
<div :key="index" class="item">
<div class="name">
{{ item.name }}
<el-popover class="tips"
placement="top"
width="260"
trigger="hover"
:content="item.tips">
<img slot="reference"
class="tips-icon"
src="@/components/glsx-combi-form/images/icon-tip.png" />
<el-popover class="tips" placement="top" width="260" trigger="hover" :content="item.tips">
<img slot="reference" class="tips-icon" src="@/components/glsx-combi-form/images/icon-tip.png" />
</el-popover>
</div>
<div class="value">{{ dataBoard[item.key] || 0 }}</div>
<template v-if="item.half">
<div class="half">
日环比:
<div
:class="['icon', { up: dataBoard[item.half] > 0 }, { down: dataBoard[item.half] < 0 }]">
</div>
<div :class="['icon', { up: dataBoard[item.half] > 0 }, { down: dataBoard[item.half] < 0 }]"></div>
<span class="num">{{ Math.abs(dataBoard[item.half]).toFixed(2) || 0 }}%</span>
</div>
</template>
......@@ -50,33 +37,14 @@
@handleRest="handleReset"></GLCombiForm>
<div class="flex m-b-10 w-100-percent">
<span class="table-title"></span>
<el-button :size="size"
class="default-blue-btn"
type="default"
@click="handleExport('rank')">导出</el-button>
<el-button :size="size" class="default-blue-btn" type="default" @click="handleExport('rank')">导出</el-button>
</div>
<GLTable ref="dataTableRef"
:getListApi="getListApi"
:noDataImg="url"
:searchForm="tableSearchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
@setTableFinishFun="setTableFinishFun"
:hasNum="false">
<div slot="shareName"
class="flex-align"
slot-scope="scope">
<GLTable ref="dataTableRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun" :hasNum="false">
<div slot="shareName" class="flex-align" slot-scope="scope">
<template v-if="scope.scope.shareAvatar">
<el-popover placement="top"
width="160"
trigger="hover"
popper-class="table-popover-block">
<img class="table-popover-img"
:src="scope.scope.shareAvatar" />
<img class="img-36 pointer"
slot="reference"
:src="scope.scope.shareAvatar" />
<el-popover placement="top" width="160" trigger="hover" popper-class="table-popover-block">
<img class="table-popover-img" :src="scope.scope.shareAvatar" />
<img class="img-36 pointer" slot="reference" :src="scope.scope.shareAvatar" />
</el-popover>
</template>
<span class="m-l-10">{{ scope.scope.shareName }}</span>
......@@ -90,32 +58,20 @@
<div class="p-20">
<div class="flex m-b-10 w-100-percent">
<span class="table-title">数据列表</span>
<el-button :size="size"
class="default-blue-btn"
type="default"
@click="handleExport('dailyOrders')">导出</el-button>
<el-button :size="size" class="default-blue-btn" type="default" @click="handleExport('dailyOrders')">导出</el-button>
</div>
<el-table v-if="DailyOrderQuantityList.length"
:data="DailyOrderQuantityListFormat"
style="width: 100%">
<el-table-column :formatter="formatterHeader"
label=""></el-table-column>
<el-table v-if="DailyOrderQuantityList.length" :data="DailyOrderQuantityListFormat" style="width: 100%">
<el-table-column :formatter="formatterHeader" label=""></el-table-column>
<!-- width="140px" -->
<el-table-column v-for="(item, index) in DailyOrderQuantityList"
:key="index"
:prop="item"
:label="item.day">
<el-table-column v-for="(item, index) in DailyOrderQuantityList" :key="index" :prop="item" :label="item.day">
<template slot-scope="scope">
<span>{{ scope.$index ? item.currentOrderQuantity : item.specificDate }}</span>
</template>
</el-table-column>
<el-table-column :formatter="formatterEnd"
fixed="right"
label="总计"></el-table-column>
<el-table-column :formatter="formatterEnd" fixed="right" label="总计"></el-table-column>
</el-table>
<div v-else>
<img src="url"
alt="" />
<img src="url" alt="" />
</div>
</div>
</div>
......@@ -141,34 +97,19 @@
单
</span>
</span>
<el-button :size="size"
class="default-blue-btn"
type="default"
@click="handleExport('liveData')">导出</el-button>
<el-button :size="size" class="default-blue-btn" type="default" @click="handleExport('liveData')">导出</el-button>
</div>
<!-- :searchForm="tableSearchForm" -->
<GLTable ref="dataTableRefDetailPage"
:getListApi="getLiveDetailPage"
:noDataImg="url"
:tableParams="liveTableParams"
:searchForm="LiveTableSearchForm"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn">
<div slot="weChatName"
class="flex-align"
slot-scope="scope">
<img v-if="scope.scope.avatar"
class="img-36 pointer img-circle"
:src="scope.scope.avatar" />
<GLTable ref="dataTableRefDetailPage" :getListApi="getLiveDetailPage" :noDataImg="url" :tableParams="liveTableParams" :searchForm="LiveTableSearchForm" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div slot="weChatName" class="flex-align" slot-scope="scope">
<img v-if="scope.scope.avatar" class="img-36 pointer img-circle" :src="scope.scope.avatar" />
<span class="m-l-10">{{ scope.scope.nickname }}</span>
<span v-if="!scope.scope.avatar && !scope.scope.nickname">-</span>
</div>
<!-- <div slot="orderStatus"
slot-scope="scope">
<span
:class="['table-circle', 'm-r-8', [2, 10, 22].includes(scope.scope.orderStatus) ? 'back-green' : [9].includes(scope.scope.orderStatus) ? 'back-blue' : [1, 21, 6].includes(scope.scope.orderStatus) ? 'back-orange' : 'back-grey']"></span>
<span>{{ baseData.orderStatusList.map(item => item.confId).includes(scope.scope.orderStatus + '') ? baseData.orderStatusList.find(item => item.confId == scope.scope.orderStatus).confName : '-' }}</span>
</div> -->
<div slot="orderStatus" slot-scope="scope">
<span :class="['table-circle', 'm-r-8', scope.scope.orderStatus == '已下单' ? 'back-green' : 'back-grey']"></span>
<span>{{ scope.scope.orderStatus ? scope.scope.orderStatus : '-' }}</span>
</div>
</GLTable>
</div>
</div>
......@@ -181,13 +122,13 @@ import { downLoadFile, orderManageStatusList } from '@/common/constant'
import url from '@/assets/empty.png'
const dataList = [
{ name: '新增浏览量', key: 'browseCount', tips: '统计时间内,新增页面被浏览的次数(一人多次访问计为多次)', half: 'browseRingRatio' },
{ name: '新增访客数', key: 'fansCount', tips: '统计时间内访问页面的人数(一人多次访问计为一次)', half: 'fansRingRatio' },
{ name: '新增订单数', key: 'orderCount', tips: '统计时间内,新增订单数(只记录已付款的订单)', half: 'orderRingRatio' },
{ name: '累计浏览量', key: 'totalBrowseCount', tips: '页面被浏览的总次数(一人多次访问计为多次)' },
{ name: '累计访客数', key: 'totalFansCount', tips: '访问页面的总人数(一人多次访问计为一次)' },
{ name: '累计订单数', key: 'totalOrderCount', tips: '累计订单总数(只记录已付款的订单)' }
],
{ name: '新增浏览量', key: 'browseCount', tips: '统计时间内,新增页面被浏览的次数(一人多次访问计为多次)', half: 'browseRingRatio' },
{ name: '新增访客数', key: 'fansCount', tips: '统计时间内访问页面的人数(一人多次访问计为一次)', half: 'fansRingRatio' },
{ name: '新增订单数', key: 'orderCount', tips: '统计时间内,新增订单数(只记录已付款的订单)', half: 'orderRingRatio' },
{ name: '累计浏览量', key: 'totalBrowseCount', tips: '页面被浏览的总次数(一人多次访问计为多次)' },
{ name: '累计访客数', key: 'totalFansCount', tips: '访问页面的总人数(一人多次访问计为一次)' },
{ name: '累计订单数', key: 'totalOrderCount', tips: '累计订单总数(只记录已付款的订单)' }
],
optionList = [
{ confId: '1', confName: '转发次数' },
{ confId: '2', confName: '访客总数' },
......@@ -333,7 +274,7 @@ export default {
{
label: '订单状态',
prop: 'orderStatus',
// addHtml: 'orderStatus',
addHtml: 'orderStatus',
width: 160
}
]
......@@ -375,7 +316,7 @@ export default {
...result
}
})
.catch(err => { })
.catch(err => {})
},
handleReset() {
this.searchRankForm = this.$options.data.call(this).searchRankForm
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!