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

修复bug

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