release(custom): i

This commit is contained in:
2023-10-10 15:01:00 +08:00
parent a9707c6d94
commit 5b33290de6
78 changed files with 13003 additions and 5230 deletions

View File

@@ -0,0 +1,6 @@
import { request } from '@/utils'
export default {
getList: (data) => request.post('/store/classify', data),
addClass: (data) => request.post('/store/classify/edit', data),
}

View File

@@ -0,0 +1,191 @@
<template>
<CommonPage show-footer :title="$route.title">
<n-button v-perms="['/admin/store/classify/edit']" type="primary" @click="handleAdd(1)">
新增商户分类
</n-button>
<!-- {{ formValue }} -->
<n-data-table
:loading="loading"
:columns="columns"
:data="data"
:pagination="pagination"
:bordered="false"
remote
/>
<n-modal v-model:show="showModal">
<n-card
style="width: 400px"
:title="modelTitle"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<n-form ref="formRef" label-placement="left" :model="formValue" :rules="rules">
<n-form-item label="分类名称:" path="name">
<n-input v-model:value="formValue.name" placeholder="请输入商户分类名称" />
</n-form-item>
<n-form-item label="分类状态:" path="status">
<n-switch v-model:value="formValue.status" :checked-value="1" :unchecked-value="2" />
</n-form-item>
<n-form-item>
<div class="m-auto">
<n-button
class="m-auto"
type="primary"
attr-type="button"
@click="handleValidateClick"
>
提交
</n-button>
<n-button class="ml-10" @click="clear">取消</n-button>
</div>
</n-form-item>
</n-form>
</n-card>
</n-modal>
</CommonPage>
</template>
<script setup>
import { onMounted, h, withDirectives, resolveDirective } from 'vue'
import api from './api'
import { NButton } from 'naive-ui'
const vPerms = resolveDirective('perms')
const loading = ref(false)
const columns = ref([
{
title: 'ID',
align: 'center',
key: 'ID',
},
{
title: '分类名称',
align: 'center',
key: 'name',
},
{
title: '状态',
align: 'center',
slot: 'status',
render(row) {
return h('span', row.status === 1 ? '正常' : '禁用')
},
},
{
title: '操作',
align: 'center',
slot: 'action',
render(row) {
return [
withDirectives(
h(
NButton,
{
type: 'primary',
size: 'small',
onClick: () => {
formValue.value = row
handleAdd(2)
},
},
() => '编辑'
),
[[vPerms, ['/admin/store/classify/edit']]]
),
]
},
},
])
const data = ref([])
const formRef = ref(null)
const rules = {
name: {
required: true,
message: '请输入商户分类名称',
},
}
const formValue = ref({
ID: 0,
name: '',
status: 1,
})
const showModal = ref(false)
const pagination = ref({
page: 1,
pageSize: 10,
itemCount: 0,
onChange: (page) => {
pagination.value.page = page
getList()
},
onUpdatePageSize: (pageSize) => {
pagination.value.pageSize = pageSize
pagination.value.page = 1
getList()
},
})
onMounted(() => {
getList()
})
const getList = async () => {
loading.value = true
try {
const res = await api.getList({
pageNum: pagination.value.page,
pageSize: pagination.value.pageSize,
})
data.value = res.data.data
pagination.value.itemCount = res.data.total
} catch (error) {
$message.error(error.msg)
}
loading.value = false
}
const modelTitle = ref('')
const handleAdd = (e) => {
modelTitle.value = e === 1 ? '新增商户分类' : '编辑商户分类'
showModal.value = true
}
const clear = () => {
formValue.value = {
ID: 0,
name: '',
status: 1,
}
showModal.value = false
}
const handleValidateClick = async (e) => {
e.preventDefault()
formRef.value?.validate(async (errors) => {
if (!errors) {
try {
await api.addClass(formValue.value)
$message.success('成功')
clear()
getList()
} catch (error) {
$message.error(error.msg)
}
} else {
$message.error('Invalid')
}
})
}
</script>
<style lang="scss" scoped></style>

View File

@@ -4,4 +4,6 @@ export default {
getList: (data) => request.post('/store', data),
addMer: (data) => request.post('/store/edit', data),
getMerType: () => request.post('/store/getOther'),
// 一键登录
login: (data) => request.post('/store/easy/login', data),
}

View File

