feat: 验证码

This commit is contained in:
2026-06-01 17:26:13 +08:00
parent 4d16af0ad6
commit 6e6d41a25c
11 changed files with 385 additions and 277 deletions
+2 -2
View File
@@ -7,7 +7,7 @@
<view class="container">
<view class="card balance-card">
<view class="balance-label">当前钱包余额</view>
<view class="balance-label">当前可提现金额</view>
<view class="balance-value">{{ $fen2yuan(walletBalanceCents || 0) }}</view>
</view>
@@ -107,7 +107,7 @@
const refreshWallet = async () => {
const res = await payApi.getWallet().catch(() => ({ code: -1 }));
if (res?.code === 0) walletBalanceCents.value = res?.data?.balance ?? 0;
if (res?.code === 0) walletBalanceCents.value = res?.data?.withdrawAmount ?? 0;
};
const onAmountBlur = () => {
+328 -132
View File
@@ -1,163 +1,359 @@
<template>
<s-pages title="AI店铺" tabbar="/pages/index/aiStore" :showLeftButton="false">
<view class="ai-store-page" style="min-height: 100vh">
<view class="search_box flex-between">
<view class="flex-center flex1 search_input">
<image style="width: 36rpx; height: 36rpx" src="/static/icon/search1.png" mode="scaleToFill" />
<input
v-model="keyword"
class="flex1 input"
type="text"
placeholder="搜索店铺.."
placeholder-style="font-size:25rpx;color:#fff"
/>
<s-pages title="AI店铺" navPreset="blue" tabbar="/pages/index/aiStore" :showLeftButton="false">
<view class="ai-store-page h100 flex-column">
<view class="top-area">
<view class="tab-header">
<view
v-for="(tab, i) in nav"
:key="tab.id"
class="tab-item"
:class="{ active: index === i }"
@click="navChange(i)"
>
{{ tab.name }}
</view>
<view class="tab-line" :style="{ left: index === 0 ? '25%' : '75%' }"></view>
</view>
<view class="search_btn flex-center" @click="onSearch">搜索</view>
</view>
<view class="tab_box">
<view class="tab-wrap">
<!-- <view class="tab-header">
<view
class="tab-item"
v-for="(item, index) in tabList"
:key="index"
@click="changeTab(index)"
:class="{ active: tabIndex === index }"
>
{{ item.name }}
</view>
<view class="tab-line" :style="{ left: `${tabIndex * 50 + 17.5}%` }"></view>
</view> -->
<view class="tab-content">
<view v-if="tabIndex === 0" class="tab-panel">
<view class="panel-title">选品广场</view>
<view class="panel-desc">这里展示可选商品/店铺内容</view>
</view>
<view v-else class="tab-panel tab-panel-no-padding">
<aistore_tab2 />
</view>
<view class="search-wrap flex-center">
<view class="search-input flex1 flex-center">
<uni-icons class="m-r-16" type="search" color="#9AA7C7" size="18" />
<uni-easyinput
class="flex1"
v-model="searchText"
type="text"
placeholder="搜索想要的商品"
:inputBorder="false"
:styles="{ color: '#333', fontSize: '28rpx' }"
placeholderStyle="color:#9AA7C7;font-size:28rpx;"
@blur="search"
@clear="clearSearch"
/>
</view>
<view class="search-btn flex-center" @click="search">
<uni-icons type="search" color="#FFFFFF" size="18" />
</view>
</view>
<view class="m-t-16 m-b-8" v-if="timeRound.length && index === 0">
<scroll-view scroll-x class="time-scroll">
<view class="flex">
<view
v-for="(item, i) in timeRound"
:key="item.id || i"
class="timeNav m-r-20"
:class="{ activeTime: selectedTimeId === item.id }"
@click="changeTimeRound(item, i)"
>
{{ item.name }}
</view>
</view>
</scroll-view>
</view>
</view>
<view class="list-wrap flex1">
<card_pages
ref="pageCommodity"
:navList="nav"
:currentTab="index"
@upCallback="getData"
:height="height"
:oneShow="true"
>
<template #content>
<aistore_tab1 v-if="index === 0" :list="dataList" @addCar="addCar" @update="update" @shipment="shipment" />
<aistore_tab2 v-if="index === 1" :list="dataList" :source="index" @addCar="addCar" @update="update" @shipment="shipment" />
</template>
</card_pages>
</view>
</view>
<view v-if="payShow">
<card_payment
ref="paymentRef"
@updataList="clearSearch"
@updatePrice="updatePrice"
:addShow="addShow"
:minSalesCountShow="navName === '折扣区'"
/>
</view>
</s-pages>
</template>
<script setup>
import { ref } from 'vue';
import { ref, watch } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import * as api from '@/sheep/api/ai/index';
import card_pages from '@/components/card_pages/card_pages';
import card_payment from '@/components/card_payment/card_payment';
import aistore_tab1 from './components/aistore_tab1.vue';
import aistore_tab2 from './components/aistore_tab2.vue';
const keyword = ref('');
const tabList = ref([{ name: '选品广场' }, { name: '我的店铺' }]);
const tabIndex = ref(1);
const searchText = ref('');
const changeTab = (index) => {
tabIndex.value = index;
const search = () => {
pageCommodity.value?.downCallback();
};
const onSearch = () => {};
const clearSearch = () => {
searchText.value = '';
pageCommodity.value?.downCallback();
};
const timeRound = ref([]);
const selectedTimeId = ref(null);
const navName = ref('');
function changeTimeRound(e) {
navName.value = e.name;
selectedTimeId.value = e?.id ?? null;
pageCommodity.value?.downCallback();
}
function getSpuTimeList() {
api.getSpuTimeList({}).then((res) => {
if (res.code === 0) {
timeRound.value = res.data || [];
selectedTimeId.value = timeRound.value?.[0]?.id ?? null;
navName.value = timeRound.value?.[0]?.name ?? '';
}
});
}
const getCartList = async () => {
const res = await api.getShopCartList({});
if (res.code === 0) {
payShow.value = Boolean(res.data.length || addShow.value);
}
};
onShow(() => {
getSpuTimeList();
getCartList();
});
const update = () => {
pageCommodity.value?.downCallback();
};
const system = uni.getSystemInfoSync();
const baseHeight =
system.windowHeight -
system.statusBarHeight -
uni.upx2px(88) -
uni.upx2px(76) -
uni.upx2px(48) -
uni.upx2px(20);
const index = ref(0);
const height = ref(`${baseHeight}px`);
const payShow = ref(false);
const addShow = ref(false);
watch(
() => payShow.value,
() => {
const extra = payShow.value ? uni.upx2px(128) : 0;
height.value = `${baseHeight - extra}px`;
},
{ immediate: true },
);
const nav = ref([
{ name: '选品广场', id: 1 },
{ name: '我的店铺', id: 2 },
]);
const pageCommodity = ref(null);
const dataList = ref([]);
const getData = async (mescroll) => {
if (mescroll?.dataObj?.index !== index.value) return;
let res = null;
if (index.value) {
res = await api.getOrderPage({
pageNo: mescroll?.num || 1,
pageSize: mescroll?.size || 10,
keyWord: searchText.value,
});
} else {
res = await api.getSpuPage({
pageNo: mescroll?.num || 1,
pageSize: mescroll?.size || 10,
keyWord: searchText.value,
timeId: selectedTimeId.value,
...mescroll.params,
});
}
if (res.code !== 0) {
pageCommodity.value?.getState(false);
return;
}
let curPageData = [];
if (index.value) {
const list = res.data.list || [];
const arr = [];
list.forEach((e) => {
e.items1 = JSON.parse(JSON.stringify(e.items));
if (e?.items?.length) {
e.items.forEach((item) => {
item.skuArr = item.items;
item.status = e.status;
item.id = item.spuId;
item.spuId = e.payOrderId;
item.shoppingPlazaId = e.roundTimeId;
item.items1 = e.items1;
arr.push(item);
});
}
});
if (arr.length) {
arr.forEach((e) => {
if (e.skuArr && e.skuArr.length) {
e.skuArr.forEach((item) => {
item.propertyText = '';
if (item?.properties) {
item.properties.forEach((e1) => {
item.propertyText += e1.valueName + ' ';
});
}
});
}
});
}
curPageData = arr;
} else {
curPageData = res.data?.list || [];
}
if (mescroll?.num === 1) dataList.value = [];
dataList.value = dataList.value.concat(curPageData);
pageCommodity.value?.getState(true, curPageData.length);
};
const paymentRef = ref(null);
const addCar = (data) => {
payShow.value = true;
addShow.value = true;
setTimeout(() => {
paymentRef.value?.addCar(data);
}, 500);
};
const navChange = (i) => {
index.value = i;
dataList.value = [];
pageCommodity.value?.downCallback();
payShow.value = !index.value;
};
const updatePrice = (val) => {
addShow.value = val;
getCartList();
};
function shipment() {
pageCommodity.value?.downCallback();
}
</script>
<style lang="scss" scoped>
$primary-start: #ff7a45;
$primary-end: #ff4d7cc6;
.ai-store-page {
// background: #fff5f1;
min-height: 100vh;
background: #2556ec;
}
.search_box {
margin-top: 30rpx;
padding: 20rpx;
.search_input {
height: 72rpx;
border-radius: 20rpx;
padding-left: 28rpx;
margin-left: 24rpx;
border: 4rpx solid rgba(255, 122, 69, 0.35);
background: linear-gradient(90deg, rgba(255, 122, 69, 0.25), rgba(255, 77, 125, 0.25));
.input {
margin-left: 16rpx;
height: 100%;
color: #ffffff;
}
}
.search_btn {
width: 120rpx;
height: 72rpx;
font-size: 25rpx;
margin: 0 20rpx;
border-radius: 20rpx;
color: #fff;
background: linear-gradient(90deg, $primary-start, $primary-end);
}
.top-area {
padding: 24rpx 24rpx 0;
}
.tab_box {
.tab-wrap {
width: 100%;
}
.tab-header {
position: relative;
display: flex;
justify-content: center;
margin-top: 12rpx;
}
.tab-header {
position: relative;
display: flex;
width: 100%;
border-bottom: 1rpx solid rgba(255, 255, 255, 0.55);
background: linear-gradient(90deg, $primary-start, $primary-end);
}
.tab-item {
width: 50%;
text-align: center;
font-size: 34rpx;
line-height: 48rpx;
padding: 16rpx 0 22rpx;
color: rgba(255, 255, 255, 0.7);
.tab-item {
flex: 1;
padding: 30rpx 0;
font-size: 32rpx;
text-align: center;
color: rgba(255, 255, 255, 0.75);
&.active {
color: #fff;
font-weight: bold;
}
}
.tab-line {
position: absolute;
bottom: 0;
width: 15%;
height: 6rpx;
background: #fff;
border-radius: 10rpx 10rpx 0 0;
transition: left 0.3s ease;
}
.tab-content {
padding: 0 24rpx;
}
.tab-panel {
padding: 28rpx;
border-radius: 20rpx;
background: #ffffff;
}
.tab-panel-no-padding {
padding: 0;
background: transparent;
}
.panel-title {
font-size: 32rpx;
&.active {
color: #ffffff;
font-weight: 700;
color: #333333;
}
}
.panel-desc {
margin-top: 12rpx;
font-size: 26rpx;
color: #666666;
}
.tab-line {
position: absolute;
bottom: 6rpx;
width: 72rpx;
height: 6rpx;
background: #fff;
border-radius: 6rpx;
transform: translateX(-50%);
transition: left 0.25s ease;
}
.search-wrap {
margin-top: 22rpx;
padding: 0 10rpx;
}
.search-input {
height: 76rpx;
background: #ffffff;
border-radius: 40rpx;
padding: 0 28rpx;
}
.search-btn {
width: 76rpx;
height: 76rpx;
margin-left: 18rpx;
border-radius: 38rpx;
background: linear-gradient(to bottom right, #2c8cfa 0%, #3d5efb 100%);
}
.time-scroll {
width: 100%;
white-space: nowrap;
}
.timeNav {
display: inline-flex;
align-items: center;
height: 56rpx;
padding: 0 22rpx;
border-radius: 28rpx;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.85);
background: rgba(255, 255, 255, 0.15);
}
.activeTime {
color: #2556ec;
background: #ffffff;
font-weight: 700;
}
.list-wrap {
margin-top: 18rpx;
background: #f1f5ff;
border-radius: 30rpx 30rpx 0 0;
padding: 0 24rpx;
overflow: hidden;
}
:deep(.ai-button1) {
background: linear-gradient(to bottom right, #2c8cfa 0%, #3d5efb 100%) !important;
}
</style>
+20
View File
@@ -0,0 +1,20 @@
<template>
<view class="p-t-16 p-b-24">
<view class="m-b-24" v-for="(v, i) in list" :key="i">
<aiOrder :data="v" @addCar="emit('addCar', $event)" :source="0" @update="emit('update')" @shipment="emit('shipment')" />
</view>
</view>
</template>
<script setup>
import aiOrder from '@/components/ai_order/ai_order';
defineProps({
list: {
type: Array,
default: () => [],
},
});
const emit = defineEmits(['addCar', 'update', 'shipment']);
</script>
+20 -138
View File
@@ -1,151 +1,33 @@
<template>
<view class="content">
<view class="border-card" v-for="item in list" :key="item.name">
<view class="card_top flex-between">
<view class="title">{{ item.name }}</view>
<view class="QR_code_img">
<image src="/static/index/2.png" mode="scaleToFill"></image>
</view>
</view>
<view class="info_text flex-row-start">
等级:
<view class="tag">{{ item.grade }}</view>
<text>|</text>
达成时间:{{ item.createTime }}
</view>
<view class="chart_box flex-between">
<view class="chart_item">
<view class="chart_title flex-between">
<view>店铺总收益</view>
<image src="/static/aiStore/earnings.png" mode="scaleToFill"></image>
</view>
<view class="num_text">¥{{ item.price || 0.0 }}</view>
</view>
<view class="chart_item">
<view class="chart_title flex-between">
<view>绿色积分</view>
<image src="/static/aiStore/leaf.png" mode="scaleToFill"></image>
</view>
<view class="num_text">{{ item.leaf }}</view>
</view>
</view>
<view class="p-t-16 p-b-24">
<view class="m-b-24" v-for="(v, i) in list" :key="i">
<aiOrder
:data="v"
@addCar="emit('addCar', $event)"
:source="source"
@update="emit('update')"
@shipment="emit('shipment')"
/>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
import aiOrder from '@/components/ai_order/ai_order';
const list = ref([
{
name: '卓玛阳光防断洗发水',
price: 220.0,
leaf: 4200,
grade: '超级店长',
createTime: '2026-01-15 09:15:00',
defineProps({
list: {
type: Array,
default: () => [],
},
{
name: '治山贡鸡源头旗舰店',
price: 870.0,
leaf: 5600,
grade: '高级店长',
createTime: '2026-01-15 09:15:00',
source: {
type: Number,
default: 1,
},
]);
});
const emit = defineEmits(['addCar', 'update', 'shipment']);
</script>
<style lang="scss" scoped>
$primary-start: #ff7a45c6;
$primary-end: #ff4d7c7d;
.content {
padding: 0 10rpx 30rpx;
}
.border-card {
margin: 30rpx 0;
padding: 30rpx 40rpx;
border-radius: 22rpx;
color: #ffffff;
background: linear-gradient(90deg, $primary-start 0%, $primary-end 100%);
box-sizing: border-box;
}
.card_top {
.title {
font-size: 35rpx;
position: relative;
padding-left: 35rpx;
&::before {
content: '';
width: 20rpx;
height: 20rpx;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
background: rgba(255, 255, 255, 0.95);
border-radius: 50%;
}
}
.QR_code_img {
width: 55rpx;
height: 55rpx;
padding: 10rpx;
border: rgba(255, 255, 255, 0.9) 1rpx solid;
border-radius: 10rpx;
box-sizing: border-box;
image {
width: 100%;
height: 100%;
}
}
}
.info_text {
font-size: 20rpx;
color: rgba(255, 255, 255, 0.85);
margin: 10rpx 0 20rpx;
.tag {
padding: 5rpx 15rpx;
color: $primary-start;
border-radius: 15rpx;
background: #fff;
}
text {
margin: 0 25rpx;
opacity: 0.9;
}
}
.chart_box {
.chart_item {
width: 48%;
padding: 20rpx 30rpx 10rpx;
border-radius: 20rpx;
box-sizing: border-box;
border: rgba(255, 255, 255, 0.6) 1rpx solid;
background: rgba(255, 255, 255, 0.18);
.chart_title {
font-size: 20rpx;
image {
width: 30rpx;
height: 30rpx;
margin-left: 10rpx;
}
}
.num_text {
font-size: 40rpx;
margin: 10rpx 0;
}
}
}
</style>