|
|
|
@ -15,9 +15,11 @@
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="250px"> |
|
|
|
|
<el-form-item label="关联商品:" prop="product"> |
|
|
|
|
<el-cascader |
|
|
|
|
style="width:370px" |
|
|
|
|
ref="cascader" |
|
|
|
|
v-model="product" |
|
|
|
|
@change="change" |
|
|
|
|
:props="props" |
|
|
|
|
placeholder="试试搜索:眼镜" |
|
|
|
|
:options="cateList" |
|
|
|
|
filterable></el-cascader> |
|
|
|
@ -125,6 +127,7 @@ import udOperation from '@crud/UD.operation'
|
|
|
|
|
import pagination from '@crud/Pagination' |
|
|
|
|
import MaterialList from "@/components/material"; |
|
|
|
|
import {getInfo} from "@/api/bxg/yxStoreProduct"; |
|
|
|
|
import {getStoreProductAndCart} from "@/api/bxg/yxStoreProduct"; |
|
|
|
|
import {initData} from "@/api/bxg/data"; |
|
|
|
|
import FileUpload from "@comp/FileUpload"; |
|
|
|
|
import VideoUpload from "@comp/VideoUpload"; |
|
|
|
@ -158,39 +161,11 @@ export default {
|
|
|
|
|
product:[], |
|
|
|
|
//分类列表 |
|
|
|
|
cateList:[], |
|
|
|
|
//懒加载暂无法回显,弃用 |
|
|
|
|
// props:{ |
|
|
|
|
// // emitPath:false, |
|
|
|
|
// lazy: true, |
|
|
|
|
// value: 'value', |
|
|
|
|
// label: 'label', |
|
|
|
|
// lazyLoad (node, resolve) { |
|
|
|
|
// console.log('node, resolve',node, resolve) |
|
|
|
|
// const { level,value } = node; |
|
|
|
|
// setTimeout(arrayLike => { |
|
|
|
|
// let productList=[] |
|
|
|
|
// initData('/bxg/api/yxStoreProduct', { |
|
|
|
|
// page: 0, |
|
|
|
|
// size: 999, |
|
|
|
|
// sort: 'id,desc', |
|
|
|
|
// cateId:value, |
|
|
|
|
// }).then(data => { |
|
|
|
|
// console.log('data', data); |
|
|
|
|
// //获取当前分类下的商品列表 |
|
|
|
|
// productList = data.content |
|
|
|
|
// const nodes = Array.from(productList,item=>({ |
|
|
|
|
// value:item, |
|
|
|
|
// label: item.storeName, |
|
|
|
|
// //判断是不是子节点 |
|
|
|
|
// leaf: level >=1 |
|
|
|
|
// }), {length: level + 1}) |
|
|
|
|
// console.log('node, resolve',nodes) |
|
|
|
|
// // 通过调用resolve将子节点数据返回,通知组件数据加载完成 |
|
|
|
|
// resolve(nodes); |
|
|
|
|
// }) |
|
|
|
|
// }, 1000); |
|
|
|
|
// } |
|
|
|
|
// }, |
|
|
|
|
props:{ |
|
|
|
|
value: 'id', |
|
|
|
|
label: 'storeName', |
|
|
|
|
children:'children', |
|
|
|
|
}, |
|
|
|
|
video:[], |
|
|
|
|
picArr:[], |
|
|
|
|
permission: { |
|
|
|
@ -313,18 +288,6 @@ export default {
|
|
|
|
|
handleClick(tab, event) { |
|
|
|
|
console.log(tab, event); |
|
|
|
|
}, |
|
|
|
|
// // 根据id获取商品名,因为异步同步无法实现 |
|
|
|
|
// getProductName(value){ |
|
|
|
|
// console.log(value,'value') |
|
|
|
|
// //这里需要一个同步请求,才能获取商品名字 |
|
|
|
|
// let product='' |
|
|
|
|
// initData('/bxg/api/yxStoreProduct/info/'+value).then((data)=>{ |
|
|
|
|
// product= data.productInfo.store_name |
|
|
|
|
// } |
|
|
|
|
// ) |
|
|
|
|
// console.log(product,product) |
|
|
|
|
// return product |
|
|
|
|
// }, |
|
|
|
|
videoInput(uploadList){ |
|
|
|
|
// console.log(uploadList,'uploadList'); |
|
|
|
|
// this.video =[] |
|
|
|
@ -336,31 +299,11 @@ export default {
|
|
|
|
|
// }) |
|
|
|
|
}, |
|
|
|
|
async getInfo(){ |
|
|
|
|
//查询商品分类 |
|
|
|
|
//查询商品分类及商品 |
|
|
|
|
let that = this; |
|
|
|
|
await getInfo(0).then( res => { |
|
|
|
|
//商品分类 |
|
|
|
|
that.cateList = res.cateList |
|
|
|
|
await getStoreProductAndCart().then(res=>{ |
|
|
|
|
that.cateList=res; |
|
|
|
|
}) |
|
|
|
|
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]() { |
|
|
|
|