过滤商品列表,小程序用户可看到全部商品
This commit is contained in:
parent
9b8824842d
commit
c80e33f87d
@ -59,7 +59,11 @@ public class GoodsMainController extends BaseController {
|
|||||||
startPage();
|
startPage();
|
||||||
LambdaQueryWrapper<GoodsMain> lqw = Wrappers.lambdaQuery(goodsMain);
|
LambdaQueryWrapper<GoodsMain> lqw = Wrappers.lambdaQuery(goodsMain);
|
||||||
|
|
||||||
lqw.eq(!isAdmin(), GoodsMain::getDeptId, getDeptId());
|
|
||||||
|
// 不是系统管理员且不是小程序用户的时候仅能看到自己部门的
|
||||||
|
lqw.eq(!isAdmin() && !getUsername().contains("mini-"),
|
||||||
|
GoodsMain::getDeptId, getDeptId());
|
||||||
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(goodsMain.getGoodsName())) {
|
if (StringUtils.isNotBlank(goodsMain.getGoodsName())) {
|
||||||
lqw.like(GoodsMain::getGoodsName, goodsMain.getGoodsName());
|
lqw.like(GoodsMain::getGoodsName, goodsMain.getGoodsName());
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import request from '../js/request'
|
import request from '../js/request'
|
||||||
import { baseUrl } from '../baseDefine'
|
import { baseUrl } from '../baseDefine'
|
||||||
|
|
||||||
@ -10,7 +9,6 @@ export const formHeader = {
|
|||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口
|
* 接口
|
||||||
*/
|
*/
|
||||||
@ -34,10 +32,9 @@ class Xiao4rApis {
|
|||||||
// 根据字典类型查询字典数据信息
|
// 根据字典类型查询字典数据信息
|
||||||
getDicts(dictType) {
|
getDicts(dictType) {
|
||||||
return request.get({
|
return request.get({
|
||||||
url: '/system/dict/data/type/' + dictType,
|
url: baseUrl + 'system/dict/data/type/' + dictType
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new Xiao4rApis()
|
export default new Xiao4rApis()
|
||||||
|
@ -127,7 +127,7 @@
|
|||||||
</van-col>
|
</van-col>
|
||||||
|
|
||||||
|
|
||||||
<van-col offset="2" span="11">
|
<van-col offset="1" span="11">
|
||||||
<div class="menu-desc" @tap="onNavItem(navDefine.HOME_MENU2)">
|
<div class="menu-desc" @tap="onNavItem(navDefine.HOME_MENU2)">
|
||||||
<div class="fxc">
|
<div class="fxc">
|
||||||
<span style="font-size: 16px;">购买庄酒</span>
|
<span style="font-size: 16px;">购买庄酒</span>
|
||||||
|
@ -29,8 +29,8 @@ module.exports.parseImage = parseImage;
|
|||||||
|
|
||||||
<div style="display: flex;flex-wrap: wrap;">
|
<div style="display: flex;flex-wrap: wrap;">
|
||||||
<div class="filter-button" v-for="(item,index) in filterButtons">
|
<div class="filter-button" v-for="(item,index) in filterButtons">
|
||||||
<van-button round size="small" :color=" currentFilter === item ? '#7232dd' : '#7232dd' "
|
<van-button round size="small" :color="currentFilter.dictLabel === item.dictLabel ? '#7232dd' : '#7232dd' "
|
||||||
:plain="currentFilter === item ? false : true" @tap="onFilterBtn(item)">{{item}}
|
:plain="currentFilter.dictLabel === item.dictLabel ? false : true" @tap="onFilterBtn(item)">{{item.dictLabel}}
|
||||||
</van-button>
|
</van-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -67,6 +67,7 @@ import appManager from '../../../appManager'
|
|||||||
import mallApis from '../../../apis/mallApis'
|
import mallApis from '../../../apis/mallApis'
|
||||||
import defaultMix from '../../../mixins/defaultMix'
|
import defaultMix from '../../../mixins/defaultMix'
|
||||||
import { goodsDetailPage } from '../../../store/constant/nav/pages'
|
import { goodsDetailPage } from '../../../store/constant/nav/pages'
|
||||||
|
import xiao4rApis from '../../../apis/xiao4rApis'
|
||||||
|
|
||||||
wepy.component({
|
wepy.component({
|
||||||
store,
|
store,
|
||||||
@ -75,8 +76,10 @@ wepy.component({
|
|||||||
data: {
|
data: {
|
||||||
active: 0,
|
active: 0,
|
||||||
records: [],
|
records: [],
|
||||||
currentFilter: '全部',
|
currentFilter: {
|
||||||
filterButtons: ['全部']
|
dictLabel: '全部'
|
||||||
|
},
|
||||||
|
filterButtons: []
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -95,16 +98,15 @@ wepy.component({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onFilterBtn(item) {
|
onFilterBtn(item) {
|
||||||
console.log(item)
|
|
||||||
this.currentFilter = item
|
this.currentFilter = item
|
||||||
},
|
},
|
||||||
parseImage(imageKey) {
|
|
||||||
return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
|
|
||||||
},
|
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
|
|
||||||
this.isInit = false
|
this.isInit = false
|
||||||
|
|
||||||
|
const dict = await xiao4rApis.getDicts('goods_type')
|
||||||
|
|
||||||
|
this.filterButtons = dict.data
|
||||||
|
|
||||||
const req = await mallApis.getGoodsList()
|
const req = await mallApis.getGoodsList()
|
||||||
|
|
||||||
this.records = req.rows
|
this.records = req.rows
|
||||||
@ -114,14 +116,6 @@ wepy.component({
|
|||||||
},
|
},
|
||||||
|
|
||||||
ready() {
|
ready() {
|
||||||
let i = 0
|
|
||||||
while (true) {
|
|
||||||
this.filterButtons.push('按钮按钮' + i)
|
|
||||||
i++
|
|
||||||
if (i > 8) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.init()
|
this.init()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user