Browse Source

问题:热榜商品选择器框内回显问题

master
sj 2 years ago
parent
commit
d4c0e7926c
  1. 27
      src/api/bxg/yxStoreHotList.js
  2. 2
      src/components/editorMaterial/index.vue
  3. 2
      src/components/file-upload/index.vue
  4. 18
      src/store/modules/user.js
  5. 32
      src/views/bxg/shop/goods/form.vue
  6. 4
      src/views/bxg/shop/set/form.vue
  7. 2
      src/views/bxg/shop/set/index.vue
  8. 2
      src/views/bxg/shop/set/menu.vue
  9. 4
      src/views/bxg/shop/set/menuform.vue
  10. 1
      src/views/bxg/shop/set/seckillform.vue
  11. 2
      src/views/bxg/shop/set/usermenu.vue
  12. 4
      src/views/bxg/shop/set/usermenuform.vue
  13. 6
      src/views/bxg/shop/storeBrand/index.vue
  14. 281
      src/views/bxg/shop/yxStoreHotList/index.vue
  15. 1
      src/views/bxg/yxEvaluation/index.vue

27
src/api/bxg/yxStoreHotList.js

@ -0,0 +1,27 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'bxg/api/yxStoreHotList',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'bxg/api/yxStoreHotList/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'bxg/api/yxStoreHotList',
method: 'put',
data
})
}
export default { add, edit, del }

2
src/components/editorMaterial/index.vue

