feat: ai店铺列表记录数据展示
This commit is contained in:
@@ -86,7 +86,7 @@
|
|||||||
selectedIconPath: '/static/index/blue_icon/1_1.png',
|
selectedIconPath: '/static/index/blue_icon/1_1.png',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pagePath: '/pages/index/aiStore',
|
pagePath: '/pages/index/aiStore',//'/pages/AI/member',//
|
||||||
text: 'AI店铺',
|
text: 'AI店铺',
|
||||||
iconPath: '/static/index/2.png',
|
iconPath: '/static/index/2.png',
|
||||||
selectedIconPath: '/static/index/blue_icon/2_1.png',
|
selectedIconPath: '/static/index/blue_icon/2_1.png',
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ import {
|
|||||||
} from '@/utils/common'
|
} from '@/utils/common'
|
||||||
import { createHotUpdate, createLoadingProgress } from '@/utils/hotUpdate'
|
import { createHotUpdate, createLoadingProgress } from '@/utils/hotUpdate'
|
||||||
import { gethotupdatelist } from '@/sheep/api/index/index'
|
import { gethotupdatelist } from '@/sheep/api/index/index'
|
||||||
import { setupVConsole } from '@/utils/vconsole.js'
|
// import { setupVConsole } from '@/utils/vconsole.js'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function createApp() {
|
export function createApp() {
|
||||||
|
|
||||||
setupVConsole();
|
// setupVConsole();
|
||||||
|
|
||||||
const hotUpdate = createHotUpdate({
|
const hotUpdate = createHotUpdate({
|
||||||
progress: createLoadingProgress(),
|
progress: createLoadingProgress(),
|
||||||
|
|||||||
@@ -301,6 +301,7 @@
|
|||||||
}
|
}
|
||||||
const list = Array.isArray(root?.storeList) ? root.storeList : [];
|
const list = Array.isArray(root?.storeList) ? root.storeList : [];
|
||||||
curPageData = list.map((it) => {
|
curPageData = list.map((it) => {
|
||||||
|
console.log(it)
|
||||||
const agencyTime = String(it?.agencyTime || '').trim();
|
const agencyTime = String(it?.agencyTime || '').trim();
|
||||||
const dateOnly = agencyTime ? agencyTime.split('T')[0].split(' ')[0] : '';
|
const dateOnly = agencyTime ? agencyTime.split('T')[0].split(' ')[0] : '';
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
></view>
|
></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="first-time">首次代理时间:{{ v.createTime }}</view>
|
<view class="first-time"
|
||||||
|
>首次代理时间:{{ sheep.$helper.timeFormat(v.createTime, 'yy-mm-dd hh:MM:ss') }}</view
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="stats flex-between">
|
<view class="stats flex-between">
|
||||||
@@ -29,7 +31,7 @@
|
|||||||
<view class="stat-title">店铺总收益</view>
|
<view class="stat-title">店铺总收益</view>
|
||||||
<image class="stat-icon" src="/static/aiStore/earnings.png" mode="aspectFit" />
|
<image class="stat-icon" src="/static/aiStore/earnings.png" mode="aspectFit" />
|
||||||
</view>
|
</view>
|
||||||
<view class="stat-value">¥{{ formatMoney(v.earnings) }}</view>
|
<view class="stat-value">¥{{ $fen2yuan(v.earnings) }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="stat">
|
<view class="stat">
|
||||||
<view class="stat-head flex-between">
|
<view class="stat-head flex-between">
|
||||||
@@ -46,6 +48,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import sheep from '@/sheep';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: {
|
list: {
|
||||||
@@ -62,12 +65,6 @@
|
|||||||
|
|
||||||
const renderList = computed(() => (Array.isArray(props.list) ? props.list : []));
|
const renderList = computed(() => (Array.isArray(props.list) ? props.list : []));
|
||||||
|
|
||||||
const formatMoney = (value) => {
|
|
||||||
const num = Number(value);
|
|
||||||
if (!Number.isFinite(num)) return '0.00';
|
|
||||||
return num.toFixed(2);
|
|
||||||
};
|
|
||||||
|
|
||||||
const toListRecord = (item) => {
|
const toListRecord = (item) => {
|
||||||
const shopId = item?.id ?? '';
|
const shopId = item?.id ?? '';
|
||||||
const name = item?.name ?? '';
|
const name = item?.name ?? '';
|
||||||
|
|||||||
+91
-37
@@ -41,53 +41,42 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
|
||||||
|
import sheep from '@/sheep';
|
||||||
|
import { getAiShopPage } from '@/sheep/api/ai';
|
||||||
|
import { formatOrderStatus } from '@/sheep/hooks/useGoods';
|
||||||
|
|
||||||
const statusBarHeight = uni.getSystemInfoSync()?.statusBarHeight || 0;
|
const statusBarHeight = uni.getSystemInfoSync()?.statusBarHeight || 0;
|
||||||
const shareTop = `${statusBarHeight + 8}px`;
|
const shareTop = `${statusBarHeight + 8}px`;
|
||||||
|
|
||||||
const shopId = ref('');
|
const skuId = ref('');
|
||||||
const name = ref('');
|
const name = ref('');
|
||||||
const cover = ref('');
|
const cover = ref('');
|
||||||
|
|
||||||
const recordList = ref([
|
const recordList = ref([]);
|
||||||
{
|
const state = reactive({
|
||||||
id: 1,
|
pageNo: 1,
|
||||||
title: '卓玛阳光防断洗发水',
|
pageSize: 10,
|
||||||
statusText: '已完成',
|
loading: false,
|
||||||
progress: 72,
|
finished: false,
|
||||||
qty: 137,
|
});
|
||||||
time: '2026-05-27 12:37',
|
|
||||||
total: 3000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
title: '卓玛阳光防断洗发水',
|
|
||||||
statusText: '已完成',
|
|
||||||
progress: 72,
|
|
||||||
qty: 137,
|
|
||||||
time: '2026-05-27 12:37',
|
|
||||||
total: 3000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
title: '卓玛阳光防断洗发水',
|
|
||||||
statusText: '已完成',
|
|
||||||
progress: 72,
|
|
||||||
qty: 137,
|
|
||||||
time: '2026-05-27 12:37',
|
|
||||||
total: 3000,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
onLoad((query) => {
|
onLoad((query) => {
|
||||||
shopId.value = query?.shopId ?? '';
|
skuId.value = query?.skuId ?? query?.shopId ?? '';
|
||||||
name.value = query?.name ?? '';
|
name.value = query?.name ?? '';
|
||||||
// cover.value = query?.cover ?? '';
|
cover.value = query?.cover ?? '';
|
||||||
if (name.value) {
|
fetchList(true);
|
||||||
recordList.value = recordList.value.map((r) => ({ ...r, title: name.value }));
|
});
|
||||||
}
|
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
fetchList(true).finally(() => {
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
onReachBottom(() => {
|
||||||
|
fetchList(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
const formatMoney = (value) => {
|
const formatMoney = (value) => {
|
||||||
@@ -96,6 +85,71 @@
|
|||||||
return num.toFixed(2);
|
return num.toFixed(2);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const resolveProgress = (status) => {
|
||||||
|
const s = Number(status);
|
||||||
|
if (s === 0) return 25;
|
||||||
|
if (s === 10) return 50;
|
||||||
|
if (s === 20) return 75;
|
||||||
|
if (s === 30) return 100;
|
||||||
|
if (s === 40) return 0;
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapOrderToRecord = (order) => {
|
||||||
|
const items = Array.isArray(order?.items) ? order.items : [];
|
||||||
|
const firstItem = items[0] || {};
|
||||||
|
const titleText = firstItem?.spuName || order?.no || name.value || '-';
|
||||||
|
const qty = Number(order?.productCount ?? 0) || 0;
|
||||||
|
const statusText = formatOrderStatus(order || {});
|
||||||
|
const timeText = sheep.$helper?.timeFormat
|
||||||
|
? sheep.$helper.timeFormat(order?.createTime, 'yy-mm-dd hh:MM:ss')
|
||||||
|
: String(order?.createTime || '');
|
||||||
|
const payPriceFen = Number(order?.payPrice ?? 0) || 0;
|
||||||
|
const totalYuan = payPriceFen / 100;
|
||||||
|
return {
|
||||||
|
id: order?.id,
|
||||||
|
title: titleText,
|
||||||
|
statusText,
|
||||||
|
progress: resolveProgress(order?.status),
|
||||||
|
qty,
|
||||||
|
time: timeText,
|
||||||
|
total: totalYuan,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchList = async (reset = false) => {
|
||||||
|
if (state.loading) return;
|
||||||
|
if (!skuId.value) {
|
||||||
|
uni.showToast({ title: '缺少 skuId', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!reset && state.finished) return;
|
||||||
|
state.loading = true;
|
||||||
|
try {
|
||||||
|
if (reset) {
|
||||||
|
state.pageNo = 1;
|
||||||
|
state.finished = false;
|
||||||
|
}
|
||||||
|
const res = await getAiShopPage({
|
||||||
|
skuId: String(skuId.value),
|
||||||
|
pageNo: String(state.pageNo),
|
||||||
|
pageSize: String(state.pageSize),
|
||||||
|
}).catch(() => ({ code: -1 }));
|
||||||
|
if (res?.code !== 0) return;
|
||||||
|
const list = Array.isArray(res?.data?.list) ? res.data.list : [];
|
||||||
|
const mapped = list.map(mapOrderToRecord);
|
||||||
|
if (reset) recordList.value = [];
|
||||||
|
recordList.value = recordList.value.concat(mapped);
|
||||||
|
if (list.length < state.pageSize) {
|
||||||
|
state.finished = true;
|
||||||
|
} else {
|
||||||
|
state.pageNo += 1;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
state.loading = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const onShare = () => {
|
const onShare = () => {
|
||||||
uni.showToast({ title: '分享功能开发中', icon: 'none' });
|
uni.showToast({ title: '分享功能开发中', icon: 'none' });
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -132,6 +132,14 @@ export function getOrderPage(params: any) {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 店铺订单列表 aishop/order/aiShopPage
|
||||||
|
export function getAiShopPage(params: any) {
|
||||||
|
return request({
|
||||||
|
url: '/aishop/order/aiShopPage',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
// 取消订单 aishop/order/cancel
|
// 取消订单 aishop/order/cancel
|
||||||
export function cancelOrder(params: any) {
|
export function cancelOrder(params: any) {
|
||||||
return request({
|
return request({
|
||||||
@@ -281,4 +289,3 @@ export function aiPendingShipment(params : any) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export function go(url, params={}) {
|
export function go(url, params={}) {
|
||||||
// 将对象转换为查询字符串
|
// 将对象转换为查询字符串
|
||||||
params = Object.keys(params).map(key => `${key}=${params[key]}`).join('&')
|
params = Object.keys(params).map(key => `${key}=${params[key]}`).join('&')
|
||||||
@@ -19,4 +18,4 @@ export function toast(msg) {
|
|||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user