提交 9887c328 authored 作者: pengxiaohui's avatar pengxiaohui

修改订单搜索

上级 82b12ecf
......@@ -34,7 +34,7 @@ export function checkPayStatus(params) {
* 查询订单列表
*/
export function getOrderList(data) {
return httpRequest.post('/api/shop/order/search', data)
return httpRequest.post('/api/shop/order/range/search', data)
}
/**
* 查询订单详情
......
<template>
<div class="main-container">
<app-search-bar v-model="search" @change="handleSearchChange"/>
<van-sticky class="search-cont">
<van-search
v-model="search"
shape="round"
size="mini"
background="transparent"
placeholder="搜索商品"
@input="handleSearchChange"
/>
</van-sticky>
<!-- <div class="notice">
<van-notice-bar color="#333" background="transparent" scrollable text="技术是开发它的人的共同灵魂。" >
<template slot="left-icon">
......@@ -20,7 +29,7 @@
class="goods-list"
:finished="finished"
finished-text="没有更多了"
@load="goodsListLoad"
@load="fetchGoodsList"
>
<div class="goods-item" v-for="item in goodsList" :key="item.id" @click="handleClick(item)">
<div class="thumb">
......@@ -76,10 +85,10 @@ export default {
return this.$route.query
},
shop_id() {
return this.query.shop_id || window.localStorage.getItem('shop_id') || '6800681447305773056'
return this.query.shop_id || window.sessionStorage.getItem('shop_id') || '6800681447305773056'
},
group_id() {
return this.query.group_id || window.localStorage.getItem('group_id') || ''
return this.query.group_id || window.sessionStorage.getItem('group_id') || ''
}
},
methods: {
......@@ -87,7 +96,14 @@ export default {
this.$router.push({ path: 'buy', query: { spu_id: val.spu_id, shop_id: val.shop_id } })
},
handleSearchChange() {
this.fetchGetList()
this.goodsList = []
this.loading = false
this.finished = false
this.refreshing = false
this.page_size = '10'
this.page = '0'
this.total = 0
this.fetchGoodsList()
},
imgJsonParse(val) {
if (typeof val === 'string' && typeof JSON.parse(val) === 'object') {
......@@ -107,9 +123,9 @@ export default {
console.log(1243)
},
goodsListLoad() {
this.fetchGetList()
this.fetchGoodsList()
},
fetchGetList() {
fetchGoodsList() {
const params = {
shop_id: this.shop_id,
group_id: this.group_id,
......@@ -120,6 +136,7 @@ export default {
}
getGoodsList(params).then(res => {
if (res.code === 0 && res.msg === '成功') {
console.log(this.goodsList)
this.goodsList = this.goodsList.concat(res.data)
} else {
this.goodsList = []
......@@ -135,9 +152,9 @@ export default {
}
},
beforeMount() {
window.localStorage.setItem('shop_id', this.shop_id)
window.localStorage.setItem('group_id', this.group_id)
// this.fetchGetList()
window.sessionStorage.setItem('shop_id', this.shop_id)
window.sessionStorage.setItem('group_id', this.group_id)
// this.fetchGoodsList()
}
}
</script>
......@@ -214,4 +231,27 @@ export default {
}
}
}
.search-cont {
.van-sticky{
padding:0.2rem 0.3rem 0.3rem;
.van-search{
padding:0;
.van-search__content{
background:#fff;
.van-cell {
padding: 5px 8px 5px 0 !important;
}
}
}
}
.van-sticky--fixed{
background:#fff;
box-shadow: 0 8px 12px #ebedf0;
.van-search{
.van-search__content{
background:#f7f7f7;
}
}
}
}
</style>
......@@ -9,7 +9,7 @@
size="small"
background="#f7f7f7"
placeholder="搜索订单"
@input="fetchOrderList"
@input="handleSearch"
/>
</div>
<van-tabs v-model="active" @change="handleTabChange">
......@@ -139,6 +139,16 @@ export default {
// this.fetchOrderList()
},
methods: {
handleSearch() {
this.list = []
this.loading = false
this.finished = false
this.refreshing = false
this.page_size = '10'
this.page = '0'
this.total = 0
this.fetchOrderList()
},
handleTabChange() {
this.list = []
this.page = '0'
......@@ -203,16 +213,27 @@ export default {
this.loading = true;
this.page = '0'
this.fetchOrderList();
console.log(1243)
},
fetchOrderList() {
const params = {
shop_id: '',
customer_id: this.user.id,
order_status: this.active,
spu_name: this.search,
search_field: this.search ? 'spu_name' : '',
search_value: this.search,
page_size: this.page_size,
payment_method: '',
page: this.page
}
// const params = {
// shop_id: '6806052866961178624',
// search_field: 'spu_name',
// search_value: '课',
// order_status: '',
// payment_method: '',
// page: '0',
// page_size: '20'
// }
getOrderList(params).then(res => {
if (res.code === 0 && res.msg === '成功') {
this.list = this.list.concat(res.data)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论