Commit 9a12f320 authored by Xuguangxing's avatar Xuguangxing

feat: 对接状态

parent f066beaf
...@@ -24,6 +24,7 @@ module.exports = { ...@@ -24,6 +24,7 @@ module.exports = {
'no-empty': ["error", { "allowEmptyCatch": true }], 'no-empty': ["error", { "allowEmptyCatch": true }],
'vue/no-v-html': 'off', 'vue/no-v-html': 'off',
'vue/require-default-prop': 'off', 'vue/require-default-prop': 'off',
'no-useless-escape': 'off',
'arrow-parens': 'off', // allow paren-less arrow functions 'arrow-parens': 'off', // allow paren-less arrow functions
'generator-star-spacing': 'off', // allow async-await 'generator-star-spacing': 'off', // allow async-await
'no-unused-vars': 'error', // disabled no ununsed var 'no-unused-vars': 'error', // disabled no ununsed var
......
...@@ -42,6 +42,7 @@ export default { ...@@ -42,6 +42,7 @@ export default {
}, },
orderSubmit(data) { orderSubmit(data) {
console.log(encryption(data), JSON.stringify(encryption(data)));
return http.post(`${talosHost}/api/kdsp/order-info/e/hundredGroupSubmit`, encryption(data)); return http.post(`${talosHost}/api/kdsp/order-info/e/hundredGroupSubmit`, encryption(data));
}, },
// 物流公司列表 // 物流公司列表
......
...@@ -28,7 +28,12 @@ ...@@ -28,7 +28,12 @@
<cr-image width="25px" src="@/assets/images/new-user.png" /> <cr-image width="25px" src="@/assets/images/new-user.png" />
</div> </div>
</div> </div>
<div v-for="n in placeholderNum" :key="n" class="placeholder" :style="widthStyle"> <div
v-for="n in placeholderNum"
:key="`placeholder-${n}`"
class="placeholder"
:style="widthStyle"
>
<div class="content">?</div> <div class="content">?</div>
</div> </div>
<div v-if="groupHC >= 10" class="more" :style="widthStyle" @click="showMoreAvator"> <div v-if="groupHC >= 10" class="more" :style="widthStyle" @click="showMoreAvator">
......
<template> <template>
<div class="success-info"> <div class="success-info">
<p class="desc"> <p class="desc">
已有<span>{{ groupInfo.groupBuySuccessCount || 0 }}</span>拼团成功 已有<span>{{ groupInfo.groupBuySuccessPersonCount || 0 }}</span>拼团成功
</p> </p>
<avator-swiper :avator-data="avatorData" /> <avator-swiper :avator-data="avatorData" />
</div> </div>
......
...@@ -15,6 +15,7 @@ export default { ...@@ -15,6 +15,7 @@ export default {
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
// 所有自定义路由字段在此处理 // 所有自定义路由字段在此处理
const { meta } = to; const { meta } = to;
isWechat && localStorage.set('vccChannel', '159913');
meta?.has?.header && store.commit('CHANGE_HEADER', meta.has.header); // 改变header meta?.has?.header && store.commit('CHANGE_HEADER', meta.has.header); // 改变header
localStorageParams.forEach(item => { localStorageParams.forEach(item => {
to.query[item] && localStorage.set(item, to.query[item]); to.query[item] && localStorage.set(item, to.query[item]);
......
<template> <template>
<div class="goods-bottom"> <div class="goods-bottom">
<template v-if="status == 1"> <template v-if="groupId">
<cr-button <cr-button
class="mutiplie" class="mutiplie"
plain plain
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
立即参团 立即参团
</cr-button> </cr-button>
</template> </template>
<template v-if="status == 2"> <template v-else>
<cr-button shape="circle" :disabled="disabled" type="primary" block @click="createGroup"> <cr-button shape="circle" :disabled="disabled" type="primary" block @click="createGroup">
立即开团 立即开团
</cr-button> </cr-button>
...@@ -29,13 +29,15 @@ ...@@ -29,13 +29,15 @@
</div> </div>
</template> </template>
<script> <script>
import { isApp, isWxMp } from '@/service/validation.service'; import goodsCheckMixin from '@/mixins/goodsCheck.mixin';
import Bridge from '@qg/js-bridge';
import MpBridge from '@/service/mp';
import localStorage from '@/service/localStorage.service';
export default { export default {
name: 'BottomNav', name: 'BottomNav',
mixins: [goodsCheckMixin],
props: { props: {
groupId: {
type: String,
default: ''
},
type: { type: {
type: String, type: String,
default: 'shopCar' // shoppingCar 购物车;settlement 结算;submitOrder 确认订单 default: 'shopCar' // shoppingCar 购物车;settlement 结算;submitOrder 确认订单
...@@ -69,54 +71,6 @@ export default { ...@@ -69,54 +71,6 @@ export default {
}; };
}, },
methods: { methods: {
getToken() {
const that = this;
window.xyqbNativeEvent = function(res) {
const json = typeof res === 'string' ? JSON.parse(res) : res;
if (json.event === 'getTokenSuccess') {
const appData = json.data || {};
if (appData && appData.token) {
localStorage.get('vccToken', appData.token);
that.$nextTick(() => {
window.location.reload();
});
}
}
};
this.nativeBridge.getToken();
},
checkLogin() {
const vccToken = localStorage.get('vccToken');
const needLogin = vccToken ? false : true;
if (needLogin) {
if (isApp) this.nativeBridge = new Bridge();
else if (isWxMp) this.nativeBridge = new MpBridge();
this.$dialog({
message: '参与拼团活动需要您先进行登录哦~',
title: '',
showCancelButton: false,
confirmButtonText: '登录',
onConfirm: () => {
if (isWxMp) {
this.nativeBridge.openNewUrl({
newUrl: `/pages/user/login`
});
} else if (isApp) {
// native调用getToken
this.getToken();
} else {
this.$dialog({
message: '请在App或小程序中参与活动~',
title: '',
showCancelButton: false,
confirmButtonText: '我知道了'
});
}
}
});
}
return needLogin;
},
joinGroup() { joinGroup() {
// 参团 // 参团
if (this.checkLogin()) { if (this.checkLogin()) {
......
<template> <template>
<div class="group-info-desc"> <div class="group-info-desc">
<!-- <div class="desc-item">
<p class="desc">发起拼团,距结束还剩</p>
<countDown :block-no-bg="true" />
</div> -->
<div class="desc-item"> <div class="desc-item">
<template v-if="groupInfo.groupBuyStatus == 1"> <template v-if="groupInfo.groupBuyStatus == 1">
<p class="desc"> <p class="desc">
还差<span>{{ groupInfo.groupBuyNeedNewUserCount }}</span>成团,距结束还剩 还差<span>{{ groupInfo.groupBuyNeedUserCount }}</span>成团,距结束还剩
</p> </p>
<countDown v-if="!!timestemp" :block-no-bg="true" :end-time="timestemp" /> <countDown v-if="!!timestemp" :block-no-bg="true" :end-time="timestemp" />
</template> </template>
<template v-if="groupInfo.groupBuyStatus == 2"> <template v-else>
<p class="desc"> <p class="desc">
恭喜成团,等待发货! {{ statusTextMap[groupInfo.groupBuyStatus] }}
</p>
</template>
<template v-if="groupInfo.groupBuyStatus == 3">
<p class="desc">
哎呀,拼团时间已过,尚未成团!
</p> </p>
</template> </template>
</div> </div>
<div v-if="groupInfo.groupBuyStatus != -1 && groupInfo.groupBuyStatus != 0" class="gourp-rules"> <div v-if="groupInfo.groupBuyStatus == 1" class="gourp-rules">
<template v-if="groupInfo.groupBuyStatus == 1"> <p>成团条件:{{ groupInfo.groupBuyCondition || '' }}</p>
<p>成团条件:{{ groupInfo.groupBuyCondition || '' }}</p> <cr-image src="@/assets/images/flag.png" width="13px" />
<cr-image src="@/assets/images/flag.png" width="13px" /> <!-- </template> -->
</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 v-if="groupInfo.groupBuyStatus == 1" block shape="circle" type="primary"
<cr-button plain block shape="circle" type="primary">查看其他商品</cr-button> >邀请好友</cr-button
>
<cr-button v-else plain block shape="circle" type="primary" @click="toList"
>查看其他商品</cr-button
>
</div> </div>
</div> </div>
</template> </template>
...@@ -58,7 +52,12 @@ export default { ...@@ -58,7 +52,12 @@ export default {
}, },
data() { data() {
return { return {
observer: null observer: null,
statusTextMap: {
2: '恭喜成团,等待发货!',
3: '哎呀,拼团时间已过,尚未成团!',
4: '已发货'
}
}; };
}, },
mounted() { mounted() {
...@@ -82,6 +81,15 @@ export default { ...@@ -82,6 +81,15 @@ export default {
if (this.$refs.buttonArea) { if (this.$refs.buttonArea) {
this.observer.unobserve(this.$refs.buttonArea); this.observer.unobserve(this.$refs.buttonArea);
} }
},
methods: {
toList() {
console.log(this.$route);
const { activityId } = this.$route.query || '';
if (activityId) {
this.$router.push({ name: 'groupBuyList', query: { activityId } });
}
}
} }
}; };
</script> </script>
......
...@@ -131,11 +131,15 @@ ...@@ -131,11 +131,15 @@
.group-price { .group-price {
// font-family: "din"; // font-family: "din";
margin-right: @padding-xs; margin-right: @padding-xs;
font-size: 30px; // font-size: 30px;
font-size: 24px;
// &.scaleFont{
// font-size: 24px;
// }
} }
.sale-price{ .sale-price{
// font-family: "din"; // font-family: "din";
.text-16(); .text-14();
} }
} }
} }
......
<template> <template>
<div class="goods" style="height: 100%"> <div v-if="showPage" class="goods" style="height: 100%">
<!-- 主体 --> <!-- 主体 -->
<div class="goods-container"> <div class="goods-container">
<!-- 轮播图 --> <!-- 轮播图 -->
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<p class="price"> <p class="price">
成团价¥<span class="group-price">{{ detailInfo.activityPrice }}</span 成团价¥<span class="group-price">{{ detailInfo.activityPrice }}</span
>售价¥<span class="sale-price">{{ detailInfo.price }}</span> >售价¥<span class="sale-price">{{ detailInfo.price }}</span>
<!-- :class="{ scaleFont: parseInt(detailInfo.activityPrice) < 10000 }" -->
</p> </p>
<p class="desc">拼团成功/失败,款项原路返回至账户</p> <p class="desc">拼团成功/失败,款项原路返回至账户</p>
</div> </div>
...@@ -174,6 +175,7 @@ ...@@ -174,6 +175,7 @@
v-if="!isPrimordialBrowser && !isWeixinBrowser && inProgress == 1" v-if="!isPrimordialBrowser && !isWeixinBrowser && inProgress == 1"
type="shoppingCar" type="shoppingCar"
:disabled="false" :disabled="false"
:group-id="groupId"
@buy="goVccOrDetail" @buy="goVccOrDetail"
/> />
<sharePic ref="sharePic" /> <sharePic ref="sharePic" />
...@@ -193,6 +195,7 @@ import groupDescInfo from './components/groupDescInfo'; ...@@ -193,6 +195,7 @@ 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'; import localStorage from '@/service/localStorage.service';
import goodsCheckMixin from '@/mixins/goodsCheck.mixin';
export default { export default {
// eslint-disable-next-line vue/name-property-casing // eslint-disable-next-line vue/name-property-casing
name: 'goodDetail', name: 'goodDetail',
...@@ -210,6 +213,7 @@ export default { ...@@ -210,6 +213,7 @@ export default {
filters: { filters: {
Img2Thumb Img2Thumb
}, },
mixins: [goodsCheckMixin],
data() { data() {
return { return {
timestemp: '', // 大活动结束时间 timestemp: '', // 大活动结束时间
...@@ -217,6 +221,8 @@ export default { ...@@ -217,6 +221,8 @@ export default {
showInfo: false, showInfo: false,
inProgress: false, // 活动是否已经开始 inProgress: false, // 活动是否已经开始
countDownText: '', countDownText: '',
showPage: false, // 是否显示页面,当查询完团与人的关系后进行处理,如果用户已经参与了此商品此活动的团,navigateto small else showpage = true
groupId: '', // 团id
// 以下是原有的data // 以下是原有的data
detailParam: { detailParam: {
skuNo: '', skuNo: '',
...@@ -257,6 +263,10 @@ export default { ...@@ -257,6 +263,10 @@ export default {
this.hasLogin = localStorage.get('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,用于下单 localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单
if (this.detailParam.groupBuyGroupId) {
localStorage.set('groupBuyGroupId', this.detailParam.groupBuyGroupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = this.detailParam.groupBuyGroupId || '';
}
this.name = this.$route.params; this.name = this.$route.params;
this.init(this.detailParam); this.init(this.detailParam);
}, },
...@@ -276,18 +286,19 @@ export default { ...@@ -276,18 +286,19 @@ export default {
// ka渠道逻辑 // ka渠道逻辑
goVccOrDetail() { goVccOrDetail() {
if (!this.hasLogin) { if (!this.hasLogin) {
this.$router.push({ name: 'login' }); this.checkLogin();
return; return;
} }
this.toOrder(); this.toOrder();
}, },
setStartStatus(data) { setStartStatus(data) {
const currentTime = new Date(data.currentTime).getTime(); const currentTime = new Date(data.currentTime.replace(/\-/g, '/')).getTime();
const activityStartTime = new Date(data.startTime).getTime(); const activityStartTime = new Date(data.startTime.replace(/\-/g, '/')).getTime();
const activityEndTime = new Date(data.endTime).getTime(); const activityEndTime = new Date(data.endTime.replace(/\-/g, '/')).getTime();
this.groupTimestemp = data.currentGroupEndTime this.groupTimestemp = data.groupBuyInfo.currentGroupEndTime
? new Date(data.currentGroupEndTime).getTime() ? new Date(data.groupBuyInfo.currentGroupEndTime).getTime()
: -1; : -1;
console.log(currentTime, activityStartTime, activityEndTime);
if (currentTime <= activityStartTime) { if (currentTime <= activityStartTime) {
// 当前时间小于活动开始时间 // 当前时间小于活动开始时间
this.timestemp = activityStartTime; this.timestemp = activityStartTime;
...@@ -310,6 +321,14 @@ export default { ...@@ -310,6 +321,14 @@ export default {
}, },
async init(detailParam) { async init(detailParam) {
const [res] = await goods.detailInfo(detailParam); const [res] = await goods.detailInfo(detailParam);
if (res.groupBuyInfo.groupId) {
localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = res.groupBuyInfo.groupId || '';
}
if (res.groupBuyInfo?.joinGroup) {
const query = { ...this.$route.query };
return this.$router.replace({ name: 'groupBuySkuInfoSmallPic', query });
}
this.imgList = res.imageUrl || []; this.imgList = res.imageUrl || [];
this.detailInfo = res; this.detailInfo = res;
this.setStartStatus(res); this.setStartStatus(res);
...@@ -327,6 +346,7 @@ export default { ...@@ -327,6 +346,7 @@ export default {
srcArr.push(src); srcArr.push(src);
} }
this.detailImgList = srcArr; this.detailImgList = srcArr;
this.showPage = true;
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
......
<template> <template>
<div class="goods" style="height: 100%"> <div v-if="Object.keys(detailInfo).length > 0" class="goods" style="height: 100%">
<!-- 主体 --> <!-- 主体 -->
<div class="goods-container"> <div class="goods-container">
<div class="goods-red-bg" /> <div class="goods-red-bg" />
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div class="goods-product-info"> <div class="goods-product-info">
<div class="goods-product-info-img"> <div class="goods-product-info-img">
<span class="goods-product-info-tag">3人团</span> <span class="goods-product-info-tag">3人团</span>
<cr-image width="108px" :src="imgList[0]" /> <cr-image width="108px" :src="detailInfo.thumbImageUrl" />
</div> </div>
<div class="goods-product-info-desc"> <div class="goods-product-info-desc">
<div class="goods-product-info-desc-part1"> <div class="goods-product-info-desc-part1">
...@@ -29,7 +29,9 @@ ...@@ -29,7 +29,9 @@
:percentage="50" :percentage="50"
/> />
</div> </div>
<div class="goods-product-info-desc-num">已拼3999团</div> <div class="goods-product-info-desc-num">
已拼{{ detailInfo.groupBuyInfo ? detailInfo.groupBuyInfo.groupBuySuccessCount : 0 }}
</div>
</div> </div>
<div class="goods-product-info-desc-price"> <div class="goods-product-info-desc-price">
<div class="goods-product-info-desc-price-group"> <div class="goods-product-info-desc-price-group">
...@@ -41,13 +43,24 @@ ...@@ -41,13 +43,24 @@
</div> </div>
<div class="goods-group-info"> <div class="goods-group-info">
<div class="goods-group-info-status"> <div class="goods-group-info-status">
<cr-image width="80" src="../../assets/images/success.png" /> <cr-image
v-if="detailInfo.groupBuyInfo.groupBuyStatus == 2"
width="80"
src="../../assets/images/success.png"
/>
<cr-image
v-if="detailInfo.groupBuyInfo.groupBuyStatus == 3"
width="80"
src="../../assets/images/defeat.png"
/>
</div> </div>
<template v-if="inProgress == 1"> <template v-if="inProgress == 1">
<avatorGroup :group-info="detailInfo.groupBuyInfo || {}" /> <avatorGroup :group-info="detailInfo.groupBuyInfo || {}" />
<group-desc-info <group-desc-info
:group-info="detailInfo.groupBuyInfo || {}" :group-info="detailInfo.groupBuyInfo || {}"
:timestemp="groupTimestemp" :timestemp="groupTimestemp"
:show-button-group="showShareButton"
@changeButtonVisible="changeButtonVisible"
/> />
<successInfo :group-info="detailInfo.groupBuyInfo || {}" /> <successInfo :group-info="detailInfo.groupBuyInfo || {}" />
<cr-divider <cr-divider
...@@ -83,6 +96,7 @@ import avatorGroup from '@/components/avatorGroup'; ...@@ -83,6 +96,7 @@ import avatorGroup from '@/components/avatorGroup';
import successInfo from '@/components/groupBuySuccessInfo'; import successInfo from '@/components/groupBuySuccessInfo';
import rules from '@/components/rules'; import rules from '@/components/rules';
import groupDescInfo from './components/groupDescInfo'; import groupDescInfo from './components/groupDescInfo';
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',
...@@ -101,6 +115,7 @@ export default { ...@@ -101,6 +115,7 @@ export default {
showInfo: false, showInfo: false,
inProgress: false, // 活动是否已经开始 inProgress: false, // 活动是否已经开始
countDownText: '', countDownText: '',
showShareButton: false, // 是否显示分享按钮
// 以下是原有的data // 以下是原有的data
detailParam: { detailParam: {
skuNo: '', skuNo: '',
...@@ -118,6 +133,10 @@ export default { ...@@ -118,6 +133,10 @@ export default {
created() { created() {
this.hasLogin = window.localStorage.getItem('vccToken') != 'null' ? true : false; this.hasLogin = window.localStorage.getItem('vccToken') != 'null' ? true : false;
this.detailParam = { ...this.$route.query }; this.detailParam = { ...this.$route.query };
localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单
if (this.detailParam.groupBuyGroupId) {
localStorage.set('groupBuyGroupId', this.detailParam.groupBuyGroupId || ''); // 设置groupBuyGroupId,用于下单
}
this.name = this.$route.params; this.name = this.$route.params;
this.imgList = [this.name.goodsimg]; this.imgList = [this.name.goodsimg];
this.init(this.detailParam); this.init(this.detailParam);
...@@ -144,6 +163,10 @@ export default { ...@@ -144,6 +163,10 @@ export default {
}, },
async init(detailParam) { async init(detailParam) {
const [res] = await goods.detailInfo(detailParam); const [res] = await goods.detailInfo(detailParam);
if (res.groupBuyInfo.groupId) {
localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
}
this.showShareButton = res.groupBuyInfo.groupBuyStatus == 1 ? true : false;
this.imgList = res.imageUrl || []; this.imgList = res.imageUrl || [];
this.detailInfo = res; this.detailInfo = res;
this.setStartStatus(res); this.setStartStatus(res);
...@@ -169,8 +192,8 @@ export default { ...@@ -169,8 +192,8 @@ export default {
const currentTime = new Date(data.currentTime).getTime(); const currentTime = new Date(data.currentTime).getTime();
const activityStartTime = new Date(data.startTime).getTime(); const activityStartTime = new Date(data.startTime).getTime();
const activityEndTime = new Date(data.endTime).getTime(); const activityEndTime = new Date(data.endTime).getTime();
this.groupTimestemp = data.currentGroupEndTime this.groupTimestemp = data.groupBuyInfo.currentGroupEndTime
? new Date(data.currentGroupEndTime).getTime() ? new Date(data.groupBuyInfo.currentGroupEndTime).getTime()
: -1; : -1;
if (currentTime <= activityStartTime) { if (currentTime <= activityStartTime) {
// 当前时间小于活动开始时间 // 当前时间小于活动开始时间
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</div> </div>
</div> </div>
<template v-if="orderInfo.calcFeeInfo.totalSkuFee !== '0.00'"> <template v-if="orderInfo.calcFeeInfo.totalSkuFee !== '0.00'">
<FeeInfo :calc-fee-info="orderInfo.calcFeeInfo" @coupon-show="handleCouponShow" /> <FeeInfo :calc-fee-info="orderInfo.calcFeeInfo" />
</template> </template>
<!-- 底部 --> <!-- 底部 -->
<bottom-nav <bottom-nav
...@@ -54,11 +54,10 @@ import bottomNav from '@/components/bottomNav'; ...@@ -54,11 +54,10 @@ import bottomNav from '@/components/bottomNav';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
import historyRecordMixins from '@/mixins/historyRecord.mixins'; import historyRecordMixins from '@/mixins/historyRecord.mixins';
import FeeInfo from './components/feeInfo.vue'; import FeeInfo from './components/feeInfo.vue';
import { DISCOUNT, FREIGHT, CASH, REDUCTION, HAS_DISCOUNT } from '@/constants/order'; import { HAS_DISCOUNT } from '@/constants/order';
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: {
...@@ -74,11 +73,8 @@ export default { ...@@ -74,11 +73,8 @@ export default {
query: {}, query: {},
prevCanAdd: true, prevCanAdd: true,
isOutBuy: false, isOutBuy: false,
couponType: 1,
isCoupon: false,
orderData: {}, orderData: {},
hasDiscount: HAS_DISCOUNT, hasDiscount: HAS_DISCOUNT,
couponId: 0,
selectCoupon: [], selectCoupon: [],
orderInfo: { orderInfo: {
addrReceiverInfo: {}, addrReceiverInfo: {},
...@@ -89,7 +85,10 @@ export default { ...@@ -89,7 +85,10 @@ export default {
}; };
}, },
computed: { computed: {
...mapState ...mapState({
isPrimordialBrowser: state => state.pay.isPrimordialBrowser,
isWeixinBrowser: state => state.pay.isWeixinBrowser
})
}, },
mounted() { mounted() {
this.init(); this.init();
...@@ -141,134 +140,12 @@ export default { ...@@ -141,134 +140,12 @@ export default {
this.$set(this.orderData, 'addrReceiverId', e.addrReceiverId || ''); this.$set(this.orderData, 'addrReceiverId', e.addrReceiverId || '');
this.getConfirmOrderInfo(); this.getConfirmOrderInfo();
}, },
handleCouponShow(data) {
const { couponActivityType, hasCouponActivity } = data || {};
this.couponType = couponActivityType;
const isCouponType =
couponActivityType == DISCOUNT ||
couponActivityType == REDUCTION ||
(couponActivityType == FREIGHT && this.orderInfo.calcFeeInfo.totalFreightFee != '0.00') ||
couponActivityType == CASH;
if (!isCouponType || !this.isAvailableFn(hasCouponActivity)) {
return;
}
this.couponId = data.couponActivityUseId;
this.isCoupon = true;
},
// // ! 需要注意stepper的value是从接口获取的,max会受影响
// getMaxStockByCanAdd(item) {
// const { count, canAdd, activityCanBuyCount } = item;
// if (activityCanBuyCount) {
// this.isOutBuy = count >= activityCanBuyCount;
// return activityCanBuyCount;
// }
// let finalCount = canAdd ? count + 1 : count;
// if (this.prevCanAdd != item.canAdd) finalCount = count;
// this.prevCanAdd = item.canAdd;
// return finalCount;
// },
// // stepper变化处理
// handleCountChange(e) {
// const { count, activityCanBuyCount } = this.orderInfo.shopSkuList[e.index];
// let skuNum = count;
// skuNum = e.type === 'add' ? skuNum + 1 : skuNum - 1;
// if (skuNum < 1) return;
// if (skuNum > activityCanBuyCount) {
// skuNum--;
// return;
// }
// this.$set(this.orderData.selectedSkuList[e.index], 'skuNum', skuNum);
// localStorage.set('orderData', this.orderData);
// this.getConfirmOrderInfo();
// },
isAvailableFn(type) { isAvailableFn(type) {
return type === this.hasDiscount; return type === this.hasDiscount;
}, },
// 获取确认订单信息 // 获取确认订单信息
async getConfirmOrderInfo() { async getConfirmOrderInfo() {
const [data] = await order.confirmOrder(this.orderData); const [data] = await order.confirmOrder(this.orderData);
// const data = {
// addrReceiverInfo: {
// addrReceiverId: 682,
// receiverName: 'ndjnn',
// addrFullName: '北京,石景山区,八角街道,nsnn',
// receiverPhoneNo: '18511117191'
// },
// invalidSkuList: [
// {
// skuName: '[自营]Apple AirPods Pro 主动降噪无线蓝牙耳机 适用iPhone/iPad/Apple Watch',
// tagList: [],
// skuImg:
// 'http://img30.360buyimg.com/sku/jfs/t1/59411/33/15646/64951/5dd50baaE81702116/413160a74742f504.jpg',
// marketPrice: '1760.66',
// skuSource: 1,
// invalidStatus: 0,
// salePrice: '1599',
// count: 1,
// canAdd: true,
// invalidStatusDesc: '该地址暂无库存',
// skuId: 3732897275393,
// jumpUrl: 'xyqb://homepage/goodsdetail?skuNo=3732897275393'
// }
// ],
// shopSkuList: [
// {
// freightFee: '12.00运费',
// shopInfo: {
// shopId: 12,
// shopName: '店铺名称',
// shopImg: 'https://'
// },
// skuList: [
// {
// marketPrice: '35.60',
// invalidStatus: 0,
// salePrice: '34.4',
// count: 1,
// canAdd: true,
// invalidStatusDesc: '宝贝已失效,不能购买',
// jumpUrl: 'xyqb://homepage/goodsdetail?skuNo=7331961',
// skuName:
// '[别下单-开普勒]美加净 MAXAM 细嫩柔白隔离防晒乳100mlSPF30 PA+++ (面部身体户外鲜果防晒霜男女)',
// tagList: [],
// skuImg:
// 'http://img11.360buyimg.com/n1/jfs/t21367/129/509809607/84163/17b4ed2e/5b0f8bdfNba3c4b43.jpg',
// skuSource: 2,
// skuAttr: '【防晒】细嫩柔白100ml',
// skuId: 7331961,
// goodsTypeImage: 'https://kdspstatic.q-gp.com/kdsp/goods/icon/best-selected3x.png'
// }
// ]
// }
// ],
// calcFeeInfo: {
// couponFee: '0.00',
// totalFreightFee: '10.00',
// totalPayFee: '10.00',
// couponFreightFee: '0.00',
// totalSkuFee: '10.00'
// },
// hasNext: false,
// couponActivityInfoList: [
// {
// hasCouponActivity: 1,
// couponActivityType: 4
// },
// {
// hasCouponActivity: 1,
// couponActivityType: 3
// },
// {
// hasCouponActivity: 1,
// couponActivityType: 2
// },
// {
// hasCouponActivity: 1,
// couponActivityType: 1
// }
// ]
// };
if (data) { if (data) {
const { addrReceiverInfo, calcFeeInfo, invalidSkuList, shopSkuList } = data; const { addrReceiverInfo, calcFeeInfo, invalidSkuList, shopSkuList } = data;
const orderInfo = { const orderInfo = {
...@@ -311,8 +188,8 @@ export default { ...@@ -311,8 +188,8 @@ export default {
receiverId, receiverId,
totalFreightFee, totalFreightFee,
totalFee, totalFee,
activityId: localStorage.get('activityId'), activityId: localStorage.get('activityId') || '',
activityHundredGroupId: '', activityHundredGroupId: localStorage.get('groupBuyGroupId') || '',
skuList: shopSkuList.map(item => { skuList: shopSkuList.map(item => {
const { skuId: skuNo, count } = item; const { skuId: skuNo, count } = item;
return { skuNo, count }; return { skuNo, count };
......
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