main
liudan 10 months ago
parent 114f2a3c82
commit 467f1f72c0
  1. 4
      src/api/api.config.js
  2. 37
      src/api/store.js
  3. 15
      src/config/router.config.js
  4. 4
      src/core/lazy_lib/components_use.js
  5. 193
      src/views/dataCenter/originData.vue
  6. 64
      src/views/store/index.vue

@ -29,6 +29,10 @@ export default {
default: 'store.module/default',
detail: 'store.module/detail',
edit: 'store.module/edit',
dataList:'store/platformList',
getStorePlatform:'store/getStorePlatform',
setStorePlatform:'store/auth',
getGoodsList:'/goods/index',
},
// 商家后台api权限

@ -84,3 +84,40 @@ export function move (data) {
data: data
})
}
/**
* 获取数据授权
* @param {*} data
*/
export function getDataList (data) {
return axios({
url: api.store.module.dataList,
method: 'post',
data: data
})
}
/**
* 获取数据授权平台列表
* @param {*} data
*/
export function getStorePlatform (params) {
return axios({
url: api.store.module.getStorePlatform,
method: 'get',
})
}
export function setStorePlatform (data) {
return axios({
url: api.store.module.setStorePlatform,
method: 'post',
data: data
})
}
export function getGoodsList (params) {
return axios({
url: api.store.module.getGoodsList,
method: 'get',
params
})
}

