9 Commits

21 changed files with 1053 additions and 285 deletions

View File

@@ -77,6 +77,10 @@ export default {
getGoodsClassifyList() { getGoodsClassifyList() {
return vm.$u.post('Goods/getGoodsClassifyList'); return vm.$u.post('Goods/getGoodsClassifyList');
}, },
// 商品推荐的分类
getGoodsClassRecommend() {
return vm.$u.post('Goods/getGoodsClassRecommend');
},
// 商品推荐 // 商品推荐
getGoodsRecommend({page, gc_id}){ getGoodsRecommend({page, gc_id}){
return vm.$u.post('Goods/getGoodsRecommend', { return vm.$u.post('Goods/getGoodsRecommend', {
@@ -122,7 +126,7 @@ export default {
}); });
}, },
// 订单步骤2发起订单返回订单信息 // 订单步骤2发起订单返回订单信息
sendOrder({ ifcart, cart_id, address_id, buy_city_id }) { sendOrder({ ifcart, cart_id, address_id, buy_city_id, pintuan_id, pintuangroup_id, voucher_id }) {
return vm.$u.post('buy/buy_step2', { return vm.$u.post('buy/buy_step2', {
ifcart: ifcart, ifcart: ifcart,
cart_id: cart_id, cart_id: cart_id,
@@ -172,11 +176,6 @@ export default {
id: id id: id
}); });
}, },
goodsInfo({id}){
return vm.$u.post('goods/goodsInfo', {
goods_id: id
});
},
// 商品搜索 // 商品搜索
ShopSearch({keyword,page = 1,order = 'goods_salenum'}){ ShopSearch({keyword,page = 1,order = 'goods_salenum'}){
return vm.$u.post('ShopSearch/search',{ return vm.$u.post('ShopSearch/search',{

View File

@@ -4,12 +4,14 @@ Vue.use(Vuex)
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
orderType: '', // 订单类型 1 普通订单 2 购物车订单 3 拼团订单 4 秒杀订单 orderType: '', // 订单类型 1 普通订单 2 拼团订单 3 秒杀订单 4 优惠券 5 购物车订单 和 goodsDetails 的 type 相同
orderInfo: {}, // 订单数据 订单步骤1展示结算数据 orderInfo: {}, // 订单数据 订单步骤1展示结算数据
orderAddress: {}, // 下单时选择的地址 orderAddress: {}, // 下单时选择的地址
goodsDetails: {}, // 商品详情 1普通 2拼团 3秒杀 4优惠券 goodsDetails: {}, // 商品详情 1普通 2拼团 3秒杀 4优惠券
goods_id: '', // 拼团商品 id goods_id: '', // 拼团商品 id
pintuangroup_headid: '', // 拼团团长id 有为开团 无为参团
groupbuyInfo: {}, // 秒杀详情 groupbuyInfo: {}, // 秒杀详情
loadmore: {}, // 下拉加载返回的数据
}, },
getters: { getters: {
getOrderAddress(state) { getOrderAddress(state) {
@@ -41,6 +43,12 @@ const store = new Vuex.Store({
setGroupbuyInfo(state, info) { setGroupbuyInfo(state, info) {
state.groupbuyInfo = info; state.groupbuyInfo = info;
}, },
setGroupHeadId(state, id) {
state.pintuangroup_headid = id;
},
setLoadMore(state, info) {
state.loadmore = info;
},
} }
}) })
export default store; export default store;

View File

@@ -0,0 +1,61 @@
<template>
<view class="loadmore">
<u-loadmore :status="loadStatus" :bgColor="bgColor" margin-bottom="20"></u-loadmore>
</view>
</template>
<script>
/*
* @description 下拉加载
* @property {String} bgColor 背景色
* @property {Number} page 初始页码
* @event {Function} callback 下拉刷新请求的接口
**/
export default {
data() {
return {
loadStatus: 'loadmore',
timer: true,
tpage: Number,
}
},
props: {
bgColor: String,
page: Number,
},
created() {
this.tpage = this.page;
},
methods: {
reachBottom() {
if(!this.timer) return false;
this.loadStatus = "loading";
this.tpage++;
this.$emit('callback', { page: this.tpage });
// this.$emit('callback', { page: this.tpage }).then(length => {
// if(length == 0) {
// this.tpage--;
// this.status = 'nomore';
// } else {
// this.status = 'loading';
// }
// }).catch(() => {
// this.loadStatus = "nomore";
// this.tpage--;
// })
// this.$parent.callback({ page: this.tpage }).then(length => {
// if(length == 0) {
// this.tpage--;
// this.status = 'nomore';
// } else {
// this.status = 'loading';
// }
// }).catch(() => {
// this.loadStatus = "nomore";
// this.tpage--;
// })
}
}
};
</script>
<style lang="scss" scoped>
</style>

View File

@@ -39,6 +39,7 @@ export default {
goodsClass: Array, goodsClass: Array,
}, },
created() { created() {
// console.log(this.goodsClass);
// console.log(this.couponInfo); // console.log(this.couponInfo);
}, },
filters: { filters: {
@@ -51,9 +52,6 @@ export default {
} }
}, },
methods: { methods: {
exchange() {
this.$emit('exchange', this.couponInfo.vouchertemplate_id);
},
use() { use() {
this.$emit('use', this.couponInfo); this.$emit('use', this.couponInfo);
}, },
@@ -64,6 +62,7 @@ export default {
.c-coupon { .c-coupon {
position: relative; position: relative;
z-index: 9; z-index: 9;
margin-bottom: 30rpx;
@mixin coupon-image($url) { @mixin coupon-image($url) {
width: 690rpx; width: 690rpx;
height: 194rpx; height: 194rpx;

View File

@@ -8,7 +8,7 @@
<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="88"></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="88"></u-tabs-swiper>
</view> </view>
<swiper :current="swiperCurrent" @animationfinish="animationfinish" style="height: 130px"> <swiper :current="swiperCurrent" @animationfinish="animationfinish" style="height: 130px">
<swiper-item class="swiper-item" 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> <sitem :info="info" v-for="(info, index) in groupList.slice(0, 3)" :key="index"></sitem>
<u-empty text="暂无拼团商品" mode="list" color="#000" v-if="!groupList.length"></u-empty> <u-empty text="暂无拼团商品" mode="list" color="#000" v-if="!groupList.length"></u-empty>
@@ -67,19 +67,18 @@ export default {
color: #999; color: #999;
} }
} }
.label{ // .label{
display: flex; // display: flex;
font-size: 24rpx; // font-size: 24rpx;
color: #999; // color: #999;
>text{ // >text{
margin-right: 34rpx; // margin-right: 34rpx;
} // }
} // }
.list{ .list{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-top: 21rpx; margin-top: 21rpx;
} }
} }
</style> </style>

View File

@@ -3,8 +3,8 @@
<image class="head" :src="info.pintuan_image"></image> <image class="head" :src="info.pintuan_image"></image>
<text class="title u-line-1">{{ info.pintuan_goods_name }}</text> <text class="title u-line-1">{{ info.pintuan_goods_name }}</text>
<view class="price"> <view class="price">
<text>{{ info.pintuan_goods_price }}</text> <view>{{ info.pintuan_goods_price }}</view>
<text>立即购买</text> <view>立即拼团</view>
</view> </view>
</view> </view>
</template> </template>
@@ -38,33 +38,33 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.item{ .item{
width: 210rpx; width: 210rpx;
overflow: hidden;
.head{ .head{
width: 210rpx; width: 210rpx;
height: 131rpx; height: 131rpx;
border-radius: 6rpx; border-radius: 6rpx;
} }
.title{ .title{
display: inline-block; display: inline-block;
width: 100%; width: 100%;
font-size: 26rpx; font-size: 26rpx;
color: #333; color: #333;
margin-top: 16rpx; margin-top: 10rpx;
} }
.price{ .price{
display: flex; // display: flex;
align-items: center; // align-items: center;
justify-content: space-between; // justify-content: space-between;
margin-top: 19rpx; margin-top: 10rpx;
>text:first-child{ > view:first-child{
font-size: 26rpx; font-size: 26rpx;
color: #FF3131; color: #FF3131;
margin-bottom: 4rpx;
} }
>text:last-child{ > view:last-child{
font-size: 22rpx;
color: #FDD360; color: #FDD360;
} }
} }
} }
</style> </style>

View File

@@ -3,66 +3,105 @@
<view class="top"> <view class="top">
商品推荐 商品推荐
</view> </view>
<!-- <view class="label">
<text v-for="item in classifyList" :key="item.gc_id">{{ item.gc_name }}</text>
</view>
<view class="item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view> -->
<view> <view>
<u-tabs-swiper ref="uTabs" :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="uTabs" :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>
</view> </view>
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" > <swiper :current="swiperCurrent" @transition="transition" @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">
<!-- <scroll-view scroll-y style="height: 800rpx;width: 100%;"> --> <!-- <scroll-view scroll-y style="height: 800rpx;width: 100%;"> -->
<view class="item"> <view class="goods-item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item> <item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view> </view>
<u-empty text="暂无商品" mode="list" color="#000" v-if="!goodsList.length"></u-empty> <u-empty text="暂无商品" mode="list" color="#000" v-if="!goodsList.length"></u-empty>
<!-- </scroll-view> --> <!-- </scroll-view> -->
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- 加载更多 -->
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20"></u-loadmore>
<!-- <loadmore ref="loadmore" @callback="getGoodsRecommend" bgColor="#FFF" :page="page"></loadmore> -->
</view> </view>
</template> </template>
<script> <script>
import item from "./item" import item from "./item";
import loadmore from "@/components/loadmore/index";
export default { export default {
name:"list", name:"list",
data() { data() {
return { return {
current: Number, current: -1,
swiperCurrent: 0, swiperCurrent: 0,
goodsList: [], goodsList: [],
classifyList: [],
swiperHeight: '',
page: 1, // 从 1 开始
loadStatus: 'loadmore',
timer: true,
} }
}, },
components:{ components: {
item item,
}, loadmore
props: {
classifyList: Array
}, },
watch: { watch: {
current(index) { current(index) {
const id = this.classifyList[index].gc_id; const id = this.classifyList[index].gc_id;
this.getGoodsRecommend(id); this.getGoodsRecommend({gc_id: id});
} }
}, },
created() { created() {
this.current = 0; this.getGoodsClassRecommend();
console.log(this.classifyList);
}, },
methods: { methods: {
getGoodsRecommend(gc_id) { loadMore(page) {
this.$u.api.getGoodsRecommend({ if(!this.timer) return false;
page: 1, this.loadStatus = "loading";
gc_id: gc_id, this.page++;
}).then((res)=>{ this.getGoodsRecommend({
gc_id: this.classifyList[this.current].gc_id,
page: this.page,
reload: false,
}).then(length => {
console.log(length);
if(length == 0) {
this.page--;
this.loadStatus = 'nomore';
} else {
this.loadStatus = 'loading';
}
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
})
// this.$refs.loadmore.reachBottom();
// this.getGoodsRecommend(this.classifyList[this.current].gc_id);
},
getGoodsClassRecommend(gc_id) {
this.$u.api.getGoodsClassRecommend().then(res => {
if (res.errCode == 0) { if (res.errCode == 0) {
this.goodsList = res.data.goodsList; // 初始化 current
console.log(this.goodsList); this.current = 0;
this.classifyList = res.data.gc_recommend;
// this.getGoodsRecommend(this.classifyList[0].gc_id);
} }
}) })
}, },
async getGoodsRecommend({ page = this.page, gc_id, reload = true } = {}) {
const res = await this.$u.api.getGoodsRecommend({
page: page,
gc_id: gc_id,
})
if (res.errCode == 0) {
if(reload) this.goodsList = res.data.goodsList;
else this.goodsList.push(...res.data.goodsList);
// console.log(this.goodsList);
this.setSwiperHeight();
}
return res.data.goodsList.length;
},
setSwiperHeight() {
// height: 230px, margin-bottom: 13
this.swiperHeight = Math.ceil(this.goodsList.length / 2) * (230 + 13) + 'px';
},
// tabs通知swiper切换 // tabs通知swiper切换
tabsChange(index) { tabsChange(index) {
this.swiperCurrent = index; this.swiperCurrent = index;
@@ -108,5 +147,11 @@ export default {
// margin-top: 20rpx; // margin-top: 20rpx;
// } // }
.goods-item {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 20rpx;
}
} }
</style> </style>

View File

@@ -4,7 +4,7 @@
<view class="info"> <view class="info">
<text class="title u-line-1">{{ info.goods_name }}</text> <text class="title u-line-1">{{ info.goods_name }}</text>
<text class="jianjie u-line-2">{{ info.goods_advword }}</text> <text class="jianjie u-line-2">{{ info.goods_advword }}</text>
<text class="price">{{ info.goods_price }}</text> <text class="price">{{ info.goods_price }}</text>
</view> </view>
</view> </view>
</template> </template>
@@ -16,43 +16,53 @@ export default {
}, },
methods: { methods: {
toDetailsPage() { toDetailsPage() {
this.$u.route({ this.$u.api.getGoodsDetails({ id: this.info.goods_id }).then(res => {
url: 'pageB/sdetails/index', if (res.errCode == 0) {
params: { const goods = {
id: this.info.goods_id goods: res.data,
type: 1,
}
this.$store.commit('setGoodsDetails', goods);
this.$store.commit('setGoodsId', this.info.goods_id);
this.$u.route({
url: 'pageB/sdetails/index',
})
// console.log(this.goodsInfo.mobile_body);
} }
}) })
} }
}, },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.item{ .item{
width: 330rpx; width: 330rpx;
height: 469rpx; height: 460rpx;
margin-bottom: 27rpx; margin-bottom: 26rpx;
background-color: #f8f8f8; background-color: #f8f8f8;
border-radius: 10rpx; border-radius: 10rpx 10rpx 0rpx 0rpx;
overflow: hidden;
.img{ .img{
width: 100%; width: 330rpx;
height: 272rpx; height: 272rpx;
background: rgba(245,245,245,1);
border-radius: 10rpx 10rpx 0rpx 0rpx;
margin-bottom: 24rpx;
} }
.info{ .info{
width: 320rpx; width: 320rpx;
padding: 0 12rpx; padding: 0 12rpx 28rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: space-around;
.title{ .title{
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
margin-bottom: 13rpx;
} }
.jianjie{ .jianjie{
font-size: 26rpx; font-size: 26rpx;
color: #666; color: #666;
margin-bottom: 20rpx;
} }
.price{ .price{
color: #FF3131; color: #FF3131;

View File

@@ -1,10 +1,10 @@
<template> <template>
<view class="item"> <view class="item" @click="spikeGoods">
<image class="head" :src="item.groupbuy_image1"></image> <image class="head" :src="item.groupbuy_image1"></image>
<text class="title u-line-2">{{ item.goods_name }}</text> <text class="title u-line-2">{{ item.goods_name }}</text>
<view class="price"> <view class="price">
<text>{{ item.groupbuy_price }}</text> <text>{{ item.groupbuy_price }}</text>
<text>{{ item.goods_price }}</text> <text class="origin">{{ item.goods_price }}</text>
</view> </view>
<view class="info"> <view class="info">
<text>剩余{{ item.inventory | formatValue }}</text> <text>剩余{{ item.inventory | formatValue }}</text>
@@ -22,6 +22,27 @@ export default {
if(temp > 999) temp = '999+'; if(temp > 999) temp = '999+';
return temp; return temp;
} }
},
methods: {
spikeGoods() {
// console.log(this.item.groupbuy_id);
this.$u.api.getSpikeInfo({
groupbuy_id: this.item.groupbuy_id
}).then(res => {
if(res.errCode == 0) {
const goods = {
goods: res.data.goodsInfo,
type: 3, // 商品详情 1普通 2拼团 3秒杀 4优惠券
}
this.$store.commit('setGoodsDetails', goods);
this.$store.commit('setGroupbuyInfo', res.data.groupbuyInfo);
this.$store.commit('setGoodsId', this.item.groupbuy_id);
this.$u.route({
url: 'pageB/sdetails/index',
})
}
})
},
} }
} }
</script> </script>

View File

@@ -36,12 +36,12 @@ export default {
type: String, type: String,
}, },
created() { created() {
console.log(this.item); // console.log(this.item);
console.log(this.type); // console.log(this.type);
}, },
methods: { methods: {
spikeGoods() { spikeGoods() {
console.log(this.item.groupbuy_id); // console.log(this.item.groupbuy_id);
this.$u.api.getSpikeInfo({ this.$u.api.getSpikeInfo({
groupbuy_id: this.item.groupbuy_id groupbuy_id: this.item.groupbuy_id
}).then(res => { }).then(res => {

View File

@@ -57,7 +57,7 @@ export default {
watch:{ watch:{
select(){ select(){
// console.log(this.select) // console.log(this.select)
this.$emit("sel",this.select) this.$emit("sel", this.select);
} }
} }
} }

View File

@@ -9,31 +9,30 @@
<image src="/static/image/common/19.png"></image> <image src="/static/image/common/19.png"></image>
客服 客服
</view> </view>
<view class="button" style="background:rgba(253,211,96,0.6);">试穿试送</view> <view class="button" style="background:rgba(253,211,96,0.6);" v-if="info.goods_try == 1">试穿试送</view>
<view class="button" style="background:rgba(253,211,96,1);" @click="buy(2)">加入购物车</view> <view class="button" style="background:rgba(253,211,96,1);" @click="buy(2)">加入购物车</view>
<view class="button" style="background:rgba(255,120,15,1);" @click="buy(1)">立即购买</view> <view class="button" style="background:rgba(255,120,15,1);" @click="buy(1)">立即购买</view>
</view> </view>
<u-popup v-model="show" mode="bottom"> <u-popup v-model="show" mode="bottom">
<scroll-view scroll-y="true" class="popup"> <scroll-view scroll-y="true" class="popup">
<view> <view>
<view class="head"> <view class="head">
<image class="image" :src="info.goods_image"></image> <image class="image" :src="info.goods_image"></image>
<view class="info"> <view class="info">
<text class="u-line-2">{{info.goods_name}}</text> <text class="u-line-2">{{info.goods_name}}</text>
<text>{{info.goods_price}}</text> <text>{{info.goods_price}}</text>
</view> </view>
</view> </view>
<guige @sel="self" ref="guige" v-for="(item,index) in info.spec_value" :key="index" :title="info.spec_name[index]" :item="item"></guige> <guige @sel="self" ref="guige" v-for="(item,index) in info.spec_value" :key="index" :title="info.spec_name[index]" :item="item"></guige>
<view class="num"> <view class="num">
<text>购买数量</text> <text>购买数量</text>
<u-number-box v-model="value" @change="valChange"></u-number-box> <u-number-box v-model="value" @change="valChange"></u-number-box>
</view> </view>
<view style="height:180rpx"></view> <view style="height:100rpx"></view>
</view> </view>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</scroll-view>
</scroll-view> </u-popup>
</u-popup>
</view> </view>
</template> </template>
@@ -41,26 +40,29 @@
import guige from "./guige" import guige from "./guige"
export default { export default {
name:"tloos", name:"tloos",
props: ['id','info'], props: ['id', 'info'],
components:{ components:{
guige guige
}, },
data(){ data(){
return { return {
show:false, show: false,
value:1, value: 1,
sel:"", sel: "",
quanxuan:false quanxuan: false
} }
}, },
created() {
this.show = false;
},
methods: { methods: {
buy(type){ buy(type){
let that = this; let that = this;
if(this.show){ if(this.show){
if(this.info.spec_value == null){ if(this.info.spec_value == null){
this.$emit("buy",{type,value:that.value}) this.$emit("buy", { type, value: that.value })
}else if(this.quanxuan){ }else if(this.quanxuan){
this.$emit("buy",{type,value:that.value}) this.$emit("buy", { type, value: that.value })
}else{ }else{
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '请选择规格', title: '请选择规格',
@@ -68,7 +70,7 @@ export default {
}) })
} }
}else{ }else{
this.show = true this.show = true;
} }
}, },
@@ -87,7 +89,6 @@ export default {
if(sel != 0){ if(sel != 0){
arr.push(sel) arr.push(sel)
} }
} }
// console.log(arr.length) // console.log(arr.length)
if(arr.length == index){ if(arr.length == index){
@@ -99,8 +100,8 @@ export default {
}, },
watch:{ watch:{
sel(){ sel(){
// console.log(this.sel) console.log(this.sel)
this.$emit('xuanze',this.sel) this.$emit('xuanze', this.sel)
} }
} }
} }

View File

@@ -26,8 +26,9 @@
<view class="hr"></view> <view class="hr"></view>
<!-- <navs :value="领券"></navs> --> <!-- <navs :value="领券"></navs> -->
<navs :value="'产品规格'"></navs> <navs :value="'产品规格'"></navs>
<navs :value="'产品颜色'"></navs> <!-- <navs :value="'产品颜色'"></navs> -->
<navs :value="'选择尺码'"></navs> <!-- <navs :value="'选择尺码'"></navs> -->
<!-- <navs v-for="(value, index) in goodsInfo.spec_name" :value="value" :key="index"></navs> -->
<view class="hr"></view> <view class="hr"></view>
<view class="group-user" v-if="groupUser.length"> <view class="group-user" v-if="groupUser.length">
<view class="top"> <view class="top">
@@ -40,9 +41,9 @@
<view class="bottom"> <view class="bottom">
<view class="left" @click="showGroupUser=true"> <view class="left" @click="showGroupUser=true">
<view class="avatar"> <view class="avatar">
<image v-for="(user, i) in groupUser.slice(0, 3)" :src="user[0].member_avatar" :key="i"></image> <image v-for="(user, i) in user_suc" :src="user[0].member_avatar" :key="i"></image>
</view> </view>
<view class="all"> <view class="all" @click="showGroupUser=true">
<text>查看全部</text> <text>查看全部</text>
<image src="/static/image/common/1.png"></image> <image src="/static/image/common/1.png"></image>
</view> </view>
@@ -84,7 +85,7 @@
<view class="name u-line-1">{{ user.member_nickname }}</view> <view class="name u-line-1">{{ user.member_nickname }}</view>
</view> </view>
</view> </view>
<view class="involvement-btn" @click="withImmediate('involvement')">参与拼团</view> <view class="involvement-btn" @click="settlementOrder({ type: 'involvement' })">参与拼团</view>
<image class="close" src="/static/image/common/17.png" @click="showInvolvementUser=false"></image> <image class="close" src="/static/image/common/17.png" @click="showInvolvementUser=false"></image>
</view> </view>
</u-popup> </u-popup>
@@ -98,7 +99,7 @@
</view> </view>
<!-- 拼团 tool --> <!-- 拼团 tool -->
<view class="group-tool" v-if="type==2"> <view class="group-tool" v-if="type==2">
<view class="launch" @click="withImmediate">发起拼团</view> <view class="launch" @click="settlementOrder">发起拼团</view>
<view class="involvement" @click="showGroupUser=true">参与拼团</view> <view class="involvement" @click="showGroupUser=true">参与拼团</view>
</view> </view>
<!-- 秒杀 --> <!-- 秒杀 -->
@@ -113,16 +114,20 @@
<text>客服</text> <text>客服</text>
</view> </view>
</view> </view>
<view class="btn" :class="{'cannot': groupbuyInfo.groupbuy_state == 32 || groupbuyInfo.inventory == groupbuyInfo.groupbuy_buy_quantity}"> <view class="btn" v-if="groupbuyInfo.groupbuy_state == 20 && groupbuyInfo.inventory > groupbuyInfo.groupbuy_buy_quantity" @click="spikeGoods">立即秒杀</view>
<view class="btn" :class="{'cannot': groupbuyInfo.groupbuy_state == 32 || groupbuyInfo.inventory == groupbuyInfo.groupbuy_buy_quantity}" v-else>
{{ groupbuyInfo.groupbuy_state == 32 ? '时间已结束' : (groupbuyInfo.inventory > groupbuyInfo.groupbuy_buy_quantity ? '立即秒杀' : '已售空') }} {{ groupbuyInfo.groupbuy_state == 32 ? '时间已结束' : (groupbuyInfo.inventory > groupbuyInfo.groupbuy_buy_quantity ? '立即秒杀' : '已售空') }}
</view> </view>
</view> </view>
<!-- 普通商品 tool --> <!-- 普通商品 tool -->
<tloos @buy="buy" @xuanze="xuanze" :id="goodsInfo.goods_commonid" :info="info" v-if="type==1"></tloos> <tloos @buy="buy" @xuanze="xuanze" :id="goodsInfo.goods_commonid" :info="goodsInfo" v-if="type==1"></tloos>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
/*
* 详情是请求完存在store的在这里从store取值
**/
import navs from "../components/sdetails/navs" import navs from "../components/sdetails/navs"
import tloos from "../components/sdetails/tloos" import tloos from "../components/sdetails/tloos"
export default { export default {
@@ -133,10 +138,12 @@ export default {
goodsInfo: {}, goodsInfo: {},
info:{}, info:{},
glist:[], glist:[],
id:0, id:0, // 商品id
type: '', // 商品类型 商品详情 1普通 2拼团 3秒杀 4优惠券 type: '', // 商品类型 商品详情 1普通 2拼团 3秒杀 4优惠券
groupUser: [], // 拼团用户 groupUser: [], // 拼团用户
user_suc: [], // 拼团成功用户
avatarWidth: '', avatarWidth: '',
pintuan_id: '', // 拼团id
showGroupUser: false, // 拼团 showGroupUser: false, // 拼团
showInvolvementUser: false, // 参团 showInvolvementUser: false, // 参团
involvemenGroupInfo: [], // 参团的人 involvemenGroupInfo: [], // 参团的人
@@ -148,7 +155,23 @@ export default {
components:{ components:{
navs, navs,
tloos tloos
}, },
onShow() {
// if(this.pintuan_id) {
// this.$u.api.getPinTuanDetails({
// pintuan_id: this.pintuan_id
// }).then(res => {
// if(res.errCode == 0) {
// const goods = {
// goods: res.data.data,
// type: 2,
// }
// this.$store.commit('setGoodsDetails', goods);
// this.$store.commit('setGoodsId', this.pintuan_id);
// }
// })
// }
},
onLoad() { onLoad() {
this.init(); this.init();
}, },
@@ -160,14 +183,16 @@ export default {
this.id = this.$store.state.goods_id; this.id = this.$store.state.goods_id;
this.type = this.$store.getters.getGoodsType; this.type = this.$store.getters.getGoodsType;
const info = this.$store.getters.getGoodsInfo; const info = this.$store.getters.getGoodsInfo;
if(this.type == 2) {
this.user_suc = info.user_suc;
this.groupUser = info.user;
this.pintuan_id = info.pintuan_id;
}
if (this.type == 3) { if (this.type == 3) {
this.groupbuyInfo = this.$store.state.groupbuyInfo; this.groupbuyInfo = this.$store.state.groupbuyInfo;
this.setSpikeTime(); this.setSpikeTime();
} }
// console.log(this.groupbuyInfo); // console.log(this.groupbuyInfo);
if(this.type == 2) {
this.groupUser = info.user;
}
this.goodsInfo = info.goods; this.goodsInfo = info.goods;
// 设置轮播图 // 设置轮播图
let list = []; let list = [];
@@ -180,40 +205,47 @@ export default {
this.list = list; this.list = list;
this.setTitle(); this.setTitle();
}, },
spikeGoods() {
this.settlementOrder()
},
setSpikeTime() { setSpikeTime() {
const time = this.groupbuyInfo.groupbuy_endtime; const time = this.groupbuyInfo.groupbuy_endtime;
// console.log(new Date(time*1000));
// console.log(new Date());
this.timer = setInterval(() => { this.timer = setInterval(() => {
let spikeTime = time * 1000 - new Date(); let spikeTime = time * 1000 - new Date().getTime();
// 计算天数
const days = Math.floor(spikeTime/(24*3600*1000));
//计算出小时数 //计算出小时数
const leave1 = spikeTime % (24*3600*1000) //计算天数后剩余的毫秒数 const leave1 = spikeTime % (24*3600*1000) // 计算天数后剩余的毫秒数
const hours = Math.floor(leave1/(3600*1000)) let hours = Math.floor(leave1/(3600*1000));
//计算相差分钟数 //计算相差分钟数
const leave2 = leave1 % (3600*1000) //计算小时数后剩余的毫秒数 const leave2 = leave1 % (3600*1000) // 计算小时数后剩余的毫秒数
const minutes = Math.floor(leave2 / (60*1000)) const minutes = Math.floor(leave2 / (60*1000))
//计算相差秒数 //计算相差秒数
const leave3 = leave2 % (60*1000) //计算分钟数后剩余的毫秒数 const leave3 = leave2 % (60*1000) // 计算分钟数后剩余的毫秒数
const seconds = Math.round(leave3 / 1000) const seconds = Math.round(leave3 / 1000)
// 把天数算在小时里
hours = days * 24 + hours;
this.spikeTime = hours + ':' + minutes + ':' + seconds; this.spikeTime = hours + ':' + minutes + ':' + seconds;
// console.log(this.spikeTime); // console.log(this.spikeTime);
}, 1000) }, 1000)
}, },
buy(info){ buy(info){
if(info.type == 2){ if(info.type == 2){ // 加入购物车
this.$u.api.addCart({ this.$u.api.addCart({
goods_id: this.id, goods_id: this.id,
quantity: info.value, quantity: info.value,
}).then(res => { }).then(res => {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.errCode[1], title: res.message,
type: res.errCode == 0 ? 'success' : 'warning', type: res.errCode == 0 ? 'success' : 'warning',
}) })
}) })
} } else if (info.type == 1) { // 支付
this.settlementOrder({num: info.value});
}
}, },
getGoodsDetails(id) { getGoodsDetails(id) {
this.id = id; this.id = id;
this.$u.api.getGoodsDetails({ id: id }).then((res)=>{ this.$u.api.getGoodsDetails({ id: id }).then((res)=>{
if (res.errCode == 0) { if (res.errCode == 0) {
this.goodsInfo = res.data.goods; this.goodsInfo = res.data.goods;
@@ -225,46 +257,39 @@ export default {
list.push(temp); list.push(temp);
}) })
this.list = list; this.list = list;
this.info = res.data.goods;
this.glist = res.data.spec_list;
// console.log(this.goodsInfo.mobile_body); // console.log(this.goodsInfo.mobile_body);
} }
})
this.$u.api.goodsInfo({id}).then((res)=>{
// console.log(res)
this.info = res.data.goods;
this.glist = res.data.spec_list;
})
},
// 如果有pintuangroup_headid为参团不然为开团
withImmediate(type) {
let params = {
pintuan_id: this.id,
}
// console.log(this.involvemenGroupInfo);
if(type == 'involvement' && this.involvemenGroupInfo.length) {
Object.assign(params, { pintuangroup_headid: this.involvemenGroupInfo[0].user_id });
Object.assign(params, { pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id });
}
// console.log(params);
this.$u.api.withImmediate(params).then(res => {
this.showGroupUser = false;
this.showInvolvementUser = false;
if(res.errCode == 0) {
this.settlementOrder();
} else {
this.$u.toast(res.message);
}
}) })
}, },
settlementOrder() { // 下单
/*
* @params {Number} type 拼团或者开团
**/
settlementOrder({type, num = 1} = {}) {
// ifcart 结算方式 1:购物车 0:直接结算(立即购买/拼团/秒杀) // ifcart 结算方式 1:购物车 0:直接结算(立即购买/拼团/秒杀)
this.$u.api.settlementOrder({ let params = {
ifcart: 0, ifcart: 0,
cart_id: [this.goodsInfo.goods_id + '|' + 1], cart_id: [this.goodsInfo.goods_id + '|' + num],
pintuan_id: this.involvemenGroupInfo[0].user_id, }
pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id if(this.type == 2) {
}).then(res => { if(type == 'involvement') {
Object.assign(params, {
pintuan_id: this.pintuan_id,
pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id
})
} else {
const userId = uni.getStorageSync('user_info').member.member_id;
this.$store.commit('setGroupHeadId', userId);
Object.assign(params, {
pintuan_id: this.pintuan_id,
})
}
}
this.$u.api.settlementOrder(params).then(res => {
if(res.errCode == 0) { if(res.errCode == 0) {
this.$store.commit('orderType', 3); this.$store.commit('setOrderType', this.type);
this.$store.commit('updateOrderInfo', res.data) this.$store.commit('updateOrderInfo', res.data)
this.$u.route({ this.$u.route({
url: '/pageC/cart/ConfirmOrder' url: '/pageC/cart/ConfirmOrder'
@@ -276,23 +301,23 @@ export default {
this.involvemenGroupInfo = user; this.involvemenGroupInfo = user;
this.showGroupUser = false; this.showGroupUser = false;
this.showInvolvementUser = true; this.showInvolvementUser = true;
console.log(this.involvemenGroupInfo); // console.log(this.involvemenGroupInfo);
}, },
xuanze(id){ xuanze(id){
// console.log(id) console.log(id)
this.getGoodsDetails(this.glist[id]) // this.getGoodsDetails(this.glist[id])
}, },
setTitle() { setTitle() {
let title = ''; let title = '';
switch (this.type) { switch (this.type) {
case 1: case 1:
title = '商品详情';
break; break;
case 2: case 2:
title = '拼团商品详情'; title = '拼团商品详情';
break; break;
case 1: case 3:
title = '秒杀商品详情';
break; break;
case 1: case 1:
@@ -340,6 +365,7 @@ export default {
} }
.origin-price { .origin-price {
font-size: 26rpx; font-size: 26rpx;
text-decoration: line-through;
} }
} }
.num { .num {

View File

@@ -33,10 +33,10 @@
</view> </view>
</view> </view>
<view class="order-info"> <view class="order-info">
<view @click="showCoupon({type: 2, store_id: item[0].store_id})"> <view @click="showCoupon({type: 2, store_id: item[0].store_id})" v-if="orderType == 1 || orderType == 5">
<view class="title">优惠券折扣</view> <view class="title">优惠券折扣</view>
<view class="value"> <view class="value">
<view>{{ item.coupon_price ? item.coupon_price : '0.00' }}</view> <view>-{{ storeCoupon[item[0].store_id] ? storeCoupon[item[0].store_id].voucher_price.toFixed(2) : '0.00' }}</view>
<image src="../static/image/1.png"></image> <image src="../static/image/1.png"></image>
</view> </view>
</view> </view>
@@ -50,10 +50,10 @@
</view> </view>
</view> </view>
<view class="common-active"> <view class="common-active">
<view @click="showCoupon({type: 1})"> <view @click="showCoupon({type: 1})" v-if="orderType == 1 || orderType == 5">
<view class="title">平台优惠券</view> <view class="title">平台优惠券</view>
<view class="value"> <view class="value">
<view>-{{ choiceCoupon.vouchertemplate_id ? choiceCoupon.voucher_price : '0.00' }}</view> <view>-{{ choiceCoupon.vouchertemplate_id ? choiceCoupon.voucher_price.toFixed(2) : '0.00' }}</view>
<image src="../static/image/1.png"></image> <image src="../static/image/1.png"></image>
</view> </view>
</view> </view>
@@ -66,11 +66,17 @@
</view> </view>
</view> </view>
<u-popup v-model="couponStatus" mode="bottom"> <u-popup v-model="couponStatus" mode="bottom">
<scroll-view class="coupon-choose" style="height: 800rpx;"> <scroll-view class="coupon-choose" scroll-y style="height: 800rpx;" v-if="this.couponType.type == 1">
<view class="title">优惠券详情</view> <view class="title">优惠券详情</view>
<view class="text">使用优惠券</view> <view class="text">店铺优惠券</view>
<Coupon :couponInfo="coupon" @use="useCoupon($event)" :goodsClass="goodsClass" v-for="(coupon, index) in couponList" :key="index"></Coupon> <Coupon :couponInfo="coupon" @use="useCoupon($event)" :goodsClass="goodsClass" v-for="(coupon, index) in orderInfo.store_voucher_all_list" :key="index"></Coupon>
<u-empty text="无可用优惠券" mode="coupon" v-if="!couponList.length"></u-empty> <u-empty text="无可用优惠券" mode="coupon" v-if="!orderInfo.store_voucher_all_list.length"></u-empty>
</scroll-view>
<scroll-view class="coupon-choose" scroll-y style="height: 800rpx;" v-if="this.couponType.type == 2">
<view class="title">优惠券详情</view>
<view class="text">平台优惠券</view>
<Coupon :couponInfo="coupon" @use="useCoupon($event)" :goodsClass="goodsClass" v-for="(coupon, index) in orderInfo.store_voucher_list[this.couponType.store_id]" :key="index"></Coupon>
<u-empty text="无可用优惠券" mode="coupon" v-if="!orderInfo.store_voucher_list[this.couponType.store_id].length"></u-empty>
</scroll-view> </scroll-view>
</u-popup> </u-popup>
<view class="bottom"> <view class="bottom">
@@ -80,7 +86,7 @@
</view> </view>
<view class="right"> <view class="right">
<view class="num">共件{{ orderInfo.store_cart_list | setTotalNumber }}商品</view> <view class="num">共件{{ orderInfo.store_cart_list | setTotalNumber }}商品</view>
<view class="btn" @click="sendOrder">结算</view> <view class="btn" @click="intermediate">结算</view>
</view> </view>
</view> </view>
<u-action-sheet :list="deliveryList" @click="setDelivery" border-radius="10" v-model="showDelivery"></u-action-sheet> <u-action-sheet :list="deliveryList" @click="setDelivery" border-radius="10" v-model="showDelivery"></u-action-sheet>
@@ -110,9 +116,12 @@ export default {
}, // 配送方式 }, // 配送方式
couponList: [], couponList: [],
couponStatus: false, couponStatus: false,
couponType: {}, // 选择的优惠券
storeCoupon: {}, // 选中的店铺优惠券
choiceCoupon: {}, // 使用的平台优惠券 choiceCoupon: {}, // 使用的平台优惠券
goodsClass: [], goodsClass: [],
orderType: '', // 订单类型 1 普通订单 2 购物车订单 3 拼团订单 4 秒杀订单 orderType: '', // 订单类型 1 普通订单 2 拼团订单 3 秒杀订单 4 优惠券 5 购物车订单
} }
}, },
components: { components: {
@@ -138,7 +147,9 @@ export default {
onLoad(option) { onLoad(option) {
this.orderType = this.$store.state.orderType; this.orderType = this.$store.state.orderType;
this.orderInfo = this.$store.state.orderInfo; this.orderInfo = this.$store.state.orderInfo;
// console.log(this.orderInfo); console.log(this.orderType);
console.log(this.orderInfo);
this.getGoodsClass();
}, },
onShow() { onShow() {
// 判断是不是从选择地址页面返回 // 判断是不是从选择地址页面返回
@@ -155,10 +166,49 @@ export default {
'$store.state.orderAddress'(value) { '$store.state.orderAddress'(value) {
this.addressInfo = value; this.addressInfo = value;
this.getFreight(); this.getFreight();
} },
// storeCoupon: {
// deep: true,
// handler() {
// console.log(222);
// this.setTotalPrice(); // 计算总价
// }
// },
// choiceCoupon: {
// deep: true,
// handler() {
// console.log(111);
// this.setTotalPrice(); // 计算总价
// }
// },
}, },
methods: { methods: {
sendOrder() { // 如果有pintuangroup_headid为参团不然为开团
async withImmediate(type) {
let params = {
pintuan_id: this.orderInfo.pintuan_id,
}
// console.log(this.involvemenGroupInfo);
if(this.orderInfo.pintuangroup_id) {
Object.assign(params, { pintuangroup_headid: this.$store.state.pintuangroup_headid });
Object.assign(params, { pintuangroup_id: this.orderInfo.pintuangroup_id });
}
// console.log(params);
this.$u.api.withImmediate(params).then(res => {
this.showGroupUser = false;
this.showInvolvementUser = false;
if(res.errCode == 0) {
this.sendOrder(0);
} else {
this.$u.toast(res.message);
}
})
},
intermediate() {
if(this.orderType == 2) this.withImmediate();
else this.sendOrder(1);
},
sendOrder(ifcart) {
// 拼接后端需要的数据形式 // 拼接后端需要的数据形式
let id = [], temp = ''; let id = [], temp = '';
const object = this.orderInfo.store_cart_list; const object = this.orderInfo.store_cart_list;
@@ -172,15 +222,32 @@ export default {
}) })
} }
} }
// 拼接优惠券
let coupon = [];
for (const key in this.storeCoupon) {
if (this.storeCoupon.hasOwnProperty(key)) {
const element = this.storeCoupon[key];
temp = key + '|' + element.voucher_id;
coupon.push(temp);
temp = '';
}
}
// 平台券store_id写0
if(JSON.stringify(this.choiceCoupon) != '{}') {
coupon.push(0 + '|' + this.choiceCoupon.voucher_id)
}
let params = { let params = {
ifcart: 1, ifcart: ifcart,
cart_id: id, cart_id: id,
address_id: this.addressInfo.address_id, address_id: this.addressInfo.address_id,
buy_city_id: this.addressInfo.city_id, buy_city_id: this.addressInfo.city_id,
voucher_id: coupon,
} }
// if(this.orderType == 3) { if(this.orderType == 2) {
// Object.assign(params, { pintuan_id: }) Object.assign(params, { pintuan_id: this.orderInfo.pintuan_id })
// } if(this.orderInfo.pintuangroup_id) Object.assign(params, { pintuangroup_id: this.orderInfo.pintuangroup_id })
}
// console.log(params);
this.$u.api.sendOrder(params).then(res => { this.$u.api.sendOrder(params).then(res => {
if(res.errCode == 0) { if(res.errCode == 0) {
this.$u.route({ this.$u.route({
@@ -190,39 +257,29 @@ export default {
price: res.data.order_total_amount, price: res.data.order_total_amount,
} }
}) })
} else {
this.$u.toast(res.message);
} }
}) })
}, },
async getCoupon({ type, store_id, status }) { showCoupon({ type, store_id = -1 } = {}) {
const res = await this.$u.api.getMemberCouponList({ this.couponType = {
type: type, type: type,
store_id: store_id, store_id: store_id
status: status,
})
return res;
},
showCoupon({ type, gc_id, store_id }) {
// this.getCoupon({
// type: type, // 优惠券类型: 1平台券, 2店铺券
// store_id: store_id,
// status: 1, // 代金券状态 1:未用 2:已用 3:过期 4:收回
// }).then(res => {
// this.couponStatus = true;
// })
let params = {
type: type, // 优惠券类型: 1平台券, 2店铺券
status: 1, // 代金券状态 1:未用 2:已用 3:过期 4:收回
} }
if(store_id) Object.assign(params, 'store_id', store_id); this.couponStatus = true;
if(gc_id) Object.assign(params, 'gc_id', gc_id);
this.$u.api.getMemberCouponList(params).then(res => {
this.couponList = res.data;
this.couponStatus = true;
})
}, },
useCoupon(coupon) { useCoupon(coupon) {
this.choiceCoupon = coupon; if(this.couponType.type == 1) this.choiceCoupon = coupon;
if(this.couponType.type == 2) {
Object.assign(this.storeCoupon, {
[this.couponType.store_id]: coupon
})
}
// console.log(this.choiceCoupon);
// console.log(this.storeCoupon);
this.couponStatus = false; this.couponStatus = false;
this.setTotalPrice(); // 计算总价
}, },
getFreight() { getFreight() {
this.$u.api.getFreight({ this.$u.api.getFreight({
@@ -238,10 +295,11 @@ export default {
} }
}) })
}, },
setTotalPrice(object) { setTotalPrice() {
const goods = this.orderInfo.store_goods_total; const goods = this.orderInfo.store_goods_total;
const freight = this.freight; const freight = this.freight;
let price = 0; let price = 0;
// 商品价格加上运费
[goods, freight].forEach(object => { [goods, freight].forEach(object => {
for (const key in object) { for (const key in object) {
if (object.hasOwnProperty(key)) { if (object.hasOwnProperty(key)) {
@@ -250,8 +308,20 @@ export default {
} }
} }
}) })
// 减去优惠券
// 平台
if(JSON.stringify(this.choiceCoupon) != '{}') price -= Number(this.choiceCoupon.voucher_price);
// 店铺
if(JSON.stringify(this.storeCoupon) != '{}') {
for (const key in this.storeCoupon) {
if (this.storeCoupon.hasOwnProperty(key)) {
const element = this.storeCoupon[key];
price -= element.voucher_price;
}
}
}
// console.log(price); // console.log(price);
this.totalPrice = price.toFixed(2); this.totalPrice = price.toFixed(2);
}, },
setDelivery(index) { setDelivery(index) {
if(index == 1) { if(index == 1) {

View File

@@ -38,7 +38,7 @@ export default {
disabled: false, disabled: false,
} }
], ],
pay_way: '', pay_way: 'wxpay_app',
pay_sn: '', pay_sn: '',
price: '', price: '',
} }

View File

@@ -100,7 +100,7 @@ export default {
// ifcart 结算方式 1:购物车 0:直接结算(立即购买/拼团/秒杀) // ifcart 结算方式 1:购物车 0:直接结算(立即购买/拼团/秒杀)
this.$u.api.settlementOrder({ ifcart: 1, cart_id: id }).then(res => { this.$u.api.settlementOrder({ ifcart: 1, cart_id: id }).then(res => {
if(res.errCode == 0) { if(res.errCode == 0) {
this.$store.commit('orderType', 2); this.$store.commit('setOrderType', 5);
this.$store.commit('updateOrderInfo', res.data); this.$store.commit('updateOrderInfo', res.data);
this.$u.route({ this.$u.route({
url: '/pageC/cart/ConfirmOrder' url: '/pageC/cart/ConfirmOrder'

View File

@@ -3,10 +3,11 @@
<view> <view>
<u-tabs-swiper ref="uTabs" :list="tabList" name="gc_name" :current="current" @change="tabsChange" :is-scroll="true" active-color="#FF780F" swiperWidth="750" height="88" :show-bar="false"></u-tabs-swiper> <u-tabs-swiper ref="uTabs" :list="tabList" name="gc_name" :current="current" @change="tabsChange" :is-scroll="true" active-color="#FF780F" swiperWidth="750" height="88" :show-bar="false"></u-tabs-swiper>
</view> </view>
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" > <swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" :style="{height: swiperHeight}">
<swiper-item class="swiper-item" v-for="(_, index) in tabList" :key="index"> <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="height: 800rpx;width: 100%;" @scrolltolower="onreachBottom">
<SpecialGoods v-for="(item, index) in pinTuanList" :key="index" :item="item" type='group'></SpecialGoods> <SpecialGoods v-for="(item, index) in pinTuanList" :key="index" :item="item" type='group'></SpecialGoods>
<!-- <loadmore ref="loadmore" @callback="getPinTuanList" bgColor="#FFF"></loadmore> -->
<u-empty text="暂无商品" mode="list" color="#000" v-if="!pinTuanList.length"></u-empty> <u-empty text="暂无商品" mode="list" color="#000" v-if="!pinTuanList.length"></u-empty>
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
@@ -14,27 +15,32 @@
</view> </view>
</template> </template>
<script> <script>
import SpecialGoods from "../../components/shop/special-shop/index" import loadmore from "@/components/loadmore/index";
import SpecialGoods from "../../components/shop/special-shop/index";
export default { export default {
data() { data() {
return { return {
tabList: [], tabList: [],
current: Number, current: -1,
swiperCurrent: 0, swiperCurrent: 0,
page: 0, page: 0,
pinTuanList: [], pinTuanList: [],
swiperHeight: '',
timer: '', // 限制下拉刷新
} }
}, },
components: { components: {
SpecialGoods loadmore,
SpecialGoods,
}, },
onLoad() { onLoad() {
this.getGoodsClass(); this.getGoodsClass();
this.setViewHeight();
}, },
watch: { watch: {
current(index) { current(index) {
console.log(this.tabList); // console.log(this.tabList);
this.getPinTuanList(this.tabList[index].gc_id); this.getPinTuanList({id: this.tabList[index].gc_id });
} }
}, },
methods: { methods: {
@@ -48,13 +54,13 @@ export default {
}) })
}, },
// 拼团列表 // 拼团列表
getPinTuanList(id) { async getPinTuanList({ id, page }) {
this.$u.api.getPinTuanList({ const res = await this.$u.api.getPinTuanList({
page: this.page, page: this.page,
gc_id: id, gc_id: id,
}).then(res => {
this.pinTuanList = res.data;
}) })
this.pinTuanList = res.data;
return res.data.length;
}, },
// tabs通知swiper切换 // tabs通知swiper切换
tabsChange(index) { tabsChange(index) {
@@ -69,14 +75,31 @@ export default {
// swiper滑动结束分别设置tabs和swiper的状态 // swiper滑动结束分别设置tabs和swiper的状态
animationfinish(e) { animationfinish(e) {
let current = e.detail.current; let current = e.detail.current;
this.$refs.uTabs.setFinishCurrent(current);
this.swiperCurrent = current; this.swiperCurrent = current;
this.current = current; this.current = current;
}, },
// scroll-view到底部加载更多 // scroll-view到底部加载更多
onreachBottom() { 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';
},
} }
}; };
</script> </script>

View File

@@ -32,10 +32,10 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.concerns { .concerns {
padding: 35rpx 30rpx 0; // padding: 35rpx 30rpx 0;
.u-index-anchor { // .u-index-anchor {
background-color: #ffffff !important; // background-color: #ffffff !important;
} // }
.list-cell { .list-cell {
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
@@ -43,6 +43,7 @@ export default {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
margin: 50rpx 0; margin: 50rpx 0;
padding: 0 30rpx;
> image { > image {
width: 70rpx; width: 70rpx;
height: 70rpx; height: 70rpx;

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="wash"> <view class="wash">
<view> <view class="title">
<u-tabs-swiper ref="tabs" :list="list" :is-scroll="false" active-color="#FF780F" :current="current" font-size="32" :show-bar="false" @change="tabsChange" height="88" ></u-tabs-swiper> <u-tabs-swiper ref="tabs" :list="list" :is-scroll="false" active-color="#FF780F" :current="current" font-size="32" :show-bar="false" @change="tabsChange" height="88" ></u-tabs-swiper>
</view> </view>
<swiper :current="swiperCurrent" @animationfinish="animationfinish"> <swiper :current="swiperCurrent" @animationfinish="animationfinish">
@@ -19,6 +19,11 @@
<view>所属公司xx公司</view> <view>所属公司xx公司</view>
</view> </view>
</view> </view>
<view class="send-btn">
<view class="btn" v-if="btn_show">
确认完成
</view>
</view>
</view> </view>
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
@@ -35,6 +40,14 @@
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="popup" v-if="showPopup" @click="onTap">
<view class="popup_cont" @click="replaces(1)">
实体店历史订单
</view>
<view class="popup_cont" @click="replaces(2)">
平台历史订单
</view>
</view>
</view> </view>
</template> </template>
<script> <script>
@@ -42,15 +55,17 @@ import Comment from '@/components/mine/comment/index'
export default { export default {
data() { data() {
return { return {
showPopup: false,
list: [{ list: [{
name: '我的订单' name: '平台历史订单'
}, { }, {
name: '申请表' name: '申请表'
}, { }, {
name: '评价' name: '评价'
}], }],
current: 0, current: 0,
swiperCurrent: 0 swiperCurrent: 0,
btn_show:true
} }
}, },
components: { components: {
@@ -59,6 +74,7 @@ export default {
onShow() { onShow() {
this.current = 0; this.current = 0;
this.swiperCurrent = 0; this.swiperCurrent = 0;
this.showPopup= false
}, },
methods: { methods: {
tabsChange(index) { tabsChange(index) {
@@ -72,11 +88,31 @@ export default {
this.toApplyPage(current); this.toApplyPage(current);
}, },
toApplyPage(index) { toApplyPage(index) {
console.log(index)
var that = this;
if(index == 1) { if(index == 1) {
this.showPopup = false
uni.navigateTo({ uni.navigateTo({
url: '/pageE/tool/WashOrder' url: '/pageE/tool/WashOrder'
}); });
}else if(index ==0){
this.history();
}else{
this.showPopup = false
} }
},
history(){
this.showPopup = true;
},
replaces(e){
if(e == 1){
this.$set(this.list,0,{name: '实体店历史订单'} )
}else{
this.$set(this.list,0,{name: '平台历史订单'} )
}
},
onTap(){
this.showPopup = false
} }
}, },
}; };
@@ -89,6 +125,10 @@ export default {
flex-direction: column; flex-direction: column;
> uni-swiper { > uni-swiper {
flex: 1; flex: 1;
height: 85vh;
}
.title{
} }
.swiper-item { .swiper-item {
padding-top: 20rpx; padding-top: 20rpx;
@@ -100,7 +140,7 @@ export default {
.order-item { .order-item {
padding: 30rpx; padding: 30rpx;
width:690rpx; width:690rpx;
height: 308rpx; height: 362rpx;
background: rgba(255,255,255,1); background: rgba(255,255,255,1);
border-radius: 10rpx; border-radius: 10rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
@@ -135,6 +175,25 @@ export default {
} }
} }
} }
.send-btn{
width: 100%;
display: flex;
justify-content: flex-end;
margin-top: 30rpx;
.btn{
width: 154rpx;
height: 54rpx;
background: RGBA(255, 254, 255, 1);
border-radius: 49rpx;
transform: translate(-50%, 0);
font-size: 26rpx;
border: 1rpx solid rgba(255,120,15,1);
color:rgba(255,120,15,1);
text-align: center;
line-height: 54rpx;
margin-right: -80rpx;
}
}
} }
} }
.comment { .comment {
@@ -145,5 +204,35 @@ export default {
} }
} }
} }
.popup{
width: 100%;
height: 100%;
position: fixed;
bottom: 0;
top: 88px;
left: 0;
right: 0;
z-index: 2;
background-color: rgba(0, 0, 0, 0.4);
transform: scale(1);
display: flex;
flex-direction: column;
justify-content: top;
align-items: center;
transition-duration: 0.3s;
.popup_cont{
border-top: 1px solid RGBA(239, 236, 240, 1);
background-color: #fff;
width: 100%;
height: 80rpx;
line-height: 80rpx;
font-size:28rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(102,102,102,1);
padding-left: 41rpx;
}
}
} }
</style> </style>

View File

@@ -1,69 +1,334 @@
<template> <template>
<view class="wash-order"> <view class="wash-order">
<view class="order-info"> <view>
<view class="order-name"> <u-tabs-swiper ref="tabs" :list="list" :is-scroll="false" active-color="#FF780F" :current="current" font-size="32" :show-bar="false" @change="tabsChange" height="88" ></u-tabs-swiper>
<view class="title">送洗人</view> </view>
<input type="text" v-model="name" /> <swiper :current="swiperCurrent" @animationfinish="animationfinish">
</view> <swiper-item class="swiper-item">
<view class="order-phone"> <view class="order-info">
<view class="title">手机号</view> <view class="order-name" @click="order()">
<input type="text" v-model="phone" /> <view class="title titles" >
</view> <text>选择订单</text>
<view class="order-area"> <image src="../../static/image/shop/2.png" mode=""></image>
<view class="title">省市区</view> </view>
<input type="text" v-model="area" /> <u-icon name="arrow-dwon" color="#2979ff" size="28"></u-icon>
<view class="location"> </view>
<image src="../static/mine/28.png"></image> <view class="choose-info" v-if="choose">
<view>定位</view> <view class="store">
<view>
<image src="../../static/image/mine/23.png" mode=""></image>胖胖的店
</view>
<view>
订单编号2222222222222
</view>
</view>
<view class="store_info">
<view class="info_img">
<image src="../../static/image/mine/23.png" mode="">
</view>
<view class="info_txt">
<view class="content">
木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子
</view>
<view class="much">
<text>99</text>
<text>x1</text>
</view>
</view>
</view>
</view>
<view class="order-name">
<view class="title">送洗人</view>
<input type="text" v-model="name" />
</view>
<view class="order-phone">
<view class="title">手机号</view>
<input type="text" v-model="phone" />
</view>
<view class="order-area">
<view class="title">省市区</view>
<input type="text" v-model="area" />
<view class="location">
<image src="../static/mine/28.png"></image>
<view>定位</view>
</view>
</view>
<view class="order-address">
<view class="title">详细地址</view>
<input type="text" v-model="address" />
</view>
</view>
<view class="upload-image">
<view class="title">上传商品图片</view>
<u-upload
ref="uUpload"
@on-uploaded="onUploaded"
:custom-btn="true"
:max-count="count"
:auto-upload="false"
>
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<img src="../static/mine/27.png" />
</view>
</u-upload>
</view>
<view class="wash-btn" @click="reset()">确认送洗</view>
</swiper-item>
<swiper-item class="swiper-item">
<view class="order-info">
<view class="order-name">
<view class="title">商品名称</view>
<input type="text" v-model="name" />
</view>
<view class="order-phone">
<view class="title">商品类型</view>
<input type="text" v-model="name" />
</view>
<view class="order-phone">
<view class="title">衣服状况</view>
<input type="text" v-model="name" />
</view>
<view class="order-name">
<view class="title">送洗人</view>
<input type="text" v-model="name" />
</view>
<view class="order-area">
<view class="title">省市区</view>
<input type="text" v-model="area" />
<view class="location">
<image src="../static/mine/28.png"></image>
<view>定位</view>
</view>
</view>
<view class="order-address">
<view class="title">详细地址</view>
<input type="text" v-model="address" />
</view>
</view>
<view class="upload-image">
<view class="title">上传商品图片</view>
<u-upload
ref="uUpload"
@on-uploaded="onUploaded"
:custom-btn="true"
:max-count="count"
:auto-upload="false"
>
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<img src="../static/mine/27.png" />
</view>
</u-upload>
</view>
<view class="wash-btn">确认送洗</view>
</swiper-item>
</swiper>
<view class="popup" v-if="showPopup">
<view class="popup_cont" >
<view class="check">
<text>选择订单</text>
<image src="../../static/image/common/17.png" @click="close()"></image>
</view>
<swiper style="height: 1000px;" vertical="true">
<swiper-item class="swiper-item">
<scroll-view scroll-y class="order-list">
<view v-for="(items, index) in 3" :key="items.index">
<view class="store">
<view>
<image src="../../static/image/mine/23.png" mode=""></image>胖胖的店
</view>
<view>
订单编号2222222222222
</view>
</view>
<view class="checkd">
<radio-group @change="er">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in checkLidt" :key="index">
<view class="radio">
<radio color="#F0AD4E" :value="item.id" :checked="a==item.id"/>
</view>
<view class="store_info">
<view class="info_img">
<image src="../../static/image/mine/23.png" mode="">
</view>
<view class="info_txt">
<view class="content">
木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子
</view>
<view class="much">
<text>99</text>
<text>x1</text>
</view>
</view>
</view>
</label>
</radio-group>
</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
<view class="bottom_btn" style="width: 100%;background-color: #fff;">
<view class="wash-btn" @click="confirm()">确认</view>
</view> </view>
</view> </view>
<view class="order-address">
<view class="title">详细地址</view>
<input type="text" v-model="address" />
</view>
</view> </view>
<view class="upload-image">
<view class="title">上传商品图片</view>
<u-upload
ref="uUpload"
@on-uploaded="onUploaded"
:custom-btn="true"
:max-count="count"
:auto-upload="false"
>
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<img src="../static/mine/27.png" />
</view>
</u-upload>
</view>
<view class="wash-btn">确认送洗</view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
items: [],
count: 4, // 最大图片数量 count: 4, // 最大图片数量
name: '', name: '',
phone: '', phone: '',
area: '', area: '',
address: '' address: '',
list: [{
name: '平台历史订单'
}, {
name: '实体店历史订单'
}],
current: 0,
swiperCurrent: 0,
showPopup : false,
a:"",
checkLidt:[
{id:'1'},
{id:'2'},
{id:'3'}
]
} }
}, },
methods: { methods: {
onShow() {
this.current = 0;
this.swiperCurrent = 0;
this.showPopup = false;
this.choose = false
},
submit() { submit() {
this.$refs.uUpload.upload(); this.$refs.uUpload.upload();
}, },
onUploaded(list) { onUploaded(list) {
console.log(list) console.log(list)
} },tabsChange(index) {
this.swiperCurrent = index;
},
er(e){
console.log(e)
this.a =e.detail.value;
console.log(this.a)
},
animationfinish(e) {
let current = e.detail.current;
this.swiperCurrent = current;
this.current = current;
this.toApplyPage(current);
},
order(){
this.showPopup = true;
},
toApplyPage(index) {
console.log(index)
if(index == 1) {
this.showPopup = false;
this.choose = false
}
},
// replaces(){
// if(this.list[0].name=='实体店历史订单'){
// this.$set(this.list,0,{name: '平台历史订单'} )
// }else{
// this.$set(this.list,0,{name: '实体店历史订单'} )
// }
// },
confirm(){
this.showPopup = false;
if(this.a ==''){
this.choose =false
}else{
this.choose = true
}
},
close(){
this.showPopup = false
},
reset(){
this.choose = false
},
radioChange: function(evt) {
for (let i = 0; i < this.items.length; i++) {
if (this.items[i].value === evt.target.value) {
this.current = i;
}
}
}
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.wash-order { .wash-order {
border-top: 1rpx solid #ECECEC; border-top: 1rpx solid #ECECEC;
> uni-swiper {
flex: 1;
height: 95vh;
}
.order-info { .order-info {
.choose-info{
display: flex;flex-wrap: wrap;
height: 335rpx;
.store{
>view{
>image{
width:60rpx;
height:60rpx;
border-radius:50%;
vertical-align: middle;
padding-right:13rpx
}
}
font-size:28rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(51,51,51,1);
line-height: 60rpx;
}
.store_info{
display: flex;
flex-wrap: nowrap;
width: 100%;
height: 150rpx;
.info_img{
>image{
width: 180rpx;
height: 160rpx;
}
}
.info_txt{
padding-left: 30rpx;
padding-right: 30rpx;
display: flex;
flex-wrap: wrap;
width: 100%;
.content{
line-height: 44rpx;
font-size: 30rpx;
color:rgba(51,51,51,1);
}
.much{
display: flex;
justify-content: space-between;
width: 100%;
}
}
}
}
> view { > view {
width: 750rpx; width: 750rpx;
height: 98rpx; height: 98rpx;
@@ -87,6 +352,20 @@ export default {
color: rgba(51,51,51,1); color: rgba(51,51,51,1);
margin-right: 10rpx; margin-right: 10rpx;
} }
.titles {
font-size: 30rpx;
color: rgba(51,51,51,1);
margin-right: 10rpx;
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
>image{
width: 27rpx;
height: 12rpx;
}
}
> input { > input {
flex: 1; flex: 1;
text-align: right; text-align: right;
@@ -127,6 +406,12 @@ export default {
} }
} }
} }
.bottom_btn{
position: fixed;
width: 100%;
height: 100rpx;
bottom: 0;
}
.wash-btn { .wash-btn {
width: 690rpx; width: 690rpx;
height: 98rpx; height: 98rpx;
@@ -141,5 +426,132 @@ export default {
text-align: center; text-align: center;
line-height: 98rpx; line-height: 98rpx;
} }
.popup{
width: 100%;
height: 100%;
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 2;
background-color: rgba(0, 0, 0, 0.4);
transform: scale(1);
align-items: center;
transition-duration: 0.3s;
.popup_cont{
border-top: 1px solid RGBA(239, 236, 240, 1);
background-color: #fff;
width: 100%;
height: 1072rpx;
line-height: 80rpx;
font-size:28rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(102,102,102,1);
transform: scale(1);
position: fixed;
display: flex;
flex-direction: column;
bottom: 0px;
left: 0px;
right: 0px;
/* top: 0px; */
transition-duration: 0.3s;
border-radius:20px 20px 0px 0px;
> uni-swiper {
flex: 1;
height: 100vh;
.order-list{
height: 60vh;
padding-bottom: 140rpx;
}
}
.check{
font-size:30rpx;
font-family:PingFang SC;
font-weight:500;
color:rgba(51,51,51,1);
height:88rpx;
width: 100%;
padding-left: 30rpx;
border-bottom: 1px solid rgba(236, 236, 236, 1);
>image{
width: 32rpx;
height: 32rpx;
vertical-align: middle;
float: right;
padding-top: 30rpx;
padding-right:30rpx
}
}
.store{
>view{
padding-left: 30rpx;
padding-top: 30rpx;
>image{
width:60rpx;
height:60rpx;
border-radius:50%;
vertical-align: middle;
padding-right:13rpx
}
}
font-size:28rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(51,51,51,1);
line-height: 60rpx;
}
.checkd{
>radio-group .uni-list-cell{
display: flex;
flex-wrap: nowrap;
width: 100%;
}
.radio{
display: flex;
align-items: center;
padding-left: 30rpx;
}
.store_info{
display: flex;
flex-wrap: nowrap;
width: 100%;
.info_img{
>image{
width: 180rpx;
height: 160rpx;
}
}
.info_txt{
padding-left: 30rpx;
padding-right: 30rpx;
display: flex;
flex-wrap: wrap;
width: 100%;
.content{
line-height: 44rpx;
font-size: 30rpx;
color:rgba(51,51,51,1);
}
.much{
display: flex;
justify-content: space-between;
width: 100%;
}
}
}
}
}
}
} }
</style> </style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="shop"> <scroll-view class="shop" scroll-y @scrolltolower="onreachBottom">
<view class="top"> <view class="top">
<image src="/static/image/shop/1.png" class="local"></image> <image src="/static/image/shop/1.png" class="local"></image>
<view class="add" @click="chooseArea=true"> <view class="add" @click="chooseArea=true">
@@ -7,7 +7,7 @@
<image src="/static/image/shop/2.png"></image> <image src="/static/image/shop/2.png"></image>
</view> </view>
<view @click="sousuo"> <view @click="sousuo">
<u-search placeholder="日照香炉生紫烟" v-model="keyword" :show-action="false" bg-color="#fff" border-color="#999999" :disabled="true"></u-search> <u-search placeholder="" v-model="keyword" :show-action="false" bg-color="#fff" border-color="#999999" :disabled="true"></u-search>
</view> </view>
<image src="/static/image/shop/3.png" class="mnue" @click="toClassifyPage"></image> <image src="/static/image/shop/3.png" class="mnue" @click="toClassifyPage"></image>
</view> </view>
@@ -48,12 +48,12 @@
<image class="lingquan"></image> <image class="lingquan"></image>
<youhq></youhq> <youhq></youhq>
<view class="hr" style="margin-top:40rpx"></view> <view class="hr" style="margin-top:40rpx"></view>
<list v-if="couponGroupList.length" :classifyList="couponGroupList"></list> <list ref="recommendGoods"></list>
<view class="cart" @click="toCartPage"> <view class="cart" @click="toCartPage">
<image src="/static/image/common/3.png"></image> <image src="/static/image/common/3.png"></image>
</view> </view>
<u-picker mode="region" :params="areaParams" v-model="chooseArea" @confirm="setArea"></u-picker> <u-picker mode="region" :params="areaParams" v-model="chooseArea" @confirm="setArea"></u-picker>
</view> </scroll-view>
</template> </template>
<script> <script>
import shopitem from "@/components/shop/shop-item/index" import shopitem from "@/components/shop/shop-item/index"
@@ -63,7 +63,6 @@ import seckill from "@/components/shop/seckill/index"
import group from "@/components/shop/group/index" import group from "@/components/shop/group/index"
import youhq from "@/components/shop/youhq/index" import youhq from "@/components/shop/youhq/index"
import list from "../../components/shop/list/index" import list from "../../components/shop/list/index"
export default { export default {
name:"shop", name:"shop",
components:{ components:{
@@ -175,7 +174,10 @@ export default {
clickImage(index) { clickImage(index) {
console.log(index); console.log(index);
console.log(this.list[index]); console.log(this.list[index]);
},
// 下拉加载更多推荐商品
onreachBottom() {
this.$refs.recommendGoods.loadMore();
}, },
setArea(e) { setArea(e) {
// console.log(e); // console.log(e);
@@ -195,8 +197,10 @@ export default {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.shop{ .shop {
padding: 0 33rpx; height: calc(100vh - var(--window-top));
box-sizing: border-box;
padding: 0 33rpx 100rpx;
.top{ .top{
width: 100%; width: 100%;
height: 88rpx; height: 88rpx;