秦佳浩 2 months ago
commit ab4971dcb0

@ -1,110 +1,138 @@
/* 容器样式 */
.container {
background: #f4f4f4;
background: #f4f4f4; /* 设置背景颜色为浅灰色 */
}
/* 分类标题栏样式 */
.category-tit {
width: 100%;
white-space: nowrap;
position: fixed;
top: 0px;
z-index: 999;
background-color: #fff;
border-bottom: 2rpx solid #f4f4f4;
font-size: 30rpx;
width: 100%; /* 宽度占满整个父元素 */
white-space: nowrap; /* 禁止文本换行,确保所有分类项在一行显示 */
position: fixed; /* 固定定位,使标题栏始终位于页面顶部 */
top: 0px; /* 距离页面顶部0像素 */
z-index: 999; /* 设置较高的堆叠顺序,确保标题栏在其他内容之上 */
background-color: #fff; /* 背景颜色为白色 */
border-bottom: 2rpx solid #f4f4f4; /* 底部边框,使用浅灰色实线 */
font-size: 30rpx; /* 标题文字大小为30响应式像素 */
.category-item {
display: inline-block;
padding: 20rpx 10rpx;
margin: 0 20rpx;
box-sizing: border-box;
font-size: 28rpx;
display: inline-block; /* 分类项作为行内块级元素显示,确保它们在同一行 */
padding: 20rpx 10rpx; /* 内边距为上下20响应式像素左右10响应式像素 */
margin: 0 20rpx; /* 左右外边距为20响应式像素 */
box-sizing: border-box; /* 确保padding和border包含在元素的width和height之内 */
font-size: 28rpx; /* 分类项文字大小为28响应式像素 */
}
}
.prod-item {
height: calc(100vh - 100rpx);
}
/* 当前选中的分类项样式 */
.on {
border-bottom: 4rpx solid #e43130;
color: #e43130;
border-bottom: 4rpx solid #e43130; /* 底部边框,使用红色实线,表示当前选中 */
color: #e43130; /* 文本颜色为红色 */
}
/* 商品项容器样式 */
.prod-item {
height: calc(100vh - 100rpx); /* 高度为视口高度减去100响应式像素确保与固定头部有足够的间距 */
}
/* 隐藏滚动条样式 */
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
width: 0; /* 滚动条宽度为0 */
height: 0; /* 滚动条高度为0 */
color: transparent; /* 滚动条颜色为透明 */
}
/* 空状态样式 */
.empty {
margin-top: 200rpx;
margin-top: 200rpx; /* 顶部外边距为200响应式像素确保空状态提示在页面中间 */
}
/* 商品项样式 */
.prod-items {
width: 345rpx;
display: inline-block;
background: #fff;
padding-bottom: 20rpx;
box-sizing: border-box;
box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2);
width: 345rpx; /* 商品项宽度为345响应式像素 */
display: inline-block; /* 作为行内块级元素显示,确保它们在同一行 */
background: #fff; /* 背景颜色为白色 */
padding-bottom: 20rpx; /* 底部内边距为20响应式像素 */
box-sizing: border-box; /* 确保padding和border包含在元素的width和height之内 */
box-shadow: 0rpx 6rpx 8rpx rgba(58, 134, 185, 0.2); /* 添加轻微的阴影效果,增强立体感 */
&:nth-child(2n-1) {
margin: 20rpx 10rpx 10rpx 20rpx;
margin: 20rpx 10rpx 10rpx 20rpx; /* 奇数商品项的外边距设置 */
}
&:nth-child(2n) {
margin: 20rpx 20rpx 10rpx 10rpx;
margin: 20rpx 20rpx 10rpx 10rpx; /* 偶数商品项的外边距设置 */
}
.hot-imagecont {
.hotsaleimg {
width: 341rpx;
height: 341rpx;
width: 341rpx; /* 图片宽度为341响应式像素 */
height: 341rpx; /* 图片高度为341响应式像素 */
}
font-size: 0;
text-align: center;
font-size: 0; /* 移除默认字体大小,防止影响图片显示 */
text-align: center; /* 图片居中对齐 */
}
.hot-text {
.hotprod-text {
font-size: 28rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
margin-top: 20rpx;
padding: 0 10rpx;
font-size: 28rpx; /* 商品名称文字大小为28响应式像素 */
white-space: nowrap; /* 禁止文本换行 */
overflow: hidden; /* 隐藏超出容器的内容 */
text-overflow: ellipsis; /* 当文本溢出时显示省略号 */
}
margin-top: 20rpx; /* 顶部外边距为20响应式像素 */
padding: 0 10rpx; /* 左右内边距为10响应式像素 */
.prod-info {
min-height: 30rpx;
font-size: 22rpx;
color: #999;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
min-height: 30rpx; /* 最小高度为30响应式像素 */
font-size: 22rpx; /* 商品信息文字大小为22响应式像素 */
color: #999; /* 文本颜色为灰色 */
white-space: nowrap; /* 禁止文本换行 */
overflow: hidden; /* 隐藏超出容器的内容 */
text-overflow: ellipsis; /* 当文本溢出时显示省略号 */
}
.prod-text-info {
position: relative;
height: 70rpx;
line-height: 70rpx;
font-family: Arial;
position: relative; /* 相对定位,用于内部元素的绝对定位 */
height: 70rpx; /* 高度为70响应式像素 */
line-height: 70rpx; /* 行高设置为70响应式像素确保文本垂直居中 */
font-family: Arial; /* 字体系列为Arial */
.hotprod-price {
display: inline;
font-size: 26rpx;
color: #eb2444;
display: inline; /* 价格文本作为行内元素显示 */
font-size: 26rpx; /* 价格文字大小为26响应式像素 */
color: #eb2444; /* 价格颜色为红色 */
}
.basket-img {
width: 50rpx;
height: 50rpx;
position: absolute;
right: 0;
bottom: 7rpx;
padding: 8rpx;
width: 50rpx; /* 购物车图标宽度为50响应式像素 */
height: 50rpx; /* 购物车图标高度为50响应式像素 */
position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */
right: 0; /* 购物车图标距离右侧0像素 */
bottom: 7rpx; /* 购物车图标距离底部7响应式像素 */
padding: 8rpx; /* 内边距为8响应式像素 */
}
}
}
}
/* 更多商品样式 */
.more-prod {
.prod-text-right {
.prod-info {
font-size: 22rpx;
color: #999;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 22rpx; /* 商品信息文字大小为22响应式像素 */
color: #999; /* 文本颜色为灰色 */
white-space: nowrap; /* 禁止文本换行 */
overflow: hidden; /* 隐藏超出容器的内容 */
text-overflow: ellipsis; /* 当文本溢出时显示省略号 */
}
}
}
/* 空状态占位样式 */
.empty-wrap {
color: #aaa;
text-align: center;
padding-top: 400rpx;
color: #aaa; /* 文本颜色为浅灰色 */
text-align: center; /* 文本居中对齐 */
padding-top: 400rpx; /* 顶部内边距为400响应式像素确保空状态提示在页面中间 */
}

