From 92230c9a97dc9ce9df3313d11d26999c04bb6b26 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 15 七月 2025 13:12:48 +0800 Subject: [PATCH] 项目初始化 --- src/components/geek-xd/components/geek-order/geek-order.vue | 220 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 220 insertions(+), 0 deletions(-) diff --git a/src/components/geek-xd/components/geek-order/geek-order.vue b/src/components/geek-xd/components/geek-order/geek-order.vue new file mode 100644 index 0000000..5eb6aad --- /dev/null +++ b/src/components/geek-xd/components/geek-order/geek-order.vue @@ -0,0 +1,220 @@ +<template> + <view class="geek-card" @click="$emit('click')"> + <view class="geek-header"> + <view class="geek-shop">{{ shop }} > </view> + <view class="geek-status">{{ status }}</view> + </view> + <view class="geek-content"> + <image class="geek-img" :src="img"></image> + <view class="geek-label">{{ label }}</view> + <view class="geek-sum"> + <view class="geek-price"> + <view class="geek-sum-1">锟{ number.integerPart }}</view> + <view class="geek-sum-2">. {{ number.decimalPart }}</view> + </view> + <view class="geek-sum-3">鍏� {{ num }} 浠�</view> + </view> + </view> + <view class="geek-footer"> + <view class="geek-more" @click="$emit('more')">鏇村</view> + <view class="geek-buttonGroup"> + <view class="geek-btn" @click="$emit('sell')">鍗栦簡鎹㈤挶</view> + <view class="geek-btn" @click="$emit('return')">閫�鎹�/鍞悗</view> + <view class="geek-buy" @click="$emit('again')">鍐嶆璐拱</view> + </view> + </view> + </view> +</template> +<script setup> +import { computed } from 'vue'; + +const props = defineProps({ + shop: { + type: String, + default: '' + }, + status: { + type: String, + default: '' + }, + img: { + type: String, + default: '' + }, + label: { + type: String, + default: '' + }, + price: { + type: Number, + default: 0 + }, + num: { + type: Number, + default: 0 + }, + type: { + type: String, + default: 'line' + } +}) + +const number = computed(() => { + return formatNumber(props.price, 2) +}) + +function formatNumber(num, place) { + + let fixedNum = Number(num).toFixed(place); // 灏嗘暟瀛椾繚鐣欎袱浣嶅皬鏁� + let parts = fixedNum.split('.'); // 鎷嗗垎鏁存暟閮ㄥ垎鍜屽皬鏁伴儴鍒� + let integerPart = parts[0]; // 鏁存暟閮ㄥ垎 + let decimalPart = parts[1]; // 灏忔暟閮ㄥ垎 + + // 浣跨敤padStart鏂规硶琛�0鍒板皬鏁伴儴鍒� + decimalPart = decimalPart.padStart(place, '0'); + + return { + integerPart, decimalPart + } +} +</script> +<style lang="scss" scoped> +.geek-card { + display: flex; + flex-direction: column; + justify-content: space-between; + position: relative; + padding: 20rpx; + background-color: white; + border-radius: 20rpx; + height: 360rpx; + width: 700rpx; + margin: 25rpx; + + .geek-header { + display: flex; + justify-content: space-between; + height: 60rpx; + width: 100%; + margin-bottom: 6rpx; + + .geek-shop { + font-size: 28rpx; + font-weight: 600; + } + + .geek-status { + width: 100rpx; + text-align: center; + opacity: 0.5; + font-size: 25rpx; + text-align: end; + } + + } + + .geek-content { + position: relative; + height: auto; + width: 664rpx; + + .geek-img { + border-radius: 30rpx; + height: 170rpx; + width: 170rpx; + display: inline-block; + } + + .geek-label { + position: absolute; + top: 40rpx; + left: 178rpx; + + width: 350rpx; + + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; + } + + .geek-sum { + position: absolute; + top: 44rpx; + right: 20rpx; + + width: 150rpx; + height: 84rpx; + + .geek-price { + display: flex; + justify-content: flex-end; + font-weight: bold; + + .geek-sum-1 { + font-size: 32rpx; + } + + .geek-sum-2 { + padding-top: 20rpx; + font-size: 20rpx; + } + } + + + .geek-sum-3 { + font-size: 20rpx; + text-align: end; + } + } + } + + .geek-footer { + display: flex; + justify-content: space-between; + height: 60rpx; + width: 100%; + font-size: 25rpx; + + .geek-more { + height: 60rpx; + margin-right: 110rpx; + text-align: center; + line-height: 60rpx; + display: inline-block; + } + + .geek-buttonGroup { + height: 60rpx; + display: inline-block; + + .geek-btn { + border: 1rpx solid #E9E9E9; + width: 140rpx; + height: 60rpx; + border-radius: 80rpx; + opacity: 0.8; + padding: 10rpx; + margin-right: 10rpx; + text-align: center; + display: inline-block; + + } + + .geek-buy { + width: 140rpx; + height: 60rpx; + border-radius: 80rpx; + opacity: 0.8; + padding: 10rpx; + text-align: center; + display: inline-block; + color: #F25E53; + border: 1rpx solid #F4DADA; + } + } + } + +} +</style> \ No newline at end of file -- Gitblit v1.9.3