需求:小程序端代码要同时同步到服务器与 git 远程仓库,此前前端仅存在于本地目录(无 remote,从未推送), 服务器与 gitcode 上只有后端。现并入本仓库,复用现有「push 即部署」链路,一次推送双端落地。 - 新增 uniapp/:小程序端源码全量快照(150 文件 / 1.2M) pages(13 页面) · components(fc-navbar/fc-tabbar/fc-post-card/fc-empty) · common(api·utils·mock·assets·store·config) · static(74 图标 + 3 轮播插画 + LOGO) · docs(01-04 交付文档) · tests(零依赖全链路用例) · tools(图标/主题/轮播配图生成脚本) - 明确排除:AGENTS.md(含后台密码、服务器 root 密码、小程序 AppSecret,切勿入库)、 unpackage/(构建产物,由 uniapp/.gitignore 忽略)、node_modules、.DS_Store、*.log - .gitignore 新增 /uniapp/AGENTS.md 兜底(与根 /AGENTS.md、/fluniapp/ 同一约定) - README.md 增补「本项目结构 + 部署链路」章节,说明 uniapp/ 为源码快照、 小程序真正上线仍需微信开发者工具 cli upload 说明:本次为源码快照,未携带前端本地仓库历史——其历史提交中含 AGENTS.md 凭据, 若做 subtree 合并会把密码永久写入本仓库历史,故采用快照方式。
220 行
5.0 KiB
Vue
220 行
5.0 KiB
Vue
<template>
|
||
<view class="orders fc-page">
|
||
<view class="orders__tabs">
|
||
<view v-for="t in tabs" :key="t.value" class="orders__tab"
|
||
:class="{ 'orders__tab--active': type === t.value }" @click="type = t.value">
|
||
<text>{{ t.label }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<fc-empty v-if="!list.length" icon="receipt" text="暂无订单记录" />
|
||
|
||
<view v-else class="orders__list">
|
||
<view v-for="o in list" :key="o.id" class="orders__item">
|
||
<view class="orders__item-head">
|
||
<text class="orders__no">订单号:{{ o.orderNo }}</text>
|
||
<text class="orders__status" :class="`orders__status--${o.status}`">{{ statusText(o.status) }}</text>
|
||
</view>
|
||
<view class="orders__item-body">
|
||
<view class="orders__icon">
|
||
<image class="fc-icon fc-icon--lg" :src="iconUrl(orderIconKey(o.type))" mode="aspectFit" />
|
||
</view>
|
||
<view class="orders__info">
|
||
<text class="orders__title">{{ o.title }}</text>
|
||
<text class="orders__time">{{ timeText(o.createdAt) }}</text>
|
||
</view>
|
||
<view class="fc-price">
|
||
<text class="fc-price__symbol">¥</text>
|
||
<text class="orders__amount">{{ o.amount }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="orders__item-foot">
|
||
<text class="orders__pay-type">{{ payText(o.payType) }}</text>
|
||
<view v-if="o.status === 'pending'" class="orders__btn" @click="payOrder(o)"><text>去支付</text></view>
|
||
<view v-else class="orders__btn orders__btn--ghost" @click="detail(o)"><text>查看详情</text></view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import FcEmpty from '@/components/fc-empty/fc-empty.vue'
|
||
import memberApi from '@/common/api/member.js'
|
||
import { ORDER_TEXT, ORDER_ICON_KEY } from '@/common/constants/ui.js'
|
||
import { formatTime } from '@/common/utils/format.js'
|
||
import { iconUrl, loadUiConfig } from '@/common/store/ui.js'
|
||
|
||
export default {
|
||
components: { FcEmpty },
|
||
data() {
|
||
return {
|
||
type: 'all',
|
||
all: [],
|
||
tabs: [
|
||
{ label: '全部', value: 'all' },
|
||
{ label: '发布订单', value: 'post' },
|
||
{ label: '会员订单', value: 'member' },
|
||
{ label: '充值订单', value: 'recharge' },
|
||
],
|
||
}
|
||
},
|
||
computed: {
|
||
list() {
|
||
return this.type === 'all' ? this.all : this.all.filter((o) => o.type === this.type)
|
||
},
|
||
},
|
||
onLoad() {
|
||
loadUiConfig()
|
||
this.fetch()
|
||
},
|
||
methods: {
|
||
iconUrl,
|
||
async fetch() {
|
||
try {
|
||
const res = await memberApi.orders({ page: 1, size: 50 })
|
||
this.all = res.list
|
||
} catch (e) {
|
||
uni.showToast({ title: '订单加载失败', icon: 'none' })
|
||
}
|
||
},
|
||
statusText(s) {
|
||
return ORDER_TEXT[s] || s
|
||
},
|
||
payText(t) {
|
||
return t === 'balance' ? '余额支付' : '微信支付'
|
||
},
|
||
timeText(t) {
|
||
return formatTime(t)
|
||
},
|
||
orderIconKey(t) {
|
||
return ORDER_ICON_KEY[t] || 'order-other'
|
||
},
|
||
payOrder(o) {
|
||
uni.showToast({ title: '正在调起支付…', icon: 'none' })
|
||
setTimeout(() => {
|
||
o.status = 'paid'
|
||
uni.showToast({ title: '支付成功', icon: 'none' })
|
||
}, 600)
|
||
},
|
||
detail(o) {
|
||
uni.showModal({ title: o.title, content: `订单号:${o.orderNo}\n金额:¥${o.amount}`, showCancel: false })
|
||
},
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.orders__tabs {
|
||
display: flex;
|
||
background: #ffffff;
|
||
border-bottom: 2rpx solid $fc-border;
|
||
}
|
||
.orders__tab {
|
||
flex: 1;
|
||
height: 88rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: $fc-font-sm;
|
||
color: $fc-text-secondary;
|
||
&--active {
|
||
color: $fc-primary-text;
|
||
font-weight: 700;
|
||
position: relative;
|
||
}
|
||
}
|
||
.orders__list {
|
||
padding: 20rpx 0;
|
||
}
|
||
.orders__item {
|
||
margin: 0 24rpx 20rpx;
|
||
padding: 24rpx;
|
||
background: #ffffff;
|
||
border-radius: $fc-radius-lg;
|
||
box-shadow: $fc-shadow;
|
||
}
|
||
.orders__item-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
.orders__no {
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-placeholder;
|
||
}
|
||
.orders__status {
|
||
font-size: $fc-font-sm;
|
||
font-weight: 600;
|
||
color: $fc-primary-text;
|
||
&--paid {
|
||
color: $fc-success;
|
||
}
|
||
&--pending {
|
||
color: $fc-warning;
|
||
}
|
||
&--refunded {
|
||
color: $fc-danger;
|
||
}
|
||
}
|
||
.orders__item-body {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-top: 20rpx;
|
||
}
|
||
.orders__icon {
|
||
width: 96rpx;
|
||
height: 96rpx;
|
||
flex: 0 0 96rpx;
|
||
border-radius: 20rpx;
|
||
background: $fc-gradient-soft;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.orders__info {
|
||
flex: 1;
|
||
margin-left: 20rpx;
|
||
}
|
||
.orders__title {
|
||
display: block;
|
||
font-size: $fc-font;
|
||
font-weight: 600;
|
||
color: $fc-text;
|
||
}
|
||
.orders__time {
|
||
display: block;
|
||
margin-top: 8rpx;
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-placeholder;
|
||
}
|
||
.orders__amount {
|
||
font-size: 36rpx;
|
||
}
|
||
.orders__item-foot {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-top: 20rpx;
|
||
padding-top: 20rpx;
|
||
border-top: 2rpx solid $fc-border;
|
||
}
|
||
.orders__pay-type {
|
||
font-size: $fc-font-xs;
|
||
color: $fc-text-secondary;
|
||
}
|
||
.orders__btn {
|
||
padding: 12rpx 32rpx;
|
||
border-radius: $fc-radius-pill;
|
||
background: $fc-gradient-primary;
|
||
color: $fc-primary-ink;
|
||
font-size: $fc-font-sm;
|
||
font-weight: 600;
|
||
&--ghost {
|
||
background: #ffffff;
|
||
border: 2rpx solid $fc-primary-text;
|
||
color: $fc-primary-text;
|
||
}
|
||
}
|
||
</style>
|