@ -1,71 +1,65 @@
<template>
<view class="Mall4j container">
<!-- 顶部子分类tab -->
<scroll-view
scroll-x="true"
class="category-tit"
:scroll-into-view="intoView"
:scroll-with-animation="true"
<scroll-view scroll-x="true" <!-- -->
class="category-tit" <!-- 应用样式类 category-tit -->
:scroll-into-view="intoView" <!-- 滚动到指定元素确保选中的分类项可见 -->
:scroll-with-animation="true" <!-- 滚动时启用动画效果 -->
>
<block
v-for="(item, index) in subCategoryList"
:key="index"
v-for="(item, index) in subCategoryList" <!-- 遍历子分类列表动态生成每个分类项 -->
:key="index" <!-- 使用索引作为唯一标识 -->
>
<view
:id="'sw' + item.categoryId"
:class="'category-item ' + (item.categoryId==categoryId? 'on':'')"
:data-id="item.categoryId"
@tap="onSubCategoryTap"
:id="'sw' + item.categoryId" <!-- 动态设置每个分类项的ID -->
:class="'category-item ' + (item.categoryId == categoryId ? 'on' : '')" <!-- 动态绑定类名当前选中的分类项添加 'on' -->
:data-id="item.categoryId" <!-- 传递分类ID -->
@tap="onSubCategoryTap" <!-- 点击分类项时触发切换分类的方法 -->
>
{{ item.categoryName }}
{{ item.categoryName }} <!-- 显示分类名称 -->
</view>
</block>
</scroll-view>
<!-- 商品列表 -->
<view class="prod-item">
<!-- 商品列表容器 -->
<block v-if="prodList.length">
<block
v-for="(prod, key) in prodList"
:key="key"
<!-- 条件渲染只有当商品列表不为空时显示商品项 -->
<block v-for="(prod, key) in prodList" <!-- -->
:key="key" <!-- 使用索引作为唯一标识 -->
>
<view
class="prod-items"
:data-prodid="prod.prodId"
@tap="toProdPage"
class="prod-items" <!-- 商品项容器 -->
:data-prodid="prod.prodId" <!-- 传递商品ID -->
@tap="toProdPage" <!-- 点击商品项时跳转到商品详情页 -->
>
<view class="hot-imagecont">
<view class="hot-imagecont"> <!-- 商品图片容器 -->
<image
:src="prod.pic"
class="hotsaleimg"
:src="prod.pic" <!-- 动态绑定商品图片路径 -->
class="hotsaleimg" <!-- 应用样式类 hotsaleimg -->
/>
</view>
<view class="hot-text">
<view class="hotprod-text">
{{ prod.prodName }}
<view class="hot-text"> <!-- 商品文本信息容器 -->
<view class="hotprod-text"> <!-- 商品名称 -->
{{ prod.prodName }} <!-- 显示商品名称 -->
</view>
<view class="prod-info">
{{ prod.brief }}
<view class="prod-info"> <!-- 商品简介 -->
{{ prod.brief }} <!-- 显示商品简介 -->
</view>
<view class="prod-text-info">
<view class="price">
<text class="symbol">
</text>
<text class="big-num">
{{ wxs.parsePrice(prod.price)[0] }}
</text>
<text class="small-num">
.{{ wxs.parsePrice(prod.price)[1] }}
</text>
<view class="prod-text-info"> <!-- 商品价格信息 -->
<view class="price"> <!-- 价格容器 -->
<text class="symbol"></text> <!-- 人民币符号 -->
<text class="big-num">{{ wxs.parsePrice(prod.price)[0] }}</text> <!-- 显示整数部分价格 -->
<text class="small-num">.{{ wxs.parsePrice(prod.price)[1] }}</text> <!-- 显示小数部分价格 -->
</view>
</view>
</view>
</view>
</block>
</block>
<view
v-else
class="empty-wrap"
<view v-else <!-- -->
class="empty-wrap" <!-- 应用样式类 empty-wrap -->
>
暂无商品数据~
</view>
@ -74,104 +68,147 @@
</template>
<script setup>
const wxs = number()
import { ref, nextTick } from 'vue'; // Vue ref nextTick
//
const wxs = number(); // `number`
// ID
const parentId = ref('');
// ID
const categoryId = ref(0);
const parentId = ref('')
const categoryId = ref(0)
/**
* 生命周期函数--监听页面加载
*/
onLoad((options) => {
parentId.value = options.parentId
categoryId.value = options.categoryId
getSubCategory()
getProdList()
})
//
parentId.value = options.parentId;
categoryId.value = options.categoryId;
//
getSubCategory();
getProdList();
});
//
const current = ref(1);
//
const pages = ref(0);
const current = ref(1)
const pages = ref(0)
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom(() => {
//
if (current.value < pages.value) {
current.value = current.value + 1
getProdList()
current.value = current.value + 1;
getProdList();
}
})
});
//
const intoView = ref('');
//
const subCategoryList = ref([]);
const intoView = ref('')
const subCategoryList = ref([])
/**
* 获取顶栏子分类数据
*/
const getSubCategory = () => {
//
http.request({
url: '/category/categoryInfo',
method: 'GET',
url: '/category/categoryInfo', // API
method: 'GET', // GET
data: {
parentId: parentId.value
parentId: parentId.value // ID
}
})
.then(({ data }) => {
subCategoryList.value = data
// subCategoryList
subCategoryList.value = data;
// 使 nextTick DOM
nextTick(() => {
intoView.value = 'sw' + categoryId.value
})
})
}
intoView.value = 'sw' + categoryId.value; //
});
});
};
//
const prodList = ref([]);
//
const isLoaded = ref(false);
const prodList = ref([])
const isLoaded = ref(false) //
/**
* 根据分类id获取商品列表数据
* 根据分类ID获取商品列表数据
*/
const getProdList = () => {
isLoaded.value = false
isLoaded.value = false; //
//
http.request({
url: '/prod/pageProd',
method: 'GET',
url: '/prod/pageProd', // API
method: 'GET', // GET
data: {
categoryId: categoryId.value,
current: current.value,
size: 10,
sort: 0,
isAllProdType: true
categoryId: categoryId.value, // ID
current: current.value, //
size: 10, //
sort: 0, // 0
isAllProdType: true //
}
})
.then(({ data }) => {
isLoaded.value = true
prodList.value = data.current == 1 ? data.records : prodList.value.concat(data.records)
current.value = data.current
pages.value = data.pages
})
}
isLoaded.value = true; //
//
prodList.value = data.current == 1 ? data.records : prodList.value.concat(data.records);
//
current.value = data.current;
pages.value = data.pages;
});
};
/**
* 切换顶部分类
* @param e - 事件对象
*/
const onSubCategoryTap = (e) => {
categoryId.value = e.currentTarget.dataset.id
current.value = 1
pages.value = 0
intoView.value = 'sw' + e.currentTarget.dataset.id
getProdList()
}
// ID
categoryId.value = e.currentTarget.dataset.id;
//
current.value = 1;
pages.value = 0;
//
intoView.value = 'sw' + e.currentTarget.dataset.id;
//
getProdList();
};
/**
* 跳转商品下详情
* 跳转商品详情页
* @param e - 事件对象
*/
const toProdPage = (e) => {
const prodid = e.currentTarget.dataset.prodid
const prodid = e.currentTarget.dataset.prodid; // ID
// ID
if (prodid) {
uni.navigateTo({
url: '/pages/prod/prod?prodid=' + prodid
})
}
url: `/pages/prod/prod?prodid=${prodid}`
});
}
};
</script>
<style lang="scss" scoped>
@import "./sub-category.scss";
@import "./sub-category.scss"; /* 引入外部样式文件 */
</style>

