dev2 #1
36
src/api/syncApp.js
Normal file
36
src/api/syncApp.js
Normal file
@ -0,0 +1,36 @@
|
||||
import request from '@/utils/request'
|
||||
import { stringify } from 'qs'
|
||||
|
||||
export async function getSyncAppList() {
|
||||
return request({
|
||||
url: '/admin/shop/sync-app/list',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
export async function saveSyncApp(data) {
|
||||
return request({
|
||||
url: '/admin/shop/sync-app/saveSyncApp',
|
||||
method: 'post',
|
||||
data:data,
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
}
|
||||
export async function editSyncApp(data) {
|
||||
return request({
|
||||
url: '/admin/shop/sync-app/editSyncApp',
|
||||
method: 'put',
|
||||
data:data,
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
}
|
||||
export async function deleteSyncApp(syncId) {
|
||||
return request({
|
||||
url: '/admin/shop/sync-app/delSyncApp',
|
||||
method: 'delete',
|
||||
params: { syncAppId: syncId },
|
||||
})
|
||||
}
|
||||
@ -34,7 +34,7 @@ export function convertRouter(asyncRoutes) {
|
||||
const obj = {
|
||||
path: '/goodsImgs',
|
||||
component: '@/views/product/goodsImg/goodsImgs',
|
||||
name: 'Vab88000',
|
||||
name: 'Vab88003',
|
||||
redirect: null,
|
||||
meta: {
|
||||
title: '商品图库管理',
|
||||
@ -46,6 +46,23 @@ export function convertRouter(asyncRoutes) {
|
||||
}
|
||||
route.children.push(obj)
|
||||
}
|
||||
if (route.meta.title == '商品' && route.name == 'Vab320') {
|
||||
const obj = {
|
||||
path: '/goodsImport',
|
||||
component: '@/views/product/goodsImport/index',
|
||||
name: 'Vab88004',
|
||||
redirect: null,
|
||||
meta: {
|
||||
title: '商品导入管理',
|
||||
icon: '',
|
||||
noClosable: 0,
|
||||
hidden: null,
|
||||
},
|
||||
menuHidden: false,
|
||||
}
|
||||
|
||||
route.children.push(obj)
|
||||
}
|
||||
if (route.meta.title == '店铺' && route.name == 'Vab330') {
|
||||
const obj = {
|
||||
path: '/storeConf',
|
||||
@ -63,6 +80,23 @@ export function convertRouter(asyncRoutes) {
|
||||
|
||||
route.children.push(obj)
|
||||
}
|
||||
if (route.meta.title == '店铺' && route.name == 'Vab330') {
|
||||
const obj = {
|
||||
path: '/SyncApp',
|
||||
component: '@/views/store/storeSyncApp/index',
|
||||
name: 'Vab88001',
|
||||
redirect: null,
|
||||
meta: {
|
||||
title: '店铺密钥配置',
|
||||
icon: '',
|
||||
noClosable: 0,
|
||||
hidden: null,
|
||||
},
|
||||
menuHidden: false,
|
||||
}
|
||||
|
||||
route.children.push(obj)
|
||||
}
|
||||
|
||||
if (route.meta.title == '店铺' && route.name == 'Vab330') {
|
||||
const obj = {
|
||||
|
||||
155
src/views/store/storeSyncApp/addSyncApp.vue
Normal file
155
src/views/store/storeSyncApp/addSyncApp.vue
Normal file
@ -0,0 +1,155 @@
|
||||
<template>
|
||||
<el-dialog title="新增密钥" width="50%" :visible.sync="visible">
|
||||
<div>
|
||||
<el-form v-model="syncAppForm" label-position="left" label-width="80px">
|
||||
<el-form-item label="app_key" size="normal">
|
||||
<el-input
|
||||
v-model="syncAppForm.app_key"
|
||||
placeholder="请输入app_key"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="app_secret" size="normal">
|
||||
<el-input
|
||||
v-model="syncAppForm.app_secret"
|
||||
placeholder="请输入app_secret"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="店铺" size="normal">
|
||||
<el-select
|
||||
v-model="syncAppForm.store_id"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="选择店铺"
|
||||
style="width: 200px"
|
||||
@change="handleStoreChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in shopList"
|
||||
:key="item.store_id"
|
||||
:label="item.store_name"
|
||||
:value="item.store_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="介绍" size="normal">
|
||||
<el-input
|
||||
v-model="syncAppForm.intro"
|
||||
style="width: 300px"
|
||||
placeholder="请输入介绍"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="syncAppForm.status"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleSyncAppStatus"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in statusList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GoodsToolApi from '@/api/goodsTool'
|
||||
import { saveSyncApp } from '@/api/syncApp.js'
|
||||
export default {
|
||||
name: 'addSyncApp',
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
syncAppForm: {
|
||||
app_key: '',
|
||||
app_secret: '',
|
||||
store_id: '',
|
||||
name: '',
|
||||
intro: '',
|
||||
status: 0,
|
||||
},
|
||||
filter: {
|
||||
productName: '',
|
||||
storeId: '',
|
||||
},
|
||||
shopList: [],
|
||||
statusList: [
|
||||
{
|
||||
label: '可用',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '不可用',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '不校验签名',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getShopList()
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
// 打开弹窗时重置表单,避免残留数据
|
||||
this.syncAppForm = {
|
||||
app_key: '',
|
||||
app_secret: '',
|
||||
store_id: '',
|
||||
name: '',
|
||||
intro: '',
|
||||
status: 1,
|
||||
}
|
||||
this.visible = true
|
||||
},
|
||||
async getShopList() {
|
||||
try {
|
||||
let res = await GoodsToolApi.getShopList()
|
||||
this.shopList = res.data.items || []
|
||||
} catch (error) {
|
||||
console.error('获取店铺列表失败:', error)
|
||||
}
|
||||
},
|
||||
handleStoreChange(storeId) {
|
||||
this.syncAppForm.name = ''
|
||||
const selectedShop = this.shopList.find(
|
||||
(item) => item.store_id === storeId
|
||||
)
|
||||
if (selectedShop) {
|
||||
this.syncAppForm.name = selectedShop.store_name
|
||||
}
|
||||
},
|
||||
async submit() {
|
||||
let res = await saveSyncApp(this.syncAppForm)
|
||||
console.log(res)
|
||||
if (res.status == 200) {
|
||||
this.visible = false
|
||||
this.$emit('success')
|
||||
}
|
||||
},
|
||||
handleSyncAppStatus(e) {
|
||||
this.syncAppForm.status = e
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
131
src/views/store/storeSyncApp/editSync.vue
Normal file
131
src/views/store/storeSyncApp/editSync.vue
Normal file
@ -0,0 +1,131 @@
|
||||
<template>
|
||||
<el-dialog title="编辑密钥" width="50%" :visible.sync="visible">
|
||||
<div>
|
||||
<el-form v-model="syncAppForm" label-position="left" label-width="80px">
|
||||
<el-form-item label="app_key" size="normal">
|
||||
<el-input
|
||||
v-model="syncAppForm.app_key"
|
||||
placeholder="请输入app_key"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="app_secret" size="normal">
|
||||
<el-input
|
||||
v-model="syncAppForm.app_secret"
|
||||
placeholder="请输入app_secret"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="店铺" size="normal">
|
||||
<el-input
|
||||
v-model="syncAppForm.name"
|
||||
style="width: 200px;"
|
||||
disabled
|
||||
clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="介绍" size="normal">
|
||||
<el-input
|
||||
v-model="syncAppForm.intro"
|
||||
style="width: 200px;"
|
||||
placeholder="请输入介绍"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="syncAppForm.status"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleSyncAppStatus"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in statusList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span>
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="changeSumbit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GoodsToolApi from '@/api/goodsTool'
|
||||
import { editSyncApp } from '@/api/syncApp';
|
||||
export default {
|
||||
name: 'editSyncApp',
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
syncAppForm: {
|
||||
app_key: '',
|
||||
app_secret: '',
|
||||
store_id: '',
|
||||
name: '',
|
||||
intro: '',
|
||||
status: 0,
|
||||
},
|
||||
filter: {
|
||||
productName: '',
|
||||
storeId: '',
|
||||
},
|
||||
shopList: [],
|
||||
statusList: [
|
||||
{
|
||||
label: '可用',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '不可用',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '不校验签名',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getShopList()
|
||||
},
|
||||
methods: {
|
||||
open(row) {
|
||||
this.visible = true
|
||||
this.syncAppForm = { ...row }
|
||||
},
|
||||
close(){
|
||||
this.visible=false
|
||||
},
|
||||
async getShopList() {
|
||||
try {
|
||||
let res = await GoodsToolApi.getShopList()
|
||||
this.shopList = res.data.items || []
|
||||
} catch (error) {
|
||||
console.error('获取店铺列表失败:', error)
|
||||
}
|
||||
},
|
||||
async changeSumbit(){
|
||||
let res = await editSyncApp(this.syncAppForm)
|
||||
console.log("sdfasa",res)
|
||||
if(res.status== 200){
|
||||
this.visible=false
|
||||
this.$emit('success')
|
||||
}
|
||||
},
|
||||
handleSyncAppStatus(e) {
|
||||
this.syncAppForm.status = e
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
106
src/views/store/storeSyncApp/index.vue
Normal file
106
src/views/store/storeSyncApp/index.vue
Normal file
@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<div class="db-config-management">
|
||||
<el-card class="list">
|
||||
<div slot="header" class="tool">
|
||||
<el-button type="primary" @click="openAddSyncApp">新增</el-button>
|
||||
</div>
|
||||
|
||||
<el-table border :data="SyncAppList" stripe>
|
||||
<el-table-column label="操作" width="250">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="primary" @click="openEdit(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button size="mini" type="danger" @click="handlerDelete(scope.row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="店铺id" prop="store_id" />
|
||||
<el-table-column label="店铺名字" prop="name" />
|
||||
<el-table-column label="app_key" prop="app_key" />
|
||||
<el-table-column label="密钥" prop="app_secret" />
|
||||
<el-table-column label="店铺介绍" prop="intro" />
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template slot-scope="scope">
|
||||
{{
|
||||
scope.row.status == 1 ? '可用' :
|
||||
scope.row.status == 2 ? '不可用' :
|
||||
scope.row.status == 3 ? '不校验签名':
|
||||
'其他'
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<addSyncApp ref="addSyncAppRef" @success="refreshList"></addSyncApp>
|
||||
<editSync ref="editSyncAppRef" @success="refreshList"></editSync>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addSyncApp from '@/views/store/storeSyncApp/addSyncApp.vue'
|
||||
import editSync from '@/views/store/storeSyncApp/editSync.vue'
|
||||
import {
|
||||
getSyncAppList,
|
||||
saveSyncApp,
|
||||
editSyncApp,
|
||||
deleteSyncApp,
|
||||
} from '@/api/syncApp.js'
|
||||
|
||||
export default {
|
||||
components: { addSyncApp, editSync },
|
||||
data() {
|
||||
return {
|
||||
addSyncAppRef: null,
|
||||
editSyncAppRef: null,
|
||||
SyncAppList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getSyncList()
|
||||
},
|
||||
methods: {
|
||||
openAddSyncApp() {
|
||||
this.$refs.addSyncAppRef?.open()
|
||||
},
|
||||
openEdit(row) {
|
||||
this.$refs.editSyncAppRef?.open(row)
|
||||
},
|
||||
async getSyncList() {
|
||||
const res = await getSyncAppList()
|
||||
this.SyncAppList = res.records
|
||||
},
|
||||
refreshList(){
|
||||
this.getSyncList()
|
||||
},
|
||||
async handlerDelete(id) {
|
||||
try {
|
||||
await this.$confirm(
|
||||
'此操作将永久删除该条记录, 是否继续?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
const res = await deleteSyncApp(id)
|
||||
if(res.status==200){
|
||||
this.$message.success('删除成功!')
|
||||
this.getSyncList()
|
||||
}
|
||||
} catch (error) {
|
||||
if (error !== 'cancel') {
|
||||
this.$message.error('删除失败!')
|
||||
console.error('删除出错:', error)
|
||||
} else {
|
||||
this.$message.info('已取消删除')
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
Loading…
Reference in New Issue
Block a user