Merge branch 'develop' of https://gitee.com/yudaocode/yudao-mall-uniapp
# Conflicts: # pages/activity/point/list.vue
This commit is contained in:
@@ -15,9 +15,9 @@ const KeFuApi = {
|
||||
},
|
||||
});
|
||||
},
|
||||
getKefuMessagePage: (params) => {
|
||||
getKefuMessageList: (params) => {
|
||||
return request({
|
||||
url: '/promotion/kefu-message/page',
|
||||
url: '/promotion/kefu-message/list',
|
||||
method: 'GET',
|
||||
params,
|
||||
custom: {
|
||||
|
||||
@@ -6,6 +6,9 @@ const TradeConfigApi = {
|
||||
return request({
|
||||
url: `/trade/config/get`,
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showLoading: false,
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -35,6 +35,9 @@ const OrderApi = {
|
||||
if (!(data.pointActivityId > 0)) {
|
||||
delete data2.pointActivityId;
|
||||
}
|
||||
if (!(data.deliveryType > 0)) {
|
||||
delete data2.deliveryType;
|
||||
}
|
||||
// 解决 SpringMVC 接受 List<Item> 参数的问题
|
||||
delete data2.items;
|
||||
for (let i = 0; i < data.items.length; i++) {
|
||||
|
||||
@@ -57,8 +57,9 @@
|
||||
<view class="ss-m-b-24 cotBu-txt">
|
||||
{{
|
||||
item.validityType == 1
|
||||
? sheep.$helper.timeFormat(item.validStartTime, 'yyyy.mm.dd') -
|
||||
sheep.$helper.timeFormat(item.validEndTime, 'yyyy.mm.dd')
|
||||
? sheep.$helper.timeFormat(item.validStartTime, 'yyyy-mm-dd') +
|
||||
'-' +
|
||||
sheep.$helper.timeFormat(item.validEndTime, 'yyyy-mm-dd')
|
||||
: '领取后' + item.fixedStartTerm + '-' + item.fixedEndTerm + '天可用'
|
||||
}}
|
||||
</view>
|
||||
|
||||
@@ -1,108 +1,111 @@
|
||||
<!-- 装修商品组件:标题栏 -->
|
||||
<template>
|
||||
<view class="ss-title-wrap ss-flex ss-col-center" :class="[state.typeMap[data.textAlign]]" :style="[bgStyle, { marginLeft: `${data.space}px` }]">
|
||||
<view class="title-content">
|
||||
<!-- 主标题 -->
|
||||
<view v-if="data.title" class="title-text" :style="[titleStyles]">{{ data.title }}</view>
|
||||
<!-- 副标题 -->
|
||||
<view v-if="data.description" :style="[descStyles]" class="sub-title-text">{{ data.description }}</view>
|
||||
</view>
|
||||
<!-- 查看更多 -->
|
||||
<view v-if="data.more?.show" class="more-box ss-flex ss-col-center" @tap="sheep.$router.go(data.more.url)"
|
||||
:style="{color: data.descriptionColor}">
|
||||
<view class="more-text" v-if="data.more.type !== 'icon'">{{ data.more.text }} </view>
|
||||
<text class="_icon-forward" v-if="data.more.type !== 'text'"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="ss-title-wrap ss-flex ss-col-center"
|
||||
:class="[state.typeMap[data.textAlign]]"
|
||||
:style="[bgStyle, { marginLeft: `${data.space}px` }]"
|
||||
>
|
||||
<view class="title-content">
|
||||
<!-- 主标题 -->
|
||||
<view v-if="data.title" class="title-text" :style="[titleStyles]">{{ data.title }}</view>
|
||||
<!-- 副标题 -->
|
||||
<view v-if="data.description" :style="[descStyles]" class="sub-title-text">{{
|
||||
data.description
|
||||
}}</view>
|
||||
</view>
|
||||
<!-- 查看更多 -->
|
||||
<view
|
||||
v-if="data.more?.show"
|
||||
class="more-box ss-flex ss-col-center"
|
||||
@tap="sheep.$router.go(data.more.url)"
|
||||
:style="{ color: data.descriptionColor }"
|
||||
>
|
||||
<view class="more-text" v-if="data.more.type !== 'icon'">{{ data.more.text }} </view>
|
||||
<text class="_icon-forward" v-if="data.more.type !== 'text'"></text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* 标题栏
|
||||
*/
|
||||
import {
|
||||
reactive,
|
||||
computed
|
||||
} from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
/**
|
||||
* 标题栏
|
||||
*/
|
||||
import { reactive, computed } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
// 数据
|
||||
const state = reactive({
|
||||
typeMap: {
|
||||
left: 'ss-row-left',
|
||||
center: 'ss-row-center',
|
||||
},
|
||||
});
|
||||
// 数据
|
||||
const state = reactive({
|
||||
typeMap: {
|
||||
left: 'ss-row-left',
|
||||
center: 'ss-row-center',
|
||||
},
|
||||
});
|
||||
|
||||
// 接收参数
|
||||
const props = defineProps({
|
||||
// 装修数据
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
// 装修样式
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
// 设置背景样式
|
||||
const bgStyle = computed(() => {
|
||||
// 直接从 props.styles 解构
|
||||
const {
|
||||
bgType,
|
||||
bgImg,
|
||||
bgColor
|
||||
} = props.styles;
|
||||
// 接收参数
|
||||
const props = defineProps({
|
||||
// 装修数据
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
// 装修样式
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
// 设置背景样式
|
||||
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
|
||||
};
|
||||
});
|
||||
// 根据 bgType 返回相应的样式
|
||||
return {
|
||||
background: bgType === 'img' ? `url(${bgImg}) no-repeat top center / 100% 100%` : bgColor,
|
||||
};
|
||||
});
|
||||
|
||||
// 标题样式
|
||||
const titleStyles = {
|
||||
color: props.data.titleColor,
|
||||
fontSize: `${props.data.titleSize}px`,
|
||||
textAlign: props.data.textAlign
|
||||
};
|
||||
// 标题样式
|
||||
const titleStyles = {
|
||||
color: props.data.titleColor,
|
||||
fontSize: `${props.data.titleSize}px`,
|
||||
textAlign: props.data.textAlign,
|
||||
};
|
||||
|
||||
// 副标题
|
||||
const descStyles = {
|
||||
color: props.data.descriptionColor,
|
||||
textAlign: props.data.textAlign,
|
||||
fontSize: `${props.data.descriptionSize}px`,
|
||||
fontWeight: `${props.data.descriptionWeight}px`,
|
||||
};
|
||||
// 副标题
|
||||
const descStyles = {
|
||||
color: props.data.descriptionColor,
|
||||
textAlign: props.data.textAlign,
|
||||
fontSize: `${props.data.descriptionSize}px`,
|
||||
fontWeight: `${props.data.descriptionWeight}`,
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ss-title-wrap {
|
||||
height: 80rpx;
|
||||
position: relative;
|
||||
.ss-title-wrap {
|
||||
height: 80rpx;
|
||||
position: relative;
|
||||
|
||||
.title-content {
|
||||
.title-text {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
.title-content {
|
||||
.title-text {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.sub-title-text {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
.sub-title-text {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.more-box {
|
||||
white-space: nowrap;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
right: 20rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.more-box {
|
||||
white-space: nowrap;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
right: 20rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+56
-36
@@ -1,4 +1,4 @@
|
||||
import dayjs from "dayjs";
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
/**
|
||||
* 将一个整数转换为分数保留两位小数
|
||||
@@ -6,10 +6,10 @@ import dayjs from "dayjs";
|
||||
* @return {number} 分数
|
||||
*/
|
||||
export const formatToFraction = (num) => {
|
||||
if (typeof num === 'undefined') return 0
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
|
||||
return parseFloat((parsedNumber / 100).toFixed(2))
|
||||
}
|
||||
if (typeof num === 'undefined') return 0;
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num;
|
||||
return parseFloat((parsedNumber / 100).toFixed(2));
|
||||
};
|
||||
|
||||
/**
|
||||
* 将一个数转换为 1.00 这样
|
||||
@@ -19,26 +19,26 @@ export const formatToFraction = (num) => {
|
||||
* @return {string} 分数
|
||||
*/
|
||||
export const floatToFixed2 = (num) => {
|
||||
let str = '0.00'
|
||||
let str = '0.00';
|
||||
if (typeof num === 'undefined') {
|
||||
return str
|
||||
return str;
|
||||
}
|
||||
const f = formatToFraction(num)
|
||||
const decimalPart = f.toString().split('.')[1]
|
||||
const len = decimalPart ? decimalPart.length : 0
|
||||
const f = formatToFraction(num);
|
||||
const decimalPart = f.toString().split('.')[1];
|
||||
const len = decimalPart ? decimalPart.length : 0;
|
||||
switch (len) {
|
||||
case 0:
|
||||
str = f.toString() + '.00'
|
||||
break
|
||||
str = f.toString() + '.00';
|
||||
break;
|
||||
case 1:
|
||||
str = f.toString() + '.0'
|
||||
break
|
||||
str = f.toString() + '.0';
|
||||
break;
|
||||
case 2:
|
||||
str = f.toString()
|
||||
break
|
||||
str = f.toString();
|
||||
break;
|
||||
}
|
||||
return str
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
/**
|
||||
* 将一个分数转换为整数
|
||||
@@ -47,11 +47,11 @@ export const floatToFixed2 = (num) => {
|
||||
* @return {number} 整数
|
||||
*/
|
||||
export const convertToInteger = (num) => {
|
||||
if (typeof num === 'undefined') return 0
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
|
||||
if (typeof num === 'undefined') return 0;
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num;
|
||||
// TODO 分转元后还有小数则四舍五入
|
||||
return Math.round(parsedNumber * 100)
|
||||
}
|
||||
return Math.round(parsedNumber * 100);
|
||||
};
|
||||
|
||||
/**
|
||||
* 时间日期转换
|
||||
@@ -64,16 +64,16 @@ export const convertToInteger = (num) => {
|
||||
* @description format 季度 + 星期 + 几周:"YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ"
|
||||
* @returns {string} 返回拼接后的时间字符串
|
||||
*/
|
||||
export function formatDate(date, format= 'YYYY-MM-DD HH:mm:ss') {
|
||||
export function formatDate(date, format = 'YYYY-MM-DD HH:mm:ss') {
|
||||
// 日期不存在,则返回空
|
||||
if (!date) {
|
||||
return ''
|
||||
return '';
|
||||
}
|
||||
// 日期存在,则进行格式化
|
||||
if (format === undefined) {
|
||||
format = 'YYYY-MM-DD HH:mm:ss'
|
||||
format = 'YYYY-MM-DD HH:mm:ss';
|
||||
}
|
||||
return dayjs(date).format(format)
|
||||
return dayjs(date).format(format);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,16 +85,22 @@ export function formatDate(date, format= 'YYYY-MM-DD HH:mm:ss') {
|
||||
* @param {*} children 孩子节点字段 默认 'children'
|
||||
* @param {*} rootId 根Id 默认 0
|
||||
*/
|
||||
export function handleTree(data, id = 'id', parentId = 'parentId', children = 'children', rootId = 0) {
|
||||
export function handleTree(
|
||||
data,
|
||||
id = 'id',
|
||||
parentId = 'parentId',
|
||||
children = 'children',
|
||||
rootId = 0,
|
||||
) {
|
||||
// 对源数据深度克隆
|
||||
const cloneData = JSON.parse(JSON.stringify(data))
|
||||
const cloneData = JSON.parse(JSON.stringify(data));
|
||||
// 循环所有项
|
||||
const treeData = cloneData.filter(father => {
|
||||
let branchArr = cloneData.filter(child => {
|
||||
const treeData = cloneData.filter((father) => {
|
||||
let branchArr = cloneData.filter((child) => {
|
||||
//返回每一项的子级数组
|
||||
return father[id] === child[parentId]
|
||||
return father[id] === child[parentId];
|
||||
});
|
||||
branchArr.length > 0 ? father.children = branchArr : '';
|
||||
branchArr.length > 0 ? (father.children = branchArr) : '';
|
||||
//返回第一层
|
||||
return father[parentId] === rootId;
|
||||
});
|
||||
@@ -120,14 +126,28 @@ export function resetPagination(pagination) {
|
||||
* @param source 源对象
|
||||
*/
|
||||
export const copyValueToTarget = (target, source) => {
|
||||
const newObj = Object.assign({}, target, source)
|
||||
const newObj = Object.assign({}, target, source);
|
||||
// 删除多余属性
|
||||
Object.keys(newObj).forEach((key) => {
|
||||
// 如果不是target中的属性则删除
|
||||
if (Object.keys(target).indexOf(key) === -1) {
|
||||
delete newObj[key]
|
||||
delete newObj[key];
|
||||
}
|
||||
})
|
||||
});
|
||||
// 更新目标对象值
|
||||
Object.assign(target, newObj)
|
||||
Object.assign(target, newObj);
|
||||
};
|
||||
|
||||
/**
|
||||
* 解析 JSON 字符串
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
export function jsonParse(str) {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
console.error(`str[${str}] 不是一个 JSON 字符串`);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user