Commit 6664c6a8 authored by beisir's avatar beisir

Merge branch 'feat/group-buy' of git.quantgroup.cn:ui/group-buy-ui into feat/group-buy

parents f8750728 3702d879
...@@ -52,7 +52,6 @@ export default { ...@@ -52,7 +52,6 @@ export default {
} }
}, },
$route() { $route() {
console.log(isApp, isWxMp, isWechat);
store.dispatch('change_show_mini_app_guide', { store.dispatch('change_show_mini_app_guide', {
bool: !isApp && !isWxMp && !isWechat ? true : false, bool: !isApp && !isWxMp && !isWechat ? true : false,
pointer: this pointer: this
......
...@@ -38,11 +38,11 @@ export default { ...@@ -38,11 +38,11 @@ export default {
return http.get(`${talosHost}/api/kdsp/order-info/status-number`); return http.get(`${talosHost}/api/kdsp/order-info/status-number`);
}, },
confirmOrder(data) { confirmOrder(data) {
return http.post(`${talosHost}/api/kdsp/shop-cart/order-confirm/page/v2`, data); return http.post(`${talosHost}/api/kdsp/shop-cart/order-confirm/page/activity`, data);
}, },
orderSubmit(data) { orderSubmit(data) {
return http.post(`${talosHost}/api/kdsp/order-info/e/submit`, encryption(data)); return http.post(`${talosHost}/api/kdsp/order-info/e/hundredGroupSubmit`, encryption(data));
}, },
// 物流公司列表 // 物流公司列表
companyList() { companyList() {
......
...@@ -59,34 +59,18 @@ ...@@ -59,34 +59,18 @@
<script> <script>
export default { export default {
props: { props: {
avators: { groupInfo: {
type: Array, type: Object,
default: () => [ default: () => {
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_01.png', return {};
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_02.png', }
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_03.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_04.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_05.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_06.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_07.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_09.png'
// 'https://activitystatic.lkbang.net/mall-free-ui/img/avator_10.png'
// 'https://activitystatic.lkbang.net/mall-free-ui/img/avator_10.png'
]
},
desc: {
type: String,
default: ''
},
groupPersonNum: {
type: Number,
default: 100
} }
}, },
data() { data() {
return { return {
isLeader: true, // 标识是不是团长 isLeader: true, // 标识是不是团长
showDialogSlot: false // 查看参团人员 showDialogSlot: false, // 查看参团人员
avators: [] // 头像列表
}; };
}, },
computed: { computed: {
......
<template>
<div class="coupon-list">
<h3 class="coupon-title">选择{{ feeTitle }}</h3>
<div class="coupon-list__list">
<template v-if="list.length">
<div v-for="(info, index) in list" :key="index" @click="handleSelectCoupon(info.id)">
<div v-if="couponType == 4" class="minus-list__item">
<div class="minus-list__left">
<p>{{ info.activityDesc }}</p>
<span>活动有效期:{{ info.startDate }}-{{ info.endDate }}</span>
</div>
<div class="minus-list__right">
<cr-icon v-if="info.isSelect" type="checked" color="#ec3333" size="25px" />
<cr-icon v-else type="circle" color="#dcdcdc" size="25px" />
</div>
</div>
<div v-else class="coupon-list__item">
<img :src="info.iconUrl" class="coupon-list__tag" />
<div class="coupon-list__left">
<div class="coupon-list__amount">
<span>{{ currency }}</span>
{{ info.faceValue }}
</div>
<div class="coupon-list__limit">{{ info.limitDesc }}</div>
</div>
<div class="coupon-list__content">
<div class="coupon-list__desc">{{ info.name }}</div>
<div class="coupon-list__date">{{ info.couponValidTime }}</div>
</div>
<div class="coupon-list__right">
<cr-icon v-if="info.isSelect" type="checked" color="#ec3333" size="25px" />
<cr-icon v-else type="circle" color="#dcdcdc" size="25px" />
</div>
</div>
</div>
</template>
<div v-else class="coupon-list__empty"><empty text="暂无优惠券" /></div>
</div>
<div v-if="list.length" class="coupon-list__bottom">
<button @click="handleRadioSubmit">确定</button>
</div>
</div>
</template>
<script>
import { getCouponChooseList } from '@/api/home.api';
import { TITLE_LIST } from '@/constants/order';
import Empty from './empty';
export default {
name: 'CouponList',
components: {
Empty
},
props: {
couponId: {
type: [String, Number],
default: 0
},
couponType: [String, Number],
currency: {
type: String,
default: '¥'
},
goodsInfo: {
type: Array,
default: () => []
},
couponActivityInfoList: {
type: Array,
default: () => []
}
},
data() {
return {
list: []
};
},
computed: {
selectedCoupon() {
return this.list.filter(l => {
if (l.isSelect) return l;
});
},
feeTitle() {
return TITLE_LIST[this.couponType];
}
},
watch: {
couponId: {
handler() {
this.getCouponChooseList();
},
immediate: true
},
couponType: {
handler() {
this.getCouponChooseList();
},
immediate: true
}
},
methods: {
handleSelectCoupon(num) {
this.list.map(item => {
if (item.id == num) {
item.isSelect = !item.isSelect;
} else {
item.isSelect = false;
}
});
},
handleRadioSubmit() {
this.$emit('coupon-select', this.selectedCoupon);
},
async getCouponChooseList() {
if (!this.goodsInfo.length) return;
this.list = [];
const selectedSkuList = this.goodsInfo.map(item => {
const { skuSource, count, skuId } = item;
return {
skuNo: skuId,
skuNum: count,
skuSource
};
});
const selectedCouponActivityList = [];
this.couponActivityInfoList.forEach(item => {
selectedCouponActivityList.push({
couponActivityType: item.couponActivityType,
couponActivityUseId: item.couponActivityUseId
});
});
const [res] = await getCouponChooseList({
selectedSkuList,
couponActivityType: this.couponType,
selectedCouponActivityList
});
if ((res && res.coupons) || (res && res.activityList)) {
const data = this.couponType == 4 ? res.activityList : res.coupons;
data.forEach(u => {
u.id = this.couponType == 4 ? u.activityId : u.pickupId;
if (u.id == this.couponId) u.isSelect = true;
else u.isSelect = false;
});
this.list = data;
}
}
}
};
</script>
<style lang="less" scoped>
.coupon-title {
text-align: center;
margin: 0 auto;
margin-top: 15px;
width: 50%;
.text-18();
}
.coupon-list {
&__bottom {
padding: 10px 20px 15px 20px;
position: relative;
box-sizing: border-box;
button {
width: 100%;
background-image: linear-gradient(269deg, #ff5d00 12%, #ff1900 86%);
border-radius: 80px;
height: 40px;
.text-14();
line-height: 40px;
color: #fff;
}
}
&__list {
padding: 10px 10px 0;
overflow-y: scroll;
overflow-x: hidden;
height: 50vh;
}
&__scroll {
height: 100%;
}
&__empty {
padding-top: 50px;
}
&__item {
position: relative;
display: flex;
align-items: center;
background: #ffece6;
border-radius: 6px;
padding: 18px 10px;
margin-bottom: 10px;
&--disabled {
-webkit-filter: grayscale(100%) opacity(0.8); /* Chrome, Safari, Opera */
filter: grayscale(100%) opacity(0.8);
.cr-coupon-list__right {
display: none;
}
}
}
&__tag {
position: absolute;
top: 0;
left: 0;
width: 44px;
height: 16px;
}
&__left {
text-align: center;
color: #ec3333;
}
&__amount {
font-size: 30px;
font-weight: 500;
line-height: 36px;
margin: 0;
text {
font-size: 16px;
line-height: 22px;
}
}
&__limit {
.text-12();
color: #ec3333;
line-height: 17px;
margin: 0;
}
&__content {
padding: 0 18px;
}
&__desc {
.text-14();
line-height: 20px;
font-weight: 500;
color: #333;
margin-bottom: 3px;
}
&__date {
.text-12();
color: #666666;
line-height: 17px;
}
&__right {
margin-left: auto;
.radio {
width: 30px;
height: 30px;
display: block;
transform: scale(0.8);
background-color: red !important;
}
}
}
::v-deep .cr-icon {
line-height: 28px !important;
}
.minus-list {
&__list {
padding: 10px 10px 0;
overflow-y: scroll;
overflow-x: hidden;
height: 50vh;
}
&__item {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
border-radius: 6px;
padding: 6px 10px;
margin-bottom: 10px;
}
&__left {
.text-14();
span {
color: @font-color-base;
.text-12();
}
}
}
</style>
<template> <template>
<div class="success-info"> <div class="success-info">
<p class="desc">已有<span>6999人</span>拼团成功</p> <p class="desc">
已有<span>{{ groupInfo.groupBuySuccessCount || 0 }}</span>拼团成功
</p>
<avator-swiper :avator-data="avatorData" /> <avator-swiper :avator-data="avatorData" />
</div> </div>
</template> </template>
...@@ -10,20 +12,27 @@ export default { ...@@ -10,20 +12,27 @@ export default {
components: { components: {
avatorSwiper avatorSwiper
}, },
props: {
groupInfo: {
type: Object,
default: () => {
return {};
}
}
},
data() { data() {
return { return {
avatorData: [ avatorData: []
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_01.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_02.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_03.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_04.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_05.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_06.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_07.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_09.png',
'https://activitystatic.lkbang.net/mall-free-ui/img/avator_10.png'
]
}; };
},
created() {
if (this.groupInfo.groupBuyAllUserInfoList) {
this.avatorData = this.groupInfo.groupBuyAllUserInfoList.map(v => {
return v.avatar;
});
} else {
this.avatorData = [];
}
} }
}; };
</script> </script>
......
...@@ -10,6 +10,9 @@ const shenceHost = 'https://bn.xyqb.com/sa?project=default'; // 测试地址 ...@@ -10,6 +10,9 @@ const shenceHost = 'https://bn.xyqb.com/sa?project=default'; // 测试地址
const talosHost = 'https://talos-vcc3.liangkebang.net'; const talosHost = 'https://talos-vcc3.liangkebang.net';
const faceHost = 'https://auth-vcc3.liangkebang.net'; const faceHost = 'https://auth-vcc3.liangkebang.net';
const kdspHost = 'https://kdsp-api-vcc3.liangkebang.net'; const kdspHost = 'https://kdsp-api-vcc3.liangkebang.net';
// const talosHost = 'http://192.168.29.89:8098'; // 唐峰
// const talosHost = 'http://192.168.25.210:8080'; // 张超
// const talosHost = 'http://192.168.28.83:80'; // 董彪
const opapiHost = 'https://opapi-vcc3.liangkebang.net'; const opapiHost = 'https://opapi-vcc3.liangkebang.net';
const VCC_CHANNEL = ''; const VCC_CHANNEL = '';
const TERMINAL = 'H5'; const TERMINAL = 'H5';
......
...@@ -88,7 +88,7 @@ const mutations = { ...@@ -88,7 +88,7 @@ const mutations = {
}, },
[types.CHANGE_SHOW_MINI_APP_GUIDE](state, { bool, pointer }) { [types.CHANGE_SHOW_MINI_APP_GUIDE](state, { bool, pointer }) {
state.isPrimordialBrowser = bool; state.isPrimordialBrowser = bool;
if (bool) { if (!bool) {
// 需要取反 // 需要取反
// 如果非app webview并且非小程序webview,直接拦截提示,到小程序操作 // 如果非app webview并且非小程序webview,直接拦截提示,到小程序操作
pointer.$dialog({ pointer.$dialog({
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
import { isApp, isWxMp } from '@/service/validation.service'; import { isApp, isWxMp } from '@/service/validation.service';
import Bridge from '@qg/js-bridge'; import Bridge from '@qg/js-bridge';
import MpBridge from '@/service/mp'; import MpBridge from '@/service/mp';
import localStorage from '@/service/localStorage.service';
export default { export default {
name: 'BottomNav', name: 'BottomNav',
props: { props: {
...@@ -130,6 +131,7 @@ export default { ...@@ -130,6 +131,7 @@ export default {
// todo // todo
return; return;
} }
this.$emit('buy');
} }
} }
}; };
......
...@@ -5,12 +5,28 @@ ...@@ -5,12 +5,28 @@
<countDown :block-no-bg="true" /> <countDown :block-no-bg="true" />
</div> --> </div> -->
<div class="desc-item"> <div class="desc-item">
<p class="desc">还差<span>2人</span>成团,距结束还剩</p> <template v-if="groupInfo.groupBuyStatus == 1">
<countDown :block-no-bg="true" /> <p class="desc">
还差<span>{{ groupInfo.groupBuyNeedNewUserCount }}</span>成团,距结束还剩
</p>
<countDown v-if="!!timestemp" :block-no-bg="true" :end-time="timestemp" />
</template>
<template v-if="groupInfo.groupBuyStatus == 2">
<p class="desc">
恭喜成团,等待发货!
</p>
</template>
<template v-if="groupInfo.groupBuyStatus == 3">
<p class="desc">
哎呀,拼团时间已过,尚未成团!
</p>
</template>
</div> </div>
<div class="gourp-rules"> <div v-if="groupInfo.groupBuyStatus != -1 && groupInfo.groupBuyStatus != 0" class="gourp-rules">
<p>成团条件:还需邀请2名新人</p> <template v-if="groupInfo.groupBuyStatus == 1">
<p>成团条件:{{ groupInfo.groupBuyCondition || '' }}</p>
<cr-image src="@/assets/images/flag.png" width="13px" /> <cr-image src="@/assets/images/flag.png" width="13px" />
</template>
</div> </div>
<div v-if="showButtonGroup" ref="buttonArea" class="button-area"> <div v-if="showButtonGroup" ref="buttonArea" class="button-area">
<cr-button block shape="circle" type="primary">邀请好友</cr-button> <cr-button block shape="circle" type="primary">邀请好友</cr-button>
...@@ -28,6 +44,16 @@ export default { ...@@ -28,6 +44,16 @@ export default {
showButtonGroup: { showButtonGroup: {
type: Boolean, type: Boolean,
default: false default: false
},
timestemp: {
type: Number,
default: 0
},
groupInfo: {
type: Object,
default: () => {
return {};
}
} }
}, },
data() { data() {
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
padding-left: @padding-unit * 3; padding-left: @padding-unit * 3;
box-sizing: border-box; box-sizing: border-box;
&-price{ &-price{
width: 253px; width: 241px;
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
justify-content: center; justify-content: center;
...@@ -155,8 +155,7 @@ ...@@ -155,8 +155,7 @@
} }
// 头像组、团购规则等 // 头像组、团购规则等
&-group-info{ &-group-info{
margin-top: @padding-sm - 4; padding:@padding-sm - 4 @padding-sd @padding-sd;
padding:0 @padding-sd @padding-sd;
background: @white; background: @white;
} }
&-param { &-param {
...@@ -319,6 +318,7 @@ ...@@ -319,6 +318,7 @@
} }
&-num { &-num {
position: relative;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
...@@ -329,7 +329,7 @@ ...@@ -329,7 +329,7 @@
top: 27.5px; top: 27.5px;
.text-14(); .text-14();
color: @red; color: @red;
width: 90px; // width: 90px;
text-align: right; text-align: right;
} }
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
<p class="desc">拼团成功/失败,款项原路返回至账户</p> <p class="desc">拼团成功/失败,款项原路返回至账户</p>
</div> </div>
<div class="goods-group-buy-info-time"> <div class="goods-group-buy-info-time">
<p class="goods-group-buy-info-time-desc">距成团结束</p> <p class="goods-group-buy-info-time-desc">{{ countDownText }}</p>
<count-down :end-time="endTime" /> <count-down v-if="!!timestemp" :end-time="timestemp" />
</div> </div>
</div> </div>
<!-- 商品名称/价格 --> <!-- 商品名称/价格 -->
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<div class="goods-info-name">{{ detailInfo.goodsName }}</div> <div class="goods-info-name">{{ detailInfo.goodsName }}</div>
</div> </div>
<div class="goods-param"> <div v-if="inProgress == 1" class="goods-param">
<!-- 商品已选 --> <!-- 商品已选 -->
<goods-cell title="已选" @click.native="handleParamsClick('sku', '')"> <goods-cell title="已选" @click.native="handleParamsClick('sku', '')">
<span class="goods-param-text"> <span class="goods-param-text">
...@@ -57,15 +57,18 @@ ...@@ -57,15 +57,18 @@
</goods-cell> </goods-cell>
</div> </div>
<div class="goods-group-info"> <div class="goods-group-info">
<avatorGroup /> <!-- {{ detailInfo.groupBuyInfo }} -->
<group-desc-info /> <template v-if="inProgress == 1">
<successInfo /> <avatorGroup :group-info="detailInfo.groupBuyInfo || {}" />
<group-desc-info :group-info="detailInfo.groupBuyInfo || {}" :timestemp="timestemp" />
<successInfo :group-info="detailInfo.groupBuyInfo || {}" />
<cr-divider <cr-divider
hairline hairline
:style="{ :style="{
borderColor: '#ECECEC' borderColor: '#ECECEC'
}" }"
/> />
</template>
<rules /> <rules />
</div> </div>
<span v-if="detailImgList.length" id="goodDetail" class="goods-divider">宝贝详情</span> <span v-if="detailImgList.length" id="goodDetail" class="goods-divider">宝贝详情</span>
...@@ -88,12 +91,12 @@ ...@@ -88,12 +91,12 @@
<div class="popup-title">{{ currentPopupName }}</div> <div class="popup-title">{{ currentPopupName }}</div>
<div v-if="currentPopupType === 'sku'" class="goods-popup"> <div v-if="currentPopupType === 'sku'" class="goods-popup">
<div class="goods-popup-selected"> <div class="goods-popup-selected">
<img :src="detailInfo.imageUrl" /> <img :src="detailInfo.thumbImageUrl" />
<div class="Gp-selected-right"> <div class="Gp-selected-right">
<div class="Gps-right-header"> <div class="Gps-right-header">
<div class="Gpsr-header-price"> <div class="Gpsr-header-price">
<span>¥</span> <span>¥</span>
<span>{{ detailInfo.salePrice }}</span> <span>{{ detailInfo.price }}</span>
</div> </div>
<div v-if="detailInfo.marketPrice" class="Gpsr-header-discount"> <div v-if="detailInfo.marketPrice" class="Gpsr-header-discount">
<span>原价:</span> <span>原价:</span>
...@@ -132,15 +135,15 @@ ...@@ -132,15 +135,15 @@
v-model="selectedGoods.skuNum" v-model="selectedGoods.skuNum"
class="Gp-num-step" class="Gp-num-step"
:min="minCount" :min="minCount"
:max="detailInfo.activityLimitCount || detailInfo.limitCount" :max="detailInfo.limitCount"
disable-input disable-input
/> />
<div v-if="detailInfo.activityLimitCount" class="goods-popup-num-limit"> <div v-if="detailInfo.limitCount" class="goods-popup-num-limit">
仅限购买{{ detailInfo.activityLimitCount }}件 仅限购买{{ detailInfo.limitCount }}件
</div> </div>
</div> </div>
<div class="goods-area-button"> <div class="goods-area-button">
<button class="goods-bottom-buy" @click="toOrder">确认</button> <button class="goods-bottom-buy" @click="goVccOrDetail">确认</button>
</div> </div>
</div> </div>
<div v-if="currentPopupType === 'area'" class="goods-area"> <div v-if="currentPopupType === 'area'" class="goods-area">
...@@ -165,7 +168,7 @@ ...@@ -165,7 +168,7 @@
</div> </div>
</cr-popup> </cr-popup>
<bottom-nav <bottom-nav
v-if="!isPrimordialBrowser && !isWeixinBrowser" v-if="!isPrimordialBrowser && !isWeixinBrowser && inProgress == 1"
type="shoppingCar" type="shoppingCar"
:disabled="false" :disabled="false"
@buy="goVccOrDetail" @buy="goVccOrDetail"
...@@ -186,6 +189,7 @@ import rules from '@/components/rules'; ...@@ -186,6 +189,7 @@ import rules from '@/components/rules';
import groupDescInfo from './components/groupDescInfo'; import groupDescInfo from './components/groupDescInfo';
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import sharePic from '@/components/sharePic'; import sharePic from '@/components/sharePic';
import localStorage from '@/service/localStorage.service';
export default { export default {
// eslint-disable-next-line vue/name-property-casing // eslint-disable-next-line vue/name-property-casing
name: 'goodDetail', name: 'goodDetail',
...@@ -205,8 +209,10 @@ export default { ...@@ -205,8 +209,10 @@ export default {
}, },
data() { data() {
return { return {
endTime: 1631203200000, timestemp: '',
showInfo: false, showInfo: false,
inProgress: false, // 活动是否已经开始
countDownText: '',
// 以下是原有的data // 以下是原有的data
detailParam: { detailParam: {
skuNo: '', skuNo: '',
...@@ -244,8 +250,9 @@ export default { ...@@ -244,8 +250,9 @@ export default {
}) })
}, },
created() { created() {
this.hasLogin = window.localStorage.getItem('vccToken') != 'null' ? true : false; this.hasLogin = localStorage.get('vccToken') != 'null' ? true : false;
this.detailParam = { ...this.$route.query }; this.detailParam = { ...this.$route.query };
localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单
this.name = this.$route.params; this.name = this.$route.params;
this.init(this.detailParam); this.init(this.detailParam);
}, },
...@@ -270,10 +277,35 @@ export default { ...@@ -270,10 +277,35 @@ export default {
} }
this.toOrder(); this.toOrder();
}, },
setStartStatus(data) {
const currentTime = new Date(data.currentTime).getTime();
const activityStartTime = new Date(data.startTime).getTime();
const activityEndTime = new Date(data.endTime).getTime();
if (currentTime <= activityStartTime) {
// 当前时间小于活动开始时间
this.timestemp = activityStartTime;
this.countDownText = '距活动开始时间';
this.inProgress = -1;
return;
}
if (currentTime >= activityEndTime) {
this.timestemp = 0;
this.countDownText = '活动已结束';
this.inProgress = 0;
return;
}
if (currentTime > activityStartTime && currentTime < activityEndTime) {
this.timestemp = activityEndTime;
this.countDownText = '距成团结束';
this.inProgress = 1;
return;
}
},
async init(detailParam) { async init(detailParam) {
const [res] = await goods.detailInfo(detailParam); const [res] = await goods.detailInfo(detailParam);
this.imgList = res.imageUrl || []; this.imgList = res.imageUrl || [];
this.detailInfo = res; this.detailInfo = res;
this.setStartStatus(res);
try { try {
const detailImages = await goods.getDetailPic(this.detailInfo.contentDetailUrl); const detailImages = await goods.getDetailPic(this.detailInfo.contentDetailUrl);
// const imgReg = new RegExp('(?<=src=").[^"]*', 'g'); // const imgReg = new RegExp('(?<=src=").[^"]*', 'g');
...@@ -293,7 +325,7 @@ export default { ...@@ -293,7 +325,7 @@ export default {
} }
this.selectedGoods.skuId = this.detailInfo.skuNo; this.selectedGoods.skuId = this.detailInfo.skuNo;
if (res.stock === 0) { if (res.activitySkuTotalCount === 0) {
this.detailInfo.limitCount = 1; this.detailInfo.limitCount = 1;
this.detailInfo.activityLimitCount = 0; this.detailInfo.activityLimitCount = 0;
this.$dialog({ this.$dialog({
...@@ -355,35 +387,33 @@ export default { ...@@ -355,35 +387,33 @@ export default {
return; return;
} }
this.show = false; this.show = false;
console.log(this.selectedAddress);
const order = { const order = {
activityInfoId: this.detailParam.activityId,
activityTemplateId: this.detailParam.templateId,
activityTemplateDetailId: this.detailParam.templateDetailId,
addrReceiverId: this.selectedAddress.addrReceiverId || '', addrReceiverId: this.selectedAddress.addrReceiverId || '',
selectedSkuList: [ selectedSku: {
{ skuNo: this.selectedGoods.skuId,
skuId: this.selectedGoods.skuId,
skuNum: this.selectedGoods.skuNum, skuNum: this.selectedGoods.skuNum,
skuSource: this.detailInfo.skuSource skuSource: this.detailInfo.skuSource
} }
],
defaultUseCoupon: true,
defaultUseFreightFeeCoupon: true,
defaultUseCashCoupon: true,
defaultUseActivityCoupon: true,
couponActivityUseIdList: []
}; };
window.localStorage.setItem('orderData', JSON.stringify(order)); localStorage.set('orderData', order);
window.localStorage.removeItem('addressList'); localStorage.remove('addressList');
this.$router.push({ name: 'createOrder' }); this.$router.push({ name: 'createOrder' });
}, },
changeAddress(address) { changeAddress(address) {
// 选取规格需要清空,init会重新赋值 // 选取规格需要清空,init会重新赋值
this.specSelected = []; this.specSelected = [];
const detailParam = { ...this.$route.query };
this.detailParam = { this.detailParam = {
count: this.selectedGoods.skuNum, count: this.selectedGoods.skuNum,
skuNo: this.selectedGoods.skuId, skuNo: this.selectedGoods.skuId,
receiverId: address.addrReceiverId receiverId: address.addrReceiverId,
...detailParam
}; };
this.show = false; this.show = false;
console.log(this.detailParam);
this.init(this.detailParam); this.init(this.detailParam);
}, },
// 选择商品规格 // 选择商品规格
......
...@@ -33,11 +33,7 @@ ...@@ -33,11 +33,7 @@
</div> </div>
</div> </div>
<template v-if="orderInfo.calcFeeInfo.totalSkuFee !== '0.00'"> <template v-if="orderInfo.calcFeeInfo.totalSkuFee !== '0.00'">
<FeeInfo <FeeInfo :calc-fee-info="orderInfo.calcFeeInfo" @coupon-show="handleCouponShow" />
:coupon-activity-info-list="orderInfo.couponActivityInfoList"
:calc-fee-info="orderInfo.calcFeeInfo"
@coupon-show="handleCouponShow"
/>
</template> </template>
<!-- 底部 --> <!-- 底部 -->
<bottom-nav <bottom-nav
...@@ -46,16 +42,6 @@ ...@@ -46,16 +42,6 @@
:info="orderInfo.calcFeeInfo" :info="orderInfo.calcFeeInfo"
@buy="handleBuy" @buy="handleBuy"
/> />
<cr-popup v-model="isCoupon" closeable round position="bottom">
<coupon-list
ref="couponList"
:coupon-id="couponId"
:goods-info="orderInfo.shopSkuList"
:coupon-type="couponType"
:coupon-activity-info-list="orderInfo.couponActivityInfoList"
@coupon-select="handleSelectCoupon"
/>
</cr-popup>
</div> </div>
</template> </template>
...@@ -64,7 +50,6 @@ import Bridge from '@qg/js-bridge'; ...@@ -64,7 +50,6 @@ import Bridge from '@qg/js-bridge';
import MpBridge from '@/service/mp'; import MpBridge from '@/service/mp';
import order from '@/api/order.api'; import order from '@/api/order.api';
import bottomNav from '@/components/bottomNav'; import bottomNav from '@/components/bottomNav';
import couponList from '@/components/coupon-list';
// import stepper from '@/components/sample'; // import stepper from '@/components/sample';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
import historyRecordMixins from '@/mixins/historyRecord.mixins'; import historyRecordMixins from '@/mixins/historyRecord.mixins';
...@@ -73,12 +58,12 @@ import { DISCOUNT, FREIGHT, CASH, REDUCTION, HAS_DISCOUNT } from '@/constants/or ...@@ -73,12 +58,12 @@ import { DISCOUNT, FREIGHT, CASH, REDUCTION, HAS_DISCOUNT } from '@/constants/or
import cookies from '@/service/cookieStorage.service'; import cookies from '@/service/cookieStorage.service';
import { isApp, isWxMp } from '@/service/validation.service'; import { isApp, isWxMp } from '@/service/validation.service';
import { mapState } from 'vuex'; import { mapState } from 'vuex';
console.log({ ...mapState });
export default { export default {
name: 'CreateOrder', name: 'CreateOrder',
components: { components: {
bottomNav, bottomNav,
// stepper, // stepper,
couponList,
FeeInfo FeeInfo
}, },
mixins: [historyRecordMixins], mixins: [historyRecordMixins],
...@@ -97,7 +82,6 @@ export default { ...@@ -97,7 +82,6 @@ export default {
selectCoupon: [], selectCoupon: [],
orderInfo: { orderInfo: {
addrReceiverInfo: {}, addrReceiverInfo: {},
couponActivityInfoList: [],
calcFeeInfo: {}, calcFeeInfo: {},
invalidSkuList: [], invalidSkuList: [],
shopSkuList: [] shopSkuList: []
...@@ -171,49 +155,6 @@ export default { ...@@ -171,49 +155,6 @@ export default {
this.couponId = data.couponActivityUseId; this.couponId = data.couponActivityUseId;
this.isCoupon = true; this.isCoupon = true;
}, },
getCouponUserIdList(couponItem) {
const { couponType } = this;
const { couponActivityInfoList } = this.orderInfo;
const { activityId, pickupId, couponCategory } = couponItem || {};
const isActivity = couponType === REDUCTION;
const couponKey = isActivity ? 'activityTemplateDetailId' : 'couponActivityUseId';
const couponId = isActivity ? activityId : pickupId;
let couponList = [];
couponActivityInfoList.forEach(item => {
if (item.couponActivityType != couponCategory) {
couponList.push({
[couponKey]: item.couponActivityUseId,
couponActivityType: item.couponActivityType
});
}
});
if (couponItem) {
couponList.push({
couponActivityUseId: couponId,
couponActivityType: couponType
});
return couponList;
}
return couponList.filter(c => c.couponActivityType !== couponType);
},
handleSelectCoupon([couponItem]) {
this.isCoupon = false;
const { couponType } = this;
this.orderData.couponActivityUseIdList = this.getCouponUserIdList(couponItem);
if (couponType === DISCOUNT) {
this.orderData.defaultUseCoupon = false;
}
if (couponType === FREIGHT) {
this.orderData.defaultUseFreightFeeCoupon = false;
}
if (couponType === CASH) {
this.orderData.defaultUseCashCoupon = false;
}
if (couponType === REDUCTION) {
this.orderData.defaultUseActivityCoupon = false;
}
this.getConfirmOrderInfo();
},
// // ! 需要注意stepper的value是从接口获取的,max会受影响 // // ! 需要注意stepper的value是从接口获取的,max会受影响
// getMaxStockByCanAdd(item) { // getMaxStockByCanAdd(item) {
// const { count, canAdd, activityCanBuyCount } = item; // const { count, canAdd, activityCanBuyCount } = item;
...@@ -329,16 +270,9 @@ export default { ...@@ -329,16 +270,9 @@ export default {
// ] // ]
// }; // };
if (data) { if (data) {
const { const { addrReceiverInfo, calcFeeInfo, invalidSkuList, shopSkuList } = data;
addrReceiverInfo,
couponActivityInfoList,
calcFeeInfo,
invalidSkuList,
shopSkuList
} = data;
const orderInfo = { const orderInfo = {
addrReceiverInfo, addrReceiverInfo,
couponActivityInfoList,
calcFeeInfo, calcFeeInfo,
invalidSkuList, invalidSkuList,
shopSkuList: [] shopSkuList: []
...@@ -371,14 +305,14 @@ export default { ...@@ -371,14 +305,14 @@ export default {
const { const {
addrReceiverInfo: { addrReceiverId: receiverId }, addrReceiverInfo: { addrReceiverId: receiverId },
calcFeeInfo: { totalFreightFee, totalPayFee: totalFee }, calcFeeInfo: { totalFreightFee, totalPayFee: totalFee },
couponActivityInfoList,
shopSkuList shopSkuList
} = this.orderInfo; } = this.orderInfo;
const params = { const params = {
receiverId, receiverId,
totalFreightFee, totalFreightFee,
totalFee, totalFee,
...this.getDiscountIds(couponActivityInfoList), activityId: localStorage.get('activityId'),
activityHundredGroupId: '',
skuList: shopSkuList.map(item => { skuList: shopSkuList.map(item => {
const { skuId: skuNo, count } = item; const { skuId: skuNo, count } = item;
return { skuNo, count }; return { skuNo, count };
...@@ -386,35 +320,8 @@ export default { ...@@ -386,35 +320,8 @@ export default {
}; };
this.orderSubmit(params); this.orderSubmit(params);
}, },
getDiscountIds(list) {
const freightCouponIds = [],
orderCouponIds = [],
activityId = [],
cashCouponIds = [];
list.forEach(c => {
const { couponActivityType, couponActivityUseId } = c;
if (couponActivityType === DISCOUNT) {
orderCouponIds.push(couponActivityUseId);
}
if (couponActivityType === FREIGHT) {
freightCouponIds.push(couponActivityUseId);
this.orderData.defaultUseFreightFeeCoupon = false;
}
if (couponActivityType === CASH) {
cashCouponIds.push(couponActivityUseId);
}
if (couponActivityType === REDUCTION) {
activityId.push(couponActivityUseId);
}
});
return {
freightCouponIds: freightCouponIds.join(''),
orderCouponIds: orderCouponIds.join(''),
activityId: activityId.join(''),
cashCouponIds: cashCouponIds.join('')
};
},
async orderSubmit(params) { async orderSubmit(params) {
console.log(params);
const [data] = await order.orderSubmit(params); const [data] = await order.orderSubmit(params);
if (data && data.orderNo) { if (data && data.orderNo) {
cookies.set('skuID', params.skuList[0].skuNo); cookies.set('skuID', params.skuList[0].skuNo);
...@@ -427,12 +334,13 @@ export default { ...@@ -427,12 +334,13 @@ export default {
newUrl: `/pay?orderNo=${data.orderNo}` newUrl: `/pay?orderNo=${data.orderNo}`
}); });
} else { } else {
this.$dialog({ return; // todo 处理纯h5情况
message: '请在App或小程序中参与活动~', // this.$dialog({
title: '', // message: '请在App或小程序中参与活动~',
showCancelButton: false, // title: '',
confirmButtonText: '我知道了' // showCancelButton: false,
}); // confirmButtonText: '我知道了'
// });
} }
} }
} }
......
...@@ -236,6 +236,10 @@ export default { ...@@ -236,6 +236,10 @@ export default {
methods: { methods: {
/* 查询支付信息 */ /* 查询支付信息 */
async queryPayInfo() { async queryPayInfo() {
console.log({
orderNo: this.orderNo,
isUsedMergePayMethod: false
});
const [data, error] = await queryPayInfo({ const [data, error] = await queryPayInfo({
orderNo: this.orderNo, orderNo: this.orderNo,
isUsedMergePayMethod: false isUsedMergePayMethod: false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment