提交 9cbaacb3 authored 作者: pengxiaohui's avatar pengxiaohui

修复bug

上级 732ecdac
......@@ -207,7 +207,7 @@ export default {
const payInfo = JSON.parse(res.payment_more_info)
if (payInfo.appId) {
WeixinJSBridge.invoke('getBrandWCPayRequest', payInfo, (res) => {
console.log(res)
window.location.href = this.order_details_url
})
} else {
console.log('下单失败')
......
......@@ -14,12 +14,13 @@
<van-swipe-item>3</van-swipe-item>
<van-swipe-item>4</van-swipe-item>
</van-swipe> -->
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list
v-model="loading"
class="goods-list"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
@load="goodsListLoad"
>
<div class="goods-item" v-for="item in goodsList" :key="item.id" @click="handleClick(item)">
<div class="thumb">
......@@ -34,6 +35,7 @@
</div>
</div>
</van-list>
</van-pull-refresh>
<ul class="goods-list" v-if="false">
<li class="goods-item" v-for="item in goodsList" :key="item.id" @click="handleClick(item)">
<div class="thumb">
......@@ -64,8 +66,9 @@ export default {
loading: false,
finished: false,
refreshing: false,
page_size: '20',
page: '1'
page_size: '10',
page: '0',
total: 0
}
},
computed: {
......@@ -94,6 +97,15 @@ export default {
return ''
}
},
onRefresh() {
this.finished = false;
// 重新加载数据
// 将 loading 设置为 true,表示处于加载状态
this.loading = true;
this.page = '0'
this.goodsListLoad();
console.log(1243)
},
goodsListLoad() {
this.fetchGetList()
},
......@@ -102,23 +114,30 @@ export default {
shop_id: this.shop_id,
group_id: this.group_id,
spu_name: this.search,
status: '2'
status: '2',
page: this.page,
page_size: this.page_size
}
this.loading = true
getGoodsList(params).then(res => {
this.loading = false
if (res.code === 0 && res.msg === '成功') {
this.goodsList = res.data
this.goodsList = this.goodsList.concat(res.data)
} else {
this.goodsList = []
}
this.total = parseInt(res.page_info.total_number)
if (((parseInt(this.page) + 1) * parseInt(this.page_size)) > this.total) {
this.finished = true
} else {
this.page = parseInt(this.page) + 1 + ''
}
this.loading = false
})
}
},
beforeMount() {
window.localStorage.setItem('shop_id', this.shop_id)
window.localStorage.setItem('group_id', this.group_id)
this.fetchGetList()
// this.fetchGetList()
}
}
</script>
......@@ -142,6 +161,9 @@ export default {
background-color: #39a9ed;
}
}
.goods-list{
padding-bottom:50px;
}
.goods-item{
background:#fff;
position:relative;
......
......@@ -19,7 +19,40 @@
<van-tab title="已完成" name="4"></van-tab>
</van-tabs>
</van-sticky>
<ul class="order-list">
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list
v-model="loading"
class="order-list"
:finished="finished"
finished-text="没有更多了"
@load="fetchOrderList"
>
<div class="order-item" v-for="item in list" :key="item.id" @click="navOrderDetails(item)">
<div class="content">
<div class="thumb">
<img :src="imgJsonParse(item.chart_oss)">
</div>
<div class="right">
<div class="status-row">{{item.order_status | statusFilter}}</div>
<div class="title-row">
<div class="title van-ellipsis">{{item.spu_name}}</div>
<div class="price">{{item.product_price}}</div>
</div>
<div class="spec-row">
<div class="spec">{{item.spec}}</div>
<div>×{{item.buy_count}}</div>
</div>
<div class="sum_pay">需付款¥{{item.payment_money}}</div>
</div>
</div>
<div class="pay_bar" v-if="item.order_status === '1'">
<p><span>更多</span></p>
<van-button plain round type="primary" size="mini" color="#C01540" @click.stop="handlePay(item)">付款</van-button>
</div>
</div>
</van-list>
</van-pull-refresh>
<ul class="order-list" v-if="false">
<li class="order-item" v-for="item in list" :key="item.id" @click="navOrderDetails(item)">
<div class="content">
<div class="thumb">
......@@ -71,6 +104,12 @@ export default {
search: '',
active: '1',
list: [],
loading: false,
finished: false,
refreshing: false,
page_size: '10',
page: '0',
total: 0,
order_details_url: window.location.origin + '/order-details',
dialogVisiable: false,
payType: '12',
......@@ -97,7 +136,7 @@ export default {
if (code) this.fetchOpenId(code)
else this.getCode()
}
this.fetchOrderList()
// this.fetchOrderList()
},
methods: {
handlePay(item) {
......@@ -149,19 +188,36 @@ export default {
return ''
}
},
onRefresh() {
this.finished = false;
// 重新加载数据
// 将 loading 设置为 true,表示处于加载状态
this.loading = true;
this.page = '0'
this.fetchOrderList();
console.log(1243)
},
fetchOrderList() {
const params = {
customer_id: this.user.id,
order_status: this.active,
spu_name: this.search,
page_size: '20'
page_size: this.page_size,
page: this.page
}
getOrderList(params).then(res => {
if (res.code === 0 && res.msg === '成功') {
this.list = res.data
this.list = this.list.concat(res.data)
} else {
this.list = []
}
this.total = parseInt(res.page_info.total_number)
if (((parseInt(this.page) + 1) * parseInt(this.page_size)) > this.total) {
this.finished = true
} else {
this.page = parseInt(this.page) + 1 + ''
}
this.loading = false
})
},
getCode() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论