coupon goods 8.13

This commit is contained in:
ghusermoon 2020-08-13 17:05:02 +08:00
parent f1fbeb65a1
commit e224cffc1c
7 changed files with 245 additions and 12 deletions

View File

@ -411,6 +411,14 @@ export default {
attentionMemberList({ page = 1 } = {}) {
return vm.$u.post('member/attentionMemberList', { page: page });
},
// 可用优惠券商品
couponGoodsList({ voucher_id, page, order }) {
return vm.$u.post('Coupon/couponGoodsList', {
page: page,
voucher_id: voucher_id,
order: order,
});
},
}
}
}

View File

@ -24,7 +24,7 @@
</view>
</view>
</view>
<view class="order-btn" v-if="[1, 2, 3, 4, 8].indexOf(order.view_type) >= 0">
<view class="order-btn" v-if="[1, 2, 3, 4, 8, 11].indexOf(order.view_type) >= 0">
<!-- || order.view_type == 2 -->
<view class="cancel" v-if="(order.view_type == 3) && order.is_refund == 1" @click="toOtherPage('RefundOrder')">申请退款</view>
<view class="cancel" v-if="order.view_type == 3" @click="toOtherPage('Logistics')">查看物流</view>
@ -56,6 +56,7 @@ export default {
methods: {
viewState() {
let state;
// console.log(this.order.view_type);
switch (this.order.view_type) {
case 1:
state = '待支付';
@ -84,6 +85,9 @@ export default {
case 10:
state = '已取消';
break;
case 11:
state = '已拒绝';
break;
default:
break;
}

View File

@ -111,6 +111,11 @@ export default {
if(e.index == 0) this.$u.route('/pageC/cart/index');
// if(e.index == 0) this.show = true;
},
onNavigationBarSearchInputClicked() {
this.$u.route('pageB/search/index', {
type: 2
});
},
methods: {
customers(){
console.log(this.$store.state.hasLogin)

View File

@ -125,6 +125,10 @@ export default {
text: '已取消',
image: '../static/mine/33.png',
},
'10': {
text: '已拒绝',
image: '../static/mine/34.png',
},
},
orderInfo: {},
oid: '',
@ -176,6 +180,9 @@ export default {
case 10:
state = '9';
break;
case 11:
state = '10';
break;
default:
break;
}

View File

@ -69,17 +69,20 @@ export default {
})
},
useCoupon(coupon) {
// console.log(coupon);
if(coupon.type == 1) {
this.$u.route({
type: 'switchTab',
url: 'pages/shop/index',
})
} else if(coupon.type == 2) {
this.$u.route('pageC/merchant/index', {
id: coupon.voucher_store_id,
});
}
console.log(coupon);
// if(coupon.type == 1) {
// this.$u.route({
// type: 'switchTab',
// url: 'pages/shop/index',
// })
// } else if(coupon.type == 2) {
// this.$u.route('pageC/merchant/index', {
// id: coupon.voucher_store_id,
// });
// }
this.$u.route('pageE/useCoupon/index', {
cid: coupon.voucher_id,
});
},
setViewHeight() {
const res = uni.getSystemInfoSync();

193
pageE/useCoupon/index.vue Normal file
View File

@ -0,0 +1,193 @@
<template>
<view class="classify-goods">
<view class="tab-container">
<view class="salenum" :class="{ 'current' : current == 0 }" @click="switchCurrent(0)">销量</view>
<view class="price" :class="{ 'current' : current == 1 }" @click="switchCurrent(1)">
<view class="text">价格</view>
<view class="icon">
<u-icon name="arrow-up-fill" :color="(current == 1 && priceOrderAsc) ? '#FF780F' : '#333333'" size="22"></u-icon>
<u-icon name="arrow-down-fill" :color="(current == 1 && !priceOrderAsc) ? '#FF780F' : '#333333'" size="22"></u-icon>
</view>
</view>
<view class="evaluation" :class="{ 'current' : current == 2 }" @click="switchCurrent(2)">好评</view>
</view>
<scroll-view scroll-y class="goods-container" :style="{ height: scrollHeight }" @scrolltolower="loadMore">
<view v-for="goods in goodsList" :key="goods.goods_id" class="goods-item" @click="toDetailsPage(goods.goods_id)">
<image :src="goods.goods_image"></image>
<view class="right">
<view class="name u-line-1">{{ goods.goods_name }}</view>
<view class="briefing u-line-1">{{ goods.goods_advword }}</view>
<view class="price">{{ goods.goods_price }}</view>
</view>
</view>
<u-loadmore :status="loadStatus" bgColor="#FFFFFF" margin-top="20" margin-bottom="20" v-if="goodsList.length >= pageSize"></u-loadmore>
<u-empty mode="list" v-if="!goodsList.length"></u-empty>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
pageSize: 12,
cid: '',
page: 1,
current: 0,
priceOrderAsc: true, //
goodsList: [],
scrollHeight: '',
loadStatus: 'loadmore',
timer: true, //
}
},
watch: {
current(value) {
this.page = 1;
this.couponGoodsList({ laod: 'reload' });
},
priceOrderAsc(value) {
this.page = 1;
this.couponGoodsList({ laod: 'reload' });
}
},
onLoad(option) {
this.cid = option.cid;
this.couponGoodsList({ load: 'reload' });
this.setViewHeight();
},
methods: {
setOrderSort() {
let sort = '';
if(this.current == 0) {
sort = 'goods_salenum';
} else if (this.current == 1) {
if(this.priceOrderAsc) sort = 'goods_price_asc';
else sort = 'goods_price_desc';
} else if (this.current == 2) {
sort = 'evaluation_count';
}
return sort;
},
// goods_salenum evaluation_count goods_price_asc goods_price_desc
async couponGoodsList({ load = 'reload' } = {}) {
const sort = this.setOrderSort();
const res = await this.$u.api.couponGoodsList({
voucher_id: this.cid,
page: this.page,
order: sort,
})
this.timer = true;
if(res.errCode == 0) {
if(load == 'reload') this.goodsList = res.data.data;
else if(load == 'loadmore') this.goodsList.push(...res.data.data);
}
return res.data.data.length;
},
loadMore() {
if(this.goodsList.length < this.pageSize) return false;
if(!this.timer) return false;
this.loadStatus = "loading";
this.page++;
this.couponGoodsList({ load: 'loadmore' }).then(length => {
if(length == 0) {
this.page--;
this.loadStatus = 'nomore';
} else {
this.loadStatus = 'loading';
}
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
})
},
switchCurrent(current) {
if(current == 1 && this.current == 1) this.priceOrderAsc = !this.priceOrderAsc;
this.current = current;
},
setViewHeight() {
const res = uni.getSystemInfoSync();
this.scrollHeight = res.windowHeight - (res.windowWidth / 750) * 90 + 'px';
},
toDetailsPage(id) {
this.$u.route('/pageB/sdetails/index', {
id: id,
});
}
}
};
</script>
<style lang="scss" scoped>
.classify-goods {
.tab-container {
box-sizing: border-box;
padding: 30rpx 40rpx;
display: flex;
margin-bottom: 30rpx;
> view {
height: 30rpx;
line-height: 30rpx;
flex: 1;
font-size: 32rpx;
color: rgba(51,51,51,1);
}
.salenum {
text-align: left;
}
.price {
display: flex;
align-items: center;
justify-content: center;
.text {
margin-right: 5rpx;
}
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
}
.evaluation {
text-align: right;
}
.current {
color: rgba(255,120,15,1);
}
}
.goods-container {
.goods-item {
margin: 0 auto;
width: 690rpx;
display: flex;
background-color: #F5F5F5;
margin-bottom: 30rpx;
align-items: center;
> image {
width: 220rpx;
height: 200rpx;
flex-shrink: 0;
margin-right: 30rpx;
}
.right {
width: 418rpx;
height: 200rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
.name {
font-size: 30rpx;
color: rgba(51,51,51,1);
}
.briefing {
font-size: 28rpx;
color: rgba(102,102,102,1);
}
.price {
font-size: 26rpx;
color: rgba(255,49,49,1);
}
}
}
}
}
</style>

View File

@ -566,6 +566,19 @@
}
}
},
{
"path": "useCoupon/index",
"style": {
"navigationBarTitleText": "优惠券商品",
"app-plus": {
"titleSize": "36px",
"titleNView": {
"titleColor": "#333333",
"backgroundColor": "#FFFFFF"
}
}
}
},
{
"path": "more/MineHelp",
"style": {