@ -1,429 +1,489 @@
/* 容器样式 */
.container {
background: #f4f4f4;
background: #f4f4f4; /* 设置背景颜色为浅灰色 */
}
/* 提交订单区域样式 */
.submit-order {
margin-bottom: 100rpx;
padding-bottom: 160rpx;
.delivery-addr {
position: relative;
background: #fff;
.addr-icon {
width: 32rpx;
height: 32rpx;
display: block;
position: absolute;
left: 30rpx;
top: 24rpx;
image {
width: 100%;
height: 100%;
}
}
.user-info {
padding-top: 20rpx;
line-height: 48rpx;
word-wrap: break-word;
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
.item {
font-size: 30rpx;
margin-right: 30rpx;
vertical-align: top;
display: inline-block;
}
}
.addr {
font-size: 26rpx;
line-height: 36rpx;
color: #999;
width: 90%;
padding-bottom: 20rpx;
margin-top: 15rpx;
word-wrap: break-word;
}
.arrow {
width: 15rpx;
height: 15rpx;
border-top: 2rpx solid #777;
border-right: 2rpx solid #777;
transform: rotate(45deg);
position: absolute;
right: 30rpx;
top: 60rpx;
}
.arrow.empty {
top: 39rpx;
}
}
}
.delivery-addr {
.addr-bg {
.add-addr {
.plus-sign {
color: #eb2444;
border: 2rpx solid #eb2444;
padding: 0rpx 6rpx;
margin-right: 10rpx;
}
font-size: 28rpx;
color: #666;
display: flex;
align-items: center;
padding: 30rpx 0;
}
padding: 0 30rpx;
}
.addr-bg.whole {
padding: 0 39rpx 0 77rpx;
}
}
.addr-bg {
.add-addr {
.plus-sign-img {
width: 32rpx;
height: 32rpx;
font-size: 0;
margin-right: 10rpx;
image {
width: 100%;
height: 100%;
}
}
}
}
.prod-item {
background-color: #fff;
margin-top: 15rpx;
font-size: 28rpx;
.item-cont {
.prod-pic {
image {
width: 180rpx;
height: 180rpx;
width: 100%;
height: 100%;
}
font-size: 0;
display: block;
width: 160rpx;
height: 160rpx;
overflow: hidden;
background: #fff;
margin-right: 16rpx;
}
display: flex;
align-items: center;
padding: 30rpx;
border-bottom: 2rpx solid #f1f1f1;
.prod-info {
margin-left: 10rpx;
font-size: 28rpx;
width: 100%;
position: relative;
height: 160rpx;
-webkit-flex: 1;
-ms-flex: 1;
-webkit-box-flex: 1;
-moz-box-flex: 1;
flex: 1;
.prodname {
font-size: 28rpx;
line-height: 40rpx;
max-height: 86rpx;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
word-break: break-all;
}
.prod-info-cont {
color: #999;
line-height: 40rpx;
margin-top: 10rpx;
font-size: 22rpx;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
word-break: break-all;
}
}
}
.order-num {
padding: 20rpx 30rpx;
display: flex;
justify-content: space-between;
font-size: 28rpx;
.clear-btn {
width: 32rpx;
height: 32rpx;
font-size: 0;
vertical-align: top;
margin-top: 6rpx;
margin-left: 42rpx;
position: relative;
&::after {
content: " ";
display: block;
position: absolute;
left: -10px;
top: 1px;
width: 1px;
height: 12px;
background: #ddd;
}
.clear-list-btn {
width: 100%;
height: 100%;
vertical-align: middle;
}
}
}
.total-num {
text-align: right;
padding: 20rpx 30rpx;
font-size: 28rpx;
.prodprice {
display: inline-block;
color: #333;
}
.prodcount {
margin-right: 20rpx;
}
}
.price-nums {
.prodprice {
position: absolute;
bottom: 0;
}
.prodcount {
position: absolute;
bottom: 5rpx;
right: 0;
color: #999;
font-family: verdana;
}
}
}
.order-state {
display: flex;
align-items: center;
}
.order-msg {
background: #fff;
margin-top: 15rpx;
padding: 0 30rpx;
font-size: 28rpx;
.msg-item {
border-top: 2rpx solid #f1f1f1;
&:first-child {
border: 0;
}
.item {
position: relative;
display: flex;
padding: 16rpx 0;
align-items: center;
.item-tit {
line-height: 48rpx;
}
.item-txt {
-webkit-box-flex: 1;
-moz-box-flex: 1;
flex: 1;
font-family: arial;
max-height: 48rpx;
overflow: hidden;
line-height: 48rpx;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
word-break: break-all;
}
.item-txt.price {
padding: 0;
text-align: right;
}
input {
flex: 1;
}
.coupon-btn {
display: block;
margin: 0 30rpx;
line-height: 28rpx;
color: #999;
}
.arrow {
width: 15rpx;
height: 15rpx;
border-top: 2rpx solid #999;
border-right: 2rpx solid #999;
transform: rotate(45deg);
position: absolute;
right: 0rpx;
}
}
.item.payment {
border-top: 2rpx solid #f1f1f1;
color: #eb2444;
}
.item.coupon {
border-bottom: 2rpx solid #e1e1e1;
}
}
}
.submit-order-footer {
position: fixed;
bottom: 0;
width: 100%;
max-width: 750rpx;
background: #fff;
margin: auto;
display: -webkit-flex;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: flex;
font-size: 26rpx;
box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
.sub-order {
flex: 1;
margin: 0 30rpx;
line-height: 100rpx;
display: block;
text-align: left;
font-size: 28rpx;
.item-txt {
.price {
display: inline;
color: #eb2444;
font-size: 28rpx;
}
}
}
.footer-box {
padding: 0 10rpx;
width: 200rpx;
background: #eb2444;
text-align: center;
line-height: 100rpx;
color: #fff;
}
}
.clearfix {
&:after {
content: " ";
display: table;
clear: both;
}
}
.popup-hide {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 999;
background-color: rgba(0, 0, 0, 0.3);
}
.popup-box {
position: absolute;
bottom: 0;
width: 100%;
height: 80%;
overflow: hidden;
background-color: #fff;
}
.popup-tit {
position: relative;
height: 46px;
line-height: 46px;
padding-left: 10px;
font-size: 16px;
color: #333;
font-weight: bold;
}
.close {
color: #aaa;
border-radius: 12px;
line-height: 20px;
text-align: center;
height: 20px;
width: 20px;
font-size: 18px;
padding: 1px;
top: 10px;
right: 10px;
position: absolute;
&::before {
content: "\2716";
}
}
.coupon-tabs {
display: flex;
font-size: 14px;
justify-content: space-around;
border-bottom: 1px solid #f2f2f2;
}
.coupon-tab {
padding: 10px 0;
}
.coupon-tab.on {
border-bottom: 2px solid #eb2444;
font-weight: 600;
}
.popup-cnt {
height: calc(100% - 88px);
overflow: auto;
padding: 0 10px;
background: #f4f4f4;
}
.coupon-ok {
position: fixed;
bottom: 0;
width: 100%;
height: 60px;
line-height: 50px;
font-size: 14px;
text-align: center;
box-shadow: 0px -1px 1px #ddd;
text {
border-radius: 20px;
display: inline-block;
height: 20px;
line-height: 20px;
width: 450rpx;
padding: 7px;
color: #fff;
box-shadow: -1px 3px 3px #aaa;
}
}
.botm-empty {
height: 60px;
}
checkbox {
.wx-checkbox-input {
border-radius: 50%;
width: 35rpx;
height: 35rpx;
}
.wx-checkbox-input.wx-checkbox-input-checked {
background: #eb2444;
border-color: #eb2444;
&::before {
text-align: center;
font-size: 22rpx;
color: #fff;
background: transparent;
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
margin-bottom: 100rpx; /* 底部外边距为100响应式像素 */
padding-bottom: 160rpx; /* 底部内边距为160响应式像素 */
.delivery-addr { /* 配送地址样式 */
position: relative; /* 相对定位,用于内部元素的绝对定位 */
background: #fff; /* 背景颜色为白色 */
.addr-icon { /* 地址图标样式 */
width: 32rpx; /* 图标宽度为32响应式像素 */
height: 32rpx; /* 图标高度为32响应式像素 */
display: block; /* 作为块级元素显示 */
position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */
left: 30rpx; /* 距离左侧30响应式像素 */
top: 24rpx; /* 距离顶部24响应式像素 */
image { /* 图片样式 */
width: 100%; /* 宽度占满父元素 */
height: 100%; /* 高度占满父元素 */
}
}
.user-info { /* 用户信息样式 */
padding-top: 20rpx; /* 顶部内边距为20响应式像素 */
line-height: 48rpx; /* 行高设置为48响应式像素 */
word-wrap: break-word; /* 允许长单词或URL地址换行到下一行 */
word-break: break-all; /* 强制文本在任意字符处换行 */
overflow: hidden; /* 隐藏超出容器的内容 */
text-overflow: ellipsis; /* 当文本溢出时显示省略号 */
display: -webkit-box; /* 使用Webkit盒模型 */
-webkit-line-clamp: 1; /* 限制文本显示为1行 */
-webkit-box-orient: vertical; /* 文本垂直排列 */
.item { /* 用户信息项样式 */
font-size: 30rpx; /* 文字大小为30响应式像素 */
margin-right: 30rpx; /* 右侧外边距为30响应式像素 */
vertical-align: top; /* 垂直对齐方式为顶部 */
display: inline-block; /* 作为行内块级元素显示 */
}
}
.addr { /* 地址样式 */
font-size: 26rpx; /* 文字大小为26响应式像素 */
line-height: 36rpx; /* 行高设置为36响应式像素 */
color: #999; /* 文本颜色为灰色 */
width: 90%; /* 宽度为父元素的90% */
padding-bottom: 20rpx; /* 底部内边距为20响应式像素 */
margin-top: 15rpx; /* 顶部外边距为15响应式像素 */
word-wrap: break-word; /* 允许长单词或URL地址换行到下一行 */
}
.arrow { /* 箭头样式 */
width: 15rpx; /* 宽度为15响应式像素 */
height: 15rpx; /* 高度为15响应式像素 */
border-top: 2rpx solid #777; /* 上边框为2响应式像素宽的灰色实线 */
border-right: 2rpx solid #777; /* 右边框为2响应式像素宽的灰色实线 */
transform: rotate(45deg); /* 旋转45度形成箭头形状 */
position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */
right: 30rpx; /* 距离右侧30响应式像素 */
top: 60rpx; /* 距离顶部60响应式像素 */
}
.arrow.empty { /* 空状态下的箭头样式 */
top: 39rpx; /* 距离顶部39响应式像素 */
}
}
}
.delivery-addr { /* 配送地址样式(重复定义,可能用于覆盖或扩展) */
.addr-bg { /* 地址背景样式 */
.add-addr { /* 添加地址按钮样式 */
.plus-sign { /* 加号样式 */
color: #eb2444; /* 文本颜色为红色 */
border: 2rpx solid #eb2444; /* 边框为2响应式像素宽的红色实线 */
padding: 0rpx 6rpx; /* 内边距为上下0响应式像素左右6响应式像素 */
margin-right: 10rpx; /* 右侧外边距为10响应式像素 */
}
font-size: 28rpx; /* 文字大小为28响应式像素 */
color: #666; /* 文本颜色为深灰色 */
display: flex; /* 使用Flex布局 */
align-items: center; /* 垂直居中对齐 */
padding: 30rpx 0; /* 上下内边距为30响应式像素 */
}
padding: 0 30rpx; /* 左右内边距为30响应式像素 */
}
.addr-bg.whole { /* 整个地址背景样式 */
padding: 0 39rpx 0 77rpx; /* 左右内边距分别为39响应式像素和77响应式像素 */
}
}
.addr-bg { /* 地址背景样式(重复定义,可能用于覆盖或扩展) */
.add-addr { /* 添加地址按钮样式 */
.plus-sign-img { /* 加号图片样式 */
width: 32rpx; /* 宽度为32响应式像素 */
height: 32rpx; /* 高度为32响应式像素 */
font-size: 0; /* 移除默认字体大小,防止影响图片显示 */
margin-right: 10rpx; /* 右侧外边距为10响应式像素 */
image { /* 图片样式 */
width: 100%; /* 宽度占满父元素 */
height: 100%; /* 高度占满父元素 */
}
}
}
}
.prod-item { /* 商品项样式 */
background-color: #fff; /* 背景颜色为白色 */
margin-top: 15rpx; /* 顶部外边距为15响应式像素 */
font-size: 28rpx; /* 文字大小为28响应式像素 */
.item-cont { /* 商品内容样式 */
.prod-pic { /* 商品图片样式 */
image { /* 图片样式 */
width: 180rpx; /* 宽度为180响应式像素 */
height: 180rpx; /* 高度为180响应式像素 */
width: 100%; /* 宽度占满父元素 */
height: 100%; /* 高度占满父元素 */
}
font-size: 0; /* 移除默认字体大小,防止影响图片显示 */
display: block; /* 作为块级元素显示 */
width: 160rpx; /* 宽度为160响应式像素 */
height: 160rpx; /* 高度为160响应式像素 */
overflow: hidden; /* 隐藏超出容器的内容 */
background: #fff; /* 背景颜色为白色 */
margin-right: 16rpx; /* 右侧外边距为16响应式像素 */
}
display: flex; /* 使用Flex布局 */
align-items: center; /* 垂直居中对齐 */
padding: 30rpx; /* 内边距为30响应式像素 */
border-bottom: 2rpx solid #f1f1f1; /* 底部边框为2响应式像素宽的浅灰色实线 */
.prod-info { /* 商品信息样式 */
margin-left: 10rpx; /* 左侧外边距为10响应式像素 */
font-size: 28rpx; /* 文字大小为28响应式像素 */
width: 100%; /* 宽度占满父元素 */
position: relative; /* 相对定位,用于内部元素的绝对定位 */
height: 160rpx; /* 高度为160响应式像素 */
flex: 1; /* 占用剩余空间 */
.prodname { /* 商品名称样式 */
font-size: 28rpx; /* 文字大小为28响应式像素 */
line-height: 40rpx; /* 行高设置为40响应式像素 */
max-height: 86rpx; /* 最大高度为86响应式像素 */
overflow: hidden; /* 隐藏超出容器的内容 */
display: -webkit-box; /* 使用Webkit盒模型 */
-webkit-line-clamp: 2; /* 限制文本显示为2行 */
-webkit-box-orient: vertical; /* 文本垂直排列 */
text-overflow: ellipsis; /* 当文本溢出时显示省略号 */
word-break: break-all; /* 强制文本在任意字符处换行 */
}
.prod-info-cont { /* 商品信息内容样式 */
color: #999; /* 文本颜色为灰色 */
line-height: 40rpx; /* 行高设置为40响应式像素 */
margin-top: 10rpx; /* 顶部外边距为10响应式像素 */
font-size: 22rpx; /* 文字大小为22响应式像素 */
overflow: hidden; /* 隐藏超出容器的内容 */
display: -webkit-box; /* 使用Webkit盒模型 */
-webkit-line-clamp: 1; /* 限制文本显示为1行 */
-webkit-box-orient: vertical; /* 文本垂直排列 */
text-overflow: ellipsis; /* 当文本溢出时显示省略号 */
word-break: break-all; /* 强制文本在任意字符处换行 */
}
}
}
.order-num { /* 订单数量样式 */
padding: 20rpx 30rpx; /* 内边距为上下20响应式像素左右30响应式像素 */
display: flex; /* 使用Flex布局 */
justify-content: space-between; /* 水平两端对齐 */
font-size: 28rpx; /* 文字大小为28响应式像素 */
.clear-btn { /* 清空按钮样式 */
width: 32rpx; /* 宽度为32响应式像素 */
height: 32rpx; /* 高度为32响应式像素 */
font-size: 0; /* 移除默认字体大小,防止影响图片显示 */
vertical-align: top; /* 垂直对齐方式为顶部 */
margin-top: 6rpx; /* 顶部外边距为6响应式像素 */
margin-left: 42rpx; /* 左侧外边距为42响应式像素 */
position: relative; /* 相对定位,用于内部元素的绝对定位 */
&::after { /* 清空按钮后的竖线样式 */
content: " "; /* 生成伪元素 */
display: block; /* 作为块级元素显示 */
position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */
left: -10px; /* 距离左侧-10像素 */
top: 1px; /* 距离顶部1像素 */
width: 1px; /* 宽度为1像素 */
height: 12px; /* 高度为12像素 */
background: #ddd; /* 背景颜色为浅灰色 */
}
.clear-list-btn { /* 清空列表按钮样式 */
width: 100%; /* 宽度占满父元素 */
height: 100%; /* 高度占满父元素 */
vertical-align: middle; /* 垂直居中对齐 */
}
}
}
.total-num { /* 总数量样式 */
text-align: right; /* 文本右对齐 */
padding: 20rpx 30rpx; /* 内边距为上下20响应式像素左右30响应式像素 */
font-size: 28rpx; /* 文字大小为28响应式像素 */
.prodprice { /* 商品价格样式 */
display: inline-block; /* 作为行内块级元素显示 */
color: #333; /* 文本颜色为深灰色 */
}
.prodcount { /* 商品数量样式 */
margin-right: 20rpx; /* 右侧外边距为20响应式像素 */
}
}
.price-nums { /* 价格和数量样式 */
.prodprice { /* 商品价格样式 */
position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */
bottom: 0; /* 距离底部0响应式像素 */
}
.prodcount { /* 商品数量样式 */
position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */
bottom: 5rpx; /* 距离底部5响应式像素 */
right: 0; /* 距离右侧0响应式像素 */
color: #999; /* 文本颜色为灰色 */
font-family: verdana; /* 字体系列为Verdana */
}
}
}
.order-state { /* 订单状态样式 */
display: flex; /* 使用Flex布局 */
align-items: center; /* 垂直居中对齐 */
}
.order-msg { /* 订单消息样式 */
background: #fff; /* 背景颜色为白色 */
margin-top: 15rpx; /* 顶部外边距为15响应式像素 */
padding: 0 30rpx; /* 左右内边距为30响应式像素 */
font-size: 28rpx; /* 文字大小为28响应式像素 */
.msg-item { /* 消息项样式 */
border-top: 2rpx solid #f1f1f1; /* 顶部边框为2响应式像素宽的浅灰色实线 */
&:first-child { /* 第一个消息项样式 */
border: 0; /* 移除边框 */
}
.item { /* 消息项内容样式 */
position: relative; /* 相对定位,用于内部元素的绝对定位 */
display: flex; /* 使用Flex布局 */
padding: 16rpx 0; /* 上下内边距为16响应式像素 */
align-items: center; /* 垂直居中对齐 */
.item-tit { /* 消息标题样式 */
line-height: 48rpx; /* 行高设置为48响应式像素 */
}
.item-txt { /* 消息文本样式 */
flex: 1; /* 占用剩余空间 */
font-family: arial; /* 字体系列为Arial */
max-height: 48rpx; /* 最大高度为48响应式像素 */
overflow: hidden; /* 隐藏超出容器的内容 */
line-height: 48rpx; /* 行高设置为48响应式像素 */
display: -webkit-box; /* 使用Webkit盒模型 */
-webkit-line-clamp: 1; /* 限制文本显示为1行 */
-webkit-box-orient: vertical; /* 文本垂直排列 */
text-overflow: ellipsis; /* 当文本溢出时显示省略号 */
word-break: break-all; /* 强制文本在任意字符处换行 */
}
.item-txt.price { /* 价格文本样式 */
padding: 0; /* 移除内边距 */
text-align: right; /* 文本右对齐 */
}
input { /* 输入框样式 */
flex: 1; /* 占用剩余空间 */
}
.coupon-btn { /* 优惠券按钮样式 */
display: block; /* 作为块级元素显示 */
margin: 0 30rpx; /* 左右外边距为30响应式像素 */
line-height: 28rpx; /* 行高设置为28响应式像素 */
color: #999; /* 文本颜色为灰色 */
}
.arrow { /* 箭头样式 */
width: 15rpx; /* 宽度为15响应式像素 */
height: 15rpx; /* 高度为15响应式像素 */
border-top: 2rpx solid #999; /* 上边框为2响应式像素宽的灰色实线 */
border-right: 2rpx solid #999; /* 右边框为2响应式像素宽的灰色实线 */
transform: rotate(45deg); /* 旋转45度形成箭头形状 */
position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */
right: 0rpx; /* 距离右侧0响应式像素 */
}
}
.item.payment { /* 支付项样式 */
border-top: 2rpx solid #f1f1f1; /* 顶部边框为2响应式像素宽的浅灰色实线 */
color: #eb2444; /* 文本颜色为红色 */
}
.item.coupon { /* 优惠券项样式 */
border-bottom: 2rpx solid #e1e1e1; /* 底部边框为2响应式像素宽的浅灰色实线 */
}
}
}
.submit-order-footer { /* 提交订单页脚样式 */
position: fixed; /* 固定定位,确保始终位于页面底部 */
bottom: 0; /* 距离页面底部0像素 */
width: 100%; /* 宽度占满整个屏幕 */
max-width: 750rpx; /* 最大宽度为750响应式像素 */
background: #fff; /* 背景颜色为白色 */
margin: auto; /* 水平居中 */
display: -webkit-flex; /* 使用Webkit Flex布局 */
display: -webkit-box; /* 使用Webkit盒模型 */
display: -moz-box; /* 使用Mozilla盒模型 */
display: -ms-flexbox; /* 使用IE Flex布局 */
display: flex; /* 使用标准Flex布局 */
font-size: 26rpx; /* 文字大小为26响应式像素 */
box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05); /* 添加轻微的阴影效果 */
.sub-order { /* 订单提交按钮样式 */
flex: 1; /* 占用剩余空间 */
margin: 0 30rpx; /* 左右外边距为30响应式像素 */
line-height: 100rpx; /* 行高设置为100响应式像素 */
display: block; /* 作为块级元素显示 */
text-align: left; /* 文本左对齐 */
font-size: 28rpx; /* 文字大小为28响应式像素 */
.item-txt { /* 订单金额样式 */
.price { /* 价格样式 */
display: inline; /* 作为行内元素显示 */
color: #eb2444; /* 文本颜色为红色 */
font-size: 28rpx; /* 文字大小为28响应式像素 */
}
}
}
.footer-box { /* 页脚按钮样式 */
padding: 0 10rpx; /* 左右内边距为10响应式像素 */
width: 200rpx; /* 宽度为200响应式像素 */
background: #eb2444; /* 背景颜色为红色 */
text-align: center; /* 文本居中对齐 */
line-height: 100rpx; /* 行高设置为100响应式像素 */
color: #fff; /* 文本颜色为白色 */
}
}
.clearfix { /* 清除浮动样式 */
&:after { /* 生成伪元素清除浮动 */
content: " "; /* 生成空内容 */
display: table; /* 作为表格元素显示 */
clear: both; /* 清除浮动 */
}
}
.popup-hide { /* 弹出层隐藏样式 */
position: fixed; /* 固定定位,覆盖整个屏幕 */
top: 0; /* 距离页面顶部0像素 */
bottom: 0; /* 距离页面底部0像素 */
left: 0; /* 距离页面左侧0像素 */
right: 0; /* 距离页面右侧0像素 */
z-index: 999; /* 设置较高的堆叠顺序,确保弹出层在其他内容之上 */
background-color: rgba(0, 0, 0, 0.3); /* 背景颜色为半透明黑色 */
}
.popup-box { /* 弹出层盒子样式 */
position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */
bottom: 0; /* 距离页面底部0像素 */
width: 100%; /* 宽度占满整个屏幕 */
height: 80%; /* 高度为屏幕高度的80% */
overflow: hidden; /* 隐藏超出容器的内容 */
background-color: #fff; /* 背景颜色为白色 */
}
.popup-tit { /* 弹出层标题样式 */
position: relative; /* 相对定位,用于内部元素的绝对定位 */
height: 46px; /* 高度为46像素 */
line-height: 46px; /* 行高设置为46像素 */
padding-left: 10px; /* 左侧内边距为10像素 */
font-size: 16px; /* 文字大小为16像素 */
color: #333; /* 文本颜色为深灰色 */
font-weight: bold; /* 文本加粗 */
}
.close { /* 关闭按钮样式 */
color: #aaa; /* 文本颜色为浅灰色 */
border-radius: 12px; /* 圆角半径为12像素 */
line-height: 20px; /* 行高设置为20像素 */
text-align: center; /* 文本居中对齐 */
height: 20px; /* 高度为20像素 */
width: 20px; /* 宽度为20像素 */
font-size: 18px; /* 文字大小为18像素 */
padding: 1px; /* 内边距为1像素 */
top: 10px; /* 距离顶部10像素 */
right: 10px; /* 距离右侧10像素 */
position: absolute; /* 绝对定位,相对于最近的相对定位祖先元素 */
&::before { /* 生成关闭符号样式 */
content: "\2716"; /* 使用Unicode字符表示关闭符号 */
}
}
.coupon-tabs { /* 优惠券标签样式 */
display: flex; /* 使用Flex布局 */
font-size: 14px; /* 文字大小为14像素 */
justify-content: space-around; /* 水平均匀分布 */
border-bottom: 1px solid #f2f2f2; /* 底部边框为1像素宽的浅灰色实线 */
}
.coupon-tab { /* 优惠券标签项样式 */
padding: 10px 0; /* 上下内边距为10像素 */
}
.coupon-tab.on { /* 选中的优惠券标签项样式 */
border-bottom: 2px solid #eb2444; /* 底部边框为2像素宽的红色实线 */
font-weight: 600; /* 文本加粗 */
}
.popup-cnt { /* 弹出层内容样式 */
height: calc(100% - 88px); /* 高度为弹出层盒子高度减去88像素 */
overflow: auto; /* 允许滚动 */
padding: 0 10px; /* 左右内边距为10像素 */
background: #f4f4f4; /* 背景颜色为浅灰色 */
}
.coupon-ok { /* 优惠券确认按钮样式 */
position: fixed; /* 固定定位,确保始终位于页面底部 */
bottom: 0; /* 距离页面底部0像素 */
width: 100%; /* 宽度占满整个屏幕 */
height: 60px; /* 高度为60像素 */
line-height: 50px; /* 行高设置为50像素 */
font-size: 14px; /* 文字大小为14像素 */
text-align: center; /* 文本居中对齐 */
box-shadow: 0px -1px 1px #ddd; /* 添加轻微的阴影效果 */
text { /* 按钮文本样式 */
border-radius: 20px; /* 圆角半径为20像素 */
display: inline-block; /* 作为行内块级元素显示 */
height: 20px; /* 高度为20像素 */
line-height: 20px; /* 行高设置为20像素 */
width: 450rpx; /* 宽度为450响应式像素 */
padding: 7px; /* 内边距为7像素 */
color: #fff; /* 文本颜色为白色 */
box-shadow: -1px 3px 3px #aaa; /* 添加轻微的阴影效果 */
}
}
.botm-empty { /* 底部空白样式 */
height: 60px; /* 高度为60像素 */
}
checkbox { /* 复选框样式 */
.wx-checkbox-input { /* 复选框输入框样式 */
border-radius: 50%; /* 圆形边框 */
width: 35rpx; /* 宽度为35响应式像素 */
height: 35rpx; /* 高度为35响应式像素 */
}
.wx-checkbox-input.wx-checkbox-input-checked { /* 选中的复选框输入框样式 */
background: #eb2444; /* 背景颜色为红色 */
border-color: #eb2444; /* 边框颜色为红色 */
&::before { /* 选中符号样式 */
text-align: center; /* 文本居中对齐 */
font-size: 22rpx; /* 文字大小为22响应式像素 */
color: #fff; /* 文本颜色为白色 */
background: transparent; /* 背景颜色为透明 */
transform: translate(-50%, -50%) scale(1); /* 居中并缩放 */
-webkit-transform: translate(-50%, -50%) scale(1); /* Webkit浏览器兼容 */
}
}
}

@ -3,100 +3,82 @@
<view class="container">
<view class="submit-order">
<!-- 收货地址 -->
<view
class="delivery-addr "
@tap="toAddrListPage"
<view class="delivery-addr"
@tap="toAddrListPage" <!-- 点击时跳转到收货地址列表页 -->
>
<!-- 如果没有选择收货地址 -->
<view
v-if="!userAddr"
v-if="!userAddr" <!-- 条件渲染只有当 userAddr 为空时显示 -->
class="addr-bg"
>
<view class="add-addr">
<view class="plus-sign-img">
<image src="@/static/images/icon/plus-sign.png" />
<image src="@/static/images/icon/plus-sign.png" /> <!-- 加号图标 -->
</view>
<text>新增收货地址</text>
<text>新增收货地址</text> <!-- 提示文本 -->
</view>
<view class="arrow empty" />
<view class="arrow empty" /> <!-- 空箭头图标 -->
</view>
<!-- 如果已经选择了收货地址 -->
<view
v-if="userAddr"
v-if="userAddr" <!-- 条件渲染只有当 userAddr 不为空时显示 -->
class="addr-bg whole"
>
<view class="addr-icon">
<image src="@/static/images/icon/addr.png" />
<image src="@/static/images/icon/addr.png" /> <!-- 地址图标 -->
</view>
<view class="user-info">
<text class="item">
{{ userAddr.receiver }}
</text>
<text class="item">
{{ userAddr.mobile }}
</text>
<text class="item">{{ userAddr.receiver }}</text> <!-- 收货人姓名 -->
<text class="item">{{ userAddr.mobile }}</text> <!-- 收货人电话 -->
</view>
<view class="addr">
{{ userAddr.province }}{{ userAddr.city }}{{ userAddr.area }}{{ userAddr.addr }}
{{ userAddr.province }}{{ userAddr.city }}{{ userAddr.area }}{{ userAddr.addr }} <!-- 详细地址 -->
</view>
<view class="arrow" />
<view class="arrow" /> <!-- 箭头图标 -->
</view>
</view>
<!-- 商品详情 -->
<view class="prod-item">
<block
v-for="(item, index) in orderItems"
:key="index"
<block v-for="(item, index) in orderItems" <!-- -->
:key="index" <!-- 使用索引作为唯一标识 -->
>
<view
class="item-cont"
:data-ordernum="item.primaryOrderNo"
@tap="toOrderDetailPage"
:data-ordernum="item.primaryOrderNo" <!-- 传递订单编号 -->
@tap="toOrderDetailPage" <!-- 点击时跳转到订单详情页 -->
>
<view class="prod-pic">
<image :src="item.pic" />
<image :src="item.pic" /> <!-- 动态绑定商品图片路径 -->
</view>
<view class="prod-info">
<view class="prodname">
{{ item.prodName }}
{{ item.prodName }} <!-- 显示商品名称 -->
</view>
<view class="prod-info-cont">
{{ item.skuName }}
{{ item.skuName }} <!-- 显示商品规格信息 -->
</view>
<view class="price-nums">
<text class="prodprice">
<text class="symbol">
</text>
<text class="big-num">
{{ wxs.parsePrice(item.price)[0] }}
</text>
<text class="small-num">
.{{ wxs.parsePrice(item.price)[1] }}
</text>
</text>
<text class="prodcount">
x{{ item.prodCount }}
<text class="symbol"></text> <!-- 人民币符号 -->
<text class="big-num">{{ wxs.parsePrice(item.price)[0] }}</text> <!-- 显示整数部分价格 -->
<text class="small-num">.{{ wxs.parsePrice(item.price)[1] }}</text> <!-- 显示小数部分价格 -->
</text>
<text class="prodcount">x{{ item.prodCount }}</text> <!-- 显示商品数量 -->
</view>
</view>
</view>
</block>
<!-- 商品总数和合计金额 -->
<view class="total-num">
<text class="prodcount">
{{ totalCount }}件商品
</text>
<text class="prodcount">{{ totalCount }}件商品</text> <!-- 显示商品总数 -->
<view class="prodprice">
合计
<text class="symbol">
</text>
<text class="big-num">
{{ wxs.parsePrice(total)[0] }}
</text>
<text class="small-num">
.{{ wxs.parsePrice(total)[1] }}
</text>
<text class="symbol"></text> <!-- 人民币符号 -->
<text class="big-num">{{ wxs.parsePrice(total)[0] }}</text> <!-- 显示整数部分合计金额 -->
<text class="small-num">.{{ wxs.parsePrice(total)[1] }}</text> <!-- 显示小数部分合计金额 -->
</view>
</view>
</view>
@ -104,96 +86,58 @@
<!-- 订单详情 -->
<view class="order-msg">
<view class="msg-item">
<view
class="item coupon"
@tap="showCouponPopup"
<!-- 优惠券选择 -->
<view class="item coupon"
@tap="showCouponPopup" <!-- 点击时显示优惠券弹窗 -->
>
<text class="item-tit">
优惠券
</text>
<text
v-if="!coupons.canUseCoupons"
class="item-txt"
>
暂无可用
</text>
<text class="coupon-btn">
{{ coupons.totalLength ? coupons.totalLength : 0 }}
</text>
<text class="arrow" />
<text class="item-tit">优惠券</text>
<text v-if="!coupons.canUseCoupons" class="item-txt"></text> <!-- -->
<text class="coupon-btn">{{ coupons.totalLength ? coupons.totalLength : 0 }}</text> <!-- 显示优惠券总数 -->
<text class="arrow" /> <!-- 箭头图标 -->
</view>
<!-- 买家留言 -->
<view class="item">
<text>买家留言</text>
<input
v-model="remarks"
placeholder="给卖家留言"
>
<input v-model="remarks" <!-- -->
placeholder="给卖家留言" <!-- 占位符提示 -->
/>
</view>
</view>
</view>
<!-- 订单金额明细 -->
<view class="order-msg">
<view class="msg-item">
<view class="item">
<view class="item-tit">
订单总额
</view>
<view class="item-tit">订单总额</view>
<view class="item-txt price">
<text class="symbol">
</text>
<text class="big-num">
{{ wxs.parsePrice(total)[0] }}
</text>
<text class="small-num">
.{{ wxs.parsePrice(total)[1] }}
</text>
<text class="symbol"></text> <!-- 人民币符号 -->
<text class="big-num">{{ wxs.parsePrice(total)[0] }}</text> <!-- 显示整数部分订单总额 -->
<text class="small-num">.{{ wxs.parsePrice(total)[1] }}</text> <!-- 显示小数部分订单总额 -->
</view>
</view>
<view class="item">
<view class="item-tit">
运费
</view>
<view class="item-tit">运费</view>
<view class="item-txt price">
<text class="symbol">
</text>
<text class="big-num">
{{ wxs.parsePrice(transfee)[0] }}
</text>
<text class="small-num">
.{{ wxs.parsePrice(transfee)[1] }}
</text>
<text class="symbol"></text> <!-- 人民币符号 -->
<text class="big-num">{{ wxs.parsePrice(transfee)[0] }}</text> <!-- 显示整数部分运费 -->
<text class="small-num">.{{ wxs.parsePrice(transfee)[1] }}</text> <!-- 显示小数部分运费 -->
</view>
</view>
<view class="item">
<view class="item-tit">
优惠金额
</view>
<view class="item-tit">优惠金额</view>
<view class="item-txt price">
<text class="symbol">
-
</text>
<text class="big-num">
{{ wxs.parsePrice(shopReduce)[0] }}
</text>
<text class="small-num">
.{{ wxs.parsePrice(shopReduce)[1] }}
</text>
<text class="symbol">-</text> <!-- 负号和人民币符号 -->
<text class="big-num">{{ wxs.parsePrice(shopReduce)[0] }}</text> <!-- 显示整数部分优惠金额 -->
<text class="small-num">.{{ wxs.parsePrice(shopReduce)[1] }}</text> <!-- 显示小数部分优惠金额 -->
</view>
</view>
<view class="item payment">
<view class="item-txt price">
小计
<text class="symbol">
</text>
<text class="big-num">
{{ wxs.parsePrice(actualTotal)[0] }}
</text>
<text class="small-num">
.{{ wxs.parsePrice(actualTotal)[1] }}
</text>
<text class="symbol"></text> <!-- 人民币符号 -->
<text class="big-num">{{ wxs.parsePrice(actualTotal)[0] }}</text> <!-- 显示整数部分小计金额 -->
<text class="small-num">.{{ wxs.parsePrice(actualTotal)[1] }}</text> <!-- 显示小数部分小计金额 -->
</view>
</view>
</view>
@ -206,21 +150,14 @@
<view class="item-txt">
合计
<view class="price">
<text class="symbol">
</text>
<text class="big-num">
{{ wxs.parsePrice(actualTotal)[0] }}
</text>
<text class="small-num">
.{{ wxs.parsePrice(actualTotal)[1] }}
</text>
<text class="symbol"></text> <!-- 人民币符号 -->
<text class="big-num">{{ wxs.parsePrice(actualTotal)[0] }}</text> <!-- 显示整数部分合计金额 -->
<text class="small-num">.{{ wxs.parsePrice(actualTotal)[1] }}</text> <!-- 显示小数部分合计金额 -->
</view>
</view>
</view>
<view
class="footer-box"
@tap="toPay"
<view class="footer-box"
@tap="toPay" <!-- 点击时提交订单并支付 -->
>
提交订单
</view>
@ -228,69 +165,69 @@
</view>
<!-- 选择优惠券弹窗 -->
<view
v-if="popupShow"
<view v-if="popupShow" <!-- popupShow true -->
class="popup-hide"
>
<view class="popup-box">
<view class="popup-tit">
<text>优惠券</text>
<text>优惠券</text> <!-- 弹窗标题 -->
<text
class="close"
@tap="closePopup"
@tap="closePopup" <!-- 点击时关闭弹窗 -->
/>
</view>
<!-- 优惠券选项卡 -->
<view class="coupon-tabs">
<view
:class="'coupon-tab ' + (couponSts==1?'on':'')"
:class="'coupon-tab ' + (couponSts == 1 ? 'on' : '')" <!-- 动态绑定类名选中时添加 'on' -->
data-sts="1"
@tap="changeCouponSts"
@tap="changeCouponSts" <!-- 点击时切换优惠券状态 -->
>
可用优惠券({{ coupons.canUseCoupons.length ? coupons.canUseCoupons.length : 0 }})
可用优惠券({{ coupons.canUseCoupons.length ? coupons.canUseCoupons.length : 0 }}) <!-- 显示可用优惠券数量 -->
</view>
<view
:class="'coupon-tab ' + (couponSts==2?'on':'')"
:class="'coupon-tab ' + (couponSts == 2 ? 'on' : '')" <!-- 动态绑定类名选中时添加 'on' -->
data-sts="2"
@tap="changeCouponSts"
@tap="changeCouponSts" <!-- 点击时切换优惠券状态 -->
>
不可用优惠券({{ coupons.unCanUseCoupons.length ? coupons.unCanUseCoupons.length : 0 }})
不可用优惠券({{ coupons.unCanUseCoupons.length ? coupons.unCanUseCoupons.length : 0 }}) <!-- 显示不可用优惠券数量 -->
</view>
</view>
<!-- 优惠券列表 -->
<view class="popup-cnt">
<block v-if="couponSts == 1">
<block v-if="couponSts == 1"> <!-- couponSts 1 -->
<view
v-for="(item, index) in coupons.canUseCoupons"
:key="index"
v-for="(item, index) in coupons.canUseCoupons" <!-- 遍历可用优惠券列表动态生成每个优惠券项 -->
:key="index" <!-- 使用索引作为唯一标识 -->
>
<coupon
:item="item"
order="true"
can-use="true"
@check-coupon="checkCoupon"
:item="item" <!-- 传递优惠券数据 -->
order="true" <!-- 标记为订单页面使用 -->
can-use="true" <!-- 标记为可用优惠券 -->
@check-coupon="checkCoupon" <!-- 点击时触发选择优惠券的方法 -->
/>
</view>
</block>
<block v-if="couponSts == 2">
<block v-if="couponSts == 2"> <!-- couponSts 2 -->
<view
v-for="(item, index) in coupons.unCanUseCoupons"
:key="index"
v-for="(item, index) in coupons.unCanUseCoupons" <!-- 遍历不可用优惠券列表动态生成每个优惠券项 -->
:key="index" <!-- 使用索引作为唯一标识 -->
>
<coupon
:item="item"
order="true"
can-use="false"
:item="item" <!-- 传递优惠券数据 -->
order="true" <!-- 标记为订单页面使用 -->
can-use="false" <!-- 标记为不可用优惠券 -->
/>
</view>
</block>
<view class="botm-empty" />
<view class="botm-empty" /> <!-- 空占位符 -->
</view>
<!-- 确认按钮 -->
<view
v-if="couponSts==1"
v-if="couponSts == 1" <!-- 条件渲染只有当 couponSts 1 时显示确认按钮 -->
class="coupon-ok"
>
<text @tap="choosedCoupon">
确定
</text>
<text @tap="choosedCoupon"></text> <!-- -->
</view>
</view>
</view>
@ -298,31 +235,44 @@
</template>
<script setup>
// number
const wxs = number()
let orderEntry = '0' // 0 1
// 0 1
let orderEntry = '0'
/**
* 生命周期函数--监听页面加载
* @param options - 页面加载时传递的参数
*/
onLoad((options) => {
//
orderEntry = options.orderEntry
})
//
const userAddr = ref(null)
/**
* 生命周期函数--监听页面显示
*/
onShow(() => {
//
const pages = getCurrentPages()
//
const currPage = pages[pages.length - 1]
// userAddr
if (currPage.selAddress === 'yes') {
//
userAddr.value = currPage.item
}
//
//
loadOrderData()
})
// ID
let couponIds = []
//
const coupons = ref({})
const total = ref(0)
const actualTotal = ref(0)
@ -330,37 +280,52 @@ const orderItems = ref([])
const totalCount = ref(0)
const transfee = ref(0)
const shopReduce = ref('')
/**
* 加载订单数据
*/
const loadOrderData = () => {
let addrId = 0
// ID
if (userAddr.value != null) {
addrId = userAddr.value.addrId
}
//
uni.showLoading({
mask: true
})
//
http.request({
url: '/p/order/confirm',
method: 'POST',
data: {
addrId,
//
orderItem: orderEntry === '1' ? JSON.parse(uni.getStorageSync('orderItem')) : undefined,
basketIds: orderEntry === '0' ? JSON.parse(uni.getStorageSync('basketIds')) : undefined,
couponIds,
userChangeCoupon: 1
couponIds, // ID
userChangeCoupon: 1 //
}
})
.then(({ data }) => {
//
uni.hideLoading()
//
let orderItemsData = []
//
data.shopCartOrders[0].shopCartItemDiscounts?.forEach(itemDiscount => {
orderItemsData = orderItems.value?.concat(itemDiscount.shopCartItems)
})
//
if (data.shopCartOrders[0].coupons) {
const canUseCoupons = []
const unCanUseCoupons = []
const canUseCoupons = [] //
const unCanUseCoupons = [] //
//
data.shopCartOrders[0].coupons?.forEach(coupon => {
if (coupon.canUse) {
canUseCoupons.push(coupon)
@ -368,12 +333,16 @@ const loadOrderData = () => {
unCanUseCoupons.push(coupon)
}
})
//
coupons.value = {
totalLength: data.shopCartOrders[0].coupons.length,
canUseCoupons,
unCanUseCoupons
totalLength: data.shopCartOrders[0].coupons.length, //
canUseCoupons, //
unCanUseCoupons //
}
}
//
orderItems.value = orderItemsData
actualTotal.value = data.actualTotal
total.value = data.total
@ -383,25 +352,31 @@ const loadOrderData = () => {
shopReduce.value = data.shopCartOrders[0].shopReduce
})
.catch(err => {
//
uni.hideLoading()
//
chooseCouponErrHandle(err)
})
}
/**
* 优惠券选择出错处理方法
* @param res - 错误响应对象
*/
const chooseCouponErrHandle = (res) => {
//
//
if (res.statusCode == 601) {
//
uni.showToast({
title: res.data,
icon: 'none',
duration: 3000,
success: () => {
// ID
couponIds = []
}
})
//
setTimeout(() => {
loadOrderData()
}, 2500)
@ -412,6 +387,7 @@ const chooseCouponErrHandle = (res) => {
* 提交订单
*/
const toPay = () => {
//
if (!userAddr.value) {
uni.showToast({
title: '请选择地址',
@ -419,38 +395,52 @@ const toPay = () => {
})
return
}
//
submitOrder()
}
//
const remarks = ref('')
/**
* 提交订单
*/
const submitOrder = () => {
//
uni.showLoading({
mask: true
})
//
http.request({
url: '/p/order/submit',
method: 'POST',
data: {
orderShopParam: [{
remarks: remarks.value,
shopId: 1
remarks: remarks.value, //
shopId: 1 // ID1
}]
}
})
.then(({ data }) => {
//
uni.hideLoading()
//
normalPay(data.orderNumbers)
})
}
/**
* 模拟支付直接提交成功
* @param orderNumbers
* @param orderNumbers - 订单编号列表
*/
const normalPay = (orderNumbers) => {
//
uni.showLoading({
mask: true
})
//
http.request({
url: '/p/order/normalPay',
method: 'POST',
@ -459,8 +449,10 @@ const normalPay = (orderNumbers) => {
}
})
.then(({ data }) => {
//
uni.hideLoading()
if (data) {
//
uni.showToast({
title: '模拟支付成功',
icon: 'none'
@ -471,6 +463,7 @@ const normalPay = (orderNumbers) => {
})
}, 1200)
} else {
//
uni.showToast({
title: '支付失败!',
icon: 'none'
@ -479,49 +472,72 @@ const normalPay = (orderNumbers) => {
})
}
// 12
const couponSts = ref(1)
/**
* 切换优惠券状态
* @param e - 事件对象
*/
const changeCouponSts = (e) => {
//
couponSts.value = e.currentTarget.dataset.sts
}
//
const popupShow = ref(false)
/**
* 显示优惠券弹窗
*/
const showCouponPopup = () => {
popupShow.value = true
}
/**
* 关闭优惠券弹窗
*/
const closePopup = () => {
popupShow.value = false
}
/**
* 去地址页面
* 跳转到地址选择页面
*/
const toAddrListPage = () => {
//
uni.navigateTo({
url: '/pages/delivery-address/delivery-address?order=0'
})
}
/**
* 确定选择好的优惠券
* 确认选择好的优惠券
*/
const choosedCoupon = () => {
//
loadOrderData()
//
popupShow.value = false
}
/**
* 优惠券子组件发过来
* 处理优惠券子组件发过来的选择事件
* @param e - 事件对象
*/
const checkCoupon = (e) => {
const index = couponIds.indexOf(e.detail.couponId)
if (index === -1) {
couponIds.push(e.detail.couponId)
// ID
const couponId = e.detail.couponId
// ID
if (couponIds.indexOf(couponId) === -1) {
couponIds.push(couponId)
} else {
couponIds.splice(index, 1)
// ID
couponIds.splice(couponIds.indexOf(couponId), 1)
}
}
</script>
<style scoped lang="scss">
@use './submit-order.scss';
@use './submit-order.scss'; //
</style>

@ -1,222 +1,400 @@
/* 定义容器样式 */
.container {
/* 设置背景颜色 */
background-color: #f7f7f7;
/* 设置底部内边距,以确保内容与底部有适当的空间 */
padding-bottom: 60rpx;
}
/* 用户信息模块样式 */
.userinfo {
/* 设置相对定位,以便其子元素可以使用绝对定位 */
position: relative;
/* 占满整个宽度 */
width: 100%;
/* 设置白色背景 */
background: #fff;
/* 文本居中显示 */
text-align: center;
/* 上下内边距,左右无内边距 */
padding: 30rpx 0;
.userinfo-con {
/* 设置固定宽度,使用户信息框在页面中心对齐 */
width: 240rpx;
/* 水平居中 */
margin: auto;
.userinfo-avatar {
/* 确保超出部分不显示 */
overflow: hidden;
/* 块级显示 */
display: block;
/* 设置头像的尺寸 */
width: 160rpx;
height: 160rpx;
/* 圆形头像 */
border-radius: 50%;
/* 添加阴影效果 */
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
/* 水平居中 */
margin: auto;
image {
/* 设置图像的尺寸 */
width: 160rpx;
height: 160rpx;
}
}
.userinfo-name {
/* 设置字体大小 */
font-size: 30rpx;
/* 加粗字体 */
font-weight: bold;
/* 与头像保持一定间距 */
margin-top: 20rpx;
/* 处理文本溢出 */
overflow: hidden;
/* 使用 WebKit 独有的多行文本截断 */
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
/* 当文本溢出时用省略号表示 */
text-overflow: ellipsis;
/* 允许单词内部断行 */
word-break: break-all;
}
}
}
/* 未登录用户的提示信息样式 */
.userinfo-none {
/* 使用 Flexbox 布局,使子元素垂直和水平居中 */
display: flex;
/* 内边距 */
padding: 30rpx;
/* 白色背景 */
background: #fff;
/* 子元素垂直居中 */
align-items: center;
.default-pic {
/* 右侧内边距 */
padding-right: 30rpx;
image {
/* 设置图像的尺寸 */
width: 160rpx;
height: 160rpx;
}
}
}
/* 未登录状态下的按钮和文本样式 */
.none-login {
button {
/* 按钮背景色为白色 */
background: #fff;
&::after {
/* 移除默认的按钮边框 */
border: 0;
}
}
.unlogin {
/* 设置字体大小 */
font-size: 30rpx;
/* 文本左对齐 */
text-align: left;
/* 移除上下内边距 */
padding: 0;
}
.click-login {
/* 设置较小的字体大小 */
font-size: 26rpx;
/* 颜色较深 */
color: #777;
/* 文本左对齐 */
text-align: left;
/* 移除上下内边距 */
padding: 0;
}
}
/* 绑定手机号的样式 */
.binding-phone {
/* 相对定位 */
position: relative;
/* 白色背景 */
background: #fff;
/* 固定高度 */
height: 80rpx;
/* 行高与高度相同,使文本垂直居中 */
line-height: 80rpx;
/* 内边距 */
padding: 0 30rpx;
/* 上下边框 */
border-top: 2rpx solid #f7f7f7;
border-bottom: 2rpx solid #f7f7f7;
.show-tip {
/* 设置字体大小 */
font-size: 26rpx;
}
.gotobinding {
/* 设置圆角 */
border-radius: 8rpx;
/* 字体大小 */
font-size: 28rpx;
color: #e24b4b;
/* 颜色为红色 */
color: #e24b42;
/* 加粗字体 */
font-weight: bold;
}
}
/* 列表内容样式 */
.list-cont {
/* 占满整个宽度 */
width: 100%;
/* 背景颜色 */
background: #f7f7f7;
/* 顶部外边距 */
margin-top: 20rpx;
.total-order {
/* 白色背景 */
background: #fff;
.order-tit {
/* 使用 Flexbox 布局 */
display: flex;
/* 两端对齐 */
justify-content: space-between;
/* 固定高度 */
height: 80rpx;
/* 行高与高度相同,使文本垂直居中 */
line-height: 80rpx;
/* 字体大小 */
font-size: 30rpx;
/* 下边框 */
border-bottom: 1px solid #f7f7f7;
/* 内边距 */
padding: 0 30rpx;
.checkmore {
/* 较小的字体大小 */
font-size: 22rpx;
/* 颜色较暗 */
color: #80848f;
/* 使用 Flexbox 布局 */
display: flex;
/* 垂直居中 */
align-items: center;
}
}
.procedure {
/* 使用 Flexbox 布局 */
display: flex;
/* 项目均匀分布 */
justify-content: space-around;
/* 项目垂直居中 */
align-items: center;
/* 字体大小 */
font-size: 25rpx;
/* 固定高度 */
height: 160rpx;
.items {
/* 相对定位 */
position: relative;
/* 使用 Flexbox 布局 */
display: flex;
/* 项目垂直排列 */
flex-direction: column;
/* 项目水平居中 */
align-items: center;
image {
/* 设置图像的尺寸 */
width: 70rpx;
height: 70rpx;
/* 与下方文字保持间距 */
margin-bottom: 20rpx;
}
.num-badge {
/* 绝对定位 */
position: absolute;
/* 设置徽章位置 */
top: -15rpx;
right: -12rpx;
/* 颜色为红色 */
color: #eb2444;
/* 边框颜色为红色 */
border: 3rpx solid #eb2444;
/* 圆形 */
border-radius: 50rpx;
/* 白色背景 */
background: #fff;
/* 最小宽度 */
min-width: 30rpx;
/* 固定高度 */
height: 30rpx;
/* 行高与高度相同,使文本垂直居中 */
line-height: 30rpx;
/* 文本水平居中 */
text-align: center;
/* 内边距 */
padding: 2rpx;
/* 块级显示 */
display: block;
}
}
}
}
.my-menu {
/* 白色背景 */
background-color: #fff;
/* 顶部外边距 */
margin-top: 20rpx;
.memu-item {
/* 使用 Flexbox 布局 */
display: flex;
/* 项目垂直居中 */
align-items: center;
/* 项目两端对齐 */
justify-content: space-between;
/* 固定高度 */
height: 100rpx;
/* 下边框 */
border-bottom: 2rpx solid #f7f7f7;
/* 内边距 */
padding: 0 30rpx;
&:nth-child(1) {
/* 第一个项目的上边框 */
border-top: 2rpx solid #f7f7f7;
}
&:last-child {
/* 最后一个项目的下边框移除 */
border-bottom: none;
}
text {
/* 字体大小 */
font-size: 28rpx;
}
image {
/* 设置图像的尺寸 */
width: 50rpx;
height: 50rpx;
/* 与右侧文本保持间距 */
margin-right: 20rpx;
}
.i-name {
/* 使用 Flexbox 布局 */
display: flex;
/* 项目垂直居中 */
align-items: center;
}
}
}
}
/* 箭头样式 */
.arrowhead {
/* 设置箭头的尺寸 */
width: 15rpx;
height: 15rpx;
/* 上边框 */
border-top: 2rpx solid #999;
/* 右边框 */
border-right: 2rpx solid #999;
/* 旋转45度形成箭头形状 */
transform: rotate(45deg);
/* 左侧外边距 */
margin-left: 10rpx;
}
/* 产品栏样式 */
.prod-col {
/* 顶部外边距 */
margin-top: 20rpx;
/* 白色背景 */
background: #fff;
/* 使用 Flexbox 布局 */
display: flex;
/* 项目均匀分布 */
justify-content: space-around;
/* 内边距 */
padding: 30rpx 0 10rpx 0;
/* 字体大小 */
font-size: 12px;
.col-item {
/* 文本居中 */
text-align: center;
.num {
/* 字体较大且加粗 */
font-size: 16px;
font-weight: 700;
/* 颜色为蓝色 */
color: #3a86b9;
}
.tit {
/* 行高 */
line-height: 34px;
}
}
}
/* 登出按钮样式 */
.log-out {
/* 内边距 */
padding: 20rpx;
/* 文本居中 */
text-align: center;
/* 顶部外边距 */
margin-top: 20rpx;
}
.log-out-n {
/* 字体大小 */
font-size: 30rpx;
/* 水平居中 */
margin: auto;
/* 固定宽度 */
width: 200rpx;
/* 内边距 */
padding: 20rpx;
/* 圆角 */
border-radius: 10rpx;
/* 红色背景 */
background: #e43130;
/* 白色文字 */
color: #ffffff;
}
/* 自定义菜单按钮样式 */
button.memu-btn.memu-item {
/* 白色背景 */
background-color: #fff;
&:after {
/* 移除默认的按钮边框 */
border: 0;
}
}

@ -1,221 +1,131 @@
<template>
<view class="container">
<!-- 用户信息 -->
<view
v-if="isAuthInfo"
class="userinfo"
>
<!-- 用户信息模块 -->
<!-- 如果用户已授权并登录则显示用户信息 -->
<view v-if="isAuthInfo" class="userinfo">
<view class="userinfo-con">
<!-- 用户头像 -->
<view class="userinfo-avatar">
<image
:src="
loginResult.pic
?
(loginResult.pic.indexOf('http') === -1 ? picDomain + loginResult.pic : loginResult.pic)
:
'/static/images/icon/head04.png'
? (loginResult.pic.indexOf('http') === -1 ? picDomain + loginResult.pic : loginResult.pic)
: '/static/images/icon/head04.png'
"
/>
</view>
<!-- 用户昵称 -->
<view class="userinfo-name">
<view>{{ loginResult.nickName ? loginResult.nickName : "用户昵称" }}</view>
</view>
</view>
</view>
<view
v-if="!isAuthInfo"
class="userinfo-none"
>
<view
class="default-pic"
@tap="toLogin"
>
<!-- 如果用户未登录则显示默认的登录提示 -->
<view v-if="!isAuthInfo" class="userinfo-none">
<view class="default-pic" @tap="toLogin">
<image src="@/static/images/icon/head04.png" />
</view>
<view
class="none-login"
@tap="toLogin"
>
<button class="unlogin">
未登录
</button>
<button class="click-login">
点击登录账号
</button>
<view class="none-login" @tap="toLogin">
<button class="unlogin">未登录</button>
<button class="click-login">点击登录账号</button>
</view>
</view>
<!-- end 用户信息 -->
<!-- end 用户信息模块 -->
<view class="list-cont">
<!-- 订单状态 -->
<!-- 订单状态模块 -->
<view class="total-order">
<view class="order-tit">
<text style="font-weight:bold">
我的订单
</text>
<view
class="checkmore"
data-sts="0"
@tap="toOrderListPage"
>
<text style="font-weight:bold">我的订单</text>
<!-- 查看全部订单按钮 -->
<view class="checkmore" data-sts="0" @tap="toOrderListPage">
<text>查看全部</text>
<text class="arrowhead" />
</view>
</view>
<!-- 订单流程条 -->
<view class="procedure">
<view
class="items"
data-sts="1"
@tap="toOrderListPage"
>
<!-- 待支付订单 -->
<view class="items" data-sts="1" @tap="toOrderListPage">
<image src="@/static/images/icon/toPay.png" />
<text>待支付</text>
<text
v-if="orderAmount.unPay>0"
class="num-badge"
>
{{ orderAmount.unPay }}
</text>
</view>
<view
class="items"
data-sts="2"
@tap="toOrderListPage"
>
<!-- 如果有待支付订单显示数量 -->
<text v-if="orderAmount.unPay > 0" class="num-badge">{{ orderAmount.unPay }}</text>
</view>
<!-- 待发货订单 -->
<view class="items" data-sts="2" @tap="toOrderListPage">
<image src="@/static/images/icon/toDelivery.png" />
<text>待发货</text>
<text
v-if="orderAmount.payed>0"
class="num-badge"
>
{{ orderAmount.payed }}
</text>
</view>
<view
class="items"
data-sts="3"
@tap="toOrderListPage"
>
<!-- 如果有待发货订单显示数量 -->
<text v-if="orderAmount.payed > 0" class="num-badge">{{ orderAmount.payed }}</text>
</view>
<!-- 待收货订单 -->
<view class="items" data-sts="3" @tap="toOrderListPage">
<image src="@/static/images/icon/toTake.png" />
<text>待收货</text>
<text
v-if="orderAmount.consignment>0"
class="num-badge"
>
{{ orderAmount.consignment }}
</text>
</view>
<view
class="items"
data-sts="5"
@tap="toOrderListPage"
>
<!-- 如果有待收货订单显示数量 -->
<text v-if="orderAmount.consignment > 0" class="num-badge">{{ orderAmount.consignment }}</text>
</view>
<!-- 已完成订单 -->
<view class="items" data-sts="5" @tap="toOrderListPage">
<image src="@/static/images/icon/toComment.png" />
<text>已完成</text>
</view>
</view>
</view>
<!--end 订单状态 -->
<!-- end 订单状态模块 -->
<!-- 产品栏 -->
<view class="prod-col">
<view
class="col-item"
@tap="myCollectionHandle"
>
<view
v-if="loginResult"
class="num"
>
{{ collectionCount }}
</view>
<view
v-else
class="num"
>
--
</view>
<view class="tit">
我的收藏
</view>
</view>
<view
class="col-item"
@tap="handleTips"
>
<view
v-if="loginResult"
class="num"
>
5
</view>
<view
v-else
class="num"
>
--
</view>
<view class="tit">
我的消息
</view>
</view>
<view
class="col-item"
@tap="handleTips"
>
<view
v-if="loginResult"
class="num"
>
3
</view>
<view
v-else
class="num"
>
--
</view>
<view class="tit">
我的足迹
<!-- 我的收藏 -->
<view class="col-item" @tap="myCollectionHandle">
<view v-if="loginResult" class="num">{{ collectionCount }}</view>
<view v-else class="num">--</view>
<view class="tit">我的收藏</view>
</view>
<!-- 我的消息 -->
<view class="col-item" @tap="handleTips">
<view v-if="loginResult" class="num">5</view>
<view v-else class="num">--</view>
<view class="tit">我的消息</view>
</view>
<!-- 我的足迹 -->
<view class="col-item" @tap="handleTips">
<view v-if="loginResult" class="num">3</view>
<view v-else class="num">--</view>
<view class="tit">我的足迹</view>
</view>
</view>
<!-- 菜单列表 -->
<view class="my-menu">
<view
class="memu-item"
@tap="toDistCenter"
>
<!-- 分销中心 -->
<view class="memu-item" @tap="toDistCenter">
<view class="i-name">
<image src="@/static/images/icon/promotion.png" />
<text>分销中心</text>
</view>
<view class="arrowhead" />
</view>
<view
class="memu-item"
@tap="toCouponCenter"
>
<!-- 领券中心 -->
<view class="memu-item" @tap="toCouponCenter">
<view class="i-name">
<image src="@/static/images/icon/getCoupon.png" />
<text>领券中心</text>
</view>
<view class="arrowhead" />
</view>
<view
class="memu-item"
@tap="toMyCouponPage"
>
<!-- 我的优惠券 -->
<view class="memu-item" @tap="toMyCouponPage">
<view class="i-name">
<image src="@/static/images/icon/myCoupon.png" />
<text>我的优惠券</text>
</view>
<view class="arrowhead" />
</view>
<view
class="memu-item"
@tap="toAddressList"
>
<!-- 收货地址 -->
<view class="memu-item" @tap="toAddressList">
<view class="i-name">
<image src="@/static/images/icon/myAddr.png" />
<text>收货地址</text>
@ -223,13 +133,10 @@
<view class="arrowhead" />
</view>
</view>
<!--end 列表 -->
<!-- end 菜单列表 -->
<view
v-if="isAuthInfo"
class="log-out"
@tap="logout"
>
<!-- 登出按钮仅在用户已登录时显示 -->
<view v-if="isAuthInfo" class="log-out" @tap="logout">
<view class="log-out-n">
<text>退出登录</text>
</view>
@ -239,84 +146,100 @@
</template>
<script setup>
// URL
const picDomain = import.meta.env.VITE_APP_RESOURCES_URL
const isAuthInfo = ref(false)
const loginResult = ref('')
const orderAmount = ref('')
//
const isAuthInfo = ref(false) //
const loginResult = ref('') //
const orderAmount = ref('') //
/**
* 生命周期函数--监听页面显示
*/
onShow(() => {
//
loginResult.value = uni.getStorageSync('loginResult')
isAuthInfo.value = !!loginResult.value
//
//
if (isAuthInfo.value) {
uni.showLoading()
uni.showLoading() //
http.request({
url: '/p/myOrder/orderCount',
method: 'GET',
data: {}
})
.then(({ data }) => {
uni.hideLoading()
orderAmount.value = data
uni.hideLoading() //
orderAmount.value = data //
})
showCollectionCount()
showCollectionCount() //
}
})
//
const toDistCenter = () => {
uni.showToast({
icon: 'none',
title: '该功能未开源'
})
}
//
const toCouponCenter = () => {
uni.showToast({
icon: 'none',
title: '该功能未开源'
})
}
//
const toMyCouponPage = () => {
uni.showToast({
icon: 'none',
title: '该功能未开源'
})
}
//
const handleTips = () => {
uni.showToast({
icon: 'none',
title: '该功能未开源'
})
}
//
const toAddressList = () => {
uni.navigateTo({
url: '/pages/delivery-address/delivery-address'
})
}
//
const toOrderListPage = (e) => {
const sts = e.currentTarget.dataset.sts
const sts = e.currentTarget.dataset.sts //
uni.navigateTo({
url: '/pages/orderList/orderList?sts=' + sts
url: '/pages/orderList/orderList?sts=' + sts //
})
}
//
const collectionCount = ref(0)
/**
* 查询所有的收藏量
*/
const showCollectionCount = () => {
uni.showLoading()
uni.showLoading() //
http.request({
url: '/p/user/collection/count',
method: 'GET',
data: {}
})
.then(({ data }) => {
uni.hideLoading()
collectionCount.value = data
uni.hideLoading() //
collectionCount.value = data //
})
}
@ -324,14 +247,14 @@ const showCollectionCount = () => {
* 我的收藏跳转
*/
const myCollectionHandle = () => {
let url = '/pages/prod-classify/prod-classify?sts=5'
const id = 0
const title = '我的收藏商品'
let url = '/pages/prod-classify/prod-classify?sts=5' //
const id = 0 // ID
const title = '我的收藏商品' //
if (id) {
url += '&tagid=' + id + '&title=' + title
url += '&tagid=' + id + '&title=' + title // ID
}
uni.navigateTo({
url
url //
})
}
@ -340,7 +263,7 @@ const myCollectionHandle = () => {
*/
const toLogin = () => {
uni.navigateTo({
url: '/pages/accountLogin/accountLogin'
url: '/pages/accountLogin/accountLogin' //
})
}
@ -353,23 +276,23 @@ const logout = () => {
method: 'post'
})
.then(() => {
util.removeTabBadge()
uni.removeStorageSync('loginResult')
uni.removeStorageSync('token')
util.removeTabBadge() //
uni.removeStorageSync('loginResult') //
uni.removeStorageSync('token') // token
uni.showToast({
title: '退出成功',
icon: 'none'
})
orderAmount.value = ''
orderAmount.value = '' //
setTimeout(() => {
uni.switchTab({
url: '/pages/index/index'
url: '/pages/index/index' //
})
}, 1000)
}, 1000) // 1
})
}
</script>
<style scoped lang="scss">
@use './user.scss';
@use './user.scss'; //
</style>

Loading…
Cancel
Save