release(custom): i
This commit is contained in:
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user