@ -50,6 +50,21 @@ export const asyncRouterMap = [
}
]
},
{
name: 'dataCenter',
path: 'dataCenter',
redirect: '/dataCenter/originData',
component: PageView,
meta: { title: '数据中心', keepAlive: true, icon: Icon['menu'], permission: ['access'] },
children: [
{
path: '/dataCenter/originData',
component: () => import(/* webpackChunkName: "menu" */ '@/views/dataCenter/originData'),
meta: { title: '原始数据', keepAlive: true, permission: ['access'] }
},
]
},
{
name: 'Setting',

@ -47,7 +47,8 @@ import {
Skeleton,
Popconfirm,
message,
notification
notification,
pagination
} from 'ant-design-vue'
import Tree from '@/components/tree'
@ -91,6 +92,7 @@ Vue.use(Progress)
Vue.use(Skeleton)
Vue.use(Popconfirm)
Vue.use(notification)
Vue.use(pagination)
Vue.use(Tree)

@ -0,0 +1,193 @@
<template>
<a-card :bordered="false" class="originData">
<content-header title="原始数据"></content-header>
<div class="formContent">
<div class="formItem">
<span class="formTitle">来源</span>
<a-select @change="getChannel" style="width: 120px" placeholder="请选择">
<a-select-option :value="item.id" v-for="(item) in checkList" :key="item.id">
{{item.name}}
</a-select-option>
</a-select>
</div>
<div class="formItem">
<span class="formTitle">获取时间</span>
<a-range-picker/>
</div>
<div>
<a-button type="primary" style="margin-left:10px;" @click="getList">查询</a-button>
</div>
</div>
<a-table :pagination="false" :columns="columns" rowKey="id" :data-source="tableData">
<a slot="channel" slot-scope="text">{{ getLable(item) }}</a>
<span slot="customTitle"><a-icon type="smile-o" /> Name</span>
<!-- <span slot="tags" slot-scope="tags">
<a-tag
v-for="tag in tags"
:key="tag"
:color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'"
>
{{ tag.toUpperCase() }}
</a-tag>
</span> -->
<span slot="action" slot-scope="text, record">
<a>编辑</a>
<a style="margin-left:10px;">删除</a>
</span>
</a-table>
<div style="text-align: right;margin-top:10px;">
<a-pagination
v-model="page"
:page-size-options="pageSizeOptions"
:total="total"
@change="changePageIndex"
show-size-changer
:page-size="per_page"
@showSizeChange="onShowSizeChange"
>
<template slot="buildOptionText" slot-scope="props">
<span>{{ props.value }}/</span>
</template>
</a-pagination>
</div>
</a-card>
</template>
<script>
import * as Api from '@/api/store'
import { ContentHeader, STable } from '@/components'
export default {
components: {
ContentHeader,
STable,
},
data () {
return {
formInline: {
source: '',
},
tableData:[],
//
columns: [
{
title: 'ID',
dataIndex: 'id'
},
{
title: '编码',
dataIndex: 'catalog_code'
},
{
title: '名称',
dataIndex: 'catalog_name'
},
{
title: '价格',
dataIndex: 'cost_price'
},
{
title: '分类',
dataIndex: 'bu_name'
},
{
title: '来源',
dataIndex: 'channel'
},
{
title: '添加时间',
dataIndex: 'create_time'
},
{
title: '更新时间',
dataIndex: 'update_time'
},
{
title: '操作',
dataIndex: 'action',
width: '100px',
scopedSlots: { customRender: 'action' }
}
],
total:0,
pageSizeOptions: ['15', '25', '50', '100'],
page: 1,
per_page: 15,
checkList:[],
channel:null
}
},
created () {
this.getDataList()
this.getList()
},
methods: {
/**
* 刷新列表
*/
// handleRefresh () {
// this.$refs.table.refresh()
// },
onShowSizeChange(page, per_page) {
this.per_page = per_page;
this.getList()
},
changePageIndex(index){
console.log(index)
this.page = index;
this.getList()
},
getDataList(){
return Api.getDataList().then(result => {
let obj = result.data;
Object.keys(obj).forEach(item=>{
this.checkList.push({id:item,name:obj[item]})
})
})
},
getChannel(val){
this.channel = val;
},
getList(){
console.log(this.channel)
let params={
channel:this.channel,
page:this.page,
per_page:this.per_page
}
return Api.getGoodsList(params).then(res => {
this.tableData = res.data.list.data;
this.total = res.data.list.total;
console.log(res)
})
},
getLable(item){
console.log(item)
}
}
}
</script>
<style scoped>
.formContent{
display: flex;
margin-bottom: 10px;
}
.formContent .formItem{
display: flex;
align-items: center;
}
.formContent .formItem .formTitle{
display: inline-block;
width:70px;
text-align: right;
margin-right:10px;
}
</style>

@ -14,6 +14,7 @@
:pageSize="15"
>
<span class="actions" slot="action" slot-scope="text, item">
<a @click="getPlatFormItem(item)">数据授权</a>
<a @click="handleInto(item)">进入商城</a>
<a @click="handleDelete(item)">删除</a>
<a @click="handleModule(item)">功能模块</a>
@ -21,6 +22,22 @@
</s-table>
<create-form ref="createModal" @handleSubmit="handleRefresh" />
<ModuleForm ref="ModuleForm" @handleSubmit="handleRefresh" />
<a-modal v-model:open="open" title="数据授权" @ok="handleOk">
<div>
<a-checkbox-group @change="onChange" :value="checkedList">
<a-row>
<a-col :span="24">
<a-checkbox :value="item.id" v-for="(item,index) in checkList" :key="index">
{{item.name}}
</a-checkbox>
</a-col>
</a-row>
</a-checkbox-group>
</div>
</a-modal>
</a-card>
</template>
@ -63,7 +80,7 @@ export default {
{
title: '操作',
dataIndex: 'action',
width: '200px',
width: '300px',
scopedSlots: { customRender: 'action' }
}
],
@ -73,13 +90,17 @@ export default {
.then(response => {
return response.data.list
})
}
},
open:false,
checkedList:[],
checkList:[],
storeId:null,
}
},
created () {
this.getDataList()
},
methods: {
/**
* 进入商城
*/
@ -140,7 +161,42 @@ export default {
*/
handleRefresh () {
this.$refs.table.refresh()
}
},
getDataList(){
return Api.getDataList().then(result => {
let obj = result.data;
Object.keys(obj).forEach(item=>{
this.checkList.push({id:item,name:obj[item]})
})
})
},
getPlatFormItem(item){
this.storeId = item.store_id
return Api.getStorePlatform({store_id:item.store_id}).then(result => {
this.checkedList = result.data.map(item=>{
return item.channel
})
this.open = true
})
},
onChange(checkedValues) {
console.log('checked = ', checkedValues);
this.checkedList = checkedValues
},
handleOk(){
let params = {
store_id:this.storeId,
platformList:this.checkedList
}
return Api.setStorePlatform(params).then(result => {
this.$message.success(result.message)
this.open = false;
this.handleRefresh()
})
},
}
}

Loading…
Cancel
Save