master
RIceWqy 2 years ago
parent 80017c09ad
commit 3954f6b756

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

@ -149,12 +149,49 @@
"navigationBarBackgroundColor": "#fafafa" "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/accountLogin/accountLogin"
}, },
{ {
"path": "pages/register/register" "path": "pages/register/register"
} },
], ],
"tabBar": { "tabBar": {
"selectedColor": "#3a86b9", "selectedColor": "#3a86b9",

@ -1,15 +1,9 @@
<template> <template>
<view class="container"> <view class="container">
<view class="prod-list"> <view class="prod-list">
<block <block v-for="(item, scIndex) in shopCartItemDiscounts" :key="scIndex">
v-for="(item, scIndex) in shopCartItemDiscounts"
:key="scIndex"
>
<view class="prod-block"> <view class="prod-block">
<view <view v-if="item.chooseDiscountItemDto" class="discount-tips">
v-if="item.chooseDiscountItemDto"
class="discount-tips"
>
<text class="text-block"> <text class="text-block">
{{ wxs.parseDiscount(item.chooseDiscountItemDto.discountRule) }} {{ wxs.parseDiscount(item.chooseDiscountItemDto.discountRule) }}
</text> </text>
@ -19,21 +13,12 @@
}} }}
</text> </text>
</view> </view>
<block <block v-for="(prod, index) in item.shopCartItems" :key="index">
v-for="(prod, index) in item.shopCartItems"
:key="index"
>
<view class="item"> <view class="item">
<view class="btn"> <view class="btn">
<label> <label>
<checkbox <checkbox :data-scindex="scIndex" :data-index="index" :value="prod.prodId" :checked="prod.checked"
:data-scindex="scIndex" color="#105c3e" @tap="onSelectedItem" />
:data-index="index"
:value="prod.prodId"
:checked="prod.checked"
color="#105c3e"
@tap="onSelectedItem"
/>
</label> </label>
</view> </view>
<view class="prodinfo"> <view class="prodinfo">
@ -48,7 +33,7 @@
{{ prod.skuName }} {{ prod.skuName }}
</text> </text>
<view class="price-count"> <view class="price-count">
<view class="price"> <view class="price" v-if="prod.productType != 2">
<text class="symbol"> <text class="symbol">
</text> </text>
@ -59,24 +44,16 @@
.{{ wxs.parsePrice(prod.price)[1] }} .{{ wxs.parsePrice(prod.price)[1] }}
</text> </text>
</view> </view>
<view class="price" v-if="prod.productType == 2">
<text class="price-num">
{{prod.payScore }}
</text>
积分
</view>
<view class="m-numSelector"> <view class="m-numSelector">
<view <view class="minus" :data-scindex="scIndex" :data-index="index" @tap="onCountMinus" />
class="minus" <input type="number" :value="prod.prodCount" disabled>
:data-scindex="scIndex" <view class="plus" :data-scindex="scIndex" :data-index="index" @tap="onCountPlus" />
: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> </view>
</view> </view>
@ -87,10 +64,7 @@
</block> </block>
</view> </view>
<view <view v-if="!shopCartItemDiscounts.length" class="empty">
v-if="!shopCartItemDiscounts.length"
class="empty"
>
<view class="img"> <view class="img">
<image src="@/static/images/tabbar/basket.png" /> <image src="@/static/images/tabbar/basket.png" />
</view> </view>
@ -100,28 +74,26 @@
</view> </view>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view <view v-if="shopCartItemDiscounts.length>0" class="cart-footer">
v-if="shopCartItemDiscounts.length>0"
class="cart-footer"
>
<view class="btn all"> <view class="btn all">
<checkbox <checkbox :checked="allChecked" color="#f7d731;" @tap="onSelAll" />
:checked="allChecked"
color="#f7d731;"
@tap="onSelAll"
/>
全选 全选
</view> </view>
<view <view class="btn del" @tap="onDelBasket">
class="btn del"
@tap="onDelBasket"
>
<text>删除</text> <text>删除</text>
</view> </view>
<view class="btn total"> <view class="btn total">
<view class="finally"> <view class="finally">
<text>合计:</text> <text>合计:</text>
<view class="price"> <view class="price">
<view v-if="totalScore > 0">
<text class="price-num">
{{totalScore }}
</text>
积分+
</view>
<text class="symbol"> <text class="symbol">
</text> </text>
@ -133,17 +105,11 @@
</text> </text>
</view> </view>
</view> </view>
<view <view v-if="subtractMoney>0" class="total-msg">
v-if="subtractMoney>0"
class="total-msg"
>
总额:{{ wxs.toPrice(totalMoney) }} 立减:{{ wxs.toPrice(subtractMoney) }} 总额:{{ wxs.toPrice(totalMoney) }} 立减:{{ wxs.toPrice(subtractMoney) }}
</view> </view>
</view> </view>
<view <view class="btn settle" @tap="toFirmOrder">
class="btn settle"
@tap="toFirmOrder"
>
<text>结算</text> <text>结算</text>
</view> </view>
</view> </view>
@ -152,25 +118,27 @@
</template> </template>
<script setup> <script setup>
const wxs = number() const wxs = number()
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow(() => { onShow(() => {
loadBasketData() loadBasketData()
http.getCartCount() // http.getCartCount() //
}) })
const allChecked = ref(false) const allChecked = ref(false)
const shopCartItemDiscounts = ref([]) const shopCartItemDiscounts = ref([])
const loadBasketData = () => { const loadBasketData = () => {
uni.showLoading() // uni.showLoading() //
http.request({ http.request({
url: '/p/shopCart/info', url: '/p/shopCart/info',
method: 'POST', method: 'POST',
data: {} data: {}
}) })
.then(({ data }) => { .then(({
data
}) => {
if (data.length > 0) { if (data.length > 0) {
// //
const shopCartItemDiscountsParam = data[0].shopCartItemDiscounts const shopCartItemDiscountsParam = data[0].shopCartItemDiscounts
@ -187,12 +155,12 @@ const loadBasketData = () => {
calTotalPrice() // calTotalPrice() //
uni.hideLoading() uni.hideLoading()
}) })
} }
/** /**
* 去结算 * 去结算
*/ */
const toFirmOrder = () => { const toFirmOrder = () => {
const shopCartItemDiscountsParam = shopCartItemDiscounts.value const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const basketIds = [] const basketIds = []
shopCartItemDiscountsParam.forEach(shopCartItemDiscount => { shopCartItemDiscountsParam.forEach(shopCartItemDiscount => {
@ -215,12 +183,12 @@ const toFirmOrder = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/submit-order/submit-order?orderEntry=0' url: '/pages/submit-order/submit-order?orderEntry=0'
}) })
} }
/** /**
* 全选 * 全选
*/ */
const onSelAll = () => { const onSelAll = () => {
const allCheckedParam = !allChecked.value // const allCheckedParam = !allChecked.value //
const shopCartItemDiscountsParam = shopCartItemDiscounts.value const shopCartItemDiscountsParam = shopCartItemDiscounts.value
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) { for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
@ -232,13 +200,13 @@ const onSelAll = () => {
allChecked.value = allCheckedParam allChecked.value = allCheckedParam
shopCartItemDiscounts.value = shopCartItemDiscountsParam shopCartItemDiscounts.value = shopCartItemDiscountsParam
calTotalPrice() // calTotalPrice() //
} }
/** /**
* 每一项的选择事件 * 每一项的选择事件
* + * +
*/ */
const onSelectedItem = (e) => { const onSelectedItem = (e) => {
const index = e.currentTarget.dataset.index // data- index const index = e.currentTarget.dataset.index // data- index
const scindex = e.currentTarget.dataset.scindex const scindex = e.currentTarget.dataset.scindex
const shopCartItemDiscountsParam = shopCartItemDiscounts.value // const shopCartItemDiscountsParam = shopCartItemDiscounts.value //
@ -247,12 +215,12 @@ const onSelectedItem = (e) => {
shopCartItemDiscounts.value = shopCartItemDiscountsParam shopCartItemDiscounts.value = shopCartItemDiscountsParam
checkAllSelected() // checkAllSelected() //
calTotalPrice() // calTotalPrice() //
} }
/** /**
* 检查全选状态 * 检查全选状态
*/ */
const checkAllSelected = () => { const checkAllSelected = () => {
let allCheckedParam = true let allCheckedParam = true
const shopCartItemDiscountsParam = shopCartItemDiscounts.value const shopCartItemDiscountsParam = shopCartItemDiscounts.value
let flag = false let flag = false
@ -268,15 +236,16 @@ const checkAllSelected = () => {
if (flag) break if (flag) break
} }
allChecked.value = allCheckedParam allChecked.value = allCheckedParam
} }
const totalMoney = ref(0) const totalMoney = ref(0)
const subtractMoney = ref(0) const subtractMoney = ref(0)
const finalMoney = ref(0) const totalScore = ref(0)
/** const finalMoney = ref(0)
/**
* 计算购物车总额 * 计算购物车总额
*/ */
const calTotalPrice = () => { const calTotalPrice = () => {
const shopCartItemDiscountsParam = shopCartItemDiscounts.value const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const shopCartIds = [] const shopCartIds = []
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) { for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
@ -293,18 +262,21 @@ const calTotalPrice = () => {
method: 'POST', method: 'POST',
data: shopCartIds data: shopCartIds
}) })
.then(({ data }) => { .then(({
data
}) => {
finalMoney.value = data.finalMoney finalMoney.value = data.finalMoney
totalMoney.value = data.totalMoney totalMoney.value = data.totalMoney
totalScore.value = data.totalScore
subtractMoney.value = data.subtractMoney subtractMoney.value = data.subtractMoney
uni.hideLoading() uni.hideLoading()
}) })
} }
/** /**
* 减少数量 * 减少数量
*/ */
const onCountMinus = (e) => { const onCountMinus = (e) => {
const index = e.currentTarget.dataset.index const index = e.currentTarget.dataset.index
const scindex = e.currentTarget.dataset.scindex const scindex = e.currentTarget.dataset.scindex
const shopCartItemDiscountsParam = shopCartItemDiscounts.value const shopCartItemDiscountsParam = shopCartItemDiscounts.value
@ -312,22 +284,22 @@ const onCountMinus = (e) => {
if (prodCount > 1) { if (prodCount > 1) {
updateCount(shopCartItemDiscountsParam, scindex, index, -1) updateCount(shopCartItemDiscountsParam, scindex, index, -1)
} }
} }
/** /**
* 增加数量 * 增加数量
*/ */
const onCountPlus = (e) => { const onCountPlus = (e) => {
const index = e.currentTarget.dataset.index const index = e.currentTarget.dataset.index
const scindex = e.currentTarget.dataset.scindex const scindex = e.currentTarget.dataset.scindex
const shopCartItemDiscountsParam = shopCartItemDiscounts.value const shopCartItemDiscountsParam = shopCartItemDiscounts.value
updateCount(shopCartItemDiscountsParam, scindex, index, 1) updateCount(shopCartItemDiscountsParam, scindex, index, 1)
} }
/** /**
* 改变购物车数量接口 * 改变购物车数量接口
*/ */
const updateCount = (shopCartItemDiscountsParam, scindex, index, prodCount) => { const updateCount = (shopCartItemDiscountsParam, scindex, index, prodCount) => {
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
@ -348,12 +320,12 @@ const updateCount = (shopCartItemDiscountsParam, scindex, index, prodCount) => {
uni.hideLoading() uni.hideLoading()
http.getCartCount() // http.getCartCount() //
}) })
} }
/** /**
* 删除购物车商品 * 删除购物车商品
*/ */
const onDelBasket = () => { const onDelBasket = () => {
const shopCartItemDiscountsParam = shopCartItemDiscounts.value const shopCartItemDiscountsParam = shopCartItemDiscounts.value
const basketIds = [] const basketIds = []
for (let i = 0; i < shopCartItemDiscountsParam.length; i++) { for (let i = 0; i < shopCartItemDiscountsParam.length; i++) {
@ -374,7 +346,7 @@ const onDelBasket = () => {
title: '', title: '',
content: '确认要删除选中的商品吗?', content: '确认要删除选中的商品吗?',
confirmColor: '#eb2444', confirmColor: '#eb2444',
success (res) { success(res) {
if (res.confirm) { if (res.confirm) {
uni.showLoading({ uni.showLoading({
mask: true mask: true
@ -393,9 +365,9 @@ const onDelBasket = () => {
}) })
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "./basket.scss"; @import "./basket.scss";
</style> </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> </text>
</view> </view>
<view class="price-nums clearfix"> <view class="price-nums clearfix">
<text class="prodprice">
<text class="prodprice" v-if="item.productType !=2 ">
<text class="symbol"> <text class="symbol">
</text> </text>
@ -61,6 +64,20 @@
.{{ wxs.parsePrice(item.price)[1] }} .{{ wxs.parsePrice(item.price)[1] }}
</text> </text>
</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 class="btn-box" />
</view> </view>
</view> </view>
@ -172,6 +189,14 @@
<view class="item payment"> <view class="item payment">
<view class="item-txt price"> <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 class="symbol">
</text> </text>
@ -234,7 +259,7 @@ const userAddrDto = ref(null)
const orderNumber = ref('') const orderNumber = ref('')
const createTime = ref('') const createTime = ref('')
const total = ref(0) // const total = ref(0) //
/** const totalScore =ref(0)/**
* 加载订单数据 * 加载订单数据
*/ */
const loadOrderDetail = (orderNum) => { const loadOrderDetail = (orderNum) => {
@ -257,6 +282,7 @@ const loadOrderDetail = (orderNum) => {
transfee.value = data.transfee transfee.value = data.transfee
reduceAmount.value = data.reduceAmount reduceAmount.value = data.reduceAmount
total.value = data.total total.value = data.total
totalScore.value = data.actualTotalScore
uni.hideLoading() uni.hideLoading()
}) })
} }

@ -2,18 +2,9 @@
<!-- 商品详情 --> <!-- 商品详情 -->
<view class="container"> <view class="container">
<!-- 轮播图 --> <!-- 轮播图 -->
<swiper <swiper :indicator-dots="indicatorDots" :autoplay="autoplay" :indicator-color="indicatorColor" :interval="interval"
:indicator-dots="indicatorDots" :duration="duration" :indicator-active-color="indicatorActiveColor">
:autoplay="autoplay" <block v-for="(item, index) in imgs" :key="index">
:indicator-color="indicatorColor"
:interval="interval"
:duration="duration"
:indicator-active-color="indicatorActiveColor"
>
<block
v-for="(item, index) in imgs"
:key="index"
>
<swiper-item> <swiper-item>
<image :src="item" /> <image :src="item" />
</swiper-item> </swiper-item>
@ -26,49 +17,42 @@
<view class="prod-tit"> <view class="prod-tit">
{{ prodName }} {{ prodName }}
</view> </view>
<view <view class="col" @tap="addOrCannelCollection">
class="col" <image v-if="!isCollection" src="@/static/images/icon/prod-col.png" />
@tap="addOrCannelCollection" <image v-if="isCollection" src="@/static/images/icon/prod-col-red.png" />
>
<image
v-if="!isCollection"
src="@/static/images/icon/prod-col.png"
/>
<image
v-if="isCollection"
src="@/static/images/icon/prod-col-red.png"
/>
收藏 收藏
</view> </view>
</view> </view>
<view class="sales-p"> <view class="sales-p">
{{ brief }} {{ brief }}
</view> </view>
<view class="prod-price"> <view class="prod-price" v-if="productType ==0 || productType==1">
<text <text v-if="defaultSku && defaultSku.price" class="price">
v-if="defaultSku && defaultSku.price"
class="price"
>
<text class="price-num"> <text class="price-num">
{{ wxs.parsePrice(defaultSku.price)[0] }} {{ wxs.parsePrice(defaultSku.price)[0] }}
</text> </text>
.{{ wxs.parsePrice(defaultSku.price)[1] }} .{{ wxs.parsePrice(defaultSku.price)[1] }}
</text> </text>
<text <text v-if="defaultSku && defaultSku.oriPrice" class="ori-price">
v-if="defaultSku && defaultSku.oriPrice"
class="ori-price"
>
{{ wxs.parsePrice(defaultSku.oriPrice)[0] }}.{{ wxs.parsePrice(defaultSku.oriPrice)[1] }} {{ wxs.parsePrice(defaultSku.oriPrice)[0] }}.{{ wxs.parsePrice(defaultSku.oriPrice)[1] }}
</text> </text>
<text class="sales" /> <text class="sales" />
</view> </view>
<view class="prod-price" v-if="productType ==2">
<text class="price">
<text class="price-num">
{{payScore }}
</text>
积分
</text>
<text class="sales" />
</view>
</view> </view>
<!-- 已选规格 --> <!-- 已选规格 -->
<view <view class="sku" @tap="showSku">
class="sku"
@tap="showSku"
>
<view class="sku-tit"> <view class="sku-tit">
已选 已选
</view> </view>
@ -81,10 +65,7 @@
</view> </view>
<!-- 评价 --> <!-- 评价 -->
<view class="cmt-wrap"> <view class="cmt-wrap">
<view <view class="cmt-tit" @tap="showComment">
class="cmt-tit"
@tap="showComment"
>
<view class="cmt-t"> <view class="cmt-t">
评价 评价
<text class="cmt-good"> <text class="cmt-good">
@ -97,10 +78,7 @@
</view> </view>
</view> </view>
<view class="cmt-cont"> <view class="cmt-cont">
<view <view class="cmt-tag" @tap="showComment">
class="cmt-tag"
@tap="showComment"
>
<text>全部({{ prodCommData.number }})</text> <text>全部({{ prodCommData.number }})</text>
<text>好评({{ prodCommData.praiseNumber }})</text> <text>好评({{ prodCommData.praiseNumber }})</text>
<text>中评({{ prodCommData.secondaryNumber }})</text> <text>中评({{ prodCommData.secondaryNumber }})</text>
@ -108,20 +86,13 @@
<text>有图({{ prodCommData.picNumber }})</text> <text>有图({{ prodCommData.picNumber }})</text>
</view> </view>
<view class="cmt-items"> <view class="cmt-items">
<view <view v-for="(item, index) in littleCommPage" :key="index" class="cmt-item">
v-for="(item, index) in littleCommPage"
:key="index"
class="cmt-item"
>
<view class="cmt-user"> <view class="cmt-user">
<text class="date"> <text class="date">
{{ item.recTime }} {{ item.recTime }}
</text> </text>
<view class="cmt-user-info"> <view class="cmt-user-info">
<image <image class="user-img" :src="item.pic" />
class="user-img"
:src="item.pic"
/>
<view class="nickname"> <view class="nickname">
{{ item.nickName }} {{ item.nickName }}
</view> </view>
@ -130,23 +101,12 @@
<view class="cmt-cnt"> <view class="cmt-cnt">
{{ item.content }} {{ item.content }}
</view> </view>
<scroll-view <scroll-view v-if="item.pics.length" class="cmt-attr" scroll-x="true">
v-if="item.pics.length" <image v-for="(commPic, index2) in item.pics" :key="index2" :src="commPic" />
class="cmt-attr"
scroll-x="true"
>
<image
v-for="(commPic, index2) in item.pics"
:key="index2"
:src="commPic"
/>
</scroll-view> </scroll-view>
</view> </view>
</view> </view>
<view <view v-if="prodCommPage.records.length > 2" class="cmt-more-v">
v-if="prodCommPage.records.length > 2"
class="cmt-more-v"
>
<text @tap="showComment"> <text @tap="showComment">
查看全部评价 查看全部评价
</text> </text>
@ -163,98 +123,62 @@
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="cart-footer"> <view class="cart-footer">
<view <view class="btn icon" @tap="toHomePage">
class="btn icon"
@tap="toHomePage"
>
<image src="@/static/images/tabbar/homepage.png" /> <image src="@/static/images/tabbar/homepage.png" />
首页 首页
</view> </view>
<view <view class="btn icon" @tap="toCartPage">
class="btn icon"
@tap="toCartPage"
>
<image src="@/static/images/tabbar/basket.png" /> <image src="@/static/images/tabbar/basket.png" />
购物车 购物车
<view <view v-if="totalCartNum>0" class="badge badge-1">
v-if="totalCartNum>0"
class="badge badge-1"
>
{{ totalCartNum }} {{ totalCartNum }}
</view> </view>
</view> </view>
<view <view class="btn cart" @tap="showSku">
class="btn cart"
@tap="showSku"
>
<text>加入购物车</text> <text>加入购物车</text>
</view> </view>
<view <view class="btn buy" @tap="showSku">
class="btn buy"
@tap="showSku"
>
<text>立即购买</text> <text>立即购买</text>
</view> </view>
</view> </view>
<!-- end 底部按钮 --> <!-- end 底部按钮 -->
<!-- 规格弹窗 --> <!-- 规格弹窗 -->
<view <view v-if="skuShow" class="pup-sku">
v-if="skuShow"
class="pup-sku"
>
<view class="pup-sku-main"> <view class="pup-sku-main">
<view class="pup-sku-header"> <view class="pup-sku-header">
<image <image class="pup-sku-img" :src="defaultSku.pic?defaultSku.pic:pic" />
class="pup-sku-img" <view class="pup-sku-price" v-if="productType != 2">
:src="defaultSku.pic?defaultSku.pic:pic"
/>
<view class="pup-sku-price">
<text <text v-if="defaultSku && defaultSku.price" class="pup-sku-price-int">
v-if="defaultSku && defaultSku.price"
class="pup-sku-price-int"
>
{{ wxs.parsePrice(defaultSku.price)[0] }} {{ wxs.parsePrice(defaultSku.price)[0] }}
</text> </text>
.{{ wxs.parsePrice(defaultSku.price)[1] }} .{{ wxs.parsePrice(defaultSku.price)[1] }}
</view> </view>
<view class="pup-sku-price" v-if="productType == 2">
<text v-if="defaultSku && defaultSku.price" class="pup-sku-price-int">
{{payScore}}
</text>
积分
</view>
<view class="pup-sku-prop"> <view class="pup-sku-prop">
<text>已选</text> <text>已选</text>
{{ selectedProp.length > 0 ? selectedProp + '' : '' }}{{ prodNum }} {{ selectedProp.length > 0 ? selectedProp + '' : '' }}{{ prodNum }}
</view> </view>
<view <view class="close" @tap="closePopup" />
class="close"
@tap="closePopup"
/>
</view> </view>
<view class="pup-sku-body"> <view class="pup-sku-body">
<view class="pup-sku-area"> <view class="pup-sku-area">
<view <view v-if="skuList.length" class="sku-box">
v-if="skuList.length" <block v-for="(skuGroupItem, skuGroupItemIndex) in skuGroupList" :key="skuGroupItemIndex">
class="sku-box" <view v-for="(skuLine, key) in skuGroupItem" :key="key" class="items sku-text">
>
<block
v-for="(skuGroupItem, skuGroupItemIndex) in skuGroupList"
:key="skuGroupItemIndex"
>
<view
v-for="(skuLine, key) in skuGroupItem"
:key="key"
class="items sku-text"
>
<text class="sku-kind"> <text class="sku-kind">
{{ key }} {{ key }}
</text> </text>
<view class="con"> <view class="con">
<text <text v-for="skuLineItem in skuLine" :key="skuLineItem" class="sku-choose-item"
v-for="skuLineItem in skuLine"
:key="skuLineItem"
class="sku-choose-item"
:class="[selectedPropList.indexOf(key + ':' + skuLineItem) !== -1?'active':'', :class="[selectedPropList.indexOf(key + ':' + skuLineItem) !== -1?'active':'',
isSkuLineItemNotOptional(allProperties,selectedPropObj,key,skuLineItem,propKeys)? 'dashed' : '']" isSkuLineItemNotOptional(allProperties,selectedPropObj,key,skuLineItem,propKeys)? 'dashed' : '']" @click="toChooseItem(skuGroupItemIndex, skuLineItem, key)">
@click="toChooseItem(skuGroupItemIndex, skuLineItem, key)"
>
{{ skuLineItem }} {{ skuLineItem }}
</text> </text>
</view> </view>
@ -264,23 +188,13 @@
</view> </view>
<view class="pup-sku-count"> <view class="pup-sku-count">
<view class="num-wrap"> <view class="num-wrap">
<view <view class="minus" @tap="onCountMinus">
class="minus"
@tap="onCountMinus"
>
<text class="row" /> <text class="row" />
</view> </view>
<view class="text-wrap"> <view class="text-wrap">
<input <input type="number" :value="prodNum" disabled>
type="number" </view>
:value="prodNum" <view class="plus" @tap="onCountPlus">
disabled
>
</view>
<view
class="plus"
@tap="onCountPlus"
>
<text class="row" /> <text class="row" />
<text class="col" /> <text class="col" />
</view> </view>
@ -291,16 +205,10 @@
</view> </view>
</view> </view>
<view class="pup-sku-footer"> <view class="pup-sku-footer">
<view <view class="btn cart" @tap="addToCart">
class="btn cart"
@tap="addToCart"
>
加入购物车 加入购物车
</view> </view>
<view <view class="btn buy" @tap="buyNow">
class="btn buy"
@tap="buyNow"
>
立即购买 立即购买
</view> </view>
</view> </view>
@ -308,10 +216,7 @@
</view> </view>
<!-- 评价弹窗 --> <!-- 评价弹窗 -->
<view <view v-if="commentShow" class="cmt-popup">
v-if="commentShow"
class="cmt-popup"
>
<view class="cmt-tit"> <view class="cmt-tit">
<view class="cmt-t"> <view class="cmt-t">
商品评价 商品评价
@ -319,65 +224,35 @@
好评度{{ prodCommData.positiveRating }}% 好评度{{ prodCommData.positiveRating }}%
</text> </text>
</view> </view>
<text <text class="close" @tap="closePopup" />
class="close"
@tap="closePopup"
/>
</view> </view>
<view class="cmt-cont"> <view class="cmt-cont">
<view class="cmt-tag"> <view class="cmt-tag">
<text <text data-evaluate="-1" :class="evaluate==-1?'selected':''" @tap="getProdCommPage">
data-evaluate="-1"
:class="evaluate==-1?'selected':''"
@tap="getProdCommPage"
>
全部({{ prodCommData.number }}) 全部({{ prodCommData.number }})
</text> </text>
<text <text data-evaluate="0" :class="evaluate==0?'selected':''" @tap="getProdCommPage">
data-evaluate="0"
:class="evaluate==0?'selected':''"
@tap="getProdCommPage"
>
好评({{ prodCommData.praiseNumber }}) 好评({{ prodCommData.praiseNumber }})
</text> </text>
<text <text data-evaluate="1" :class="evaluate==1?'selected':''" @tap="getProdCommPage">
data-evaluate="1"
:class="evaluate==1?'selected':''"
@tap="getProdCommPage"
>
中评({{ prodCommData.secondaryNumber }}) 中评({{ prodCommData.secondaryNumber }})
</text> </text>
<text <text data-evaluate="2" :class="evaluate==2?'selected':''" @tap="getProdCommPage">
data-evaluate="2"
:class="evaluate==2?'selected':''"
@tap="getProdCommPage"
>
差评({{ prodCommData.negativeNumber }}) 差评({{ prodCommData.negativeNumber }})
</text> </text>
<text <text data-evaluate="3" :class="evaluate==3?'selected':''" @tap="getProdCommPage">
data-evaluate="3"
:class="evaluate==3?'selected':''"
@tap="getProdCommPage"
>
有图({{ prodCommData.picNumber }}) 有图({{ prodCommData.picNumber }})
</text> </text>
</view> </view>
<view class="cmt-items"> <view class="cmt-items">
<block v-if="prodCommPage.records.length"> <block v-if="prodCommPage.records.length">
<view <view v-for="(item, index) in prodCommPage.records" :key="index" class="cmt-item">
v-for="(item, index) in prodCommPage.records"
:key="index"
class="cmt-item"
>
<view class="cmt-user"> <view class="cmt-user">
<text class="date"> <text class="date">
{{ item.recTime }} {{ item.recTime }}
</text> </text>
<view class="cmt-user-info"> <view class="cmt-user-info">
<image <image class="user-img" :src="item.pic" />
class="user-img"
:src="item.pic"
/>
<view class="nickname"> <view class="nickname">
{{ item.nickName }} {{ item.nickName }}
</view> </view>
@ -386,21 +261,10 @@
<view class="cmt-cnt"> <view class="cmt-cnt">
{{ item.content }} {{ item.content }}
</view> </view>
<scroll-view <scroll-view v-if="item.pics.length" class="cmt-attr" scroll-x="true">
v-if="item.pics.length" <image v-for="(commPic, index2) in item.pics" :key="index2" :src="commPic" />
class="cmt-attr"
scroll-x="true"
>
<image
v-for="(commPic, index2) in item.pics"
:key="index2"
:src="commPic"
/>
</scroll-view> </scroll-view>
<view <view v-if="item.replyContent" class="cmt-reply">
v-if="item.replyContent"
class="cmt-reply"
>
<text class="reply-tit"> <text class="reply-tit">
店铺回复 店铺回复
</text> </text>
@ -408,17 +272,11 @@
</view> </view>
</view> </view>
</block> </block>
<view <view v-if="!prodCommPage.records.length" class="empty">
v-if="!prodCommPage.records.length"
class="empty"
>
暂无评价 暂无评价
</view> </view>
</view> </view>
<view <view v-if="prodCommPage.pages > prodCommPage.current" class="load-more">
v-if="prodCommPage.pages > prodCommPage.current"
class="load-more"
>
<text @tap="getMoreCommPage"> <text @tap="getMoreCommPage">
点击加载更多 点击加载更多
</text> </text>
@ -429,51 +287,51 @@
</template> </template>
<script setup> <script setup>
const wxs = number() const wxs = number()
const indicatorDots = ref(true) const indicatorDots = ref(true)
const indicatorColor = ref('#f2f2f2') const indicatorColor = ref('#f2f2f2')
const indicatorActiveColor = ref('#eb2444') const indicatorActiveColor = ref('#eb2444')
const autoplay = ref(true) const autoplay = ref(true)
const interval = ref(3000) const interval = ref(3000)
const duration = ref(1000) const duration = ref(1000)
const selectedProp = ref([]) const selectedProp = ref([])
let prodId = 0 let prodId = 0
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad((options) => { onLoad((options) => {
prodId = options.prodid// prodId = options.prodid //
getProdInfo() // getProdInfo() //
getProdCommData() // getProdCommData() //
getLittleProdComm() // getLittleProdComm() //
getCollection() getCollection()
}) })
const app = getApp() const app = getApp()
const totalCartNum = ref(0) const totalCartNum = ref(0)
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow(() => { onShow(() => {
totalCartNum.value = app.globalData.totalCartCount totalCartNum.value = app.globalData.totalCartCount
}) })
/** /**
* 分享设置 * 分享设置
*/ */
onShareAppMessage(() => { onShareAppMessage(() => {
return { return {
title: prodName.value, title: prodName.value,
path: '/pages/prod/prod?prodid=' + prodId path: '/pages/prod/prod?prodid=' + prodId
} }
}) })
const isCollection = ref(false) const isCollection = ref(false)
/** /**
* 获取是否关注信息 * 获取是否关注信息
*/ */
const getCollection = () => { const getCollection = () => {
uni.showLoading() uni.showLoading()
http.request({ http.request({
url: '/p/user/collection/isCollection', url: '/p/user/collection/isCollection',
@ -482,16 +340,18 @@ const getCollection = () => {
prodId prodId
} }
}) })
.then(({ data }) => { .then(({
data
}) => {
isCollection.value = data isCollection.value = data
uni.hideLoading() uni.hideLoading()
}) })
} }
/** /**
* 添加或者取消收藏商品 * 添加或者取消收藏商品
*/ */
const addOrCannelCollection = () => { const addOrCannelCollection = () => {
uni.showLoading() uni.showLoading()
http.request({ http.request({
url: '/p/user/collection/addOrCancel', url: '/p/user/collection/addOrCancel',
@ -502,20 +362,23 @@ const addOrCannelCollection = () => {
isCollection.value = !isCollection.value isCollection.value = !isCollection.value
uni.hideLoading() uni.hideLoading()
}) })
} }
const skuList = ref([]) const skuList = ref([])
const brief = ref('') const brief = ref('')
const prodNum = ref(1) const prodNum = ref(1)
const pic = ref('') const pic = ref('')
const imgs = ref('') const imgs = ref('')
const prodName = ref('') const prodName = ref('')
const price = ref(0) const price = ref(0)
const content = ref('') const content = ref('')
/** let payScore = 1000
let giveScore = 0
const productType = ref(0)
/**
* 获取商品信息 * 获取商品信息
*/ */
const getProdInfo = () => { const getProdInfo = () => {
uni.showLoading() uni.showLoading()
http.request({ http.request({
url: '/prod/prodInfo', url: '/prod/prodInfo',
@ -524,7 +387,9 @@ const getProdInfo = () => {
prodId // userType: 0 prodId // userType: 0
} }
}) })
.then(({ data }) => { .then(({
data
}) => {
uni.hideLoading() uni.hideLoading()
if (!data) { if (!data) {
setTimeout(() => { setTimeout(() => {
@ -540,14 +405,17 @@ const getProdInfo = () => {
brief.value = data.brief brief.value = data.brief
skuList.value = data.skuList skuList.value = data.skuList
pic.value = data.pic pic.value = data.pic
productType.value = data.productType
payScore = data.payScore
giveScore = data.giveScore
// sku // sku
groupSkuProp(data.skuList, data.price) groupSkuProp(data.skuList, data.price)
uni.hideLoading() uni.hideLoading()
}) })
} }
const prodCommData = ref({}) const prodCommData = ref({})
const getProdCommData = () => { const getProdCommData = () => {
http.request({ http.request({
url: '/prodComm/prodCommData', url: '/prodComm/prodCommData',
method: 'GET', method: 'GET',
@ -555,36 +423,38 @@ const getProdCommData = () => {
prodId prodId
} }
}) })
.then(({ data }) => { .then(({
data
}) => {
prodCommData.value = data prodCommData.value = data
}) })
} }
const prodCommPage = ref({ const prodCommPage = ref({
current: 0, current: 0,
pages: 0, pages: 0,
records: [] records: []
}) })
/** /**
* 获取部分评论 * 获取部分评论
*/ */
const getLittleProdComm = () => { const getLittleProdComm = () => {
if (prodCommPage.value.records.length) { if (prodCommPage.value.records.length) {
return return
} }
getProdCommPage() getProdCommPage()
} }
const getMoreCommPage = () => { const getMoreCommPage = () => {
getProdCommPage() getProdCommPage()
} }
const littleCommPage = ref([]) const littleCommPage = ref([])
const evaluate = ref(-1) const evaluate = ref(-1)
/** /**
* 获取分页获取评论 * 获取分页获取评论
*/ */
const getProdCommPage = (e) => { const getProdCommPage = (e) => {
if (e) { if (e) {
if (e.currentTarget.dataset.evaluate === evaluate.value) { if (e.currentTarget.dataset.evaluate === evaluate.value) {
return return
@ -607,7 +477,9 @@ const getProdCommPage = (e) => {
evaluate: evaluate.value evaluate: evaluate.value
} }
}) })
.then(({ data }) => { .then(({
data
}) => {
data.records.forEach(item => { data.records.forEach(item => {
if (item.pics) { if (item.pics) {
item.pics = item.pics.split(',') item.pics = item.pics.split(',')
@ -625,19 +497,19 @@ const getProdCommPage = (e) => {
littleCommPage.value = records.slice(0, 2) littleCommPage.value = records.slice(0, 2)
} }
}) })
} }
let selectedPropObjList = null let selectedPropObjList = null
const skuGroup = ref({}) const skuGroup = ref({})
const defaultSku = ref(null) const defaultSku = ref(null)
const selectedPropObj = ref({}) const selectedPropObj = ref({})
const propKeys = ref([]) const propKeys = ref([])
const allProperties = ref([]) const allProperties = ref([])
const findSku = ref(true) const findSku = ref(true)
const skuGroupList = ref([]) const skuGroupList = ref([])
/** /**
* 组装SKU * 组装SKU
*/ */
const groupSkuProp = (skuList, defaultPrice) => { const groupSkuProp = (skuList, defaultPrice) => {
if (skuList.length === 1 && !skuList[0].properties) { if (skuList.length === 1 && !skuList[0].properties) {
defaultSku.value = skuList[0] defaultSku.value = skuList[0]
findSku.value = true findSku.value = true
@ -693,13 +565,13 @@ const groupSkuProp = (skuList, defaultPrice) => {
skuGroupList.value = unique(_skuGroupList) skuGroupList.value = unique(_skuGroupList)
allProperties.value = _allProperties allProperties.value = _allProperties
parseSelectedObjToVals(skuList) parseSelectedObjToVals(skuList)
} }
const selectedPropList = ref(null) const selectedPropList = ref(null)
/** /**
* 将已选的 {key:val,key2:val2}转换成 [val,val2] * 将已选的 {key:val,key2:val2}转换成 [val,val2]
*/ */
const parseSelectedObjToVals = (skuList) => { const parseSelectedObjToVals = (skuList) => {
const selectedPropObjListParam = selectedPropObjList const selectedPropObjListParam = selectedPropObjList
let selectedPropertiesParam = '' let selectedPropertiesParam = ''
const selectedPropListParam = [] const selectedPropListParam = []
@ -726,12 +598,12 @@ const parseSelectedObjToVals = (skuList) => {
} }
} }
findSku.value = findSkuParam findSku.value = findSkuParam
} }
/** /**
* 判断当前的规格值 是否可以选 * 判断当前的规格值 是否可以选
*/ */
const isSkuLineItemNotOptional = (allProperties, selectedPropObjParam, key, item, propKeys) => { const isSkuLineItemNotOptional = (allProperties, selectedPropObjParam, key, item, propKeys) => {
const selectedPropObj = Object.assign({}, selectedPropObjParam) const selectedPropObj = Object.assign({}, selectedPropObjParam)
let properties = '' let properties = ''
selectedPropObj[key] = item selectedPropObj[key] = item
@ -750,21 +622,21 @@ const isSkuLineItemNotOptional = (allProperties, selectedPropObjParam, key, item
} }
} }
return false return false
} }
/** /**
* 规格点击事件 * 规格点击事件
*/ */
const toChooseItem = (skuGroupItemIndex, skuLineItem, key) => { const toChooseItem = (skuGroupItemIndex, skuLineItem, key) => {
selectedPropObjList[skuGroupItemIndex][key] = skuLineItem selectedPropObjList[skuGroupItemIndex][key] = skuLineItem
selectedPropObj.value[key] = skuLineItem selectedPropObj.value[key] = skuLineItem
parseSelectedObjToVals(skuList.value) parseSelectedObjToVals(skuList.value)
} }
/** /**
* 去重 * 去重
*/ */
const unique = (arr) => { const unique = (arr) => {
const map = {} const map = {}
arr.forEach(item => { arr.forEach(item => {
const obj = {} const obj = {}
@ -772,31 +644,31 @@ const unique = (arr) => {
map[JSON.stringify(obj)] = item map[JSON.stringify(obj)] = item
}) })
return Object.keys(map).map(key => JSON.parse(key)) return Object.keys(map).map(key => JSON.parse(key))
} }
/** /**
* 跳转到首页 * 跳转到首页
*/ */
const toHomePage = () => { const toHomePage = () => {
uni.switchTab({ uni.switchTab({
url: '/pages/index/index' url: '/pages/index/index'
}) })
} }
/** /**
* 跳转到购物车 * 跳转到购物车
*/ */
const toCartPage = () => { const toCartPage = () => {
uni.switchTab({ uni.switchTab({
url: '/pages/basket/basket' url: '/pages/basket/basket'
}) })
} }
const shopId = 1 const shopId = 1
/** /**
* 加入购物车 * 加入购物车
*/ */
const addToCart = () => { const addToCart = () => {
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
@ -819,12 +691,12 @@ const addToCart = () => {
icon: 'none' icon: 'none'
}) })
}) })
} }
/** /**
* 立即购买 * 立即购买
*/ */
const buyNow = () => { const buyNow = () => {
uni.setStorageSync('orderItem', JSON.stringify({ uni.setStorageSync('orderItem', JSON.stringify({
prodId, prodId,
skuId: defaultSku.value.skuId, skuId: defaultSku.value.skuId,
@ -834,42 +706,42 @@ const buyNow = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/submit-order/submit-order?orderEntry=1' url: '/pages/submit-order/submit-order?orderEntry=1'
}) })
} }
/** /**
* 减数量 * 减数量
*/ */
const onCountMinus = () => { const onCountMinus = () => {
if (prodNum.value > 1) { if (prodNum.value > 1) {
prodNum.value = prodNum.value - 1 prodNum.value = prodNum.value - 1
} }
} }
/** /**
* 加数量 * 加数量
*/ */
const onCountPlus = () => { const onCountPlus = () => {
if (prodNum.value < 1000) { if (prodNum.value < 1000) {
prodNum.value = prodNum.value + 1 prodNum.value = prodNum.value + 1
} }
} }
const skuShow = ref(false) const skuShow = ref(false)
const showSku = () => { const showSku = () => {
skuShow.value = true skuShow.value = true
} }
const commentShow = ref(false) const commentShow = ref(false)
const showComment = () => { const showComment = () => {
commentShow.value = true commentShow.value = true
} }
const closePopup = () => { const closePopup = () => {
skuShow.value = false skuShow.value = false
commentShow.value = false commentShow.value = false
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@use './prod.scss'; @use './prod.scss';
</style> </style>

@ -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 { .container {
background: #f4f4f4; 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 { .category-tit {
width: 100%; width: 100%;
white-space: nowrap; white-space: nowrap;

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

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

@ -1,21 +1,16 @@
<template> <template>
<view class="container"> <view class="container">
<!-- 用户信息 --> <!-- 用户信息 -->
<view <view v-if="isAuthInfo" class="userinfo">
v-if="isAuthInfo"
class="userinfo"
>
<view class="userinfo-con"> <view class="userinfo-con">
<view class="userinfo-avatar"> <view class="userinfo-avatar">
<image <image :src="
:src="
loginResult.pic loginResult.pic
? ?
(loginResult.pic.indexOf('http') === -1 ? picDomain + loginResult.pic : loginResult.pic) (loginResult.pic.indexOf('http') === -1 ? picDomain + loginResult.pic : loginResult.pic)
: :
'/static/images/icon/head04.png' '/static/images/icon/head04.png'
" " />
/>
</view> </view>
<view class="userinfo-name"> <view class="userinfo-name">
<view>{{ loginResult.nickName ? loginResult.nickName : "用户昵称" }}</view> <view>{{ loginResult.nickName ? loginResult.nickName : "用户昵称" }}</view>
@ -23,20 +18,11 @@
</view> </view>
</view> </view>
<view <view v-if="!isAuthInfo" class="userinfo-none">
v-if="!isAuthInfo" <view class="default-pic" @tap="toLogin">
class="userinfo-none"
>
<view
class="default-pic"
@tap="toLogin"
>
<image src="@/static/images/icon/head04.png" /> <image src="@/static/images/icon/head04.png" />
</view> </view>
<view <view class="none-login" @tap="toLogin">
class="none-login"
@tap="toLogin"
>
<button class="unlogin"> <button class="unlogin">
未登录 未登录
</button> </button>
@ -54,63 +40,34 @@
<text style="font-weight:bold"> <text style="font-weight:bold">
我的订单 我的订单
</text> </text>
<view <view class="checkmore" data-sts="0" @tap="toOrderListPage">
class="checkmore"
data-sts="0"
@tap="toOrderListPage"
>
<text>查看全部</text> <text>查看全部</text>
<text class="arrowhead" /> <text class="arrowhead" />
</view> </view>
</view> </view>
<view class="procedure"> <view class="procedure">
<view <view class="items" data-sts="1" @tap="toOrderListPage">
class="items"
data-sts="1"
@tap="toOrderListPage"
>
<image src="@/static/images/icon/toPay.png" /> <image src="@/static/images/icon/toPay.png" />
<text>待支付</text> <text>待支付</text>
<text <text v-if="orderAmount.unPay>0" class="num-badge">
v-if="orderAmount.unPay>0"
class="num-badge"
>
{{ orderAmount.unPay }} {{ orderAmount.unPay }}
</text> </text>
</view> </view>
<view <view class="items" data-sts="2" @tap="toOrderListPage">
class="items"
data-sts="2"
@tap="toOrderListPage"
>
<image src="@/static/images/icon/toDelivery.png" /> <image src="@/static/images/icon/toDelivery.png" />
<text>待发货</text> <text>待发货</text>
<text <text v-if="orderAmount.payed>0" class="num-badge">
v-if="orderAmount.payed>0"
class="num-badge"
>
{{ orderAmount.payed }} {{ orderAmount.payed }}
</text> </text>
</view> </view>
<view <view class="items" data-sts="3" @tap="toOrderListPage">
class="items"
data-sts="3"
@tap="toOrderListPage"
>
<image src="@/static/images/icon/toTake.png" /> <image src="@/static/images/icon/toTake.png" />
<text>待收货</text> <text>待收货</text>
<text <text v-if="orderAmount.consignment>0" class="num-badge">
v-if="orderAmount.consignment>0"
class="num-badge"
>
{{ orderAmount.consignment }} {{ orderAmount.consignment }}
</text> </text>
</view> </view>
<view <view class="items" data-sts="5" @tap="toOrderListPage">
class="items"
data-sts="5"
@tap="toOrderListPage"
>
<image src="@/static/images/icon/toComment.png" /> <image src="@/static/images/icon/toComment.png" />
<text>已完成</text> <text>已完成</text>
</view> </view>
@ -119,60 +76,33 @@
<!--end 订单状态 --> <!--end 订单状态 -->
<view class="prod-col"> <view class="prod-col">
<view <view class="col-item" @tap="myCollectionHandle">
class="col-item" <view v-if="loginResult" class="num">
@tap="myCollectionHandle"
>
<view
v-if="loginResult"
class="num"
>
{{ collectionCount }} {{ collectionCount }}
</view> </view>
<view <view v-else class="num">
v-else
class="num"
>
-- --
</view> </view>
<view class="tit"> <view class="tit">
我的收藏 我的收藏
</view> </view>
</view> </view>
<view <view class="col-item" @tap="handleTips">
class="col-item" <view v-if="loginResult" class="num">
@tap="handleTips"
>
<view
v-if="loginResult"
class="num"
>
5 5
</view> </view>
<view <view v-else class="num">
v-else
class="num"
>
-- --
</view> </view>
<view class="tit"> <view class="tit">
我的消息 我的消息
</view> </view>
</view> </view>
<view <view class="col-item" @tap="handleTips">
class="col-item" <view v-if="loginResult" class="num">
@tap="handleTips"
>
<view
v-if="loginResult"
class="num"
>
3 3
</view> </view>
<view <view v-else class="num">
v-else
class="num"
>
-- --
</view> </view>
<view class="tit"> <view class="tit">
@ -182,40 +112,49 @@
</view> </view>
<view class="my-menu"> <view class="my-menu">
<view <view class="memu-item" @tap="toMemberInfoPage">
class="memu-item" <view class="i-name">
@tap="toDistCenter" <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"> <view class="i-name">
<image src="@/static/images/icon/promotion.png" /> <image src="@/static/images/icon/promotion.png" />
<text>分销中心</text> <text>分销中心</text>
</view> </view>
<view class="arrowhead" /> <view class="arrowhead" />
</view> </view>
<view <view class="memu-item" @tap="toCouponCenter">
class="memu-item"
@tap="toCouponCenter"
>
<view class="i-name"> <view class="i-name">
<image src="@/static/images/icon/getCoupon.png" /> <image src="@/static/images/icon/getCoupon.png" />
<text>领券中心</text> <text>领券中心</text>
</view> </view>
<view class="arrowhead" /> <view class="arrowhead" />
</view> </view>
<view <view class="memu-item" @tap="toMyCouponPage">
class="memu-item"
@tap="toMyCouponPage"
>
<view class="i-name"> <view class="i-name">
<image src="@/static/images/icon/myCoupon.png" /> <image src="@/static/images/icon/myCoupon.png" />
<text>我的优惠券</text> <text>我的优惠券</text>
</view> </view>
<view class="arrowhead" /> <view class="arrowhead" />
</view> </view>
<view <view class="memu-item" @tap="toAddressList">
class="memu-item"
@tap="toAddressList"
>
<view class="i-name"> <view class="i-name">
<image src="@/static/images/icon/myAddr.png" /> <image src="@/static/images/icon/myAddr.png" />
<text>收货地址</text> <text>收货地址</text>
@ -225,11 +164,7 @@
</view> </view>
<!--end 列表项 --> <!--end 列表项 -->
<view <view v-if="isAuthInfo" class="log-out" @tap="logout">
v-if="isAuthInfo"
class="log-out"
@tap="logout"
>
<view class="log-out-n"> <view class="log-out-n">
<text>退出登录</text> <text>退出登录</text>
</view> </view>
@ -239,15 +174,15 @@
</template> </template>
<script setup> <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 isAuthInfo = ref(false)
const loginResult = ref('') const loginResult = ref('')
const orderAmount = ref('') const orderAmount = ref('')
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow(() => { onShow(() => {
loginResult.value = uni.getStorageSync('loginResult') loginResult.value = uni.getStorageSync('loginResult')
isAuthInfo.value = !!loginResult.value isAuthInfo.value = !!loginResult.value
// //
@ -258,72 +193,93 @@ onShow(() => {
method: 'GET', method: 'GET',
data: {} data: {}
}) })
.then(({ data }) => { .then(({
data
}) => {
uni.hideLoading() uni.hideLoading()
orderAmount.value = data orderAmount.value = data
}) })
showCollectionCount() showCollectionCount()
} }
}) })
const toMemberInfoPage = () => {
const toDistCenter = () => { 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({ uni.showToast({
icon: 'none', icon: 'none',
title: '该功能未开源' title: '该功能未开源'
}) })
} }
const toCouponCenter = () => { const toCouponCenter = () => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '该功能未开源' title: '该功能未开源'
}) })
} }
const toMyCouponPage = () => { const toMyCouponPage = () => {
uni.showToast({ /* uni.showToast({
icon: 'none', icon: 'none',
title: '该功能未开源' title: '该功能未开源'
}) */
uni.navigateTo({
url: '/pages/delivery-address/delivery-address'
}) })
} }
const handleTips = () => { const handleTips = () => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '该功能未开源' title: '该功能未开源'
}) })
} }
const toAddressList = () => { const toAddressList = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/delivery-address/delivery-address' url: '/pages/delivery-address/delivery-address'
}) })
} }
const toOrderListPage = (e) => { const toOrderListPage = (e) => {
const sts = e.currentTarget.dataset.sts const sts = e.currentTarget.dataset.sts
uni.navigateTo({ uni.navigateTo({
url: '/pages/orderList/orderList?sts=' + sts url: '/pages/orderList/orderList?sts=' + sts
}) })
} }
const collectionCount = ref(0) const collectionCount = ref(0)
/** /**
* 查询所有的收藏量 * 查询所有的收藏量
*/ */
const showCollectionCount = () => { const showCollectionCount = () => {
uni.showLoading() uni.showLoading()
http.request({ http.request({
url: '/p/user/collection/count', url: '/p/user/collection/count',
method: 'GET', method: 'GET',
data: {} data: {}
}) })
.then(({ data }) => { .then(({
data
}) => {
uni.hideLoading() uni.hideLoading()
collectionCount.value = data collectionCount.value = data
}) })
} }
/** /**
* 我的收藏跳转 * 我的收藏跳转
*/ */
const myCollectionHandle = () => { const myCollectionHandle = () => {
let url = '/pages/prod-classify/prod-classify?sts=5' let url = '/pages/prod-classify/prod-classify?sts=5'
const id = 0 const id = 0
const title = '我的收藏商品' const title = '我的收藏商品'
@ -333,21 +289,21 @@ const myCollectionHandle = () => {
uni.navigateTo({ uni.navigateTo({
url url
}) })
} }
/** /**
* 去登陆 * 去登陆
*/ */
const toLogin = () => { const toLogin = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/accountLogin/accountLogin' url: '/pages/accountLogin/accountLogin'
}) })
} }
/** /**
* 退出登录 * 退出登录
*/ */
const logout = () => { const logout = () => {
http.request({ http.request({
url: '/logOut', url: '/logOut',
method: 'post' method: 'post'
@ -367,9 +323,9 @@ const logout = () => {
}) })
}, 1000) }, 1000)
}) })
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@use './user.scss'; @use './user.scss';
</style> </style>

Loading…
Cancel
Save