reactor:consts 挪到 helper 目录下
parent
997404dfb4
commit
dfe4a33e2d
|
@ -208,7 +208,7 @@
|
|||
import { isEmpty } from 'lodash-es';
|
||||
import CombinationApi from '@/sheep/api/promotion/combination';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { SharePageEnum } from '@/sheep/util/const';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
|
|
|
@ -151,7 +151,7 @@
|
|||
import { useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import SeckillApi from '@/sheep/api/promotion/seckill';
|
||||
import dayjs from 'dayjs';
|
||||
import { TimeStatusEnum } from '@/sheep/util/const';
|
||||
import { TimeStatusEnum } from '@/sheep/helper/const';
|
||||
|
||||
// 计算页面高度
|
||||
const { safeAreaInsets, safeArea } = sheep.$platform.device;
|
||||
|
|
|
@ -1,48 +1,57 @@
|
|||
<!-- 分销中心 -->
|
||||
<template>
|
||||
<s-layout navbar="inner" class="index-wrap" title="分销中心" :bgStyle="bgStyle" :onShareAppMessage="shareInfo">
|
||||
<!-- 分销商信息 -->
|
||||
<commission-info />
|
||||
<!-- 账户信息 -->
|
||||
<account-info />
|
||||
<!-- 菜单栏 -->
|
||||
<commission-menu />
|
||||
<!-- 分销记录 -->
|
||||
<commission-log />
|
||||
<s-layout
|
||||
navbar="inner"
|
||||
class="index-wrap"
|
||||
title="分销中心"
|
||||
:bgStyle="bgStyle"
|
||||
:onShareAppMessage="shareInfo"
|
||||
>
|
||||
<!-- 分销商信息 -->
|
||||
<commission-info />
|
||||
<!-- 账户信息 -->
|
||||
<account-info />
|
||||
<!-- 菜单栏 -->
|
||||
<commission-menu />
|
||||
<!-- 分销记录 -->
|
||||
<commission-log />
|
||||
|
||||
<!-- 权限弹窗 -->
|
||||
<commission-auth />
|
||||
</s-layout>
|
||||
<!-- 权限弹窗 -->
|
||||
<commission-auth />
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import commissionInfo from './components/commission-info.vue';
|
||||
import accountInfo from './components/account-info.vue';
|
||||
import commissionLog from './components/commission-log.vue';
|
||||
import commissionMenu from './components/commission-menu.vue';
|
||||
import commissionAuth from './components/commission-auth.vue';
|
||||
import commissionInfo from './components/commission-info.vue';
|
||||
import accountInfo from './components/account-info.vue';
|
||||
import commissionLog from './components/commission-log.vue';
|
||||
import commissionMenu from './components/commission-menu.vue';
|
||||
import commissionAuth from './components/commission-auth.vue';
|
||||
import sheep from '@/sheep';
|
||||
import { SharePageEnum } from '@/sheep/util/const';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
/** 分销邀请 */
|
||||
const shareInfo = computed(() => {
|
||||
return sheep.$platform.share.getShareInfo({
|
||||
params: {
|
||||
page: SharePageEnum.HOME.value, // 用户通邀请进入到首页
|
||||
return sheep.$platform.share.getShareInfo(
|
||||
{
|
||||
params: {
|
||||
page: SharePageEnum.HOME.value, // 用户通邀请进入到首页
|
||||
},
|
||||
},
|
||||
}, {
|
||||
type: 'user',
|
||||
});
|
||||
{
|
||||
type: 'user',
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const bgStyle = {
|
||||
color: '#F7D598',
|
||||
};
|
||||
const bgStyle = {
|
||||
color: '#F7D598',
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.page-main) {
|
||||
background-size: 100% 100% !important;
|
||||
}
|
||||
:deep(.page-main) {
|
||||
background-size: 100% 100% !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
import { useDurationTime, formatGoodsSwiper, fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import CombinationApi from '@/sheep/api/promotion/combination';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { SharePageEnum } from '@/sheep/util/const';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/goods/groupon-bg.png');
|
||||
const btnBg = sheep.$url.css('/static/img/shop/goods/groupon-btn.png');
|
||||
|
|
|
@ -85,7 +85,10 @@
|
|||
<view class="price-text ss-m-r-16">
|
||||
{{ fen2yuan(state.selectedSku.price || state.goodsInfo.price) }}
|
||||
</view>
|
||||
<view class="origin-price-text" v-if="state.goodsInfo.marketPrice > state.goodsInfo.price">
|
||||
<view
|
||||
class="origin-price-text"
|
||||
v-if="state.goodsInfo.marketPrice > state.goodsInfo.price"
|
||||
>
|
||||
{{ fen2yuan(state.selectedSku.marketPrice || state.goodsInfo.marketPrice) }}
|
||||
</view>
|
||||
</view>
|
||||
|
@ -205,7 +208,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, computed, ref, toRaw } from 'vue';
|
||||
import { reactive, computed } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||
|
@ -233,8 +236,7 @@
|
|||
onPageScroll(() => {});
|
||||
import countDown from '@/sheep/components/countDown/index.vue';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import activity from '@/sheep/api/promotion/activity';
|
||||
import { SharePageEnum } from '@/sheep/util/const';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
const bgColor = {
|
||||
bgColor: '#E93323',
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
import detailCommentCard from './components/detail/detail-comment-card.vue';
|
||||
import detailContentCard from './components/detail/detail-content-card.vue';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { PromotionActivityTypeEnum, SharePageEnum } from '@/sheep/util/const';
|
||||
import { PromotionActivityTypeEnum, SharePageEnum } from '@/sheep/helper/const';
|
||||
import PointApi from '@/sheep/api/promotion/point';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/goods/score-bg.png');
|
||||
|
|
|
@ -151,7 +151,7 @@
|
|||
import detailProgress from './components/detail/detail-progress.vue';
|
||||
import SeckillApi from '@/sheep/api/promotion/seckill';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { getTimeStatusEnum, SharePageEnum, TimeStatusEnum } from '@/sheep/util/const';
|
||||
import { getTimeStatusEnum, SharePageEnum, TimeStatusEnum } from '@/sheep/helper/const';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/goods/seckill-bg.png');
|
||||
const btnBg = sheep.$url.css('/static/img/shop/goods/seckill-btn.png');
|
||||
|
|
|
@ -125,7 +125,6 @@
|
|||
import TradeConfigApi from '@/sheep/api/trade/config';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||
import { WxaSubscribeTemplate } from '@/sheep/util/const';
|
||||
|
||||
const form = ref(null);
|
||||
const state = reactive({
|
||||
|
|
|
@ -228,7 +228,7 @@
|
|||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import TradeConfigApi from '@/sheep/api/trade/config';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { DeliveryTypeEnum } from '@/sheep/util/const';
|
||||
import { DeliveryTypeEnum } from '@/sheep/helper/const';
|
||||
|
||||
const state = reactive({
|
||||
orderPayload: {},
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
<!-- 充值界面 -->
|
||||
<template>
|
||||
<s-layout title="充值" class="withdraw-wrap" navbar="inner">
|
||||
<view class="wallet-num-box ss-flex ss-col-center ss-row-between" :style="[
|
||||
{
|
||||
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
|
||||
paddingTop: Number(statusBarHeight + 108) + 'rpx',
|
||||
},
|
||||
]">
|
||||
<view
|
||||
class="wallet-num-box ss-flex ss-col-center ss-row-between"
|
||||
:style="[
|
||||
{
|
||||
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
|
||||
paddingTop: Number(statusBarHeight + 108) + 'rpx',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<view class="">
|
||||
<view class="num-title">当前余额(元)</view>
|
||||
<view class="wallet-num">{{ fen2yuan(userWallet.balance) }}</view>
|
||||
|
@ -20,20 +23,31 @@
|
|||
<view class="input-label ss-m-b-50">充值金额</view>
|
||||
<view class="input-box ss-flex border-bottom ss-p-b-20">
|
||||
<view class="unit">¥</view>
|
||||
<uni-easyinput v-model="state.recharge_money" type="digit" placeholder="请输入充值金额"
|
||||
:inputBorder="false" />
|
||||
<uni-easyinput
|
||||
v-model="state.recharge_money"
|
||||
type="digit"
|
||||
placeholder="请输入充值金额"
|
||||
:inputBorder="false"
|
||||
/>
|
||||
</view>
|
||||
<view class="face-value-box ss-flex ss-flex-wrap ss-m-y-40">
|
||||
<button class="ss-reset-button face-value-btn" v-for="item in state.packageList" :key="item.money"
|
||||
:class="[{ 'btn-active': state.recharge_money === fen2yuan(item.payPrice) }]"
|
||||
@tap="onCard(item.payPrice)">
|
||||
<button
|
||||
class="ss-reset-button face-value-btn"
|
||||
v-for="item in state.packageList"
|
||||
:key="item.money"
|
||||
:class="[{ 'btn-active': state.recharge_money === fen2yuan(item.payPrice) }]"
|
||||
@tap="onCard(item.payPrice)"
|
||||
>
|
||||
<text class="face-value-title">{{ fen2yuan(item.payPrice) }}</text>
|
||||
<view v-if="item.bonusPrice" class="face-value-tag">
|
||||
送 {{ fen2yuan(item.bonusPrice) }} 元
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
<button class="ss-reset-button save-btn ui-BG-Main-Gradient ss-m-t-60 ui-Shadow-Main" @tap="onConfirm">
|
||||
<button
|
||||
class="ss-reset-button save-btn ui-BG-Main-Gradient ss-m-t-60 ui-Shadow-Main"
|
||||
@tap="onConfirm"
|
||||
>
|
||||
确认充值
|
||||
</button>
|
||||
</view>
|
||||
|
@ -47,7 +61,7 @@
|
|||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import PayWalletApi from '@/sheep/api/pay/wallet';
|
||||
import { WxaSubscribeTemplate } from '@/sheep/util/const';
|
||||
import { WxaSubscribeTemplate } from '@/sheep/helper/const';
|
||||
|
||||
const userWallet = computed(() => sheep.$store('user').userWallet);
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
|
@ -75,14 +89,17 @@
|
|||
// 发起支付
|
||||
async function onConfirm() {
|
||||
const { code, data } = await PayWalletApi.createWalletRecharge({
|
||||
packageId: state.packageList.find((item) => fen2yuan(item.payPrice) === state.recharge_money)?.id,
|
||||
packageId: state.packageList.find((item) => fen2yuan(item.payPrice) === state.recharge_money)
|
||||
?.id,
|
||||
payPrice: state.recharge_money * 100,
|
||||
});
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// #ifdef MP
|
||||
sheep.$platform.useProvider('wechat').subscribeMessage(WxaSubscribeTemplate.PAY_WALLET_RECHARGER_SUCCESS);
|
||||
sheep.$platform
|
||||
.useProvider('wechat')
|
||||
.subscribeMessage(WxaSubscribeTemplate.PAY_WALLET_RECHARGER_SUCCESS);
|
||||
// #endif
|
||||
sheep.$router.go('/pages/pay/index', {
|
||||
id: data.payOrderId,
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
import PayOrderApi from '@/sheep/api/pay/order';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import { WxaSubscribeTemplate } from '@/sheep/util/const';
|
||||
import { WxaSubscribeTemplate } from '@/sheep/helper/const';
|
||||
|
||||
const state = reactive({
|
||||
id: 0, // 支付单号
|
||||
|
|
|
@ -1,176 +1,181 @@
|
|||
<!-- 装修营销组件:优惠券 -->
|
||||
<template>
|
||||
<scroll-view class="scroll-box" scroll-x scroll-anchoring :style="[bgStyle, { marginLeft: `${data.space}px` }]">
|
||||
<view class="coupon-box ss-flex" :style="couponList.length === 2 ? couponBoxStyleTwo : couponBoxStyleNormal">
|
||||
<view class="coupon-item" :style="[couponBg, { marginLeft: `${data.space}px` }]"
|
||||
v-for="(item, index) in couponList" :key="index">
|
||||
<su-coupon :size="SIZE_LIST[columns - 1]" :textColor="data.textColor" background="" :couponId="item.id"
|
||||
:title="item.name" :type="formatCouponDiscountType(item)" :value="formatCouponDiscountValue(item)"
|
||||
:sellBy="formatValidityType(item)">
|
||||
<template v-slot:btn>
|
||||
<!-- 两列时,领取按钮坚排 -->
|
||||
<button v-if="columns === 2" @click.stop="onGetCoupon(item.id)"
|
||||
class="ss-reset-button card-btn vertical" :style="[btnStyles]">
|
||||
<view class="btn-text">立即领取</view>
|
||||
</button>
|
||||
<button v-else class="ss-reset-button card-btn" :style="[btnStyles]"
|
||||
@click.stop="onGetCoupon(item.id)">
|
||||
立即领取
|
||||
</button>
|
||||
</template>
|
||||
</su-coupon>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<scroll-view
|
||||
class="scroll-box"
|
||||
scroll-x
|
||||
scroll-anchoring
|
||||
:style="[bgStyle, { marginLeft: `${data.space}px` }]"
|
||||
>
|
||||
<view
|
||||
class="coupon-box ss-flex"
|
||||
:style="couponList.length === 2 ? couponBoxStyleTwo : couponBoxStyleNormal"
|
||||
>
|
||||
<view
|
||||
class="coupon-item"
|
||||
:style="[couponBg, { marginLeft: `${data.space}px` }]"
|
||||
v-for="(item, index) in couponList"
|
||||
:key="index"
|
||||
>
|
||||
<su-coupon
|
||||
:size="SIZE_LIST[columns - 1]"
|
||||
:textColor="data.textColor"
|
||||
background=""
|
||||
:couponId="item.id"
|
||||
:title="item.name"
|
||||
:type="formatCouponDiscountType(item)"
|
||||
:value="formatCouponDiscountValue(item)"
|
||||
:sellBy="formatValidityType(item)"
|
||||
>
|
||||
<template v-slot:btn>
|
||||
<!-- 两列时,领取按钮坚排 -->
|
||||
<button
|
||||
v-if="columns === 2"
|
||||
@click.stop="onGetCoupon(item.id)"
|
||||
class="ss-reset-button card-btn vertical"
|
||||
:style="[btnStyles]"
|
||||
>
|
||||
<view class="btn-text">立即领取</view>
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
class="ss-reset-button card-btn"
|
||||
:style="[btnStyles]"
|
||||
@click.stop="onGetCoupon(item.id)"
|
||||
>
|
||||
立即领取
|
||||
</button>
|
||||
</template>
|
||||
</su-coupon>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
CouponTemplateValidityTypeEnum,
|
||||
PromotionDiscountTypeEnum
|
||||
} from "@/sheep/util/const";
|
||||
import {
|
||||
floatToFixed2,
|
||||
formatDate
|
||||
} from "@/sheep/util";
|
||||
import sheep from '@/sheep';
|
||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum } from '@/sheep/helper/const';
|
||||
import { floatToFixed2, formatDate } from '@/sheep/util';
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
const {
|
||||
columns,
|
||||
button
|
||||
} = props.data;
|
||||
const SIZE_LIST = ['lg', 'md', 'xs']
|
||||
const couponBg = {
|
||||
background: `url(${sheep.$url.cdn(props.data.bgImg)}) no-repeat top center / 100% 100%`,
|
||||
};
|
||||
const btnStyles = {
|
||||
background: button.bgColor,
|
||||
color: button.color,
|
||||
};
|
||||
// 两列优惠券时的排版方式
|
||||
const couponBoxStyleNormal = {
|
||||
'display': 'flex',
|
||||
'justify-content': 'space-between'
|
||||
};
|
||||
// 非两列优惠券时的排版方式
|
||||
const couponBoxStyleTwo = {
|
||||
'display': 'flex',
|
||||
'justify-content': 'space-around'
|
||||
};
|
||||
// 设置背景样式
|
||||
const bgStyle = computed(() => {
|
||||
// 直接从 props.styles 解构
|
||||
const {
|
||||
bgType,
|
||||
bgImg,
|
||||
bgColor
|
||||
} = props.styles;
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
const { columns, button } = props.data;
|
||||
const SIZE_LIST = ['lg', 'md', 'xs'];
|
||||
const couponBg = {
|
||||
background: `url(${sheep.$url.cdn(props.data.bgImg)}) no-repeat top center / 100% 100%`,
|
||||
};
|
||||
const btnStyles = {
|
||||
background: button.bgColor,
|
||||
color: button.color,
|
||||
};
|
||||
// 两列优惠券时的排版方式
|
||||
const couponBoxStyleNormal = {
|
||||
display: 'flex',
|
||||
'justify-content': 'space-between',
|
||||
};
|
||||
// 非两列优惠券时的排版方式
|
||||
const couponBoxStyleTwo = {
|
||||
display: 'flex',
|
||||
'justify-content': 'space-around',
|
||||
};
|
||||
// 设置背景样式
|
||||
const bgStyle = computed(() => {
|
||||
// 直接从 props.styles 解构
|
||||
const { bgType, bgImg, bgColor } = props.styles;
|
||||
|
||||
// 根据 bgType 返回相应的样式
|
||||
return {
|
||||
background: bgType === 'img' ? `url(${bgImg}) no-repeat top center / 100% 100%` : bgColor
|
||||
};
|
||||
});
|
||||
// 格式化【折扣类型】
|
||||
const formatCouponDiscountType = (coupon) => {
|
||||
if (coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) {
|
||||
return 'reduce'
|
||||
}
|
||||
if (coupon.discountType === PromotionDiscountTypeEnum.PERCENT.type) {
|
||||
return 'percent'
|
||||
}
|
||||
return `未知【${coupon.discountType}】`
|
||||
}
|
||||
// 根据 bgType 返回相应的样式
|
||||
return {
|
||||
background: bgType === 'img' ? `url(${bgImg}) no-repeat top center / 100% 100%` : bgColor,
|
||||
};
|
||||
});
|
||||
// 格式化【折扣类型】
|
||||
const formatCouponDiscountType = (coupon) => {
|
||||
if (coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) {
|
||||
return 'reduce';
|
||||
}
|
||||
if (coupon.discountType === PromotionDiscountTypeEnum.PERCENT.type) {
|
||||
return 'percent';
|
||||
}
|
||||
return `未知【${coupon.discountType}】`;
|
||||
};
|
||||
|
||||
// 格式化【折扣】
|
||||
const formatCouponDiscountValue = (coupon) => {
|
||||
if (coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) {
|
||||
return floatToFixed2(coupon.discountPrice)
|
||||
}
|
||||
if (coupon.discountType === PromotionDiscountTypeEnum.PERCENT.type) {
|
||||
return coupon.discountPercent
|
||||
}
|
||||
return `未知【${coupon.discountType}】`
|
||||
}
|
||||
// 格式化【折扣】
|
||||
const formatCouponDiscountValue = (coupon) => {
|
||||
if (coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) {
|
||||
return floatToFixed2(coupon.discountPrice);
|
||||
}
|
||||
if (coupon.discountType === PromotionDiscountTypeEnum.PERCENT.type) {
|
||||
return coupon.discountPercent;
|
||||
}
|
||||
return `未知【${coupon.discountType}】`;
|
||||
};
|
||||
|
||||
// 格式化【有效期限】
|
||||
const formatValidityType = (row) => {
|
||||
if (row.validityType === CouponTemplateValidityTypeEnum.DATE.type) {
|
||||
return `${formatDate(row.validStartTime)} 至 ${formatDate(row.validEndTime)}`
|
||||
}
|
||||
if (row.validityType === CouponTemplateValidityTypeEnum.TERM.type) {
|
||||
return `领取后第 ${row.fixedStartTerm} - ${row.fixedEndTerm} 天内可用`
|
||||
}
|
||||
return '未知【' + row.validityType + '】'
|
||||
}
|
||||
// 格式化【有效期限】
|
||||
const formatValidityType = (row) => {
|
||||
if (row.validityType === CouponTemplateValidityTypeEnum.DATE.type) {
|
||||
return `${formatDate(row.validStartTime)} 至 ${formatDate(row.validEndTime)}`;
|
||||
}
|
||||
if (row.validityType === CouponTemplateValidityTypeEnum.TERM.type) {
|
||||
return `领取后第 ${row.fixedStartTerm} - ${row.fixedEndTerm} 天内可用`;
|
||||
}
|
||||
return '未知【' + row.validityType + '】';
|
||||
};
|
||||
|
||||
const couponList = ref([]);
|
||||
// 立即领取优惠券
|
||||
async function onGetCoupon(id) {
|
||||
const {
|
||||
error,
|
||||
msg
|
||||
} = await CouponApi.takeCoupon(id);
|
||||
if (error === 0) {
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
icon: 'none',
|
||||
});
|
||||
return
|
||||
}
|
||||
await getCouponTemplateList()
|
||||
}
|
||||
const getCouponTemplateList = async () => {
|
||||
const {
|
||||
data
|
||||
} = await CouponApi.getCouponTemplateListByIds(props.data.couponIds.join(','));
|
||||
couponList.value = data;
|
||||
}
|
||||
onMounted(() => {
|
||||
getCouponTemplateList()
|
||||
});
|
||||
const couponList = ref([]);
|
||||
// 立即领取优惠券
|
||||
async function onGetCoupon(id) {
|
||||
const { error, msg } = await CouponApi.takeCoupon(id);
|
||||
if (error === 0) {
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
await getCouponTemplateList();
|
||||
}
|
||||
const getCouponTemplateList = async () => {
|
||||
const { data } = await CouponApi.getCouponTemplateListByIds(props.data.couponIds.join(','));
|
||||
couponList.value = data;
|
||||
};
|
||||
onMounted(() => {
|
||||
getCouponTemplateList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-btn {
|
||||
width: 140rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 50rpx;
|
||||
.card-btn {
|
||||
width: 140rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 50rpx;
|
||||
|
||||
&.vertical {
|
||||
width: 50rpx;
|
||||
height: 140rpx;
|
||||
margin: auto 20rpx auto 0;
|
||||
&.vertical {
|
||||
width: 50rpx;
|
||||
height: 140rpx;
|
||||
margin: auto 20rpx auto 0;
|
||||
|
||||
.btn-text {
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
writing-mode: vertical-lr;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn-text {
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
writing-mode: vertical-lr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-item {
|
||||
&:nth-of-type(1) {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.coupon-item {
|
||||
&:nth-of-type(1) {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -502,7 +502,7 @@
|
|||
getRewardActivityRuleItemDescriptions,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import { isArray } from 'lodash-es';
|
||||
import { PromotionActivityTypeEnum } from '@/sheep/util/const';
|
||||
import { PromotionActivityTypeEnum } from '@/sheep/helper/const';
|
||||
|
||||
// 数据
|
||||
let defaultImgWidth = ref(0);
|
||||
|
|
|
@ -141,11 +141,11 @@
|
|||
/**
|
||||
* 商品卡片
|
||||
*/
|
||||
import { computed, onMounted, reactive, ref } from 'vue';
|
||||
import { computed, onMounted, reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import PointApi from '@/sheep/api/promotion/point';
|
||||
import { PromotionActivityTypeEnum } from '@/sheep/util/const';
|
||||
import { PromotionActivityTypeEnum } from '@/sheep/helper/const';
|
||||
|
||||
// 布局类型
|
||||
const LayoutTypeEnum = {
|
||||
|
@ -260,10 +260,10 @@
|
|||
// 查找对应的 spu 并更新价格
|
||||
const spu = state.spuList.find((spu) => activity.spuId === spu.id);
|
||||
if (spu) {
|
||||
spu.pointStock = activity.stock
|
||||
spu.pointTotalStock = activity.totalStock
|
||||
spu.point = activity.point
|
||||
spu.pointPrice = activity.price
|
||||
spu.pointStock = activity.stock;
|
||||
spu.pointTotalStock = activity.totalStock;
|
||||
spu.point = activity.point;
|
||||
spu.pointPrice = activity.price;
|
||||
// 赋值活动ID,为了点击跳转详情页
|
||||
spu.activityId = activity.id;
|
||||
// 赋值活动类型
|
||||
|
|
|
@ -76,7 +76,12 @@
|
|||
<view class="goods-list-box">
|
||||
<view
|
||||
class="left-list"
|
||||
:style="[{ paddingRight: state.property.space + 'rpx', marginBottom: state.property.space + 'px' }]"
|
||||
:style="[
|
||||
{
|
||||
paddingRight: state.property.space + 'rpx',
|
||||
marginBottom: state.property.space + 'px',
|
||||
},
|
||||
]"
|
||||
v-for="item in state.leftSpuList"
|
||||
:key="item.id"
|
||||
>
|
||||
|
@ -106,7 +111,12 @@
|
|||
<view class="goods-list-box">
|
||||
<view
|
||||
class="right-list"
|
||||
:style="[{ paddingLeft: state.property.space + 'rpx', marginBottom: state.property.space + 'px' }]"
|
||||
:style="[
|
||||
{
|
||||
paddingLeft: state.property.space + 'rpx',
|
||||
marginBottom: state.property.space + 'px',
|
||||
},
|
||||
]"
|
||||
v-for="item in state.rightSpuList"
|
||||
:key="item.id"
|
||||
>
|
||||
|
@ -141,10 +151,10 @@
|
|||
/**
|
||||
* 商品卡片
|
||||
*/
|
||||
import { computed, nextTick, onMounted, reactive, watch } from 'vue';
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { PromotionActivityTypeEnum } from '@/sheep/util/const';
|
||||
import { PromotionActivityTypeEnum } from '@/sheep/helper/const';
|
||||
import { isEmpty } from '@/sheep/helper/utils';
|
||||
|
||||
// 布局类型
|
||||
|
@ -162,53 +172,53 @@
|
|||
leftSpuList: [],
|
||||
rightSpuList: [],
|
||||
property: {
|
||||
'layoutType': 'oneColBigImg',
|
||||
'fields': {
|
||||
'name': {
|
||||
'show': true,
|
||||
'color': '#000',
|
||||
layoutType: 'oneColBigImg',
|
||||
fields: {
|
||||
name: {
|
||||
show: true,
|
||||
color: '#000',
|
||||
},
|
||||
'introduction': {
|
||||
'show': true,
|
||||
'color': '#999',
|
||||
introduction: {
|
||||
show: true,
|
||||
color: '#999',
|
||||
},
|
||||
'price': {
|
||||
'show': true,
|
||||
'color': '#ff3000',
|
||||
price: {
|
||||
show: true,
|
||||
color: '#ff3000',
|
||||
},
|
||||
'marketPrice': {
|
||||
'show': true,
|
||||
'color': '#c4c4c4',
|
||||
marketPrice: {
|
||||
show: true,
|
||||
color: '#c4c4c4',
|
||||
},
|
||||
'salesCount': {
|
||||
'show': true,
|
||||
'color': '#c4c4c4',
|
||||
salesCount: {
|
||||
show: true,
|
||||
color: '#c4c4c4',
|
||||
},
|
||||
'stock': {
|
||||
'show': true,
|
||||
'color': '#c4c4c4',
|
||||
stock: {
|
||||
show: true,
|
||||
color: '#c4c4c4',
|
||||
},
|
||||
},
|
||||
'badge': {
|
||||
'show': false,
|
||||
'imgUrl': '',
|
||||
badge: {
|
||||
show: false,
|
||||
imgUrl: '',
|
||||
},
|
||||
'btnBuy': {
|
||||
'type': 'text',
|
||||
'text': '立即兑换',
|
||||
'bgBeginColor': '#FF6000',
|
||||
'bgEndColor': '#FE832A',
|
||||
'imgUrl': '',
|
||||
btnBuy: {
|
||||
type: 'text',
|
||||
text: '立即兑换',
|
||||
bgBeginColor: '#FF6000',
|
||||
bgEndColor: '#FE832A',
|
||||
imgUrl: '',
|
||||
},
|
||||
'borderRadiusTop': 8,
|
||||
'borderRadiusBottom': 8,
|
||||
'space': 8,
|
||||
'style': {
|
||||
'bgType': 'color',
|
||||
'bgColor': '',
|
||||
'marginLeft': 8,
|
||||
'marginRight': 8,
|
||||
'marginBottom': 8,
|
||||
borderRadiusTop: 8,
|
||||
borderRadiusBottom: 8,
|
||||
space: 8,
|
||||
style: {
|
||||
bgType: 'color',
|
||||
bgColor: '',
|
||||
marginLeft: 8,
|
||||
marginRight: 8,
|
||||
marginBottom: 8,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -219,9 +229,13 @@
|
|||
},
|
||||
});
|
||||
// 动态更新 property
|
||||
watch(() => props.property, (newVal) => {
|
||||
state.property = { ...state.property, ...newVal };
|
||||
}, { immediate: true, deep: true });
|
||||
watch(
|
||||
() => props.property,
|
||||
(newVal) => {
|
||||
state.property = { ...state.property, ...newVal };
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
);
|
||||
const { marginLeft, marginRight } = state.property.styles || {};
|
||||
|
||||
// 购买按钮样式
|
||||
|
@ -317,7 +331,7 @@
|
|||
function getActivityCount() {
|
||||
return state.spuList.length;
|
||||
}
|
||||
defineExpose({ concatActivity,getActivityCount,calculateGoodsColumn });
|
||||
defineExpose({ concatActivity, getActivityCount, calculateGoodsColumn });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
import sheep from '@/sheep';
|
||||
import { convertProductPropertyList, fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { isEmpty, min } from 'lodash-es';
|
||||
import { PromotionActivityTypeEnum } from '@/sheep/util/const';
|
||||
import { PromotionActivityTypeEnum } from '@/sheep/helper/const';
|
||||
|
||||
const emits = defineEmits(['change', 'addCart', 'buy', 'close']);
|
||||
const props = defineProps({
|
||||
|
|
|
@ -151,5 +151,3 @@ export const SharePageEnum = {
|
|||
value: '6',
|
||||
},
|
||||
};
|
||||
|
||||
// TODO @芋艿:融合下;
|
|
@ -3,7 +3,7 @@ import $platform from '@/sheep/platform';
|
|||
import $router from '@/sheep/router';
|
||||
import $url from '@/sheep/url';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import { SharePageEnum } from '@/sheep/util/const';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
// #ifdef H5
|
||||
import $wxsdk from '@/sheep/libs/sdk-h5-weixin';
|
||||
|
|
|
@ -9,7 +9,7 @@ import $store from '@/sheep/store';
|
|||
import $platform from '@/sheep/platform';
|
||||
import { showAuthModal } from '@/sheep/hooks/useModal';
|
||||
import AuthUtil from '@/sheep/api/member/auth';
|
||||
import { getTerminal } from '@/sheep/util/const';
|
||||
import { getTerminal } from '@/sheep/helper/const';
|
||||
|
||||
const options = {
|
||||
// 显示操作成功消息 默认不显示
|
||||
|
@ -80,13 +80,13 @@ http.interceptors.request.use(
|
|||
if (config.custom.showLoading) {
|
||||
LoadingInstance.count++;
|
||||
LoadingInstance.count === 1 &&
|
||||
uni.showLoading({
|
||||
title: config.custom.loadingMsg,
|
||||
mask: true,
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
},
|
||||
});
|
||||
uni.showLoading({
|
||||
title: config.custom.loadingMsg,
|
||||
mask: true,
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 增加 token 令牌、terminal 终端、tenant 租户的请求头
|
||||
|
@ -127,7 +127,8 @@ http.interceptors.response.use(
|
|||
// 特殊:处理分销用户绑定失败的提示
|
||||
if ((response.data.code + '').includes('1011007')) {
|
||||
console.error(`分销用户绑定失败,原因:${response.data.msg}`);
|
||||
} else if (response.config.custom.showError) { // 错误提示
|
||||
} else if (response.config.custom.showError) {
|
||||
// 错误提示
|
||||
uni.showToast({
|
||||
title: response.data.msg || '服务器开小差啦,请稍后再试~',
|
||||
icon: 'none',
|
||||
|
|
Loading…
Reference in New Issue