feat: ai店铺列表记录数据展示
This commit is contained in:
@@ -86,7 +86,7 @@
|
||||
selectedIconPath: '/static/index/blue_icon/1_1.png',
|
||||
},
|
||||
{
|
||||
pagePath: '/pages/index/aiStore',
|
||||
pagePath: '/pages/index/aiStore',//'/pages/AI/member',//
|
||||
text: 'AI店铺',
|
||||
iconPath: '/static/index/2.png',
|
||||
selectedIconPath: '/static/index/blue_icon/2_1.png',
|
||||
|
||||
@@ -16,13 +16,13 @@ import {
|
||||
} from '@/utils/common'
|
||||
import { createHotUpdate, createLoadingProgress } from '@/utils/hotUpdate'
|
||||
import { gethotupdatelist } from '@/sheep/api/index/index'
|
||||
import { setupVConsole } from '@/utils/vconsole.js'
|
||||
// import { setupVConsole } from '@/utils/vconsole.js'
|
||||
|
||||
|
||||
|
||||
export function createApp() {
|
||||
|
||||
setupVConsole();
|
||||
// setupVConsole();
|
||||
|
||||
const hotUpdate = createHotUpdate({
|
||||
progress: createLoadingProgress(),
|
||||
|
||||
@@ -301,6 +301,7 @@
|
||||
}
|
||||
const list = Array.isArray(root?.storeList) ? root.storeList : [];
|
||||
curPageData = list.map((it) => {
|
||||
console.log(it)
|
||||
const agencyTime = String(it?.agencyTime || '').trim();
|
||||
const dateOnly = agencyTime ? agencyTime.split('T')[0].split(' ')[0] : '';
|
||||
return {
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
></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 class="stats flex-between">
|
||||
@@ -29,7 +31,7 @@
|
||||
<view class="stat-title">店铺总收益</view>
|
||||
<image class="stat-icon" src="/static/aiStore/earnings.png" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="stat-value">¥{{ formatMoney(v.earnings) }}</view>
|
||||
<view class="stat-value">¥{{ $fen2yuan(v.earnings) }}</view>
|
||||
</view>
|
||||
<view class="stat">
|
||||
<view class="stat-head flex-between">
|
||||
@@ -46,6 +48,7 @@
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const props = defineProps({
|
||||
list: {
|
||||
@@ -62,12 +65,6 @@
|
||||
|
||||
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 shopId = item?.id ?? '';
|
||||
const name = item?.name ?? '';
|
||||
|
||||
+91
-37
@@ -41,53 +41,42 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { reactive, ref } from 'vue';
|
||||
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 shareTop = `${statusBarHeight + 8}px`;
|
||||
|
||||
const shopId = ref('');
|
||||
const skuId = ref('');
|
||||
const name = ref('');
|
||||
const cover = ref('');
|
||||
|
||||
const recordList = ref([
|
||||
{
|
||||
id: 1,
|
||||
title: '卓玛阳光防断洗发水',
|
||||
statusText: '已完成',
|
||||
progress: 72,
|
||||
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,
|
||||
},
|
||||
]);
|
||||
const recordList = ref([]);
|
||||
const state = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
loading: false,
|
||||
finished: false,
|
||||
});
|
||||
|
||||
onLoad((query) => {
|
||||
shopId.value = query?.shopId ?? '';
|
||||
skuId.value = query?.skuId ?? query?.shopId ?? '';
|
||||
name.value = query?.name ?? '';
|
||||
// cover.value = query?.cover ?? '';
|
||||
if (name.value) {
|
||||
recordList.value = recordList.value.map((r) => ({ ...r, title: name.value }));
|
||||
}
|
||||
cover.value = query?.cover ?? '';
|
||||
fetchList(true);
|
||||
});
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
fetchList(true).finally(() => {
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
});
|
||||
|
||||
onReachBottom(() => {
|
||||
fetchList(false);
|
||||
});
|
||||
|
||||
const formatMoney = (value) => {
|
||||
@@ -96,6 +85,71 @@
|
||||
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 = () => {
|
||||
uni.showToast({ title: '分享功能开发中', icon: 'none' });
|
||||
};
|
||||
|
||||
@@ -132,6 +132,14 @@ export function getOrderPage(params: any) {
|
||||
params
|
||||
})
|
||||
}
|
||||
// 店铺订单列表 aishop/order/aiShopPage
|
||||
export function getAiShopPage(params: any) {
|
||||
return request({
|
||||
url: '/aishop/order/aiShopPage',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 取消订单 aishop/order/cancel
|
||||
export function cancelOrder(params: any) {
|
||||
return request({
|
||||
@@ -281,4 +289,3 @@ export function aiPendingShipment(params : any) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
|
||||
export function go(url, params={}) {
|
||||
// 将对象转换为查询字符串
|
||||
params = Object.keys(params).map(key => `${key}=${params[key]}`).join('&')
|
||||
@@ -19,4 +18,4 @@ export function toast(msg) {
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user