|
@@ -3,71 +3,69 @@
|
|
<!-- 搜索框 -->
|
|
<!-- 搜索框 -->
|
|
<div class="table-page-search-wrapper" style="margin-bottom: 15px;">
|
|
<div class="table-page-search-wrapper" style="margin-bottom: 15px;">
|
|
<a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
<a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
- <a-row :gutter="48" >
|
|
|
|
|
|
+ <a-row :gutter="48">
|
|
<a-col :md="6" :sm="24">
|
|
<a-col :md="6" :sm="24">
|
|
- <a-form-item label="商品分类名称"><a-input allowClear v-model.trim="searchData.name" :maxLength="30" placeholder="请输入" id="OperateJournal-queryWord"/></a-form-item>
|
|
|
|
|
|
+ <a-form-item label="商品分类名称">
|
|
|
|
+ <a-input allowClear v-model="searchData.name" :maxLength="30" placeholder="请输入" id="goodsClass-name" />
|
|
|
|
+ </a-form-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="6" :sm="24">
|
|
<a-col :md="6" :sm="24">
|
|
- <a-button style="margin-right: 10px;" type="primary" @click="$refs.table.refresh(true)" id="OperateJournal-refreshTable">查询</a-button>
|
|
|
|
|
|
+ <a-button style="margin-right: 10px;" type="primary" @click="$refs.table.refresh(true)" id="goodsClass-refresh">查询</a-button>
|
|
<a-button type="" @click="resetForm" id="OperateJournal-resetForm">重置</a-button>
|
|
<a-button type="" @click="resetForm" id="OperateJournal-resetForm">重置</a-button>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
</a-form>
|
|
</a-form>
|
|
</div>
|
|
</div>
|
|
- <div class="add"><a-button type="primary" icon="plus" class="addBtn" @click="showModal" id="bannerSetting-showModal">新增</a-button></div>
|
|
|
|
- <v-select ref="position" style="display: none;" code="ADVERT_POSITION"></v-select>
|
|
|
|
|
|
+ <div class="add">
|
|
|
|
+ <a-button type="primary" icon="plus" class="addBtn" @click="showModal" id="goodsClass-showModal">新增</a-button>
|
|
|
|
+ </div>
|
|
<!-- table列表 -->
|
|
<!-- table列表 -->
|
|
<s-table
|
|
<s-table
|
|
ref="table"
|
|
ref="table"
|
|
size="default"
|
|
size="default"
|
|
- :rowKey="row => row.id"
|
|
|
|
- :showPagination="false"
|
|
|
|
|
|
+ :rowKey="(record) => record.id"
|
|
:columns="columns"
|
|
:columns="columns"
|
|
:data="loadData"
|
|
:data="loadData"
|
|
bordered>
|
|
bordered>
|
|
- <!-- 广告图位置 -->
|
|
|
|
- <!-- <span slot="position" slot-scope="text">{{ $refs.position.getNameByCode(text) }}</span> -->
|
|
|
|
<span slot="action" slot-scope="text, record">
|
|
<span slot="action" slot-scope="text, record">
|
|
<a-icon
|
|
<a-icon
|
|
- type="eye"
|
|
|
|
- id="bannerSetting-handleView"
|
|
|
|
- title="查看"
|
|
|
|
- class="actionBtn icon-green"
|
|
|
|
- @click="handleEdit(record, 1)" />
|
|
|
|
- <a-icon
|
|
|
|
|
|
+ v-if="record.state==0"
|
|
type="edit"
|
|
type="edit"
|
|
id="bannerSetting-handleEdit"
|
|
id="bannerSetting-handleEdit"
|
|
- v-if="record.state == '0'"
|
|
|
|
title="编辑"
|
|
title="编辑"
|
|
class="actionBtn icon-blues"
|
|
class="actionBtn icon-blues"
|
|
- @click="handleEdit(record, 0)" />
|
|
|
|
- <a-icon
|
|
|
|
- type="delete"
|
|
|
|
- id="bannerSetting-delect"
|
|
|
|
- v-if="record.state == '0'"
|
|
|
|
- title="删除"
|
|
|
|
- class="actionBtn icon-red"
|
|
|
|
- @click="delect(record)" />
|
|
|
|
|
|
+ @click="handleEdit(record)" />
|
|
|
|
+ <span v-if="record.state==1">--</span>
|
|
</span>
|
|
</span>
|
|
<span slot="state" slot-scope="text, record">
|
|
<span slot="state" slot-scope="text, record">
|
|
<a-switch
|
|
<a-switch
|
|
checkedChildren="启用"
|
|
checkedChildren="启用"
|
|
unCheckedChildren="禁用"
|
|
unCheckedChildren="禁用"
|
|
id="bannerSetting-changeFlagHandle"
|
|
id="bannerSetting-changeFlagHandle"
|
|
- v-model="record.state == 1 ? true : false"
|
|
|
|
- @change="changeFlagHandle(text, record)"
|
|
|
|
- />
|
|
|
|
|
|
+ :checked="record.state == 1 ? true : false"
|
|
|
|
+ @change="changeFlagHandle(text, record)" />
|
|
</span>
|
|
</span>
|
|
- </s-table>
|
|
|
|
- <add-goodsClass-modal :itemData="itemData" :openGoodClassModal="openGoodClassModal" @close="openGoodClassModal=false"></add-goodsClass-modal>
|
|
|
|
|
|
+ </span></s-table>
|
|
|
|
+ <add-goodsClass-modal
|
|
|
|
+ :itemId="itemId"
|
|
|
|
+ :itemData="itemData"
|
|
|
|
+ :openGoodClassModal="openGoodClassModal"
|
|
|
|
+ @refresh="$refs.table.refresh(true)"
|
|
|
|
+ @close="cancel"></add-goodsClass-modal>
|
|
</a-card>
|
|
</a-card>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { Upload, STable, VSelect } from '@/components'
|
|
|
|
|
|
+import {
|
|
|
|
+ Upload,
|
|
|
|
+ STable,
|
|
|
|
+ VSelect
|
|
|
|
+} from '@/components'
|
|
import addGoodsClassModal from './addGoodsClassModal.vue'
|
|
import addGoodsClassModal from './addGoodsClassModal.vue'
|
|
-// import Editor from '@/components/WEeditor'
|
|
|
|
-import { getGoodsClassList, changeGoodsStatus, goodsClassDetails } from '@/api/shopSetting.js'
|
|
|
|
|
|
+import {
|
|
|
|
+ getGoodsClassList,
|
|
|
|
+ changeGoodsStatus
|
|
|
|
+} from '@/api/shopSetting.js'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
@@ -78,76 +76,13 @@ export default {
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
- searchData: { name: '' },
|
|
|
|
- openGoodClassModal: false, // 默认关闭弹窗
|
|
|
|
- itemData: {}, // 编辑行数据
|
|
|
|
- // 表头
|
|
|
|
- columns: [
|
|
|
|
- {
|
|
|
|
- title: '序号',
|
|
|
|
- dataIndex: 'no',
|
|
|
|
- width: 60,
|
|
|
|
- align: 'center'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '商品分类名称',
|
|
|
|
- width: 100,
|
|
|
|
- dataIndex: 'name',
|
|
|
|
- align: 'center'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '订单起购金额',
|
|
|
|
- width: 100,
|
|
|
|
- dataIndex: 'goldLimit',
|
|
|
|
- align: 'center'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '状态',
|
|
|
|
- width: 100,
|
|
|
|
- dataIndex: 'state',
|
|
|
|
- align: 'center',
|
|
|
|
- scopedSlots: {
|
|
|
|
- customRender: 'state'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '备注',
|
|
|
|
- width: 100,
|
|
|
|
- dataIndex: 'url',
|
|
|
|
- align: 'center',
|
|
|
|
- customRender: (text) => {
|
|
|
|
- return text || '--'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '操作',
|
|
|
|
- align: 'center',
|
|
|
|
- width: 100,
|
|
|
|
- scopedSlots: {
|
|
|
|
- customRender: 'action'
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
|
- loadData: parameter => {
|
|
|
|
- // return getGoodsClassList({
|
|
|
|
- // Object.assign(parameter, this.searchData)
|
|
|
|
- // }).then(res => {
|
|
|
|
- // // console.log(res, '1111')
|
|
|
|
- // const no = 0
|
|
|
|
- // for (let i = 0; i < res.data.length; i++) {
|
|
|
|
- // const _item = res.data[i]
|
|
|
|
- // _item.no = no + i + 1
|
|
|
|
- // }
|
|
|
|
- // return res.data
|
|
|
|
- // })
|
|
|
|
|
|
+ searchData: {
|
|
|
|
+ name: ''
|
|
},
|
|
},
|
|
- title: '编辑',
|
|
|
|
- closable: true,
|
|
|
|
- visible: false,
|
|
|
|
- confirmLoading: false,
|
|
|
|
|
|
+ openGoodClassModal: false, // 默认关闭弹窗
|
|
|
|
+ itemId: null, // 编辑行id
|
|
|
|
+ itemData: {}, // 编辑行数据
|
|
formLayout: 'horizontal',
|
|
formLayout: 'horizontal',
|
|
- // hideRequiredMark: false, // 是否显示必填的* 默认显示
|
|
|
|
form: this.$form.createForm(this),
|
|
form: this.$form.createForm(this),
|
|
formItemLayout: {
|
|
formItemLayout: {
|
|
labelCol: {
|
|
labelCol: {
|
|
@@ -157,20 +92,74 @@ export default {
|
|
span: 14
|
|
span: 14
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- formData: {
|
|
|
|
- title: '', // 标题
|
|
|
|
- url: '', // 图片路径
|
|
|
|
- status: '', // 状态
|
|
|
|
- sort: '', // 排序
|
|
|
|
- position: '', // 广告图位置
|
|
|
|
- photoPath: '', // banner地址
|
|
|
|
- createDate: ''
|
|
|
|
|
|
+ // 表头
|
|
|
|
+ columns: [{
|
|
|
|
+ title: '序号',
|
|
|
|
+ dataIndex: 'no',
|
|
|
|
+ width: 60,
|
|
|
|
+ align: 'center'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '商品分类名称',
|
|
|
|
+ width: 100,
|
|
|
|
+ dataIndex: 'name',
|
|
|
|
+ align: 'center'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '订单起购金额',
|
|
|
|
+ width: 100,
|
|
|
|
+ dataIndex: 'goldLimit',
|
|
|
|
+ align: 'center',
|
|
|
|
+ customRender: (text) => {
|
|
|
|
+ if (text >= 1) {
|
|
|
|
+ return text
|
|
|
|
+ } else {
|
|
|
|
+ return '--'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- bannerType: 'app',
|
|
|
|
- disabled: false,
|
|
|
|
- value: '',
|
|
|
|
- id: '',
|
|
|
|
- isShow: true
|
|
|
|
|
|
+ {
|
|
|
|
+ title: '状态',
|
|
|
|
+ width: 100,
|
|
|
|
+ dataIndex: 'state',
|
|
|
|
+ align: 'center',
|
|
|
|
+ scopedSlots: {
|
|
|
|
+ customRender: 'state'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '备注',
|
|
|
|
+ width: 100,
|
|
|
|
+ dataIndex: 'remarks',
|
|
|
|
+ align: 'center',
|
|
|
|
+ customRender: (text) => {
|
|
|
|
+ return text || '--'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '操作',
|
|
|
|
+ align: 'center',
|
|
|
|
+ width: 100,
|
|
|
|
+ scopedSlots: {
|
|
|
|
+ customRender: 'action'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
|
+ loadData: parameter => {
|
|
|
|
+ return getGoodsClassList(
|
|
|
|
+ Object.assign(parameter, this.searchData)
|
|
|
|
+ ).then(res => {
|
|
|
|
+ const no = (res.data.pageNo - 1) * res.data.pageSize
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ for (let i = 0; i < res.data.list.length; i++) {
|
|
|
|
+ const _item = res.data.list[i]
|
|
|
|
+ _item.no = no + i + 1
|
|
|
|
+ }
|
|
|
|
+ return res.data
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
beforeCreate () {
|
|
beforeCreate () {
|
|
@@ -180,132 +169,68 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
showModal () {
|
|
showModal () {
|
|
- // this.disabled = false
|
|
|
|
- // delete this.formData.id
|
|
|
|
- // delete this.formData.createDate
|
|
|
|
- // this.visible = true
|
|
|
|
- this.openGoodClassModal = true
|
|
|
|
- this.title = '新增'
|
|
|
|
- // this.hideRequiredMark = false
|
|
|
|
|
|
+ console.log('---新增')
|
|
|
|
+ this.itemId = null
|
|
|
|
+ this.itemData = {}
|
|
|
|
+ this.openGoodClassModal = true
|
|
|
|
+ },
|
|
|
|
+ // 编辑
|
|
|
|
+ handleEdit (record) {
|
|
|
|
+ this.itemId = record.id
|
|
|
|
+ this.itemData = record
|
|
|
|
+ console.log(this.itemId, '-------编辑')
|
|
|
|
+ this.openGoodClassModal = true
|
|
},
|
|
},
|
|
- // 轮播图change
|
|
|
|
- // getbannerImage (data) {
|
|
|
|
- // this.formData.photoPath = data
|
|
|
|
- // },
|
|
|
|
// 重置
|
|
// 重置
|
|
resetForm () {
|
|
resetForm () {
|
|
this.searchData.name = ''
|
|
this.searchData.name = ''
|
|
- this.$refs.table.refresh(true)
|
|
|
|
- },
|
|
|
|
- // 点击保存;
|
|
|
|
- handleSubmit (e) {
|
|
|
|
- // e.preventDefault()
|
|
|
|
- // const _this = this
|
|
|
|
- // this.form.validateFields((err, values) => {
|
|
|
|
- // if (!err) {
|
|
|
|
- // console.log('Received values of form: ', values, this.formData)
|
|
|
|
- // const formData = Object.assign({}, this.formData, values.formData, {
|
|
|
|
- // bannerType: 'app'
|
|
|
|
- // })
|
|
|
|
- // console.log(formData, _this.radioGroup)
|
|
|
|
- // saveItem(formData, _this.radioGroup).then(res => {
|
|
|
|
- // console.log(res, 'rrrrrrrrr')
|
|
|
|
- // if (res.status == 200) {
|
|
|
|
- // _this.$message.success(res.message)
|
|
|
|
- // _this.$refs.table.refresh()
|
|
|
|
- // _this.close()
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
|
|
+ this.$refs.table.refresh(true)
|
|
},
|
|
},
|
|
- close () {
|
|
|
|
- this.visible = false
|
|
|
|
- this.formData.title = ''
|
|
|
|
- this.photo = ''
|
|
|
|
- this.formData.url = ''
|
|
|
|
- this.formData.status = ''
|
|
|
|
- this.formData.sort = ''
|
|
|
|
- this.formData.position = ''
|
|
|
|
- this.formData.photoBasePath = ''
|
|
|
|
- this.formData.photoPath = ''
|
|
|
|
- this.title = '新增'
|
|
|
|
- // this.$refs.bannerImage.setFileList('')
|
|
|
|
- // this.form.resetFields()
|
|
|
|
- },
|
|
|
|
- // 赋值
|
|
|
|
- assignment (row) {
|
|
|
|
- this.formData.id = row.id
|
|
|
|
- this.formData.title = row.title
|
|
|
|
- this.formData.photoPath = row.photoPath
|
|
|
|
- this.formData.url = row.url
|
|
|
|
- this.formData.status = row.status
|
|
|
|
- this.formData.sort = row.sort
|
|
|
|
- this.formData.position = row.position
|
|
|
|
- this.formData.createDate = row.createDate
|
|
|
|
- },
|
|
|
|
- // 0 修改,1 查看详情
|
|
|
|
- // handleEdit (row, type) {
|
|
|
|
- // const _this = this
|
|
|
|
- // console.log(row)
|
|
|
|
- // if (type == 1) {
|
|
|
|
- // this.title = '查看详情'
|
|
|
|
- // this.hideRequiredMark = true
|
|
|
|
- // } else if (type == 0) {
|
|
|
|
- // this.title = '编辑'
|
|
|
|
- // this.hideRequiredMark = false
|
|
|
|
- // }
|
|
|
|
- // this.assignment(row)
|
|
|
|
- // this.disabled = type == 1
|
|
|
|
- // this.visible = true
|
|
|
|
- // setTimeout(() => {
|
|
|
|
- // _this.$refs.bannerImage.setFileList(this.formData.photoPath)
|
|
|
|
- // }, 500)
|
|
|
|
- // },
|
|
|
|
- // 删除
|
|
|
|
- delect (row) {
|
|
|
|
- const _this = this
|
|
|
|
- this.$confirm({
|
|
|
|
- title: '警告',
|
|
|
|
- centered: true,
|
|
|
|
- content: '删除后无法恢复,确认删除?',
|
|
|
|
- okText: '确定',
|
|
|
|
- cancelText: '取消',
|
|
|
|
- onOk () {
|
|
|
|
- // deleteItem({
|
|
|
|
- // id: row.id
|
|
|
|
- // }).then(res => {
|
|
|
|
- // if (res.status == 200) {
|
|
|
|
- // _this.$message.success(res.message)
|
|
|
|
- // _this.$refs.table.refresh()
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ //
|
|
|
|
+ cancel () {
|
|
|
|
+ this.itemId = null
|
|
|
|
+ this.openGoodClassModal = false
|
|
},
|
|
},
|
|
// 更改启用禁用状态
|
|
// 更改启用禁用状态
|
|
changeFlagHandle (text, record) {
|
|
changeFlagHandle (text, record) {
|
|
|
|
+ console.log(text)
|
|
const _this = this
|
|
const _this = this
|
|
- this.$confirm({
|
|
|
|
- title: '提示',
|
|
|
|
- centered: true,
|
|
|
|
- content: '商品分类被禁用后,该分类将不在显示给用户,确定禁用吗?',
|
|
|
|
- okText: '确定',
|
|
|
|
- cancelText: '取消',
|
|
|
|
- onOk () {
|
|
|
|
- const _data = {
|
|
|
|
- id: record.id,
|
|
|
|
- flag: record.status == 1 ? '0' : '1'
|
|
|
|
|
|
+ const _data = {
|
|
|
|
+ id: record.id,
|
|
|
|
+ flag: record.state == 1 ? '0' : '1'
|
|
|
|
+ }
|
|
|
|
+ if (record.state == 1) {
|
|
|
|
+ this.$confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ centered: true,
|
|
|
|
+ content: '商品分类被禁用后,该分类将不在显示给用户,确定禁用吗?',
|
|
|
|
+ okText: '确定',
|
|
|
|
+ cancelText: '取消',
|
|
|
|
+ onOk () {
|
|
|
|
+ changeGoodsStatus(_data).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.$refs.table.refresh()
|
|
|
|
+ } else {
|
|
|
|
+ record.state = !record.state
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- changeStatus(_data).then(res => {
|
|
|
|
- if (res.status == '200') {
|
|
|
|
- _this.$message.success(res.message)
|
|
|
|
- _this.$refs.table.refresh()
|
|
|
|
- } else {
|
|
|
|
- record.status = !record.status
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ changeGoodsStatus(_data).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.$refs.table.refresh()
|
|
|
|
+ } else {
|
|
|
|
+ record.state = !record.state
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
|
+ next(vm => {
|
|
|
|
+ vm.resetForm()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -313,10 +238,11 @@ export default {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style>
|
|
<style>
|
|
- .w-e-toolbar{
|
|
|
|
- flex-wrap:wrap;
|
|
|
|
|
|
+ .w-e-toolbar {
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .addBtn {
|
|
|
|
+ margin-bottom: 20px;
|
|
}
|
|
}
|
|
-.addBtn {
|
|
|
|
- margin-bottom: 20px;
|
|
|
|
-}
|
|
|
|
</style>
|
|
</style>
|