group buy 8.8

This commit is contained in:
ghusermoon 2020-08-08 12:07:50 +08:00
parent 1ee0dd4b25
commit 02702bc447
16 changed files with 110 additions and 93 deletions

View File

@ -105,6 +105,7 @@ export default {
flex-shrink: 0; flex-shrink: 0;
} }
.title-wrap { .title-wrap {
flex: 1;
.item-top { .item-top {
font-size: 30rpx; font-size: 30rpx;
color: rgba(51,51,51,1); color: rgba(51,51,51,1);

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="order-item"> <view class="order-item" v-if="order.extend_store">
<view class="order-title"> <view class="order-title">
<view class="store-info"> <view class="store-info">
<image :src="order.extend_store.store_avatar"></image> <image :src="order.extend_store.store_avatar"></image>
@ -24,13 +24,14 @@
</view> </view>
</view> </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, 9].indexOf(order.view_type) >= 0">
<view class="cancel" v-if="(order.view_type == 3 || order.view_type == 2) && order.is_refund == 1" @click="toOtherPage('RefundOrder')">申请退款</view> <view class="cancel" v-if="(order.view_type == 3 || order.view_type == 2) && order.is_refund == 1" @click="toOtherPage('RefundOrder')">申请退款</view>
<view class="cancel" v-if="order.view_type == 3" @click="toOtherPage('Logistics')">查看物流</view> <view class="cancel" v-if="order.view_type == 3" @click="toOtherPage('Logistics')">查看物流</view>
<view class="logistics" v-if="order.view_type == 3" @click="confirmReceive">确认收货</view> <view class="logistics" v-if="order.view_type == 3" @click="confirmReceive">确认收货</view>
<view class="comment" v-if="order.view_type == 4" @click="toOtherPage('Comment')">立即评价</view> <view class="comment" v-if="order.view_type == 4" @click="toOtherPage('Comment')">立即评价</view>
<view class="cancel" v-if="order.view_type == 1" @click="cancelOrder">取消支付</view> <view class="cancel" v-if="order.view_type == 1" @click="cancelOrder">取消支付</view>
<view class="payment" v-if="order.view_type == 1" @click="payNow(order.pay_sn, order.order_amount,order.order_id)">立即支付</view> <view class="cancel" v-if="order.view_type == 9" @click="cancelOrder">取消订单</view>
<view class="payment" v-if="order.view_type == 1 || order.view_type == 9" @click="payNow(order.pay_sn, order.order_amount,order.order_id)">立即支付</view>
<view class="service" v-if="order.view_type == 8">联系官方客服</view> <view class="service" v-if="order.view_type == 8">联系官方客服</view>
<view class="submit" v-if="order.view_type == 8">提交官方审核</view> <view class="submit" v-if="order.view_type == 8">提交官方审核</view>
</view> </view>

View File

@ -8,13 +8,16 @@
</view> </view>
</view> </view>
<view class="label"> <view class="label">
<u-tabs-swiper ref="group" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="24" :show-bar="false" @change="tabsChange" height="60"></u-tabs-swiper> <!-- <u-tabs-swiper ref="group" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="24" :show-bar="false" @change="tabsChange" height="60"></u-tabs-swiper> -->
<u-tabs :list="classifyList" name="gc_name" :is-scroll="true" :current="current" @change="tabsChange" active-color="#FF780F" :show-bar="false" height="60" font-size="24" inactive-color="#333333"></u-tabs>
</view> </view>
<swiper :current="swiperCurrent" @animationfinish="animationfinish" style="height: 340rpx;"> <swiper :current="swiperCurrent" @animationfinish="animationfinish" style="height: 340rpx;">
<swiper-item class="swiper-item list" v-for="(_, i) in classifyList" :key="i"> <swiper-item class="swiper-item list" v-for="(_, i) in classifyList" :key="i">
<!-- 最多显示3个 --> <!-- 最多显示3个 -->
<sitem :info="info" v-for="(info, index) in groupList.slice(0, 3)" :key="index"></sitem> <view v-if="groupList[i]">
<u-empty text="暂无拼团商品" mode="list" color="#000" v-if="!groupList.length" style="margin: 0 auto;"></u-empty> <sitem :info="info" v-for="(info, index) in groupList[i].slice(0, 3)" :key="index"></sitem>
</view>
<u-empty text="暂无拼团商品" mode="list" color="#000" v-if="!groupList[i] || !groupList[i].length" style="margin: 0 auto;"></u-empty>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
@ -58,7 +61,9 @@ export default {
page: 0, page: 0,
gc_id: id, gc_id: id,
}).then(res => { }).then(res => {
this.groupList = res.data; this.groupList[this.current] = res.data;
// console.log(this.groupList);
this.$forceUpdate();
}) })
}, },
tabsChange(index) { tabsChange(index) {

View File

@ -2,14 +2,15 @@
<view class="list"> <view class="list">
<view class="top">商品推荐</view> <view class="top">商品推荐</view>
<view> <view>
<u-tabs-swiper ref="uTabs" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="26" :show-bar="false" @change="tabsChange" height="60"></u-tabs-swiper> <!-- <u-tabs-swiper ref="uTabs" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="26" :show-bar="false" @change="tabsChange" height="60"></u-tabs-swiper> -->
<u-tabs :list="classifyList" name="gc_name" :is-scroll="true" :current="current" @change="tabsChange" active-color="#FF780F" :show-bar="false" height="60" font-size="24" inactive-color="#333333"></u-tabs>
</view> </view>
<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" :style="{height: swiperHeight}"> <swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish" :style="{height: swiperHeight}">
<swiper-item class="swiper-item" v-for="(_, index) in classifyList" :key="index"> <swiper-item class="swiper-item" v-for="(_, index) in classifyList" :key="index">
<view class="goods-item" v-if="goodsList.length"> <view class="goods-item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item> <item v-for="item in goodsList[index]" :key="item.goods_id" :info="item"></item>
</view> </view>
<u-empty text="暂无商品" mode="list" color="#000" margin-top="20" v-else></u-empty> <u-empty text="暂无商品" mode="list" color="#000" margin-top="20" v-if="!goodsList[index] || !goodsList[index].length"></u-empty>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- 加载更多 --> <!-- 加载更多 -->
@ -39,7 +40,7 @@ export default {
watch: { watch: {
current(index) { current(index) {
this.page = 1; this.page = 1;
this.goodsList = []; // this.goodsList = [];
const id = this.classifyList[index].gc_id; const id = this.classifyList[index].gc_id;
this.getGoodsRecommend({gc_id: id}); this.getGoodsRecommend({gc_id: id});
} }
@ -86,34 +87,30 @@ export default {
// this.swiperCurrent = this.current; // this.swiperCurrent = this.current;
if (res.errCode == 0) { if (res.errCode == 0) {
this.timer = true; this.timer = true;
if(reload) this.goodsList = res.data.goodsList; if(reload) this.goodsList[this.current] = res.data.goodsList;
else this.goodsList.push(...res.data.goodsList); else this.goodsList[this.current].push(...res.data.goodsList);
// console.log(this.goodsList); // console.log(this.goodsList);
this.setSwiperHeight(); this.setSwiperHeight();
} }
this.$forceUpdate();
return res.data.goodsList.length; return res.data.goodsList.length;
}, },
setSwiperHeight() { setSwiperHeight() {
// height: 230px, margin-bottom: 13 // height: 480rpx, margin-bottom: 26rpx
const height = Math.ceil(this.goodsList.length / 2) * (500 + 26); const height = Math.ceil(this.goodsList[this.current].length / 2) * (480 + 26);
this.swiperHeight = height == 0 ? '230rpx' : height + 'rpx'; this.swiperHeight = height == 0 ? '230rpx' : height + 'rpx';
// this.swiperHeight = Math.ceil(this.goodsList.length / 2) * (270 + 13) + 'px'; // console.log(this.swiperHeight);
}, },
// tabsswiper // tabsswiper
tabsChange(index) { tabsChange(index) {
this.current = index; this.current = index;
this.swiperCurrent = this.current;
// this.getGoodsRecommend({ gc_id: this.classifyList[this.current].gc_id }); // this.getGoodsRecommend({ gc_id: this.classifyList[this.current].gc_id });
}, },
// swiper-itemtabs
transition(e) {
let dx = e.detail.dx;
this.$refs.uTabs.setDx(dx);
},
// swiperswiperdx // swiperswiperdx
// swipertabsswiper // swipertabsswiper
animationfinish(e) { animationfinish(e) {
let current = e.detail.current; let current = e.detail.current;
this.$refs.uTabs.setFinishCurrent(current);
this.current = current; this.current = current;
this.swiperCurrent = current; this.swiperCurrent = current;
// this.getGoodsRecommend({ gc_id: this.classifyList[this.current].gc_id }); // this.getGoodsRecommend({ gc_id: this.classifyList[this.current].gc_id });
@ -136,8 +133,7 @@ export default {
} }
.swiper-box { .swiper-box {
height: 100%; height: 100%;
padding: 20rpx 0; padding-top: 20rpx;
margin-bottom: 10rpx;
.swiper-item { .swiper-item {
// height: 100%; // height: 100%;
.goods-item { .goods-item {

View File

@ -65,6 +65,7 @@ export default {
margin-bottom: 16rpx; margin-bottom: 16rpx;
font-size: 26rpx; font-size: 26rpx;
font-weight: 600; font-weight: 600;
height: 60rpx;
line-height: 30rpx; line-height: 30rpx;
color: #333; color: #333;
} }

View File

@ -7,7 +7,7 @@
<u-icon name="arrow-right" color="#999" size="22"></u-icon> <u-icon name="arrow-right" color="#999" size="22"></u-icon>
</view> </view>
</view> </view>
<view class="connect"> <view class="connect" @click="toOthersPage">
<view class="time" v-if="type == 'spike'"> <view class="time" v-if="type == 'spike'">
<image src="/static/image/common/15.png"></image> <image src="/static/image/common/15.png"></image>
<text>{{ info.groupbuy_starttime_histime }}</text> <text>{{ info.groupbuy_starttime_histime }}</text>
@ -42,8 +42,8 @@ export default {
this.$u.route({ this.$u.route({
url: 'pageB/sdetails/index', url: 'pageB/sdetails/index',
params: { params: {
id: this.recommendData.groupbuy_id, id: this.recommendData.goods_id,
type: 3, // type: 3,
} }
}) })
} }

View File

@ -61,8 +61,8 @@ export default {
this.$u.route({ this.$u.route({
url: 'pageB/sdetails/index', url: 'pageB/sdetails/index',
params: { params: {
id: this.item.groupbuy_id, id: this.item.goods_id,
type: 3, // type: 3,
} }
}) })
}, },
@ -85,8 +85,8 @@ export default {
this.$u.route({ this.$u.route({
url: 'pageB/sdetails/index', url: 'pageB/sdetails/index',
params: { params: {
id: this.item.pintuan_id, id: this.item.goods_id,
type: 2, // type: 2,
} }
}) })
} }

View File

@ -4,15 +4,18 @@
<view class="title">全部优惠券</view> <view class="title">全部优惠券</view>
<view class="view-more" @click="toCouponPage">查看更多></view> <view class="view-more" @click="toCouponPage">查看更多></view>
</view> </view>
<u-tabs-swiper ref="coupon" :list="couponGroupList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="60" ></u-tabs-swiper> <!-- <u-tabs-swiper ref="coupon" :list="couponGroupList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="60" ></u-tabs-swiper> -->
<u-tabs :list="couponGroupList" name="gc_name" :is-scroll="true" :current="couponCurrent" @change="couponTabsChange" active-color="#FF780F" :show-bar="false" height="60" font-size="24" inactive-color="#333333"></u-tabs>
<!-- :style="{ height: swiperHeight }" --> <!-- :style="{ height: swiperHeight }" -->
<swiper class="box" :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{height: swiperHeight}"> <swiper class="box" :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{height: swiperHeight}">
<swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i"> <swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i">
<!-- 最多显示四个 --> <!-- 最多显示四个 -->
<view v-for="(coupon, index) in couponList.slice(0, 4)" :key="index" class="coupon-item"> <view v-if="couponList[i]">
<view v-for="(coupon, index) in couponList[i].slice(0, 4)" :key="index" class="coupon-item">
<Coupon :couponInfo="coupon" :status='0' :type="0"></Coupon> <Coupon :couponInfo="coupon" :status='0' :type="0"></Coupon>
</view> </view>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty> </view>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList[i] || !couponList[i].length"></u-empty>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
@ -56,16 +59,18 @@ export default {
gc_id: gc_id, gc_id: gc_id,
}).then(res => { }).then(res => {
if(res.errCode == 0) { if(res.errCode == 0) {
this.couponList = res.data; this.couponList[this.couponCurrent] = res.data;
} else { } else {
this.couponList = []; this.couponList[this.couponCurrent] = [];
} }
// swiper // swiper
this.setViewHeight(); this.setViewHeight();
this.$forceUpdate();
}) })
}, },
couponTabsChange(index) { couponTabsChange(index) {
this.couponCurrent = index; this.couponCurrent = index;
this.swiperCouponCurrent = this.couponCurrent;
}, },
couponAnimationFinish(e) { couponAnimationFinish(e) {
const current = e.detail.current; const current = e.detail.current;
@ -75,8 +80,8 @@ export default {
setViewHeight() { setViewHeight() {
// 97px, 10px // 97px, 10px
let num = 0; let num = 0;
num = this.couponList.length num = this.couponList[this.couponCurrent].length
? this.couponList.length > 4 ? 4 : this.couponList.length ? this.couponList[this.couponCurrent].length > 4 ? 4 : this.couponList[this.couponCurrent].length
: 1 : 1
this.swiperHeight = (200 + 20) * num + 'rpx'; this.swiperHeight = (200 + 20) * num + 'rpx';
}, },

View File

@ -201,7 +201,7 @@ export default {
showInvolvementUser: false, // showInvolvementUser: false, //
involvemenGroupInfo: [], // involvemenGroupInfo: [], //
groupbuyInfo: {}, // groupbuyInfo: {}, //
spikeTime: '', spikeTime: '00:00:00',
isSpike: false, // isSpike: false, //
timer: '', // timer: '', //
spec_id: '', // id, spec_id: '', // id,
@ -360,7 +360,7 @@ export default {
this.id = res.data.goods.pintuan_id; this.id = res.data.goods.pintuan_id;
this.getGoodsDetails(this.id); this.getGoodsDetails(this.id);
} else if(this.type == 3) { } else if(this.type == 3) {
this.id = res.data.goods.groupbuy_id; this.id = res.data.groupbuy_id;
this.getGoodsDetails(this.id); this.getGoodsDetails(this.id);
} }
} }
@ -388,12 +388,12 @@ export default {
groupbuy_id: id groupbuy_id: id
}).then(res => { }).then(res => {
if(res.errCode == 0) { if(res.errCode == 0) {
this.id = res.data.groupbuy_id; // this.id = res.data.groupbuy_id;
this.groupbuyInfo = res.data.groupbuyInfo; this.groupbuyInfo = res.data.groupbuyInfo;
this.evaluate = res.data.goodsInfo.goods_evaluate_info; this.evaluate = res.data.goodsInfo.goods_evaluate_info;
this.goodsInfo = res.data.goodsInfo.goods; this.goodsInfo = res.data.goodsInfo.goods;
this.setSwiperList(res.data.goodsInfo.goods_image); this.setSwiperList(res.data.goodsInfo.goods_image);
this.setSpikeTime(res.data.groupbuyInfo.groupbuy_endtime); this.setSpikeTime(res.data.groupbuyInfo.groupbuy_starttime);
} }
}) })
}, },
@ -423,7 +423,7 @@ export default {
if(type == 'involvement') { if(type == 'involvement') {
// const userId = uni.getStorageSync('user_info').member.member_id; // const userId = uni.getStorageSync('user_info').member.member_id;
this.$store.commit('setGroupHeadId', this.involvemenGroupInfo[0].user_id); this.$store.commit('setGroupHeadId', this.involvemenGroupInfo[0].user_id);
console.log(this.$store.state.pintuangroup_headid); // console.log(this.$store.state.pintuangroup_headid);
Object.assign(params, { Object.assign(params, {
pintuan_id: this.id, pintuan_id: this.id,
pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id, pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id,
@ -492,6 +492,7 @@ export default {
title = '秒杀商品详情'; title = '秒杀商品详情';
break; break;
default: default:
title = '商品详情';
break; break;
} }
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({

View File

@ -464,6 +464,8 @@ export default {
justify-content: space-between; justify-content: space-between;
.name { .name {
font-size: 30rpx; font-size: 30rpx;
height: 88rpx;
line-height: 44rpx;
color: rgba(51,51,51,1); color: rgba(51,51,51,1);
} }
.cart-info { .cart-info {

View File

@ -5,7 +5,7 @@
<view class="price">{{ price }}</view> <view class="price">{{ price }}</view>
</view> </view>
<view class="pay-view"> <view class="pay-view">
<u-radio-group v-model="pay_way" @change="radioGroupChange" size="16"> <u-radio-group v-model="pay_way" size="16">
<view v-for="(item, index) in payLiat" :key="index" class="pay-item"> <view v-for="(item, index) in payLiat" :key="index" class="pay-item">
<view class="pay-way"> <view class="pay-way">
<image :src="item.icon"></image> <image :src="item.icon"></image>
@ -53,12 +53,6 @@ export default {
this.order_id = option.order_id; this.order_id = option.order_id;
}, },
methods: { methods: {
radioGroupChange(e) {
// console.log(e);
},
// getProvider() {
// uni.getProvider({service: 'payment'})
// },
payOrder(provider, orderInfo) { payOrder(provider, orderInfo) {
let me = this; let me = this;
uni.requestPayment({ uni.requestPayment({

View File

@ -3,13 +3,13 @@
<view class="title"> <view class="title">
<view class="name">全部秒杀</view> <view class="name">全部秒杀</view>
<view class="time"> <view class="time">
<text class="num">{{ seckillTime.littleHour }}</text> <text class="num">{{ seckillTime.littleHour || '00' }}</text>
<text class="mah">:</text> <text class="mah">:</text>
<text class="num">00</text> <text class="num">00</text>
<text class="mah">:</text> <text class="mah">:</text>
<text class="num">00</text> <text class="num">00</text>
<text>-</text> <text>-</text>
<text class="num">{{ seckillTime.bigHour }}</text> <text class="num">{{ seckillTime.bigHour || '00' }}</text>
<text class="mah">:</text> <text class="mah">:</text>
<text class="num">00</text> <text class="num">00</text>
<text class="mah">:</text> <text class="mah">:</text>
@ -18,6 +18,7 @@
</view> </view>
<view class="spike-list"> <view class="spike-list">
<SpecialGoods v-for="(item, index) in spikeList" :key="index" :item="item" type='spike'></SpecialGoods> <SpecialGoods v-for="(item, index) in spikeList" :key="index" :item="item" type='spike'></SpecialGoods>
<u-empty mode="list" v-if="!spikeList.length" :margin-top="240"></u-empty>
</view> </view>
</view> </view>
</template> </template>

View File

@ -1,9 +1,10 @@
<template> <template>
<view class="coupon-swiper"> <view class="coupon-swiper">
<scroll-view scroll-x="true" class="classify-coupon"> <!-- <scroll-view scroll-x="true" class="classify-coupon">
<view v-for="(classify, index) in couponGroupList" :key="index" class="classify-item" :class="{ 'active': couponCurrent == index }" @click="couponTabsChange(index)">{{ classify.gc_name }}</view> <view v-for="(classify, index) in couponGroupList" :key="index" class="classify-item" :class="{ 'active': couponCurrent == index }" @click="couponTabsChange(index)">{{ classify.gc_name }}</view>
</scroll-view> </scroll-view> -->
<!-- <swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{ height: swiperHeight }"> <u-tabs :list="couponGroupList" name="gc_name" :is-scroll="true" :current="couponCurrent" @change="couponTabsChange" active-color="#FF780F" :show-bar="false" height="88" font-size="24" inactive-color="#333333"></u-tabs>
<swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i"> <swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i">
<scroll-view scroll-y style="height: 100%;" @scrolltolower="onreachBottom" class="coupon-scroll"> <scroll-view scroll-y style="height: 100%;" @scrolltolower="onreachBottom" class="coupon-scroll">
<view v-for="(coupon, index) in couponList" :key="index" class="coupon-item"> <view v-for="(coupon, index) in couponList" :key="index" class="coupon-item">
@ -13,14 +14,14 @@
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty> <u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
</swiper> --> </swiper>
<scroll-view scroll-y style="height: 100%;" @scrolltolower="onreachBottom" class="coupon-scroll" :style="{ height: swiperHeight }"> <!-- <scroll-view scroll-y style="height: 100%;" @scrolltolower="onreachBottom" class="coupon-scroll" :style="{ height: swiperHeight }">
<view v-for="(coupon, index) in couponList" :key="index" class="coupon-item"> <view v-for="(coupon, index) in couponList" :key="index" class="coupon-item">
<Coupon :couponInfo="coupon" :status='0' :type="0" @exchange="exchangeCoupon($event)"></Coupon> <Coupon :couponInfo="coupon" :status='0' :type="0" @exchange="exchangeCoupon($event)"></Coupon>
</view> </view>
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" v-if="couponList.length>=pageSize" @loadmore="onreachBottom"></u-loadmore> <u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" v-if="couponList.length>=pageSize" @loadmore="onreachBottom"></u-loadmore>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty> <u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
</scroll-view> </scroll-view> -->
</view> </view>
</template> </template>
<script> <script>

View File

@ -67,13 +67,14 @@
<view>创建时间{{ orderInfo.add_time | date}}</view> <view>创建时间{{ orderInfo.add_time | date}}</view>
</view> </view>
</view> </view>
<view class="btn" v-if="['1', '2', '4', '6'].indexOf(orderstate) >= 0"> <view class="btn" v-if="['1', '2', '4', '6', '8'].indexOf(orderstate) >= 0">
<view class="cancel" v-if="(orderstate == '4' || orderstate == '1') && orderInfo.is_refund == 1" @click="toOtherPage('RefundOrder')">申请退款</view> <view class="cancel" v-if="(orderstate == '4' || orderstate == '1') && orderInfo.is_refund == 1" @click="toOtherPage('RefundOrder')">申请退款</view>
<view class="cancel" v-if="orderstate == '1'" @click="toOtherPage('Logistics')">查看物流</view> <view class="cancel" v-if="orderstate == '1'" @click="toOtherPage('Logistics')">查看物流</view>
<view class="logistics" v-if="orderstate == '1'" @click="confirmReceive">确认收货</view> <view class="logistics" v-if="orderstate == '1'" @click="confirmReceive">确认收货</view>
<view class="comment" v-if="orderstate == '2'" @click="toOtherPage('Comment')">立即评价</view> <view class="comment" v-if="orderstate == '2'" @click="toOtherPage('Comment')">立即评价</view>
<view class="cancel" v-if="orderstate == '6'" @click="cancelOrder">取消支付</view> <view class="cancel" v-if="orderstate == '6'" @click="cancelOrder">取消支付</view>
<view class="payment" v-if="orderstate == '6'" @click="payNow">立即支付</view> <view class="cancel" v-if="orderstate == '8'" @click="cancelOrder">取消订单</view>
<view class="payment" v-if="orderstate == '6' || orderstate == '8'" @click="payNow">立即支付</view>
<view class="service" v-if="orderstate == '7'">联系官方客服</view> <view class="service" v-if="orderstate == '7'">联系官方客服</view>
<view class="submit" v-if="orderstate == '7'">提交官方审核</view> <view class="submit" v-if="orderstate == '7'">提交官方审核</view>
</view> </view>
@ -83,7 +84,7 @@
export default { export default {
data() { data() {
return { return {
orderstate: '', // 1: 2: 3: 4: 5: 退 6: 7: 退 8: 退 orderstate: '',
s_object: { s_object: {
'1': { '1': {
text: '待收货', text: '待收货',

View File

@ -1,19 +1,20 @@
<template> <template>
<view class="order"> <view class="order">
<view> <view>
<u-tabs-swiper ref="tabs" :list="list" active-color="#FF780F" :current="current" font-size="26" @change="tabsChange" height="88" :gutter="30"></u-tabs-swiper> <!-- <u-tabs-swiper ref="tabs" :list="list" active-color="#FF780F" :current="current" font-size="26" @change="tabsChange" height="88" :gutter="30"></u-tabs-swiper> -->
<u-tabs :list="list" name="gc_name" :is-scroll="true" :current="current" @change="tabsChange" active-color="#FF780F" :show-bar="false" height="88" font-size="26" :gutter="20" inactive-color="#333333"></u-tabs>
</view> </view>
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }"> <swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-item" v-for="(item, index) in list" :key="index"> <swiper-item class="swiper-item" v-for="(item, index) in list" :key="index">
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom" class="order-scroll"> <scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom" class="order-scroll">
<view> <view v-if="orderList[index]">
<view class="item-container" v-for="order in orderList" :key="order.order_id"> <view class="item-container" v-for="order in orderList[index]" :key="order.order_id">
<OrderItem :order="order" @refreshOrderList="refreshOrderList" v-if="current != 4"></OrderItem> <OrderItem :order="order" @refreshOrderList="refreshOrderList" v-if="current != 4"></OrderItem>
<TryOrderItem :order="order" @refreshOrderList="refreshOrderList" v-else></TryOrderItem> <TryOrderItem :order="order" @refreshOrderList="refreshOrderList" v-else></TryOrderItem>
</view> </view>
</view> </view>
<u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList.length"></u-empty> <u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList[index] || !orderList[index].length"></u-empty>
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20" v-if="current != 4 && orderList.length>3" class="order-loadmore"></u-loadmore> <u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20" v-if="current != 4 && (!orderList[index] || orderList[index].length>3)" class="order-loadmore"></u-loadmore>
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
</swiper> </swiper>
@ -57,9 +58,7 @@ export default {
}, },
watch: { watch: {
current(value, origin) { current(value, origin) {
if((origin == 4 && value != 4) || (value == 4 && origin != 4)) { // this.orderList = [];
this.orderList = [];
}
this.page = 0; this.page = 0;
// reload loadmore // reload loadmore
if(value == 4) { if(value == 4) {
@ -69,6 +68,9 @@ export default {
} }
}, },
}, },
onShow() {
this.refreshOrderList();
},
onLoad(option) { onLoad(option) {
const current = option.current ? Number(option.current) : 0; const current = option.current ? Number(option.current) : 0;
this.current = current; this.current = current;
@ -131,23 +133,25 @@ export default {
this.timer = true; this.timer = true;
uni.stopPullDownRefresh(); // uni.stopPullDownRefresh(); //
if(res.errCode == 0) { if(res.errCode == 0) {
if(load == 'reload') this.orderList = res.data; if(load == 'reload') this.orderList[this.current] = res.data;
else if(load == 'loadmore') this.orderList.push(...res.data); else if(load == 'loadmore') this.orderList[this.current].push(...res.data);
}
return res.data.length;
},
//
async getAfterSaleList({ load = 'loadmore' } = {}) {
const res = await this.$u.api.getAfterSaleList({
page: this.page,
})
this.timer = true;
if(res.errCode == 0) {
if(load == 'reload') this.orderList = res.data;
else if(load == 'loadmore') this.orderList.push(...res.data);
} }
this.$forceUpdate();
// console.log(this.orderList);
return res.data.length; return res.data.length;
}, },
//
// async getAfterSaleList({ load = 'loadmore' } = {}) {
// const res = await this.$u.api.getAfterSaleList({
// page: this.page,
// })
// this.timer = true;
// if(res.errCode == 0) {
// if(load == 'reload') this.orderList[this.current] = res.data;
// else if(load == 'loadmore') this.orderList[this.current].push(...res.data);
// }
// return res.data.length;
// },
// 穿 // 穿
async goodsTryOrderList({ load = 'loadmore' } = {}) { async goodsTryOrderList({ load = 'loadmore' } = {}) {
const res = await this.$u.api.goodsTryOrderList({ const res = await this.$u.api.goodsTryOrderList({
@ -156,9 +160,10 @@ export default {
uni.stopPullDownRefresh(); // uni.stopPullDownRefresh(); //
this.timer = true; this.timer = true;
if(res.errCode == 0) { if(res.errCode == 0) {
if(load == 'reload') this.orderList = res.data.list; if(load == 'reload') this.orderList[this.current] = res.data.list;
else if(load == 'loadmore') this.orderList.push(...res.data.list); else if(load == 'loadmore') this.orderList[this.current].push(...res.data.list);
} }
this.$forceUpdate();
return res.data.list.length; return res.data.list.length;
}, },
reachBottom() { reachBottom() {

View File

@ -4,10 +4,12 @@
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }"> <swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-item" v-for="(_, index) in list" :key="index"> <swiper-item class="swiper-item" v-for="(_, index) in list" :key="index">
<scroll-view scroll-y class="scroll-coupon"> <scroll-view scroll-y class="scroll-coupon">
<view class="coupon-item" v-for="(coupon, c_index) in couponList" :key="c_index"> <view v-if="couponList[index]">
<view class="coupon-item" v-for="(coupon, c_index) in couponList[index]" :key="c_index">
<Coupon :couponInfo="coupon" :status='index' :type="1" @use="useCoupon($event)" :goodsClass="goodsClass"></Coupon> <Coupon :couponInfo="coupon" :status='index' :type="1" @use="useCoupon($event)" :goodsClass="goodsClass"></Coupon>
</view> </view>
<u-empty text="暂无优惠券" mode="coupon" v-if="!couponList.length"></u-empty> </view>
<u-empty text="暂无优惠券" mode="coupon" v-if="!couponList[index] || !couponList[index].length"></u-empty>
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
</swiper> </swiper>
@ -59,10 +61,11 @@ export default {
status: current status: current
}).then(res => { }).then(res => {
if(res.errCode == 0) { if(res.errCode == 0) {
this.couponList = res.data; this.couponList[this.current] = res.data;
} else { } else {
this.couponList = []; this.couponList[this.current] = [];
} }
this.$forceUpdate();
}) })
}, },
useCoupon(id) { useCoupon(id) {