adv 7.30
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="order">
|
||||
<view class="info-address" @click="changeAddress">
|
||||
<view class="info-address" @click="changeAddress" v-if="JSON.stringify(addressInfo) != '{}'">
|
||||
<image src="../static/image/2.png" class="address-icon"></image>
|
||||
<view class="address">
|
||||
<view class="user-info">
|
||||
@@ -11,6 +11,7 @@
|
||||
</view>
|
||||
<image src="../static/image/1.png" class="right"></image>
|
||||
</view>
|
||||
<view v-else class="address-none" @click="changeAddress">请选择地址</view>
|
||||
<view class="main">
|
||||
<view v-for="(item, index) in orderInfo.store_cart_list" :key="index">
|
||||
<view class="goods-info">
|
||||
@@ -147,17 +148,18 @@ export default {
|
||||
this.orderType = this.$store.state.orderType;
|
||||
this.orderInfo = this.$store.state.orderInfo;
|
||||
// console.log(this.orderType);
|
||||
console.log(this.orderInfo);
|
||||
// console.log(this.orderInfo);
|
||||
this.getGoodsClass();
|
||||
this.setTotalPrice();
|
||||
},
|
||||
onShow() {
|
||||
this.storeCoupon = {};
|
||||
this.choiceCoupon = {};
|
||||
// 判断是不是从选择地址页面返回
|
||||
if(JSON.stringify(this.$store.state.orderAddress) == '{}') {
|
||||
this.$store.commit('updateAddress', this.orderInfo.address_info);
|
||||
if(this.orderInfo.address_info) this.$store.commit('updateAddress', this.orderInfo.address_info);
|
||||
} else {
|
||||
this.addressInfo = this.$store.state.orderAddress;
|
||||
if(this.$store.getters.getOrderAddress) this.addressInfo = this.$store.state.orderAddress;
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
@@ -166,22 +168,8 @@ export default {
|
||||
watch: {
|
||||
'$store.state.orderAddress'(value) {
|
||||
this.addressInfo = value;
|
||||
this.getFreight();
|
||||
if(JSON.stringify(value) != '{}') this.getFreight();
|
||||
},
|
||||
// storeCoupon: {
|
||||
// deep: true,
|
||||
// handler() {
|
||||
// console.log(222);
|
||||
// this.setTotalPrice(); // 计算总价
|
||||
// }
|
||||
// },
|
||||
// choiceCoupon: {
|
||||
// deep: true,
|
||||
// handler() {
|
||||
// console.log(111);
|
||||
// this.setTotalPrice(); // 计算总价
|
||||
// }
|
||||
// },
|
||||
},
|
||||
methods: {
|
||||
// 如果有pintuangroup_headid为参团不然为开团
|
||||
@@ -242,6 +230,11 @@ export default {
|
||||
if(JSON.stringify(this.choiceCoupon) != '{}') {
|
||||
coupon.push(0 + '|' + this.choiceCoupon.voucher_id)
|
||||
}
|
||||
// 验证是否选择地址
|
||||
if(!this.addressInfo || JSON.stringify(this.addressInfo) == '{}') {
|
||||
this.$u.toast('收货地址不能为空');
|
||||
return false;
|
||||
}
|
||||
let params = {
|
||||
ifcart: ifcart,
|
||||
cart_id: id,
|
||||
@@ -304,6 +297,7 @@ export default {
|
||||
},
|
||||
setTotalPrice() {
|
||||
const goods = this.orderInfo.store_goods_total;
|
||||
console.log(this.freight);
|
||||
const freight = this.freight;
|
||||
let price = 0;
|
||||
// 商品价格加上运费
|
||||
@@ -398,6 +392,14 @@ export default {
|
||||
height: 22rpx;
|
||||
}
|
||||
}
|
||||
.address-none {
|
||||
height: 150rpx;
|
||||
line-height: 150rpx;
|
||||
margin-bottom: 10rpx;
|
||||
background:rgba(255,255,255,1);
|
||||
text-align: center;
|
||||
color: #333;
|
||||
}
|
||||
.main {
|
||||
margin-bottom: 50rpx;
|
||||
> view {
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
</view>
|
||||
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" :style="{height: swiperHeight}">
|
||||
<swiper-item class="swiper-item" v-for="(_, index) in tabList" :key="index">
|
||||
<scroll-view scroll-y style="height: 800rpx;width: 100%;" @scrolltolower="onreachBottom">
|
||||
<scroll-view scroll-y style="width: 100%;" @scrolltolower="onreachBottom">
|
||||
<SpecialGoods v-for="(item, index) in pinTuanList" :key="index" :item="item" type='group'></SpecialGoods>
|
||||
<loadmore ref="loadmore" @callback="getPinTuanList" bgColor="#FFF"></loadmore>
|
||||
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" v-if="pinTuanList.length>=pageSize" @loadmore="onreachBottom"></u-loadmore>
|
||||
<u-empty text="暂无商品" mode="list" color="#000" v-if="!pinTuanList.length"></u-empty>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
@@ -15,22 +15,22 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import loadmore from "@/components/loadmore/index";
|
||||
import SpecialGoods from "../../components/shop/special-shop/index";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pageSize: 12,
|
||||
tabList: [],
|
||||
current: -1,
|
||||
swiperCurrent: 0,
|
||||
page: 0,
|
||||
pinTuanList: [],
|
||||
swiperHeight: '',
|
||||
timer: '', // 限制下拉刷新
|
||||
timer: true, // 限制下拉刷新
|
||||
loadStatus: 'loadmore',
|
||||
}
|
||||
},
|
||||
components: {
|
||||
loadmore,
|
||||
SpecialGoods,
|
||||
},
|
||||
onLoad() {
|
||||
@@ -39,7 +39,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
current(index) {
|
||||
this.getPinTuanList({ id: this.tabList[index].gc_id });
|
||||
this.getPinTuanList({ id: this.tabList[index].gc_id, load: 'reload' });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -53,14 +53,39 @@ export default {
|
||||
})
|
||||
},
|
||||
// 拼团列表
|
||||
async getPinTuanList({ id, page }) {
|
||||
async getPinTuanList({ id, page, load }) {
|
||||
const res = await this.$u.api.getPinTuanList({
|
||||
page: this.page,
|
||||
gc_id: id,
|
||||
})
|
||||
this.pinTuanList = res.data;
|
||||
this.timer = true;
|
||||
if (res.errCode == 0) {
|
||||
if(load == 'reload') this.pinTuanList = res.data;
|
||||
else if(load == 'loadmore') this.pinTuanList.push(...res.data);
|
||||
}
|
||||
return res.data.length;
|
||||
},
|
||||
// scroll-view到底部加载更多
|
||||
onreachBottom() {
|
||||
if(!this.timer) return false;
|
||||
this.loadStatus = "loading";
|
||||
this.page++;
|
||||
this.getPinTuanList({
|
||||
id: this.tabList[this.current].gc_id,
|
||||
load: 'loadmore',
|
||||
}).then(length => {
|
||||
console.log(length);
|
||||
if(length == 0) {
|
||||
this.page--;
|
||||
this.loadStatus = 'nomore';
|
||||
} else {
|
||||
this.loadStatus = 'loadmore';
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loadStatus = "nomore";
|
||||
this.page--;
|
||||
})
|
||||
},
|
||||
// tabs通知swiper切换
|
||||
tabsChange(index) {
|
||||
this.swiperCurrent = index;
|
||||
@@ -77,24 +102,6 @@ export default {
|
||||
this.swiperCurrent = current;
|
||||
this.current = current;
|
||||
},
|
||||
// scroll-view到底部加载更多
|
||||
onreachBottom() {
|
||||
this.$$refs.loadmore.reachBottom();
|
||||
if(!this.timer) return false;
|
||||
this.loadStatus = "loading";
|
||||
this.page++;
|
||||
this.getPinTuanList().then(length => {
|
||||
if(length == 0) {
|
||||
this.page--;
|
||||
this.status = 'nomore';
|
||||
} else {
|
||||
this.status = 'loading';
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loadStatus = "nomore";
|
||||
this.page--;
|
||||
})
|
||||
},
|
||||
setViewHeight() {
|
||||
const res = uni.getSystemInfoSync();
|
||||
this.swiperHeight = res.windowHeight - (88 / 2) + 'px';
|
||||
|
||||
Reference in New Issue
Block a user