完成新版店铺管理三方设置

This commit is contained in:
gyq
2026-01-15 13:54:19 +08:00
parent 3b19d58f27
commit ed8be8a16a
7 changed files with 271 additions and 174 deletions

View File

@@ -1,10 +1,11 @@
import request from "@/utils/request";
import { Account_BaseUrl } from "@/api/config";
import { Account_BaseUrl, Order_BaseUrl } from "@/api/config";
const baseURL = Account_BaseUrl + "/admin/shopMerchant";
const orderURL = Order_BaseUrl + "/admin/shopMerchant";
const API = {
get(shopId: string | number) {
return request({
url: `${baseURL}`,
url: `${orderURL}`,
method: "get",
params: {
shopId: shopId
@@ -14,7 +15,7 @@ const API = {
edit(shopId: string | number, data: shopMerchantType) {
delete data.id
return request({
url: `${baseURL}`,
url: `${orderURL}`,
method: "put",
data: { ...data, shopId },
});

View File

@@ -124,4 +124,43 @@ export const queryEntry = (params: Object) => {
method: "get",
params
});
}
}
/**
* 商户支付信息获取
* @data { params }
* @returns
*/
export const shopMerchantGet = (params: Object) => {
return request<any, any[]>({
url: `/order/admin/shopMerchant`,
method: "get",
params
});
}
/**
* 商户支付信息修改 修改聚合支付信息
* @data { params }
* @returns
*/
export const shopMerchantPut = (data: Object) => {
return request<any, any[]>({
url: `/order/admin/shopMerchant`,
method: "put",
data
});
}
/**
* 获取当前店铺的主店进件信息
* @data { params }
* @returns
*/
export const getMainMerchant = (params: Object) => {
return request<any, any[]>({
url: `/order/admin/shopMerchant/getMainMerchant`,
method: "get",
params
});
}

View File

@@ -10,7 +10,7 @@ export function searchstorestatus(type) {
return request_php({
method: "post",
headers: {
clint_type: type
'ClintType': type
},
url: "/meituan/searchstorestatus"
});
@@ -79,7 +79,7 @@ export function getuisdk(data) {
return request_php({
method: "post",
headers: {
clint_type: 2
'ClintType': 2
},
url: "/douyin/getuisdk",
data,
@@ -214,7 +214,7 @@ export function thirdPartyCoupon_bindUrl(data) {
return request_php({
method: "post",
headers: {
clint_type: 1
'ClintType': 1
},
url: "/meituan/getuisdkurl",
data,

View File

@@ -1,152 +1,105 @@
<template>
<!-- <el-dialog v-model="dialogVisible" :show-close="false" @close="reset"> -->
<el-tabs v-model="activeName">
<!-- <el-tab-pane label="聚合支付" name="pay"> -->
<el-form ref="form" :model="form" label-width="120px" label-position="left">
<el-form-item label="店铺id">
<el-input v-model="form.storeId" placeholder="请输入店铺id"></el-input>
<div class="row mt14">
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px" label-position="left">
<el-form-item label="店铺ID" prop="storeId">
<el-input v-model="form.storeId" placeholder="请输入店铺ID" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="商户名称">
<el-input v-model="form.merchantName" placeholder="请输入支付系统商户名称"></el-input>
<el-form-item label="商户名称" prop="merchantName">
<el-input v-model="form.merchantName" placeholder="请输入商户名称" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="商户应用id">
<el-input v-model="form.appId" placeholder="请输入商户应用id"></el-input>
<el-form-item label="appId" prop="appId">
<el-input v-model="form.appId" placeholder="请输入appId" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="商户密钥">
<el-input type="textarea" v-model="form.appSecret" placeholder="请输入商户密钥"></el-input>
</el-form-item>
<el-form-item label="支付密码">
<el-input v-model="form.payPassword" placeholder="请输入支付密码"></el-input>
</el-form-item>
<el-form-item label="微信appid">
<el-input v-model="form.wechatSmallAppid" placeholder="请输入微信小程序appid"></el-input>
</el-form-item>
<el-form-item label="支付宝appid">
<el-input v-model="form.alipaySmallAppid" placeholder="请输入支付宝小程序appid"></el-input>
<el-form-item label="appSecret" prop="appSecret">
<el-input v-model="form.appSecret" placeholder="请输入appSecret" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitHandle" :loading="formLoading">
<span v-if="!formLoading">保存</span>
<span v-else>保存中...</span>
</el-button>
<el-button type="primary" @click="submitHandle" v-loading="loading">保存</el-button>
</el-form-item>
<!-- <el-form-item label="支付宝商户号">
<el-input v-model="form.alipayAppId" placeholder="请输入支付宝商户号"></el-input>
</el-form-item>
<el-form-item label="支付宝商户密钥">
<el-input v-model="form.alipayAppToken" placeholder="请输入支付宝商户密钥"></el-input>
</el-form-item> -->
<!-- <el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio :value="1">启用</el-radio>
<el-radio :value="-1">禁用</el-radio>
</el-radio-group>
</el-form-item> -->
</el-form>
<!-- </el-tab-pane> -->
</el-tabs>
<!-- <template #footer>
<div class="dialog-footer">
<el-button @click="close">取消</el-button>
<el-button type="primary" @click="submitHandle" :loading="formLoading">
<span v-if="!formLoading">保存</span>
<span v-else>保存中...</span>
</el-button>
</div>
</template> -->
<!-- </el-dialog> -->
</div>
</template>
<script>
// import { tbMerchantThirdApply, tbMerchantThirdApplyPut } from "@/api/shop";
import ShopApi from "@/api/account/shop";
import shopMerchantApi from "@/api/account/shopMerchant";
import { ElNotification } from "element-plus";
export default {
data() {
return {
dialogVisible: false,
activeName: "pay",
formLoading: false,
form: {
appSecret: "",
id: "",
payPassword: "",
status: 1,
appId: "",
wechatSmallAppid: "",
storeId: "",
alipaySmallAppid: "",
alipayAppToken: "",
alipayAppId: "",
},
shopId: "",
};
},
methods: {
// 保存
async submitHandle() {
this.formLoading = true;
try {
await shopMerchantApi.edit(this.shopId, this.form);
this.$emit("success");
this.formLoading = false;
ElNotification({
title: "成功",
message: `修改成功`,
type: "success",
});
this.close();
} catch (error) {
this.formLoading = false;
console.log(error);
}
},
close() {
this.dialogVisible = false;
},
reset() {
this.form.appSecret = "";
this.form.id = "";
this.form.payPassword = "";
this.form.status = 1;
this.form.appId = "";
this.shopId = "";
},
// 详情(配置三方支付)
async getDetail(id) {
console.log(id);
this.shopId = id;
try {
const res = await shopMerchantApi.get(id);
this.form.appSecret = res.appSecret || "";
this.form.payPassword = res.payPassword || "";
this.form.status = res.status || "";
this.form.appId = res.appId || "";
this.form.wechatSmallAppid = res.wechatSmallAppid || "";
this.form.alipaySmallAppid = res.alipaySmallAppid || "";
this.form.merchantName = res.merchantName || "";
//this.form.alipayAppToken = res.alipayAppToken
//this.form.alipayAppId = res.alipayAppId
this.form.storeId = res.storeId || "";
this.dialogVisible = true;
} catch (error) {
console.log(error);
}
},
show(obj) {
if (obj && obj.id) {
this.form.id = obj.id;
this.getDetail(obj.id);
}
},
},
};
</script>
<script setup>
import { ref } from 'vue'
import { useRoute } from 'vue-router'
import { shopMerchantPut } from '@/api/common'
<style scoped lang="scss">
:deep(.el-dialog__header) {
padding: 0;
const props = defineProps({
detail: {
type: Object,
default: {}
}
})
const route = useRoute()
const formRef = ref(null)
const form = defineModel({
storeId: '',
merchantName: '',
appId: '',
appSecret: '',
})
const rules = ref({
storeId: [
{
required: true,
message: '请输入店铺ID',
trigger: 'blur'
}
],
merchantName: [
{
required: true,
message: '请输入店铺名称',
trigger: 'blur'
}
],
appId: [
{
required: true,
message: '请输入appId',
trigger: 'blur'
}
],
appSecret: [
{
required: true,
message: '请输入appSecret',
trigger: 'blur'
}
]
})
// 验证表单
function submitHandle() {
formRef.value.validate(valid => {
if (valid) {
shopMerchantPostAjax()
}
})
}
</style>
// 更新聚合支付
const loading = ref(false)
async function shopMerchantPostAjax() {
try {
loading.value = true
const res = await shopMerchantPut({
shopId: route.query.shopId,
polyMerchantDTO: form.value
})
ElNotification({
title: '注意',
message: '更新成功',
type: 'success'
})
} catch (error) {
console.log('shopMerchantPostAjax=', error);
}
loading.value = false
}
</script>

View File

@@ -10,6 +10,9 @@
</el-form-item>
</template>
<template v-else>
<el-form-item label="复用信息" v-if="shopId != mainInfo.shopId">
<el-tag>复用主店信息</el-tag>
</el-form-item>
<el-form-item label="商户号">
<el-text>{{ form.merchantCode }}</el-text>
</el-form-item>
@@ -44,7 +47,7 @@
<el-form-item label="创建时间">
<el-text>{{ form.createTime }}</el-text>
</el-form-item>
<el-form-item>
<el-form-item v-if="shopId == mainInfo.shopId">
<el-button link type="primary"
v-if="form.wechatStatus == 'INIT' || form.wechatStatus == 'AUDIT' || form.wechatStatus == 'SIGN' || form.alipayStatus == 'INIT' || form.alipayStatus == 'AUDIT' || form.alipayStatus == 'SIGN'"
@click="checkStatusHandle()">查询</el-button>
@@ -55,19 +58,29 @@
</template>
</el-form>
<singCodeDialog ref="singCodeDialogRef" />
<!-- 分店复用主店信息弹窗 -->
<el-dialog title="注意" width="400px" top="40vh" v-model="mainDialogVisable">
<span>是否复用主店</span>
<template #footer>
<div class="dialog-footer">
<el-button @click="toApplymentRouter">自己申请</el-button>
<el-button type="primary" @click="shopMerchantPutAjax" :loading="mainDialogVisableLoading">复用主店信息</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router';
import { entryManagerDetail } from '@/api/common'
import { shopMerchantGet, getMainMerchant, shopMerchantPut } from '@/api/common'
import singCodeDialog from '@/views/applyments/components/singCodeDialog.vue';
const singCodeDialogRef = ref(null)
const route = useRoute()
const router = useRouter()
const shopId = route.query.shopId
const userTypeList = ref([
{
value: '0',
@@ -151,9 +164,71 @@ async function checkStatusHandle() {
}
}
// 去进件
function toApplyment() {
router.push({ name: 'applyment_in', query: { shopId: route.query.shopId } });
// 获取主店进件信息
const mainInfo = ref({})
async function headShopApplmentInfo() {
try {
const res = await getMainMerchant({
shopId: route.query.mainId
})
mainInfo.value = res
} catch (error) {
console.log(error);
}
}
// 跳转进件逻辑处理
const mainDialogVisable = ref(false)
const mainDialogVisableLoading = ref(false)
async function toApplyment() {
let shopType = route.query.shopType
let isHeadShop = route.query.isHeadShop
if (shopType == 'chain' || shopType == 'join') {
if (isHeadShop == 1) {
toApplymentRouter()
} else {
// 分店弹窗选择
await headShopApplmentInfo()
if (mainInfo.value && mainInfo.value.shopId) {
mainDialogVisable.value = true
} else {
toApplymentRouter()
}
}
} else {
toApplymentRouter()
}
}
// 跳转进件
function toApplymentRouter() {
router.push({ name: 'applyment_in', query: { shopId: shopId } });
}
// 复用主店的进件信息
async function shopMerchantPutAjax() {
try {
mainDialogVisableLoading.value = true
await shopMerchantPut({
shopId: shopId,
relatedLicenceNo: mainInfo.value.licenceNo,
nativeMerchantDTO: {
wechatMerchantId: mainInfo.value.wechatMerchantId,
alipayMerchantId: mainInfo.value.alipayMerchantId,
alipayAuthInfo: mainInfo.value.alipayAuthInfo
}
})
ElNotification({
title: '注意',
message: '复用成功',
type: 'success'
})
mainDialogVisable.value = false
updateData()
} catch (error) {
console.log(error);
}
mainDialogVisableLoading.value = false
}
// 跳转编辑页面
@@ -173,10 +248,11 @@ function toDetail(type) {
async function updateData() {
try {
loading.value = true
const res = await entryManagerDetail({
shopId: route.query.shopId
const res = await shopMerchantGet({
shopId: shopId
})
form.value = (res && res.shopId) ? res : ''
form.value = (res && res.shopDirectMerchant) ? res.shopDirectMerchant
: ''
} catch (error) {
console.log(error);
}

View File

@@ -196,11 +196,17 @@ function dropdownClick(e, row) {
return;
}
if (e.command == 1) {
console.log('row===', row);
// refDetailModal.value.show(e.row);
router.push({
name: 'pay_setting',
query: {
shopId: row.id
shopId: row.id,
shopType: row.shopType,
isHeadShop: row.isHeadShop,
mainId: row.mainId,
shopName: row.shopName
}
})
return;

View File

@@ -8,7 +8,7 @@
</el-icon>
</div>
<div class="info">
<div class="t">支付配置</div>
<div class="t">{{ route.query.shopName }} | 支付配置</div>
<div class="intro">管理您的支付渠道和进件信息</div>
</div>
<div class="center">
@@ -21,48 +21,70 @@
<div class="gyq_content row mt14">
<tabHeader v-model="tabActiveIndex" :list="tabList" />
<payStatusCard name="payStatusCard" key="payStatusCard" ref="payStatusCardRef" v-if="tabActiveIndex == 0" />
<detailModal name="detailModal" key="detailModal" ref="detailModalRef" v-if="tabActiveIndex == 1" />
<detailModal name="detailModal" key="detailModal" ref="detailModalRef" v-model="detail"
v-if="tabActiveIndex == 1" />
</div>
</div>
</template>
<script setup>
import { ref, onMounted, watch } from 'vue'
import { ref, watch, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router';
import detailModal from './components/detailModal.vue';
import payStatusCard from './components/payStatusCard.vue';
import { shopMerchantGet, shopMerchantPut } from '@/api/common'
const route = useRoute()
const router = useRouter()
const payModel = ref(0)
const payModel = ref('')
const tabActiveIndex = ref(0)
const tabList = ref([
{
label: '支付进件',
value: 0
value: 'native'
},
{
label: '聚合支付',
value: 1
value: 'poly'
}
])
// 二次确认支付模式
// 二次确认支付模式 更换支付模式
async function handleRadioChange(value) {
await ElMessageBox.confirm('确定要选择该模式吗?', '注意').then(() => {
payModel.value = value
await ElMessageBox.confirm('确定要选择该模式吗?', '注意').then(async () => {
try {
await shopMerchantPut({
shopId: route.query.shopId,
channel: value
})
payModel.value = value
} catch (error) {
console.log(error);
}
}).catch(() => { })
}
watch(() => tabActiveIndex.value, async (newValue, oldValue) => {
if (newValue == 1) {
await nextTick()
detailModalRef.value.show({ id: route.query.shopId })
}
})
// 与子组件的form绑定
const detail = ref({})
async function shopMerchantGetAjax() {
try {
const res = await shopMerchantGet({ shopId: route.query.shopId })
console.log('shopMerchantGetAjax===', res);
if (res && res.shopId) {
payModel.value = res.channel
const detailModalRef = ref(null)
const payStatusCardRef = ref(null)
if (res && res.polyMerchantDTO) {
detail.value = res.polyMerchantDTO
}
}
} catch (error) {
console.log(error);
}
}
onMounted(() => {
shopMerchantGetAjax()
})
</script>