显示隐藏

main
fanfan 4 months ago
parent a87fc697d4
commit 6c50ea5f12
  1. 172
      src/views/store/channel.vue
  2. 19
      src/views/store/modules/channelEdit.vue

@ -1,20 +1,23 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<div class="card-title">{{ $route.meta.title }}</div> <div class="card-title">{{ $route.meta.title }}</div>
<s-table ref="table" size="default" rowKey="store_id" :columns="columns" :data="loadData" :pagination="pagination"> <s-table ref="table" size="default" rowKey="store_id" :columns="columns" :data="loadData" :pagination="pagination">
<span slot="logoImage" slot-scope="text, item"> <span slot="status" slot-scope="text">
<a v-if="item.logoImage" title="点击查看原图" :href="item.logoImage.external_url" target="_blank"> <a-tag :color="text ? 'green' : ''">{{ text ? '显示' : '隐藏' }}</a-tag>
<img width="50" height="50" :src="item.logoImage.external_url" alt="商户logo" /> </span>
</a> <span slot="logoImage" slot-scope="text, item">
</span> <a v-if="item.logoImage" title="点击查看原图" :href="item.logoImage.external_url" target="_blank">
<span slot="action" slot-scope="text, item"> <img width="50" height="50" :src="item.logoImage.external_url" alt="商户logo" />
<template> </a>
<a v-action:edit style="margin-right: 8px" @click="handleEdit(item)">编辑</a> </span>
</template> <span slot="action" slot-scope="text, item">
</span> <template>
</s-table> <a v-action:edit style="margin-right: 8px" @click="handleEdit(item)">编辑</a>
<EditForm ref="EditForm" @handleSubmit="handleRefresh" /> </template>
</a-card> </span>
</s-table>
<EditForm ref="EditForm" @handleSubmit="handleRefresh" />
</a-card>
</template> </template>
<script> <script>
@ -23,71 +26,74 @@ import { STable } from '@/components'
import EditForm from './modules/channelEdit.vue' import EditForm from './modules/channelEdit.vue'
export default { export default {
components: { components: {
STable, STable,
EditForm EditForm,
}, },
data() { data() {
return { return {
shopList: [], shopList: [],
// //
columns: [ columns: [
{ {
title: '商户logo', title: '商户logo',
dataIndex: 'logoImage', dataIndex: 'logoImage',
scopedSlots: { customRender: 'logoImage' } scopedSlots: { customRender: 'logoImage' },
}, },
{ {
title: '商户名称', title: '商户名称',
dataIndex: 'shop_name' dataIndex: 'shop_name',
}, },
{ {
title: '商户标签', title: '商户标签',
dataIndex: 'shop_label' dataIndex: 'shop_label',
}, },
{ {
title: '渠道名称', title: '渠道名称',
dataIndex: 'name' dataIndex: 'name',
}, },
{ {
title: '渠道别名', title: '渠道别名',
dataIndex: 'alias' dataIndex: 'alias',
}, },
{ {
title: '添加时间', title: '状态',
dataIndex: 'create_time' dataIndex: 'status',
}, scopedSlots: { customRender: 'status' },
{ },
title: '操作', {
dataIndex: 'action', title: '添加时间',
width: '180px', dataIndex: 'create_time',
scopedSlots: { customRender: 'action' } },
} {
], title: '操作',
// Promise dataIndex: 'action',
loadData: param => { width: '180px',
return Api.channelList(param) scopedSlots: { customRender: 'action' },
.then(response => { },
return response.data.list ],
}) // Promise
}, loadData: (param) => {
} return Api.channelList(param).then((response) => {
}, return response.data.list
created() { })
}, },
methods: { }
/** },
* 刷新列表 created() {},
* @param Boolean bool 强制刷新到第一页 methods: {
*/ /**
handleRefresh(bool = false) { * 刷新列表
this.$refs.table.refresh(false) * @param Boolean bool 强制刷新到第一页
}, */
// handleRefresh(bool = false) {
async handleEdit(record) { this.$refs.table.refresh(false)
// },
this.$refs.EditForm.add(record) //
}, async handleEdit(record) {
} //
this.$refs.EditForm.add(record)
},
},
} }
</script> </script>

@ -25,10 +25,10 @@
v-decorator="['shop_label', { rules: [{ required: true, min: 2, max: 10, message: '请输入2-10个字符' }] }]" v-decorator="['shop_label', { rules: [{ required: true, min: 2, max: 10, message: '请输入2-10个字符' }] }]"
/> />
</a-form-item> </a-form-item>
<a-form-item label="渠道名称" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="渠道名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" /> <a-input v-decorator="['name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
</a-form-item> </a-form-item>
<a-form-item label="渠道别名" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="渠道别名" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['alias', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" /> <a-input v-decorator="['alias', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
</a-form-item> </a-form-item>
<a-form-item label="营业执照" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="营业执照" :labelCol="labelCol" :wrapperCol="wrapperCol">
@ -38,6 +38,12 @@
v-decorator="['license_img_id', { rules: [{ required: true, message: '请上传营业执照' }] }]" v-decorator="['license_img_id', { rules: [{ required: true, message: '请上传营业执照' }] }]"
/> />
</a-form-item> </a-form-item>
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]">
<a-radio :value="1">显示</a-radio>
<a-radio :value="0">隐藏</a-radio>
</a-radio-group>
</a-form-item>
</a-form> </a-form>
</a-spin> </a-spin>
</a-modal> </a-modal>
@ -96,14 +102,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
setFieldsValue( setFieldsValue(
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
_.pick(this.info, [ _.pick(this.info, ['logo', 'shop_name', 'shop_label', 'logo_image_id', 'name', 'alias', 'status'])
'logo',
'shop_name',
'shop_label',
'logo_image_id',
'name',
'alias',
])
) )
}) })
}, },

Loading…
Cancel
Save