Merge pull request 'group order' (#71) from zhy into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/71
This commit is contained in:
hansu 2020-07-20 17:18:38 +08:00
commit 73519fe205
11 changed files with 494 additions and 55 deletions

View File

@ -205,10 +205,18 @@ export default {
getPinTuanDetails({ pintuan_id }) {
return vm.$u.post('Specialci/pintuanInfo', { pintuan_id: pintuan_id });
},
// pintuanPush
// 推荐拼团
getPinTuanPush() {
return vm.$u.post('Specialci/pintuanPush');
},
// 开团/参团
withImmediate({ pintuan_id, pintuangroup_headid, pintuangroup_id}) {
return vm.$u.post('Specialci/withImmediate', {
pintuan_id: pintuan_id,
pintuangroup_headid: pintuangroup_headid,
pintuangroup_id: pintuangroup_id,
});
},
// 商品分类(拼团分类)
getGoodsClass() {
return vm.$u.post('Specialci/goodsClass');

View File

@ -308,7 +308,6 @@ export default {
delMessage({ type }) {
return vm.$u.post('/message/readMessage', { type });
},
// 已读消息
refreshToken({ }) {
return vm.$u.post('/Auth/refreshToken', { });
@ -321,6 +320,12 @@ export default {
articleDelShield({ id }) {
return vm.$u.post('article/articleDelShield', { member_id: id });
},
// 配置
getConfigInfo({ code }) {
return vm.$u.post('Document/getConfigInfo', {
code: code,
});
},
}
}
}

View File

@ -6,10 +6,17 @@ const store = new Vuex.Store({
state: {
cartInfo: {}, // 购物车数据
orderAddress: {}, // 下单时选择的地址
goodsDetails: {}, // 商品详情 1普通 2拼团 3秒杀 4优惠券
},
getters: {
getOrderAddress(state) {
return state.orderAddress;
},
getGoodsType(state) {
return state.goodsDetails.type;
},
getGoodsInfo(state) {
return state.goodsDetails.goods;
}
},
mutations: {
@ -18,7 +25,10 @@ const store = new Vuex.Store({
},
updateAddress(state, address) {
state.orderAddress = address;
}
},
setGoodsDetails(state, goods) {
state.goodsDetails = goods;
},
}
})
export default store;

View File

@ -26,7 +26,6 @@
/**
* coupon 领取的优惠券 自己的优惠券
* @description 优惠券组件
* @property {Number} type 优惠券操作方式(可兑换的优惠券: 0 / 自己的优惠券: 1)
* @property {Object} coupon-info 优惠券信息
* @event {Function} use 使用优惠券
*/
@ -36,20 +35,18 @@ export default {
},
props: {
status: Number,
type: Number,
couponInfo: Object,
goodsClass: Array,
},
created() {
// console.log(this.couponInfo);
// this.getGoodsClass();
},
filters: {
showClass(value, classList) {
const ids = classList.filter(element => {
return element.gc_id == value;
});
console.log(ids);
// console.log(ids);
return ids.length ? ids[0].gc_name : '';
}
},

View File

@ -5,16 +5,15 @@
<text>查看更多></text>
</view>
<view class="label">
<text>sda</text>
<text>asda</text>
<text>dsad</text>
<text>asdas</text>
</view>
<view class="list">
<sitem></sitem>
<sitem></sitem>
<sitem></sitem>
<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>
<swiper :current="swiperCurrent" @animationfinish="animationfinish" style="height: 130px">
<swiper-item class="swiper-item" v-for="(_, i) in classifyList" :key="i">
<!-- 最多显示3个 -->
<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>
</swiper-item>
</swiper>
</view>
</template>
<script>
@ -23,12 +22,27 @@ export default {
name:"group",
components:{
sitem
},
},
props: {
groupList: Array,
classifyList: Array,
},
data(){
return {
current: 0,
swiperCurrent: 0,
}
}
},
methods: {
tabsChange(index) {
this.swiperCurrent = index;
},
animationfinish(e) {
let current = e.detail.current;
this.swiperCurrent = current;
this.current = current;
},
}
}
</script>
<style lang="scss" scoped>

View File

@ -1,17 +1,19 @@
<template>
<view class="item">
<image class="head"></image>
<text class="title">商品名</text>
<image class="head" :src="info.pintuan_image"></image>
<text class="title u-line-1">{{ info.pintuan_goods_name }}</text>
<view class="price">
<text>99</text>
<text>立即购买</text>
<text>{{ info.pintuan_goods_price }}</text>
<text>立即购买</text>
</view>
</view>
</template>
<script>
export default {
name:"item"
name:"item",
props: {
info: Object
}
}
</script>
<style lang="scss" scoped>
@ -24,6 +26,8 @@ export default {
}
.title{
display: inline-block;
width: 100%;
font-size: 26rpx;
color: #333;
margin-top: 16rpx;

View File

@ -0,0 +1,155 @@
<template>
<view class="recommend">
<view class="top">
<text>今日拼团推荐</text>
<text @click="toDetailsPage">点击查看更多></text>
</view>
<view class="connect">
<view class="user">
<view class="avatar">
<image :src="info.member_avatar[0]"></image>
<image :src="info.member_avatar[1]"></image>
</view>
<view class="num">{{ info.pintuan_limit_number }}人团</view>
</view>
<view class="info">
<text class="u-line-1">{{ info.groupbuy_name }}</text>
<text class="u-line-2">{{ info.goods_name }}</text>
<view>
<text>{{ info.groupbuy_price }}</text>
<text>{{ info.goods_price }}</text>
</view>
</view>
<image class="img" :src="info.groupbuy_image1"></image>
</view>
</view>
</template>
<script>
export default {
name:"recommend",
data() {
return {
info: {}
}
},
props: ['recommendData', 'type'],
created() {
this.info = this.recommendData;
console.log(this.recommendData);
},
methods: {
toDetailsPage() {
this.$u.api.getPinTuanDetails({
pintuan_id: this.recommendData.pintuan_id
}).then(res => {
if(res.errCode == 0) {
const goods = {
goods: res.data.data,
type: 2,
}
this.$store.commit('setGoodsDetails', goods);
this.$u.route({
url: 'pageB/sdetails/index',
params: {
id: this.recommendData.pintuan_id
}
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.recommend{
.top{
height: 90rpx;
display: flex;
align-items: center;
justify-content: space-between;
>text:first-child{
font-size: 30rpx;
color: #333;
}
>text:last-child{
font-size: 18rpx;
color: #999;
}
}
.connect{
display: flex;
align-items: center;
.user {
margin-right: 16px;
.avatar {
width: 96rpx;
height: 64rpx;
margin-bottom: 16rpx;
position: relative;
> image {
position: absolute;
width: 64rpx;
height: 64rpx;
border-radius: 50%;
&:first-child {
left: 0;
top: 0;
z-index: 8;
background-color: aqua;
}
&:last-child {
left: 32rpx;
top: 0;
z-index: 9;
background-color: antiquewhite;
}
}
}
.num {
text-align: center;
font-size: 28rpx;
font-weight: 500;
color: rgba(253,211,96,1);
}
}
.info{
width: 340rpx;
display: flex;
flex-direction: column;
>text:nth-child(1){
font-size: 28rpx;
color: #333;
}
>text:nth-child(2){
margin-top: 17rpx;
line-height: 36rpx;
font-size: 24rpx;
color: #666;
}
>view{
margin-top: 24rpx;
display: flex;
align-items: flex-end;
>text:first-child{
font-size: 27rpx;
color: #FF3131;
}
>text:last-child{
font-size: 24rpx;
color: #999;
margin-left: 33rpx;
text-decoration: line-through;
}
}
}
.img{
width: 213rpx;
height: 160rpx;
flex-shrink: 0;
margin-left: 13rpx;
background-color: antiquewhite;
}
}
}
</style>

View File

@ -1,9 +1,9 @@
<template>
<view class="sdetails">
<u-swiper :list="list" height="500" border-radius="0"></u-swiper>
<u-swiper :list="list" height="500" border-radius="0" mode="dot"></u-swiper>
<view class="info">
<view class="title">
<text>{{ goodsInfo.store_name }}</text>{{ goodsInfo.goods_name }}
<view class="title u-line-2">
<text>{{ goodsInfo.store_name }}</text>{{ goodsInfo.goods_name }}
</view>
<view class="pic">
<text>{{ goodsInfo.goods_price }}</text>
@ -15,6 +15,39 @@
<navs :value="'产品规格'"></navs>
<navs :value="'产品颜色'"></navs>
<navs :value="'选择尺码'"></navs>
<view class="hr"></view>
<view class="group-user" v-if="groupUser.length">
<view class="top">
<view class="title">{{ groupUser.length }}人正在拼团可直接参与</view>
<view class="view-more">
<text>查看全部</text>
<image src="/static/image/common/1.png"></image>
</view>
</view>
<view class="bottom">
<view class="left">
<view class="avatar">
<image v-for="(user, i) in groupUser" :src="user[0].member_avatar" :key="i"></image>
</view>
<view class="all">
<text>查看全部</text>
<image src="/static/image/common/1.png"></image>
</view>
</view>
<view class="right">
<view class="launch-user">
<image :src="groupUser[0][0].member_avatar"></image>
<text class="u-line-1">{{ groupUser[0][0].member_nickname }}</text>
</view>
<view class="involvement-user">
<view class="item" v-for="(user, i) in groupUser.slice(1)" :key="i">
<image :src="user[0].member_avatar"></image>
<text class="u-line-1">{{ user[0].member_nickname }}</text>
</view>
</view>
</view>
</view>
</view>
<view class="xiangqing">
<view class="heng"></view>
<view class="title">商品详情</view>
@ -23,22 +56,31 @@
<view class="rich">
<rich-text :nodes="goodsInfo.mobile_body"></rich-text>
</view>
<tloos @buy="buy" @xuanze="xuanze" :id="goodsInfo.goods_commonid" :info="info"></tloos>
<!-- 拼团 tool -->
<view class="group-tool" v-if="type==2">
<view class="launch" @click="withImmediate">发起拼团</view>
<view class="involvement">参与拼团</view>
</view>
<!-- 普通商品 tool -->
<tloos @buy="buy" @xuanze="xuanze" :id="goodsInfo.goods_commonid" :info="info" v-if="type==1"></tloos>
<u-toast ref="uToast" />
</view>
</template>
<script>
import navs from "../components/sdetails/navs"
import tloos from "../components/sdetails/tloos"
export default {
export default {
name:"sdetails",
data() {
return {
list: [],
list: [], //
goodsInfo: {},
info:{},
glist:[],
id:0
id:0,
type: '', //
groupUser: [], //
avatarWidth: '',
}
},
components:{
@ -46,10 +88,27 @@ export default {
tloos
},
onLoad(option) {
this.getGoodsDetails(option.id);
this.id = option.id;
this.init();
},
methods: {
init() {
this.type = this.$store.getters.getGoodsType;
const info = this.$store.getters.getGoodsInfo;
console.log(info);
this.goodsInfo = info.goods;
this.groupUser = info.user;
//
let list = [];
info.goods_image[0].forEach(item => {
let temp = {
image: item
}
list.push(temp);
})
this.list = list;
this.setTitle();
},
buy(info){
if(info.type == 2){
this.$u.api.addCart({
@ -80,15 +139,44 @@ export default {
}
})
this.$u.api.goodsInfo({id}).then((res)=>{
console.log(res)
// console.log(res)
this.info = res.data.goods;
this.glist = res.data.spec_list;
})
},
},
withImmediate() {
this.$u.api.withImmediate({
pintuan_id: this.id,
}).then(res => {
})
},
xuanze(id){
console.log(id)
// console.log(id)
this.getGoodsDetails(this.glist[id])
}
},
setTitle() {
let title = '';
switch (this.type) {
case 1:
break;
case 2:
title = '拼团商品详情';
break;
case 1:
break;
case 1:
break;
default:
break;
}
uni.setNavigationBarTitle({
title: title
});
},
},
}
</script>
@ -128,6 +216,105 @@ export default {
height: 20rpx;
background-color: #ececec;
}
.group-user {
padding: 30rpx;
.top {
margin-bottom: 28rpx;
display: flex;
align-items: center;
justify-content: space-between;
.title {
font-size: 30rpx;
color: rgba(51,51,51,1);
}
.view-more {
font-size: 24rpx;
color: rgba(153,153,153,1);
> image {
margin-left: 10rpx;
width: 8rpx;
height: 16rpx;
}
}
}
.bottom {
display: flex;
align-items: center;
font-size: 22rpx;
color: rgba(153,153,153,1);
.left {
margin-right: 40rpx;
.avatar {
width: 120rpx;
height: 60rpx;
margin-bottom: 16rpx;
position: relative;
@mixin avatar($left, $index) {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
position: absolute;
top: 0;
left: $left;
z-index: $index;
}
> image {
&:first-child {
background-color: aliceblue;
@include avatar($left: 0rpx, $index: 7);
}
&:nth-child(2) {
background-color: aquamarine;
@include avatar($left: 30rpx, $index: 8);
}
&:nth-child(3) {
background-color: antiquewhite;
@include avatar($left: 60rpx, $index: 9);
}
}
}
.all {
> image {
margin-left: 10rpx;
width: 8rpx;
height: 16rpx;
}
}
}
.right {
display: flex;
image {
background-color: aquamarine;
width: 60rpx;
height: 60rpx;
margin-bottom: 15rpx;
border-radius: 50%;
}
.launch-user {
margin-right: 40rpx;
text-align: center;
> text {
width: 98rpx;
display: block;
}
}
.involvement-user {
display: flex;
align-items: center;
.item {
text-align: center;
> text {
display: block;
width: 72rpx;
}
&:not(:last-child) {
margin-right: 30rpx;
}
}
}
}
}
}
.xiangqing{
display: flex;
height: 85rpx;
@ -149,5 +336,28 @@ export default {
.rich {
width: 100%;
}
.group-tool {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 98rpx;
display: flex;
font-size: 32rpx;
color: rgba(255,255,255,1);
z-index: 99;
.launch {
flex: 1;
background: rgba(253,211,96,1);
line-height: 98rpx;
text-align: center;
}
.involvement {
flex: 1;
background: rgba(255,120,15,1);
line-height: 98rpx;
text-align: center;
}
}
}
</style>

View File

@ -33,7 +33,7 @@
</view>
</view>
<view class="order-info">
<view @click="showCoupon({type: 2, store_id: item[index].store_id})">
<view @click="showCoupon({type: 2, store_id: item[0].store_id})">
<view class="title">优惠券折扣</view>
<view class="value">
<view>{{ item.coupon_price ? item.coupon_price : '0.00' }}</view>
@ -69,7 +69,7 @@
<scroll-view class="coupon-choose" style="height: 800rpx;">
<view class="title">优惠券详情</view>
<view class="text">使用优惠券</view>
<Coupon :couponInfo="coupon" :status='0' :type="1" @use="useCoupon($event)" v-for="(coupon) in couponList" :key="coupon.vouchertemplate_id"></Coupon>
<Coupon :couponInfo="coupon" @use="useCoupon($event)" :goodsClass="goodsClass" v-for="(coupon, index) in couponList" :key="index"></Coupon>
<u-empty text="无可用优惠券" mode="coupon" v-if="!couponList.length"></u-empty>
</scroll-view>
</u-popup>
@ -87,7 +87,7 @@
</view>
</template>
<script>
import Coupon from "@/components/mine/coupon/index";
import Coupon from "@/components/mine/coupon/mine";
export default {
data() {
return {
@ -111,6 +111,7 @@ export default {
couponList: [],
couponStatus: false,
choiceCoupon: {}, // 使
goodsClass: [],
}
},
components: {
@ -135,6 +136,7 @@ export default {
},
onLoad(option) {
this.orderInfo = this.$store.state.cartInfo;
console.log(this.orderInfo);
},
onShow() {
//
@ -193,7 +195,7 @@ export default {
})
return res;
},
showCoupon({ type, store_id }) {
showCoupon({ type, gc_id, store_id }) {
// this.getCoupon({
// type: type, // : 1, 2
// store_id: store_id,
@ -201,11 +203,13 @@ export default {
// }).then(res => {
// this.couponStatus = true;
// })
this.$u.api.getMemberCouponList({
let params = {
type: type, // : 1, 2
store_id: store_id,
status: 1, // 1: 2: 3: 4:
}).then(res => {
}
if(store_id) Object.assign(params, 'store_id', store_id);
if(gc_id) Object.assign(params, 'gc_id', gc_id);
this.$u.api.getMemberCouponList(params).then(res => {
this.couponList = res.data;
this.couponStatus = true;
})
@ -256,6 +260,11 @@ export default {
url: '/pageE/order/Details'
});
},
getGoodsClass() {
this.$u.api.getGoodsClass().then(res => {
this.goodsClass = res.data;
})
},
changeAddress() {
uni.navigateTo({
url: '/pageE/more/Address?type=choose'

View File

@ -35,21 +35,25 @@ export default {
minute: true,
second: false
},
show: false
show: false,
addressInfo: {},
}
},
onLoad() {
this.getConfigInfo();
},
methods: {
validateValue() {
if(this.$u.test.isEmpty(this.name)) {
this.showToast('姓名不能为空', 'warning');
this.showToast('姓名不能为空', 'error');
return false;
}
if(this.$u.test.isEmpty(this.time)) {
this.showToast('日期不能为空', 'warning');
this.showToast('日期不能为空', 'error');
return false;
}
if(new Date() > new Date(this.time)) {
this.showToast('日期错误', 'warning');
this.showToast('日期错误', 'error');
return false;
}
return true;
@ -74,6 +78,16 @@ export default {
}
})
},
getConfigInfo() {
this.$u.api.getConfigInfo({
code: 'manicure_address',
}).then(res => {
if(res.errCode == 0) {
this.addressInfo = res.data.config;
this.address = this.addressInfo.value;
}
})
},
chooseDate(e) {
// let time = e.year + '' + e.month + '' + e.day + '' + e.hour + '' + e.minute + ''
let time = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute
@ -105,6 +119,19 @@ export default {
font-size: 30rpx;
}
}
.order-name {
display: flex;
align-items: center;
> view {
font-size: 30rpx;
color: rgba(51,51,51,1);
}
> input {
padding-left: 20rpx;
flex: 1;
font-size: 28rpx;
}
}
.order-address {
display: flex;
align-items: center;

View File

@ -30,9 +30,6 @@
<text>上门取件</text>
</view>
</view>
<view class="fenlei">
<shopitem v-for="item in 5" class="item"></shopitem>
</view>
<view class="fenlei">
<shopitem v-for="item in goodsClassify" :key="item.gc_id" :info="item" class="item"></shopitem>
</view>
@ -43,9 +40,9 @@
<seckill v-if="spikeList.length" :list="spikeList" :time="seckillTime"></seckill>
<view v-if="spikeList.length" class="hr" style="margin-top:40rpx"></view>
<!-- 拼团 -->
<recommend v-if="JSON.stringify(pinTuanPush) != '{}'" :recommendData="pinTuanPush" type='group'></recommend>
<pintuan v-if="JSON.stringify(pinTuanPush) != '{}'" :recommendData="pinTuanPush"></pintuan>
<view class="hr" style="margin-top:40rpx" v-if="JSON.stringify(pinTuanPush) != '{}'"></view>
<group></group>
<group :groupList="pinTuanList" :classifyList="couponGroupList"></group>
<image class="lingquan"></image>
<youhq></youhq>
<view class="hr" style="margin-top:40rpx"></view>
@ -59,6 +56,7 @@
<script>
import shopitem from "@/components/shop/shop-item/index"
import recommend from "@/components/shop/recommend/index"
import pintuan from "@/components/shop/recommend/pintuan"
import seckill from "@/components/shop/seckill/index"
import group from "@/components/shop/group/index"
import youhq from "@/components/shop/youhq/index"
@ -72,7 +70,8 @@ export default {
seckill,
group,
youhq,
list
list,
pintuan
},
data(){
return {
@ -274,6 +273,7 @@ export default {
background-color: #ececec;
}
.cart {
z-index: 9;
position: fixed;
right: 30rpx;
bottom: 300rpx;