style(theme): 统一应用主题样式并更新组件样式变量

- 在多个页面组件中添加动态主题样式绑定
- 将硬编码的颜色值替换为CSS变量和主题配置
- 引入主题样式计算逻辑到各个页面
- 更新优惠券、地址、订单等页面的主题适配
- 替换线性渐变背景为动态主题颜色
- 移除uni_modules组件中的$set方法调用以优化性能
- 更新README中主题色管理状态为已完成
This commit is contained in:
pikachu1995@126.com
2026-10-09 16:02:11 +08:00
parent 74d186ff36
commit a32f6d2313
58 changed files with 519 additions and 301 deletions

View File

@@ -1,5 +1,5 @@
<template>
<view class="content">
<view :style="themeStyle" class="content">
<view class="u-tabs-box">
<u-tabs
:list="list"
@@ -204,8 +204,10 @@ import { isECouponOrder } from '@/utils/goodsType.js'
import { getAfterSaleList, cancelAfterSale } from '@/api/after-sale.js'
import { getOrderList } from '@/api/order.js'
import storage from '@/utils/storage'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const lightColor = computed(() => store.getters.lightColor)
const list = [

View File

@@ -1,5 +1,5 @@
<template>
<view class="page-wrap">
<view :style="themeStyle" class="page-wrap">
<scroll-view scroll-y class="page-scroll">
<up-form
:model="form"
@@ -173,8 +173,10 @@ import { isAppointmentOrder } from '@/utils/goodsType.js'
import { computePartialRefundPrice } from '@/utils/appointmentGoods.js'
import { handleUploadAfterRead } from '@/utils/uploadHelper.js'
import storage from '@/utils/storage.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const { proxy } = getCurrentInstance()!
const $u = proxy!.$u

View File

@@ -1,5 +1,5 @@
<template>
<view class="mp-iphonex-bottom content">
<view :style="themeStyle" class="mp-iphonex-bottom content">
<up-form
:model="form"
ref="uForm"
@@ -81,8 +81,10 @@ import { unitPrice } from '@/utils/filters.js'
import { getLogistics } from '@/api/address.js'
import { fillShipInfo } from '@/api/after-sale.js'
import storage from '@/utils/storage'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const lightColor = computed(() => store.getters.lightColor)
const companySelectShow = ref(false)

View File

@@ -1,5 +1,5 @@
<template>
<view>
<view :style="themeStyle">
<view class="after-sales-goods-detail-view">
<view class="header">
<view>
@@ -58,13 +58,17 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { unitPrice, parseGoodsImageUrl } from '@/utils/filters.js'
import { getAfterSaleInfo } from '@/api/after-sale'
import storage from '@/utils/storage'
// 深链进入时拦截 E_COUPON,后端 apply/save 亦会拒绝
import { isECouponOrder } from '@/utils/goodsType.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const sn = ref('')
const sku = ref<any>({})

View File

@@ -1,5 +1,5 @@
<template>
<view v-if="serviceDetail">
<view :style="themeStyle" v-if="serviceDetail">
<view class="after-sales-goods-detail-view">
<view class="header">
<view>
@@ -185,7 +185,7 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import {
@@ -201,8 +201,10 @@ import {
getAfterSaleLog,
getAfterSaleReason,
} from '@/api/after-sale.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const reason = ref('')
const serviceTypeList: Record<string, string> = {

View File

@@ -1,5 +1,5 @@
<template>
<view>
<view :style="themeStyle">
<view class="header">
<u-icon name='checkmark' size="150" color="#ff6b35"></u-icon>
<view class="success-text">售后申请提交成功</view>
@@ -21,7 +21,12 @@
</view>
</template>
<script setup lang="ts">
<script setup lang="ts">import { computed } from 'vue'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
function navigateToAfterSales() {
uni.redirectTo({
url: '/pages/order/afterSales/afterSales',

View File

@@ -3,7 +3,7 @@
@Date 2026-08-03
-->
<template>
<view class="card-key-page">
<view :style="themeStyle" class="card-key-page">
<view v-if="loading" class="card-key-page__loading">加载中...</view>
<view v-else-if="errorMessage" class="card-key-page__empty">{{ errorMessage }}</view>
<view v-else-if="!cardKeyRows.length" class="card-key-page__empty">
@@ -64,6 +64,10 @@ import {
resolveCardKeyFulfillMessage,
CARD_KEY_FULFILL_STATUS,
} from '@/utils/goodsType.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const orderSn = ref('')
const loading = ref(true)

View File

@@ -1,5 +1,5 @@
<template>
<view>
<view :style="themeStyle">
<!-- 商品模块 -->
<view class="seller-view">
<view class="seller-info u-flex u-row-between">
@@ -58,15 +58,17 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { getOrderDetail } from '@/api/order.js'
import { getComplainReason, addComplain } from '@/api/after-sale.js'
import { handleUploadAfterRead } from '@/utils/uploadHelper.js'
import { unitPrice } from '@/utils/filters.js'
import { unitPrice } from '@/utils/filters.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const orderStatusMap: Record<string, string> = {
UNDELIVERED: '待发货',

View File

@@ -1,5 +1,5 @@
<template>
<view class="wrapper">
<view :style="themeStyle" class="wrapper">
<view class="tips">我的投诉信息</view>
<u-cell-group>
<u-cell :isLink="false" :value="complainDetail.goodsName" title="投诉商品"></u-cell>
@@ -52,12 +52,14 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { getComplainDetail, communication } from '@/api/after-sale'
import { getComplainDetail, communication } from '@/api/after-sale'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const complainId = ref('')
const complainValue = ref('')

View File

@@ -1,5 +1,5 @@
<template>
<view>
<view :style="themeStyle">
<view class="seller-view" v-for="(item, index) in complaionData" :key="index">
<view class="seller-info u-flex u-row-between">
<view class="seller-name">
@@ -41,13 +41,15 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onLoad, onReachBottom } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { unitPrice } from '@/utils/filters.js'
import { getComplain, clearComplain } from '@/api/after-sale'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const statusData: Record<string, string> = {
NEW: '新投诉',

View File

@@ -1,5 +1,5 @@
<template>
<view>
<view :style="themeStyle">
<view class="wrap">
<view class="u-tabs-box">
<u-tabs
@@ -85,8 +85,10 @@ import { onShow } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { getOrderList } from '@/api/order.js'
import { getComments } from '@/api/members.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const lightColor = computed(() => store.getters.lightColor)
const list = [

View File

@@ -1,5 +1,5 @@
<template>
<view>
<view :style="themeStyle">
<!-- 遍历出评价商品 -->
<view>
<view class="after-sales-goods-detail-view">
@@ -87,13 +87,15 @@
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue'
import { ref, reactive, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { commentsMemberOrder } from '@/api/members.js'
import { handleUploadAfterRead } from '@/utils/uploadHelper.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const type = 'textarea'
const border = false

View File

@@ -1,5 +1,5 @@
<template>
<view class="invoice-detail">
<view :style="themeStyle" class="invoice-detail">
<view class="block-item flex-center">
<view>
<view>
@@ -75,10 +75,14 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getReceiptDetail } from '@/api/order.js'
import { unitPrice } from '@/utils/filters.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const order = ref<Record<string, any>>({})
const title_type = ref('')

View File

@@ -1,5 +1,5 @@
<template>
<u-popup closeable border-radius="28" @close="onPopupClose" mode="bottom" height="80%" v-model:show="show">
<u-popup :style="themeStyle" closeable border-radius="28" @close="onPopupClose" mode="bottom" height="80%" v-model:show="show">
<div class="wrapper">
<!-- 发票类型 -->
@@ -94,6 +94,10 @@
</template>
<script setup lang="ts">
import { ref, reactive, computed, watch, onMounted, getCurrentInstance } from 'vue'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
interface InvoiceOption {
title: string
@@ -481,7 +485,7 @@ function submitInvoice() {
font-weight: bold;
color: $main-color;
border: 2rpx solid $main-color;
background: rgba($color: $main-color, $alpha: 0.1);
background: var(--theme-primary-10, rgba(255, 60, 42, 0.1));
}
.disabled {
color: #b5b5b6;

View File

@@ -1,5 +1,5 @@
<template>
<view class="content">
<view class="content" :style="themeStyle">
<scroll-view class="navbar" scroll-x :show-scrollbar="false">
<view class="navbar-inner">
<view v-for="(item, index) in navList" :key="index" class="nav-item"
@@ -138,6 +138,7 @@
import { ref, reactive, computed, watch, getCurrentInstance } from 'vue'
import { onLoad, onShow, onPullDownRefresh, onBackPress } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
import { getOrderList, cancelOrder, confirmReceipt } from '@/api/order.js'
import { getClearReason, getAfterSaleList } from '@/api/after-sale.js'
@@ -154,6 +155,7 @@ import { appointmentOrderStatusText, getAppointmentAllowOperation } from '@/util
const store = useStore()
const { proxy } = getCurrentInstance()!
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const lightColor = computed(() => store.getters.lightColor)
const mainColor = computed(() => store.getters.mainColor)