init
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<uni-popup ref="privacyPopup" type="center" :isMaskClick="false">
|
||||
<view class="privacy-modal">
|
||||
<view class="privacy-header">
|
||||
<!-- <view class="badge">S</view> -->
|
||||
<view class="privacy-title">隐私政策</view>
|
||||
</view>
|
||||
<scroll-view class="privacy-content" scroll-y="true">
|
||||
<view class="privacy-text">
|
||||
欢迎使用本应用,我们非常重视您的个人信息和隐私保护。在使用服务之前,请仔细阅读
|
||||
<text class="privacy-link" @click="goAgreement(1)">《隐私政策》</text>
|
||||
和
|
||||
<text class="privacy-link" @click="goAgreement(2)">《用户协议》</text>
|
||||
。我们将按照您同意的条款使用您的个人信息,以便为您提供服务。
|
||||
<text class="privacy-subtext">
|
||||
如您同意此政策,请点击“同意”开始使用我们的产品和服务;如您不同意,我们将无法为您提供完整服务。
|
||||
</text>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
<view class="privacy-actions">
|
||||
<view class="submit-btn" @click="agree"> 同意 </view>
|
||||
<!-- <button class="btn confirm" @click="agree">同意</button> -->
|
||||
<view class="cancel" @click="exitApp">不同意</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
|
||||
const privacyPopup = ref();
|
||||
const agree = () => {
|
||||
uni.setStorageSync('privacy_agreed', 1);
|
||||
uni.showTabBar();
|
||||
privacyPopup.value && privacyPopup.value.close();
|
||||
};
|
||||
const exitApp = () => {
|
||||
// #ifdef APP-PLUS
|
||||
uni.showTabBar();
|
||||
plus.runtime.quit();
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
uni.showTabBar();
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
// #endif
|
||||
};
|
||||
const goAgreement = (type) => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/agreement?type=' + type,
|
||||
});
|
||||
};
|
||||
onMounted(() => {
|
||||
const agreed = !!uni.getStorageSync('privacy_agreed');
|
||||
if (!agreed) {
|
||||
uni.hideTabBar();
|
||||
setTimeout(() => {
|
||||
privacyPopup.value && privacyPopup.value.open();
|
||||
}, 50);
|
||||
}
|
||||
});
|
||||
onUnmounted(() => {
|
||||
uni.showTabBar();
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.privacy-modal {
|
||||
// width: 620rpx;
|
||||
// max-height: 70vh;
|
||||
background: #ffffff;
|
||||
border-radius: 22rpx;
|
||||
overflow: hidden;
|
||||
margin: 0 80rpx;
|
||||
}
|
||||
|
||||
.privacy-header {
|
||||
padding-top: 36rpx;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.badge {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
margin: 0 auto;
|
||||
border-radius: 48rpx;
|
||||
background: linear-gradient(180deg, #e9f1ff 0%, #cfe0ff 100%);
|
||||
color: #366EEE;
|
||||
font-size: 42rpx;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
line-height: 96rpx;
|
||||
}
|
||||
|
||||
.privacy-title {
|
||||
text-align: center;
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
padding: 18rpx 24rpx 6rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.privacy-content {
|
||||
// max-height: 48vh;
|
||||
// margin: 8rpx 28rpx 0;
|
||||
|
||||
}
|
||||
|
||||
.privacy-text {
|
||||
font-size: 26rpx;
|
||||
line-height: 42rpx;
|
||||
color: #666;
|
||||
margin: 0 40rpx 12rpx;
|
||||
}
|
||||
|
||||
.privacy-subtext {
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.privacy-link {
|
||||
color: #366EEE;
|
||||
// text-decoration: underline;
|
||||
}
|
||||
|
||||
.privacy-actions {
|
||||
margin: 28rpx 40rpx;
|
||||
|
||||
.btn {
|
||||
height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
// .submit-btn{
|
||||
// height: 88rpx;
|
||||
// border-radius: 12rpx;
|
||||
// text-align: center;
|
||||
// line-height: 88rpx;
|
||||
// color: #fff;
|
||||
// background: linear-gradient(90deg,#FFA65B 0%, #366EEE 100%);
|
||||
// }
|
||||
|
||||
.cancel {
|
||||
color: #666;
|
||||
font-size: 26rpx;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,388 @@
|
||||
<template>
|
||||
<view class="flex-row card" @click="goDetail(props.data)">
|
||||
<view
|
||||
class="image m-r-16 shrink"
|
||||
:class="{ w_180: props.source === 3, h_180: props.source === 3 }"
|
||||
>
|
||||
<image :src="props.data.picUrl" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="flex1 flex-column ju-between">
|
||||
<view>
|
||||
<view class="lineTwo size28 f500 m-b-14">
|
||||
{{ props.source === 3 || props.source === 1 ? props.data.spuName : props.data.name }}
|
||||
</view>
|
||||
<view class="flex-center m-t-14 m-b-14" v-if="props.source === 0">
|
||||
<view class="flex1 m-r-28 progressCard card1">
|
||||
<view class="progress"></view>
|
||||
<view
|
||||
class="progress1"
|
||||
:style="{
|
||||
width:
|
||||
Math.ceil(
|
||||
(props.data.sales / (props.data.stocks + props.data.sales)) * 100,
|
||||
).toFixed(0) + '%',
|
||||
}"
|
||||
></view>
|
||||
<view class="progressText size20 line28"
|
||||
>{{
|
||||
Math.ceil(
|
||||
(props.data.sales / (props.data.stocks + props.data.sales)) * 100,
|
||||
).toFixed(0)
|
||||
}}%</view
|
||||
>
|
||||
</view>
|
||||
<view class="stockText size24">存量:{{ props.data.stocks }}</view>
|
||||
</view>
|
||||
<view
|
||||
class="flex-center ju-flex-start"
|
||||
v-if="props.source === 0"
|
||||
:style="{ opacity: show ? 0 : 1 }"
|
||||
>
|
||||
<view class="size24 m-r-10">
|
||||
距离<span class="c15">本场{{ timeText }}</span
|
||||
>仅剩
|
||||
</view>
|
||||
<uni-countdown
|
||||
color="#FFFFFF"
|
||||
background-color="#FF393A"
|
||||
border-color="#FF393A"
|
||||
:show-day="false"
|
||||
:hour="hour"
|
||||
:minute="minute"
|
||||
:second="second"
|
||||
@timeup="timeup"
|
||||
></uni-countdown>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center ju-flex-start">
|
||||
<view class="ai-button3 w_110 line38 h_38 radius8 m-t-8 m-b-14 m-r-20" v-if="props.source === 1">
|
||||
{{ formatOrderStatus(props.data) }}
|
||||
</view>
|
||||
<view class="ai-button3 w_92 line38 h_38 radius8 m-t-8 m-b-14" v-if="props.source === 1"
|
||||
:class="{'c12 border12':!props.data?.items1[0]?.saleStatus}">
|
||||
{{ props.data?.items1[0]?.saleStatus ? '已上架' : '已下架' }}
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="m-b-12 size24 h_52" v-for="(item, i) in props.data.skuArr" :key="i">
|
||||
<view
|
||||
class="flex1 flex-center ju-between h_52 bg18 radius8 p-l-8 p-r-16"
|
||||
v-if="item?.properties"
|
||||
>
|
||||
<view class="lineOne c19">
|
||||
{{ item?.properties.length > 1 ? item?.propertyText : item?.properties[0].valueName }}
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<view class="c19">x{{ item.count }}</view>
|
||||
<view class="size28 m-l-12 weight900"
|
||||
>¥<span class="">{{
|
||||
fen2yuan(item.discountedPrice ? item.discountedPrice : item.price)
|
||||
}}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between">
|
||||
<view class="flex-row al-flex-end">
|
||||
<view class="c13 size28 weight900"
|
||||
>¥
|
||||
<span class="size38" v-if="props.source == 1">{{ fen2yuan(props.data.price) }}</span>
|
||||
<span class="size38" v-else-if="props.source == 3">{{
|
||||
fen2yuan(
|
||||
props.data.discountedTotalPrice
|
||||
? props.data.discountedTotalPrice
|
||||
: props.data.totalPrice,
|
||||
)
|
||||
}}</span>
|
||||
<span class="size38" v-else>
|
||||
{{
|
||||
fen2yuan(props.data.discountedPrice ? props.data.discountedPrice : props.data.price)
|
||||
}}
|
||||
</span>
|
||||
</view>
|
||||
<!-- <view class="through c12 m-l-8 size20" v-if="!props.source"
|
||||
>¥{{
|
||||
fen2yuan(
|
||||
props.data.discountedPrice
|
||||
? props.data.price
|
||||
: props.data.totalPrice,
|
||||
)
|
||||
}}</view
|
||||
> -->
|
||||
<view class="through c12 m-l-8 size20" v-if="props.source == 3"
|
||||
>¥{{
|
||||
fen2yuan(props.data.discountedTotalPrice ? props.data.price : props.data.totalPrice)
|
||||
}}</view
|
||||
>
|
||||
</view>
|
||||
<view v-if="props.source === 0 && timeText !== '开始'">
|
||||
<uni-badge :text="props.data.cartCount" absolute="rightTop" :offset="[8, 3]">
|
||||
<view class="ai-button1 w_144" style="color: #fff" @click.stop="addCar">选规格</view>
|
||||
</uni-badge>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="props.source === 1" class="flex-center ju-flex-end m-t-12">
|
||||
<view
|
||||
class="ai-button3 w_144 m-r-10"
|
||||
@click.stop="delayShipment(props.data)"
|
||||
v-if="props.data.status === 10"
|
||||
>延迟发货</view
|
||||
>
|
||||
<view
|
||||
class="ai-button3 w_144 m-r-10"
|
||||
@click.stop="nowShipment(props.data)"
|
||||
v-if="props.data.status === 50"
|
||||
>立即发货
|
||||
</view>
|
||||
<view class="ai-button3 w_144" @click.stop="goInfo">查看订单</view>
|
||||
<view class="ai-button1 w_144 m-l-16" v-if="props.data.status === 20" @click.stop="confirm"
|
||||
>确认收货</view
|
||||
>
|
||||
<view class="ai-button1 w_144 m-l-16" v-if="props.data.status === 0" @click.stop="goPay"
|
||||
>去支付</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { ref, onMounted, getCurrentInstance, defineProps, watch } from 'vue';
|
||||
import { formatOrderStatus } from '@/sheep/hooks/useGoods';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
source: {
|
||||
//0选品广场 1我的店铺 3订单
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
idName: {
|
||||
type: String,
|
||||
default: 'id',
|
||||
},
|
||||
});
|
||||
let timeText = ref('结束');
|
||||
let hour = ref(0);
|
||||
let minute = ref(0);
|
||||
let second = ref(0);
|
||||
let show = ref(false);
|
||||
const timeup = () => {
|
||||
show.value = true;
|
||||
timeChange();
|
||||
};
|
||||
const timeChange = () => {
|
||||
show.value = false;
|
||||
let data = props.data;
|
||||
let endTime = data.endTime;
|
||||
let startTime = data.startTime;
|
||||
// 当前时间戳
|
||||
let currentTime = Date.now();
|
||||
let time = null;
|
||||
if (currentTime < startTime) {
|
||||
timeText.value = '开始';
|
||||
time = startTime - currentTime;
|
||||
} else if (currentTime > startTime && currentTime < endTime) {
|
||||
timeText.value = '结束';
|
||||
time = endTime - currentTime;
|
||||
} else {
|
||||
show.value = true;
|
||||
timeText.value = '已结束';
|
||||
}
|
||||
if (time) {
|
||||
hour.value = Math.floor(time / 1000 / 60 / 60);
|
||||
minute.value = Math.floor(time / 1000 / 60) % 60;
|
||||
second.value = Math.floor(time / 1000) % 60;
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.data,
|
||||
() => {
|
||||
timeChange();
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
//延迟发货
|
||||
function delayShipment(e) {
|
||||
uni.showModal({
|
||||
title: '延迟发货',
|
||||
content: '请您确认是否暂时不需要发货,确认后该产品将为您安排延迟发货',
|
||||
confirmColor: '#FA7E31',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
api
|
||||
.aiDelayedShipment({
|
||||
id: e.orderId,
|
||||
status: 50,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
proxy.$emit('shipment');
|
||||
}
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
//立即发货
|
||||
function nowShipment(e) {
|
||||
uni.showModal({
|
||||
title: '立即发货',
|
||||
content: '请您确认是否需要立即发货,确认后将尽快为您安排发货',
|
||||
confirmColor: '#FA7E31',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
api
|
||||
.aiPendingShipment({
|
||||
id: e.orderId,
|
||||
status: 10,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
proxy.$emit('shipment');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
function getPrice(source, data) {
|
||||
// console.log(source, data);
|
||||
if (source === 3) {
|
||||
return props.data.totalPrice;
|
||||
} else if (source === 1) {
|
||||
return props.data.payPrice;
|
||||
} else {
|
||||
return props.data.price;
|
||||
}
|
||||
}
|
||||
const addCar = () => {
|
||||
proxy.$emit('addCar', props.data);
|
||||
};
|
||||
const goInfo = () => {
|
||||
let id = props.data.orderId;
|
||||
// if (props.source === 1) {
|
||||
// id = props.data.spu.id;
|
||||
// }
|
||||
proxy.utils.go('/pages/AI/orderInfo', {
|
||||
id: id,
|
||||
});
|
||||
};
|
||||
// 确认收货
|
||||
const confirm = () => {
|
||||
api
|
||||
.confirmReceive({
|
||||
id: props.data.orderId,
|
||||
})
|
||||
.then(() => {
|
||||
proxy.$emit('update');
|
||||
});
|
||||
};
|
||||
// 去支付
|
||||
const goPay = () => {
|
||||
proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
id: props.data.orderId,
|
||||
payOrderId: props.data.spuId,
|
||||
});
|
||||
};
|
||||
|
||||
function goDetail(e) {
|
||||
if (props.source == 3) return;
|
||||
proxy.utils.go('/pages/AI/comDetails', {
|
||||
id: e[props.idName],
|
||||
shopId: e.shoppingPlazaId || e.roundTimeId,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.card {
|
||||
background: #ffefe5;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 248rpx;
|
||||
height: 248rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.stockText {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.progressCard {
|
||||
position: relative;
|
||||
height: 28rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.progress,
|
||||
.progress1 {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 28rpx;
|
||||
background-color: #7a7995;
|
||||
opacity: 0.3;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
|
||||
.progressText {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 14rpx;
|
||||
}
|
||||
|
||||
.progress {
|
||||
}
|
||||
|
||||
.progress1 {
|
||||
width: 0%;
|
||||
background: linear-gradient(90deg, #f7772e 0%, #ee0a24 98%),
|
||||
linear-gradient(96deg, #f7772e 10%, #ee0a24 126%), #fa7e31;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.uni-badge) {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
:deep(.uni-countdown__number) {
|
||||
font-size: 20rpx !important;
|
||||
width: 32rpx !important;
|
||||
height: 32rpx !important;
|
||||
line-height: 32rpx !important;
|
||||
}
|
||||
|
||||
:deep(.uni-countdown__splitor) {
|
||||
color: #ff393a !important;
|
||||
}
|
||||
|
||||
.card {
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<l-echart ref="chartRef"></l-echart>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, onBeforeUnmount, nextTick, watch } from 'vue';
|
||||
import * as echarts from 'echarts';
|
||||
|
||||
const chartRef = ref(null)
|
||||
const myChart = ref(null)
|
||||
|
||||
const props = defineProps({
|
||||
options: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
});
|
||||
|
||||
// 初始化图表
|
||||
const initChart = async () => {
|
||||
if (!chartRef.value) return
|
||||
|
||||
// 初始化echart
|
||||
myChart.value = await chartRef.value.init(echarts)
|
||||
|
||||
// 默认获取容器尺寸
|
||||
myChart.value.resize();
|
||||
|
||||
// 设置true清空echart缓存
|
||||
myChart.value?.setOption(props.options, true);
|
||||
}
|
||||
|
||||
|
||||
// 监听图表数据时候变化,重新渲染图表
|
||||
watch(
|
||||
() => props.options,
|
||||
() => {
|
||||
nextTick(() => {
|
||||
initChart();
|
||||
});
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 页面挂载,开始绘制图表
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
initChart();
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// 组件销毁时销毁图表实例
|
||||
onBeforeUnmount(() => {
|
||||
if (myChart.value) {
|
||||
echarts.dispose(myChart.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,392 @@
|
||||
<!-- 收货地址的新增/编辑 -->
|
||||
<template>
|
||||
<view class="cardEdit" style="position: relative">
|
||||
<view>
|
||||
<view class="title" :class="props.theme == 2 ? 'c0' : ''">添加收货地址</view>
|
||||
</view>
|
||||
<view class="close" @click="onColse">
|
||||
<image :src="$url + 'home/closee.svg'" mode="scaleToFill" />
|
||||
</view>
|
||||
<view>
|
||||
<view class="flex-center w100 h_108 border-top p-x-28" v-for="(v, i) in arr" :key="i"
|
||||
:class="{'ju-between': v.type == 'switch'}">
|
||||
<view class="m-r-20 w_180" style="text-align: left;">{{ v.name }}</view>
|
||||
<view @click="regionClick(v)" class="flex1 flex-center" :class="{'ju-flex-end': v.type == 'switch'}">
|
||||
<uni-easyinput :type="v.typeName || 'text'" class="flex1 h100"
|
||||
v-if="v.type == 'input'" v-model="state.model[v.value]"
|
||||
:placeholder="v.placeholder" :inputBorder="false"
|
||||
placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
|
||||
:maxlength="v.max" :disabled="v.disabled"/>
|
||||
<view v-if="v.type == 'select'" :style="{color: state.model[v.value]?'#333333':'#BBBBBB'}" style="font-size:30rpx;font-weight:400;line-height:normal;text-align: left;width: 100%">{{state.model[v.value] || v.placeholder}}</view>
|
||||
<su-switch v-if="v.type == 'switch'" style="transform: scale(0.8)"
|
||||
v-model="state.model.defaultStatus" />
|
||||
<uni-icons v-if="v.value == 'areaName'" type="right" :color="props.theme == 2 ? '#ffffff' : ''" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-top p-x-28 c35" style="text-align: left;">{{messText}}</view>
|
||||
<view class="btn p-x-28">
|
||||
<button class="add-btn" :class="props.theme == 2 ? 'ai-button2' : ''" @tap="onSave">保存</button>
|
||||
</view>
|
||||
|
||||
<!-- 省市区弹窗 -->
|
||||
<su-region-picker :show="state.showRegion" @cancel="state.showRegion = false" @confirm="onRegionConfirm" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
unref
|
||||
} from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app';
|
||||
import _ from 'lodash-es';
|
||||
import {
|
||||
mobile
|
||||
} from '@/sheep/validate/form';
|
||||
import AreaApi from '@/sheep/api/system/area';
|
||||
import AddressApi from '@/sheep/api/member/address';
|
||||
let emit = defineEmits(['close']);
|
||||
let messText = ref('')
|
||||
let props = defineProps({
|
||||
theme: {
|
||||
type: Number,
|
||||
default: 2,
|
||||
},
|
||||
});
|
||||
let arr = ref([{
|
||||
name: '收货人',
|
||||
value: 'name',
|
||||
type: 'input',
|
||||
typeName: 'text',
|
||||
placeholder: '请输入收货人姓名',
|
||||
},
|
||||
{
|
||||
name: '手机号',
|
||||
value: 'mobile',
|
||||
type: 'input',
|
||||
max: 11,
|
||||
typeName: 'number',
|
||||
placeholder: '请输入手机号',
|
||||
},
|
||||
{
|
||||
name: '省市区',
|
||||
value: 'areaName',
|
||||
type: 'select',
|
||||
placeholder: '请选择省市区',
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
name: '详细地址',
|
||||
value: 'detailAddress',
|
||||
type: 'input',
|
||||
typeName: 'text',
|
||||
placeholder: '请输入详细地址',
|
||||
},
|
||||
{
|
||||
name: '默认地址',
|
||||
value: 'defaultStatus',
|
||||
type: 'switch',
|
||||
},
|
||||
]);
|
||||
const addressFormRef = ref(null);
|
||||
const state = reactive({
|
||||
showRegion: false,
|
||||
model: {
|
||||
name: '',
|
||||
mobile: '',
|
||||
detailAddress: '',
|
||||
defaultStatus: false,
|
||||
areaName: '',
|
||||
},
|
||||
rules: {},
|
||||
});
|
||||
|
||||
const rules = {
|
||||
name: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入收货人姓名',
|
||||
}, ],
|
||||
},
|
||||
mobile: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入手机号',
|
||||
}, ],
|
||||
},
|
||||
areaName: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请选择您的位置',
|
||||
}, ],
|
||||
},
|
||||
detailAddress: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入详细地址',
|
||||
}, ],
|
||||
},
|
||||
};
|
||||
|
||||
// 确认选择地区
|
||||
const onRegionConfirm = (e) => {
|
||||
state.model.areaName = `${e.province_name} ${e.city_name} ${e.district_name} ${e.street_name}`;
|
||||
state.model.areaId = e.street_id;
|
||||
state.showRegion = false;
|
||||
};
|
||||
|
||||
// 获得地区数据
|
||||
const getAreaData = () => {
|
||||
if (_.isEmpty(uni.getStorageSync('areaData'))) {
|
||||
AreaApi.getAreaTree().then((res) => {
|
||||
if (res.code === 0) {
|
||||
uni.setStorageSync('areaData', res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 保存收货地址
|
||||
const onSave = async () => {
|
||||
// 参数校验
|
||||
for (const key in rules) {
|
||||
if (!state.model[key]) {
|
||||
// messText.value = rules[key].rules[0].errorMessage
|
||||
uni.showToast({
|
||||
title: rules[key].rules[0].errorMessage,
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(state.model.mobile)) {
|
||||
uni.showToast({
|
||||
title: '请填写正确的手机号',
|
||||
icon: 'none',
|
||||
});
|
||||
// messText.value = '请填写正确的手机号'
|
||||
return;
|
||||
}
|
||||
// messText.value = ""
|
||||
|
||||
// 提交请求
|
||||
const formData = {
|
||||
...state.model,
|
||||
};
|
||||
const {
|
||||
code
|
||||
} =
|
||||
state.model.id > 0 ?
|
||||
await AddressApi.updateAddress(formData) :
|
||||
await AddressApi.createAddress(formData);
|
||||
if (code === 0) {
|
||||
emit('close');
|
||||
}
|
||||
};
|
||||
|
||||
// 删除收货地址
|
||||
const onDelete = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认删除此收货地址吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function(res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
const {
|
||||
code
|
||||
} = await AddressApi.deleteAddress(state.model.id);
|
||||
if (code === 0) {
|
||||
sheep.$router.back();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
const onEdit = async (id) => {
|
||||
let {
|
||||
code,
|
||||
data
|
||||
} = await AddressApi.getAddress(id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.model = data;
|
||||
};
|
||||
onLoad(async (options) => {
|
||||
// 获得地区数据
|
||||
getAreaData();
|
||||
// 情况一:基于 id 获得收件地址
|
||||
if (options.id) {
|
||||
let {
|
||||
code,
|
||||
data
|
||||
} = await AddressApi.getAddress(options.id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.model = data;
|
||||
}
|
||||
// 情况二:微信导入
|
||||
if (options.data) {
|
||||
let data = JSON.parse(options.data);
|
||||
const areaData = uni.getStorageSync('areaData');
|
||||
const findAreaByName = (areas, name) => areas.find((item) => item.name === name);
|
||||
|
||||
let provinceObj = findAreaByName(areaData, data.province_name);
|
||||
let cityObj = provinceObj ? findAreaByName(provinceObj.children, data.city_name) : undefined;
|
||||
let districtObj = cityObj ? findAreaByName(cityObj.children, data.district_name) : undefined;
|
||||
let areaId = (districtObj || cityObj || provinceObj).id;
|
||||
|
||||
state.model = {
|
||||
...state.model,
|
||||
areaId,
|
||||
areaName: [data.province_name, data.city_name, data.district_name]
|
||||
.filter(Boolean)
|
||||
.join(' '),
|
||||
defaultStatus: false,
|
||||
detailAddress: data.address,
|
||||
mobile: data.mobile,
|
||||
name: data.consignee,
|
||||
};
|
||||
}
|
||||
});
|
||||
const onColse = () => {
|
||||
emit('close');
|
||||
};
|
||||
defineExpose({
|
||||
onEdit,
|
||||
});
|
||||
const regionClick = (e) => {
|
||||
console.log('111')
|
||||
if (e.value == 'areaName') {
|
||||
state.showRegion = true;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.cardEdit {
|
||||
// width: 90%;
|
||||
}
|
||||
|
||||
:deep() {
|
||||
.uni-forms-item__label .label-text {
|
||||
font-size: 28rpx !important;
|
||||
color: #333333;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.uni-easyinput__content-input {
|
||||
font-size: 28rpx !important;
|
||||
color: #333333;
|
||||
line-height: normal !important;
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
.uni-easyinput__content-textarea {
|
||||
font-size: 28rpx !important;
|
||||
color: #333333;
|
||||
line-height: normal !important;
|
||||
margin-top: 8rpx !important;
|
||||
}
|
||||
|
||||
.uni-icons {
|
||||
font-size: 40rpx !important;
|
||||
}
|
||||
|
||||
.is-textarea-icon {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
.is-disabled {
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.form2) {
|
||||
.border-top {
|
||||
border-top: 1rpx solid #4c505b;
|
||||
}
|
||||
}
|
||||
|
||||
.default-box {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
height: 100rpx;
|
||||
|
||||
.default-box-title {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-box {
|
||||
.save-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: #F2F4F7;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.uni-forms-item--border) {
|
||||
padding: 0;
|
||||
border-top: 1px solid #4c505b;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 32rpx 0rpx;
|
||||
box-align: border-box;
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%);
|
||||
border-radius: 8rpx;
|
||||
font-size: 32rpx;
|
||||
// font-weight: 500;
|
||||
line-height: 82rpx;
|
||||
color: $white;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.title {
|
||||
line-height: 92rpx;
|
||||
color: #3d3d3d;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.close {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
position: absolute;
|
||||
right: -14rpx;
|
||||
top: -18rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.uni-forms-item__error) {
|
||||
text-align: left;
|
||||
}
|
||||
:deep(.is-disabled){
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<uni-list>
|
||||
<uni-list-item
|
||||
:title="v.title"
|
||||
:rightText="v.rightText"
|
||||
:disabled="v.disabled"
|
||||
v-for="(v, i) in arr"
|
||||
:link="v.link"
|
||||
:to="v.to"
|
||||
:key="i"
|
||||
>
|
||||
<template v-slot:footer>
|
||||
<slot :name="`footer-${v.id}`"></slot>
|
||||
</template>
|
||||
</uni-list-item>
|
||||
</uni-list>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, toRaw, watch, onMounted, onUnmounted, getCurrentInstance } from 'vue';
|
||||
const props = defineProps({
|
||||
arr: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
:deep(.uni-list--border) {
|
||||
display: none;
|
||||
}
|
||||
:deep(.uni-list-item__extra-text) {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
:deep(.uni-list--border-top) {
|
||||
display: none;
|
||||
}
|
||||
:deep(.uni-list--border-bottom) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<view class="cardTitle p-x-20 cardBg" :style="{ height: statusBarHeight + 44 + 'px' }">
|
||||
<view :style="{ height: statusBarHeight + 'px' }"></view>
|
||||
<view class="flex-center ju-between h_88">
|
||||
<view class="cardLeft" v-if="props.showLeftButton">
|
||||
<view @tap="onClickLeft">
|
||||
<uni-icons type="left" :color="textColor" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="title size36 flex1 center" :style="[{ color: textColor }]">{{
|
||||
props.title
|
||||
}}</view>
|
||||
<view> </view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getCurrentInstance, defineProps, defineEmits, ref } from 'vue';
|
||||
import { onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
bg: {
|
||||
type: String,
|
||||
default: '#ffffff',
|
||||
},
|
||||
scrollbg: {
|
||||
type: String,
|
||||
default: '#ffffff',
|
||||
},
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 20,
|
||||
},
|
||||
showLeftButton: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#333333',
|
||||
},
|
||||
scrollColor: {
|
||||
type: String,
|
||||
default: '#ffffff',
|
||||
},
|
||||
goLeft: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: '/pages/index/index',
|
||||
},
|
||||
back: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
});
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
const hasHistory = sheep.$router.hasHistory();
|
||||
const emits = defineEmits(['navback', 'clickLeft']);
|
||||
const onClickLeft = () => {
|
||||
if (props.goLeft) {
|
||||
if (hasHistory) {
|
||||
uni.navigateBack({ delta: props.back });
|
||||
} else {
|
||||
sheep.$router.go(props.url);
|
||||
}
|
||||
} else {
|
||||
emits('clickLeft');
|
||||
}
|
||||
};
|
||||
// 监听滚动事件
|
||||
let scrollTop = ref(0);
|
||||
let backgroundColor = ref(props.bg);
|
||||
let textColor = ref(props.color);
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.cardTitle {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
.cardBg {
|
||||
// 背景图片顶部显示, 超出部分隐藏, 宽等于100%
|
||||
background-color: #ffffff;
|
||||
}
|
||||
:deep(.uniui-left) {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
.cardLeft {
|
||||
position: absolute;
|
||||
bottom: 44rpx;
|
||||
left: 20rpx;
|
||||
transform: translateY(50%);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<view class="cardTitle p-x-20" :style="{ background: backgroundColor }">
|
||||
<view :style="{height: statusBarHeight + 'px'}"></view>
|
||||
<view class="flex-center ju-between h_88">
|
||||
<view class="cardLeft" v-if="props.showLeftButton">
|
||||
<view @tap="onClickLeft">
|
||||
<uni-icons type="left" :color="textColor" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="title size36 flex1 center" :style="[{ color: textColor }]">{{ props.title }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getCurrentInstance, defineProps, defineEmits, ref } from 'vue';
|
||||
import {onPageScroll} from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
bg: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
scrollbg: {
|
||||
type: String,
|
||||
default: '#ffffff',
|
||||
},
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 20
|
||||
},
|
||||
showLeftButton: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#333333',
|
||||
},
|
||||
scrollColor:{
|
||||
type: String,
|
||||
default: '#333333'
|
||||
},
|
||||
goLeft: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: '/pages/index/index',
|
||||
},
|
||||
back:{
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
index:{
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
});
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
const hasHistory = sheep.$router.hasHistory();
|
||||
const emits = defineEmits(['navback', 'clickLeft']);
|
||||
const onClickLeft = () => {
|
||||
if (props.goLeft && props.showLeftButton) {
|
||||
if (hasHistory) {
|
||||
uni.navigateBack({ delta: props.back })
|
||||
} else {
|
||||
sheep.$router.go(props.url);
|
||||
}
|
||||
} else {
|
||||
emits('clickLeft');
|
||||
}
|
||||
};
|
||||
// 监听滚动事件
|
||||
let scrollTop = ref(0)
|
||||
let backgroundColor = ref(props.bg)
|
||||
let textColor = ref(props.color)
|
||||
|
||||
onPageScroll(e=>{
|
||||
|
||||
scrollTop.value = e.scrollTop
|
||||
if(e.scrollTop > props.scrollTop){
|
||||
backgroundColor.value = props.scrollbg
|
||||
textColor.value = props.scrollColor
|
||||
}else{
|
||||
backgroundColor.value = props.bg
|
||||
textColor.value = props.color
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.cardTitle {
|
||||
position: fixed;
|
||||
top:0;
|
||||
left:0;
|
||||
width: 100%;
|
||||
z-index: 98;
|
||||
}
|
||||
:deep(.uniui-left){
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
.cardLeft{
|
||||
position: absolute;
|
||||
bottom: 44rpx;
|
||||
left: 20rpx;
|
||||
transform: translateY(50%);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<view class="cardTitle p-x-20">
|
||||
<view :style="{height: statusBarHeight + 'px'}"></view>
|
||||
<view class="flex-center ju-between h_88">
|
||||
<view class="cardLeft" v-if="props.showLeftButton">
|
||||
<view @tap="onClickLeft">
|
||||
<uni-icons type="left" :color="textColor" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="title size36 flex1 center" :style="[{ color: textColor }]">{{ props.title }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getCurrentInstance, defineProps, defineEmits, ref } from 'vue';
|
||||
import { onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
bg: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
scrollbg: {
|
||||
type: String,
|
||||
default: '#ffffff',
|
||||
},
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
default: 20
|
||||
},
|
||||
showLeftButton: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#333333',
|
||||
},
|
||||
scrollColor: {
|
||||
type: String,
|
||||
default: '#333333'
|
||||
},
|
||||
goLeft: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: '/pages/index/index',
|
||||
},
|
||||
back: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
});
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
const hasHistory = sheep.$router.hasHistory();
|
||||
const emits = defineEmits(['navback', 'clickLeft']);
|
||||
const onClickLeft = () => {
|
||||
if (props.goLeft && props.showLeftButton) {
|
||||
if (hasHistory) {
|
||||
uni.navigateBack({ delta: props.back })
|
||||
} else {
|
||||
sheep.$router.go(props.url);
|
||||
}
|
||||
} else {
|
||||
emits('clickLeft');
|
||||
}
|
||||
};
|
||||
// 监听滚动事件
|
||||
let scrollTop = ref(0)
|
||||
let backgroundColor = ref(props.bg)
|
||||
let textColor = ref(props.color)
|
||||
|
||||
onPageScroll(e => {
|
||||
|
||||
scrollTop.value = e.scrollTop
|
||||
if (e.scrollTop > props.scrollTop) {
|
||||
backgroundColor.value = props.scrollbg
|
||||
textColor.value = props.scrollColor
|
||||
} else {
|
||||
backgroundColor.value = props.bg
|
||||
textColor.value = props.color
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.one {
|
||||
width: 100%;
|
||||
height: 708rpx;
|
||||
background-image: linear-gradient(to top, #F2F4F7 0%, rgba(251, 129, 55, 0.459) 36%);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
// z-index: -1;
|
||||
}
|
||||
|
||||
.cardTitle {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
// z-index: 98;
|
||||
}
|
||||
|
||||
:deep(.uniui-left) {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
|
||||
.cardLeft {
|
||||
position: absolute;
|
||||
bottom: 44rpx;
|
||||
left: 20rpx;
|
||||
transform: translateY(50%);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<view class="flex-center" :class="{
|
||||
'ju-flex-end': props.type == 2,
|
||||
'ju-between': props.type != 2,
|
||||
}">
|
||||
<view class="more size24" v-if="props.type != 2"></view>
|
||||
<view class="flex-center ju-flex-end">
|
||||
<view v-for="(item, index) in btns" :key="index">
|
||||
<view v-if="item.value.split(',').indexOf(String(props?.data?.status)) !== -1" class="btn size28 f500"
|
||||
@click.stop="btnClick(item.id)"
|
||||
:style="{ color: item.color, background: item.background, border: item.border }"
|
||||
:class="{btn1: props.type == 2}">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
getCurrentInstance,
|
||||
defineProps,
|
||||
defineEmits
|
||||
} from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
|
||||
let emit = defineEmits(['downData']);
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: '0', //0列表2订单详情
|
||||
},
|
||||
});
|
||||
let btns = ref([{
|
||||
id: 1,
|
||||
name: '取消订单',
|
||||
value: '0',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '去付款',
|
||||
value: '0',
|
||||
color: '#EE0A24',
|
||||
background: 'rgba(238,10,36,0.2)',
|
||||
border: 'none'
|
||||
},
|
||||
// { //在订单详情退货
|
||||
// id: 3,
|
||||
// name: '申请售后',
|
||||
// value: '10,20',
|
||||
// },
|
||||
{
|
||||
id: 4,
|
||||
name: '确认收货',
|
||||
value: '20,60',
|
||||
color: '#EE0A24',
|
||||
background: 'rgba(238,10,36,0.2)',
|
||||
border: 'none'
|
||||
},
|
||||
// {
|
||||
// id: 5,
|
||||
// name: '再次购买',
|
||||
// value: '30,50,40',
|
||||
// color: '#FA9C31',
|
||||
// },
|
||||
{
|
||||
id: 6,
|
||||
name: '取消售后',
|
||||
value: '60',
|
||||
},
|
||||
]);
|
||||
const btnClick = (index) => {
|
||||
let timestamp = new Date().getTime();
|
||||
let payExpireTime = props.data.payExpireTime
|
||||
if (timestamp > payExpireTime && props.data.status == 0 && index == 2) {
|
||||
uni.showToast({
|
||||
title: '订单已过期',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
let id = props.data?.id;
|
||||
switch (index) {
|
||||
case 1:
|
||||
cancelOrder();
|
||||
break;
|
||||
case 2:
|
||||
payOrder(id);
|
||||
break;
|
||||
case 3:
|
||||
applyAfterSale();
|
||||
break;
|
||||
case 4:
|
||||
confirmReceive();
|
||||
break;
|
||||
case 5:
|
||||
buyAgain();
|
||||
break;
|
||||
case 6:
|
||||
cancelAfterSale();
|
||||
break;
|
||||
}
|
||||
};
|
||||
// 取消订单
|
||||
const cancelOrder = () => {
|
||||
let orderId = props.data?.id;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要取消订单吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function(res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
|
||||
upData();
|
||||
const {
|
||||
code
|
||||
} = await OrderApi.cancelOrder(orderId);
|
||||
if (code === 0) {
|
||||
uni.showToast({
|
||||
title: '订单已取消',
|
||||
icon: 'none'
|
||||
});
|
||||
upData();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
// 去付款
|
||||
const payOrder = (id) => {
|
||||
sheep.$router.go('/pages/pay/index', {
|
||||
id: props.data.payOrderId,
|
||||
});
|
||||
};
|
||||
// 申请售后
|
||||
const applyAfterSale = () => {
|
||||
sheep.$router.go('/pages/order/aftersale/apply', props.data);
|
||||
};
|
||||
// 确认收货
|
||||
const confirmReceive = () => {
|
||||
let change = false
|
||||
if (props.data?.items.length) {
|
||||
props.data.items.forEach(item => {
|
||||
if (item.afterSaleStatus == 10) {
|
||||
change = true
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
if (change) {
|
||||
uni.showToast({
|
||||
title: '有售后中的商品,请先处理完售后',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认收货吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function(res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
// 正常的确认收货流程
|
||||
const {
|
||||
code
|
||||
} = await OrderApi.receiveOrder(props.data?.id);
|
||||
if (code === 0) {
|
||||
upData();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
// 再次购买
|
||||
const buyAgain = () => {};
|
||||
// 取消售后
|
||||
const cancelAfterSale = () => {};
|
||||
const upData = () => {
|
||||
emit('downData');
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.more {}
|
||||
|
||||
.btn {
|
||||
line-height: 54rpx;
|
||||
padding: 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
border: 2rpx solid #999999;
|
||||
border-radius: 94px 94px 94px 94px;
|
||||
margin-left: 12rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.btn1 {
|
||||
line-height: 74rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<view v-show="props.i === props.index" class="h100">
|
||||
<mescroll-uni
|
||||
@init="mescrollInit"
|
||||
top="0"
|
||||
:down="downOption"
|
||||
@down="downCallback"
|
||||
:up="upOption"
|
||||
@up="upCallback"
|
||||
@emptyclick="emptyClick"
|
||||
:height="props.height"
|
||||
>
|
||||
<slot></slot>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, getCurrentInstance } from 'vue';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
i: {
|
||||
// 每个tab页的专属下标
|
||||
type: Number,
|
||||
default() {
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
index: {
|
||||
// 当前tab的下标
|
||||
type: Number,
|
||||
default() {
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
tabs: {
|
||||
// 为了请求数据,演示用,可根据自己的项目判断是否要传
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 10,
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '100%',
|
||||
},
|
||||
});
|
||||
watch(
|
||||
() => props.i,
|
||||
() => {
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(); // 调用mescroll的hook
|
||||
|
||||
const isAutoInit = props.i === props.index; // 自动加载当前tab的数据
|
||||
const downOption = {
|
||||
auto: isAutoInit, // 自动加载当前tab的数据
|
||||
bottomOffset: 20, // 当手指touchmove位置在距离body底部20upx范围内的时候结束上拉刷新,避免Webview嵌套导致touchend事件不执行
|
||||
};
|
||||
|
||||
const upOption = {
|
||||
auto: true, // 是否在初始化完毕之后自动执行下拉刷新的回调; 默认true
|
||||
noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
||||
empty: {
|
||||
tip: '~ 空空如也 ~', // 提示
|
||||
},
|
||||
page: {
|
||||
num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
|
||||
size: props.pageSize, // 每页数据的数量
|
||||
},
|
||||
};
|
||||
const isInit = ref(isAutoInit); // 当前tab是否已初始化
|
||||
// 监听下标的变化
|
||||
watch(
|
||||
() => props.index,
|
||||
(val) => {
|
||||
if (props.i === val && !isInit.value) mescrollTrigger();
|
||||
},
|
||||
);
|
||||
// 主动触发下拉加载
|
||||
const mescrollTrigger = () => {
|
||||
isInit.value = true; // 标记为true
|
||||
const mescroll = getMescroll();
|
||||
if (mescroll) {
|
||||
if (mescroll.optDown.use) {
|
||||
mescroll.triggerDownScroll();
|
||||
} else {
|
||||
mescroll.triggerUpScroll();
|
||||
}
|
||||
}
|
||||
};
|
||||
//点击空布局按钮的回调
|
||||
const emptyClick = () => {
|
||||
uni.showToast({
|
||||
title: '点击了按钮,具体逻辑自行实现',
|
||||
});
|
||||
};
|
||||
|
||||
const upCallback = (mescroll) => {
|
||||
setTimeout(() => {
|
||||
proxy.$emit('upCallback', {
|
||||
...mescroll,
|
||||
dataObj: {
|
||||
status: props.tabs.length ? props.tabs[props.i].value : null,
|
||||
i: props.i,
|
||||
index: props.index,
|
||||
},
|
||||
});
|
||||
}, 500);
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据状态更新 Mescroll 组件的状态
|
||||
*
|
||||
* @param state 布尔值,表示 Mescroll 组件的状态,默认为 true
|
||||
* @param num 数字,表示数据长度,默认为 0
|
||||
*/
|
||||
|
||||
const getState = (state = true, num = 0) => {
|
||||
const mescroll = getMescroll();
|
||||
if (state) {
|
||||
mescroll.endSuccess(num);
|
||||
} else {
|
||||
mescroll.endErr();
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({ getMescroll, getState, mescrollTrigger }); // 使父组件可以通过ref调用到getMescroll方法 (必须)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<view v-show="props.i === props.index" class="h100">
|
||||
<mescroll-uni @init="mescrollInit" top="0" :down="downOption" @down="downCallback" :up="upOption"
|
||||
@up="upCallback" @emptyclick="emptyClick" :height="props.height">
|
||||
<slot></slot>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
watch,
|
||||
getCurrentInstance
|
||||
} from 'vue';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
i: {
|
||||
// 每个tab页的专属下标
|
||||
type: Number,
|
||||
default () {
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
index: {
|
||||
// 当前tab的下标
|
||||
type: Number,
|
||||
default () {
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
tabs: {
|
||||
// 为了请求数据,演示用,可根据自己的项目判断是否要传
|
||||
type: Array,
|
||||
default () {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 10,
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '100%',
|
||||
},
|
||||
});
|
||||
watch(
|
||||
() => props.i,
|
||||
() => {}, {
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
const {
|
||||
mescrollInit,
|
||||
downCallback,
|
||||
getMescroll
|
||||
} = useMescroll(); // 调用mescroll的hook
|
||||
|
||||
const isAutoInit = props.i === props.index; // 自动加载当前tab的数据
|
||||
const downOption = {
|
||||
auto: isAutoInit, // 自动加载当前tab的数据
|
||||
bottomOffset: 20, // 当手指touchmove位置在距离body底部20upx范围内的时候结束上拉刷新,避免Webview嵌套导致touchend事件不执行
|
||||
};
|
||||
|
||||
const upOption = {
|
||||
auto: true, // 是否在初始化完毕之后自动执行下拉刷新的回调; 默认true
|
||||
noMoreSize: 1, // 总数量小于该值也展示“无更多”,设为0确保少于10条时也显示结束
|
||||
empty: {
|
||||
tip: '~ 空空如也 ~', // 提示
|
||||
},
|
||||
page: {
|
||||
num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
|
||||
size: props.pageSize, // 每页数据的数量
|
||||
},
|
||||
};
|
||||
const isInit = ref(isAutoInit); // 当前tab是否已初始化
|
||||
// 监听下标的变化
|
||||
watch(
|
||||
() => props.index,
|
||||
(val) => {
|
||||
if (props.i === val && !isInit.value) mescrollTrigger();
|
||||
},
|
||||
);
|
||||
// 主动触发下拉加载
|
||||
const mescrollTrigger = () => {
|
||||
isInit.value = true; // 标记为true
|
||||
const mescroll = getMescroll();
|
||||
if (mescroll) {
|
||||
if (mescroll.optDown.use) {
|
||||
mescroll.triggerDownScroll();
|
||||
} else {
|
||||
mescroll.triggerUpScroll();
|
||||
}
|
||||
}
|
||||
};
|
||||
//点击空布局按钮的回调
|
||||
const emptyClick = () => {
|
||||
uni.showToast({
|
||||
title: '点击了按钮,具体逻辑自行实现',
|
||||
});
|
||||
};
|
||||
|
||||
const upCallback = (mescroll) => {
|
||||
setTimeout(() => {
|
||||
proxy.$emit('upCallback', {
|
||||
...mescroll,
|
||||
dataObj: {
|
||||
status: props.tabs.length ? props.tabs[props.i].value : null,
|
||||
i: props.i,
|
||||
index: props.index,
|
||||
},
|
||||
});
|
||||
}, 500);
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据状态更新 Mescroll 组件的状态
|
||||
*
|
||||
* @param state 布尔值,表示 Mescroll 组件的状态,默认为 true
|
||||
* @param num 数字,表示数据长度,默认为 0
|
||||
*/
|
||||
|
||||
const getState = (state = true, num = 0) => {
|
||||
const mescroll = getMescroll();
|
||||
if (state) {
|
||||
mescroll.endSuccess(num);
|
||||
} else {
|
||||
mescroll.endErr();
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
getMescroll,
|
||||
getState,
|
||||
mescrollTrigger
|
||||
}); // 使父组件可以通过ref调用到getMescroll方法 (必须)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<view v-show="props.i === props.index" class="h100">
|
||||
<mescroll-body
|
||||
@init="mescrollInit"
|
||||
top="0"
|
||||
:down="downOption"
|
||||
@down="downCallback"
|
||||
:up="upOption"
|
||||
@up="upCallback"
|
||||
@emptyclick="emptyClick"
|
||||
:height="props.height"
|
||||
>
|
||||
<slot></slot>
|
||||
</mescroll-body>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, getCurrentInstance } from 'vue';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
i: {
|
||||
// 每个tab页的专属下标
|
||||
type: Number,
|
||||
default() {
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
index: {
|
||||
// 当前tab的下标
|
||||
type: Number,
|
||||
default() {
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
tabs: {
|
||||
// 为了请求数据,演示用,可根据自己的项目判断是否要传
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 10,
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '100%',
|
||||
},
|
||||
});
|
||||
watch(
|
||||
() => props.i,
|
||||
() => {
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(); // 调用mescroll的hook
|
||||
|
||||
const isAutoInit = props.i === props.index; // 自动加载当前tab的数据
|
||||
const downOption = {
|
||||
auto: isAutoInit, // 自动加载当前tab的数据
|
||||
bottomOffset: 20, // 当手指touchmove位置在距离body底部20upx范围内的时候结束上拉刷新,避免Webview嵌套导致touchend事件不执行
|
||||
};
|
||||
|
||||
const upOption = {
|
||||
auto: true, // 是否在初始化完毕之后自动执行下拉刷新的回调; 默认true
|
||||
noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
||||
empty: {
|
||||
tip: '~ 空空如也 ~', // 提示
|
||||
},
|
||||
page: {
|
||||
num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
|
||||
size: props.pageSize, // 每页数据的数量
|
||||
},
|
||||
};
|
||||
const isInit = ref(isAutoInit); // 当前tab是否已初始化
|
||||
// 监听下标的变化
|
||||
watch(
|
||||
() => props.index,
|
||||
(val) => {
|
||||
if (props.i === val && !isInit.value) mescrollTrigger();
|
||||
},
|
||||
);
|
||||
// 主动触发下拉加载
|
||||
const mescrollTrigger = () => {
|
||||
isInit.value = true; // 标记为true
|
||||
const mescroll = getMescroll();
|
||||
if (mescroll) {
|
||||
if (mescroll.optDown.use) {
|
||||
mescroll.triggerDownScroll();
|
||||
} else {
|
||||
mescroll.triggerUpScroll();
|
||||
}
|
||||
}
|
||||
};
|
||||
//点击空布局按钮的回调
|
||||
const emptyClick = () => {
|
||||
uni.showToast({
|
||||
title: '点击了按钮,具体逻辑自行实现',
|
||||
});
|
||||
};
|
||||
|
||||
const upCallback = (mescroll) => {
|
||||
setTimeout(() => {
|
||||
proxy.$emit('upCallback', {
|
||||
...mescroll,
|
||||
dataObj: {
|
||||
status: props.tabs.length ? props.tabs[props.i].value : null,
|
||||
i: props.i,
|
||||
index: props.index,
|
||||
},
|
||||
});
|
||||
}, 500);
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据状态更新 Mescroll 组件的状态
|
||||
*
|
||||
* @param state 布尔值,表示 Mescroll 组件的状态,默认为 true
|
||||
* @param num 数字,表示数据长度,默认为 0
|
||||
*/
|
||||
|
||||
const getState = (state = true, num = 0) => {
|
||||
const mescroll = getMescroll();
|
||||
if (state) {
|
||||
mescroll.endSuccess(num);
|
||||
} else {
|
||||
mescroll.endErr();
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({ getMescroll, getState, mescrollTrigger }); // 使父组件可以通过ref调用到getMescroll方法 (必须)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<view class="card_pages flex1 flex-column h100">
|
||||
<view v-if="props.type == 1" class="flex1 flex-column">
|
||||
<slot name="nav"></slot>
|
||||
<view class="flex1">
|
||||
<!-- props.oneShow -->
|
||||
<view v-for="(tab, i) in props.navList" :key="tab.id || i">
|
||||
<card_mescroll
|
||||
v-if="props.oneShow?props.currentTab == i:true"
|
||||
:ref="(el) => mescrollItems[i] && (mescrollItems[i].value = el)"
|
||||
:i="i"
|
||||
:index="props.currentTab"
|
||||
:tabs="props.navList"
|
||||
@upCallback="upCallback"
|
||||
:pageSize="props.pageSize"
|
||||
:height="props.height"
|
||||
>
|
||||
<slot name="content"></slot>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, watch, onMounted, onUnmounted, getCurrentInstance } from 'vue';
|
||||
import card_mescroll from './card_mescroll.vue';
|
||||
import card_mescroll1 from './card_mescroll1.vue';
|
||||
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app';
|
||||
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
navList: {
|
||||
//菜单列表
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
currentTab: {
|
||||
//当前选中的菜单
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 10,
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '100%',
|
||||
},
|
||||
oneShow: {
|
||||
//滚动的时候根据全局滚动测算
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
let mescrollRef = ref(null);
|
||||
watch(
|
||||
() => {
|
||||
props.currentTab;
|
||||
},
|
||||
(val) => {
|
||||
if (props.oneShow && mescrollRef.value) {
|
||||
mescrollRef.value.mescrollTrigger();
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
|
||||
// 动态生成与 tabs 同步的 refs 数组,供 useMescrollMore 使用
|
||||
const mescrollItems = props.navList.map(() => ref(null));
|
||||
const { getMescroll, scrollToLastY } = useMescrollMore(
|
||||
mescrollItems,
|
||||
onPageScroll,
|
||||
onReachBottom,
|
||||
);
|
||||
// 下拉刷新回调
|
||||
const downCallback = () => {
|
||||
if (props.oneShow && mescrollRef.value) {
|
||||
mescrollRef.value.mescrollTrigger();
|
||||
return;
|
||||
}
|
||||
if (mescrollItems.length && mescrollItems[props.currentTab]) {
|
||||
mescrollItems[props.currentTab].value.mescrollTrigger();
|
||||
}
|
||||
};
|
||||
// 上拉加载回调
|
||||
const upCallback = (mescroll) => {
|
||||
//获取数据
|
||||
proxy.$emit('upCallback', mescroll);
|
||||
};
|
||||
|
||||
const getState = (state = true, num = 0) => {
|
||||
// console.log(mescrollItems[props.currentTab].value)
|
||||
if (props.oneShow && mescrollRef.value) {
|
||||
return mescrollRef.value.getState(state, num);
|
||||
}
|
||||
if (mescrollItems.length && mescrollItems[props.currentTab]) {
|
||||
return mescrollItems[props.currentTab].value.getState(state, num);
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
getMescroll,
|
||||
scrollToLastY,
|
||||
getState,
|
||||
downCallback,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,334 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="card_payment flex-center ju-between bg16 h_128 p-l-34 p-r-40">
|
||||
<view class="flex-center ju-flex-start flex1" @click="showPopup">
|
||||
<uni-badge :text="num" absolute="rightTop" :offset="[13, 6]">
|
||||
<view class="w_80 h_80 m-r-24">
|
||||
<image class="w100 h100" :src="$url + 'ai/index/2.svg'" mode="scaleToFill" />
|
||||
</view>
|
||||
</uni-badge>
|
||||
<view class="flex1">总计: <span class="c13 size24 m-r-5">¥</span><span
|
||||
class="c13 size34">{{ $fen2yuan(price) }}</span></view>
|
||||
</view>
|
||||
<view class="ai-button1 h_80 line80 w_200" @click="go"> 去结算 </view>
|
||||
</view>
|
||||
<uni-popup ref="popupRef" type="bottom" border-radius="10px 10px 0 0">
|
||||
<view class="p-x-32 p-y-40 bg17">
|
||||
<view class="flex-center ju-between p-b-44">
|
||||
<view>已加购商品</view>
|
||||
<view @click="hidePopup">
|
||||
<uni-icons type="closeempty" color="#999999" size="20" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="popupCon">
|
||||
<view class="flex-row m-b-24" v-for="(v, i) in cartList" :key="i">
|
||||
<view class="w_130 h_130 shrink m-r-16">
|
||||
<image class="w100 h100 radius8" :src="v.picUrl" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="flex-column ju-between flex1">
|
||||
<view class="m-b-14">
|
||||
<view class="size28 lineTwo">{{ v?.name }}</view>
|
||||
</view>
|
||||
<view class="w100">
|
||||
<view class="flex-center m-b-12" v-for="(item, index) in v.skuArr" :key="index"
|
||||
@click="openSelectSku(v, item)">
|
||||
<view class="flex1 flex-center ju-between h_52 bg18 radius8 p-l-8 p-r-16">
|
||||
<view class="lineOne c19" v-if="item?.properties">
|
||||
{{item?.properties.length > 1? item?.propertyText: item?.properties[0].valueName}}
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<view class="c19">x{{ item?.count }}</view>
|
||||
<view class="m-l-12 weight900">¥{{ $fen2yuan(item?.discountedPrice?item?.discountedPrice:item?.price) }}</view>
|
||||
<uni-icons class="m-l-10" type="right" color="#999999" size="16" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-l-16" @click.stop="deleteCart(v, item)">
|
||||
<uni-icons type="closeempty" size="27" color="#999999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p-x-8 p-y-10 radius8 bg18 c20" style="display: inline-block">
|
||||
<span class="m-r-12" @click="openSelectSku(v)">再选一款</span>
|
||||
<uni-icons type="plusempty" color="#D4D8E1" size="13" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="c13 size36 m-t-8 weight900">
|
||||
<span class="size28">¥</span>{{ $fen2yuan(v.discountedPrice?v.discountedPrice:v.price) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="popupBottom flex-center ju-between h_128">
|
||||
<view class="flex-center ju-flex-start flex1">
|
||||
<uni-badge :text="num" absolute="rightTop" :offset="[13, 6]">
|
||||
<view class="w_80 h_80 m-r-24">
|
||||
<image class="w100 h100" :src="$url + 'ai/index/2.svg'" mode="scaleToFill" />
|
||||
</view>
|
||||
</uni-badge>
|
||||
<view class="flex1">
|
||||
总计: <span class="c13 size24 m-r-5">¥</span>
|
||||
<span class="c13 size34">{{ $fen2yuan(price) }}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ai-button1 h_80 line80 w_200" @click="go"> 去结算 </view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
<s-select-aiSku v-if="showSelectSku" :goodsInfo="goodsInfo" :activeSku="activeSku" :selectSku="selectSku"
|
||||
:show="showSelectSku" :activeInfo="activeInfo" @addCart="onAddCart" @change="onSkuChange"
|
||||
@close="aiSkuClose" :minSalesCountShow="props.minSalesCountShow"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, getCurrentInstance, onMounted, defineProps, watch } from 'vue';
|
||||
import CartApi from '@/sheep/api/trade/cart.js';
|
||||
import * as SpuApi from '@/sheep/api/ai/index';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
const props = defineProps({
|
||||
source: {
|
||||
// orderInfo商品详情
|
||||
type: String,
|
||||
default: 'index',
|
||||
},
|
||||
actionStatus: {
|
||||
// 活动开始状态
|
||||
type: String,
|
||||
default: 'index',
|
||||
},
|
||||
addShow: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
minSalesCountShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
const cartList = ref([]);
|
||||
let price = ref(0);
|
||||
let num = ref(0);
|
||||
let addShow1 = ref(false)
|
||||
watch(() => props.addShow, () => {
|
||||
addShow1.value = props.addShow
|
||||
}, {
|
||||
immediate: true,
|
||||
deep: true
|
||||
})
|
||||
const getCartList = (val : any = true) => {
|
||||
num.value = 0;
|
||||
price.value = 0;
|
||||
SpuApi.getShopCartList({}).then((res) => {
|
||||
let list = res.data || [];
|
||||
if (list.length) {
|
||||
list.forEach((e) => {
|
||||
e.skuArr = JSON.parse(e.specification);
|
||||
e.skuArr.forEach((item) => {
|
||||
num.value += item.count;
|
||||
item.propertyText = '';
|
||||
if (item.properties) {
|
||||
item.properties.forEach((e1) => {
|
||||
item.propertyText += e1.valueName + " ";
|
||||
});
|
||||
}
|
||||
});
|
||||
price.value += e.discountedPrice;
|
||||
});
|
||||
addShow1.value = true
|
||||
} else {
|
||||
if (!val) {
|
||||
addShow1.value = false
|
||||
}
|
||||
}
|
||||
cartList.value = list;
|
||||
proxy.$emit('updatePrice', addShow1.value);
|
||||
});
|
||||
|
||||
};
|
||||
onShow(() => {
|
||||
getCartList();
|
||||
});
|
||||
let popupRef = ref(null);
|
||||
const showPopup = () => {
|
||||
if (!popupRef.value) return;
|
||||
|
||||
popupRef.value.open('bottom');
|
||||
};
|
||||
const hidePopup = () => {
|
||||
popupRef.value.close();
|
||||
};
|
||||
onMounted(() => { });
|
||||
//#region 选择规格弹窗
|
||||
let showSelectSku = ref(false);
|
||||
let goodsInfo = ref({});
|
||||
// 加入购物车
|
||||
const onAddCart = (data) => {
|
||||
let obj = {
|
||||
spuId: '',
|
||||
specification: '',
|
||||
shoppingPlazaId: '', //选品广场id
|
||||
id: '',
|
||||
};
|
||||
let url = SpuApi.addShopCart;
|
||||
if (addShow.value) {
|
||||
// 新增
|
||||
delete obj.id;
|
||||
obj.spuId = addObj.value.id;
|
||||
obj.shoppingPlazaId = addObj.value.shoppingPlazaId;
|
||||
let arr = [];
|
||||
arr.push(data);
|
||||
obj.specification = JSON.stringify(arr);
|
||||
url(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
aiSkuClose();
|
||||
getCartList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 编辑
|
||||
let info = activeInfo.value;
|
||||
console.log(info)
|
||||
console.log(activeSku.value)
|
||||
let index = -1;
|
||||
if (activeSku.value.id) {
|
||||
// index = info.skuArr.findIndex((e) => activeSku.value.id == data.id);
|
||||
info.skuArr.forEach((e, i) => {
|
||||
if (e.id == activeSku.value.id) {
|
||||
index = i
|
||||
}
|
||||
})
|
||||
} else {
|
||||
index = info.skuArr.findIndex((e) => e.id == data.id);
|
||||
}
|
||||
if (index != -1) {
|
||||
info.skuArr[index] = data;
|
||||
} else {
|
||||
info.skuArr.push(data);
|
||||
}
|
||||
infoChange(info);
|
||||
}
|
||||
};
|
||||
const onSkuChange = (data) => { };
|
||||
let activeSku = ref({}); // 选中的sku
|
||||
let selectSku = ref([]); // 选中的sku列表
|
||||
let activeInfo = ref({}); // 当前商品信息
|
||||
// 打开规格选择弹窗
|
||||
const openSelectSku = async (v : any = {}, item = {}) => {
|
||||
let res = await SpuApi.getSpuDetail(v.spuId, v.shoppingPlazaId);
|
||||
if (res.code === 0) {
|
||||
goodsInfo.value = res.data;
|
||||
activeSku.value = item;
|
||||
selectSku.value = v?.skuArr || [];
|
||||
activeInfo.value = v;
|
||||
showSelectSku.value = true;
|
||||
}
|
||||
};
|
||||
// 关闭规格选择弹窗
|
||||
const aiSkuClose = () => {
|
||||
showSelectSku.value = false;
|
||||
goodsInfo.value = {};
|
||||
activeSku.value = {};
|
||||
selectSku.value = [];
|
||||
activeInfo.value = {};
|
||||
addObj.value = {};
|
||||
|
||||
addShow.value = false;
|
||||
};
|
||||
//#endregion
|
||||
const deleteCart = (v, item) => {
|
||||
if (v.skuArr.length == 1) {
|
||||
// 删除接口
|
||||
SpuApi.deleteShopCart({ id: v.id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getCartList(false);
|
||||
proxy.$emit('updataList');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 修改接口
|
||||
let index = v.skuArr.findIndex((e) => e.id == item.id);
|
||||
v.skuArr.splice(index, 1);
|
||||
infoChange(v);
|
||||
}
|
||||
};
|
||||
// 修改属性
|
||||
const infoChange = (data) => {
|
||||
let obj = {
|
||||
spuId: data.spuId,
|
||||
specification: JSON.stringify(data.skuArr),
|
||||
shoppingPlazaId: data.shoppingPlazaId, //选品广场id
|
||||
id: data.id,
|
||||
};
|
||||
let url = SpuApi.updateShopCart;
|
||||
url(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
aiSkuClose();
|
||||
getCartList();
|
||||
}
|
||||
});
|
||||
};
|
||||
let addObj = ref({});
|
||||
let addShow = ref(false);
|
||||
const addCar = async (data) => {
|
||||
addObj.value = data;
|
||||
let obj = cartList.value.find(
|
||||
(e) => e.shoppingPlazaId == data.shoppingPlazaId && e.spuId == data.id,
|
||||
);
|
||||
if (obj?.id) {
|
||||
openSelectSku(obj);
|
||||
return;
|
||||
}
|
||||
addShow.value = true;
|
||||
let res = await SpuApi.getSpuDetail(data.id, data.shoppingPlazaId);
|
||||
if (res.code === 0) {
|
||||
goodsInfo.value = res.data;
|
||||
showSelectSku.value = true;
|
||||
}
|
||||
};
|
||||
defineExpose({
|
||||
addCar,
|
||||
getCartList,
|
||||
});
|
||||
const go = () => {
|
||||
// if (props.actionStatus === '开始') {
|
||||
// uni.showToast({
|
||||
// title: '活动未开始',
|
||||
// icon: 'none'
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
if (price.value > 0) {
|
||||
// proxy.utils.go('/pages/AI/placeOrder');
|
||||
uni.redirectTo({
|
||||
url: '/pages/AI/placeOrder',
|
||||
});
|
||||
} else {
|
||||
if (props.source == 'orderInfo') {
|
||||
proxy.$emit('addCar');
|
||||
return;
|
||||
}
|
||||
proxy.utils.toast('请选择商品');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.card_payment {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
box-shadow: 0px 0px 18px 0px rgba(0, 0, 0, 0.04);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.popupCon {
|
||||
height: 506rpx;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.popupBottom {
|
||||
box-shadow: 0px 0px 18px 0px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<view class="flex-center ju-between w100 search">
|
||||
<view class="flex-center flex1 search_input">
|
||||
<image
|
||||
style="width: 32rpx; height: 32rpx"
|
||||
src="/static/icon/search1.png"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<input
|
||||
class="flex1 input"
|
||||
type="text"
|
||||
placeholder="搜索想要的商品"
|
||||
confirm-type="搜索"
|
||||
placeholder-class="search_placeholder"
|
||||
v-model="searchText"
|
||||
@confirm="search"
|
||||
/>
|
||||
<view class="search_btn" @click="search">搜索</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
const emit = defineEmits(['search']);
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
let searchText = ref('');
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
() => {
|
||||
searchText.value = props.modelValue;
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
);
|
||||
// let globalData = uni.getStorageSync('globalData');
|
||||
const search = () => {
|
||||
emit('search', searchText.value);
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.search {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
// background-color: #fff;
|
||||
.search_input {
|
||||
border: 4rpx solid #fa9c31;
|
||||
height: 72rpx;
|
||||
border-radius: 64rpx;
|
||||
padding-left: 28rpx;
|
||||
padding-right: 6rpx;
|
||||
input {
|
||||
width: 100%;
|
||||
margin-left: 16rpx;
|
||||
height: 100%;
|
||||
}
|
||||
.search_btn {
|
||||
line-height: 64rpx;
|
||||
width: 108rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient(270deg, #fa7931 0%, #fa9c31 100%);
|
||||
border-radius: 64rpx;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.shopIcon {
|
||||
width: 80rpx;
|
||||
}
|
||||
.search_placeholder {
|
||||
font-size: 28rpx !important;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<view class="card_tabber">
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref} from 'vue'
|
||||
|
||||
const tabber = ref({
|
||||
items: [
|
||||
{
|
||||
text: '首页',
|
||||
url: '/pages/index/index',
|
||||
iconUrl: proxy.$url+'index/1.svg',
|
||||
activeIconUrl: proxy.$url+'index/1_1.svg',
|
||||
},
|
||||
{
|
||||
text: '分类',
|
||||
url: '/pages/index/category',
|
||||
iconUrl: proxy.$url+'index/2.svg',
|
||||
activeIconUrl: proxy.$url+'index/2_1.svg',
|
||||
},
|
||||
{
|
||||
text: '',
|
||||
url: '/pages/home/seed',
|
||||
iconUrl: proxy.$url+'index/6.svg',
|
||||
activeIconUrl: proxy.$url+'index/6.svg',
|
||||
},
|
||||
{
|
||||
text: '购物车',
|
||||
url: '/pages/cart/cart',
|
||||
iconUrl: proxy.$url+'index/3.svg',
|
||||
activeIconUrl: proxy.$url+'index/3_1.svg',
|
||||
},
|
||||
{
|
||||
text: '我的',
|
||||
url: '/pages/index/user',
|
||||
iconUrl: proxy.$url+'index/4.svg',
|
||||
activeIconUrl: proxy.$url+'index/4_1.svg',
|
||||
},
|
||||
],
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<view>
|
||||
<scroll-view scroll-x show-scrollbar="false" class="scroll-x-wrapper p-x-32">
|
||||
<view class="navs flex-center ju-flex-start nowrap" style="width: auto;">
|
||||
<view
|
||||
class="navItem flex-center flex-column flex1 shrink nowrap"
|
||||
:class="{ tabIndex: i == tabIndex, c34: i == tabIndex }"
|
||||
v-for="(v, i) in props.list"
|
||||
:key="i"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="navText"> {{ v.name }} </view>
|
||||
<image src="/static/index/active.png" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="goodsPages">
|
||||
<goods-item
|
||||
v-for="(tab, i) in props.list"
|
||||
:key="tab.id || i"
|
||||
:ref="(el) => mescrollItems[i] && (mescrollItems[i].value = el)"
|
||||
:i="i"
|
||||
:index="tabIndex"
|
||||
:tabs="props.list"
|
||||
></goods-item>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import goodsItem from '../goodsItem/goodsItem.vue';
|
||||
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app';
|
||||
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js';
|
||||
let props = defineProps({
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
// 动态生成与 tabs 同步的 refs 数组,供 useMescrollMore 使用
|
||||
const mescrollItems = props.list.map(() => ref(null));
|
||||
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
|
||||
mescrollItems,
|
||||
onPageScroll,
|
||||
onReachBottom,
|
||||
);
|
||||
// let tabIndex = ref(0);
|
||||
const navChange = (i) => {
|
||||
// scrollToLastY()
|
||||
tabIndex.value = i;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scroll-x-wrapper {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.navs {
|
||||
// padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
height: 120rpx;
|
||||
// padding-bottom: 10rpx;
|
||||
.navItem {
|
||||
color: #777777;
|
||||
font-size: 32rpx;
|
||||
// width: 20%;
|
||||
// text-align: center;
|
||||
// margin-right: 40rpx;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0; // 防止被压缩
|
||||
image {
|
||||
width: 40rpx;
|
||||
height: 12rpx;
|
||||
opacity: 0;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
}
|
||||
.tabIndex {
|
||||
color: #777777;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
image {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
.goodsPages {
|
||||
padding: 0 32rpx;
|
||||
padding-top: 12rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<view>
|
||||
<card_pages
|
||||
ref="cardPages"
|
||||
:navList="props.list"
|
||||
:currentTab="tabIndex"
|
||||
@upCallback="getData"
|
||||
:height="height + 'px'"
|
||||
:oneShow="true"
|
||||
>
|
||||
<template #nav>
|
||||
<scroll-view scroll-x show-scrollbar="false" class="scroll-x-wrapper p-x-32">
|
||||
<view class="navs flex-center ju-flex-start nowrap" style="width: auto">
|
||||
<view
|
||||
class="navItem flex-center flex-column c33 flex1 shrink nowrap"
|
||||
:class="{ tabIndex: i == tabIndex, c0: i == tabIndex }"
|
||||
v-for="(v, i) in props.list"
|
||||
:key="i"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="navText"> {{ v.name }} </view>
|
||||
<image src="/static/index/active1.png" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
<template #content>
|
||||
<view class="goodsPages">
|
||||
<view class="flex-row wrap w100" ref="cardRef">
|
||||
<view class="cardItem" v-for="(v, i) in goods" :key="i">
|
||||
<card_goods :data="v"></card_goods>
|
||||
</view> </view
|
||||
></view>
|
||||
</template>
|
||||
</card_pages>
|
||||
</view>
|
||||
<!-- <view>
|
||||
<scroll-view scroll-x show-scrollbar="false" class="scroll-x-wrapper p-x-32">
|
||||
<view class="navs flex-center ju-flex-start nowrap" style="width: auto;">
|
||||
<view
|
||||
class="navItem flex-center flex-column c33 flex1 shrink nowrap"
|
||||
:class="{ tabIndex: i == tabIndex, c0: i == tabIndex }"
|
||||
v-for="(v, i) in props.list"
|
||||
:key="i"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="navText"> {{ v.name }} </view>
|
||||
<image src="/static/index/active1.png" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="goodsPages">
|
||||
<goods-item
|
||||
v-for="(tab, i) in props.list"
|
||||
:key="tab.id || i"
|
||||
:ref="(el) => mescrollItems[i] && (mescrollItems[i].value = el)"
|
||||
:i="i"
|
||||
:index="tabIndex"
|
||||
:tabs="props.list"
|
||||
></goods-item>
|
||||
</view>
|
||||
</view> -->
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import goodsItem from '../goodsItem/goodsItem.vue';
|
||||
import card_goods from '../goodsItem/card_goods.vue';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
// import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app';
|
||||
// import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js';
|
||||
let cardPages = ref(null);
|
||||
let props = defineProps({
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
// 动态生成与 tabs 同步的 refs 数组,供 useMescrollMore 使用
|
||||
// const mescrollItems = props.list.map(() => ref(null));
|
||||
// const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
|
||||
// mescrollItems,
|
||||
// onPageScroll,
|
||||
// onReachBottom,
|
||||
// );
|
||||
let tabIndex = ref(0);
|
||||
let goods = ref([]);
|
||||
let height = ref('');
|
||||
const navChange = (i) => {
|
||||
// scrollToLastY()
|
||||
tabIndex.value = i;
|
||||
upData()
|
||||
};
|
||||
const getData = (mescroll) => {
|
||||
if (!props.list || !props.list.length) {
|
||||
cardPages.value.getState(false);
|
||||
return;
|
||||
}
|
||||
SpuApi.getSpuPage({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
tagTypeId: props.list[tabIndex.value].id,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code !== 0) {
|
||||
if (cardPages.value) {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
const list = res.data.list || []; // 当前页数据
|
||||
if (mescroll.num == 1) goods.value = []; //如果是第一页需手动制空列表
|
||||
goods.value = goods.value.concat(list); //追加新数据
|
||||
hasMore.value = goods.value.length < res.data.total;
|
||||
// 计算容器高度
|
||||
getHeight(mescroll.num);
|
||||
|
||||
if (cardPages.value) {
|
||||
cardPages.value.getState(true, list.length);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
cardPages.value.getState(false);
|
||||
});
|
||||
};
|
||||
|
||||
const getHeight = (num) => {
|
||||
if (!goods.value.length) {
|
||||
// 541
|
||||
height.value = 10;
|
||||
return;
|
||||
}
|
||||
// 相除向上取整
|
||||
let cardHeight = Math.ceil(goods.value.length / 2) * 541;
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
const value1 = windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) - uni.upx2px(120);
|
||||
let value2 = uni.upx2px(cardHeight) + 55 + uni.upx2px(12);
|
||||
// if(hasMore){
|
||||
// value2 = uni.upx2px(cardHeight) + uni.upx2px(12)
|
||||
// }
|
||||
const isGreater = value1 > value2;
|
||||
if (isGreater) {
|
||||
height.value = value2;
|
||||
} else {
|
||||
height.value = value1;
|
||||
}
|
||||
// console.error(windowHeight)
|
||||
// console.log("最大高"+value1)
|
||||
// console.log("内容高"+value2)
|
||||
// console.error(height.value)
|
||||
};
|
||||
const upData = () => {
|
||||
if (cardPages.value) {
|
||||
cardPages.value.downCallback();
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.list,
|
||||
() => {
|
||||
if (props.list && props.list.length) {
|
||||
upData();
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scroll-x-wrapper {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.navs {
|
||||
// padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
height: 120rpx;
|
||||
// padding-bottom: 10rpx;
|
||||
.navItem {
|
||||
color: #777777;
|
||||
font-size: 32rpx;
|
||||
// width: 20%;
|
||||
// text-align: center;
|
||||
margin-right: 40rpx;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0; // 防止被压缩
|
||||
image {
|
||||
width: 40rpx;
|
||||
height: 12rpx;
|
||||
opacity: 0;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
}
|
||||
.tabIndex {
|
||||
color: #333333;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
image {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
.goodsPages {
|
||||
padding: 0 32rpx;
|
||||
padding-top: 12rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.cardItem {
|
||||
width: calc(50% - 8rpx);
|
||||
margin-right: 16rpx;
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="navs flex-center ju-flex-start">
|
||||
<view
|
||||
class="navItem flex-center flex-column"
|
||||
:class="{ tabIndex: i == tabIndex }"
|
||||
v-for="(v, i) in props.list"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="navText">
|
||||
{{ v.name }}
|
||||
</view>
|
||||
<image src="/static/index/active.png" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<mescroll-body
|
||||
:down="downOption"
|
||||
@init="mescrollInit"
|
||||
top="0"
|
||||
@down="downCallback"
|
||||
:up="upOption"
|
||||
@up="upCallback"
|
||||
@emptyclick="emptyClick"
|
||||
:height="10"
|
||||
>
|
||||
<goods-item :goods="goods" v-if="goods.length > 0"></goods-item>
|
||||
</mescroll-body>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import goodsItem from '../goodsItem/goodsItem2.vue';
|
||||
let props = defineProps({
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
let tabIndex = ref(0);
|
||||
let goods = ref([]);
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(); // 调用mescroll的hook
|
||||
|
||||
defineExpose({ getMescroll }); // 使父组件可以通过ref调用到getMescroll方法 (必须)
|
||||
const downOption = {
|
||||
use: false, // 是否启用下拉刷新; 默认true
|
||||
};
|
||||
const upOption = {
|
||||
noMoreSize: 4,
|
||||
empty:{
|
||||
tip: '~ 搜索无数据 ~', // 提示
|
||||
}
|
||||
};
|
||||
const upCallback = (mescroll) => {
|
||||
SpuApi.getSpuPage({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
tagTypeId: props.list[tabIndex.value].id,
|
||||
})
|
||||
.then((res) => {
|
||||
const list = res.data.list || []; // 当前页数据
|
||||
if (mescroll.num == 1) goods.value = []; //如果是第一页需手动制空列表
|
||||
goods.value = goods.value.concat(list); //追加新数据
|
||||
mescroll.endSuccess(list.length); // 请求成功, 结束加载
|
||||
})
|
||||
.catch(() => {
|
||||
mescroll.endErr(); // 请求失败, 结束加载
|
||||
});
|
||||
|
||||
mescroll.endErr(); // 请求失败, 结束加载
|
||||
};
|
||||
|
||||
//点击空布局按钮的回调
|
||||
const emptyClick = () => {
|
||||
uni.showToast({
|
||||
title: '点击了按钮,具体逻辑自行实现',
|
||||
});
|
||||
};
|
||||
// let tabIndex = ref(0);
|
||||
const navChange = (i) => {
|
||||
// scrollToLastY()
|
||||
goods.value = [];
|
||||
tabIndex.value = i;
|
||||
const m = getMescroll();
|
||||
m.setPageNum(1);
|
||||
m.resetUpScroll(false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navs {
|
||||
.navItem {
|
||||
color: #777777;
|
||||
font-size: 24rpx;
|
||||
width: 20%;
|
||||
// text-align: center;
|
||||
image {
|
||||
width: 40rpx;
|
||||
height: 12rpx;
|
||||
opacity: 0;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
}
|
||||
.tabIndex {
|
||||
color: #333333;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
image {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,315 @@
|
||||
<template>
|
||||
<view
|
||||
class="w100"
|
||||
:class="{
|
||||
'card-goods1': props.type == 1,
|
||||
'card-goods2': props.type == 2,
|
||||
'card-goods3': props.type == 3,
|
||||
}"
|
||||
>
|
||||
<view
|
||||
class="shrink"
|
||||
@click="utils.go('/pages/goods/info', { id: props.data.id })"
|
||||
:class="{
|
||||
goodsImg1: props.type == 1,
|
||||
goodsImg2: props.type == 2,
|
||||
goodsImg3: props.type == 3,
|
||||
}"
|
||||
>
|
||||
<image
|
||||
class=""
|
||||
:src="props.data.picUrl ? sheep.$url.cdn(props.data.picUrl) : '/static/icon/null1.png'"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</view>
|
||||
<view class="goodItem" :class="{itemBg: props.type == 1}" @click="utils.go('/pages/goods/info', { id: props.data.id })">
|
||||
<view class="wrap">
|
||||
<view
|
||||
class="title "
|
||||
:class="{ lineTwo: props.type == 2, lineOne: props.type == 1 || props.type == 3, c34: props.type == 2 || props.type == 1, c34: props.type == 3 }"
|
||||
>{{ props.data.name }} </view
|
||||
>
|
||||
<view
|
||||
class="flex-center m-t-10 m-b-12"
|
||||
:class="{ 'ju-between': props.data.tagSaleName, 'ju-flex-end': !props.data.tagSaleName }"
|
||||
v-if="props.type == 1"
|
||||
>
|
||||
<view class="label" v-if="props.data.tagSaleName">{{ props.data.tagSaleName }}</view>
|
||||
<view class="num">已售{{ props.data.salesCount }}</view>
|
||||
</view>
|
||||
<view v-else-if="props.type == 2">
|
||||
<view class="flex-center ju-between mt10 wrap">
|
||||
<view class="num size26 m-r-4">{{ props.data.categoryText }}</view>
|
||||
<view class="num">销量:{{ props.data.salesCount }}</view>
|
||||
</view>
|
||||
<view class="flex-row wrap" v-if="props.data.tagSaleName">
|
||||
<view
|
||||
class="label mr10 mb10"
|
||||
v-for="(v, i) in props.data.tagSaleName.split(',')"
|
||||
:key="i"
|
||||
>{{ v }}</view
|
||||
>
|
||||
<!-- <view class="label">标签2</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center ju-between">
|
||||
<view class="price"
|
||||
><span class="f500" style="font-size: 24rpx;">¥</span
|
||||
><span class="priceNum f500">{{ fen2yuan(props.data.price) }}</span>
|
||||
<span v-if="props.type == 1 && props.data.unit">/{{ props.data.unit || '' }}</span>
|
||||
<!-- <span
|
||||
class="marketPrice"
|
||||
v-else
|
||||
style="color: 20rpx; color: #777777; text-decoration: line-through; margin-left: 8rpx"
|
||||
>¥{{ fen2yuan(props.data.marketPrice) }}</span
|
||||
> -->
|
||||
</view>
|
||||
<!-- -->
|
||||
<uni-badge :text="props.data.cartCount" v-if="props.type == 2 && props.data.cartCount" absolute="rightTop" :customStyle="{background: '#FF0000'}">
|
||||
<view class="shopIcon" :class="{ 'shopIcon1': props.type == 2 }" @click.stop="changeSelectSku">
|
||||
<image src="/static/index/shop.png" mode="scaleToFill" />
|
||||
</view>
|
||||
</uni-badge>
|
||||
<view class="shopIcon" :class="{ 'shopIcon1': props.type == 2 }" @click.stop="changeSelectSku" v-else>
|
||||
<image src="/static/index/shop.png" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<s-select-sku
|
||||
v-if="showSelectSku"
|
||||
:goodsInfo="state.goodsInfo"
|
||||
:show="showSelectSku"
|
||||
@addCart="onAddCart"
|
||||
@buy="onBuy"
|
||||
@change="onSkuChange"
|
||||
@close="showSelectSku = false"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
type: {
|
||||
//1:首页 2:分类 3:搜索
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
search: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
watch(
|
||||
() => props.data,
|
||||
() => {},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
let showSelectSku = ref(false);
|
||||
const changeSelectSku = async () => {
|
||||
let res = await getData();
|
||||
showSelectSku.value = true;
|
||||
};
|
||||
const getData = async () => {
|
||||
let res = await SpuApi.getSpuDetail(props.data.id);
|
||||
if (res.code !== 0 || !res.data) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 加载到商品
|
||||
state.skeletonLoading = false;
|
||||
state.goodsInfo = res.data;
|
||||
|
||||
// 获取结算信息
|
||||
// getSettlementByIds(state.goodsId);
|
||||
};
|
||||
const state = reactive({
|
||||
goodsId: 0,
|
||||
skeletonLoading: true, // SPU 加载中
|
||||
goodsInfo: {}, // SPU 信息
|
||||
showSelectSku: false, // 是否展示 SKU 选择弹窗
|
||||
selectedSku: {}, // 选中的 SKU
|
||||
settlementSku: {}, // 结算的 SKU:由于 selectedSku 不进行默认选中,所以初始使用结算价格最低的 SKU 作为基础展示
|
||||
showModel: false, // 是否展示 Coupon 优惠劵的弹窗
|
||||
couponInfo: [], // 可领取的 Coupon 优惠劵的列表
|
||||
showActivityModel: false, // 【满减送/限时折扣】是否展示 Activity 营销活动的弹窗
|
||||
rewardActivity: {}, // 【满减送】活动
|
||||
activityList: [], // 【秒杀/拼团/砍价】可参与的 Activity 营销活动的列表
|
||||
});
|
||||
|
||||
// 添加购物车
|
||||
function onAddCart(e) {
|
||||
//console.log(e);
|
||||
if (!e.id) {
|
||||
sheep.$helper.toast('请选择商品规格');
|
||||
return;
|
||||
}
|
||||
sheep.$store('cart').add(e);
|
||||
showSelectSku.value = false;
|
||||
}
|
||||
|
||||
// 立即购买
|
||||
function onBuy(e) {
|
||||
if (!e.id) {
|
||||
sheep.$helper.toast('请选择商品规格');
|
||||
return;
|
||||
}
|
||||
showSelectSku.value = false;
|
||||
sheep.$router.go('/pages/order/confirm', {
|
||||
data: JSON.stringify({
|
||||
items: [
|
||||
{
|
||||
skuId: e.id,
|
||||
count: e.goods_num,
|
||||
categoryId: state.goodsInfo.categoryId,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// 规格变更
|
||||
function onSkuChange(e) {
|
||||
state.selectedSku = e;
|
||||
state.settlementSku = e;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goodItem {
|
||||
padding: 20rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 32rpx;
|
||||
border-radius: 0 0 8rpx 8rpx;
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
line-height: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
.label {
|
||||
font-size: 20rpx;
|
||||
color: #ff5040;
|
||||
border: 1px solid #ff5040;
|
||||
border-radius: 8rpx;
|
||||
height: 34rpx;
|
||||
line-height: 34rpx;
|
||||
padding: 0 8rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.num {
|
||||
color: #777777;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.price {
|
||||
color: #ee0a24;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.priceNum {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.shopIcon {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.shopIcon1{
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.shrink{
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.goodsImg2 {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
|
||||
}
|
||||
.goodsImg3 {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
}
|
||||
.goodsImg1 {
|
||||
// width: 100%;
|
||||
// aspect-ratio: 1/1;
|
||||
border-radius:10rpx 10rpx 0 0;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.goodsImg1::before{
|
||||
content: '';
|
||||
display: block;
|
||||
padding-top: 100%;
|
||||
}
|
||||
.goodsImg1 image{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.card-goods1 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.card-goods2,
|
||||
.card-goods3 {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-bottom: 36rpx;
|
||||
flex-wrap: nowrap;
|
||||
.goodItem {
|
||||
flex: 1;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
padding-left: 12rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
.card-goods3 {
|
||||
.priceNum {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.marketPrice {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.itemBg{
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-show="i === props.index">
|
||||
<!-- top="120"下拉布局往下偏移,防止被悬浮菜单遮住 -->
|
||||
<mescroll-body
|
||||
@init="mescrollInit"
|
||||
top="0"
|
||||
:down="downOption"
|
||||
@down="downCallback"
|
||||
:up="upOption"
|
||||
@up="upCallback"
|
||||
@emptyclick="emptyClick"
|
||||
:height="10"
|
||||
>
|
||||
<!-- 数据列表 -->
|
||||
<!-- <good-list :list="goods"></good-list> -->
|
||||
<!-- <view v-for="(v,i) in goods" :key="i">
|
||||
{{ v.picUrl }}
|
||||
</view> -->
|
||||
|
||||
<!-- <view class="flex-row">
|
||||
<view class="flex1 cardItem" v-for="(v, i) in goods" :key="i">
|
||||
<card_goods :data="v"></card_goods>
|
||||
</view>
|
||||
</view> -->
|
||||
<custom-waterfalls-flow-vue3-2
|
||||
:value="goods"
|
||||
:column="props.column" :columnSpace="1"
|
||||
:seat="2"
|
||||
imageKey="picUrl"
|
||||
v-if="goods.length"
|
||||
>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view v-for="(v, i) in goods" :key="i" :slot="`slot${i}`">
|
||||
{{goods.length}}
|
||||
<!-- <card_goods :data="v"></card_goods> -->
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<template v-slot:default="item">
|
||||
<card_goods :data="item"></card_goods>
|
||||
</template>
|
||||
<!-- <view v-for="(v, i) in goods" :key="i" v-slot:default="v">
|
||||
<card_goods :data="v"></card_goods>
|
||||
</view> -->
|
||||
<!-- #endif -->
|
||||
</custom-waterfalls-flow-vue3-2>
|
||||
</mescroll-body>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import card_goods from './card_goods.vue'
|
||||
let goods = ref([]);
|
||||
const column = ref(2);
|
||||
const columnChange = ref(false);
|
||||
const props = defineProps({
|
||||
i: Number, // 每个tab页的专属下标
|
||||
index: {
|
||||
// 当前tab的下标
|
||||
type: Number,
|
||||
default() {
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
tabs: {
|
||||
// 为了请求数据,演示用,可根据自己的项目判断是否要传
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
column: {
|
||||
type: Number,
|
||||
default() {
|
||||
return 2;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
watch(props.column, (val) => {
|
||||
if (val !== column.value) {
|
||||
columnChange.value = true;
|
||||
setTimeout(() => {
|
||||
columnChange.value = false;
|
||||
}, 100);
|
||||
column.value = val;
|
||||
}
|
||||
});
|
||||
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(); // 调用mescroll的hook
|
||||
|
||||
defineExpose({ getMescroll }); // 使父组件可以通过ref调用到getMescroll方法 (必须)
|
||||
|
||||
const isAutoInit = props.i === props.index; // 自动加载当前tab的数据
|
||||
const downOption = {
|
||||
auto: isAutoInit, // 自动加载当前tab的数据
|
||||
};
|
||||
|
||||
const upOption = {
|
||||
auto: false, // 不自动加载
|
||||
noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
||||
empty: {
|
||||
tip: '~ 空空如也 ~', // 提示
|
||||
},
|
||||
};
|
||||
|
||||
const isInit = ref(isAutoInit); // 当前tab是否已初始化
|
||||
// 监听下标的变化
|
||||
watch(
|
||||
() => props.index,
|
||||
(val) => {
|
||||
if (props.i === val && !isInit.value) mescrollTrigger();
|
||||
},
|
||||
);
|
||||
|
||||
// 主动触发加载
|
||||
const mescrollTrigger = () => {
|
||||
isInit.value = true; // 标记为true
|
||||
const mescroll = getMescroll();
|
||||
if (mescroll) {
|
||||
if (mescroll.optDown.use) {
|
||||
mescroll.triggerDownScroll();
|
||||
} else {
|
||||
mescroll.triggerUpScroll();
|
||||
}
|
||||
}
|
||||
};
|
||||
const upCallback = (mescroll) => {
|
||||
SpuApi.getSpuPage({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
tagTypeId: props.tabs[props.i].id,
|
||||
})
|
||||
.then((res) => {
|
||||
const list = res.data.list || []; // 当前页数据
|
||||
if(list.length){
|
||||
list.forEach(e=>{
|
||||
e.hide = true
|
||||
})
|
||||
}
|
||||
if (mescroll.num == 1) goods.value = []; //如果是第一页需手动制空列表
|
||||
goods.value = goods.value.concat(list); //追加新数据
|
||||
mescroll.endSuccess(list.length); // 请求成功, 结束加载
|
||||
})
|
||||
.catch(() => {
|
||||
mescroll.endErr(); // 请求失败, 结束加载
|
||||
});
|
||||
|
||||
mescroll.endErr(); // 请求失败, 结束加载
|
||||
};
|
||||
|
||||
//点击空布局按钮的回调
|
||||
const emptyClick = () => {
|
||||
uni.showToast({
|
||||
title: '点击了按钮,具体逻辑自行实现',
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.cardItem{
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<view class="goodsItem-container">
|
||||
<view v-show="i === props.index">
|
||||
<!-- top="120"下拉布局往下偏移,防止被悬浮菜单遮住 -->
|
||||
<mescroll-uni
|
||||
@init="mescrollInit"
|
||||
top="0"
|
||||
:down="downOption"
|
||||
@down="downCallback"
|
||||
:up="upOption"
|
||||
@up="upCallback"
|
||||
@emptyclick="emptyClick"
|
||||
v-if="i === props.index"
|
||||
:height="height + 'px'"
|
||||
>
|
||||
<!-- 数据列表 -->
|
||||
<!-- <good-list :list="goods"></good-list> -->
|
||||
<!-- <view v-for="(v,i) in goods" :key="i">
|
||||
{{ v.picUrl }}
|
||||
</view> -->
|
||||
|
||||
<view class="flex-row wrap w100" ref="cardRef">
|
||||
<view class="cardItem" v-for="(v, i) in goods" :key="i">
|
||||
<card_goods :data="v"></card_goods>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, getCurrentInstance } from 'vue';
|
||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import card_goods from './card_goods.vue';
|
||||
const { proxy } = getCurrentInstance();
|
||||
let goods = ref([]);
|
||||
const column = ref(2);
|
||||
const columnChange = ref(false);
|
||||
const height = ref(0);
|
||||
const props = defineProps({
|
||||
i: Number, // 每个tab页的专属下标
|
||||
index: {
|
||||
// 当前tab的下标
|
||||
type: Number,
|
||||
default() {
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
tabs: {
|
||||
// 为了请求数据,演示用,可根据自己的项目判断是否要传
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
column: {
|
||||
type: Number,
|
||||
default() {
|
||||
return 2;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.column,
|
||||
(val) => {
|
||||
if (val !== column.value) {
|
||||
columnChange.value = true;
|
||||
setTimeout(() => {
|
||||
columnChange.value = false;
|
||||
}, 100);
|
||||
column.value = val;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom); // 调用mescroll的hook
|
||||
|
||||
defineExpose({ getMescroll }); // 使父组件可以通过ref调用到getMescroll方法 (必须)
|
||||
|
||||
const isAutoInit = props.i === props.index; // 自动加载当前tab的数据
|
||||
const downOption = {
|
||||
auto: isAutoInit, // 自动加载当前tab的数据
|
||||
};
|
||||
|
||||
const upOption = {
|
||||
use: true, // 必须明确启用上拉加载功能
|
||||
auto: true, // 不自动加载
|
||||
noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
||||
empty: {
|
||||
tip: '~ 空空如也 ~', // 提示
|
||||
},
|
||||
page: {
|
||||
num: 0, // 当前页码,默认0,回调之前会加1
|
||||
size: 10, // 每页数据的数量
|
||||
},
|
||||
offset: 150, // 距底部100px时触发上拉加载
|
||||
};
|
||||
|
||||
const isInit = ref(isAutoInit); // 当前tab是否已初始化
|
||||
// 监听下标的变化
|
||||
watch(
|
||||
() => props.index,
|
||||
(val) => {
|
||||
if (props.i === val && !isInit.value) mescrollTrigger();
|
||||
},
|
||||
);
|
||||
|
||||
// 主动触发加载
|
||||
const mescrollTrigger = () => {
|
||||
isInit.value = true; // 标记为true
|
||||
const mescroll = getMescroll();
|
||||
if (mescroll) {
|
||||
if (mescroll.optDown.use) {
|
||||
mescroll.triggerDownScroll();
|
||||
} else {
|
||||
mescroll.triggerUpScroll();
|
||||
}
|
||||
}
|
||||
};
|
||||
let cardRef = ref(null);
|
||||
// 是否有下一页
|
||||
let hasMore = ref(true);
|
||||
const upCallback = (mescroll) => {
|
||||
SpuApi.getSpuPage({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
tagTypeId: props.tabs[props.i].id,
|
||||
})
|
||||
.then((res) => {
|
||||
const list = res.data.list || []; // 当前页数据
|
||||
// if(list.length){
|
||||
// list.forEach(e=>{
|
||||
// e.hide = true
|
||||
// })
|
||||
// }
|
||||
if (mescroll.num == 1) goods.value = []; //如果是第一页需手动制空列表
|
||||
goods.value = goods.value.concat(list); //追加新数据
|
||||
hasMore.value = goods.value.length < res.data.total;
|
||||
// 计算容器高度
|
||||
getHeight(mescroll.num);
|
||||
|
||||
mescroll.endSuccess(list.length); // 请求成功, 结束加载
|
||||
})
|
||||
.catch(() => {
|
||||
mescroll.endErr(); // 请求失败, 结束加载
|
||||
});
|
||||
};
|
||||
|
||||
//点击空布局按钮的回调
|
||||
const emptyClick = () => {
|
||||
uni.showToast({
|
||||
title: '点击了按钮,具体逻辑自行实现',
|
||||
});
|
||||
};
|
||||
const getHeight = (num) => {
|
||||
if (!goods.value.length) {
|
||||
// 541
|
||||
height.value = 10
|
||||
return
|
||||
}
|
||||
// 相除向上取整
|
||||
let cardHeight = Math.ceil(goods.value.length / 2) * (541)
|
||||
let sysInfo = uni.getSystemInfoSync()
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
const value1 = windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) - uni.upx2px(120)
|
||||
let value2 = uni.upx2px(cardHeight) + 55 + uni.upx2px(12)
|
||||
// if(hasMore){
|
||||
// value2 = uni.upx2px(cardHeight) + uni.upx2px(12)
|
||||
// }
|
||||
const isGreater = value1 > value2;
|
||||
if(isGreater){
|
||||
height.value = value2
|
||||
}else{
|
||||
height.value = value1
|
||||
}
|
||||
// console.error(windowHeight)
|
||||
// console.log("最大高"+value1)
|
||||
// console.log("内容高"+value2)
|
||||
// console.error(height.value)
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goodsItem-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.cardItem {
|
||||
width: calc(50% - 8rpx);
|
||||
margin-right: 16rpx;
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<custom-waterfalls-flow-vue3-2
|
||||
:value="props.goods"
|
||||
:column="props.column"
|
||||
:columnSpace="3"
|
||||
imageKey="picUrl"
|
||||
v-if="props.goods.length"
|
||||
>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view v-for="(v, i) in props.goods" :key="i" :slot="`slot${i}`">
|
||||
<card_goods :data="v"></card_goods>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<template v-slot:default="item">
|
||||
<card_goods :data="item"></card_goods>
|
||||
</template>
|
||||
<!-- #endif -->
|
||||
</custom-waterfalls-flow-vue3-2>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import card_goods from './card_goods.vue'
|
||||
const props = defineProps({
|
||||
goods: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
column: {
|
||||
type: Number,
|
||||
default() {
|
||||
return 1;
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goodItem{
|
||||
background-color: #fff;
|
||||
padding: 20rpx 26rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 32rpx;
|
||||
.title{
|
||||
font-size: 24rpx;
|
||||
line-height: 30rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
.label{
|
||||
font-size: 20rpx;
|
||||
color: #ff5040;
|
||||
border: 1px solid #ff5040;
|
||||
border-radius: 8rpx;
|
||||
height: 34rpx;
|
||||
line-height: 34rpx;
|
||||
padding: 0 8rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top: 10rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.num{
|
||||
color: #777777;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.price{
|
||||
color: #EE0A24;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.priceNum{
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.shopIcon{
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="maoScroll-main" :style="`height:${(lineHeight + props.mt) * showLine}rpx;`">
|
||||
<view :style="`margin-top:-${marginTop}rpx;`">
|
||||
<view
|
||||
v-for="(item, index) in showdata"
|
||||
:key="`maoScroll${index}`"
|
||||
:style="`height:${lineHeight}rpx;margin-top:${props.mt}rpx;`"
|
||||
|
||||
>
|
||||
<slot :line="item" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, onMounted, onUnmounted, defineProps } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
showNum: {
|
||||
type: Number,
|
||||
default: 3,
|
||||
},
|
||||
lineHeight: {
|
||||
type: Number,
|
||||
default: 60,
|
||||
},
|
||||
animationScroll: {
|
||||
type: Number,
|
||||
default: 500,
|
||||
},
|
||||
animation: {
|
||||
type: Number,
|
||||
default: 2000,
|
||||
},
|
||||
mt: {
|
||||
type: Number,
|
||||
default:16
|
||||
}
|
||||
});
|
||||
const showdata = ref([]);
|
||||
const marginTop = ref(0);
|
||||
const showLine = ref(0);
|
||||
let animationInterval = null;
|
||||
let stepInterval = null;
|
||||
|
||||
// 初始化函数
|
||||
const init = () => {
|
||||
// 清除之前的定时器,避免内存泄漏
|
||||
if (animationInterval) {
|
||||
clearInterval(animationInterval);
|
||||
}
|
||||
if (stepInterval) {
|
||||
clearInterval(stepInterval);
|
||||
}
|
||||
|
||||
showLine.value = props.showNum < props.data.length ? props.showNum : props.data.length;
|
||||
showdata.value = [];
|
||||
|
||||
// 填充数据
|
||||
for (let i = 0; i < props.data.length; i++) {
|
||||
showdata.value.push(props.data[i]);
|
||||
}
|
||||
for (let i = 0; i < showLine.value; i++) {
|
||||
showdata.value.push(props.data[i]);
|
||||
}
|
||||
|
||||
// 启动定时器
|
||||
animationInterval = setInterval(animationFunc, props.animation);
|
||||
};
|
||||
|
||||
// 动画函数
|
||||
const animationFunc = () => {
|
||||
if (marginTop.value >= props.data.length * props.lineHeight) {
|
||||
marginTop.value = 0;
|
||||
}
|
||||
|
||||
const stepTime = props.animationScroll / props.lineHeight;
|
||||
let step = 0;
|
||||
|
||||
// 清除之前可能存在的步进定时器
|
||||
if (stepInterval) {
|
||||
clearInterval(stepInterval);
|
||||
}
|
||||
|
||||
stepInterval = setInterval(() => {
|
||||
marginTop.value++;
|
||||
step++;
|
||||
if (step >= props.lineHeight) {
|
||||
clearInterval(stepInterval);
|
||||
stepInterval = null;
|
||||
}
|
||||
}, stepTime);
|
||||
};
|
||||
|
||||
// 监听数据变化
|
||||
watch(
|
||||
() => props.data,
|
||||
() => {
|
||||
init();
|
||||
},
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
// 组件挂载时初始化
|
||||
onMounted(() => {
|
||||
init();
|
||||
});
|
||||
|
||||
// 组件卸载时清理定时器
|
||||
onUnmounted(() => {
|
||||
if (animationInterval) {
|
||||
clearInterval(animationInterval);
|
||||
}
|
||||
if (stepInterval) {
|
||||
clearInterval(stepInterval);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.maoScroll-main {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="maoScroll-main" :style="'height:'+(lineHeight*showLine)+'rpx;'">
|
||||
<view :style="'margin-top:-'+marginTop+'rpx;'">
|
||||
<view v-for="(item,index) in showdata" :key="'maoScroll'+index" :style="'height:'+lineHeight+'rpx;'">
|
||||
<slot :line="item" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'maoScroll',
|
||||
data() {
|
||||
return {
|
||||
showdata: [],
|
||||
marginTop: 0,
|
||||
showLine: 0,
|
||||
}
|
||||
},
|
||||
props:{
|
||||
data: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
showNum: {
|
||||
type: Number,
|
||||
default: 3,
|
||||
},
|
||||
lineHeight: {
|
||||
type: Number,
|
||||
default: 60,
|
||||
},
|
||||
animationScroll: {
|
||||
type: Number,
|
||||
default: 500,
|
||||
},
|
||||
animation: {
|
||||
type: Number,
|
||||
default: 2000,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init: function(){
|
||||
this.showLine = this.showNum < this.data.length ? this.showNum : this.data.length;
|
||||
for(let i = 0; i < this.data.length; i++){
|
||||
this.showdata.push(this.data[i]);
|
||||
}
|
||||
for(let i = 0; i < this.showLine; i++){
|
||||
this.showdata.push(this.data[i]);
|
||||
}
|
||||
setInterval(this.animationFunc, this.animation);
|
||||
},
|
||||
animationFunc: function(){
|
||||
if(this.marginTop >= this.data.length*this.lineHeight){
|
||||
this.marginTop = 0;
|
||||
}
|
||||
let stepTime = this.animationScroll/this.lineHeight;
|
||||
|
||||
var step = 0;
|
||||
let self = this;
|
||||
var index = setInterval(function(){
|
||||
self.marginTop = self.marginTop + 1;
|
||||
step++;
|
||||
if (step >= self.lineHeight) {
|
||||
clearInterval(index);
|
||||
}
|
||||
}, stepTime);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
data(outdata, newdata) {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.maoScroll-main{width: 100%;overflow: hidden;}
|
||||
</style>
|
||||
@@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<view class="order_con" :class="{ bg24: props.theme == 2 }">
|
||||
|
||||
<view class="flex-center ju-between m-b-28"
|
||||
v-if="(props.type == 2 || props.type == 4) && props.data.logisticsNo">
|
||||
<view>{{ props.data.logisticsName }} {{ props.data.logisticsNo }}</view>
|
||||
<view class="flex-center">
|
||||
<view @click.stop="onCopy(props.data.logisticsNo)">复制</view>
|
||||
<truckLine :data="props.data" :code="2" v-if="props.data.deliveryTime && props.data.logisticsNo"></truckLine>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="con_item flex-center ju-between" v-for="(v, i) in props.data.items" :key="i"
|
||||
:class="{ 'al-flex-start': props.type == 3 || props.type == 4 }">
|
||||
<view class="order_img shrink" :class="{ 'm-r-16': props.type == 3 }">
|
||||
<image :src="`${v.picUrl}`" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="flex1">
|
||||
<view class="flex-row ju-between m-b-6">
|
||||
<view class="size28 spuName lineTwo" :class="{ 'p-r-10': props.type == 3, c0: props.theme == 2 }">
|
||||
{{ v.spuName }}
|
||||
</view>
|
||||
<view class="shrink price" v-if="props.type != 4"><span class="size24">¥</span><span class="size36"
|
||||
style="font-weight: 600">{{ fen2yuan(v.price) }}</span></view>
|
||||
</view>
|
||||
<view v-if="props.type == 4">
|
||||
<view class="m-b-12 size24 h_52" v-for="(item, i) in v.items" :key="i">
|
||||
<view class="flex1 flex-center ju-between h_52 bg18 radius8 p-l-8 p-r-16">
|
||||
<view class="lineOne c19">
|
||||
{{item?.properties.length > 1? item?.properties.reduce((items2, items) => items2.valueName + ' ' + items.valueName,): item?.properties[0].valueName}}
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<view class="c19">x{{ item.count }}</view>
|
||||
<view class=" size28 m-l-12 weight900">¥<span class="">{{ fen2yuan(item.price) }}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="c13 size28 weight900">
|
||||
¥<span class="size40">{{ fen2yuan(item.payPrice) }}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between" :class="{ 'm-t-8': props.type == 3 }" v-else>
|
||||
<view class="valueName size28" :class="{ c19: props.theme == 2 }">{{
|
||||
v.properties.map((property) => property.valueName).join(' ')
|
||||
}}</view>
|
||||
<view class="shrink size28 c_333" :class="{ c0: props.theme == 2 }">{{
|
||||
`x${v.count}`
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="btn flex-row ju-flex-end" v-if="props.type == 2">
|
||||
<button class="ss-reset-button btnItem btnItem1"
|
||||
v-if="[10, 20].includes(props.data.status) && v.afterSaleStatus === 0" @tap.stop="
|
||||
sheep.$router.go('/pages/order/aftersale/apply', {
|
||||
orderId: props.data.id,
|
||||
itemId: v.id,
|
||||
})
|
||||
">
|
||||
申请售后
|
||||
</button>
|
||||
<view class="btnItem btnItem1" v-if="v.afterSaleStatus === 10" @click="cancelAfterSale(v)">
|
||||
取消售后
|
||||
</view>
|
||||
<view class="btnItem" v-if="v.afterSaleStatus === 20"> 售后成功 </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, getCurrentInstance, defineProps } from 'vue';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||
import sheep from '@/sheep';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let emit = defineEmits(['getOrderDetail']);
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: '0', //0列表2订单详情 3订单列表 4ai订单详情
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: '2', //1浅色 2深色
|
||||
},
|
||||
});
|
||||
const cancelAfterSale = (v) => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要取消此申请吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
const { code } = await AfterSaleApi.cancelAfterSale(v.afterSaleId);
|
||||
if (code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
const getOrderDetail = () => {
|
||||
emit('getOrderDetail');
|
||||
};
|
||||
const onCopy = (text) => {
|
||||
sheep.$helper.copyText(text);
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.order_con {
|
||||
.con_item {
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.order_img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
margin-right: 12rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.spuName {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.valueName {
|
||||
color: #777777;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #ee0a24;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.btnItem {
|
||||
line-height: 50rpx;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 94px 94px 94px 94px;
|
||||
margin-top: 12rpx;
|
||||
font-size: 24rpx;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.btnItem1 {
|
||||
background: #F2F2F2;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<view class="card_order bg24 size34" @click="
|
||||
utils.go('/pages/order/detail', { id: props.index != 5 ? props.data.id : props.data.orderId })
|
||||
">
|
||||
<view class="flex-center ju-between createTime">
|
||||
<view class="flex-center shrink">
|
||||
<view class="size28">订单编号: {{ props.data.no }}</view>
|
||||
<view class="copy flex-center" @tap.stop="onCopy(props.data.no)" style="margin-left: 10px">
|
||||
<image :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="stateText size28" style="margin-left: 10px" :class="formatOrderColor(props.data)"
|
||||
v-if="props.index != 5">
|
||||
{{ formatOrderStatus(props.data) }}
|
||||
</view>
|
||||
<view class="stateText size28" v-else>
|
||||
{{ formatAfterSaleStatus(props.data) }}
|
||||
</view>
|
||||
</view>
|
||||
<card_order :data="props.data" v-if="props.index != 5" type="3"></card_order>
|
||||
<view v-else class="con_item flex-center ju-between al-flex-start">
|
||||
<view class="order_img shrink">
|
||||
<image :src="`${props.data.picUrl}`" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="flex1 flex-column ju-between">
|
||||
<view class="flex-row ju-between">
|
||||
<view class="size28 spuName lineTwo c0">{{ props.data.spuName }}</view>
|
||||
<view class="shrink price">
|
||||
<span class="size24">¥</span><span class="size36"
|
||||
style="font-weight: 600">{{ fen2yuan(props.data.refundPrice) }}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between m-t-10">
|
||||
<view class="valueName size24">{{
|
||||
props.data.properties.map((property) => property.valueName).join(' ')
|
||||
}}</view>
|
||||
<view class="shrink size24 c0">{{ `x${props.data.count}` }}</view>
|
||||
</view>
|
||||
<view class="btn flex-row ju-flex-end">
|
||||
<button class="ss-reset-button btnItem btnItem1" @tap.stop="onApply"
|
||||
v-if="statusChange(['10', '20', '30', '62', '63'], String(props.data.status))">取消售后</button>
|
||||
<button class="ss-reset-button btnItem btnItem1" style="margin-left: 20rpx"
|
||||
v-if="statusChange(['20'], String(props.data.status))" @tap.stop="
|
||||
sheep.$router.go('/pages/order/aftersale/return-delivery', { id: props.data.id })
|
||||
">
|
||||
填写物流信息
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-flex-end" v-if="props.index != 5">
|
||||
<view class="flex-center size24">{{ `共${props.data.productCount}件商品 合计: `
|
||||
}}
|
||||
<!-- <view class="price">¥{{ fen2yuan(props.data.payPrice) }}</view> -->
|
||||
<view class="shrink price"><span class="size24">¥</span><span class="size36"
|
||||
style="font-weight: 600;">{{ fen2yuan(props.data.payPrice) }}</span></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="margin-top: 32rpx" v-if="props.index != 5">
|
||||
<card_orderBan :data="props.data" @downData="downData"></card_orderBan>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
nextTick,
|
||||
defineProps,
|
||||
defineEmits,
|
||||
} from 'vue';
|
||||
import {
|
||||
fen2yuan,
|
||||
formatOrderColor,
|
||||
formatOrderStatus,
|
||||
handleOrderButtons,
|
||||
formatAfterSaleStatus,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import card_order from './card_order.vue';
|
||||
import card_orderBan from '@/components/card_orderBan/card_orderBan.vue';
|
||||
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||
import sheep from '@/sheep/index';
|
||||
let emit = defineEmits(['downData']);
|
||||
let { proxy } = getCurrentInstance();
|
||||
let props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
let data = reactive({});
|
||||
watch(
|
||||
() => props.data,
|
||||
(val) => {
|
||||
data = val;
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
);
|
||||
const downData = () => {
|
||||
emit('downData');
|
||||
};
|
||||
// 复制
|
||||
const onCopy = (no) => {
|
||||
proxy.$sheep.$helper.copyText(no);
|
||||
};
|
||||
const onApply = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要取消此申请吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
const { code } = await AfterSaleApi.cancelAfterSale(props.data.id);
|
||||
if (code === 0) {
|
||||
emit('downData');
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
const statusChange = (arr, status) => {
|
||||
return arr.indexOf(status) != -1;
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.card_order {
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.stateText {}
|
||||
|
||||
.createTime {
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #ee0a24;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.copy {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-left: 14rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.con_item {
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.order_img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
margin-right: 12rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.spuName {
|
||||
color: #323232;
|
||||
}
|
||||
|
||||
.valueName {
|
||||
color: #777777;
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #ee0a24;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.btnItem {
|
||||
line-height: 50rpx;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 94px 94px 94px 94px;
|
||||
margin-top: 12rpx;
|
||||
font-size: 24rpx;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.btnItem1 {
|
||||
background: #F2F2F2;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,625 @@
|
||||
<template>
|
||||
<view class="page_right flex-column" :class="{ search: props.source == 'search' }">
|
||||
<view class="screen flex-center ju-evenly">
|
||||
<view v-for="(v, i) in dataObj.screenNav" :key="i" class="screenItem flex-center"
|
||||
:class="{ activeItem: v.status }" @click="screenChange(i)">
|
||||
<view class="">{{ v.name }}</view>
|
||||
<view class="c_icon flex-column" v-if="i != 2">
|
||||
<image class="icon_up" :src="`/static/icon/screenUp${v.status == 1 ? 1 : 0}.svg`"
|
||||
mode="scaleToFill" />
|
||||
<image class="icon_down" :src="`/static/icon/screenDown${v.status == 2 ? 1 : 0}.svg`"
|
||||
mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="c_icon flex-column" v-else>
|
||||
<image v-if="v.status == 1" class="icon_up" :src="`/static/icon/screenUp1.svg`"
|
||||
mode="scaleToFill" />
|
||||
<image v-if="v.status == 2 || !v.status" class="icon_down" :src="`/static/icon/screenDown0.svg`" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods w100 flex1">
|
||||
<mescroll-uni @init="mescrollInit" @down="downCallback" :up="upOption" @up="upCallback"
|
||||
:height="props.height">
|
||||
<view v-for="(v, i) in props.dataList" :key="i" class="goodsItem">
|
||||
<card_goods :data="v" :type="props.type"></card_goods>
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
<!-- 筛选条件 -->
|
||||
<su-popup :show="show" round="10" @close="close">
|
||||
<view class="screen_popup flex-column ju-between">
|
||||
<view class="screen_title center">
|
||||
<view class="size32 f500 c34">全部筛选</view>
|
||||
<uni-icons class="colse" type="closeempty" color="#333333" size="20" @click="close" />
|
||||
</view>
|
||||
<view class="screen_content flex-row flex1">
|
||||
<view class="screen_left">
|
||||
<view v-for="(v, i) in screenNav" :key="i" @click="screenNavChange(i, v.id)"
|
||||
class="screen_nav_item center" :class="{ activeItem: screenIndex == i }">
|
||||
{{ v.name }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="screen_right flex1" ref="rightRef">
|
||||
<scroll-view scroll-y="true" style="height: 50vh;" :scroll-into-view="scrollIntoView"
|
||||
:scroll-with-animation="true">
|
||||
<view :id="'item' + i" v-for="(v, i) in screenNav" :key="i" class="screen_right_item"
|
||||
:ref="(ref) => (itemRefs[i] = ref)">
|
||||
<view>
|
||||
<view class="screen_title">{{ v.title }}</view>
|
||||
<view class="screen_data flex-row wrap">
|
||||
<view v-for="(item, index) in v.data" :key="index"
|
||||
class="screen_iteem flex-center" @click="screenItemClick(i, index, item)"
|
||||
:class="{
|
||||
screen_activeItem: v.ids.includes(item.id),
|
||||
screen_none: index >= v.colMax - 1 && !v.more,
|
||||
screen_iteem1: v.col == 2,
|
||||
screen_iteem2: v.col == 3,
|
||||
}">
|
||||
<view class="size28 flex-center lineTwo center">{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="screen_moreIteem center flex-center"
|
||||
v-if="v.data.length >= v.colMax - 1 && !v.more && v.name != '价格区间'"
|
||||
@click="v.more = true">
|
||||
<view class="moreText size28">更多</view>
|
||||
<view class="down"></view>
|
||||
</view>
|
||||
<view class="flex-center priceBox ju-between" v-if="v.name == '价格区间'">
|
||||
<input class="flex1" type="number" placeholder="自定最低价"
|
||||
placeholder-style="text-align: center;color: #5a6981;font-size: 28rpx;"
|
||||
v-model="v.arr.minValue" />
|
||||
<text class="">-</text>
|
||||
<input class="flex1" type="number" placeholder="自定最高价"
|
||||
placeholder-style="text-align: center;color: #5a6981;font-size: 28rpx;"
|
||||
v-model="v.arr.maxValue" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="screen_btns flex-center ju-between">
|
||||
<view class="screen_clear screen_btn size32 center" @click="screenClear">清空选择</view>
|
||||
<view class="screen_confirm screen_btn center size32" @click="screenConfirm">确认</view>
|
||||
</view>
|
||||
</view>
|
||||
</su-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import * as api from '@/sheep/api/index/index.js';
|
||||
import {
|
||||
getCurrentInstance,
|
||||
defineProps,
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
nextTick
|
||||
} from 'vue';
|
||||
import {
|
||||
onPageScroll,
|
||||
onReachBottom
|
||||
} from '@dcloudio/uni-app';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
import card_goods from '@/components/goodsItem/card_goods.vue';
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app';
|
||||
const {
|
||||
mescrollInit,
|
||||
downCallback,
|
||||
getMescroll
|
||||
} = useMescroll(onPageScroll, onReachBottom); // 调用mescroll的hook
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
dataList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
subclassification: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '50%',
|
||||
},
|
||||
source: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 2,
|
||||
},
|
||||
});
|
||||
const dataObj = reactive({
|
||||
screenNav: [{
|
||||
name: '销量',
|
||||
status: 0,
|
||||
},
|
||||
{
|
||||
name: '价格',
|
||||
status: 0,
|
||||
},
|
||||
{
|
||||
name: '筛选',
|
||||
status: 0,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const upOption = {
|
||||
noMoreSize: 4,
|
||||
empty: {
|
||||
tip: '~ 无数据 ~', // 提示
|
||||
},
|
||||
};
|
||||
const changeData = () => {
|
||||
const mescroll = getMescroll();
|
||||
if (mescroll) {
|
||||
mescroll.resetUpScroll();
|
||||
}
|
||||
};
|
||||
let dataParams = ref({});
|
||||
let screenObj = ref({});
|
||||
const upCallback = async (mescroll) => {
|
||||
let params = {
|
||||
...dataParams.value,
|
||||
...screenObj.value,
|
||||
};
|
||||
proxy.$emit('getData', {
|
||||
...mescroll,
|
||||
params,
|
||||
});
|
||||
};
|
||||
const screenChange = (i) => {
|
||||
let obj = {
|
||||
sortAsc: true,
|
||||
sortField: 'salesCount', //salesCount销量 price价格
|
||||
};
|
||||
if (i == 0) {
|
||||
dataObj.screenNav[1].status = 0;
|
||||
}
|
||||
if (i == 1) {
|
||||
dataObj.screenNav[0].status = 0;
|
||||
}
|
||||
switch (dataObj.screenNav[i].status) {
|
||||
case 0:
|
||||
dataObj.screenNav[i].status = 1;
|
||||
obj.sortAsc = true;
|
||||
break;
|
||||
case 1:
|
||||
if (i != 2) {
|
||||
dataObj.screenNav[i].status = 2;
|
||||
} else {
|
||||
dataObj.screenNav[i].status = 0;
|
||||
}
|
||||
obj.sortAsc = false;
|
||||
|
||||
break;
|
||||
case 2:
|
||||
dataObj.screenNav[i].status = 1;
|
||||
break;
|
||||
}
|
||||
if (i != 2) {
|
||||
if (i == 1) {
|
||||
obj.sortField = 'price';
|
||||
}
|
||||
dataParams.value = obj;
|
||||
changeData();
|
||||
} else {
|
||||
show.value = true;
|
||||
}
|
||||
};
|
||||
// 请求结果
|
||||
const requestResult = (result = true, num = 0) => {
|
||||
const mescroll = getMescroll();
|
||||
if (result) {
|
||||
mescroll.endSuccess(num);
|
||||
} else {
|
||||
mescroll.endErr();
|
||||
}
|
||||
};
|
||||
let show = ref(false);
|
||||
const close = () => {
|
||||
show.value = false;
|
||||
dataObj.screenNav[2].status = 0;
|
||||
};
|
||||
|
||||
let screenNav = ref([{
|
||||
id: 1,
|
||||
name: '价格区间',
|
||||
title: '价格区间(元)',
|
||||
data: [],
|
||||
ids: [],
|
||||
arr: {},
|
||||
multi: false, //是否多选
|
||||
col: 2,
|
||||
colMax: 5,
|
||||
more: false,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '分类',
|
||||
title: '分类',
|
||||
data: [],
|
||||
ids: [],
|
||||
multi: false,
|
||||
col: 3,
|
||||
colMax: 6,
|
||||
more: false,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '品牌',
|
||||
title: '品牌',
|
||||
data: [],
|
||||
ids: [],
|
||||
multi: true,
|
||||
col: 3,
|
||||
colMax: 6,
|
||||
more: false,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '优惠',
|
||||
title: '优惠',
|
||||
data: [],
|
||||
ids: [],
|
||||
multi: true,
|
||||
col: 3,
|
||||
colMax: 6,
|
||||
more: false,
|
||||
},
|
||||
]);
|
||||
let rightRef = ref(null);
|
||||
let staticHeight = ref(0);
|
||||
let screenIndex = ref(0);
|
||||
let itemRefs = ref(screenNav.value.map(() => ref(null)));
|
||||
|
||||
let scrollIntoView = ref("")
|
||||
const screenNavChange = (i, id) => {
|
||||
screenIndex.value = i;
|
||||
scrollIntoView.value = 'item' + i;
|
||||
|
||||
};
|
||||
|
||||
const screenItemClick = (i, index, item) => {
|
||||
let ids = screenNav.value[i].ids;
|
||||
let multi = screenNav.value[i].multi;
|
||||
|
||||
if (ids.indexOf(item.id) == -1) {
|
||||
console.log(multi);
|
||||
if (!multi) {
|
||||
ids = [];
|
||||
}
|
||||
ids.push(item.id);
|
||||
} else {
|
||||
ids.splice(ids.indexOf(item.id), 1);
|
||||
}
|
||||
screenNav.value[i].ids = ids;
|
||||
};
|
||||
const screenClear = () => {
|
||||
screenNav.value.forEach((e) => {
|
||||
e.ids = [];
|
||||
e.arr = {};
|
||||
});
|
||||
dataParams.value = {};
|
||||
changeData();
|
||||
};
|
||||
const priceData = (arr, id) => {
|
||||
return arr.find((item) => item.id === id) || {};
|
||||
};
|
||||
const screenConfirm = () => {
|
||||
let obj = screenNav.value[0];
|
||||
dataParams.value = {
|
||||
categoryIds: screenNav.value[1].ids.join(','),
|
||||
brandIds: screenNav.value[2].ids.join(','),
|
||||
tagTypeId: screenNav.value[3].ids.join(','),
|
||||
categoryId: '',
|
||||
minValue: obj.arr.minValue || obj.arr.minValue == 0 || priceData(obj.data, obj.ids[0]).minValue,
|
||||
maxValue: obj.arr.maxValue || obj.arr.maxValue == 0 || priceData(obj.data, obj.ids[0]).maxValue,
|
||||
minPrice: obj.arr.minValue || obj.arr.minValue == 0 || priceData(obj.data, obj.ids[0]).minValue,
|
||||
maxPrice: obj.arr.maxValue || obj.arr.maxValue == 0 || priceData(obj.data, obj.ids[0]).maxValue,
|
||||
};
|
||||
changeData();
|
||||
close();
|
||||
};
|
||||
watch(
|
||||
() => props.subclassification,
|
||||
(val) => {
|
||||
screenNav.value.forEach((e) => {
|
||||
if (e.name == '分类') {
|
||||
e.data = props.subclassification;
|
||||
}
|
||||
});
|
||||
}, {
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
let getbrandlist = () => {
|
||||
api.getbrandlist().then((res) => {
|
||||
if (res.code != 0) return;
|
||||
screenNav.value.forEach((e) => {
|
||||
if (e.name == '品牌') {
|
||||
e.data = res.data;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
const getproducttaglist = () => {
|
||||
api.getproducttaglist({
|
||||
categoryId: 2
|
||||
}).then((res) => {
|
||||
if (res.code != 0) return;
|
||||
screenNav.value.forEach((e) => {
|
||||
if (e.name == '优惠') {
|
||||
e.data = res.data;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
const getpricerangelist = () => {
|
||||
api.getpricerangelist().then((res) => {
|
||||
if (res.code != 0) return;
|
||||
screenNav.value.forEach((e) => {
|
||||
if (e.name == '价格区间') {
|
||||
e.data = res.data;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
onLoad(() => {
|
||||
getbrandlist();
|
||||
getproducttaglist();
|
||||
// 获取价格
|
||||
getpricerangelist();
|
||||
});
|
||||
const clearAll = () => {
|
||||
screenNav.value.forEach((e) => {
|
||||
e.ids = [];
|
||||
e.arr = {};
|
||||
e.more = false;
|
||||
});
|
||||
dataParams.value = {};
|
||||
screenObj.value = {};
|
||||
dataObj.screenNav.forEach((e) => {
|
||||
e.status = 0;
|
||||
});
|
||||
changeData();
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
changeData,
|
||||
requestResult,
|
||||
clearAll,
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page_right {
|
||||
height: 100%;
|
||||
background-color: #fff;
|
||||
|
||||
// overflow-y: auto;
|
||||
.screen {
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
}
|
||||
|
||||
.goods {
|
||||
// height: calc(100% - 96rpx);
|
||||
height: calc(100%);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.screenItem {
|
||||
color: #323233;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.activeItem {
|
||||
color: #fa9c31;
|
||||
}
|
||||
|
||||
.icon_up,
|
||||
.icon_down {
|
||||
width: 16rpx;
|
||||
height: 8rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.icon_up {
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.icon_down {}
|
||||
}
|
||||
|
||||
.goodsItem {
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.goodsImg {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.screen_popup {
|
||||
padding-top: 46rpx;
|
||||
/* #ifdef H5 */
|
||||
padding-bottom: 100rpx;
|
||||
/* #endif */
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
z-index: 1000;
|
||||
|
||||
.screen_title {
|
||||
box-sizing: border-box;
|
||||
// margin-bottom: 58rpx;
|
||||
}
|
||||
|
||||
.colse {
|
||||
position: absolute;
|
||||
top: 42rpx;
|
||||
right: 22rpx;
|
||||
}
|
||||
|
||||
.screen_content {
|
||||
.screen_left {
|
||||
min-height: 100%;
|
||||
overflow-y: auto;
|
||||
background-color: #F3F6F8;
|
||||
;
|
||||
|
||||
.screen_nav_item {
|
||||
width: 162rpx;
|
||||
line-height: 86rpx;
|
||||
}
|
||||
|
||||
.activeItem {
|
||||
color: #FA7E31;
|
||||
background-color: #F3F6F8;
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
.screen_right {
|
||||
padding: 0 18rpx;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
|
||||
.screen_right_item {
|
||||
margin-bottom: 34rpx;
|
||||
|
||||
.screen_title {
|
||||
margin-bottom: 8rpx;
|
||||
line-height: 70rpx;
|
||||
}
|
||||
|
||||
.screen_iteem {
|
||||
line-height: 40rpx;
|
||||
height: 114rpx;
|
||||
background-color: #F2F5F7;
|
||||
margin-bottom: 10rpx;
|
||||
border-radius: 12rpx;
|
||||
padding: 16rpx 10rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.screen_iteem1 {
|
||||
width: calc((100% - 6rpx) / 2);
|
||||
margin-right: 6rpx;
|
||||
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.screen_iteem2 {
|
||||
&:nth-child(3n) {
|
||||
// margin-right: 0;
|
||||
}
|
||||
|
||||
width: calc((100% - 12rpx) / 2);
|
||||
margin-right: 6rpx;
|
||||
}
|
||||
|
||||
.screen_moreIteem {
|
||||
color: #121212;
|
||||
width: calc((100% - 12rpx) / 2);
|
||||
margin-bottom: 10rpx;
|
||||
line-height: 84rpx;
|
||||
}
|
||||
|
||||
.moreText {
|
||||
// color: #ffffff;
|
||||
}
|
||||
|
||||
.down {
|
||||
width: 0rpx;
|
||||
height: 0;
|
||||
border-left: 9rpx solid transparent;
|
||||
border-right: 9rpx solid transparent;
|
||||
border-top: 12rpx solid #666666;
|
||||
margin-left: 6rpx;
|
||||
}
|
||||
|
||||
.screen_activeItem {
|
||||
background-color: #FFEFE5;
|
||||
color: #FA7E31;
|
||||
}
|
||||
|
||||
.screen_none {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.screen_btns {
|
||||
padding: 44rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.screen_btn {
|
||||
width: calc(100% - 54rpx);
|
||||
height: 82rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #FFEFE5;
|
||||
color: #FA7E31;
|
||||
line-height: 82rpx;
|
||||
margin-right: 18rpx;
|
||||
}
|
||||
|
||||
.screen_clear {}
|
||||
|
||||
.screen_confirm {
|
||||
background: linear-gradient(270deg, #F7772E 0%, #EE0A24 99%);
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.priceBox {
|
||||
height: 84rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #F2F5F7;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
input {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.pricePlace {
|
||||
text-align: center;
|
||||
color: #333333;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.search {
|
||||
.screen {
|
||||
justify-content: space-between;
|
||||
padding: 0 58rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.goodsItem {
|
||||
padding: 0 32rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="w_32 h_32 m-l-14" @click.stop="logistics">
|
||||
<image class="w100 h100" src="/static/truck-line.svg" mode="scaleToFill" />
|
||||
</view>
|
||||
<su-popup :show="show" round="10" @close="close">
|
||||
<view class="steps">
|
||||
<view class="colse flex-center ju-flex-end"
|
||||
><uni-icons class="m-r-50" type="closeempty" color="#333333" size="20" @click="close" />
|
||||
</view>
|
||||
<uni-steps :options="list" active-color="#007AFF" :active="0" direction="column" />
|
||||
</view>
|
||||
</su-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import { getExpressTrackList } from '@/sheep/api/index/index';
|
||||
let props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
code: {
|
||||
type: Number,
|
||||
default: 1, //1:商城订单 2:AI店铺订单 3:AI店铺赠送订单
|
||||
}
|
||||
});
|
||||
let show = ref(false);
|
||||
let list = ref([]);
|
||||
const logistics = () => {
|
||||
// 获取物流信息并显示弹窗
|
||||
getData();
|
||||
show.value = true;
|
||||
};
|
||||
const close = () => {
|
||||
show.value = false;
|
||||
};
|
||||
const getData = async () => {
|
||||
console.log(props.data);
|
||||
let { data, code } = await getExpressTrackList({
|
||||
id: props.data.id,
|
||||
code: props.code,
|
||||
});
|
||||
if (code !== 0) return;
|
||||
list.value = [];
|
||||
data.forEach((item) => {
|
||||
let obj = {
|
||||
title: item.content,
|
||||
desc: item.time,
|
||||
};
|
||||
list.value.push(obj);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.steps {
|
||||
height: 100vh;
|
||||
overflow-y: auto;
|
||||
min-height: 500rpx;
|
||||
padding: 30rpx;
|
||||
padding-left: 15rpx;
|
||||
padding-top: 60rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
.colse {
|
||||
position: fixed;
|
||||
top: 0rpx;
|
||||
width: 100%;
|
||||
height: 70rpx;
|
||||
background-color: #fff;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user