Browse Source

优化商品查询方法

master
sj 2 years ago
parent
commit
6954e3bf8c
  1. 7
      src/api/bxg/yxStoreProduct.js
  2. 4
      src/views/bxg/activity/storecouponuser/index.vue
  3. 35
      src/views/bxg/shop/yxStoreHotListRecord/index.vue
  4. 79
      src/views/bxg/yxEvaluation/index.vue

7
src/api/bxg/yxStoreProduct.js

@ -81,3 +81,10 @@ export function getInfo(id) {
method: 'get'
})
}
export function getStoreProductAndCart() {
return request({
url: '/bxg/api/yxStoreProductAndCart',
method: 'get'
})
}

4
src/views/bxg/activity/storecouponuser/index.vue

@ -27,12 +27,12 @@
<el-table-column prop="useMinPrice" label="优惠券最低消费" />
<el-table-column label="优惠券开始时间">
<template slot-scope="scope">
{{ formatTimeTwo(scope.row.addTime) }}
{{ formatTimeTwo(scope.row.useStartTime) }}
</template>
</el-table-column>
<el-table-column label="优惠券结束时间">
<template slot-scope="scope">
{{ formatTimeTwo(scope.row.endTime) }}
{{ formatTimeTwo(scope.row.useEndTime) }}
</template>
</el-table-column>
<el-table-column label="获取方式">

35
src/views/bxg/shop/yxStoreHotListRecord/index.vue

@ -47,6 +47,7 @@
@change="change"
placeholder="选择商品"
:options="cateList"
:props="props"
filterable>
</el-cascader>
</el-form-item>
@ -154,7 +155,7 @@ import pagination from '@crud/Pagination'
import MaterialList from "@/components/material";
import crudOperation from "@crud/CRUD.operation";
import {initData} from "@/api/bxg/data";
import {getInfo} from "@/api/bxg/yxStoreProduct";
import {getInfo, getStoreProductAndCart} from "@/api/bxg/yxStoreProduct";
// crudpresenter
const defaultCrud = CRUD({ title: '榜单记录', url: 'bxg/api/yxStoreHotListRecord', sort: 'id,desc', crudMethod: { ...crudYxStoreHotListRecord }})
@ -179,7 +180,12 @@ export default {
price: [{ required: true, message: "商品价格不能为空", trigger: "blur" }],
hotSales: [{ required: true, message: "商品销量不能为空", trigger: "blur" }],
mouth: [{ required: true, message: "参与月份不能为空", trigger: "blur" }],
}
},
props:{
value: 'id',
label: 'storeName',
children:'children',
},
}
},
mounted () {
@ -218,29 +224,10 @@ export default {
that.hotList=data.content
//
}),
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)
await getStoreProductAndCart().then(res=>{
that.cateList=res;
})
}
console.log(that.cateList,'that.cateList')
// console.log(that.cateList,'that.cateList')
},
dataFilter(val){
this.value=val

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

@ -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]() {

Loading…
Cancel
Save