mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-13 12:28:54 +08:00
refactor: 四端完成 Options API → script setup + vuex → pinia 迁移
- buyer(95) / seller(169) / im(53) / manager(280) 共 597 个组件全部从 Options API 转换为 <script setup> - 四端 vuex 全部移除,状态管理统一迁移至 pinia 4(stores/ 目录) - util.js 等基础设施去除 vm 首参依赖;全局属性($Message/$filters 等)在 script 内改为具名导入 - 被外部 ref 访问的公共组件均已补齐 defineExpose(清单见各端 MIGRATION-VUE3.md) - 各端 eslint 启用 vue/component-api-style 防止新代码回退 Options API - 四端 yarn build 全部通过;迁移约定与注意事项已更新至各端 MIGRATION-VUE3.md
This commit is contained in:
@@ -40,88 +40,80 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script setup>
|
||||
import { ref, watch } from "vue";
|
||||
import * as API_Statistics from "@/api/statistics";
|
||||
import affixTime from "@/components/affix-time";
|
||||
import { QuestionFilled } from "@element-plus/icons-vue";
|
||||
|
||||
export default {
|
||||
components: { affixTime, QuestionFilled },
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
searchType: "LAST_SEVEN",
|
||||
year: "",
|
||||
month: "",
|
||||
storeId: "",
|
||||
},
|
||||
overview: {},
|
||||
activityMetrics: [
|
||||
{ key: "couponActiveNum", label: "进行中优惠券" },
|
||||
{ key: "seckillActiveNum", label: "进行中秒杀" },
|
||||
{ key: "pintuanActiveNum", label: "进行中拼团" },
|
||||
{ key: "fullDiscountActiveNum", label: "进行中满减" },
|
||||
{ key: "kanjiaActiveNum", label: "进行中砍价商品" },
|
||||
{ key: "pointsGoodsActiveNum", label: "进行中积分商品" },
|
||||
],
|
||||
couponMetrics: [
|
||||
{
|
||||
key: "couponPublishNum",
|
||||
label: "优惠券发放量",
|
||||
tip: "优惠券配置的累计发放数量",
|
||||
},
|
||||
{
|
||||
key: "couponReceivedNum",
|
||||
label: "优惠券领取量",
|
||||
tip: "客户已领取的优惠券数量",
|
||||
},
|
||||
{
|
||||
key: "couponUsedNum",
|
||||
label: "优惠券核销量",
|
||||
tip: "客户已使用的优惠券数量",
|
||||
},
|
||||
{
|
||||
key: "discountAmount",
|
||||
label: "活动优惠总额",
|
||||
isMoney: true,
|
||||
tip: "统计周期内订单产生的优惠金额合计",
|
||||
},
|
||||
],
|
||||
};
|
||||
const params = ref({
|
||||
searchType: "LAST_SEVEN",
|
||||
year: "",
|
||||
month: "",
|
||||
storeId: "",
|
||||
});
|
||||
const overview = ref({});
|
||||
const activityMetrics = ref([
|
||||
{ key: "couponActiveNum", label: "进行中优惠券" },
|
||||
{ key: "seckillActiveNum", label: "进行中秒杀" },
|
||||
{ key: "pintuanActiveNum", label: "进行中拼团" },
|
||||
{ key: "fullDiscountActiveNum", label: "进行中满减" },
|
||||
{ key: "kanjiaActiveNum", label: "进行中砍价商品" },
|
||||
{ key: "pointsGoodsActiveNum", label: "进行中积分商品" },
|
||||
]);
|
||||
const couponMetrics = ref([
|
||||
{
|
||||
key: "couponPublishNum",
|
||||
label: "优惠券发放量",
|
||||
tip: "优惠券配置的累计发放数量",
|
||||
},
|
||||
watch: {
|
||||
params: {
|
||||
handler() {
|
||||
this.loadData();
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
{
|
||||
key: "couponReceivedNum",
|
||||
label: "优惠券领取量",
|
||||
tip: "客户已领取的优惠券数量",
|
||||
},
|
||||
methods: {
|
||||
clickBreadcrumb(item) {
|
||||
this.params = {
|
||||
searchType: item.searchType || "",
|
||||
year: item.year || "",
|
||||
month: item.month || "",
|
||||
storeId: item.storeId || "",
|
||||
startTime: item.startTime || "",
|
||||
endTime: item.endTime || "",
|
||||
};
|
||||
},
|
||||
formatNumber(val) {
|
||||
if (val == null || val === "") return 0;
|
||||
const num = Number(val);
|
||||
return Number.isNaN(num) ? 0 : Math.round(num);
|
||||
},
|
||||
async loadData() {
|
||||
const res = await API_Statistics.getMarketingOverview({ ...this.params });
|
||||
if (res && res.success) {
|
||||
this.overview = res.result || {};
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "couponUsedNum",
|
||||
label: "优惠券核销量",
|
||||
tip: "客户已使用的优惠券数量",
|
||||
},
|
||||
};
|
||||
{
|
||||
key: "discountAmount",
|
||||
label: "活动优惠总额",
|
||||
isMoney: true,
|
||||
tip: "统计周期内订单产生的优惠金额合计",
|
||||
},
|
||||
]);
|
||||
|
||||
watch(
|
||||
params,
|
||||
() => {
|
||||
loadData();
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
function clickBreadcrumb(item) {
|
||||
params.value = {
|
||||
searchType: item.searchType || "",
|
||||
year: item.year || "",
|
||||
month: item.month || "",
|
||||
storeId: item.storeId || "",
|
||||
startTime: item.startTime || "",
|
||||
endTime: item.endTime || "",
|
||||
};
|
||||
}
|
||||
function formatNumber(val) {
|
||||
if (val == null || val === "") return 0;
|
||||
const num = Number(val);
|
||||
return Number.isNaN(num) ? 0 : Math.round(num);
|
||||
}
|
||||
async function loadData() {
|
||||
const res = await API_Statistics.getMarketingOverview({ ...params.value });
|
||||
if (res && res.success) {
|
||||
overview.value = res.result || {};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user