refactor: 重构多个组件以支持 Vue 3 语法和功能

- 将多个组件转换为 `<script setup>` 语法,提升可读性和性能
- 优化状态管理和事件处理逻辑,简化代码结构
- 更新样式和布局以适应新组件结构
- 添加新功能和修复已知问题,提升用户体验
This commit is contained in:
Yer11214
2026-07-08 18:37:11 +08:00
parent 4d0b0fb5e4
commit 349ffa4f34
189 changed files with 18278 additions and 20758 deletions

View File

@@ -2,52 +2,46 @@
<view class="content">
<view class="body">
<view class="top-view">
<view class="title">{{coupon.title}}</view>
<view class="price" v-if="coupon.couponType =='PRICE'"><text></text>{{unitPrice(coupon.price)}}</view>
<view class="price" v-if="coupon.couponType =='DISCOUNT'">{{coupon.discount}}</view>
<view class="text">{{coupon.consumeThreshold}}元可用</view>
<view class="bg-quan">
</view>
<view class="jiao-1" :class="{'used-color':coupon.used_status!=0}">
<text class="text-1">{{coupon.used_status == 0?'新到':coupon.used_status_text}}</text>
<view class="title">{{ coupon.title }}</view>
<view class="price" v-if="coupon.couponType == 'PRICE'"><text></text>{{ unitPrice(coupon.price) }}</view>
<view class="price" v-if="coupon.couponType == 'DISCOUNT'">{{ coupon.discount }}</view>
<view class="text">{{ coupon.consumeThreshold }}元可用</view>
<view class="bg-quan"></view>
<view class="jiao-1" :class="{ 'used-color': coupon.used_status != 0 }">
<text class="text-1">{{ coupon.used_status == 0 ? '新到' : coupon.used_status_text }}</text>
</view>
</view>
<view class="bottom-view">
<view class="text"> 使用范围{{
coupon.scopeType == 'ALL' && coupon.storeId == '0'
? "全平台"
: coupon.scopeType == "PORTION_GOODS"
? "部分商品"
: coupon.scopeType == "PORTION_GOODS_CATEGORY"
? "部分分类商品"
: coupon.storeName == 'platform' ? '全平台' :coupon.storeName+''
}}使用</view>
<view class="text"> 有效期至{{coupon.endTime}}</view>
coupon.scopeType == 'ALL' && coupon.storeId == '0'
? '全平台'
: coupon.scopeType == 'PORTION_GOODS'
? '部分商品'
: coupon.scopeType == 'PORTION_GOODS_CATEGORY'
? '部分分类商品'
: coupon.storeName == 'platform' ? '全平台' : coupon.storeName + ''
}}使用</view>
<view class="text"> 有效期至{{ coupon.endTime }}</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
coupon: {}, //优惠券数据
};
},
onLoad(option) {
this.coupon = JSON.parse(decodeURIComponent(option.item));
},
};
<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { unitPrice } from '@/utils/filters.js'
const coupon = ref<Record<string, any>>({})
onLoad((option) => {
coupon.value = JSON.parse(decodeURIComponent(option.item))
})
</script>
<style lang="scss" scoped>
page,
.content {
// background: $main-color;
height: 100%;
}
.body {