parent
4c02137721
commit
1747ab8d84
@ -0,0 +1,42 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function index(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/admin/special-order-config/index',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/api/admin/special-order-config/show/${params.id}`,
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function store(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/api/admin/special-order-config/store',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function update(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/admin/special-order-config/update/${data.id}`,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: `/api/admin/special-order-config/destroy/${data.id}`,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<div>
|
||||
<Modal :value="isShow" :title="title" @on-visible-change="$emit('update:isShow',$event)">
|
||||
<div class="searchMerchants">
|
||||
<el-input
|
||||
type="text"
|
||||
@keyup.enter.native="searchMerchants"
|
||||
v-model="keyword"
|
||||
placeholder="请输入关键词查找商户"
|
||||
></el-input>
|
||||
<el-button type="primary" @click="searchMerchants">查询</el-button>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
size="small"
|
||||
highlight-row
|
||||
:columns="merchantTable"
|
||||
:data="merchants"
|
||||
@on-current-change="merchantSelect"
|
||||
/>
|
||||
|
||||
<Page
|
||||
:current="pageIndex"
|
||||
:total="total"
|
||||
simple
|
||||
style="padding-top: 14px;display: flex;justify-content: center;"
|
||||
@on-change="pageChange"
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { index as merchantIndex } from '@/api/merchant'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
isShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '商户选择'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: '',
|
||||
pageIndex: 1,
|
||||
total: 0,
|
||||
merchants: [],
|
||||
merchantTable: [
|
||||
{ title: '简称', key: 'username' },
|
||||
{ title: '全称', key: 'name', align: 'left' }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getMerchants() {
|
||||
const res = await merchantIndex(
|
||||
{
|
||||
page_size: 10,
|
||||
page: this.pageIndex,
|
||||
keyword: this.keyword
|
||||
},
|
||||
false
|
||||
)
|
||||
this.total = res.total || 0
|
||||
this.merchants = res.data || []
|
||||
},
|
||||
searchMerchants() {
|
||||
this.pageIndex = 1
|
||||
this.getMerchants()
|
||||
},
|
||||
pageChange(e) {
|
||||
this.pageIndex = e
|
||||
this.getMerchants()
|
||||
},
|
||||
merchantSelect(row) {
|
||||
if (!row) return
|
||||
this.$emit('select', row)
|
||||
this.$emit('update:isShow', false)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isShow(newVal) {
|
||||
if (newVal) {
|
||||
this.getMerchants()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.searchMerchants{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom:16px;
|
||||
.el-input{
|
||||
width:80%
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<div style="padding: 0 20px">
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" text="特殊订单流程配置" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<slot>
|
||||
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
|
||||
<Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" />
|
||||
<Button type="primary" @click="searchConfig">查询</Button>
|
||||
<Button icon="ios-add" type="primary" style="margin-left: 10px;" @click="$refs['specialOrderConfigEdit'].isShow = true,$refs['specialOrderConfigEdit'].type = 'add'">新增</Button>
|
||||
</div>
|
||||
</slot>
|
||||
</lx-header>
|
||||
</div>
|
||||
|
||||
<xy-table
|
||||
:list="list"
|
||||
:total="total"
|
||||
@pageSizeChange="pageSizeChange"
|
||||
@pageIndexChange="pageChange"
|
||||
:table-item="table">
|
||||
<template v-slot:btns>
|
||||
<el-table-column fixed="right" label="操作" width="260" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<Button type="primary" size="small" @click="editorConfig(scope.row.id,'editor')">编辑</Button>
|
||||
<Poptip
|
||||
transfer
|
||||
confirm
|
||||
title="确认要删除吗?"
|
||||
@on-ok="deleteConfig(scope.row)">
|
||||
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
|
||||
</Poptip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
||||
</xy-table>
|
||||
|
||||
<specialOrderConfigEdit ref="specialOrderConfigEdit" @refresh="getConfigList"></specialOrderConfigEdit>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {index,destroy} from "@/api/specialOrderConfig"
|
||||
import {parseTime} from "@/utils"
|
||||
import specialOrderConfigEdit from '@/views/order/component/specialOrderConfigEdit'
|
||||
import { Message } from 'element-ui'
|
||||
export default {
|
||||
components:{
|
||||
specialOrderConfigEdit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select:{
|
||||
pageSize:10,
|
||||
page:1,
|
||||
keyword:""
|
||||
},
|
||||
total:0,
|
||||
list:[],
|
||||
table:[
|
||||
{ label:"ID", prop:'id', width:80, align:'center' },
|
||||
{ label:"配置名称", prop:'name', align:'left', minWidth:160 },
|
||||
{ label:"产品名称识别关键词", prop:'product_name_keyword', align:'left', minWidth:180 },
|
||||
{
|
||||
label:"目标商户",
|
||||
prop:'target_merchant_id',
|
||||
align:'left',
|
||||
minWidth:160,
|
||||
formatter: (cell, data, value) => {
|
||||
return cell?.target_merchant?.username || cell?.target_merchant?.name || cell?.target_merchant_name || value
|
||||
}
|
||||
},
|
||||
{
|
||||
label:"自动分发",
|
||||
prop:'auto_assign_enabled',
|
||||
width:100,
|
||||
align:'center',
|
||||
formatter: (cell, data, value) => {
|
||||
return value === true || value === 1 || value === '1' ? '是' : '否'
|
||||
}
|
||||
},
|
||||
// 暂时注释掉服务监管商户列
|
||||
// {
|
||||
// label:"服务监管商户",
|
||||
// prop:'service_supervisor_merchant_id',
|
||||
// align:'left',
|
||||
// minWidth:160,
|
||||
// formatter: (cell, data, value) => {
|
||||
// return cell?.service_supervisor_merchant?.username || cell?.service_supervisor_merchant?.name || cell?.service_supervisor_merchant_name || value
|
||||
// }
|
||||
// },
|
||||
{
|
||||
label:"状态",
|
||||
prop:'state',
|
||||
width:100,
|
||||
align:'center',
|
||||
formatter: (cell, data, value) => {
|
||||
return value === 'active' || value === 1 || value === '1' ? '启用' : '禁用'
|
||||
}
|
||||
},
|
||||
{
|
||||
label:"创建时间",
|
||||
prop:'created_at',
|
||||
width:180,
|
||||
align:'center',
|
||||
formatter: (cell, data, value, index) => {
|
||||
if (value)
|
||||
return parseTime(new Date(value))
|
||||
}
|
||||
},
|
||||
{
|
||||
label:"更新时间",
|
||||
prop:'updated_at',
|
||||
width:180,
|
||||
align:'center',
|
||||
formatter: (cell, data, value, index) => {
|
||||
if (value)
|
||||
return parseTime(new Date(value))
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getConfigList(){
|
||||
const res = await index({
|
||||
page_size:this.select.pageSize,
|
||||
page:this.select.page,
|
||||
keyword:this.select.keyword
|
||||
})
|
||||
this.list = res.data || res.rows || []
|
||||
this.total = res.total || 0
|
||||
},
|
||||
|
||||
pageChange(e){
|
||||
this.select.page = e
|
||||
this.getConfigList()
|
||||
},
|
||||
pageSizeChange(e){
|
||||
this.select.pageSize = e
|
||||
this.select.page = 1
|
||||
this.getConfigList()
|
||||
},
|
||||
|
||||
searchConfig(){
|
||||
this.select.page = 1
|
||||
this.getConfigList()
|
||||
},
|
||||
|
||||
deleteConfig(row){
|
||||
destroy({id:row.id}).then(res => {
|
||||
Message({
|
||||
type:'success',
|
||||
message:'删除成功'
|
||||
})
|
||||
this.getConfigList()
|
||||
}).catch(err => {
|
||||
Message({
|
||||
type:'error',
|
||||
message:'删除失败'
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
editorConfig(id,type){
|
||||
this.$refs['specialOrderConfigEdit'].id = id
|
||||
this.$refs['specialOrderConfigEdit'].type = type
|
||||
this.$refs['specialOrderConfigEdit'].isShow = true
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getConfigList()
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
|
||||
Loading…
Reference in new issue