|
|
|
@ -13,6 +13,18 @@
|
|
|
|
|
<el-form-item label="榜单名称" prop="listName"> |
|
|
|
|
<el-input v-model="form.listName" style="width: 380px;" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="展示图片" prop="listImage"> |
|
|
|
|
<single-pic v-model="form.listImage" type="image" :num="1" :width="150" :height="150" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="所属月份" prop="mouth" > |
|
|
|
|
<el-date-picker |
|
|
|
|
format="yyyy 年 MM 月" |
|
|
|
|
value-format="yyyy-MM" |
|
|
|
|
v-model="form.mouth" |
|
|
|
|
type="month" |
|
|
|
|
placeholder="选择榜单所属年月"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="商品列表"> |
|
|
|
|
<el-input style="width: 200px;" v-model="product" v-if="productNameList.length==0" |
|
|
|
|
:readonly="true" @click.native="changeShow=!changeShow" placeholder="点击选择商品或收起商品列表"> |
|
|
|
@ -66,10 +78,11 @@
|
|
|
|
|
<el-table-column type="selection" width="55" /> |
|
|
|
|
<el-table-column v-if="columns.visible('id')" prop="id" label="榜单列表ID" /> |
|
|
|
|
<el-table-column v-if="columns.visible('listName')" prop="listName" label="榜单名称" /> |
|
|
|
|
<el-table-column v-if="columns.visible('mouth')" prop="mouth" label="所属月份" /> |
|
|
|
|
<el-table-column v-if="columns.visible('sort')" prop="sort" label="排序" /> |
|
|
|
|
<el-table-column v-if="columns.visible('productlist')" prop="productlist" label="商品列表" width="250"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div v-for="(item,index) in JSON.parse(scope.row.productList)"> |
|
|
|
|
<div v-for="(item,index) in (scope.row.productInfoList)"> |
|
|
|
|
<span>top{{index+1}}:{{item.storeName}}</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
@ -120,14 +133,15 @@ import pagination from '@crud/Pagination'
|
|
|
|
|
import MaterialList from "@/components/material"; |
|
|
|
|
import {getInfo} from "@/api/bxg/yxStoreProduct"; |
|
|
|
|
import {initData} from "@/api/bxg/data"; |
|
|
|
|
|
|
|
|
|
import singlePic from '@/components/singlematerial' |
|
|
|
|
// crud交由presenter持有 |
|
|
|
|
const defaultCrud = CRUD({ title: '热门榜单', url: 'bxg/api/yxStoreHotList', sort: 'id,desc', crudMethod: { ...crudYxStoreHotList }}) |
|
|
|
|
const defaultForm = { id: null, listName: null, sort: null, productList: null, isShow: 1, |
|
|
|
|
const defaultForm = { id: null, listName: null, sort: 0, productList: null, isShow: 1,listImage:'', |
|
|
|
|
mouth:null, |
|
|
|
|
createTime: null, updateTime: null, isDel: null, tenantId: Cookies.get('tenantId') } |
|
|
|
|
export default { |
|
|
|
|
name: 'YxStoreHotList', |
|
|
|
|
components: { pagination, crudOperation, rrOperation, udOperation ,MaterialList}, |
|
|
|
|
components: { pagination, crudOperation, rrOperation, udOperation ,MaterialList,singlePic}, |
|
|
|
|
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()], |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
@ -150,6 +164,13 @@ export default {
|
|
|
|
|
} } |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
// 'form.ListImage': function(val) { |
|
|
|
|
// console.log('aaaa:'+val) |
|
|
|
|
// if (val) { |
|
|
|
|
// this.oneFormValidate[0].pic = val |
|
|
|
|
// console.log('bbbbbb:'+this.oneFormValidate.pic) |
|
|
|
|
// } |
|
|
|
|
// }, |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
this.getInfo(); |
|
|
|
@ -165,7 +186,7 @@ export default {
|
|
|
|
|
productList=this.getCascader(val,this.oldProductList,this.$refs.quitCascader.getCheckedNodes(true)); |
|
|
|
|
this.productList = productList //回显的数据 |
|
|
|
|
this.oldProductList=productList; |
|
|
|
|
console.log('val',val,'element',productList,'Nodes',this.$refs.quitCascader.getCheckedNodes(true)) |
|
|
|
|
// console.log('val',val,'element',productList,'Nodes',this.$refs.quitCascader.getCheckedNodes(true)) |
|
|
|
|
this.form.productList=JSON.stringify(this.productList.map(item=>item[1])); |
|
|
|
|
}, |
|
|
|
|
getCascader(newVal,oldVal,Nodes) { |
|
|
|
@ -211,7 +232,7 @@ export default {
|
|
|
|
|
Nodes.forEach(item=>{ |
|
|
|
|
if (item.value==ele[1]){ |
|
|
|
|
// productNameList=item.parent.label+'/'+item.label+productNameList; |
|
|
|
|
console.log('item.parent.label+\'/\'+item.label',item.parent.label+'/'+item.label) |
|
|
|
|
// console.log('item.parent.label+\'/\'+item.label',item.parent.label+'/'+item.label) |
|
|
|
|
productNameList.push(item.parent.label+'/'+item.label) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -258,11 +279,17 @@ export default {
|
|
|
|
|
return true |
|
|
|
|
}, // 新增与编辑前做的操作 |
|
|
|
|
[CRUD.HOOK.afterToCU](crud, form) { |
|
|
|
|
console.log('form',form) |
|
|
|
|
this.changeShow=false; |
|
|
|
|
this.productNameList=[]; |
|
|
|
|
this.productList=[]; |
|
|
|
|
//兼容之前没有图时候 |
|
|
|
|
if (form.listImage==null && form.id) { |
|
|
|
|
this.form.listImage='' |
|
|
|
|
} |
|
|
|
|
if (form.productList && form.id) { |
|
|
|
|
let data=JSON.parse(this.form.productList) |
|
|
|
|
// let data=JSON.parse(this.form.productList) |
|
|
|
|
let data=form.productInfoList |
|
|
|
|
console.log('data',data) |
|
|
|
|
let productNameList=[] |
|
|
|
|
data.forEach(item=>{ |
|
|
|
|