Commit 3957e003 by zhangxw

支付商户管理

1 parent 4147f458
......@@ -82,6 +82,18 @@ const uploadCertApi = params => {
returnAll: true
})
}
// 获取应用Id列表
const getlistAppInfoApi = params => {
params.method = `${defaultPath}listAppInfo`
return http({
url: url,
method: 'POST',
data: params,
sign: true
})
}
export default {
getListApi,
getBusinessListApi,
......@@ -89,5 +101,6 @@ export default {
delPayMerchantApi,
creatBizQrcodeApi,
createWeappQrcodeApi,
uploadCertApi
uploadCertApi,
getlistAppInfoApi
}
......@@ -5,9 +5,14 @@
<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.confId" :label="value.confId">{{ value.confName }}</el-checkbox>
<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>
......@@ -87,7 +92,7 @@ export default {
editForm: {
payMerchantAccount: '',
payMerchantName: '',
merchantType: '',
merchantType: '0',
affiliationMerchant: '',
applyIds: [],
certificateString: '',
......@@ -136,37 +141,25 @@ export default {
confName: '流量方'
}
],
isDisabled: false
isDisabled: false,
handleRadioChange: (value, targetItem) => {
this.changeRadio(value)
}
},
{
label: '所属商户',
name: 'affiliationMerchant',
type: 'select',
optionList: [],
optionId: 'merchantNo',
optionLabel: 'merchantName',
isDisabled: false,
changeAttr: (value, targetItem) => {
this.editForm.merchantName = targetItem.optionList.find(v => v.merchantNo == value).merchantName
}
addHtml: 'affiliationMerchant',
isHide: true
},
{
label: '应用ID',
name: 'applyIds',
addHtml: 'applyIds',
optionId: 'confId',
optionLabel: 'confName',
optionId: 'appType',
optionLabel: 'appName',
isDisabled: false,
applyIdsList: [
{
confId: 'MINIAPP',
confName: '众筹小程序'
},
{
confId: 'BIZ',
confName: '众筹公众号'
}
]
applyIdsList: []
}
],
configEditFormData: [
......@@ -193,13 +186,15 @@ export default {
editChildRef: 'editChildRef',
isShowTestDialog: false,
dialogData: [],
jumpH5Path: ''
jumpH5Path: '',
merchantsList: [],
queryMerchantName: ''
}
},
mounted() {
// 获取所有商户
this.$apis.payMerchantManage.getBusinessListApi({}).then(res => {
this.editFormData[3].optionList = res
// 获取应用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
......@@ -209,6 +204,38 @@ export default {
}
},
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
......@@ -271,12 +298,15 @@ export default {
this.dialogData = []
// 获取收款测试码
let fetchArr = []
let tilteList = this.editFormData.find(v => v.name == 'applyIds').applyIdsList
this.editForm.applyIds.forEach(val => {
if (val == 'MINIAPP') {
fetchArr.push(this.getWeappQrcode(data['MINIAPP'].payMannerId))
let itemTitle = tilteList.find(v => val == v.appType).appName
fetchArr.push(this.getWeappQrcode(data['MINIAPP'].payMannerId, itemTitle))
}
if (val == 'BIZ') {
fetchArr.push(this.getBizQrcode(data['BIZ'].payMannerId))
let itemTitle = tilteList.find(v => val == v.appType).appName
fetchArr.push(this.getBizQrcode(data['BIZ'].payMannerId, itemTitle))
}
})
return new Promise(resolve => {
......@@ -320,7 +350,7 @@ export default {
document.getElementById(id).scrollIntoView()
},
// 获取微信小程序收款测试码
getWeappQrcode(payMannerId) {
getWeappQrcode(payMannerId, itemTitle) {
return new Promise((resolve, reject) => {
this.$apis.payMerchantManage
.createWeappQrcodeApi({
......@@ -333,20 +363,19 @@ export default {
.then(res => {
if (res.code == '0') {
this.dialogData.push({
title: '小程序收款码',
title: itemTitle,
url: res.data
})
resolve()
} else {
this.$message.error(res.message)
resolve()
// reject()
}
})
})
},
// 获取公众号收款测试码
getBizQrcode(payMannerId) {
getBizQrcode(payMannerId, itemTitle) {
return new Promise((resolve, reject) => {
this.$apis.payMerchantManage
.creatBizQrcodeApi({
......@@ -356,12 +385,13 @@ export default {
.then(res => {
if (res.code == '0') {
this.dialogData.push({
title: '公众号收款码',
title: itemTitle,
url: res.data
})
resolve()
} else {
this.$message.error(res.message)
resolve()
}
})
})
......@@ -391,21 +421,25 @@ export default {
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.loading = true
this.$apis.payMerchantManage.uploadCertApi({ file: base64 }).then(res => {
this.loading = false
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
})
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
})
}
},
......@@ -473,6 +507,10 @@ export default {
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 {
......
......@@ -2,7 +2,7 @@
<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 ? item.title : '众筹小程序'}}</div>
<div class="qrcode-tiltle">{{ item.title }}</div>
<div class="qrcode-tips">请扫码完成支付</div>
<img class="qrcode-img" :src="item.url" alt="" />
</div>
......@@ -24,8 +24,7 @@ export default {
}
},
data() {
return {
}
return {}
},
methods: {
handleDialogClose() {
......@@ -35,30 +34,29 @@ export default {
}
</script>
<style lang="scss" scoped>
.dialog-look{
.dialog-look {
padding: 24px 40px 48px 40px;
display: flex;
align-items: center;
justify-content: center;
.qrcode-box{
.qrcode-box {
display: flex;
flex-flow: column;
align-items: center;
margin: 0 20px;
.qrcode-tiltle{
.qrcode-tiltle {
font-size: 16px;
color: #333;
}
.qrcode-tips{
.qrcode-tips {
font-size: 14px;
color: #666;
margin: 8px;
}
.qrcode-img{
.qrcode-img {
width: 118px;
height: 118px;
}
}
}
</style>
\ No newline at end of file
......@@ -47,7 +47,7 @@ export default {
merchantName: '',
mchId: '',
mchName: '',
appType: '',
appId: '',
testFlag: ''
},
tableSearchForm: {},
......@@ -69,12 +69,12 @@ export default {
},
{
label: '应用ID',
name: 'appType',
name: 'appId',
type: 'select',
width: '215px',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionId: 'appId',
optionLabel: 'appName',
optionsName: 'applyTypes'
},
{
......@@ -88,11 +88,7 @@ export default {
label: '商户号',
name: 'merchantId',
type: 'input',
width: '215px',
// optionList: [],
// optionId: 'merchantNo',
// optionLabel: 'merchantName',
// optionsName: 'listMerchants'
width: '215px'
},
{
label: '状态',
......@@ -155,9 +151,6 @@ export default {
{
label: '应用ID',
prop: 'appPrincipal'
// formatter: cellValue => {
// return this.baseData.applyTypes.find(item => item.confId == cellValue.appType)?.confName
// }
},
{
label: '所属商户',
......@@ -168,6 +161,13 @@ export default {
prop: 'merchantId'
},
{
label: '账号所属',
prop: 'mchBelong',
formatter: cellValue => {
return this.mchBelongList.find(item => item.confId == cellValue.mchBelong)?.confName
}
},
{
label: '创建人',
prop: 'createdBy'
},
......@@ -198,30 +198,34 @@ export default {
confName: '已生效'
}
],
applyTypes: [
{
confId: 'MINIAPP',
confName: '众筹小程序'
},
{
confId: 'BIZ',
confName: '众筹公众号'
}
],
listMerchants: []
applyTypes: []
},
isShowTestDialog: false,
dialogData: [],
jumpH5Path: ''
jumpH5Path: '',
mchBelongList: [
{
confId: '0',
confName: '广联'
},
{
confId: '1',
confName: '服务商'
},
{
confId: '2',
confName: '流量方'
}
]
}
},
mounted() {
// 获取所有商户
// this.$apis.payMerchantManage.getBusinessListApi({}).then(res => {
// this.baseData.listMerchants = res
this.getOptionsList('searchFormData')
// })
// 获取应用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`
......@@ -249,9 +253,7 @@ export default {
type: 'warning',
callback: action => {
if (action == 'confirm') {
console.log(apiParams)
this.$apis[apiModule][apiName](apiParams).then(res => {
console.log(res)
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
......@@ -287,24 +289,26 @@ export default {
// 获取微信小程序收款测试码
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: '小程序收款码',
url: res.data
})
resolve()
} else {
this.$message.error(res.message)
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()
}
})
})
},
// 获取公众号收款测试码
......@@ -318,7 +322,7 @@ export default {
.then(res => {
if (res.code == '0') {
this.dialogData.push({
title: '公众号收款码',
title: row.appPrincipal,
url: res.data
})
resolve()
......@@ -336,7 +340,6 @@ export default {
//删除
del(row) {
console.log(row)
var params = {}
params.payMannerId = row.payMannerId
this.secondConfirm('删除', '确定删除此支付商户?', 'payMerchantManage', 'delPayMerchantApi', params)
......@@ -347,30 +350,18 @@ export default {
this.$router.push('/payMerchantsManage/addPayMerchant')
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
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)
}
} else {
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)
}
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() {
......@@ -383,7 +374,7 @@ export default {
merchantName: '',
mchId: '',
mchName: '',
appType: '',
appId: '',
testFlag: ''
}
this.handleSearch()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!