@@ -1,7 +1,7 @@
<template>
<CommonPage show-footer :title="$route.title">
<!-- {{ formValue }} -->
<n-button type="primary" @click="handleAdd(1)">新增商户</n-button>
<n-button v-perms="['/store/edit']" type="primary" @click="handleAdd(1)">新增商户</n-button>
<n-grid class="mb-10" x-gap="12" cols="6" collapsed>
<n-gi>
<div class="flex items-center">
@@ -41,6 +41,7 @@
:data="data"
:pagination="pagination"
:bordered="false"
remote
/>
<n-drawer v-model:show="showModal" :width="502" placement="right">
@@ -54,23 +55,26 @@
:rules="rules"
size="medium"
>
<!-- <n-form-item label="商户头像:" path="img">
<n-upload
v-model:file-list="formValue.img"
action="https://www.mocky.io/v2/5e4bafc63100007100d8b70f"
list-type="image-card"
>
点击上传
</n-upload>
</n-form-item> -->
<n-form-item label="商户名称:" path="name">
<n-input v-model:value="formValue.name" placeholder="请输入商户名称" />
<n-input
v-model:value="formValue.name"
:disabled="isEdit"
placeholder="请输入商户名称"
/>
</n-form-item>
<n-form-item label="负责人姓名:" path="username">
<n-input v-model:value="formValue.username" placeholder="请输入负责人姓名" />
<n-input
v-model:value="formValue.username"
:disabled="isEdit"
placeholder="请输入负责人姓名"
/>
</n-form-item>
<n-form-item label="商户手机号:" path="phone">
<n-input v-model:value="formValue.phone" placeholder="请输入商户手机号" />
<n-input
v-model:value="formValue.phone"
:disabled="isEdit"
placeholder="请输入商户手机号"
/>
</n-form-item>
<n-form-item label="商户座机:" path="mobile">
<n-input v-model:value="formValue.mobile" placeholder="请输入商户座机" />
@@ -88,13 +92,12 @@
:options="classOptions"
/>
</n-form-item>
<!-- <n-form-item label="商户经纬度:" path="local">
<n-input v-model:value="formValue.local" placeholder="请输入商户地址" />
<div ref="wrapRef" class="h-300 w-300"></div>
</n-form-item> -->
<n-form-item label="商户密码:" path="password">
<n-form-item v-if="!isEdit" label="商户密码:" path="password">
<n-input v-model:value="formValue.password" placeholder="请输入商户密码" />
</n-form-item>
<n-form-item v-else label="修改密码:" path="password">
<n-input v-model:value="formValue.password" placeholder="不修改密码请留空" />
</n-form-item>
<n-form-item label="商户类型:" path="bType">
<n-select
v-model:value="formValue.bType"
@@ -137,7 +140,7 @@
>
提交
</n-button>
<n-button class="m-auto w-200" @click="handleClearValidateClick">重置</n-button>
<!-- <n-button class="m-auto w-200" @click="handleClearValidateClick">重置</n-button> -->
</n-form-item>
</n-form>
</n-drawer-content>
@@ -146,10 +149,12 @@
</template>
<script setup>
import { onMounted, ref, h, unref, nextTick } from 'vue'
import { onMounted, ref, h, withDirectives, resolveDirective } from 'vue'
import { NButton } from 'naive-ui'
import api from './api'
import { useScript } from '@/hooks/useScript'
const vPerms = resolveDirective('perms')
const isEdit = computed(() => (drawerTitle.value === '编辑商户' ? true : false))
const columns = ref([
{
@@ -177,19 +182,47 @@ const columns = ref([
title: '操作',
align: 'center',
slot: 'action',
render(row) {
render: (row) => {
return [
h(
NButton,
{
type: 'primary',
size: 'small',
onClick: () => {
formValue.value = row
handleAdd(2)
withDirectives(
h(
NButton,
{
type: 'primary',
text: true,
size: 'small',
onClick: () => {
formValue.value = { ...row }
Reflect.deleteProperty(formValue.value, 'password')
handleAdd(2)
},
},
},
() => '编辑'
() => '编辑'
),
[[vPerms, ['/admin/store/edit']]]
),
withDirectives(
h(
NButton,
{
class: 'ml-10',
type: 'primary',
text: true,
size: 'small',
onClick: async () => {
const res = await api.login({
bid: row.bid,
})
window.open(
`${import.meta.env.VITE_MER_LOGIN_URL}?redirect=/workbench&type=${
res.data.type
}&tk=${res.data.token}`
)
},
},
() => '一键登录'
),
[[vPerms, ['/admin/store/login']]]
),
]
},
@@ -204,12 +237,12 @@ const showModal = ref(false)
const formRef = ref(null)
const drawerTitle = ref('')
const drawerTitle = ref('新增商户')
const pagination = ref({
current: 1,
page: 1,
pageSize: 10,
total: 0,
itemCount: 0,
onChange: (page) => {
pagination.value.page = page
getList()
@@ -226,21 +259,6 @@ const QuryVal = ref({
Status: null,
})
// const defaultValueRef = () => ({
// name: '',
// username: '',
// phone: '',
// mobile: '',
// address: '',
// classId: null,
// local: '',
// password: '',
// bType: null,
// scaleType: null,
// scale: null,
// status: 2,
// })
let formValue = ref({
name: '',
username: '',
@@ -323,42 +341,20 @@ const rules = {
},
}
const wrapRef = ref(null)
const MapUrl =
'https://map.qq.com/api/gljs?v=1.exp&key=S3GBZ-WR26O-IXNW2-SXBOD-LZXV6-WAFNO&callback=initMap'
const { toPromise } = useScript({ src: MapUrl })
onMounted(() => {
initMap()
getList()
getMertype()
})
const initMap = async () => {
await toPromise()
await nextTick()
const wrapEl = unref(wrapRef.value)
if (!wrapEl) return
const TMap = window?.TMap
const center = new TMap.Map.LatLng(39.984104, 116.307503)
const map = new TMap.Map.Map(wrapEl, {
rotation: 20, //设置地图旋转角度
pitch: 30, //设置俯仰角度0~45
zoom: 12, //设置地图缩放级别
center: center, //设置地图中心点坐标
})
console.log(map)
}
const getList = async () => {
loading.value = true
const res = await api.getList({
...QuryVal.value,
PageNum: pagination.value.current,
PageNum: pagination.value.page,
PageSize: pagination.value.pageSize,
})
data.value = res.data.data
data.value = res.data.data || []
pagination.value.itemCount = res.data.total
loading.value = false
}
@@ -374,7 +370,7 @@ const getMertype = async () => {
const clearQuryVal = () => {
QuryVal.value = {
StoreName: '',
Status: '',
Status: null,
}
getList()
}
@@ -384,14 +380,6 @@ const handleAdd = (e) => {
showModal.value = true
}
// const onPositiveClick = () => {
// showModal.value = false
// }
// const onNegativeClick = () => {
// showModal.value = false
// }
const handleValidateClick = (e) => {
e.preventDefault()
formRef.value?.validate(async (errors) => {

View File

@@ -1,6 +1,8 @@
<template>
<CommonPage show-footer :title="$route.title">
<n-button type="primary" @click="handleAdd(1)">新增商户类型</n-button>
<n-button v-perms="['/admin/typesof/edit']" type="primary" @click="handleAdd(1)">
新增商户类型
</n-button>
<!-- {{ formValue }} -->
<n-data-table
:loading="loading"
@@ -8,6 +10,7 @@
:data="data"
:pagination="pagination"
:bordered="false"
remote
/>
<n-modal v-model:show="showModal">
<n-card
@@ -45,9 +48,10 @@
</template>
<script setup>
import { onMounted, h } from 'vue'
import { onMounted, h, withDirectives, resolveDirective } from 'vue'
import api from './api'
import { NButton } from 'naive-ui'
const vPerms = resolveDirective('perms')
const loading = ref(false)
@@ -76,17 +80,20 @@ const columns = ref([
slot: 'action',
render(row) {
return [
h(
NButton,
{
type: 'primary',
size: 'small',
onClick: () => {
formValue.value = row
handleAdd(2)
withDirectives(
h(
NButton,
{
type: 'primary',
size: 'small',
onClick: () => {
formValue.value = row
handleAdd(2)
},
},
},
() => '编辑'
() => '编辑'
),
[[vPerms, ['/admin/typesof/edit']]]
),
]
},
@@ -112,9 +119,9 @@ const formValue = ref({
const showModal = ref(false)
const pagination = ref({
current: 1,
page: 1,
pageSize: 10,
total: 0,
itemCount: 0,
onChange: (page) => {
pagination.value.page = page
getList()
@@ -134,11 +141,11 @@ const getList = async () => {
loading.value = true
try {
const res = await api.getMerType({
pageNum: pagination.value.current,
pageNum: pagination.value.page,
pageSize: pagination.value.pageSize,
})
console.log(res)
data.value = res.data.data
pagination.value.itemCount = res.data.total
} catch (error) {
$message.error(error.msg)
}

View File

@@ -0,0 +1,8 @@
import { request } from '@/utils'
export default {
// 获取入驻审核列表
getAuditList: (data) => request.post('/process/store', data),
// 通过审核/不通过
passAudit: (data) => request.post('/process/store/edit', data),
}

View File

@@ -1,7 +1,209 @@
<template>
<CommonPage show-footer :title="$route.title"></CommonPage>
<CommonPage show-footer :title="$route.title">
<n-data-table
:loading="loading"
:columns="columns"
:data="data"
:pagination="pagination"
:bordered="false"
remote
/>
<!-- 详情 -->
<n-drawer v-model:show="active" :width="502" placement="right">
<n-drawer-content title="商户入驻详情">
<div>
<div>商户名称:{{ nowRow.name }}</div>
<div mt-10>用户姓名:{{ nowRow.username }}</div>
<div mt-10>联系电话:{{ nowRow.phone }}</div>
<div mt-10>开户行:{{ nowRow.bank }}</div>
<div mt-10>银行卡号:{{ nowRow.bank_card }}</div>
<div mt-10>商户类型:{{ atype.name }}</div>
<div mt-10>经营类目:{{ btype.name }}</div>
<div mt-10>
<div>营业执照:</div>
<n-image width="100" :src="nowRow.license" />
</div>
<div mt-10>
<div>法人身份证正面:</div>
<n-image width="100" :src="nowRow.front" />
</div>
<div mt-10>
<div>法人身份证反面:</div>
<n-image width="100" :src="nowRow.back" />
</div>
<div mt-10>
<div>门头照:</div>
<n-image-group>
<n-image
v-for="(item, index) in nowRow.img"
:key="index"
mr-10
width="100"
:src="item"
/>
</n-image-group>
</div>
</div>
<div m-auto w-full flex justify-center>
<n-button mr-20 type="primary" @click="ok">通过</n-button>
<n-button mr-20 type="warning" @click="noOk">不通过</n-button>
<n-button @click="active = false">关闭</n-button>
</div>
</n-drawer-content>
</n-drawer>
</CommonPage>
</template>
<script setup></script>
<script setup>
import { h, withDirectives, resolveDirective } from 'vue'
import api from './api'
import api1 from '../mer_list/api'
import { NButton } from 'naive-ui'
const vPerms = resolveDirective('perms')
const loading = ref(false)
const nowRow = ref({})
const active = ref(false)
const columns = ref([
{
title: '商户名称',
align: 'center',
key: 'name',
},
{
title: '用户姓名',
align: 'center',
key: 'username',
},
{
title: '联系电话',
align: 'center',
key: 'phone',
},
{
title: '开户银行',
align: 'center',
key: 'bank',
},
{
title: '银行卡号',
align: 'center',
key: 'bank_card',
},
{
title: '操作',
align: 'center',
slot: 'detail',
render: (row) => {
return [
withDirectives(
h(
NButton,
{
type: 'primary',
text: true,
onClick: () => {
nowRow.value = {
...row,
img: row.img.split(','),
}
active.value = true
},
},
{
default: () => '详情',
}
),
[[vPerms, ['/admin/process/store/edit']]]
),
]
},
},
])
const data = ref([])
const pagination = ref({
page: 1,
pageSize: 10,
itemCount: 0,
onChange: (page) => {
pagination.value.page = page
},
})
onMounted(() => {
getData()
getMertype()
})
const getData = async () => {
loading.value = true
const res = await api.getAuditList({
pageNum: pagination.value.page,
pageSize: pagination.value.pageSize,
})
data.value = res.data.data || []
pagination.value.itemCount = res.data.total
loading.value = false
}
const classOptions = ref([])
const typeOptions = ref([])
const getMertype = async () => {
const res = await api1.getMerType()
classOptions.value = res.data.class
typeOptions.value = res.data.type
}
const atype = computed(() => {
return typeOptions.value.find((item) => {
if (item.ID === nowRow.value.bType) return item
})
})
const btype = computed(() => {
return classOptions.value.find((item) => {
if (item.ID === nowRow.value.classId) return item
})
})
const ok = async () => {
$dialog.warning({
title: '提示',
content: '同意后无法撤销,确认同意吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
const res = await api.passAudit({
bid: nowRow.value.bid,
status: 1,
})
$message.success(res.msg)
clear()
},
onNegativeClick: () => {
$message.warning('已取消操作')
},
})
}
const noOk = async () => {
const res = await api.passAudit({
bid: nowRow.value.bid,
status: 2,
})
$message.success(res.msg)
clear()
}
const clear = () => {
nowRow.value = {}
active.value = false
getData()
}
</script>
<style lang="scss" scoped></style>

View File

@@ -5,6 +5,11 @@ export default {
path: '/merchant',
component: Layout,
redirect: '/mer_list',
meta: {
title: '商户管理',
icon: 'mdi:account-multiple',
order: 10,
},
children: [
{
name: 'Merlist',
@@ -16,6 +21,16 @@ export default {
order: 10,
},
},
{
name: 'Classlist',
path: 'mer_class',
component: () => import('./mer_class/index.vue'),
meta: {
title: '商户分类',
icon: 'mdi:account-multiple',
order: 10,
},
},
{
name: 'Mertype',
path: 'mer_type',