支付中台

feature/pay-0704-ch
ch 2 years ago
parent 2a2203eed9
commit 9279a7d6cb

@ -0,0 +1,22 @@
/*
* @Author: ch
* @Date: 2022-07-04 15:20:02
* @LastEditors: ch
* @LastEditTime: 2022-07-04 15:50:39
* @Description: file content
*/
import request from '@/utils/request.js';
export const getMerchantList = (params) => {
return request({
url: '/payCenter/mchInfo/page',
method: 'get',
params,
});
};
export const getMerchantPlatform = (params) => {
return request({
url: '/payCenter/mchInfo/mchCode',
method: 'get',
params,
});
};

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-06-07 15:41:05
* @LastEditors: ch
* @LastEditTime: 2022-06-14 15:26:44
* @LastEditTime: 2022-07-04 11:34:14
* @Description: file content
*/
import * as api from '@/api/chat';
@ -166,7 +166,7 @@ const actions = {
/**
* 提交转移会话
*/
submitTransferSession: ({}, data) => {
submitTransferSession: (context, data) => {
return api
.transferCustomerService({
storeId: 1,

@ -150,10 +150,6 @@ const actions = {
data.commentTimeBegin = data.dateRange[0];
data.commentTimeEnd = data.dateRange[1];
}
if (data.scoreList) {
data.commentScoreList = data.scoreList.join(',');
delete data.scoreList;
}
delete data.dateRange;
delete data.pagingCode;
const res = await api.commentList({
@ -171,7 +167,7 @@ const actions = {
commit('setTotal', res?.total || 0);
}
},
async updateShow({}, params) {
async updateShow(context, params) {
const res = await api.updateCommentShow(params);
if (!res) {
ElMessage.error('状态更新失败!');
@ -188,7 +184,7 @@ const actions = {
commit('setDetail', res);
return Promise.resolve(res);
},
async add({}, data) {
async add(context, data) {
const res = await api.commentAdd(data);
if (!res) {
ElMessage.error('回复失败');

@ -0,0 +1,60 @@
/*
* @Author: ch
* @Date: 2022-07-04 15:21:30
* @LastEditors: ch
* @LastEditTime: 2022-07-04 16:22:14
* @Description: file content
*/
import * as api from '@/api/pay/merchant.js';
const state = {
list: [],
detail: {},
total: 0,
opts: {
status: [
{
value: false,
label: '启用',
},
{
value: true,
label: '禁用',
},
],
platform: [],
},
};
const getters = {};
const mutations = {
setList: (state, data) => (state.list = data),
setPlatform: (state, data) => (state.opts.platform = data),
setTotal: (state, data) => (state.total = data),
setDetail: (state, data) => (state.detail = data),
};
const actions = {
async search({ rootGetters, commit }, params) {
let data = { ...params };
let pagingCode = params.pagingCode;
const res = await api.getMerchantList({
...rootGetters['local/page'](pagingCode),
...data,
});
if (res) {
commit('setList', res?.records || []);
commit('setTotal', res?.total || 0);
}
},
async getMerchantPlatform({ commit }, params) {
const res = await api.getMerchantPlatform();
if (res) {
commit('setPlatform', res || []);
}
},
};
export default {
state,
getters,
mutations,
actions,
};

@ -0,0 +1,166 @@
<!--
* @Author: ch
* @Date: 2022-06-15 17:29:32
* @LastEditors: ch
* @LastEditTime: 2022-07-04 16:12:49
* @Description: file content
-->
<template>
<table-list
v-loading="loading"
:operation="['search']"
:code="_pagingCode"
:config="config"
:data="list"
:total="total"
@search="handleSearch"
:reset="handleReset"
>
<template #search>
<el-form inline>
<el-form-item label="商户名称">
<el-input v-model="state.condition.mchName" />
</el-form-item>
<el-form-item label="商户ID">
<el-input v-model="state.condition.mchId" />
</el-form-item>
<el-form-item label="商户平台">
<el-select v-model="state.condition.mchCode">
<el-option
v-for="(item, idx) in opts.platform"
:key="idx"
:label="item.text"
:value="item.code"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="商户状态">
<el-select v-model="state.condition.isDisabled">
<el-option
v-for="(item, idx) in opts.status"
:key="idx"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
</template>
<template #operation="{ selection }">
<div class="batch-show-hide" v-if="selection.length">
<el-select v-model="allShowHideVal">
<el-option
v-for="(item, idx) in opts.isShow"
:key="idx"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
<el-button type="primary" @click="handleAllShowHide(selection)"></el-button>
</div>
</template>
</table-list>
</template>
<script setup lang="jsx">
import ElButton from '@/components/extra/ElButton.vue';
import ElSwitch from '@/components/extra/ElSwitch.vue';
const router = useRouter();
const store = useStore();
const loading = ref(false);
//
const opts = computed(() => store.state.merchant.opts);
//
const list = computed(() => _.cloneDeep(store.state.merchant.list));
const total = computed(() => store.state.merchant.total);
// code使codesotre
const _pagingCode = 'PayMerchantManagement';
//
const _condition = {
mchCode: '',
mchId: '',
mchName: '',
isDisabled: null,
};
const state = reactive({
condition: { ..._condition },
});
/**
* 搜索
*/
const handleSearch = async () => {
loading.value = true;
await store.dispatch('merchant/search', { ...state.condition, pagingCode: _pagingCode });
loading.value = false;
};
store.dispatch('merchant/getMerchantPlatform');
onActivated(handleSearch);
/**
* 重置
*/
const handleReset = () => {
state.condition = { ..._condition };
};
const config = reactive({
columns: [
{
label: '商户名称',
align: 'left',
prop: 'mchName',
},
{
label: '商户ID',
align: 'left',
prop: 'mchId',
},
{
label: '商户平台',
width: 180,
slots: {
default: ({ row }) => ({ opts }),
},
},
{
label: '商户状态',
width: 120,
prop: 'isDisabledDesc',
},
{
label: '创建时间',
prop: 'createTime',
width: 120,
},
{
label: '操作',
width: 70,
slots: {
default: ({ row }) => (
<ElButton type="text" onClick={() => handleDetail(row.id)}>
查看
</ElButton>
),
},
},
],
});
</script>
<style lang="less" scoped>
.batch-show-hide {
margin-left: 20px;
}
:deep(.row-ellipsis) {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
:deep(.ctx-link) {
cursor: pointer;
&:hover {
color: var(--el-color-primary);
}
}
</style>

@ -0,0 +1,242 @@
<!--
* @Author: ch
* @Date: 2022-06-15 17:29:32
* @LastEditors: ch
* @LastEditTime: 2022-07-04 11:38:11
* @Description: file content
-->
<template>
<div>
<table-list
v-loading="loading"
:operation="['search']"
:code="_pagingCode"
:config="config"
:data="list"
:total="total"
@search="handleSearch"
:reset="handleReset"
>
<template #search>
<el-form inline>
<el-form-item label="商户平台" prop="productName">
<el-input v-model="state.condition.productName" />
</el-form-item>
<el-form-item label="商户名称">
<el-input v-model="state.condition.userName" />
</el-form-item>
<el-form-item label="商户ID" prop="phone">
<el-input v-model="state.condition.phone" />
</el-form-item>
<el-form-item label="商户状态" prop="status">
<el-select v-model="state.condition.isShow">
<el-option
v-for="(item, idx) in opts.isShow"
:key="idx"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
</template>
<template #operation="{ selection }">
<div class="batch-show-hide" v-if="selection.length">
<el-select v-model="allShowHideVal">
<el-option
v-for="(item, idx) in opts.isShow"
:key="idx"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
<el-button type="primary" @click="handleAllShowHide(selection)"></el-button>
</div>
</template>
</table-list>
</div>
</template>
<script setup lang="jsx">
import ElButton from '@/components/extra/ElButton.vue';
import ElSwitch from '@/components/extra/ElSwitch.vue';
const router = useRouter();
const store = useStore();
const loading = ref(false);
//
const opts = computed(() => store.state.comment.opts);
//
const list = computed(() => _.cloneDeep(store.state.comment.list));
const total = computed(() => store.state.comment.total);
// code使codesotre
const _pagingCode = 'CommentManagement';
//
const _condition = {
productName: '',
userName: '',
phone: '',
scoreList: [],
isShow: '',
dateRange: '',
};
const state = reactive({
condition: { ..._condition },
});
//
const allShowHideVal = ref(true);
// store.dispatch('comment/search', { pagingCode: _pagingCode });
/**
* 搜索
*/
const handleSearch = async () => {
loading.value = true;
await store.dispatch('comment/search', { ...state.condition, pagingCode: _pagingCode });
loading.value = false;
};
onActivated(handleSearch);
/**
* 重置
*/
const handleReset = () => {
state.condition = { ..._condition };
};
/**
* 单行操作显示隐藏
*
*/
const handleShowHide = async (row) => {
loading.value = true;
try {
await store.dispatch('comment/updateShow', {
idList: [row.id],
isShow: row.isShow,
});
} catch (e) {
row.isShow = !row.isShow;
}
loading.value = false;
};
/**
* 批量操作显示隐藏
*/
const handleAllShowHide = async (selection) => {
loading.value = true;
let val = allShowHideVal.value;
try {
await store.dispatch('comment/updateShow', {
idList: selection.map((i) => i.id),
isShow: val,
});
} catch (e) {
val = !val;
}
loading.value = false;
selection.forEach((item) => {
item.isShow = val;
});
};
const handleDetail = (id) => {
router.push({
name: 'CommentDetail',
params: {
id: id,
},
});
};
const config = reactive({
columns: [
{
type: 'selection',
fixed: 'left',
width: 60,
},
{
label: '商品名称',
width: 180,
align: 'left',
slots: {
default: ({ row }) => <div class="row-ellipsis">{row.productName}</div>,
},
},
{
label: '评价内容',
align: 'left',
slots: {
default: ({ row }) => (
<div class="row-ellipsis ctx-link" onClick={() => handleDetail(row.id)}>
{row.commentContent}
</div>
),
},
},
{
label: '评分',
prop: 'scoreName',
width: 70,
},
{
label: '用户',
width: 120,
slots: {
default: ({ row }) => (
<div>
<p class="row-ellipsis">{row.userName}</p>
<p>{row.phone}</p>
</div>
),
},
},
{
label: '评价时间',
prop: 'time',
width: 120,
slots: {
default: ({ row }) => (
<div>
<p>{row.createTime.split(' ')[0]}</p>
<p>{row.createTime.split(' ')[1]}</p>
</div>
),
},
},
{
label: '显示',
width: 80,
slots: {
default: ({ row }) => <ElSwitch v-model={row.isShow} onChange={() => handleShowHide(row)} />,
},
},
{
label: '操作',
width: 70,
slots: {
default: ({ row }) => (
<ElButton type="text" onClick={() => handleDetail(row.id)}>
查看
</ElButton>
),
},
},
],
});
</script>
<style lang="less" scoped>
.batch-show-hide {
margin-left: 20px;
}
:deep(.row-ellipsis) {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
:deep(.ctx-link) {
cursor: pointer;
&:hover {
color: var(--el-color-primary);
}
}
</style>
Loading…
Cancel
Save