commit
e727974806
|
@ -7,7 +7,7 @@
|
||||||
<view class="type-text ss-flex ss-row-center">满减:</view>
|
<view class="type-text ss-flex ss-row-center">满减:</view>
|
||||||
<view class="ss-flex-1">
|
<view class="ss-flex-1">
|
||||||
<view class="tip-content" v-for="item in state.activityInfo.rules" :key="item">
|
<view class="tip-content" v-for="item in state.activityInfo.rules" :key="item">
|
||||||
{{ item.description }}
|
{{ item.description[1] }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<image class="activity-left-image" src="/static/activity-left.png" />
|
<image class="activity-left-image" src="/static/activity-left.png" />
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,244 +1,259 @@
|
||||||
<!-- 商品信息:满减送等营销活动的弹窗 -->
|
<!-- 商品信息:满减送等营销活动的弹窗 -->
|
||||||
<template>
|
<template>
|
||||||
<su-popup :show="show" type="bottom" round="20" @close="emits('close')" showClose>
|
<su-popup :show="show" type="bottom" round="20" @close="emits('close')" showClose>
|
||||||
<view class="model-box">
|
<view class="model-box">
|
||||||
<view class="title ss-m-t-16 ss-m-l-20 ss-flex">优惠</view>
|
<view class="title ss-m-t-16 ss-m-l-20 ss-flex">优惠</view>
|
||||||
<view v-if="state.rewardActivity && state.rewardActivity.id > 0">
|
<view v-if="state.rewardActivity && state.rewardActivity.id > 0">
|
||||||
<view class="titleLi">促销</view>
|
<view class="titleLi">促销</view>
|
||||||
<scroll-view
|
<scroll-view class="model-content" scroll-y :scroll-with-animation="false" :enable-back-to-top="true">
|
||||||
class="model-content"
|
<view class="actBox" v-for="(item, index) in state.handeActivity" :key="index">
|
||||||
scroll-y
|
<view class="boxCont ss-flex ss-col-top ss-m-b-40" @tap="onGoodsList(state.rewardActivity)">
|
||||||
:scroll-with-animation="false"
|
<view class="model-content-tag ss-flex ss-row-center">{{item.name}}</view>
|
||||||
:enable-back-to-top="true"
|
<view class="model-content-title">
|
||||||
>
|
<view class="contBu">
|
||||||
<view
|
<text v-for="(items,indexs) in item.value" :key="indexs">{{ items }};</text>
|
||||||
class="actBox"
|
</view>
|
||||||
v-for="(item, index) in state.rewardActivity.ruleDescriptions"
|
<view class="ss-m-b-24 cotBu-txt">
|
||||||
:key="index"
|
{{ sheep.$helper.timeFormat(state.rewardActivity.startTime, 'yyyy.mm.dd') }}
|
||||||
>
|
-
|
||||||
<view
|
{{ sheep.$helper.timeFormat(state.rewardActivity.endTime, 'yyyy.mm.dd') }}
|
||||||
class="boxCont ss-flex ss-col-top ss-m-b-40"
|
</view>
|
||||||
@tap="onGoodsList(state.rewardActivity)"
|
</view>
|
||||||
>
|
<text class="cicon-forward" />
|
||||||
<view class="model-content-tag ss-flex ss-row-center">满减</view>
|
</view>
|
||||||
<view class="model-content-title">
|
</view>
|
||||||
<view class="contBu">
|
</scroll-view>
|
||||||
<text>{{ item }}</text>
|
</view>
|
||||||
</view>
|
<view class="titleLi">可领优惠券</view>
|
||||||
<view class="ss-m-b-24 cotBu-txt">
|
<scroll-view class="model-content" scroll-y :scroll-with-animation="false" :enable-back-to-top="true" v-if="state.couponInfo.length">
|
||||||
{{ sheep.$helper.timeFormat(state.rewardActivity.startTime, 'yyyy.mm.dd') }}
|
<view class="actBox" v-for="item in state.couponInfo" :key="item.id">
|
||||||
-
|
<view class="boxCont ss-flex ss-col-top ss-m-b-40">
|
||||||
{{ sheep.$helper.timeFormat(state.rewardActivity.endTime, 'yyyy.mm.dd') }}
|
<view class="model-content-tag2">
|
||||||
</view>
|
<view class="usePrice"> ¥{{ fen2yuan(item.discountPrice) }} </view>
|
||||||
</view>
|
<view class="impose"> 满¥{{ fen2yuan(item.usePrice) }}可用 </view>
|
||||||
<text class="cicon-forward" />
|
</view>
|
||||||
</view>
|
<view class="model-content-title2">
|
||||||
</view>
|
<view class="contBu">
|
||||||
</scroll-view>
|
{{ item.name }}
|
||||||
</view>
|
</view>
|
||||||
<view class="titleLi">可领优惠券</view>
|
<view class="ss-m-b-24 cotBu-txt">
|
||||||
<scroll-view
|
{{
|
||||||
class="model-content"
|
item.validityType == 1
|
||||||
scroll-y
|
? sheep.$helper.timeFormat(item.validStartTime, 'yyyy.mm.dd') -
|
||||||
:scroll-with-animation="false"
|
sheep.$helper.timeFormat(item.validEndTime, 'yyyy.mm.dd')
|
||||||
:enable-back-to-top="true"
|
: '领取后' + item.fixedStartTerm + '-' + item.fixedEndTerm + '天可用'
|
||||||
>
|
}}
|
||||||
<view class="actBox" v-for="item in state.couponInfo" :key="item.id">
|
</view>
|
||||||
<view class="boxCont ss-flex ss-col-top ss-m-b-40">
|
</view>
|
||||||
<view class="model-content-tag2">
|
<view class="coupon" @click.stop="getBuy(item.id)" v-if="item.canTake"> 立即领取 </view>
|
||||||
<view class="usePrice"> ¥{{ fen2yuan(item.discountPrice) }} </view>
|
<view class="coupon2" v-else> 已领取 </view>
|
||||||
<view class="impose"> 满¥{{ fen2yuan(item.usePrice) }}可用 </view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="model-content-title2">
|
</scroll-view>
|
||||||
<view class="contBu">
|
<view class="nullBox" v-else>
|
||||||
{{ item.name }}
|
暂无可领优惠券
|
||||||
</view>
|
</view>
|
||||||
<view class="ss-m-b-24 cotBu-txt">
|
</view>
|
||||||
{{
|
</su-popup>
|
||||||
item.validityType == 1
|
|
||||||
? sheep.$helper.timeFormat(item.validStartTime, 'yyyy.mm.dd') -
|
|
||||||
sheep.$helper.timeFormat(item.validEndTime, 'yyyy.mm.dd')
|
|
||||||
: '领取后' + item.fixedStartTerm + '-' + item.fixedEndTerm + '天可用'
|
|
||||||
}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="coupon" @click.stop="getBuy(item.id)" v-if="item.canTake"> 立即领取 </view>
|
|
||||||
<view class="coupon2" v-else> 已领取 </view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
</view>
|
|
||||||
</su-popup>
|
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { computed, reactive } from 'vue';
|
import {
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
handeleData
|
||||||
const props = defineProps({
|
} from '@/sheep/hooks/useGoods';
|
||||||
modelValue: {
|
import {
|
||||||
type: Object,
|
computed,
|
||||||
default() {},
|
reactive,
|
||||||
},
|
watch,
|
||||||
show: {
|
ref
|
||||||
type: Boolean,
|
} from 'vue';
|
||||||
default: false,
|
import {
|
||||||
},
|
fen2yuan
|
||||||
});
|
} from '@/sheep/hooks/useGoods';
|
||||||
const emits = defineEmits(['close']);
|
const props = defineProps({
|
||||||
const state = reactive({
|
modelValue: {
|
||||||
rewardActivity: computed(() => props.modelValue.rewardActivity),
|
type: Object,
|
||||||
couponInfo: computed(() => props.modelValue.couponInfo),
|
default () {},
|
||||||
});
|
},
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const emits = defineEmits(['close']);
|
||||||
|
const state = reactive({
|
||||||
|
rewardActivity: computed(() => props.modelValue.rewardActivity),
|
||||||
|
couponInfo: computed(() => props.modelValue.couponInfo),
|
||||||
|
});
|
||||||
|
// setTimeout(()=>{
|
||||||
|
// console.log('历程数据',state.rewardActivity.ruleDescriptions)
|
||||||
|
// console.log('处理数据',handeleData(props.modelValue.rewardActivity.ruleDescriptions))
|
||||||
|
// },5000)
|
||||||
|
// 领取优惠劵
|
||||||
|
const getBuy = (id) => {
|
||||||
|
emits('get', id);
|
||||||
|
};
|
||||||
|
|
||||||
// 领取优惠劵
|
function onGoodsList(e) {
|
||||||
const getBuy = (id) => {
|
sheep.$router.go('/pages/activity/index', {
|
||||||
emits('get', id);
|
activityId: e.id,
|
||||||
};
|
});
|
||||||
|
}
|
||||||
function onGoodsList(e) {
|
//监听获取到数据后再执行且只执行一次
|
||||||
sheep.$router.go('/pages/activity/index', {
|
let flag = ref(true)
|
||||||
activityId: e.id,
|
watch(state, (newValue, oldValue) => {
|
||||||
});
|
if (flag.value) {
|
||||||
}
|
flag.value = false
|
||||||
|
state.handeActivity = handeleData(state.rewardActivity.ruleDescriptions)
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.model-box {
|
.model-box {
|
||||||
height: 60vh;
|
height: 60vh;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-content {
|
.model-content {
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
max-height: 350rpx;
|
max-height: 380rpx;
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
|
|
||||||
.model-content-tag {
|
.model-content-tag {
|
||||||
// background: rgba(#ff6911, 0.1);
|
// background: rgba(#ff6911, 0.1);
|
||||||
font-size: 35rpx;
|
font-size: 35rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #ff6911;
|
color: #ff6911;
|
||||||
line-height: 150rpx;
|
line-height: 150rpx;
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 150rpx;
|
height: 150rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
// border-radius: 5rpx;
|
// border-radius: 5rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-content-title {
|
.model-content-title {
|
||||||
width: 450rpx;
|
width: 450rpx;
|
||||||
height: 150rpx;
|
height: 150rpx;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cicon-forward {
|
.cicon-forward {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增的
|
// 新增的
|
||||||
.titleLi {
|
.titleLi {
|
||||||
margin: 10rpx 0 10rpx 20rpx;
|
margin: 10rpx 0 10rpx 20rpx;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.actBox {
|
.actBox {
|
||||||
width: 700rpx;
|
width: 700rpx;
|
||||||
height: 150rpx;
|
height: 150rpx;
|
||||||
background-color: #fff2f2;
|
background-color: #fff2f2;
|
||||||
margin: 10rpx auto;
|
margin: 10rpx auto;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.boxCont {
|
.boxCont {
|
||||||
width: 700rpx;
|
width: 700rpx;
|
||||||
height: 150rpx;
|
height: 150rpx;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contBu {
|
.contBu {
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
-o-text-overflow: ellipsis;
|
-o-text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cotBu-txt {
|
.cotBu-txt {
|
||||||
height: 70rpx;
|
height: 70rpx;
|
||||||
line-height: 70rpx;
|
line-height: 70rpx;
|
||||||
font-size: 25rpx;
|
font-size: 25rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-content-tag2 {
|
.model-content-tag2 {
|
||||||
font-size: 35rpx;
|
font-size: 35rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #ff6911;
|
color: #ff6911;
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 150rpx;
|
height: 150rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.usePrice {
|
.usePrice {
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 90rpx;
|
height: 90rpx;
|
||||||
line-height: 100rpx;
|
line-height: 100rpx;
|
||||||
// background-color: red;
|
// background-color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.impose {
|
.impose {
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
// line-height: 75rpx;
|
// line-height: 75rpx;
|
||||||
font-size: 23rpx;
|
font-size: 23rpx;
|
||||||
// background-color: gold;
|
// background-color: gold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-content-title2 {
|
.model-content-title2 {
|
||||||
width: 330rpx;
|
width: 330rpx;
|
||||||
height: 150rpx;
|
height: 150rpx;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.coupon {
|
.coupon {
|
||||||
width: 150rpx;
|
width: 150rpx;
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
line-height: 50rpx;
|
line-height: 50rpx;
|
||||||
background-color: rgb(255, 68, 68);
|
background-color: rgb(255, 68, 68);
|
||||||
color: white;
|
color: white;
|
||||||
border-radius: 30rpx;
|
border-radius: 30rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 25rpx;
|
font-size: 25rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.coupon2 {
|
.coupon2 {
|
||||||
width: 150rpx;
|
width: 150rpx;
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
line-height: 50rpx;
|
line-height: 50rpx;
|
||||||
background-color: rgb(203, 192, 191);
|
background-color: rgb(203, 192, 191);
|
||||||
color: white;
|
color: white;
|
||||||
border-radius: 30rpx;
|
border-radius: 30rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 25rpx;
|
font-size: 25rpx;
|
||||||
}
|
}
|
||||||
</style>
|
.nullBox{
|
||||||
|
width: 100%;
|
||||||
|
height: 300rpx;
|
||||||
|
font-size: 25rpx;
|
||||||
|
line-height: 300rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,11 @@
|
||||||
import { ref } from 'vue';
|
import {
|
||||||
|
ref
|
||||||
|
} from 'vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import $url from '@/sheep/url';
|
import $url from '@/sheep/url';
|
||||||
import { formatDate } from '@/sheep/util';
|
import {
|
||||||
|
formatDate
|
||||||
|
} from '@/sheep/util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化销量
|
* 格式化销量
|
||||||
|
@ -10,8 +14,8 @@ import { formatDate } from '@/sheep/util';
|
||||||
* @return {string} 格式化后的销量字符串
|
* @return {string} 格式化后的销量字符串
|
||||||
*/
|
*/
|
||||||
export function formatSales(type, num) {
|
export function formatSales(type, num) {
|
||||||
let prefix = type !== 'exact' && num < 10 ? '销量' : '已售';
|
let prefix = type !== 'exact' && num < 10 ? '销量' : '已售';
|
||||||
return formatNum(prefix, type, num);
|
return formatNum(prefix, type, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +25,7 @@ export function formatSales(type, num) {
|
||||||
* @return {string} 格式化后的销量字符串
|
* @return {string} 格式化后的销量字符串
|
||||||
*/
|
*/
|
||||||
export function formatExchange(type, num) {
|
export function formatExchange(type, num) {
|
||||||
return formatNum('已兑换', type, num);
|
return formatNum('已兑换', type, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +35,7 @@ export function formatExchange(type, num) {
|
||||||
* @return {string} 格式化后的销量字符串
|
* @return {string} 格式化后的销量字符串
|
||||||
*/
|
*/
|
||||||
export function formatStock(type, num) {
|
export function formatStock(type, num) {
|
||||||
return formatNum('库存', type, num);
|
return formatNum('库存', type, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,27 +46,27 @@ export function formatStock(type, num) {
|
||||||
* @return {string} 格式化后的销量字符串
|
* @return {string} 格式化后的销量字符串
|
||||||
*/
|
*/
|
||||||
export function formatNum(prefix, type, num) {
|
export function formatNum(prefix, type, num) {
|
||||||
num = num || 0;
|
num = num || 0;
|
||||||
// 情况一:精确数值
|
// 情况一:精确数值
|
||||||
if (type === 'exact') {
|
if (type === 'exact') {
|
||||||
return prefix + num;
|
return prefix + num;
|
||||||
}
|
}
|
||||||
// 情况二:小于等于 10
|
// 情况二:小于等于 10
|
||||||
if (num < 10) {
|
if (num < 10) {
|
||||||
return `${prefix}≤10`;
|
return `${prefix}≤10`;
|
||||||
}
|
}
|
||||||
// 情况三:大于 10,除第一位外,其它位都显示为0
|
// 情况三:大于 10,除第一位外,其它位都显示为0
|
||||||
// 例如:100 - 199 显示为 100+
|
// 例如:100 - 199 显示为 100+
|
||||||
// 9000 - 9999 显示为 9000+
|
// 9000 - 9999 显示为 9000+
|
||||||
const numStr = num.toString();
|
const numStr = num.toString();
|
||||||
const first = numStr[0];
|
const first = numStr[0];
|
||||||
const other = '0'.repeat(numStr.length - 1);
|
const other = '0'.repeat(numStr.length - 1);
|
||||||
return `${prefix}${first}${other}+`;
|
return `${prefix}${first}${other}+`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化价格
|
// 格式化价格
|
||||||
export function formatPrice(e) {
|
export function formatPrice(e) {
|
||||||
return e.length === 1 ? e[0] : e.join('~');
|
return e.length === 1 ? e[0] : e.join('~');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 视频格式后缀列表
|
// 视频格式后缀列表
|
||||||
|
@ -75,19 +79,19 @@ const VIDEO_SUFFIX_LIST = ['.avi', '.mp4'];
|
||||||
* @return {{src: string, type: 'video' | 'image' }[]} 转换后的链接列表
|
* @return {{src: string, type: 'video' | 'image' }[]} 转换后的链接列表
|
||||||
*/
|
*/
|
||||||
export function formatGoodsSwiper(urlList) {
|
export function formatGoodsSwiper(urlList) {
|
||||||
return (
|
return (
|
||||||
urlList
|
urlList
|
||||||
?.filter((url) => url)
|
?.filter((url) => url)
|
||||||
.map((url, key) => {
|
.map((url, key) => {
|
||||||
const isVideo = VIDEO_SUFFIX_LIST.some((suffix) => url.includes(suffix));
|
const isVideo = VIDEO_SUFFIX_LIST.some((suffix) => url.includes(suffix));
|
||||||
const type = isVideo ? 'video' : 'image';
|
const type = isVideo ? 'video' : 'image';
|
||||||
const src = $url.cdn(url);
|
const src = $url.cdn(url);
|
||||||
return {
|
return {
|
||||||
type,
|
type,
|
||||||
src,
|
src,
|
||||||
};
|
};
|
||||||
}) || []
|
}) || []
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,16 +101,16 @@ export function formatGoodsSwiper(urlList) {
|
||||||
* @return {string} 颜色的 class 名称
|
* @return {string} 颜色的 class 名称
|
||||||
*/
|
*/
|
||||||
export function formatOrderColor(order) {
|
export function formatOrderColor(order) {
|
||||||
if (order.status === 0) {
|
if (order.status === 0) {
|
||||||
return 'info-color';
|
return 'info-color';
|
||||||
}
|
}
|
||||||
if (order.status === 10 || order.status === 20 || (order.status === 30 && !order.commentStatus)) {
|
if (order.status === 10 || order.status === 20 || (order.status === 30 && !order.commentStatus)) {
|
||||||
return 'warning-color';
|
return 'warning-color';
|
||||||
}
|
}
|
||||||
if (order.status === 30 && order.commentStatus) {
|
if (order.status === 30 && order.commentStatus) {
|
||||||
return 'success-color';
|
return 'success-color';
|
||||||
}
|
}
|
||||||
return 'danger-color';
|
return 'danger-color';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,25 +119,25 @@ export function formatOrderColor(order) {
|
||||||
* @param order 订单
|
* @param order 订单
|
||||||
*/
|
*/
|
||||||
export function formatOrderStatus(order) {
|
export function formatOrderStatus(order) {
|
||||||
if (order.status === 0) {
|
if (order.status === 0) {
|
||||||
return '待付款';
|
return '待付款';
|
||||||
}
|
}
|
||||||
if (order.status === 10 && order.deliveryType === 1) {
|
if (order.status === 10 && order.deliveryType === 1) {
|
||||||
return '待发货';
|
return '待发货';
|
||||||
}
|
}
|
||||||
if (order.status === 10 && order.deliveryType === 2) {
|
if (order.status === 10 && order.deliveryType === 2) {
|
||||||
return '待核销';
|
return '待核销';
|
||||||
}
|
}
|
||||||
if (order.status === 20) {
|
if (order.status === 20) {
|
||||||
return '待收货';
|
return '待收货';
|
||||||
}
|
}
|
||||||
if (order.status === 30 && !order.commentStatus) {
|
if (order.status === 30 && !order.commentStatus) {
|
||||||
return '待评价';
|
return '待评价';
|
||||||
}
|
}
|
||||||
if (order.status === 30 && order.commentStatus) {
|
if (order.status === 30 && order.commentStatus) {
|
||||||
return '已完成';
|
return '已完成';
|
||||||
}
|
}
|
||||||
return '已关闭';
|
return '已关闭';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,22 +146,22 @@ export function formatOrderStatus(order) {
|
||||||
* @param order 订单
|
* @param order 订单
|
||||||
*/
|
*/
|
||||||
export function formatOrderStatusDescription(order) {
|
export function formatOrderStatusDescription(order) {
|
||||||
if (order.status === 0) {
|
if (order.status === 0) {
|
||||||
return `请在 ${formatDate(order.payExpireTime)} 前完成支付`;
|
return `请在 ${formatDate(order.payExpireTime)} 前完成支付`;
|
||||||
}
|
}
|
||||||
if (order.status === 10) {
|
if (order.status === 10) {
|
||||||
return '商家未发货,请耐心等待';
|
return '商家未发货,请耐心等待';
|
||||||
}
|
}
|
||||||
if (order.status === 20) {
|
if (order.status === 20) {
|
||||||
return '商家已发货,请耐心等待';
|
return '商家已发货,请耐心等待';
|
||||||
}
|
}
|
||||||
if (order.status === 30 && !order.commentStatus) {
|
if (order.status === 30 && !order.commentStatus) {
|
||||||
return '已收货,快去评价一下吧';
|
return '已收货,快去评价一下吧';
|
||||||
}
|
}
|
||||||
if (order.status === 30 && order.commentStatus) {
|
if (order.status === 30 && order.commentStatus) {
|
||||||
return '交易完成,感谢您的支持';
|
return '交易完成,感谢您的支持';
|
||||||
}
|
}
|
||||||
return '交易关闭';
|
return '交易关闭';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,32 +170,32 @@ export function formatOrderStatusDescription(order) {
|
||||||
* @param order 订单
|
* @param order 订单
|
||||||
*/
|
*/
|
||||||
export function handleOrderButtons(order) {
|
export function handleOrderButtons(order) {
|
||||||
order.buttons = [];
|
order.buttons = [];
|
||||||
if (order.type === 3) {
|
if (order.type === 3) {
|
||||||
// 查看拼团
|
// 查看拼团
|
||||||
order.buttons.push('combination');
|
order.buttons.push('combination');
|
||||||
}
|
}
|
||||||
if (order.status === 20) {
|
if (order.status === 20) {
|
||||||
// 确认收货
|
// 确认收货
|
||||||
order.buttons.push('confirm');
|
order.buttons.push('confirm');
|
||||||
}
|
}
|
||||||
if (order.logisticsId > 0) {
|
if (order.logisticsId > 0) {
|
||||||
// 查看物流
|
// 查看物流
|
||||||
order.buttons.push('express');
|
order.buttons.push('express');
|
||||||
}
|
}
|
||||||
if (order.status === 0) {
|
if (order.status === 0) {
|
||||||
// 取消订单 / 发起支付
|
// 取消订单 / 发起支付
|
||||||
order.buttons.push('cancel');
|
order.buttons.push('cancel');
|
||||||
order.buttons.push('pay');
|
order.buttons.push('pay');
|
||||||
}
|
}
|
||||||
if (order.status === 30 && !order.commentStatus) {
|
if (order.status === 30 && !order.commentStatus) {
|
||||||
// 发起评价
|
// 发起评价
|
||||||
order.buttons.push('comment');
|
order.buttons.push('comment');
|
||||||
}
|
}
|
||||||
if (order.status === 40) {
|
if (order.status === 40) {
|
||||||
// 删除订单
|
// 删除订单
|
||||||
order.buttons.push('delete');
|
order.buttons.push('delete');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -200,31 +204,31 @@ export function handleOrderButtons(order) {
|
||||||
* @param afterSale 售后
|
* @param afterSale 售后
|
||||||
*/
|
*/
|
||||||
export function formatAfterSaleStatus(afterSale) {
|
export function formatAfterSaleStatus(afterSale) {
|
||||||
if (afterSale.status === 10) {
|
if (afterSale.status === 10) {
|
||||||
return '申请售后';
|
return '申请售后';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 20) {
|
if (afterSale.status === 20) {
|
||||||
return '商品待退货';
|
return '商品待退货';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 30) {
|
if (afterSale.status === 30) {
|
||||||
return '商家待收货';
|
return '商家待收货';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 40) {
|
if (afterSale.status === 40) {
|
||||||
return '等待退款';
|
return '等待退款';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 50) {
|
if (afterSale.status === 50) {
|
||||||
return '退款成功';
|
return '退款成功';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 61) {
|
if (afterSale.status === 61) {
|
||||||
return '买家取消';
|
return '买家取消';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 62) {
|
if (afterSale.status === 62) {
|
||||||
return '商家拒绝';
|
return '商家拒绝';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 63) {
|
if (afterSale.status === 63) {
|
||||||
return '商家拒收货';
|
return '商家拒收货';
|
||||||
}
|
}
|
||||||
return '未知状态';
|
return '未知状态';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,31 +237,31 @@ export function formatAfterSaleStatus(afterSale) {
|
||||||
* @param afterSale 售后
|
* @param afterSale 售后
|
||||||
*/
|
*/
|
||||||
export function formatAfterSaleStatusDescription(afterSale) {
|
export function formatAfterSaleStatusDescription(afterSale) {
|
||||||
if (afterSale.status === 10) {
|
if (afterSale.status === 10) {
|
||||||
return '退款申请待商家处理';
|
return '退款申请待商家处理';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 20) {
|
if (afterSale.status === 20) {
|
||||||
return '请退货并填写物流信息';
|
return '请退货并填写物流信息';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 30) {
|
if (afterSale.status === 30) {
|
||||||
return '退货退款申请待商家处理';
|
return '退货退款申请待商家处理';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 40) {
|
if (afterSale.status === 40) {
|
||||||
return '等待退款';
|
return '等待退款';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 50) {
|
if (afterSale.status === 50) {
|
||||||
return '退款成功';
|
return '退款成功';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 61) {
|
if (afterSale.status === 61) {
|
||||||
return '退款关闭';
|
return '退款关闭';
|
||||||
}
|
}
|
||||||
if (afterSale.status === 62) {
|
if (afterSale.status === 62) {
|
||||||
return `商家不同意退款申请,拒绝原因:${afterSale.auditReason}`;
|
return `商家不同意退款申请,拒绝原因:${afterSale.auditReason}`;
|
||||||
}
|
}
|
||||||
if (afterSale.status === 63) {
|
if (afterSale.status === 63) {
|
||||||
return `商家拒绝收货,不同意退款,拒绝原因:${afterSale.auditReason}`;
|
return `商家拒绝收货,不同意退款,拒绝原因:${afterSale.auditReason}`;
|
||||||
}
|
}
|
||||||
return '未知状态';
|
return '未知状态';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -266,15 +270,15 @@ export function formatAfterSaleStatusDescription(afterSale) {
|
||||||
* @param afterSale 售后
|
* @param afterSale 售后
|
||||||
*/
|
*/
|
||||||
export function handleAfterSaleButtons(afterSale) {
|
export function handleAfterSaleButtons(afterSale) {
|
||||||
afterSale.buttons = [];
|
afterSale.buttons = [];
|
||||||
if ([10, 20, 30].includes(afterSale.status)) {
|
if ([10, 20, 30].includes(afterSale.status)) {
|
||||||
// 取消订单
|
// 取消订单
|
||||||
afterSale.buttons.push('cancel');
|
afterSale.buttons.push('cancel');
|
||||||
}
|
}
|
||||||
if (afterSale.status === 20) {
|
if (afterSale.status === 20) {
|
||||||
// 退货信息
|
// 退货信息
|
||||||
afterSale.buttons.push('delivery');
|
afterSale.buttons.push('delivery');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -284,28 +288,28 @@ export function handleAfterSaleButtons(afterSale) {
|
||||||
* @return {{s: string, ms: number, h: string, m: string}} 持续时间
|
* @return {{s: string, ms: number, h: string, m: string}} 持续时间
|
||||||
*/
|
*/
|
||||||
export function useDurationTime(toTime, fromTime = '') {
|
export function useDurationTime(toTime, fromTime = '') {
|
||||||
toTime = getDayjsTime(toTime);
|
toTime = getDayjsTime(toTime);
|
||||||
if (fromTime === '') {
|
if (fromTime === '') {
|
||||||
fromTime = dayjs();
|
fromTime = dayjs();
|
||||||
}
|
}
|
||||||
let duration = ref(toTime - fromTime);
|
let duration = ref(toTime - fromTime);
|
||||||
if (duration.value > 0) {
|
if (duration.value > 0) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (duration.value > 0) {
|
if (duration.value > 0) {
|
||||||
duration.value -= 1000;
|
duration.value -= 1000;
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
let durationTime = dayjs.duration(duration.value);
|
let durationTime = dayjs.duration(duration.value);
|
||||||
return {
|
return {
|
||||||
h: (durationTime.months() * 30 * 24 + durationTime.days() * 24 + durationTime.hours())
|
h: (durationTime.months() * 30 * 24 + durationTime.days() * 24 + durationTime.hours())
|
||||||
.toString()
|
.toString()
|
||||||
.padStart(2, '0'),
|
.padStart(2, '0'),
|
||||||
m: durationTime.minutes().toString().padStart(2, '0'),
|
m: durationTime.minutes().toString().padStart(2, '0'),
|
||||||
s: durationTime.seconds().toString().padStart(2, '0'),
|
s: durationTime.seconds().toString().padStart(2, '0'),
|
||||||
ms: durationTime.$ms,
|
ms: durationTime.$ms,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -314,19 +318,19 @@ export function useDurationTime(toTime, fromTime = '') {
|
||||||
* @return {dayjs.Dayjs}
|
* @return {dayjs.Dayjs}
|
||||||
*/
|
*/
|
||||||
function getDayjsTime(time) {
|
function getDayjsTime(time) {
|
||||||
time = time.toString();
|
time = time.toString();
|
||||||
if (time.indexOf('-') > 0) {
|
if (time.indexOf('-') > 0) {
|
||||||
// 'date'
|
// 'date'
|
||||||
return dayjs(time);
|
return dayjs(time);
|
||||||
}
|
}
|
||||||
if (time.length > 10) {
|
if (time.length > 10) {
|
||||||
// 'timestamp'
|
// 'timestamp'
|
||||||
return dayjs(parseInt(time));
|
return dayjs(parseInt(time));
|
||||||
}
|
}
|
||||||
if (time.length === 10) {
|
if (time.length === 10) {
|
||||||
// 'unixTime'
|
// 'unixTime'
|
||||||
return dayjs.unix(parseInt(time));
|
return dayjs.unix(parseInt(time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -336,7 +340,7 @@ function getDayjsTime(time) {
|
||||||
* @returns {string} 元,例如说 1.00 元
|
* @returns {string} 元,例如说 1.00 元
|
||||||
*/
|
*/
|
||||||
export function fen2yuan(price) {
|
export function fen2yuan(price) {
|
||||||
return (price / 100.0).toFixed(2);
|
return (price / 100.0).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -354,55 +358,92 @@ export function fen2yuan(price) {
|
||||||
* @param skus 商品 SKU 数组
|
* @param skus 商品 SKU 数组
|
||||||
*/
|
*/
|
||||||
export function convertProductPropertyList(skus) {
|
export function convertProductPropertyList(skus) {
|
||||||
let result = [];
|
let result = [];
|
||||||
for (const sku of skus) {
|
for (const sku of skus) {
|
||||||
if (!sku.properties) {
|
if (!sku.properties) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (const property of sku.properties) {
|
for (const property of sku.properties) {
|
||||||
// ① 先处理属性
|
// ① 先处理属性
|
||||||
let resultProperty = result.find((item) => item.id === property.propertyId);
|
let resultProperty = result.find((item) => item.id === property.propertyId);
|
||||||
if (!resultProperty) {
|
if (!resultProperty) {
|
||||||
resultProperty = {
|
resultProperty = {
|
||||||
id: property.propertyId,
|
id: property.propertyId,
|
||||||
name: property.propertyName,
|
name: property.propertyName,
|
||||||
values: [],
|
values: [],
|
||||||
};
|
};
|
||||||
result.push(resultProperty);
|
result.push(resultProperty);
|
||||||
}
|
}
|
||||||
// ② 再处理属性值
|
// ② 再处理属性值
|
||||||
let resultValue = resultProperty.values.find((item) => item.id === property.valueId);
|
let resultValue = resultProperty.values.find((item) => item.id === property.valueId);
|
||||||
if (!resultValue) {
|
if (!resultValue) {
|
||||||
resultProperty.values.push({
|
resultProperty.values.push({
|
||||||
id: property.valueId,
|
id: property.valueId,
|
||||||
name: property.valueName,
|
name: property.valueName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function appendSettlementProduct(spus, settlementInfos) {
|
export function appendSettlementProduct(spus, settlementInfos) {
|
||||||
if (!settlementInfos || settlementInfos.length === 0) {
|
if (!settlementInfos || settlementInfos.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const spu of spus) {
|
for (const spu of spus) {
|
||||||
const settlementInfo = settlementInfos.find((info) => info.spuId === spu.id);
|
const settlementInfo = settlementInfos.find((info) => info.spuId === spu.id);
|
||||||
if (!settlementInfo) {
|
if (!settlementInfo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 选择价格最小的 SKU 设置到 SPU 上
|
// 选择价格最小的 SKU 设置到 SPU 上
|
||||||
const settlementSku = settlementInfo.skus
|
const settlementSku = settlementInfo.skus
|
||||||
.filter((sku) => sku.promotionPrice > 0)
|
.filter((sku) => sku.promotionPrice > 0)
|
||||||
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr));
|
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr));
|
||||||
if (settlementSku) {
|
if (settlementSku) {
|
||||||
spu.promotionType = settlementSku.promotionType;
|
spu.promotionType = settlementSku.promotionType;
|
||||||
spu.promotionPrice = settlementSku.promotionPrice;
|
spu.promotionPrice = settlementSku.promotionPrice;
|
||||||
}
|
}
|
||||||
// 设置【满减送】活动
|
// 设置【满减送】活动
|
||||||
if (settlementInfo.rewardActivity) {
|
if (settlementInfo.rewardActivity) {
|
||||||
spu.rewardActivity = settlementInfo.rewardActivity;
|
spu.rewardActivity = settlementInfo.rewardActivity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//处理促销信息
|
||||||
|
export function handeleData(array) {
|
||||||
|
const array2 = ref([{
|
||||||
|
name: '满减',
|
||||||
|
value: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '赠品',
|
||||||
|
value: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '包邮',
|
||||||
|
value: []
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
array.forEach(item => {
|
||||||
|
Object.entries(item).forEach(([key, value]) => {
|
||||||
|
const type = parseInt(key);
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
array2.value[0].value.push(value); // 满减
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
array2.value[1].value.push(value); // 满送
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
array2.value[2].value.push(value); // 包邮
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return array2
|
||||||
|
}
|
Loading…
Reference in New Issue