refactor:项目升级Vue3+uView Plus

- 改造入口文件、全量替换组件引入
- 过滤器迁移混入,更新忽略配置,新增迁移文档
This commit is contained in:
lifenlong
2026-06-06 22:51:10 +08:00
parent d5663cfb4d
commit f4337fd030
269 changed files with 1956 additions and 42350 deletions

View File

@@ -1,9 +1,9 @@
<template>
<div class="wrapper">
<u-navbar :is-back="false" title="购物车">
<div slot="right">
<u-navbar :auto-back="false" title="购物车">
<template #right>
<div class="light-color edit" @click="isEdit = !isEdit">{{ !isEdit ? '编辑' : '完成'}}</div>
</div>
</template>
</u-navbar>
<!-- 空白页-->
<view v-if="!loading && (cartDetail.cartList == '' || cartDetail.cartList == [] || !cartDetail)" class="empty">
@@ -40,8 +40,9 @@
<span>领劵</span>
</view>
</view>
<u-swipe-action :show="skuItem.selected" @open="openAction(skuItem)" :options="options" bg-color="#fff"
ref="swiperAction" class="cart-item" v-for="(skuItem, i) in item.skuList" :index="i" :key="skuItem.goodsSku.id"
<u-swipe-action ref="swiperAction" class="cart-item" v-for="(skuItem, i) in item.skuList" :key="skuItem.goodsSku.id">
<u-swipe-action-item :show="skuItem.selected" @open="openAction(skuItem)" :options="options"
:name="i"
@click="changeActionTab(skuItem)" @longpress="changeActionTab(skuItem)">
<!-- 满减活动 -->
<div v-if="Object.keys(skuItem.promotionMap).length != 0">
@@ -83,8 +84,8 @@
<view class="sp-price">
<!-- <div class="default-color" :class="{'main-color':Object.keys(skuItem.promotionMap).length ==0 }"> -->
<div class="main-color">
<span>{{ $options.filters.goodsFormatPrice(skuItem.goodsSku.price)[0] }}</span>
<span>.{{ $options.filters.goodsFormatPrice(skuItem.goodsSku.price)[1] }}</span>
<span>{{ goodsFormatPrice(skuItem.goodsSku.price)[0] }}</span>
<span>.{{ goodsFormatPrice(skuItem.goodsSku.price)[1] }}</span>
</div>
</view>
<view>
@@ -105,8 +106,8 @@
<!-- 如果有活动 并且是选中的状态,显示预估到手价格 -->
<!-- <div class="priceDetail-flowPrice" :class="{'main-color':skuItem.priceDetailDTO}"
v-if="skuItem.priceDetailDTO && skuItem.invalid == 0 && Object.keys(skuItem.promotionMap).length != 0 && skuItem.checked && skuItem.checked">
预估到手价 <span>{{ $options.filters.goodsFormatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
<span>.{{ $options.filters.goodsFormatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
预估到手价 <span>{{ goodsFormatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
<span>.{{ goodsFormatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
</div> -->
<div style='margin-left: 20rpx;' v-if="!skuItem.checked && skuItem.errorMessage">
{{skuItem.errorMessage}}
@@ -115,10 +116,11 @@
</view>
</view>
</u-swipe-action-item>
</u-swipe-action>
</div>
</div>
<u-modal v-model="deleteShow" :confirm-style="{'color':lightColor}" @confirm="deleteConfirm" show-cancel-button
<u-modal v-model:show="deleteShow" :confirm-style="{'color':lightColor}" @confirm="deleteConfirm" show-cancel-button
:content="deleteContent" :async-close="true"></u-modal>
<!-- 结账 -->
<div class="box box6">
@@ -130,14 +132,14 @@
<div class="fullPrice">
<span class="number" v-if="cartDetail && cartDetail.priceDetailDTO">
总计:
<span>¥{{ $options.filters.goodsFormatPrice(cartDetail.priceDetailDTO.flowPrice)[0] }}</span>.<span>{{ $options.filters.goodsFormatPrice(cartDetail.priceDetailDTO.flowPrice)[1] }}</span>
<span>¥{{ goodsFormatPrice(cartDetail.priceDetailDTO.flowPrice)[0] }}</span>.<span>{{ goodsFormatPrice(cartDetail.priceDetailDTO.flowPrice)[1] }}</span>
</span>
<span class="number" v-else>总计:0.00</span>
</div>
<div
v-if="cartDetail.cartList && cartDetail.cartList.length!=0 && cartDetail.priceDetailDTO && cartDetail.priceDetailDTO.discountPrice!=0 "
class="discountPrice">
<span>优惠减:{{(cartDetail.priceDetailDTO.goodsPrice - cartDetail.priceDetailDTO.flowPrice) | unitPrice}}
<span>优惠减:{{(cartDetail.priceDetailDTO.goodsPrice -unitPrice(cartDetail.priceDetailDTO.flowPrice))}}
</span>
<span class="discount-details" @click="discountDetails">优惠明细</span>
</div>
@@ -145,22 +147,22 @@
</span>
</view>
<!-- 优惠详情 -->
<u-popup z-index="3" close mode="bottom" height="50%" closeable v-model="discountDetailsFlag" border-radius="20">
<u-popup z-index="3" close mode="bottom" height="50%" closeable v-model:show="discountDetailsFlag" border-radius="20">
<div class="discount-list">
<view class="discount-title">优惠明细</view>
<div class="discount-way">
<div class="discount-item" v-if="cartDetail.priceDetailDTO">
<span>商品总额</span>
<span>{{cartDetail.priceDetailDTO.goodsPrice | unitPrice}}</span>
<span>{{unitPrice(cartDetail.priceDetailDTO.goodsPrice)}}</span>
</div>
<div class="discount-item" v-if="cartDetail.priceDetailDTO">
<span>优惠券</span>
<span>-{{cartDetail.priceDetailDTO.couponPrice | unitPrice}}</span>
<span>-{{unitPrice(cartDetail.priceDetailDTO.couponPrice)}}</span>
</div>
<div class="discount-item" v-if="cartDetail.priceDetailDTO">
<span>其他优惠</span>
<span>-{{cartDetail.priceDetailDTO.discountPrice | unitPrice}}</span>
<span>-{{unitPrice(cartDetail.priceDetailDTO.discountPrice)}}</span>
</div>
</div>
</div>
@@ -266,11 +268,11 @@ export default {
this.cartDetail.cartList.forEach((cartItem) => {
if (cartItem.skuList) {
cartItem.skuList.forEach((sku) => {
this.$set(sku, "selected", false);
sku["selected"] = false;
});
}
});
this.$set(skuItem, "selected", true);
skuItem["selected"] = true;
},
/**
@@ -380,7 +382,7 @@ export default {
* 验证是否选中商品
*/
whetherChecked() {
this.$options.filters.forceLogin()
this.forceLogin()
let canBuy = false;
this.cartDetail.cartList.forEach((item) => {
@@ -486,7 +488,7 @@ export default {
* 获取购物车数据
*/
getCardData() {
if (this.$options.filters.isLogin("auth")) {
if (this.isLogin("auth")) {
uni.showLoading({
title: "加载中",
});

View File

@@ -1,12 +1,12 @@
<template>
<view class="category-wrap">
<u-navbar class="navbar" :is-back="false">
<u-navbar class="navbar" :auto-back="false">
<div class="title">商品分类</div>
<!-- #ifdef H5 -->
<u-search class="nav-search" @click.native="search" placeholder="搜索商品" :show-action="false"></u-search>
<u-search class="nav-search" @click="search" placeholder="搜索商品" :show-action="false"></u-search>
<!-- #endif -->
<!-- #ifndef H5 -->
<u-search class="nav-search" disabled @click.native="search" placeholder="搜索商品" :show-action="false"></u-search>
<u-search class="nav-search" disabled @click="search" placeholder="搜索商品" :show-action="false"></u-search>
<!-- #endif -->
</u-navbar>
<view class="content">

View File

@@ -1,6 +1,6 @@
<template>
<div>
<u-popup v-model="enableShowCoupon" mode="center" width="550rpx" height="400px">
<u-popup v-model:show="enableShowCoupon" mode="center" width="550rpx" height="400px">
<view style="height: 130rpx">
<view
style="
@@ -32,14 +32,13 @@
>{{ item.discount }}</view
>
<view v-else
>优惠金额<span style="color: red; font-size: 32rpx">{{
item.price | unitPrice
>优惠金额<span style="color: red; font-size: 32rpx">{{unitPrice(item.price)
}}</span
></view
>
<view
><span style="color: red; font-size: 32rpx"
>{{ item.consumeThreshold | unitPrice }}</span
>{{unitPrice(item.consumeThreshold) }}</span
>可用</view
>
<view v-if="item.scopeType == 'ALL' && item.storeId == '0'"
@@ -100,7 +99,7 @@ export default {
},
methods: {
firstGetAuto() {
if(!this.$options.filters.isLogin('auth')) return false
if(!this.isLogin('auth')) return false
let data = new Date();
let now = data.getDate();
let hours = data.getHours();

View File

@@ -2,7 +2,7 @@
<div class="layout">
<div class="box">
<u-swiper @click="clickSwiper" interval="5000" duration="500" height="350" v-if="res" name="img" :list="res.list">
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-swiper>
</div>
</div>
@@ -16,7 +16,7 @@ export default {
watch: {
res: {
handler(newValue, oldValue) {
this.$set(this, "res", newValue);
this["res"] = newValue;
},
deep: true,
},

View File

@@ -2,7 +2,7 @@
<template>
<div class="layout">
<u-image width="140rpx" mode="aspectFit" height="140rpx" @click="modelNavigateTo(item)" class="image-mode" v-for="(item,index) in res.list" :key="index" :src="item.img" alt="">
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
</template>

View File

@@ -2,7 +2,7 @@
<template>
<div class="layout">
<u-image height="175rpx" mode="aspectFit" width="175rpx" @click="modelNavigateTo(item)" class="image-mode" :src="item.img" v-for="(item,index) in res.list" :key="index">
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
</template>

View File

@@ -2,7 +2,7 @@
<template>
<div class="layout">
<u-image @click="modelNavigateTo(item)" height="240rpx" width="240rpx" class="image-mode" :src="item.img" v-for="(item, index) in res.list" :key="index">
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
</template>

View File

@@ -3,23 +3,21 @@
<div class="flex-two">
<div class="flex-item" @click="modelNavigateTo(res.list[0])">
<u-image height="250rpx" width="100%" mode="scaleToFill" :src="res.list[0].img" alt>
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
<div class="flex-item" @click="modelNavigateTo(res.list[1])">
<u-image height="250rpx" width="100%" mode="scaleToFill" :src="res.list[1].img" alt>
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
</div>
</div>
</template>
<script>
import uImage from "@/uview-ui/components/u-image/u-image.vue";
import { modelNavigateTo } from "./tpl";
export default {
components: { uImage },
title: "两张横图",
title: "两张横图",
props: ["res"],
mounted() {

View File

@@ -33,7 +33,7 @@
mode="aspectFit"
width="100%"
>
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
<div class="goods-desc">
@@ -43,8 +43,8 @@
<div class="goods-bottom">
<div class="goods-price">
¥<span
>{{ $options.filters.goodsFormatPrice(item.price)[0] }} </span
>.{{ $options.filters.goodsFormatPrice(item.price)[1] }}
>{{ goodsFormatPrice(item.price)[0] }} </span
>.{{ goodsFormatPrice(item.price)[1] }}
</div>
</div>
</div>
@@ -64,7 +64,7 @@
mode="aspectFit"
width="100%"
>
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
<div class="goods-desc">
@@ -74,8 +74,8 @@
<div class="goods-bottom">
<div class="goods-price">
¥<span
>{{ $options.filters.goodsFormatPrice(item.price)[0] }} </span
>.{{ $options.filters.goodsFormatPrice(item.price)[1] }}
>{{ goodsFormatPrice(item.price)[0] }} </span
>.{{ goodsFormatPrice(item.price)[1] }}
</div>
</div>
</div>

View File

@@ -3,18 +3,18 @@
<div class="layout">
<div class="view-height-150" @click="modelNavigateTo(res.list[0])">
<u-image width="100%" height="340rpx" class="image-mode" :src="res.list[0].img">
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
<div class="view-height-150">
<div class="view-height-75" @click="modelNavigateTo(res.list[1])">
<u-image width="100%" height="170rpx" class="image-mode" :src="res.list[1].img" alt>
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
<div class="view-height-75" @click="modelNavigateTo(res.list[2])">
<u-image width="100%" height="170rpx" class="image-mode" :src="res.list[2].img" alt>
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
</div>

View File

@@ -14,7 +14,7 @@
class="menu-img"
:src="item.img"
>
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
<div class="menu-title">{{ item.title }}</div>

View File

@@ -4,7 +4,7 @@
<u-icon name="search"></u-icon>
{{ res.list[0].title }}
</div>
<div slot="right" open-type="contact" class="navbar-right message" @click="linkMsgDetail" style="border-style:none;background:rgb(234,234,234);" >
<div class="navbar-right message" @click="linkMsgDetail" style="border-style:none;background:rgb(234,234,234);">
<image style="width:53rpx;height:53rpx;margin-top:6rpx;" src="@/static/img/title.png"></image>
</div>
</div>

View File

@@ -3,18 +3,18 @@
<div class="layout">
<div class="view-width-100" @click="modelNavigateTo(res.list[0])">
<u-image class="image-mode" width="100%" height="200rpx" :src="res.list[0].img">
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
<div class="view-width-100" @click="modelNavigateTo(res.list[1])">
<div class="view-height-85">
<u-image class="image-mode" width="100%" height="170rpx" :src="res.list[1].img">
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
<div class="view-height-85" @click="modelNavigateTo(res.list[2])">
<u-image class="image-mode" width="100%" height="170rpx" :src="res.list[2].img">
<u-loading slot="loading"></u-loading>
<template #loading><u-loading></u-loading></template>
</u-image>
</div>
</div>

View File

@@ -8,7 +8,7 @@
width="100%"
:src="res.list[0].img"
alt
><u-loading slot="loading"></u-loading
><u-loading #loading></u-loading
></u-image>
</div>
<div class="view-height-85" @click="modelNavigateTo(res.list[1])">
@@ -18,7 +18,7 @@
width="100%"
:src="res.list[1].img"
alt
><u-loading slot="loading"></u-loading
><u-loading #loading></u-loading
></u-image>
</div>
</div>
@@ -28,7 +28,7 @@
height="200rpx"
width="100%"
:src="res.list[2].img"
><u-loading slot="loading"></u-loading
><u-loading #loading></u-loading
></u-image>
</div>
</div>

View File

@@ -8,9 +8,9 @@
</view>
<u-cell-group v-if="current == 0">
<view v-for="(item,index) in lists" :key="index">
<u-cell-item :arrow="false" v-if="item.status =='UN_READY'" style="position: relative;"
<u-cell :isLink="false" v-if="item.status =='UN_READY'" style="position: relative;"
@click="linkMsgDetail(item)">
<template slot="label">
<template #label>
<view style="display: inline-block;
width: 100%;
height: auto;
@@ -26,15 +26,15 @@
</view>
</template>
<!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#000000;color:white;">未读</button> -->
</u-cell-item>
</u-cell>
</view>
</u-cell-group>
<u-cell-group v-if="current == 1">
<view v-for="(item,index) in lists" :key="index">
<u-cell-item :arrow="false" v-if="item.status == 'ALREADY_READY'" style="position: relative;"
<u-cell :isLink="false" v-if="item.status == 'ALREADY_READY'" style="position: relative;"
@click="linkMsgDetail(item)">
<template slot="label">
<template #label>
<view style="display: inline-block;
width: 100%;
height: auto;
@@ -51,7 +51,7 @@
</view>
</template>
<!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#F3F3FA;color:black;">已读</button> -->
</u-cell-item>
</u-cell>
</view>
</u-cell-group>
</view>
@@ -150,7 +150,7 @@
this.getMessage()
},
getMessage() {
this.params.memberId = this.$options.filters.isLogin().id;
this.params.memberId = this.isLogin().id;
messages(this.params).then(res => {
console.log(res)

View File

@@ -3,13 +3,15 @@
<!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
<div v-for="(item, index) in pageData.list" :key="index">
<!-- 搜索栏如果在楼层装修顶部则会自动浮动否则不浮动 -->
<u-navbar class="navbar" v-if="item.type == 'search'" :is-back="false" :is-fixed="index === 1 ? false : true">
<u-navbar class="navbar" v-if="item.type == 'search'" :auto-back="false" :fixed="index === 1 ? false : true">
<search style="width: 100%" :res="item.options" />
<!-- #ifndef H5 -->
<!-- 扫码功能 不兼容h5 详情文档: https://uniapp.dcloud.io/api/system/barcode?id=scancode -->
<div slot="right" class="navbar-right">
<u-icon name="scan" @click="scan()" color="#666" size="50"></u-icon>
</div>
<template #right>
<div class="navbar-right">
<u-icon name="scan" @click="scan()" color="#666" size="50"></u-icon>
</div>
</template>
<!-- #endif -->
</u-navbar>
<carousel v-if="item.type == 'carousel'" :res="item.options" />

View File

@@ -1,5 +1,5 @@
<template>
<u-modal v-model="show" cancelText="不同意" confirmText="同意" showCancelButton title="服务协议和隐私政策" @confirm="confirm" @cancel="cancel">
<u-modal v-model:show="show" cancelText="不同意" confirmText="同意" showCancelButton title="服务协议和隐私政策" @confirm="confirm" @cancel="cancel">
<view class="u-update-content">
请您务必审慎阅读,充分理解服务协议隐私政策各条款
包括但不限于为了更好的向你提供服务我们需要收集你的设备标识,

View File

@@ -7,7 +7,7 @@
<search style="width: 100%" :res="item.options" />
<!-- #ifndef H5 -->
<!-- 扫码功能 不兼容h5 详情文档: https://uniapp.dcloud.io/api/system/barcode?id=scancode -->
<div slot="right" class="navbar-right">
<div class="navbar-right">
<u-icon name="scan" @click="scan()" color="#666" size="50"></u-icon>
</div>
<!-- #endif -->

View File

@@ -21,7 +21,7 @@
<u-row text-align="center" gutter="16" class="point">
<u-col text-align="center" span="4" @click="navigateTo('/pages/mine/deposit/operation')">
<view>预存款</view>
<view class="money">{{ walletNum | unitPrice }}</view>
<view class="money">{{unitPrice(walletNum) }}</view>
</u-col>
<u-col text-align="center" span="4" @click="navigateTo('/pages/cart/coupon/myCoupon')">
@@ -98,8 +98,8 @@ export default {
},
onLoad() { },
onShow() {
this.userInfo = this.$options.filters.isLogin() || {};
if (this.$options.filters.isLogin("auth")) {
this.userInfo = this.isLogin() || {};
if (this.isLogin("auth")) {
this.getUserOrderNum();
} else {
this.walletNum = 0;
@@ -109,7 +109,7 @@ export default {
},
onPullDownRefresh() {
this.getUserOrderNum();
this.userInfo = this.$options.filters.isLogin();
this.userInfo = this.isLogin();
},
// #ifndef MP
onNavigationBarButtonTap(e) {
@@ -134,7 +134,7 @@ export default {
userDetail() {
this.userInfo.id
? this.navigateTo("/pages/mine/set/personMsg")
: this.$options.filters.navigateToLogin();;
: this.navigateToLogin();;
},
async getUserOrderNum() {
uni.stopPullDownRefresh();

View File

@@ -5,7 +5,7 @@
<view class="goods-intro">
<view>{{goods.goodsName}}</view>
<view>{{goods.goods_sn}}</view>
<view>¥{{goods.goods_price | unitPrice}}</view>
<view>¥{{unitPrice(goods.goods_price)}}</view>
</view>
<!-- <button>找相似</button> -->
</view>
@@ -16,7 +16,7 @@
<image :src="item.thumbnail" mode=""></image>
<view class="nowrap">{{item.name}}</view>
<view>
<text>{{item.price | unitPrice}}
<text>{{unitPrice(item.price)}}
<!-- <text v-if="item.point">+{{item.point || 0}}积分</text> -->
</text>
<text>{{item.mktprice}}</text>

View File

@@ -111,7 +111,7 @@
</div>
<template>
<u-popup v-model="sharingShow" mode="bottom" border-radius="14">
<u-popup v-model:show="sharingShow" mode="bottom" border-radius="14">
<view style="margin: 10px; text-align: center;"> 请邀请用户扫描二维码或者将地址复制转发给其他用户 </view>
<view class='qrcode'>
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="sharingLink" :options="{ margin: 10 }">
@@ -171,7 +171,7 @@ export default {
'/pages/mine/set/feedBack'
]
if (!ignores.includes(url)) {
if (this.$options.filters.tipsToLogin('normal')) {
if (this.tipsToLogin('normal')) {
this.handleNavigate(url)
}
}