@ -190,7 +190,7 @@ export default {
data() {
return {
headers: {
Authorization: "Bearer " + getToken()
Authorization: "Bearer" + getToken()
},
dialogVisible: true,
url: '',

2
src/components/file-upload/index.vue

@ -29,7 +29,7 @@ export default {
return {
resourcesUrl: '',
headers: {
'Authorization': getToken()
'Authorization':"Bearer"+getToken()
}
}
},

18
src/store/modules/user.js

@ -50,15 +50,15 @@ const user = {
let params = {};
params.currentPage = 1;
params.pageSize = 100;
getAction('/erp/materialProperty/list', params).then((mp) => {
console.log(mp);
if(mp && mp.code === 200){
if(mp.data) {
let thisRows = mp.data.rows; //属性列表
Vue.ls.set('materialPropertyList', thisRows);
}
}
})
// getAction('/erp/materialProperty/list', params).then((mp) => {
// console.log(mp);
// if(mp && mp.code === 200){
// if(mp.data) {
// let thisRows = mp.data.rows; //属性列表
// Vue.ls.set('materialPropertyList', thisRows);
// }
// }
// })
resolve()
}).catch(error => {
reject(error)

32
src/views/bxg/shop/goods/form.vue

@ -516,15 +516,15 @@ export default {
store_info: [
{ required: true, message: '请输入商品简介', trigger: 'blur' }
],
// spec_type: [
// { required: true, message: '', trigger: 'change' }
// ],
// selectRule: [
// { required: true, message: '', trigger: 'change' }
// ],
// temp_id: [
// { required: true, message: '', trigger: 'change', type: 'number' }
// ]
spec_type: [
{ required: true, message: '请选择商品规格', trigger: 'change' }
],
selectRule: [
{ required: true, message: '请选择商品规格属性', trigger: 'change' }
],
temp_id: [
{ required: true, message: '请选择运费模板', trigger: 'change', type: 'number' }
]
},
attrs: []
}
@ -757,9 +757,13 @@ export default {
if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){
return this.$message.warning('请点击生成规格!');
}
console.log(this.formValidate,'提交的')
// console.log(this.formValidate,'')
// return
add(this.formValidate).then(async res => {
if (res.status==500){
this.$message.error(res.msg)
return
}
//Status Code201
this.$message({
message:'操作成功',
@ -769,10 +773,10 @@ export default {
this.$router.push({ path: '/bxg/shop/goods' });
}, 500);
}).catch(res => {
// this.$message({
// message:res.message,
// type: 'error'
// });
this.$message({
message:res.message,
type: 'error'
});
})
} else {
if(!this.formValidate.store_name || !this.formValidate.cate_id || !this.formValidate.keyword

4
src/views/bxg/shop/set/form.vue

@ -49,7 +49,7 @@ export default {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_home_banner',
groupName: 'zsw_home_banner',
name: '',
url: '',
wxapp_url: '',
@ -116,7 +116,7 @@ export default {
this.$refs['form'].resetFields()
this.form = {
id: '',
groupName: 'yshop_home_banner',
groupName: 'zsw_home_banner',
name: '',
url: '',
wxapp_url: '',

2
src/views/bxg/shop/set/index.vue

@ -91,7 +91,7 @@ export default {
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_home_banner' }
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'zsw_home_banner' }
return true
},
subDelete(id) {

2
src/views/bxg/shop/set/menu.vue

@ -90,7 +90,7 @@ export default {
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_home_menus' }
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'zsw_home_menus' }
return true
},
subDelete(id) {

4
src/views/bxg/shop/set/menuform.vue

@ -46,7 +46,7 @@ export default {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_home_menus',
groupName: 'zsw_home_menus',
name: '',
url: '',
wxapp_url: '',
@ -112,7 +112,7 @@ export default {
this.$refs['form'].resetFields()
this.form = {
id: '',
groupName: 'yshop_home_menus',
groupName: 'zsw_home_menus',
name: '',
url: '',
wxapp_url: '',

1
src/views/bxg/shop/set/seckillform.vue

@ -93,6 +93,7 @@ export default {
})
},
doEdit() {
this.form.time=Number(this.form.time.slice(0,2))
edit(this.form).then(res => {
if (res.status==500){
this.$message.error(res.msg)

2
src/views/bxg/shop/set/usermenu.vue

@ -92,7 +92,7 @@ export default {
beforeInit() {
this.url = 'bxg/api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'yshop_my_menus' }
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'zsw_my_menus' }
return true
},
subDelete(id) {

4
src/views/bxg/shop/set/usermenuform.vue

@ -46,7 +46,7 @@ export default {
loading: false, dialog: false,
form: {
id: '',
groupName: 'yshop_my_menus',
groupName: 'zsw_my_menus',
name: '',
url: '',
wxapp_url: '',
@ -112,7 +112,7 @@ export default {
this.$refs['form'].resetFields()
this.form = {
id: '',
groupName: 'yshop_my_menus',
groupName: 'zsw_my_menus',
name: '',
url: '',
wxapp_url: '',

6
src/views/bxg/shop/storeBrand/index.vue

@ -12,9 +12,9 @@
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="品牌ID">
<el-input v-model="form.id" style="width: 370px;" />
</el-form-item>
<!-- <el-form-item label="品牌ID">-->
<!-- <el-input v-model="form.id" style="width: 370px;" />-->
<!-- </el-form-item>-->
<el-form-item label="品牌名称" prop="brandName">
<el-input v-model="form.brandName" style="width: 370px;" />
</el-form-item>

281
src/views/bxg/shop/yxStoreHotList/index.vue

@ -0,0 +1,281 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<!-- <el-form-item label="榜单列表ID">-->
<!-- <el-input v-model="form.id" style="width: 370px;" />-->
<!-- </el-form-item>-->
<el-form-item label="榜单名称" prop="listName">
<el-input v-model="form.listName" style="width: 370px;" />
</el-form-item>
<el-form-item label="商品列表">
<el-cascader
:props="props"
clearable
@change="cascaderChange($event)"
v-model="productList"
placeholder="试试搜索:眼镜"
:options="cateList"
ref="quitCascader"
filterable></el-cascader>
</el-form-item>
<el-form-item label="是否显示">
<!-- <el-input v-model="form.isShow" style="width: 370px;" />-->
<el-radio-group v-model="form.isShow" style="width: 178px">
<el-radio :label="1">显示</el-radio>
<el-radio :label="0">隐藏</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 370px;" type="number" />
</el-form-item>
<!-- <el-form-item label="添加时间">-->
<!-- <el-input v-model="form.createTime" style="width: 370px;" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="updateTime">-->
<!-- <el-input v-model="form.updateTime" style="width: 370px;" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="删除状态">-->
<!-- <el-input v-model="form.isDel" style="width: 370px;" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="tenantId">-->
<!-- <el-input v-model="form.tenantId" style="width: 370px;" />-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<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('sort')" prop="sort" label="排序" />
<el-table-column v-if="columns.visible('productlist')" prop="productlist" label="商品列表" >
<template slot-scope="scope">
<div v-for="(item,index) in JSON.parse(scope.row.productList)">
<span>top{{index+1}}:{{item.storeName}}</span>
</div>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('isShow')" label="状态" align="center" prop="isShow">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.isShow === 1" :type="''">显示</el-tag>
<el-tag v-else :type=" 'info' ">隐藏</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('createTime')" prop="createTime" label="添加时间">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('updateTime')" prop="updateTime" label="更新时间">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<!-- <el-table-column v-if="columns.visible('isDel')" prop="isDel" label="删除状态" />-->
<!-- <el-table-column v-if="columns.visible('tenantId')" prop="tenantId" label="tenantId" />-->
<el-table-column v-permission="['admin','yxStoreHotList:edit','yxStoreHotList:del']" label="操作" width="150px" align="center">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import Cookies from "js-cookie";
import crudYxStoreHotList from '@/api/bxg/yxStoreHotList'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import MaterialList from "@/components/material";
import {getInfo} from "@/api/bxg/yxStoreProduct";
import {initData} from "@/api/bxg/data";
// crudpresenter
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,
createTime: null, updateTime: null, isDel: null, tenantId: Cookies.get('tenantId') }
export default {
name: 'YxStoreHotList',
components: { pagination, crudOperation, rrOperation, udOperation ,MaterialList},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
oldProductList:[],
props: { multiple: true },
productList:[],
cateList:[],
permission: {
add: ['admin', 'yxStoreHotList:add'],
edit: ['admin', 'yxStoreHotList:edit'],
del: ['admin', 'yxStoreHotList:del']
},
rules: {
listName: [
{ required: true, message: '榜单名称不能为空', trigger: 'blur' }
]
} }
},
watch: {
},
mounted () {
this.getInfo();
},
methods: {
//使
// cascaderChange(val) {
// this.oldProductList= val;
// //,
// if (val.length<=1){
// // this.oldProductList=[]
// }else {
// // productList=this.getCascader(val,this.$refs.cascader.getCheckedNodes());
// // this.label = productList.label; //
// console.log('val',val, this.oldProductList,)
// this.productList=[];
// // console.log('1111',val)
// }
// },
cascaderChange(val) {
this.productList=[]
let productList=[]
productList=this.getCascader(val,this.oldProductList);
this.productList = productList //
this.oldProductList=productList;
this.form.productList=JSON.stringify(this.productList.map(item=>item[1]));
this.$refs.quitCascader.inputValue="你想要框内显示的值"
},
getCascader(newVal,oldVal) {
let productList = []
console.log('val',newVal,'element',oldVal)
//,
if(newVal.length <= 1) {
productList=newVal;
//
}else if(newVal.length < this.oldProductList.length) {
let newValList=newVal.map(item=>item[1])
let oldValList=oldVal.map(item=>item[1])
let diff = newValList.concat(oldValList).filter((value, index, arr) => {
return arr.indexOf(value) === arr.lastIndexOf(value)
});
oldVal.forEach((item,index)=> {
diff.forEach(ele=>{
if(item[1]==ele) {
oldVal.splice(index,1)
}
})
})
productList=oldVal
//
}else {
let newValList=newVal.map(item=>item[1])
let oldValList=oldVal.map(item=>item[1])
let diff = newValList.concat(oldValList).filter((value, index, arr) => {
return arr.indexOf(value) === arr.lastIndexOf(value)
});
// console.log('newValList',newValList,oldValList,diff)
newVal.forEach((item)=> {
diff.forEach(ele=>{
if(item[1]==ele) {
oldVal.push(item)
}
})
});
productList=oldVal
console.log('productList',productList)
}
return productList;
},
change(val){
console.log('选的子级',val)
let productList=val.map(item=>item[1])
this.form.productList=JSON.stringify(productList)
console.log('选的子级',this.form.productList)
},
async getInfo(){
//
let that = this;
await getInfo(0).then( res => {
//
that.cateList = res.cateList
})
for (const item of that.cateList) {
await initData('/bxg/api/yxStoreProduct', {
page: 0,
size: 999,
sort: 'id,desc',
cateId:item.value,
}).then(data=>{
data.content.forEach(ele=>{
//使ele
// let ele1=JSON.parse(JSON.stringify(ele))
// that.$set(ele,'value',ele1)
that.$set(ele,'value',ele.id)
that.$set(ele,'label',ele.storeName)
}
)
that.$set(item,'children',data.content)
})
}
console.log(that.cateList,'that.cateList')
},
//
[CRUD.HOOK.beforeRefresh]() {
return true
}, //
[CRUD.HOOK.afterToCU](crud, form) {
if (form.productList && form.id) {
let data=JSON.parse(this.form.productList)
console.log('data',data)
data.forEach(item=>{
let product=[Number(item.cateId),Number(item.id)]
this.productList.push(product)
})
// product=select
console.log( '111',this.productList,typeof(this.product));
}
},
}
}
</script>
<style scoped>
.table-img {
display: inline-block;
text-align: center;
background: #ccc;
color: #fff;
white-space: nowrap;
position: relative;
overflow: hidden;
vertical-align: middle;
width: 32px;
height: 32px;
line-height: 32px;
}
</style>

1
src/views/bxg/yxEvaluation/index.vue

@ -338,7 +338,6 @@ export default {
// this.product=[50,105]
// this.product=data
console.log( '111',this.product,typeof(this.product));
}
},

Loading…
Cancel
Save