v1.0
This commit is contained in:
101
components/activity/activity.vue
Normal file
101
components/activity/activity.vue
Normal file
@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<container>
|
||||
<view class="activity">
|
||||
<view class="activity-header">
|
||||
<view class="activity-header-info">
|
||||
<view class="activity-header-title">
|
||||
{{ title }}
|
||||
</view>
|
||||
<view class="activity-header-subtitle">
|
||||
{{ subtitle }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="activity-header-more"
|
||||
@tap="handleMoreClick"
|
||||
>
|
||||
<view class="activity-header-more-info">{{ more }}</view>
|
||||
<img
|
||||
class="image"
|
||||
src="@/static/images/next.png"
|
||||
alt=""
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="activity-body">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
</container>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
const props = defineProps(["title", "subtitle", 'more'])
|
||||
|
||||
const title = ref(props.title)
|
||||
const subtitle = ref(props.subtitle)
|
||||
const more = ref(props.more)
|
||||
|
||||
const emit = defineEmits(['moreClick'])
|
||||
|
||||
const handleMoreClick = () => {
|
||||
emit('moreClick')
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.activity {
|
||||
|
||||
&-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
&-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
&-title {
|
||||
line-height: 45rpx;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
&-subtitle {
|
||||
margin-left: 10rpx;
|
||||
|
||||
line-height: 33rpx;
|
||||
font-size: 24rpx;
|
||||
color: #EE6D46;
|
||||
}
|
||||
|
||||
&-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
|
||||
&-info {
|
||||
line-height: 33rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.image {
|
||||
margin-left: 10rpx;
|
||||
display: block;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&-body {}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
15
components/blank/blank.vue
Normal file
15
components/blank/blank.vue
Normal file
@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<view
|
||||
class="blank"
|
||||
:style="{ height: size + 'px' }"
|
||||
></view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
const props = defineProps(['size'])
|
||||
const size = ref(props.size)
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
</style>
|
50
components/buyProgress/buyProgress.vue
Normal file
50
components/buyProgress/buyProgress.vue
Normal file
@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<view class="buy-progress">
|
||||
<space align="center">
|
||||
<view class="buy-progress-info">
|
||||
<view
|
||||
class="buy-progress-info-desc"
|
||||
v-if="surplus"
|
||||
>
|
||||
仅剩{{ surplus }}件
|
||||
</view>
|
||||
</view>
|
||||
<view class="buy-progress-action">
|
||||
<uv-button
|
||||
round
|
||||
block
|
||||
type="primary"
|
||||
>
|
||||
立即抢购
|
||||
</uv-button>
|
||||
</view>
|
||||
</space>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "buyProgress",
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.buy-progress {
|
||||
&-info {
|
||||
flex: 1;
|
||||
|
||||
&-desc {
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&-action {}
|
||||
}
|
||||
</style>
|
26
components/card/card.vue
Normal file
26
components/card/card.vue
Normal file
@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<view
|
||||
:class="['card', props.class]"
|
||||
:style="{ width: width ? width + 'rpx' : '100%' }"
|
||||
>
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
const props = defineProps(['class', 'width'])
|
||||
console.log("gxs --> % props:\n", props)
|
||||
const className = ref(props.class)
|
||||
const width = ref(props.width)
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.card {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-radius: 7.5rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
397
components/city-select/city-select.vue
Normal file
397
components/city-select/city-select.vue
Normal file
@ -0,0 +1,397 @@
|
||||
<template>
|
||||
<view>
|
||||
<text
|
||||
class="uni-input"
|
||||
@tap="open"
|
||||
>{{ value }}</text>
|
||||
<uv-popup
|
||||
ref="popup"
|
||||
mode="bottom"
|
||||
>
|
||||
<view class="cityselect">
|
||||
<view class="cityselect-header">
|
||||
<view class="cityselect-title">
|
||||
<text>请选择地址</text>
|
||||
</view>
|
||||
<view class="cityselect-nav">
|
||||
<view
|
||||
class="item"
|
||||
v-if="provinceActive"
|
||||
@tap="changeNav(0)"
|
||||
>
|
||||
<text>{{ provinceActive.name }}</text>
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
v-if="cityActive"
|
||||
@tap="changeNav(1)"
|
||||
>
|
||||
<text>{{ cityActive.name }}</text>
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
v-if="districtActive"
|
||||
@tap="changeNav(2)"
|
||||
>
|
||||
<text>{{ districtActive.name }}</text>
|
||||
</view>
|
||||
<view
|
||||
class="item active"
|
||||
v-else
|
||||
>
|
||||
<text>请选择</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cityselect-content">
|
||||
<swiper
|
||||
class="swiper"
|
||||
disable-touch="true"
|
||||
touchable="false"
|
||||
:current="current"
|
||||
>
|
||||
<swiper-item>
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="cityScroll"
|
||||
>
|
||||
<view>
|
||||
<view
|
||||
class="cityselect-item"
|
||||
v-for="(item, index) in province"
|
||||
:key="index"
|
||||
@tap="selectProvince(item, index)"
|
||||
>
|
||||
<view
|
||||
class="cityselect-item-box"
|
||||
:class="{ active: isProvinceActive(item) }"
|
||||
>
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="cityScroll"
|
||||
>
|
||||
<view>
|
||||
<view
|
||||
class="cityselect-item"
|
||||
v-for="(item, index) in city"
|
||||
:key="index"
|
||||
@tap="selectCity(item, index)"
|
||||
>
|
||||
<view
|
||||
class="cityselect-item-box"
|
||||
:class="{ active: isCityActive(item) }"
|
||||
>
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="cityScroll"
|
||||
>
|
||||
<view>
|
||||
<view
|
||||
class="cityselect-item"
|
||||
v-for="(item, index) in district"
|
||||
:key="index"
|
||||
@tap="selectDistrict(item, index)"
|
||||
>
|
||||
<view
|
||||
class="cityselect-item-box"
|
||||
:class="{ active: isDistrictActive(item) }"
|
||||
>
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
</uv-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import { ref, watch,onMounted } from "vue"
|
||||
const props = defineProps(['items', 'defaultValue'])
|
||||
|
||||
const emit = defineEmits(['callback'])
|
||||
|
||||
|
||||
const items = ref(props.items || [])
|
||||
// const defaultValue = ref(props.defaultValue)
|
||||
// console.log("--> % defaultValue:\n", defaultValue)
|
||||
|
||||
const value = ref(props.value || '请选择')
|
||||
const province = ref(props.items)
|
||||
const provinceActive = ref(null)
|
||||
const city = ref([])
|
||||
const cityActive = ref(null)
|
||||
const district = ref([])
|
||||
const districtActive = ref(null)
|
||||
const current = ref(0)
|
||||
const popup = ref(null)
|
||||
|
||||
|
||||
watch(() => props.items, (next) => {
|
||||
province.value = next
|
||||
})
|
||||
|
||||
watch(() => props.defaultValue, (next) => {
|
||||
console.log("--> % defaultValue % next:\n", next)
|
||||
value.value = `${next.province.name} ${next.city.name} ${next.district.name}`
|
||||
setDefaultValue(items.value, next)
|
||||
})
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
// setDefaultValue(items, props.defaultValue)
|
||||
})
|
||||
|
||||
const isProvinceActive = (item) => {
|
||||
return provinceActive.value && item.value == provinceActive.value.value
|
||||
}
|
||||
|
||||
const isCityActive = (item) => {
|
||||
return cityActive.value && item.value == cityActive.value.value
|
||||
}
|
||||
|
||||
const isDistrictActive = (item) => {
|
||||
return districtActive.value && item.value == districtActive.value.value
|
||||
}
|
||||
|
||||
const setDefaultValue = (items, value) => {
|
||||
if (!items || !value) {
|
||||
return
|
||||
}
|
||||
province.value = items
|
||||
items.map(prov => {
|
||||
console.log("--> % setDefaultValue % prov:\n", prov)
|
||||
if (prov.name == value.province.name) {
|
||||
city.value = prov.id
|
||||
provinceActive.value = {
|
||||
value: prov.id,
|
||||
name: value.province.name,
|
||||
}
|
||||
prov.children.map(city => {
|
||||
if (city.name == value.city.name) {
|
||||
district.value = city.children
|
||||
cityActive.value = {
|
||||
value: city.id,
|
||||
name: value.city.name,
|
||||
}
|
||||
city.children.map(district => {
|
||||
if (district.name == value.district.name) {
|
||||
districtActive.value = {
|
||||
value: city.id,
|
||||
name: value.district.name,
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(provinceActive.value, cityActive.value, districtActive.value)
|
||||
}
|
||||
|
||||
const open = () => {
|
||||
province.value = props.items
|
||||
provinceActive.value = null
|
||||
cityActive.value = null
|
||||
districtActive.value = null
|
||||
city.value = []
|
||||
district.value = []
|
||||
current.value = 0
|
||||
popup.value.open()
|
||||
|
||||
setDefaultValue(items.value, props.defaultValue.value)
|
||||
}
|
||||
|
||||
const changeNav = (index) => {
|
||||
if (index == 0) {
|
||||
provinceActive.value = null
|
||||
}
|
||||
if (index == 1) {
|
||||
cityActive.value = null
|
||||
districtActive.value = null
|
||||
}
|
||||
if (index == 2) {
|
||||
districtActive.value = null
|
||||
}
|
||||
current.value = index
|
||||
}
|
||||
|
||||
const selectProvince = (selectItem, index) => {
|
||||
provinceActive.value = selectItem
|
||||
city.value = selectItem.children
|
||||
current.value = 1
|
||||
}
|
||||
|
||||
const selectCity = (selectItem, index) => {
|
||||
cityActive.value = selectItem
|
||||
district.value = selectItem.children
|
||||
current.value = 2
|
||||
}
|
||||
|
||||
const selectDistrict = (selectItem, index) => {
|
||||
console.log("--> % selectDistrict % selectItem:\n", selectItem)
|
||||
districtActive.value = selectItem
|
||||
value.value = `${provinceActive.value?.name} ${cityActive.value?.name} ${districtActive.value?.name}`
|
||||
console.log({
|
||||
province: {
|
||||
id: provinceActive.value?.id,
|
||||
name: provinceActive.value?.name,
|
||||
},
|
||||
city: {
|
||||
id: cityActive.value?.id,
|
||||
name: cityActive.value?.name,
|
||||
},
|
||||
district: {
|
||||
id: districtActive.value?.id,
|
||||
name: districtActive.value?.name,
|
||||
},
|
||||
})
|
||||
emit('callback', {
|
||||
province: {
|
||||
id: provinceActive.value?.id,
|
||||
name: provinceActive.value?.name,
|
||||
},
|
||||
city: {
|
||||
id: cityActive.value?.id,
|
||||
name: cityActive.value?.name,
|
||||
},
|
||||
district: {
|
||||
id: districtActive.value?.id,
|
||||
name: districtActive.value?.name,
|
||||
},
|
||||
})
|
||||
popup.value.close()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.cityselect {
|
||||
width: 100%;
|
||||
height: 75%;
|
||||
background-color: #fff;
|
||||
z-index: 1502;
|
||||
position: relative;
|
||||
padding-bottom: 0;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
|
||||
.cityScroll {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.swiper {
|
||||
height: 800rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cityselect-header {
|
||||
width: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.cityselect-title {
|
||||
width: 100%;
|
||||
font-size: 30rpx;
|
||||
text-align: center;
|
||||
height: 95rpx;
|
||||
line-height: 95rpx;
|
||||
position: relative;
|
||||
|
||||
&:cityselect-title:after {
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
content: '';
|
||||
width: 100%;
|
||||
background-image: linear-gradient(0deg, #ececec 50%, transparent 0);
|
||||
}
|
||||
}
|
||||
|
||||
.cityselect-nav {
|
||||
width: 100%;
|
||||
padding-left: 20rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
|
||||
.item {
|
||||
font-size: 26rpx;
|
||||
color: #222;
|
||||
display: block;
|
||||
height: 80rpx;
|
||||
line-height: 92rpx;
|
||||
padding: 0 16rpx;
|
||||
position: relative;
|
||||
margin-right: 30rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 40%;
|
||||
|
||||
&.active {
|
||||
color: #f23030 !important;
|
||||
border-bottom: 1rpx solid #f23030;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cityselect-content {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cityselect-item {
|
||||
.cityselect-item-box {
|
||||
display: block;
|
||||
padding: 0 40rpx;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
word-break: break-all;
|
||||
text-overflow: ellipsis;
|
||||
line-height: 64rpx;
|
||||
max-height: 65rpx;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
|
||||
&.active {
|
||||
color: #f23030 !important;
|
||||
}
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
height: 1rpx;
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-image: linear-gradient(0deg, #ececec 50%, transparent 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
22
components/container/container.vue
Normal file
22
components/container/container.vue
Normal file
@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view :class="['container', min ? 'container-min' : '']">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, } from 'vue';
|
||||
const props = defineProps(['min'])
|
||||
const min = ref(props?.min != undefined)
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.container {
|
||||
padding: 0 34rpx;
|
||||
|
||||
&-min {
|
||||
padding: 0 10rpx;
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
342
components/first-goods/first-goods.vue
Normal file
342
components/first-goods/first-goods.vue
Normal file
@ -0,0 +1,342 @@
|
||||
<template>
|
||||
<goods
|
||||
card
|
||||
:data="goodsData"
|
||||
:storeName="goodsData.storeName"
|
||||
:price="goodsData.price"
|
||||
:stock="goodsData.stock"
|
||||
surplus="200"
|
||||
link
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const props = defineProps(['data'])
|
||||
|
||||
const goodsData = props.data
|
||||
console.log("--> % goodsData:\n", goodsData)
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.goods {
|
||||
width: 100%;
|
||||
padding: 30rpx 0;
|
||||
|
||||
&-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.goods {
|
||||
&-content {
|
||||
padding: 0 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
&-info {
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
&-thumb {
|
||||
margin-bottom: 15rpx;
|
||||
width: 100%;
|
||||
height: 203rpx;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
&-header {}
|
||||
|
||||
&-thumb {
|
||||
background: #FAFAFA;
|
||||
}
|
||||
|
||||
&-content {}
|
||||
|
||||
&-title {
|
||||
line-height: 40rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
|
||||
|
||||
&-price {
|
||||
&-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.goods-price {}
|
||||
}
|
||||
|
||||
&-primary {
|
||||
line-height: 42rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #EE6D46;
|
||||
}
|
||||
|
||||
&-default {
|
||||
line-height: 40rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
&-original {
|
||||
margin-left: 9rpx;
|
||||
line-height: 28rpx;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
&-desc {
|
||||
line-height: 33rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
&-info {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
|
||||
&-left {}
|
||||
|
||||
&-action {
|
||||
&-btn {}
|
||||
|
||||
&-desc {
|
||||
line-height: 28rpx;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
&-image {
|
||||
&-img {}
|
||||
}
|
||||
|
||||
&-list {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 14rpx;
|
||||
|
||||
.goods {
|
||||
&-thumb {
|
||||
margin-bottom: 0;
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&-content {
|
||||
padding-right: 40rpx;
|
||||
margin-left: 30rpx;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// .goods {
|
||||
// padding: 16rpx 14rpx;
|
||||
|
||||
// &-header {
|
||||
// display: flex;
|
||||
// align-items: flex-start;
|
||||
// }
|
||||
|
||||
// &-thumb {
|
||||
|
||||
// width: 220rpx;
|
||||
// height: 220rpx;
|
||||
|
||||
// &-img {
|
||||
// width: 100%;
|
||||
// height: 100%;
|
||||
// display: block;
|
||||
// }
|
||||
// }
|
||||
|
||||
// &-content {
|
||||
// margin-top: 24rpx;
|
||||
// margin-left: 40rpx;
|
||||
// flex: 1
|
||||
// }
|
||||
|
||||
// &-title {
|
||||
// line-height: 40rpx;
|
||||
// font-size: 28rpx;
|
||||
// font-weight: 500;
|
||||
// color: #333333;
|
||||
// margin-bottom: 35rpx;
|
||||
// }
|
||||
|
||||
// &-info {
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// justify-content: space-between;
|
||||
|
||||
// &-left {
|
||||
// display: flex;
|
||||
// align-items: flex-end;
|
||||
|
||||
// }
|
||||
|
||||
// &-action {
|
||||
// &-btn {}
|
||||
|
||||
// &-desc {
|
||||
// color: #999999;
|
||||
// font-size: 24rpx;
|
||||
// line-height: 40rpx;
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// &-price {
|
||||
// &-default {
|
||||
// line-height: 28rpx;
|
||||
// font-size: 20rpx;
|
||||
// color: #999999;
|
||||
|
||||
// }
|
||||
|
||||
// &-primary {
|
||||
// line-height: 42rpx;
|
||||
// font-size: 30rpx;
|
||||
// font-weight: 500;
|
||||
// color: #EE6D46;
|
||||
// margin-left: 5rpx;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// &-desc {
|
||||
// color: #999999;
|
||||
// font-size: 24rpx;
|
||||
// line-height: 40rpx;
|
||||
// }
|
||||
|
||||
|
||||
// &-model {
|
||||
// display: inline-flex;
|
||||
// align-items: center;
|
||||
// width: auto;
|
||||
// height: 40rpx;
|
||||
// border: 1px solid #CCCCCC;
|
||||
// opacity: 1;
|
||||
// border-radius: 0rpx;
|
||||
// padding: 0 10rpx;
|
||||
|
||||
// margin-bottom: 28rpx;
|
||||
|
||||
// &-label {
|
||||
// line-height: 38rpx;
|
||||
// font-size: 24rpx;
|
||||
// color: #999999;
|
||||
// }
|
||||
|
||||
// &-value {
|
||||
// line-height: 38rpx;
|
||||
// font-size: 24rpx;
|
||||
// color: #333333;
|
||||
// margin-right: 10rpx;
|
||||
// }
|
||||
|
||||
// &-action {
|
||||
// width: 11rpx;
|
||||
// height: 7rpx;
|
||||
// }
|
||||
// }
|
||||
|
||||
// &-model-info {
|
||||
// display: inline-flex;
|
||||
// align-items: center;
|
||||
// width: auto;
|
||||
// height: 40rpx;
|
||||
// opacity: 1;
|
||||
// border-radius: 0rpx;
|
||||
// margin-bottom: 28rpx;
|
||||
|
||||
// &-label {
|
||||
// line-height: 38rpx;
|
||||
// font-size: 24rpx;
|
||||
// color: #999999;
|
||||
// }
|
||||
|
||||
// &-value {
|
||||
// line-height: 38rpx;
|
||||
// font-size: 24rpx;
|
||||
// color: #333333;
|
||||
// margin-right: 10rpx;
|
||||
// }
|
||||
|
||||
// &-action {
|
||||
// width: 11rpx;
|
||||
// height: 7rpx;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
.buy-progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
&-info {
|
||||
flex: 1;
|
||||
|
||||
&-desc {
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&-action {
|
||||
margin-left: 17rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.buy-num {
|
||||
|
||||
&-info-desc {
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
203
components/good-attr-select/good-attr-select.vue
Normal file
203
components/good-attr-select/good-attr-select.vue
Normal file
@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<uv-popup
|
||||
ref="popupRef"
|
||||
mode="bottom"
|
||||
:style="{ height: '50%' }"
|
||||
round="round"
|
||||
>
|
||||
<view
|
||||
class="goodAttrSelect"
|
||||
v-if="storeInfo"
|
||||
>
|
||||
<view class="goodAttrSelect-goods">
|
||||
<goods
|
||||
list
|
||||
min
|
||||
:storeName="storeInfo.storeName"
|
||||
:price="storeInfo.price"
|
||||
surplus="200"
|
||||
:data="storeInfo"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<div class="line"></div>
|
||||
<view class="goodAttrSelect-attr row">
|
||||
<view class="goodAttrSelect-attr-title">
|
||||
数量
|
||||
</view>
|
||||
<view class="goodAttrSelect-attr-content">
|
||||
<uv-number-box
|
||||
v-model="storeNum"
|
||||
min="1"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<div class="line"></div>
|
||||
|
||||
<view
|
||||
class="goodAttrSelect-attr"
|
||||
v-for="(item, index) in productAttr"
|
||||
:key="index"
|
||||
>
|
||||
<view class="goodAttrSelect-attr-title">
|
||||
{{ item.attrName }}
|
||||
</view>
|
||||
<view class="goodAttrSelect-attr-content">
|
||||
<space>
|
||||
<view
|
||||
:class="{ attr: true, check: select[item.attrName] == attr.attr }"
|
||||
v-for="(attr, attrIndex) in item.attrValue"
|
||||
:key="attrIndex"
|
||||
@tap="handleSelectAttr(item.attrName, attr)"
|
||||
>{{ attr.attr }}</view>
|
||||
</space>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goodAttrSelect-action">
|
||||
<uv-button
|
||||
round
|
||||
block
|
||||
type="primary"
|
||||
@tap="handleSubmit"
|
||||
>
|
||||
确定
|
||||
</uv-button>
|
||||
</view>
|
||||
</view>
|
||||
</uv-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { getProductDetail, getProductAddCollect, getProductDelCollect } from '@/api/product'
|
||||
|
||||
const props = defineProps(["id"])
|
||||
|
||||
const emit = defineEmits(['onSelect', 'submit'])
|
||||
|
||||
const popupRef = ref()
|
||||
const select = ref({})
|
||||
const visible = ref(false)
|
||||
const detailData = ref(null)
|
||||
const storeInfo = ref(null)
|
||||
const productAttr = ref(null)
|
||||
const productValue = ref(null)
|
||||
const storeNum = ref(1)
|
||||
|
||||
const selectAttrPanel = ref(false)
|
||||
|
||||
const handleGetDetail = async (id) => {
|
||||
|
||||
const detail = await getProductDetail(id)
|
||||
if (detail) {
|
||||
detailData.value = detail
|
||||
storeInfo.value = detail.storeInfo
|
||||
productAttr.value = detail.productAttr
|
||||
productValue.value = detail.productValue
|
||||
let attr = {}
|
||||
detail.productAttr.forEach(item => {
|
||||
attr[item.attrName] = ''
|
||||
})
|
||||
select.value = attr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handleSelectAttr = (attr, value) => {
|
||||
select.value[attr] = value.attr
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
|
||||
|
||||
let value = []
|
||||
productAttr.value.map(item => {
|
||||
value.push(select.value[item.attrName] || '')
|
||||
})
|
||||
|
||||
if (value.includes('')) {
|
||||
uni.showToast({
|
||||
title: '请选择规格',
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
emit('select', {
|
||||
store: productValue.value[value.toString()],
|
||||
num: storeNum.value
|
||||
})
|
||||
}
|
||||
|
||||
const open = () => {
|
||||
popupRef.value.open()
|
||||
handleGetDetail(props.id)
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
popupRef.value.close()
|
||||
}
|
||||
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.goodAttrSelect {
|
||||
height: 100%;
|
||||
|
||||
&-goods {
|
||||
padding: 20rpx 20rpx;
|
||||
}
|
||||
|
||||
&-action {
|
||||
padding: 20rpx 20rpx;
|
||||
|
||||
}
|
||||
|
||||
&-attr {
|
||||
padding: 40rpx 30rpx;
|
||||
|
||||
&.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.goodAttrSelect-attr-title {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&-title {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
&-content {}
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
height: 1rpx;
|
||||
background: #E6E6E6;
|
||||
}
|
||||
|
||||
.attr {
|
||||
height: 68rpx;
|
||||
border: 1rpx solid #333333;
|
||||
padding: 0 20rpx;
|
||||
line-height: 68rpx;
|
||||
|
||||
font-size: 28rpx;
|
||||
|
||||
&.check {
|
||||
background: #333333;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
566
components/goods/goods.vue
Normal file
566
components/goods/goods.vue
Normal file
@ -0,0 +1,566 @@
|
||||
<template>
|
||||
<view
|
||||
:class="{ goods: true, 'goods-card': card, 'goods-list': list, 'goods-min': min, 'goods-fill': fill, 'goods-round': round }"
|
||||
>
|
||||
<view
|
||||
class="goods-header"
|
||||
@tap="toDetail"
|
||||
>
|
||||
<view class="goods-thumb">
|
||||
<image
|
||||
:src="data.image"
|
||||
class="goods-thumb-img"
|
||||
style="object-fit: cover"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view :class="['goods-content']">
|
||||
<view
|
||||
class="goods-storeName"
|
||||
@tap="toDetail"
|
||||
>{{ data.storeName }}</view>
|
||||
<view
|
||||
class="goods-list-model"
|
||||
v-if="selectModel"
|
||||
>
|
||||
<div
|
||||
class="goods-list-model-border"
|
||||
@tap.stop="handleOpenSelect"
|
||||
>
|
||||
<view class="goods-list-model-label">{{ data.attrInfo.sku }}</view>
|
||||
<view class="goods-list-model-action icon">
|
||||
<image src="@/static/images/down.png" />
|
||||
</view>
|
||||
</div>
|
||||
</view>
|
||||
<view
|
||||
class="goods-list-model-info"
|
||||
v-if="model"
|
||||
>
|
||||
<view class="goods-list-model-label">{{ data.attrInfo.sku }}</view>
|
||||
|
||||
<!-- <view class="goods-list-model-info-label">颜色:</view>
|
||||
<view class="goods-list-model-info-value">黑色</view>
|
||||
<view class="goods-list-model-info-label">尺码:</view>
|
||||
<view class="goods-list-model-info-value">M</view> -->
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="goods-info-left">
|
||||
<view
|
||||
class="goods-desc"
|
||||
v-if="groupNum"
|
||||
>{{ data.groupNum }}人团</view>
|
||||
<view
|
||||
class="goods-price-row"
|
||||
v-if="primary"
|
||||
>
|
||||
<view class="goods-price goods-price-primary">
|
||||
¥{{ data.price }}
|
||||
</view>
|
||||
<view
|
||||
class="goods-price goods-price-original"
|
||||
v-if="original"
|
||||
>
|
||||
¥{{ data.original }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="goods-price goods-price-default"
|
||||
v-if="!primary"
|
||||
>¥{{ data.price }}</view>
|
||||
</view>
|
||||
<view class="goods-info-action">
|
||||
<view class="goods-info-action-btn">
|
||||
<slot name="action"></slot>
|
||||
</view>
|
||||
<view
|
||||
class="goods-info-action-desc"
|
||||
v-if="stock"
|
||||
>
|
||||
仅剩{{ data.stock }}件
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="buy-num"
|
||||
v-if="purchase"
|
||||
>
|
||||
<view class="buy-num-info-desc">
|
||||
{{ data.purchase }}
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="buyProgress">
|
||||
<view class="buy-progress">
|
||||
<view class="buy-progress-info">
|
||||
<view
|
||||
class="buy-progress-info-desc"
|
||||
v-if="quantity"
|
||||
>
|
||||
限量{{ data.quantity }}件
|
||||
</view>
|
||||
<uv-line-progress
|
||||
:percentage="50"
|
||||
:showText="false"
|
||||
/>
|
||||
</view>
|
||||
<view class="buy-progress-action">
|
||||
<uv-button
|
||||
round
|
||||
block
|
||||
type="primary"
|
||||
>
|
||||
立即抢购
|
||||
</uv-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<good-attr-select
|
||||
ref="selectAttrPanel"
|
||||
:id="data.id"
|
||||
@select="handleSelectAttr"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { navigateTo } from '@/utils/router';
|
||||
import { ref } from 'vue'
|
||||
const props = defineProps(['data', 'min', 'groupNum', 'original', 'stock', 'primary', 'card', 'list', 'buyProgress', 'quantity', 'selectModel', 'model', 'purchase', 'link', 'fill', 'round'])
|
||||
|
||||
// 团购人数
|
||||
const groupNum = ref(props.groupNum)
|
||||
// 剩余数量
|
||||
const stock = ref(props.stock)
|
||||
// 使用主题颜色的价格
|
||||
const primary = ref(props.primary !== undefined)
|
||||
// 卡片模式
|
||||
const card = ref(props.card !== undefined)
|
||||
// 列表模式
|
||||
const list = ref(props.list !== undefined)
|
||||
// 限量多少件
|
||||
const quantity = ref(props.quantity)
|
||||
// 显示购买进度
|
||||
const buyProgress = ref(props.buyProgress)
|
||||
// 选择规格
|
||||
const selectModel = ref(props.selectModel !== undefined)
|
||||
// 显示规格
|
||||
const model = ref(props.model !== undefined)
|
||||
// 购买数量
|
||||
const purchase = ref(props.purchase)
|
||||
// 原价
|
||||
const original = ref(props.original)
|
||||
// 小尺寸
|
||||
const min = ref(props.min)
|
||||
const selectAttrPanel = ref(null)
|
||||
const link = ref(props.link !== undefined)
|
||||
const fill = ref(props.fill !== undefined)
|
||||
const round = ref(props.round !== undefined)
|
||||
|
||||
const toDetail = () => {
|
||||
if (!link.value) { return }
|
||||
navigateTo({
|
||||
url: '/pages/goodsDetail/goodsDetail',
|
||||
query: {
|
||||
id: props.data.id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleOpenSelect = () => {
|
||||
selectAttrPanel.value.open()
|
||||
}
|
||||
|
||||
const handleSelectAttr = () => {
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.goods {
|
||||
position: relative;
|
||||
padding: 30rpx 0;
|
||||
|
||||
|
||||
&-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.goods {
|
||||
&-content {
|
||||
padding: 0 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
&-info {
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
&-thumb {
|
||||
margin-bottom: 15rpx;
|
||||
width: 100%;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
&-header {}
|
||||
|
||||
&-thumb {
|
||||
background: #FAFAFA;
|
||||
}
|
||||
|
||||
&-content {}
|
||||
|
||||
&-storeName {
|
||||
line-height: 40rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
|
||||
|
||||
&-price {
|
||||
&-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.goods-price {}
|
||||
}
|
||||
|
||||
&-primary {
|
||||
line-height: 42rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #EE6D46;
|
||||
}
|
||||
|
||||
&-default {
|
||||
line-height: 40rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
&-original {
|
||||
margin-left: 9rpx;
|
||||
line-height: 28rpx;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
&-desc {
|
||||
line-height: 33rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
&-info {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
|
||||
&-left {}
|
||||
|
||||
&-action {
|
||||
&-btn {}
|
||||
|
||||
&-desc {
|
||||
line-height: 28rpx;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
&-image {
|
||||
&-img {}
|
||||
}
|
||||
|
||||
&-list {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 14rpx;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
|
||||
.goods {
|
||||
&-thumb {
|
||||
margin-bottom: 0;
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&-content {
|
||||
padding-right: 40rpx;
|
||||
margin-left: 30rpx;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
&-model {
|
||||
display: flex;
|
||||
|
||||
|
||||
margin-bottom: 28rpx;
|
||||
|
||||
&-border {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 40rpx;
|
||||
border: 1px solid #CCCCCC;
|
||||
opacity: 1;
|
||||
border-radius: 0rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
&-info {}
|
||||
|
||||
&-label {
|
||||
line-height: 38rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
&-value {
|
||||
line-height: 38rpx;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
&-action {
|
||||
width: 11rpx;
|
||||
height: 7rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&-min {
|
||||
.goods {
|
||||
&-thumb {
|
||||
margin-bottom: 0;
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-fill {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
&-round {
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// .goods {
|
||||
// padding: 16rpx 14rpx;
|
||||
|
||||
// &-header {
|
||||
// display: flex;
|
||||
// align-items: flex-start;
|
||||
// }
|
||||
|
||||
// &-thumb {
|
||||
|
||||
// width: 220rpx;
|
||||
// height: 220rpx;
|
||||
|
||||
// &-img {
|
||||
// width: 100%;
|
||||
// height: 100%;
|
||||
// display: block;
|
||||
// }
|
||||
// }
|
||||
|
||||
// &-content {
|
||||
// margin-top: 24rpx;
|
||||
// margin-left: 40rpx;
|
||||
// flex: 1
|
||||
// }
|
||||
|
||||
// &-storeName {
|
||||
// line-height: 40rpx;
|
||||
// font-size: 28rpx;
|
||||
// font-weight: 500;
|
||||
// color: #333333;
|
||||
// margin-bottom: 35rpx;
|
||||
// }
|
||||
|
||||
// &-info {
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// justify-content: space-between;
|
||||
|
||||
// &-left {
|
||||
// display: flex;
|
||||
// align-items: flex-end;
|
||||
|
||||
// }
|
||||
|
||||
// &-action {
|
||||
// &-btn {}
|
||||
|
||||
// &-desc {
|
||||
// color: #999999;
|
||||
// font-size: 24rpx;
|
||||
// line-height: 40rpx;
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// &-price {
|
||||
// &-default {
|
||||
// line-height: 28rpx;
|
||||
// font-size: 20rpx;
|
||||
// color: #999999;
|
||||
|
||||
// }
|
||||
|
||||
// &-primary {
|
||||
// line-height: 42rpx;
|
||||
// font-size: 30rpx;
|
||||
// font-weight: 500;
|
||||
// color: #EE6D46;
|
||||
// margin-left: 5rpx;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// &-desc {
|
||||
// color: #999999;
|
||||
// font-size: 24rpx;
|
||||
// line-height: 40rpx;
|
||||
// }
|
||||
|
||||
|
||||
&-model {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
width: auto;
|
||||
height: 40rpx;
|
||||
border: 1px solid #CCCCCC;
|
||||
opacity: 1;
|
||||
border-radius: 0rpx;
|
||||
padding: 0 10rpx;
|
||||
|
||||
margin-bottom: 28rpx;
|
||||
|
||||
&-label {
|
||||
line-height: 38rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
&-value {
|
||||
line-height: 38rpx;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
&-action {
|
||||
width: 11rpx;
|
||||
height: 7rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// &-model-info {
|
||||
// display: inline-flex;
|
||||
// align-items: center;
|
||||
// width: auto;
|
||||
// height: 40rpx;
|
||||
// opacity: 1;
|
||||
// border-radius: 0rpx;
|
||||
// margin-bottom: 28rpx;
|
||||
|
||||
// &-label {
|
||||
// line-height: 38rpx;
|
||||
// font-size: 24rpx;
|
||||
// color: #999999;
|
||||
// }
|
||||
|
||||
// &-value {
|
||||
// line-height: 38rpx;
|
||||
// font-size: 24rpx;
|
||||
// color: #333333;
|
||||
// margin-right: 10rpx;
|
||||
// }
|
||||
|
||||
// &-action {
|
||||
// width: 11rpx;
|
||||
// height: 7rpx;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
.buy-progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
&-info {
|
||||
flex: 1;
|
||||
|
||||
&-desc {
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&-action {
|
||||
margin-left: 17rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.buy-num {
|
||||
|
||||
&-info-desc {
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
17
components/layout/layout.vue
Normal file
17
components/layout/layout.vue
Normal file
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<view class="layout">
|
||||
<slot />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, defineProps, reactive } from 'vue';
|
||||
const props = defineProps(['size'])
|
||||
console.log("gxs --> % props:\n", props)
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.layout {
|
||||
min-height: 100%;
|
||||
}
|
||||
</style>
|
20
components/logo/logo.vue
Normal file
20
components/logo/logo.vue
Normal file
@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"logo",
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
|
||||
</style>
|
350
components/order/order.vue
Normal file
350
components/order/order.vue
Normal file
@ -0,0 +1,350 @@
|
||||
<template>
|
||||
<view>
|
||||
<view
|
||||
:class="['order', className]"
|
||||
v-if="data"
|
||||
>
|
||||
|
||||
<view
|
||||
class="order-header"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
<view class="order-logo">
|
||||
<!-- <image :src="data." alt=""> -->
|
||||
</view>
|
||||
<view class="order-status status-1">
|
||||
{{ data._status._msg }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="order-goods"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
<goods
|
||||
list
|
||||
interval
|
||||
desc="3"
|
||||
showAction
|
||||
model
|
||||
purchase="x3"
|
||||
:data="item.productInfo"
|
||||
v-for="(item, index) in data.cartInfo"
|
||||
/>
|
||||
</view>
|
||||
<view
|
||||
class="order-info"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
<text>总价:¥{{ payPrice }}</text>
|
||||
<text>优惠:¥{{ deductionPrice }}</text>
|
||||
<text>运费:-¥{{ freightPrice }}</text>
|
||||
<text>总计:¥{{ totalPrice }}</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 0"
|
||||
>
|
||||
<!-- 未支付 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="handleCancel"
|
||||
>
|
||||
取消订单
|
||||
</view>
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="handlePay"
|
||||
>
|
||||
立即付款
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 1"
|
||||
>
|
||||
<!-- 待发货 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="toSelectRefundGood"
|
||||
>
|
||||
申请退款
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 2"
|
||||
>
|
||||
<!-- 待收货 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看物流
|
||||
</view>
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="handleOrderTake"
|
||||
>
|
||||
确认收货
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 3"
|
||||
>
|
||||
<!-- 待评价 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="handleDelete"
|
||||
>
|
||||
删除订单
|
||||
</view>
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
去评价
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 4"
|
||||
>
|
||||
<!-- 已完成 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="handleDelete"
|
||||
>
|
||||
删除订单
|
||||
</view>
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看订单
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 5"
|
||||
>
|
||||
<!-- 退款中 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看订单
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 6"
|
||||
>
|
||||
<!-- 已退款 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看订单
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 7"
|
||||
>
|
||||
<!-- 退款 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看订单
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { orderCancel, orderInfo, orderDelete, orderTake } from '@/api/order'
|
||||
|
||||
import { navigateTo, back } from '@/utils/router'
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const props = defineProps(['class', 'data'])
|
||||
|
||||
const data = ref(props.data)
|
||||
|
||||
// 运费金额
|
||||
const freightPrice = ref(props.data.freightPrice)
|
||||
// 实际支付金额
|
||||
const payPrice = ref(props.data.payPrice)
|
||||
// 优惠券金额
|
||||
const couponPrice = ref(props.data.couponPrice)
|
||||
// 抵扣金额
|
||||
const deductionPrice = ref(props.data.deductionPrice)
|
||||
// 订单总价
|
||||
const totalPrice = ref(props.data.totalPrice)
|
||||
|
||||
const handleCancel = async () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认取消订单',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
await orderCancel({
|
||||
id: data.value.orderId
|
||||
})
|
||||
data.value = null
|
||||
uni.showToast({
|
||||
title: '已取消',
|
||||
duration: 2000
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const toSelectRefundGood = () => {
|
||||
navigateTo({
|
||||
url: '/pages/selectRefundGood/selectRefundGood',
|
||||
query: {
|
||||
orderId: data.value.orderId,
|
||||
id: data.value.id,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handlePay = () => {
|
||||
|
||||
navigateTo({
|
||||
url: '/pages/selectPlay/selectPlay',
|
||||
query: {
|
||||
key: data.value.unique,
|
||||
orderId: data.value.orderId,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const toOrderInfo = () => {
|
||||
navigateTo({
|
||||
url: '/pages/orderInfo/orderInfo',
|
||||
query: {
|
||||
key: data.value.unique,
|
||||
orderId: data.value.orderId,
|
||||
// id: data.value.id,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const toEvaluate = () => {
|
||||
navigateTo({
|
||||
url: '/pages/evaluate/evaluate',
|
||||
query: {
|
||||
unique: data.value.unique,
|
||||
orderId: data.value.orderId,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const handleDelete = async () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认取消订单',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
await orderDelete({
|
||||
id: data.value.orderId
|
||||
})
|
||||
data.value = null
|
||||
uni.showToast({
|
||||
title: '已删除',
|
||||
duration: 2000
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
const handleOrderTake = async () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认收货',
|
||||
success: async (res) => {
|
||||
console.log("gxs --> % success: % res:\n", res)
|
||||
if (res.confirm) {
|
||||
let option = {
|
||||
uni: data.value.orderId,
|
||||
}
|
||||
const res = await orderTake(option)
|
||||
|
||||
emit('refresh')
|
||||
} else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
</style>
|
107
components/reply/reply.vue
Normal file
107
components/reply/reply.vue
Normal file
@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<view :class="{
|
||||
reply: true,
|
||||
noPic: !data?.pics
|
||||
}">
|
||||
<view class="reply-content">
|
||||
<view class="reply-user">
|
||||
<view class="reply-user-pic">
|
||||
<image
|
||||
class="img"
|
||||
src="http://yshop.l1.ttut.cc/admin-api/infra/file/4/get/7599202df273d25f1ce3aeba21165a544849248fda23aad090098d7be0c063c9.jpeg"
|
||||
/>
|
||||
<!-- <image :src="data.avatar" /> -->
|
||||
</view>
|
||||
<view class="reply-user-name">
|
||||
<view class="name">
|
||||
<!-- {{ data.nickname }} -->
|
||||
我的名字
|
||||
</view>
|
||||
<view class="productScore">
|
||||
<uv-rate
|
||||
count="5"
|
||||
:value="data.productScore"
|
||||
readonly
|
||||
size="12"
|
||||
gutter="1"
|
||||
active-color="#ee6d46"
|
||||
inactive-color="#999999"
|
||||
></uv-rate>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="reply-text">
|
||||
{{ data.comment }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="reply-pic"
|
||||
v-if="data?.pics"
|
||||
>
|
||||
<uv-album
|
||||
:urls="data?.pics"
|
||||
space="8rpx"
|
||||
></uv-album>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
const props = defineProps(['data'])
|
||||
|
||||
const data = ref(props.data)
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.reply {
|
||||
margin-top: 20rpx;
|
||||
|
||||
&.noPic {
|
||||
|
||||
.reply-content {}
|
||||
}
|
||||
|
||||
&-pic {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
|
||||
&-user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 16rpx;
|
||||
|
||||
&-pic {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 10rpx;
|
||||
|
||||
.img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: block;
|
||||
border-radius: 50%;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
&-name {
|
||||
margin-left: 6rpx;
|
||||
line-height: 33rpx;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
&-content {
|
||||
border-right: 0;
|
||||
flex: 1;
|
||||
font-size: 30rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
</style>
|
220
components/space/space.vue
Normal file
220
components/space/space.vue
Normal file
@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<view
|
||||
:class="classObject"
|
||||
:style="[getStyle]"
|
||||
>
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, onMounted } from "vue"
|
||||
const props = defineProps([
|
||||
'direction',
|
||||
'align',
|
||||
'wrap',
|
||||
'justify',
|
||||
'size',
|
||||
'height',
|
||||
'padding',
|
||||
'flex',
|
||||
'border'
|
||||
])
|
||||
|
||||
console.log("--> % props:\n", props)
|
||||
|
||||
|
||||
const classObject = ref({})
|
||||
|
||||
const handleClassObject = (props) => {
|
||||
console.log("--> % handleClassObject % props:\n", props.value)
|
||||
let className = 'yshop-space'
|
||||
let direction = props.direction
|
||||
let align = props.align
|
||||
let wrap = props.wrap
|
||||
let justify = props.justify
|
||||
let flex = props.flex
|
||||
let border = props.border
|
||||
if (border) {
|
||||
className += ' yshop-space-border'
|
||||
}
|
||||
if (direction) {
|
||||
className += ` yshop-space-${direction}`
|
||||
}
|
||||
if (wrap) {
|
||||
className += ` yshop-space-${wrap}`
|
||||
}
|
||||
if (align) {
|
||||
className += ` yshop-space-align-${align}`
|
||||
}
|
||||
if (justify) {
|
||||
className += ` yshop-space-justify-${justify}`
|
||||
}
|
||||
console.log("--> % handleClassObject % className:\n", className)
|
||||
|
||||
classObject.value = className
|
||||
}
|
||||
|
||||
const getStyle = ({
|
||||
size = 6,
|
||||
wrap,
|
||||
height,
|
||||
padding,
|
||||
flex
|
||||
}) => {
|
||||
let innerStyle = {}
|
||||
// let size = size.value
|
||||
// let wrap = wrap.value
|
||||
// let height = height.value
|
||||
// let padding = padding.value
|
||||
|
||||
if (height) {
|
||||
innerStyle.height = `${height}rpx`
|
||||
}
|
||||
if (typeof size === 'number') {
|
||||
innerStyle.gap = size + 'px'
|
||||
}
|
||||
|
||||
|
||||
if (wrap) {
|
||||
innerStyle.flexWrap = 'wrap'
|
||||
}
|
||||
|
||||
if (typeof size === 'string') {
|
||||
switch (size) {
|
||||
case 'small':
|
||||
innerStyle.gap = '8rpx'
|
||||
break
|
||||
case 'middle':
|
||||
innerStyle.gap = '16rpx'
|
||||
break
|
||||
case 'large':
|
||||
innerStyle.gap = '24rpx'
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (typeof padding === 'string') {
|
||||
innerStyle.padding = `${padding}rpx`
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(padding) === '[object Array]') {
|
||||
if (typeof padding === 'object') {
|
||||
if (padding.length == 1) {
|
||||
innerStyle.padding = `${padding[0]}rpx`
|
||||
}
|
||||
if (padding.length == 2) {
|
||||
innerStyle.padding = `${padding[0]}rpx ${padding[1]}rpx`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(size) === '[object Array]') {
|
||||
if (typeof size === 'object') {
|
||||
if (size.length == 1) {
|
||||
innerStyle.gap = `${size[0]}rpx`
|
||||
}
|
||||
if (size.length == 2) {
|
||||
innerStyle.gap = `${size[0]}rpx ${size[1]}rpx`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (flex) {
|
||||
innerStyle.flex = flex
|
||||
}
|
||||
|
||||
return innerStyle
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
handleClassObject(props)
|
||||
getStyle(props)
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
space {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.yshop-space {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
|
||||
&-vertical {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
&-align-center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&-align-start {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
&-align-end {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
&-justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&-justify-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
&-justify-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
&-align-end {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
&-align-baseline {
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
&-item:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-border {
|
||||
border-bottom: 1rpx solid #f9f9f9;
|
||||
}
|
||||
}
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
.yshop-space {
|
||||
&>view {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
&>text {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
&>image {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.u-tag-wrapper {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.u-tag {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// #endif
|
||||
</style>
|
125
components/upload-file/upload-file.vue
Normal file
125
components/upload-file/upload-file.vue
Normal file
@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<uv-upload
|
||||
:fileList="list"
|
||||
name="1"
|
||||
multiple
|
||||
:maxCount="10"
|
||||
@afterRead="afterRead"
|
||||
@delete="handleDeletePic"
|
||||
></uv-upload>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { VUE_APP_UPLOAD_URL } from '@/config';
|
||||
import { ref } from 'vue';
|
||||
|
||||
const props = defineProps(['modelValue'])
|
||||
console.log("--> % modelValue:\n", props.modelValue)
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const list = ref(props.modelValue)
|
||||
|
||||
const handleDeletePic = (event) => {
|
||||
list.value.splice(event.index, 1)
|
||||
|
||||
emit('update:modelValue', list.value)
|
||||
}
|
||||
|
||||
const afterRead = async (event) => {
|
||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
let lists = [].concat(event.file)
|
||||
let fileListLen = list.value.length
|
||||
lists.map((item) => {
|
||||
list.value.push({
|
||||
...item,
|
||||
status: 'uploading',
|
||||
message: '上传中'
|
||||
})
|
||||
})
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
const result = await uploadFilePromise(lists[i].url)
|
||||
console.log("gxs --> % afterRead % result:\n", result)
|
||||
let item = list.value[fileListLen]
|
||||
list.value.splice(fileListLen, 1, Object.assign(item, {
|
||||
status: 'success',
|
||||
message: '',
|
||||
url: result
|
||||
}))
|
||||
fileListLen++
|
||||
}
|
||||
emit('update:modelValue', list.value)
|
||||
}
|
||||
|
||||
const uploadFilePromise = (url) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let a = uni.uploadFile({
|
||||
url: VUE_APP_UPLOAD_URL, // 仅为示例,非真实的接口地址
|
||||
filePath: url,
|
||||
name: 'file',
|
||||
formData: {
|
||||
user: 'test'
|
||||
},
|
||||
success: (res) => {
|
||||
console.log("gxs --> % returnnewPromise % res:\n", res)
|
||||
setTimeout(() => {
|
||||
resolve(res.data.data)
|
||||
}, 10)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.activity {
|
||||
|
||||
&-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
&-info {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
&-title {
|
||||
line-height: 45rpx;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
&-subtitle {
|
||||
margin-left: 10rpx;
|
||||
|
||||
line-height: 33rpx;
|
||||
font-size: 24rpx;
|
||||
color: #EE6D46;
|
||||
}
|
||||
|
||||
&-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
|
||||
&-info {
|
||||
line-height: 33rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.image {
|
||||
margin-left: 10rpx;
|
||||
display: block;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&-body {}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
452
components/verification/verification.vue
Normal file
452
components/verification/verification.vue
Normal file
@ -0,0 +1,452 @@
|
||||
<template>
|
||||
<uv-button
|
||||
round
|
||||
size="mini"
|
||||
block
|
||||
type="primary"
|
||||
@click="startCountdown"
|
||||
>
|
||||
{{ buttonText }}
|
||||
</uv-button>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
onUnmounted
|
||||
} from 'vue'
|
||||
import {
|
||||
sendSmsCode
|
||||
} from '@/api/auth'
|
||||
|
||||
const props = defineProps(['mobile', 'scene'])
|
||||
|
||||
const countingDown = ref(false); // 是否正在倒计时
|
||||
const countdownSeconds = ref(60); // 倒计时的总秒数
|
||||
const timer = ref(null); // 倒计时的总秒数
|
||||
|
||||
const buttonText = computed(() => {
|
||||
return countingDown.value ? `${countdownSeconds.value} 秒` : '发送验证码';
|
||||
});
|
||||
|
||||
const startCountdown = () => {
|
||||
if (!countingDown.value) {
|
||||
countingDown.value = true;
|
||||
handleSendSmsCode()
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const handleSendSmsCode = () => {
|
||||
uni.showLoading({
|
||||
title: '发送验证码中'
|
||||
});
|
||||
console.log("gxs --> % handleSendSmsCode % props.mobile:\n", props.mobile)
|
||||
sendSmsCode({
|
||||
"mobile": props.mobile,
|
||||
"scene": props.scene
|
||||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '验证码已发送',
|
||||
duration: 2000
|
||||
});
|
||||
timer.value = setInterval(() => {
|
||||
countdownSeconds.value--;
|
||||
console.log("gxs --> % timer % countdownSeconds.value:\n", countdownSeconds.value)
|
||||
if (countdownSeconds.value <= 0) {
|
||||
clearInterval(timer.value);
|
||||
countdownSeconds.value = 60; // 倒计时结束后重置为初始值
|
||||
countingDown.value = false;
|
||||
}
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
countingDown.value = false;
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer.value);
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.goods {
|
||||
position: relative;
|
||||
padding: 30rpx 0;
|
||||
|
||||
&-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.goods {
|
||||
&-content {
|
||||
padding: 0 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
&-info {
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
&-thumb {
|
||||
margin-bottom: 15rpx;
|
||||
width: 100%;
|
||||
height: 203rpx;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
&-header {}
|
||||
|
||||
&-thumb {
|
||||
background: #FAFAFA;
|
||||
}
|
||||
|
||||
&-content {}
|
||||
|
||||
&-storeName {
|
||||
line-height: 40rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
|
||||
|
||||
&-price {
|
||||
&-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.goods-price {}
|
||||
}
|
||||
|
||||
&-primary {
|
||||
line-height: 42rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #EE6D46;
|
||||
}
|
||||
|
||||
&-default {
|
||||
line-height: 40rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
&-original {
|
||||
margin-left: 9rpx;
|
||||
line-height: 28rpx;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
&-desc {
|
||||
line-height: 33rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
&-info {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
|
||||
&-left {}
|
||||
|
||||
&-action {
|
||||
&-btn {}
|
||||
|
||||
&-desc {
|
||||
line-height: 28rpx;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
&-image {
|
||||
&-img {}
|
||||
}
|
||||
|
||||
&-list {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 14rpx;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
|
||||
.goods {
|
||||
&-thumb {
|
||||
margin-bottom: 0;
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&-content {
|
||||
padding-right: 40rpx;
|
||||
margin-left: 30rpx;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
&-model {
|
||||
display: flex;
|
||||
|
||||
|
||||
margin-bottom: 28rpx;
|
||||
|
||||
&-border {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 40rpx;
|
||||
border: 1px solid #CCCCCC;
|
||||
opacity: 1;
|
||||
border-radius: 0rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
&-info {}
|
||||
|
||||
&-label {
|
||||
line-height: 38rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
&-value {
|
||||
line-height: 38rpx;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
&-action {
|
||||
width: 11rpx;
|
||||
height: 7rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&-min {
|
||||
.goods {
|
||||
&-thumb {
|
||||
margin-bottom: 0;
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// .goods {
|
||||
// padding: 16rpx 14rpx;
|
||||
|
||||
// &-header {
|
||||
// display: flex;
|
||||
// align-items: flex-start;
|
||||
// }
|
||||
|
||||
// &-thumb {
|
||||
|
||||
// width: 220rpx;
|
||||
// height: 220rpx;
|
||||
|
||||
// &-img {
|
||||
// width: 100%;
|
||||
// height: 100%;
|
||||
// display: block;
|
||||
// }
|
||||
// }
|
||||
|
||||
// &-content {
|
||||
// margin-top: 24rpx;
|
||||
// margin-left: 40rpx;
|
||||
// flex: 1
|
||||
// }
|
||||
|
||||
// &-storeName {
|
||||
// line-height: 40rpx;
|
||||
// font-size: 28rpx;
|
||||
// font-weight: 500;
|
||||
// color: #333333;
|
||||
// margin-bottom: 35rpx;
|
||||
// }
|
||||
|
||||
// &-info {
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// justify-content: space-between;
|
||||
|
||||
// &-left {
|
||||
// display: flex;
|
||||
// align-items: flex-end;
|
||||
|
||||
// }
|
||||
|
||||
// &-action {
|
||||
// &-btn {}
|
||||
|
||||
// &-desc {
|
||||
// color: #999999;
|
||||
// font-size: 24rpx;
|
||||
// line-height: 40rpx;
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// &-price {
|
||||
// &-default {
|
||||
// line-height: 28rpx;
|
||||
// font-size: 20rpx;
|
||||
// color: #999999;
|
||||
|
||||
// }
|
||||
|
||||
// &-primary {
|
||||
// line-height: 42rpx;
|
||||
// font-size: 30rpx;
|
||||
// font-weight: 500;
|
||||
// color: #EE6D46;
|
||||
// margin-left: 5rpx;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// &-desc {
|
||||
// color: #999999;
|
||||
// font-size: 24rpx;
|
||||
// line-height: 40rpx;
|
||||
// }
|
||||
|
||||
|
||||
&-model {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
width: auto;
|
||||
height: 40rpx;
|
||||
border: 1px solid #CCCCCC;
|
||||
opacity: 1;
|
||||
border-radius: 0rpx;
|
||||
padding: 0 10rpx;
|
||||
|
||||
margin-bottom: 28rpx;
|
||||
|
||||
&-label {
|
||||
line-height: 38rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
&-value {
|
||||
line-height: 38rpx;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
&-action {
|
||||
width: 11rpx;
|
||||
height: 7rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// &-model-info {
|
||||
// display: inline-flex;
|
||||
// align-items: center;
|
||||
// width: auto;
|
||||
// height: 40rpx;
|
||||
// opacity: 1;
|
||||
// border-radius: 0rpx;
|
||||
// margin-bottom: 28rpx;
|
||||
|
||||
// &-label {
|
||||
// line-height: 38rpx;
|
||||
// font-size: 24rpx;
|
||||
// color: #999999;
|
||||
// }
|
||||
|
||||
// &-value {
|
||||
// line-height: 38rpx;
|
||||
// font-size: 24rpx;
|
||||
// color: #333333;
|
||||
// margin-right: 10rpx;
|
||||
// }
|
||||
|
||||
// &-action {
|
||||
// width: 11rpx;
|
||||
// height: 7rpx;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
.buy-progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
&-info {
|
||||
flex: 1;
|
||||
|
||||
&-desc {
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&-action {
|
||||
margin-left: 17rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.buy-num {
|
||||
|
||||
&-info-desc {
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user