master
RIceWqy 2 years ago
parent 80017c09ad
commit 3954f6b756

@ -3,7 +3,7 @@
"private": true,
"version": "0.0.0",
"scripts": {
"preinstall": "npx only-allow pnpm",
"preinstall": "npx only-allow npm",
"dev:h5": "uni",
"dev:h5-test": "uni --mode testing",
"dev:mp-weixin": "uni -p mp-weixin",

@ -149,12 +149,49 @@
"navigationBarBackgroundColor": "#fafafa"
}
},
{
"path": "pages/score/score",
"style": {
"backgroundTextStyle": "light",
"navigationBarTitleText": "积分商城",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#fafafa"
}
},
{
"path": "pages/member/member",
"style": {
"backgroundTextStyle": "light",
"navigationBarTitleText": "会员专区",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#fafafa"
}
},
{
"path": "pages/member-info/member-info",
"style": {
"backgroundTextStyle": "light",
"navigationBarTitleText": "会员信息",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#fafafa"
}
},
{
"path": "pages/member-info-detail/member-info-detail",
"style": {
"backgroundTextStyle": "light",
"navigationBarTitleText": "会员信息详情",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#fafafa"
}
},
{
"path": "pages/accountLogin/accountLogin"
},
{
"path": "pages/register/register"
}
},
],
"tabBar": {
"selectedColor": "#3a86b9",

@ -1,15 +1,9 @@
<template>
<view class="container">
<view class="prod-list">
<block
v-for="(item, scIndex) in shopCartItemDiscounts"
:key="scIndex"
>
<block v-for="(item, scIndex) in shopCartItemDiscounts" :key="scIndex">
<view class="prod-block">
<view
v-if="item.chooseDiscountItemDto"
class="discount-tips"
>
<view v-if="item.chooseDiscountItemDto" class="discount-tips">
<text class="text-block">
{{ wxs.parseDiscount(item.chooseDiscountItemDto.discountRule) }}
</text>
@ -19,21 +13,12 @@
}}
</text>
</view>
<block
v-for="(prod, index) in item.shopCartItems"
:key="index"
>
<block v-for="(prod, index) in item.shopCartItems" :key="index">
<view class="item">
<view class="btn">
<label>
<checkbox
:data-scindex="scIndex"
:data-index="index"
:value="prod.prodId"
:checked="prod.checked"
color="#105c3e"
@tap="onSelectedItem"
/>
<checkbox :data-scindex="scIndex" :data-index="index" :value="prod.prodId" :checked="prod.checked"
color="#105c3e" @tap="onSelectedItem" />
</label>
</view>
<view class="prodinfo">
@ -48,7 +33,7 @@
{{ prod.skuName }}
</text>
<view class="price-count">
<view class="price">
<view class="price" v-if="prod.productType != 2">
<text class="symbol">
</text>
@ -59,24 +44,16 @@
.{{ wxs.parsePrice(prod.price)[1] }}
</text>
</view>
<view class="price" v-if="prod.productType == 2">
<text class="price-num">
{{prod.payScore }}
</text>
积分
</view>
<view class="m-numSelector">
<view
class="minus"
:data-scindex="scIndex"
:data-index="index"
@tap="onCountMinus"
/>
<input
type="number"
:value="prod.prodCount"
disabled
>
<view
class="plus"
:data-scindex="scIndex"
:data-index="index"
@tap="onCountPlus"
/>
<view class="minus" :data-scindex="scIndex" :data-index="index" @tap="onCountMinus" />
<input type="number" :value="prod.prodCount" disabled>
<view class="plus" :data-scindex="scIndex" :data-index="index" @tap="onCountPlus" />
</view>
</view>
</view>
@ -87,10 +64,7 @@
</block>
</view>
<view
v-if="!shopCartItemDiscounts.length"
class="empty"
>
<view v-if="!shopCartItemDiscounts.length" class="empty">
<view class="img">
<image src="@/static/images/tabbar/basket.png" />
</view>
@ -100,28 +74,26 @@
</view>
<!-- 底部按钮 -->
<view
v-if="shopCartItemDiscounts.length>0"
class="cart-footer"
>
<view v-if="shopCartItemDiscounts.length>0" class="cart-footer">
<view class="btn all">
<checkbox
:checked="allChecked"
color="#f7d731;"
@tap="onSelAll"
/>
<checkbox :checked="allChecked" color="#f7d731;" @tap="onSelAll" />
全选
</view>
<view
class="btn del"
@tap="onDelBasket"
>
<view class="btn del" @tap="onDelBasket">
<text>删除</text>
</view>
<view class="btn total">
<view class="finally">
<text>合计:</text>
<view class="price">
<view v-if="totalScore > 0">
<text class="price-num">
{{totalScore }}
</text>
积分+
</view>
<text class="symbol">
</text>
@ -133,17 +105,11 @@
</text>
</view>
</view>
<view
v-if="subtractMoney>0"
class="total-msg"
>
<view v-if="subtractMoney>0" class="total-msg">
总额:{{ wxs.toPrice(totalMoney) }} 立减:{{ wxs.toPrice(subtractMoney) }}
</view>
</view>
<view
class="btn settle"
@tap="toFirmOrder"
>
<view class="btn settle" @tap="toFirmOrder">
<text>结算</text>
</view>
</view>
@ -152,250 +118,256 @@
</template>
<script setup>
const wxs = number()
/**
* 生命周期函数--监听页面显示
*/
onShow(() => {
loadBasketData()
http.getCartCount() //
})
const allChecked = ref(false)
const shopCartItemDiscounts = ref([])
const loadBasketData = () => {
uni.showLoading() //
http.request({
url: '/p/shopCart/info',
method: 'POST',
data: {}
const wxs = number()
/**
* 生命周期函数--监听页面显示
*/
onShow(() => {
loadBasketData()
http.getCartCount() //
})
.then(({ data }) => {
if (data.length > 0) {
//
const shopCartItemDiscountsParam = data[0].shopCartItemDiscounts
shopCartItemDiscountsParam.forEach(shopCartItemDiscount => {
shopCartItemDiscount.shopCartItems.forEach(shopCartItem => {
shopCartItem.checked = false
const allChecked = ref(false)
const shopCartItemDiscounts = ref([])
const loadBasketData = () => {
uni.showLoading() //
http.request({
url: '/p/shopCart/info',
method: 'POST',
data: {}
})
.then(({
data
}) => {
if (data.length > 0) {
//
const shopCartItemDiscountsParam = data[0].shopCartItemDiscounts
shopCartItemDiscountsParam.forEach(shopCartItemDiscount => {
shopCartItemDiscount.shopCartItems.forEach(shopCartItem => {
shopCartItem.checked = false
})
})
})
shopCartItemDiscounts.value = shopCartItemDiscountsParam
allChecked.value = false
} else {
shopCartItemDiscounts.value = []
}
calTotalPrice() //
uni.hideLoading()
})
}
shopCartItemDiscounts.value = shopCartItemDiscountsParam
allChecked.value = false
} else {
shopCartItemDiscounts.value = []
}
calTotalPrice() //
uni.hideLoading()
})
}
/**
* 去结算
*/
const toFirmOrder = () => {
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const basketIds = []
shopCartItemDiscountsParam.forEach(shopCartItemDiscount => {
shopCartItemDiscount.shopCartItems.forEach(shopCartItem => {
if (shopCartItem.checked) {
basketIds.push(shopCartItem.basketId)
}
/**
* 去结算
*/
const toFirmOrder = () => {
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const basketIds = []
shopCartItemDiscountsParam.forEach(shopCartItemDiscount => {
shopCartItemDiscount.shopCartItems.forEach(shopCartItem => {
if (shopCartItem.checked) {
basketIds.push(shopCartItem.basketId)
}
})
})
})
if (!basketIds.length) {
uni.showToast({
title: '请选择商品',
icon: 'none'
if (!basketIds.length) {
uni.showToast({
title: '请选择商品',
icon: 'none'
})
return
}
uni.setStorageSync('basketIds', JSON.stringify(basketIds))
uni.navigateTo({
url: '/pages/submit-order/submit-order?orderEntry=0'
})
return
}
uni.setStorageSync('basketIds', JSON.stringify(basketIds))
uni.navigateTo({
url: '/pages/submit-order/submit-order?orderEntry=0'
})
}
/**
* 全选
*/
const onSelAll = () => {
const allCheckedParam = !allChecked.value //
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
const cItems = shopCartItemDiscountsParam[i].shopCartItems
for (let j = 0; j < cItems.length; j++) {
cItems[j].checked = allCheckedParam
/**
* 全选
*/
const onSelAll = () => {
const allCheckedParam = !allChecked.value //
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
const cItems = shopCartItemDiscountsParam[i].shopCartItems
for (let j = 0; j < cItems.length; j++) {
cItems[j].checked = allCheckedParam
}
}
allChecked.value = allCheckedParam
shopCartItemDiscounts.value = shopCartItemDiscountsParam
calTotalPrice() //
}
allChecked.value = allCheckedParam
shopCartItemDiscounts.value = shopCartItemDiscountsParam
calTotalPrice() //
}
/**
* 每一项的选择事件
* +
*/
const onSelectedItem = (e) => {
const index = e.currentTarget.dataset.index // data- index
const scindex = e.currentTarget.dataset.scindex
const shopCartItemDiscountsParam = shopCartItemDiscounts.value //
const checked = shopCartItemDiscountsParam[scindex].shopCartItems[index].checked //
shopCartItemDiscountsParam[scindex].shopCartItems[index].checked = !checked //
shopCartItemDiscounts.value = shopCartItemDiscountsParam
checkAllSelected() //
calTotalPrice() //
}
/**
* 每一项的选择事件
* +
*/
const onSelectedItem = (e) => {
const index = e.currentTarget.dataset.index // data- index
const scindex = e.currentTarget.dataset.scindex
const shopCartItemDiscountsParam = shopCartItemDiscounts.value //
const checked = shopCartItemDiscountsParam[scindex].shopCartItems[index].checked //
shopCartItemDiscountsParam[scindex].shopCartItems[index].checked = !checked //
shopCartItemDiscounts.value = shopCartItemDiscountsParam
checkAllSelected() //
calTotalPrice() //
}
/**
* 检查全选状态
*/
const checkAllSelected = () => {
let allCheckedParam = true
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
let flag = false
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
const cItems = shopCartItemDiscountsParam[i].shopCartItems
for (let j = 0; j < cItems.length; j++) {
if (!cItems[j].checked) {
allCheckedParam = !allCheckedParam
flag = true
break
/**
* 检查全选状态
*/
const checkAllSelected = () => {
let allCheckedParam = true
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
let flag = false
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
const cItems = shopCartItemDiscountsParam[i].shopCartItems
for (let j = 0; j < cItems.length; j++) {
if (!cItems[j].checked) {
allCheckedParam = !allCheckedParam
flag = true
break
}
}
if (flag) break
}
if (flag) break
allChecked.value = allCheckedParam
}
allChecked.value = allCheckedParam
}
const totalMoney = ref(0)
const subtractMoney = ref(0)
const finalMoney = ref(0)
/**
* 计算购物车总额
*/
const calTotalPrice = () => {
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const shopCartIds = []
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
const cItems = shopCartItemDiscountsParam[i].shopCartItems
for (let j = 0; j < cItems.length; j++) {
if (cItems[j].checked) {
shopCartIds.push(cItems[j].basketId)
const totalMoney = ref(0)
const subtractMoney = ref(0)
const totalScore = ref(0)
const finalMoney = ref(0)
/**
* 计算购物车总额
*/
const calTotalPrice = () => {
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const shopCartIds = []
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
const cItems = shopCartItemDiscountsParam[i].shopCartItems
for (let j = 0; j < cItems.length; j++) {
if (cItems[j].checked) {
shopCartIds.push(cItems[j].basketId)
}
}
}
uni.showLoading()
http.request({
url: '/p/shopCart/totalPay',
method: 'POST',
data: shopCartIds
})
.then(({
data
}) => {
finalMoney.value = data.finalMoney
totalMoney.value = data.totalMoney
totalScore.value = data.totalScore
subtractMoney.value = data.subtractMoney
uni.hideLoading()
})
}
uni.showLoading()
http.request({
url: '/p/shopCart/totalPay',
method: 'POST',
data: shopCartIds
})
.then(({ data }) => {
finalMoney.value = data.finalMoney
totalMoney.value = data.totalMoney
subtractMoney.value = data.subtractMoney
uni.hideLoading()
})
}
/**
* 减少数量
*/
const onCountMinus = (e) => {
const index = e.currentTarget.dataset.index
const scindex = e.currentTarget.dataset.scindex
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const prodCount = shopCartItemDiscountsParam[scindex].shopCartItems[index].prodCount
if (prodCount > 1) {
updateCount(shopCartItemDiscountsParam, scindex, index, -1)
/**
* 减少数量
*/
const onCountMinus = (e) => {
const index = e.currentTarget.dataset.index
const scindex = e.currentTarget.dataset.scindex
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const prodCount = shopCartItemDiscountsParam[scindex].shopCartItems[index].prodCount
if (prodCount > 1) {
updateCount(shopCartItemDiscountsParam, scindex, index, -1)
}
}
}
/**
* 增加数量
*/
const onCountPlus = (e) => {
const index = e.currentTarget.dataset.index
const scindex = e.currentTarget.dataset.scindex
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
updateCount(shopCartItemDiscountsParam, scindex, index, 1)
}
/**
* 增加数量
*/
const onCountPlus = (e) => {
const index = e.currentTarget.dataset.index
const scindex = e.currentTarget.dataset.scindex
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
updateCount(shopCartItemDiscountsParam, scindex, index, 1)
}
/**
* 改变购物车数量接口
*/
const updateCount = (shopCartItemDiscountsParam, scindex, index, prodCount) => {
uni.showLoading({
mask: true
})
http.request({
url: '/p/shopCart/changeItem',
method: 'POST',
data: {
count: prodCount,
prodId: shopCartItemDiscountsParam[scindex].shopCartItems[index].prodId,
skuId: shopCartItemDiscountsParam[scindex].shopCartItems[index].skuId,
shopId: 1
}
})
.then(() => {
shopCartItemDiscountsParam[scindex].shopCartItems[index].prodCount += prodCount
shopCartItemDiscounts.value = shopCartItemDiscountsParam
calTotalPrice() //
uni.hideLoading()
http.getCartCount() //
/**
* 改变购物车数量接口
*/
const updateCount = (shopCartItemDiscountsParam, scindex, index, prodCount) => {
uni.showLoading({
mask: true
})
}
http.request({
url: '/p/shopCart/changeItem',
method: 'POST',
data: {
count: prodCount,
prodId: shopCartItemDiscountsParam[scindex].shopCartItems[index].prodId,
skuId: shopCartItemDiscountsParam[scindex].shopCartItems[index].skuId,
shopId: 1
}
})
.then(() => {
shopCartItemDiscountsParam[scindex].shopCartItems[index].prodCount += prodCount
shopCartItemDiscounts.value = shopCartItemDiscountsParam
calTotalPrice() //
uni.hideLoading()
http.getCartCount() //
})
}
/**
* 删除购物车商品
*/
const onDelBasket = () => {
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const basketIds = []
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
const cItems = shopCartItemDiscountsParam[i].shopCartItems
for (let j = 0; j < cItems.length; j++) {
if (cItems[j].checked) {
basketIds.push(cItems[j].basketId)
/**
* 删除购物车商品
*/
const onDelBasket = () => {
const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const basketIds = []
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
const cItems = shopCartItemDiscountsParam[i].shopCartItems
for (let j = 0; j < cItems.length; j++) {
if (cItems[j].checked) {
basketIds.push(cItems[j].basketId)
}
}
}
}
if (!basketIds.length) {
uni.showToast({
title: '请选择商品',
icon: 'none'
})
} else {
uni.showModal({
title: '',
content: '确认要删除选中的商品吗?',
confirmColor: '#eb2444',
success (res) {
if (res.confirm) {
uni.showLoading({
mask: true
})
http.request({
url: '/p/shopCart/deleteItem',
method: 'DELETE',
data: basketIds
})
.then(() => {
uni.hideLoading()
loadBasketData()
if (!basketIds.length) {
uni.showToast({
title: '请选择商品',
icon: 'none'
})
} else {
uni.showModal({
title: '',
content: '确认要删除选中的商品吗?',
confirmColor: '#eb2444',
success(res) {
if (res.confirm) {
uni.showLoading({
mask: true
})
http.request({
url: '/p/shopCart/deleteItem',
method: 'DELETE',
data: basketIds
})
.then(() => {
uni.hideLoading()
loadBasketData()
})
}
}
}
})
})
}
}
}
</script>
<style scoped lang="scss">
@import "./basket.scss";
@import "./basket.scss";
</style>

@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

@ -0,0 +1,238 @@
.container {
background-color: #f7f7f7;
padding-bottom: 60rpx;
}.price {
font-size: 30rpx;
color: #ff3000;
font-weight: 600;
&::before {
content: '';
font-size: 24rpx;
}
}
.origin-price {
font-size: 26rpx;
font-weight: 400;
text-decoration: line-through;
color: #c4c4c4;
}
.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;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
word-break: break-all;
}
}
}
.userinfo-none {
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;
font-weight: bold;
}
}
.list-cont {
width: 100%;
background: #f7f7f7;
margin-top: 20rpx;
.total-order {
background: #fff;
.order-tit {
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;
display: flex;
align-items: center;
}
}
.procedure {
display: flex;
justify-content: space-around;
align-items: center;
font-size: 25rpx;
height: 160rpx;
.items {
position: relative;
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 {
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 {
display: flex;
align-items: center;
}
}
}
}
.arrowhead {
width: 15rpx;
height: 15rpx;
border-top: 2rpx solid #999;
border-right: 2rpx solid #999;
transform: rotate(45deg);
margin-left: 10rpx;
}
.prod-col {
margin-top: 20rpx;
background: #fff;
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;
}
}

@ -0,0 +1,22 @@
<template>
<view>
3123123
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
@use './member-info.scss';
</style>

@ -0,0 +1,125 @@
.container {
background: #f4f4f4;
}.price {
font-size: 30rpx;
color: #ff3000;
font-weight: 600;
/* &::before {
content: '';
font-size: 24rpx;
} */
}
.origin-price {
font-size: 26rpx;
font-weight: 400;
text-decoration: line-through;
color: #c4c4c4;
}
.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;
.category-item {
display: inline-block;
padding: 20rpx 10rpx;
margin: 0 20rpx;
box-sizing: border-box;
font-size: 28rpx;
}
}
.prod-item {
height: calc(100vh - 100rpx);
}
.on {
border-bottom: 4rpx solid #e43130;
color: #e43130;
}
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
.empty {
margin-top: 200rpx;
}
.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);
&:nth-child(2n-1) {
margin: 20rpx 10rpx 10rpx 20rpx;
}
&:nth-child(2n) {
margin: 20rpx 20rpx 10rpx 10rpx;
}
.hot-imagecont {
.hotsaleimg {
width: 341rpx;
height: 341rpx;
}
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;
.prod-info {
font-size: 22rpx;
color: #999;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.prod-text-info {
position: relative;
height: 70rpx;
line-height: 70rpx;
font-family: Arial;
.hotprod-price {
display: inline;
font-size: 26rpx;
color: #eb2444;
}
.basket-img {
width: 50rpx;
height: 50rpx;
position: absolute;
right: 0;
bottom: 7rpx;
padding: 8rpx;
}
}
}
}
.more-prod {
.prod-text-right {
.prod-info {
font-size: 22rpx;
color: #999;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.empty-wrap {
color: #aaa;
text-align: center;
padding-top: 400rpx;
}

@ -0,0 +1,110 @@
<template>
<!-- 商品列表 -->
<view class="prod-item">
<block v-if="prodList.length">
<block v-for="(prod, key) in prodList" :key="key">
<view class="prod-items" :data-prodid="prod.prodId" @tap="toProdPage">
<view class="hot-imagecont">
<image :src="prod.pic" class="hotsaleimg" />
</view>
<view class="hot-text">
<view class="hotprod-text">
{{ prod.prodName }}
</view>
<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>
</view>
</view>
</view>
</block>
</block>
<view v-else class="empty-wrap">
暂无商品数据~
</view>
</view>
</template>
<script setup>
const wxs = number()
/**
* 生命周期函数--监听页面加载
*/
onLoad((options) => {
getProdList()
})
const current = ref(1)
const pages = ref(0)
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom(() => {
if (current.value < pages.value) {
current.value = current.value + 1
getProdList()
}
})
const intoView = ref('')
const subCategoryList = ref([])
const prodList = ref([])
const isLoaded = ref(false) //
/**
* 根据分类id获取商品列表数据
*/
const getProdList = () => {
isLoaded.value = false
http.request({
url: '/prod/prodListByMember',
method: 'GET',
data: {
current: current.value,
size: 10,
sort: 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
})
}
/**
* 跳转商品下详情
*/
const toProdPage = (e) => {
const prodid = e.currentTarget.dataset.prodid
if (prodid) {
uni.navigateTo({
url: '/pages/prod/prod?prodid=' + prodid
})
}
}
</script>
<style scoped lang="scss">
@use './member.scss';
</style>

@ -50,7 +50,10 @@
</text>
</view>
<view class="price-nums clearfix">
<text class="prodprice">
<text class="prodprice" v-if="item.productType !=2 ">
<text class="symbol">
</text>
@ -61,6 +64,20 @@
.{{ wxs.parsePrice(item.price)[1] }}
</text>
</text>
<text class="prodprice" v-if="item.productType ==2 ">
<text class="symbol">
</text>
<text class="big-num">
{{ item.payScore }}
</text>
<text class="small-num">
积分
</text>
</text>
<view class="btn-box" />
</view>
</view>
@ -172,6 +189,14 @@
<view class="item payment">
<view class="item-txt price">
实付款
<text v-if="totalScore > 0">
<text class="big-num">
{{totalScore }}
</text>
<text class="small-num">
积分+
</text>
</text>
<text class="symbol">
</text>
@ -234,7 +259,7 @@ const userAddrDto = ref(null)
const orderNumber = ref('')
const createTime = ref('')
const total = ref(0) //
/**
const totalScore =ref(0)/**
* 加载订单数据
*/
const loadOrderDetail = (orderNum) => {
@ -257,6 +282,7 @@ const loadOrderDetail = (orderNum) => {
transfee.value = data.transfee
reduceAmount.value = data.reduceAmount
total.value = data.total
totalScore.value = data.actualTotalScore
uni.hideLoading()
})
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,126 @@
.container {
background: #f4f4f4;
}
.price {
font-size: 30rpx;
color: #ff3000;
font-weight: 600;
/* &::before {
content: '';
font-size: 24rpx;
} */
}
.origin-price {
font-size: 26rpx;
font-weight: 400;
text-decoration: line-through;
color: #c4c4c4;
}
.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;
.category-item {
display: inline-block;
padding: 20rpx 10rpx;
margin: 0 20rpx;
box-sizing: border-box;
font-size: 28rpx;
}
}
.prod-item {
height: calc(100vh - 100rpx);
}
.on {
border-bottom: 4rpx solid #e43130;
color: #e43130;
}
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
.empty {
margin-top: 200rpx;
}
.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);
&:nth-child(2n-1) {
margin: 20rpx 10rpx 10rpx 20rpx;
}
&:nth-child(2n) {
margin: 20rpx 20rpx 10rpx 10rpx;
}
.hot-imagecont {
.hotsaleimg {
width: 341rpx;
height: 341rpx;
}
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;
.prod-info {
font-size: 22rpx;
color: #999;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.prod-text-info {
position: relative;
height: 70rpx;
line-height: 70rpx;
font-family: Arial;
.hotprod-price {
display: inline;
font-size: 26rpx;
color: #eb2444;
}
.basket-img {
width: 50rpx;
height: 50rpx;
position: absolute;
right: 0;
bottom: 7rpx;
padding: 8rpx;
}
}
}
}
.more-prod {
.prod-text-right {
.prod-info {
font-size: 22rpx;
color: #999;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.empty-wrap {
color: #aaa;
text-align: center;
padding-top: 400rpx;
}

@ -0,0 +1,110 @@
<template>
<!-- 商品列表 -->
<view class="prod-item">
<block v-if="prodList.length">
<block v-for="(prod, key) in prodList" :key="key">
<view class="prod-items" :data-prodid="prod.prodId" @tap="toProdPage">
<view class="hot-imagecont">
<image :src="prod.pic" class="hotsaleimg" />
</view>
<view class="hot-text">
<view class="hotprod-text">
{{ prod.prodName }}
</view>
<view class="prod-info">
{{ prod.brief }}
</view>
<view class="prod-text-info">
<view class="price">
<text class="big-num">
{{ prod.payScore }}
</text>
<text class="symbol">
积分
</text>
</view>
</view>
</view>
</view>
</block>
</block>
<view v-else class="empty-wrap">
暂无商品数据~
</view>
</view>
</template>
<script setup>
const wxs = number()
/**
* 生命周期函数--监听页面加载
*/
onLoad((options) => {
getProdList()
})
const current = ref(1)
const pages = ref(0)
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom(() => {
if (current.value < pages.value) {
current.value = current.value + 1
getProdList()
}
})
const intoView = ref('')
const subCategoryList = ref([])
const prodList = ref([])
const isLoaded = ref(false) //
/**
* 根据分类id获取商品列表数据
*/
const getProdList = () => {
isLoaded.value = false
http.request({
url: '/prod/prodListByScore',
method: 'GET',
data: {
current: current.value,
size: 10,
sort: 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
})
}
/**
* 跳转商品下详情
*/
const toProdPage = (e) => {
const prodid = e.currentTarget.dataset.prodid
if (prodid) {
uni.navigateTo({
url: '/pages/prod/prod?prodid=' + prodid
})
}
}
</script>
<style scoped lang="scss">
@use './score.scss';
</style>

@ -1,6 +1,22 @@
.container {
background: #f4f4f4;
}
}.price {
font-size: 30rpx;
color: #ff3000;
font-weight: 600;
/*
&::before {
content: '';
font-size: 24rpx;
} */
}
.origin-price {
font-size: 26rpx;
font-weight: 400;
text-decoration: line-through;
color: #c4c4c4;
}
.category-tit {
width: 100%;
white-space: nowrap;

@ -1,22 +1,10 @@
<template>
<view class="Mall4j container">
<!-- 顶部子分类tab -->
<scroll-view
scroll-x="true"
class="category-tit"
:scroll-into-view="intoView"
:scroll-with-animation="true"
>
<block
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"
>
<scroll-view scroll-x="true" class="category-tit" :scroll-into-view="intoView" :scroll-with-animation="true">
<block 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">
{{ item.categoryName }}
</view>
</block>
@ -24,20 +12,10 @@
<!-- 商品列表 -->
<view class="prod-item">
<block v-if="prodList.length">
<block
v-for="(prod, key) in prodList"
:key="key"
>
<view
class="prod-items"
:data-prodid="prod.prodId"
@tap="toProdPage"
>
<block v-for="(prod, key) in prodList" :key="key">
<view class="prod-items" :data-prodid="prod.prodId" @tap="toProdPage">
<view class="hot-imagecont">
<image
:src="prod.pic"
class="hotsaleimg"
/>
<image :src="prod.pic" class="hotsaleimg" />
</view>
<view class="hot-text">
<view class="hotprod-text">
@ -63,10 +41,7 @@
</view>
</block>
</block>
<view
v-else
class="empty-wrap"
>
<view v-else class="empty-wrap">
暂无商品数据~
</view>
</view>
@ -74,104 +49,108 @@
</template>
<script setup>
const wxs = number()
const wxs = number()
const parentId = ref('')
const categoryId = ref(0)
/**
* 生命周期函数--监听页面加载
*/
onLoad((options) => {
parentId.value = options.parentId
categoryId.value = options.categoryId
getSubCategory()
getProdList()
})
const current = ref(1)
const pages = ref(0)
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom(() => {
if (current.value < pages.value) {
current.value = current.value + 1
const parentId = ref('')
const categoryId = ref(0)
/**
* 生命周期函数--监听页面加载
*/
onLoad((options) => {
parentId.value = options.parentId
categoryId.value = options.categoryId
getSubCategory()
getProdList()
}
})
})
const intoView = ref('')
const subCategoryList = ref([])
/**
* 获取顶栏子分类数据
*/
const getSubCategory = () => {
http.request({
url: '/category/categoryInfo',
method: 'GET',
data: {
parentId: parentId.value
const current = ref(1)
const pages = ref(0)
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom(() => {
if (current.value < pages.value) {
current.value = current.value + 1
getProdList()
}
})
.then(({ data }) => {
subCategoryList.value = data
nextTick(() => {
intoView.value = 'sw' + categoryId.value
const intoView = ref('')
const subCategoryList = ref([])
/**
* 获取顶栏子分类数据
*/
const getSubCategory = () => {
http.request({
url: '/category/categoryInfo',
method: 'GET',
data: {
parentId: parentId.value
}
})
})
}
.then(({
data
}) => {
subCategoryList.value = data
nextTick(() => {
intoView.value = 'sw' + categoryId.value
})
})
}
const prodList = ref([])
const isLoaded = ref(false) //
/**
* 根据分类id获取商品列表数据
*/
const getProdList = () => {
isLoaded.value = false
const prodList = ref([])
const isLoaded = ref(false) //
/**
* 根据分类id获取商品列表数据
*/
const getProdList = () => {
isLoaded.value = false
http.request({
url: '/prod/pageProd',
method: 'GET',
data: {
categoryId: categoryId.value,
current: current.value,
size: 10,
sort: 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
})
}
http.request({
url: '/prod/pageProd',
method: 'GET',
data: {
categoryId: categoryId.value,
current: current.value,
size: 10,
sort: 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
})
}
/**
* 切换顶部分类
*/
const onSubCategoryTap = (e) => {
categoryId.value = e.currentTarget.dataset.id
current.value = 1
pages.value = 0
intoView.value = 'sw' + e.currentTarget.dataset.id
getProdList()
}
/**
* 切换顶部分类
*/
const onSubCategoryTap = (e) => {
categoryId.value = e.currentTarget.dataset.id
current.value = 1
pages.value = 0
intoView.value = 'sw' + e.currentTarget.dataset.id
getProdList()
}
/**
* 跳转商品下详情
*/
const toProdPage = (e) => {
const prodid = e.currentTarget.dataset.prodid
if (prodid) {
uni.navigateTo({
url: '/pages/prod/prod?prodid=' + prodid
})
/**
* 跳转商品下详情
*/
const toProdPage = (e) => {
const prodid = e.currentTarget.dataset.prodid
if (prodid) {
uni.navigateTo({
url: '/pages/prod/prod?prodid=' + prodid
})
}
}
}
</script>
<style lang="scss" scoped>
@import "./sub-category.scss";
@import "./sub-category.scss";
</style>

@ -3,14 +3,8 @@
<view class="container">
<view class="submit-order">
<!-- 收货地址 -->
<view
class="delivery-addr "
@tap="toAddrListPage"
>
<view
v-if="!userAddr"
class="addr-bg "
>
<view class="delivery-addr " @tap="toAddrListPage">
<view v-if="!userAddr" class="addr-bg ">
<view class="add-addr">
<view class="plus-sign-img">
<image src="@/static/images/icon/plus-sign.png" />
@ -19,10 +13,7 @@
</view>
<view class="arrow empty" />
</view>
<view
v-if="userAddr"
class="addr-bg whole"
>
<view v-if="userAddr" class="addr-bg whole">
<view class="addr-icon">
<image src="@/static/images/icon/addr.png" />
</view>
@ -43,15 +34,8 @@
<!-- 商品详情 -->
<view class="prod-item">
<block
v-for="(item, index) in orderItems"
:key="index"
>
<view
class="item-cont"
:data-ordernum="item.primaryOrderNo"
@tap="toOrderDetailPage"
>
<block v-for="(item, index) in orderItems" :key="index">
<view class="item-cont" :data-ordernum="item.primaryOrderNo" @tap="toOrderDetailPage">
<view class="prod-pic">
<image :src="item.pic" />
</view>
@ -63,7 +47,8 @@
{{ item.skuName }}
</view>
<view class="price-nums">
<text class="prodprice">
<text class="prodprice" v-if="item.productType !=2 ">
<text class="symbol">
</text>
@ -74,6 +59,18 @@
.{{ wxs.parsePrice(item.price)[1] }}
</text>
</text>
<text class="prodprice" v-if="item.productType ==2 ">
<text class="symbol">
</text>
<text class="big-num">
{{ item.payScore }}
</text>
<text class="small-num">
积分
</text>
</text>
<text class="prodcount">
x{{ item.prodCount }}
</text>
@ -88,6 +85,14 @@
</text>
<view class="prodprice">
合计
<text v-if="totalScore > 0">
<text class="big-num">
{{totalScore }}
</text>
<text class="small-num">
积分+
</text>
</text>
<text class="symbol">
</text>
@ -104,17 +109,11 @@
<!-- 订单详情 -->
<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 v-if="!coupons.canUseCoupons" class="item-txt">
暂无可用
</text>
<text class="coupon-btn">
@ -124,10 +123,7 @@
</view>
<view class="item">
<text>买家留言</text>
<input
v-model="remarks"
placeholder="给卖家留言"
>
<input v-model="remarks" placeholder="给卖家留言">
</view>
</view>
</view>
@ -185,6 +181,14 @@
<view class="item payment">
<view class="item-txt price">
小计
<text v-if="totalScore > 0">
<text class="big-num">
{{totalScore }}
</text>
<text class="small-num">
积分+
</text>
</text>
<text class="symbol">
</text>
@ -206,6 +210,16 @@
<view class="item-txt">
合计
<view class="price">
<text v-if="totalScore > 0">
<text class="big-num">
{{totalScore }}
</text>
<text class="small-num">
积分+
</text>
</text>
<text class="symbol">
</text>
@ -218,76 +232,41 @@
</view>
</view>
</view>
<view
class="footer-box"
@tap="toPay"
>
<view class="footer-box" @tap="toPay">
提交订单
</view>
</view>
</view>
<!-- 选择优惠券弹窗 -->
<view
v-if="popupShow"
class="popup-hide"
>
<view v-if="popupShow" class="popup-hide">
<view class="popup-box">
<view class="popup-tit">
<text>优惠券</text>
<text
class="close"
@tap="closePopup"
/>
<text class="close" @tap="closePopup" />
</view>
<view class="coupon-tabs">
<view
:class="'coupon-tab ' + (couponSts==1?'on':'')"
data-sts="1"
@tap="changeCouponSts"
>
<view :class="'coupon-tab ' + (couponSts==1?'on':'')" data-sts="1" @tap="changeCouponSts">
可用优惠券({{ coupons.canUseCoupons.length ? coupons.canUseCoupons.length : 0 }})
</view>
<view
:class="'coupon-tab ' + (couponSts==2?'on':'')"
data-sts="2"
@tap="changeCouponSts"
>
<view :class="'coupon-tab ' + (couponSts==2?'on':'')" data-sts="2" @tap="changeCouponSts">
不可用优惠券({{ coupons.unCanUseCoupons.length ? coupons.unCanUseCoupons.length : 0 }})
</view>
</view>
<view class="popup-cnt">
<block v-if="couponSts == 1">
<view
v-for="(item, index) in coupons.canUseCoupons"
:key="index"
>
<coupon
:item="item"
order="true"
can-use="true"
@check-coupon="checkCoupon"
/>
<view v-for="(item, index) in coupons.canUseCoupons" :key="index">
<coupon :item="item" order="true" can-use="true" @check-coupon="checkCoupon" />
</view>
</block>
<block v-if="couponSts == 2">
<view
v-for="(item, index) in coupons.unCanUseCoupons"
:key="index"
>
<coupon
:item="item"
order="true"
can-use="false"
/>
<view v-for="(item, index) in coupons.unCanUseCoupons" :key="index">
<coupon :item="item" order="true" can-use="false" />
</view>
</block>
<view class="botm-empty" />
</view>
<view
v-if="couponSts==1"
class="coupon-ok"
>
<view v-if="couponSts==1" class="coupon-ok">
<text @tap="choosedCoupon">
确定
</text>
@ -298,230 +277,238 @@
</template>
<script setup>
const wxs = number()
let orderEntry = '0' // 0 1
/**
* 生命周期函数--监听页面加载
*/
onLoad((options) => {
orderEntry = options.orderEntry
})
const userAddr = ref(null)
/**
* 生命周期函数--监听页面显示
*/
onShow(() => {
const pages = getCurrentPages()
const currPage = pages[pages.length - 1]
if (currPage.selAddress === 'yes') {
//
userAddr.value = currPage.item
}
//
loadOrderData()
})
let couponIds = []
const coupons = ref({})
const total = ref(0)
const actualTotal = ref(0)
const orderItems = ref([])
const totalCount = ref(0)
const transfee = ref(0)
const shopReduce = ref('')
/**
* 加载订单数据
*/
const loadOrderData = () => {
let addrId = 0
if (userAddr.value != null) {
addrId = userAddr.value.addrId
}
uni.showLoading({
mask: true
const wxs = number()
let orderEntry = '0' // 0 1
/**
* 生命周期函数--监听页面加载
*/
onLoad((options) => {
orderEntry = options.orderEntry
})
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
const userAddr = ref(null)
/**
* 生命周期函数--监听页面显示
*/
onShow(() => {
const pages = getCurrentPages()
const currPage = pages[pages.length - 1]
if (currPage.selAddress === 'yes') {
//
userAddr.value = currPage.item
}
//
loadOrderData()
})
.then(({ data }) => {
uni.hideLoading()
let orderItemsData = []
data.shopCartOrders[0].shopCartItemDiscounts?.forEach(itemDiscount => {
orderItemsData = orderItems.value?.concat(itemDiscount.shopCartItems)
let couponIds = []
const coupons = ref({})
const total = ref(0)
const actualTotal = ref(0)
const orderItems = ref([])
const totalCount = ref(0)
const transfee = ref(0)
const shopReduce = ref('')
const totalScore = ref(0)
/**
* 加载订单数据
*/
const loadOrderData = () => {
let addrId = 0
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
}
})
if (data.shopCartOrders[0].coupons) {
const canUseCoupons = []
const unCanUseCoupons = []
data.shopCartOrders[0].coupons?.forEach(coupon => {
if (coupon.canUse) {
canUseCoupons.push(coupon)
} else {
unCanUseCoupons.push(coupon)
}
.then(({
data
}) => {
uni.hideLoading()
let orderItemsData = []
data.shopCartOrders[0].shopCartItemDiscounts?.forEach(itemDiscount => {
orderItemsData = orderItems.value?.concat(itemDiscount.shopCartItems)
})
coupons.value = {
totalLength: data.shopCartOrders[0].coupons.length,
canUseCoupons,
unCanUseCoupons
if (data.shopCartOrders[0].coupons) {
const canUseCoupons = []
const unCanUseCoupons = []
data.shopCartOrders[0].coupons?.forEach(coupon => {
if (coupon.canUse) {
canUseCoupons.push(coupon)
} else {
unCanUseCoupons.push(coupon)
}
})
coupons.value = {
totalLength: data.shopCartOrders[0].coupons.length,
canUseCoupons,
unCanUseCoupons
}
}
}
orderItems.value = orderItemsData
actualTotal.value = data.actualTotal
total.value = data.total
totalCount.value = data.totalCount
userAddr.value = data.userAddr
transfee.value = data.shopCartOrders[0].transfee
shopReduce.value = data.shopCartOrders[0].shopReduce
})
.catch(err => {
uni.hideLoading()
chooseCouponErrHandle(err)
})
}
/**
* 优惠券选择出错处理方法
*/
const chooseCouponErrHandle = (res) => {
//
if (res.statusCode == 601) {
uni.showToast({
title: res.data,
icon: 'none',
duration: 3000,
success: () => {
couponIds = []
}
})
setTimeout(() => {
loadOrderData()
}, 2500)
orderItems.value = orderItemsData
actualTotal.value = data.actualTotal
total.value = data.total
totalCount.value = data.totalCount
userAddr.value = data.userAddr
transfee.value = data.shopCartOrders[0].transfee
shopReduce.value = data.shopCartOrders[0].shopReduce
totalScore.value = data.actualTotalScore
})
.catch(err => {
uni.hideLoading()
chooseCouponErrHandle(err)
})
}
}
/**
* 提交订单
*/
const toPay = () => {
if (!userAddr.value) {
uni.showToast({
title: '请选择地址',
icon: 'none'
})
return
/**
* 优惠券选择出错处理方法
*/
const chooseCouponErrHandle = (res) => {
//
if (res.statusCode == 601) {
uni.showToast({
title: res.data,
icon: 'none',
duration: 3000,
success: () => {
couponIds = []
}
})
setTimeout(() => {
loadOrderData()
}, 2500)
}
}
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
}]
/**
* 提交订单
*/
const toPay = () => {
if (!userAddr.value) {
uni.showToast({
title: '请选择地址',
icon: 'none'
})
return
}
})
.then(({ data }) => {
uni.hideLoading()
normalPay(data.orderNumbers)
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
}]
}
})
.then(({
data
}) => {
uni.hideLoading()
normalPay(data.orderNumbers)
})
}
/**
* 模拟支付直接提交成功
* @param orderNumbers
*/
const normalPay = (orderNumbers) => {
uni.showLoading({
mask: true
})
http.request({
url: '/p/order/normalPay',
method: 'POST',
data: {
orderNumbers
}
})
.then(({ data }) => {
uni.hideLoading()
if (data) {
uni.showToast({
title: '模拟支付成功',
icon: 'none'
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/pay-result/pay-result?sts=1&orderNumbers=' + orderNumbers
})
}, 1200)
} else {
uni.showToast({
title: '支付失败!',
icon: 'none'
})
}
/**
* 模拟支付直接提交成功
* @param orderNumbers
*/
const normalPay = (orderNumbers) => {
uni.showLoading({
mask: true
})
}
http.request({
url: '/p/order/normalPay',
method: 'POST',
data: {
orderNumbers
}
})
.then(({
data
}) => {
uni.hideLoading()
if (data) {
uni.showToast({
title: '模拟支付成功',
icon: 'none'
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/pay-result/pay-result?sts=1&orderNumbers=' + orderNumbers
})
}, 1200)
} else {
uni.showToast({
title: '支付失败!',
icon: 'none'
})
}
})
}
const couponSts = ref(1)
const changeCouponSts = (e) => {
couponSts.value = e.currentTarget.dataset.sts
}
const couponSts = ref(1)
const changeCouponSts = (e) => {
couponSts.value = e.currentTarget.dataset.sts
}
const popupShow = ref(false)
const showCouponPopup = () => {
popupShow.value = true
}
const closePopup = () => {
popupShow.value = false
}
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 toAddrListPage = () => {
uni.navigateTo({
url: '/pages/delivery-address/delivery-address?order=0'
})
}
/**
* 确定选择好的优惠券
*/
const choosedCoupon = () => {
loadOrderData()
popupShow.value = false
}
/**
* 确定选择好的优惠券
*/
const choosedCoupon = () => {
loadOrderData()
popupShow.value = false
}
/**
* 优惠券子组件发过来
*/
const checkCoupon = (e) => {
const index = couponIds.indexOf(e.detail.couponId)
if (index === -1) {
couponIds.push(e.detail.couponId)
} else {
couponIds.splice(index, 1)
/**
* 优惠券子组件发过来
*/
const checkCoupon = (e) => {
const index = couponIds.indexOf(e.detail.couponId)
if (index === -1) {
couponIds.push(e.detail.couponId)
} else {
couponIds.splice(index, 1)
}
}
}
</script>
<style scoped lang="scss">
@use './submit-order.scss';
@use './submit-order.scss';
</style>

@ -1,21 +1,16 @@
<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="
<image :src="
loginResult.pic
?
(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>
@ -23,20 +18,11 @@
</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"
>
<view class="none-login" @tap="toLogin">
<button class="unlogin">
未登录
</button>
@ -54,63 +40,34 @@
<text style="font-weight:bold">
我的订单
</text>
<view
class="checkmore"
data-sts="0"
@tap="toOrderListPage"
>
<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"
>
<text v-if="orderAmount.unPay>0" class="num-badge">
{{ orderAmount.unPay }}
</text>
</view>
<view
class="items"
data-sts="2"
@tap="toOrderListPage"
>
<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"
>
<text v-if="orderAmount.payed>0" class="num-badge">
{{ orderAmount.payed }}
</text>
</view>
<view
class="items"
data-sts="3"
@tap="toOrderListPage"
>
<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"
>
<text v-if="orderAmount.consignment>0" class="num-badge">
{{ orderAmount.consignment }}
</text>
</view>
<view
class="items"
data-sts="5"
@tap="toOrderListPage"
>
<view class="items" data-sts="5" @tap="toOrderListPage">
<image src="@/static/images/icon/toComment.png" />
<text>已完成</text>
</view>
@ -119,60 +76,33 @@
<!--end 订单状态 -->
<view class="prod-col">
<view
class="col-item"
@tap="myCollectionHandle"
>
<view
v-if="loginResult"
class="num"
>
<view class="col-item" @tap="myCollectionHandle">
<view v-if="loginResult" class="num">
{{ collectionCount }}
</view>
<view
v-else
class="num"
>
<view v-else class="num">
--
</view>
<view class="tit">
我的收藏
</view>
</view>
<view
class="col-item"
@tap="handleTips"
>
<view
v-if="loginResult"
class="num"
>
<view class="col-item" @tap="handleTips">
<view v-if="loginResult" class="num">
5
</view>
<view
v-else
class="num"
>
<view v-else class="num">
--
</view>
<view class="tit">
我的消息
</view>
</view>
<view
class="col-item"
@tap="handleTips"
>
<view
v-if="loginResult"
class="num"
>
<view class="col-item" @tap="handleTips">
<view v-if="loginResult" class="num">
3
</view>
<view
v-else
class="num"
>
<view v-else class="num">
--
</view>
<view class="tit">
@ -182,40 +112,49 @@
</view>
<view class="my-menu">
<view
class="memu-item"
@tap="toDistCenter"
>
<view class="memu-item" @tap="toMemberInfoPage">
<view class="i-name">
<image src="@/static/images/icon/promotion.png" />
<text>会员信息</text>
</view>
<view class="arrowhead" />
</view>
<view class="memu-item" @tap="toScorePage">
<view class="i-name">
<image src="@/static/images/icon/promotion.png" />
<text>积分商城</text>
</view>
<view class="arrowhead" />
</view>
<view class="memu-item" @tap="toMemberPage">
<view class="i-name">
<image src="@/static/images/icon/promotion.png" />
<text>会员专区</text>
</view>
<view class="arrowhead" />
</view>
<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>
@ -225,11 +164,7 @@
</view>
<!--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,137 +174,158 @@
</template>
<script setup>
const picDomain = import.meta.env.VITE_APP_RESOURCES_URL
const picDomain = import.meta.env.VITE_APP_RESOURCES_URL
const isAuthInfo = ref(false)
const loginResult = ref('')
const orderAmount = ref('')
/**
* 生命周期函数--监听页面显示
*/
onShow(() => {
loginResult.value = uni.getStorageSync('loginResult')
isAuthInfo.value = !!loginResult.value
//
if (isAuthInfo.value) {
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()
http.request({
url: '/p/myOrder/orderCount',
method: 'GET',
data: {}
})
.then(({
data
}) => {
uni.hideLoading()
orderAmount.value = data
})
showCollectionCount()
}
})
const toMemberInfoPage = () => {
uni.navigateTo({
url: '/pages/member-info/member-info'
})
}
const toScorePage = () => {
uni.navigateTo({
url: '/pages/score/score'
})
}
const toMemberPage = () => {
uni.navigateTo({
url: '/pages/member/member'
})
}
const toDistCenter = () => {
uni.showToast({
icon: 'none',
title: '该功能未开源'
})
}
const toCouponCenter = () => {
uni.showToast({
icon: 'none',
title: '该功能未开源'
})
}
const toMyCouponPage = () => {
/* uni.showToast({
icon: 'none',
title: '该功能未开源'
}) */
uni.navigateTo({
url: '/pages/delivery-address/delivery-address'
})
}
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
uni.navigateTo({
url: '/pages/orderList/orderList?sts=' + sts
})
}
const collectionCount = ref(0)
/**
* 查询所有的收藏量
*/
const showCollectionCount = () => {
uni.showLoading()
http.request({
url: '/p/myOrder/orderCount',
method: 'GET',
data: {}
})
.then(({ data }) => {
url: '/p/user/collection/count',
method: 'GET',
data: {}
})
.then(({
data
}) => {
uni.hideLoading()
orderAmount.value = data
collectionCount.value = data
})
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
uni.navigateTo({
url: '/pages/orderList/orderList?sts=' + sts
})
}
const collectionCount = ref(0)
/**
* 查询所有的收藏量
*/
const showCollectionCount = () => {
uni.showLoading()
http.request({
url: '/p/user/collection/count',
method: 'GET',
data: {}
})
.then(({ data }) => {
uni.hideLoading()
collectionCount.value = data
/**
* 我的收藏跳转
*/
const myCollectionHandle = () => {
let url = '/pages/prod-classify/prod-classify?sts=5'
const id = 0
const title = '我的收藏商品'
if (id) {
url += '&tagid=' + id + '&title=' + title
}
uni.navigateTo({
url
})
}
/**
* 我的收藏跳转
*/
const myCollectionHandle = () => {
let url = '/pages/prod-classify/prod-classify?sts=5'
const id = 0
const title = '我的收藏商品'
if (id) {
url += '&tagid=' + id + '&title=' + title
}
uni.navigateTo({
url
})
}
/**
* 去登陆
*/
const toLogin = () => {
uni.navigateTo({
url: '/pages/accountLogin/accountLogin'
})
}
/**
* 去登陆
*/
const toLogin = () => {
uni.navigateTo({
url: '/pages/accountLogin/accountLogin'
})
}
/**
* 退出登录
*/
const logout = () => {
http.request({
url: '/logOut',
method: 'post'
})
.then(() => {
util.removeTabBadge()
uni.removeStorageSync('loginResult')
uni.removeStorageSync('token')
uni.showToast({
title: '退出成功',
icon: 'none'
/**
* 退出登录
*/
const logout = () => {
http.request({
url: '/logOut',
method: 'post'
})
orderAmount.value = ''
setTimeout(() => {
uni.switchTab({
url: '/pages/index/index'
.then(() => {
util.removeTabBadge()
uni.removeStorageSync('loginResult')
uni.removeStorageSync('token')
uni.showToast({
title: '退出成功',
icon: 'none'
})
}, 1000)
})
}
orderAmount.value = ''
setTimeout(() => {
uni.switchTab({
url: '/pages/index/index'
})
}, 1000)
})
}
</script>
<style scoped lang="scss">
@use './user.scss';
@use './user.scss';
</style>

Loading…
Cancel
Save