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