PageSourceSearch

https://0daily.vip/assets/personal-static-cards.vue_vue_type_script_setup_true_lang-4YaDoy65.js

js 0daily.vip collected 2026-10-09 04:38:18 UTC 10,262 bytes, 244 lines download raw bytes

1import "./index-C7I5J-ck.js";
2import { E as ElRow } from "./el-row-DjtCIHVo.js";
3/* empty css                */
4import { E as ElSelect, a as ElOption } from "./el-select-Dq1fdmB2.js";
5import { E as ElCol } from "./el-col-Cm-LDI5u.js";
6/* empty css                 */
7import { d as dayjs } from "./dayjs.min-BR6FuxFk.js";
8import { c as getUserKpiStatic } from "./index-CP17BCSm.js";
9import { E as ElCard } from "./index-aTGw3FKG.js";
10import { k as defineComponent, r as ref, d as onMounted, e as watch, D as createBlock, m as openBlock, E as withCtx, N as createVNode, v as createBaseVNode, H as toDisplayString, u as unref, l as createElementBlock, f as isRef } from "./quill-vendor-Bitzq2B7.js";
11const _hoisted_1 = /* @__PURE__ */ createBaseVNode("div", { class: "w-full text-[14px] text-black/80" }, "我的目标", -1);
12const _hoisted_2 = { class: "w-full text-[32px] font-600 text-blue" };
13const _hoisted_3 = /* @__PURE__ */ createBaseVNode("div", { class: "w-full text-[14px] text-black/80" }, "我的业绩", -1);
14const _hoisted_4 = { class: "w-full text-[32px] font-600 text-green" };
15const _hoisted_5 = {
16  key: 0,
17  class: "text-red"
18};
19const _hoisted_6 = {
20  key: 1,
21  class: "text-yellow"
22};
23const _hoisted_7 = { key: 2 };
24const _hoisted_8 = { class: "w-full text-[14px] text-green" };
25const _hoisted_9 = {
26  key: 0,
27  class: "text-red"
28};
29const _hoisted_10 = {
30  key: 1,
31  class: "text-yellow"
32};
33const _hoisted_11 = { key: 2 };
34const _hoisted_12 = /* @__PURE__ */ createBaseVNode("div", { class: "w-full text-[14px] text-black/80" }, "时间筛选", -1);
35const _sfc_main = /* @__PURE__ */ defineComponent({
36  __name: "personal-static-cards",
37  props: {
38    businessUserId: {}
39  },
40  setup(__props) {
41    const props = __props;
42    const data = ref();
43    const timeSelectValue = ref();
44    const timeRange = ref();
45    const handleTimeSelectChange = (value) => {
46      if (!value) {
47        timeRange.value = void 0;
48        getData();
49        return;
50      }
51      const now = dayjs();
52      switch (value) {
53        case "q1":
54          timeRange.value = {
55            start: now.month(0).startOf("month").format("YYYY-MM-DD HH:mm:ss"),
56            end: now.month(2).endOf("month").format("YYYY-MM-DD HH:mm:ss")
57          };
58          break;
59        case "q2":
60          timeRange.value = {
61            start: now.month(3).startOf("month").format("YYYY-MM-DD HH:mm:ss"),
62            end: now.month(5).endOf("month").format("YYYY-MM-DD HH:mm:ss")
63          };
64          break;
65        case "q3":
66          timeRange.value = {
67            start: now.month(6).startOf("month").format("YYYY-MM-DD HH:mm:ss"),
68            end: now.month(8).endOf("month").format("YYYY-MM-DD HH:mm:ss")
69          };
70          break;
71        case "q4":
72          timeRange.value = {
73            start: now.month(9).startOf("month").format("YYYY-MM-DD HH:mm:ss"),
74            end: now.month(11).endOf("month").format("YYYY-MM-DD HH:mm:ss")
75          };
76          break;
77        case "year":
78          timeRange.value = {
79            start: now.startOf("year").format("YYYY-MM-DD HH:mm:ss"),
80            end: now.endOf("year").format("YYYY-MM-DD HH:mm:ss")
81          };
82          break;
83        default:
84          timeRange.value = void 0;
85          break;
86      }
87      getData();
88    };
89    const getData = async () => {
90      if (!props.businessUserId) {
91        return;
92      }
93      let range = timeRange.value;
94      if (!range) {
95        const now = dayjs();
96        const currentMonth = now.month();
97        const quarterStartMonth = Math.floor(currentMonth / 3) * 3;
98        const quarterStart = now.month(quarterStartMonth).startOf("month");
99        const quarterEnd = quarterStart.add(2, "month").endOf("month");
100        range = {
101          start: quarterStart.format("YYYY-MM-DD HH:mm:ss"),
102          end: quarterEnd.format("YYYY-MM-DD HH:mm:ss")
103        };
104      }
105      const response = await getUserKpiStatic(props.businessUserId, range);
106      data.value = response.data;
107    };
108    const getCurrentQuarter = () => {
109      const currentMonth = dayjs().month();
110      if (currentMonth >= 0 && currentMonth <= 2)
111        return "q1";
112      if (currentMonth >= 3 && currentMonth <= 5)
113        return "q2";
114      if (currentMonth >= 6 && currentMonth <= 8)
115        return "q3";
116      return "q4";
117    };
118    onMounted(() => {
119      const currentQuarter = getCurrentQuarter();
120      timeSelectValue.value = currentQuarter;
121      handleTimeSelectChange(currentQuarter);
122    });
123    const calcProgress = (targetAmount, actualAmount) => {
124      if (!targetAmount || !actualAmount) {
125        return 0;
126      }
127      return Number(actualAmount) / Number(targetAmount) * 100;
128    };
129    watch(
130      () => props.businessUserId,
131      (userId) => {
132        if (!userId) {
133          return;
134        }
135        getData();
136      },
137      { immediate: true }
138    );
139    return (_ctx, _cache) => {
140      const _component_el_card = ElCard;
141      const _component_el_col = ElCol;
142      const _component_el_option = ElOption;
143      const _component_el_select = ElSelect;
144      const _component_el_row = ElRow;
145      return openBlock(), createBlock(_component_el_row, { gutter: 24 }, {
146        default: withCtx(() => [
147          createVNode(_component_el_col, { span: 8 }, {
148            default: withCtx(() => [
149              createVNode(_component_el_card, {
150                shadow: "hover",
151                class: "w-full",
152                "body-class": "flex flex-col gap-[4px] h-[130px]"
153              }, {
154                default: withCtx(() => {
155                  var _a;
156                  return [
157                    _hoisted_1,
158                    createBaseVNode("div", _hoisted_2, toDisplayString(((_a = unref(data)) == null ? void 0 : _a.targetAmount) ?? 0) + " USDT", 1)
159                  ];
160                }),
161                _: 1
162              })
163            ]),
164            _: 1
165          }),
166          createVNode(_component_el_col, { span: 8 }, {
167            default: withCtx(() => [
168              createVNode(_component_el_card, {
169                shadow: "hover",
170                class: "w-full",
171                "body-class": "flex flex-col gap-[4px] h-[130px]"
172              }, {
173                default: withCtx(() => {
174                  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
175                  return [
176                    _hoisted_3,
177                    createBaseVNode("div", _hoisted_4, [
178                      calcProgress((_a = unref(data)) == null ? void 0 : _a.targetAmount, (_b = unref(data)) == null ? void 0 : _b.actualAmount) < 50 ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(((_c = unref(data)) == null ? void 0 : _c.actualAmount) ?? 0) + " USDT ", 1)) : calcProgress((_d = unref(data)) == null ? void 0 : _d.targetAmount, (_e = unref(data)) == null ? void 0 : _e.actualAmount) < 100 ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(((_f = unref(data)) == null ? void 0 : _f.actualAmount) ?? 0) + " USDT ", 1)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(((_g = unref(data)) == null ? void 0 : _g.actualAmount) ?? 0) + " USDT", 1))
179                    ]),
180                    createBaseVNode("div", _hoisted_8, [
181                      calcProgress((_h = unref(data)) == null ? void 0 : _h.targetAmount, (_i = unref(data)) == null ? void 0 : _i.actualAmount) < 50 ? (openBlock(), createElementBlock("span", _hoisted_9, " 完成率: " + toDisplayString(calcProgress((_j = unref(data)) == null ? void 0 : _j.targetAmount, (_k = unref(data)) == null ? void 0 : _k.actualAmount).toFixed(2)) + "% ", 1)) : calcProgress((_l = unref(data)) == null ? void 0 : _l.targetAmount, (_m = unref(data)) == null ? void 0 : _m.actualAmount) < 100 ? (openBlock(), createElementBlock("span", _hoisted_10, " 完成率: " + toDisplayString(calcProgress((_n = unref(data)) == null ? void 0 : _n.targetAmount, (_o = unref(data)) == null ? void 0 : _o.actualAmount).toFixed(2)) + "% ", 1)) : (openBlock(), createElementBlock("span", _hoisted_11, " 完成率: " + toDisplayString(calcProgress((_p = unref(data)) == null ? void 0 : _p.targetAmount, (_q = unref(data)) == null ? void 0 : _q.actualAmount).toFixed(2)) + "% ", 1))
182                    ])
183                  ];
184                }),
185                _: 1
186              })
187            ]),
188            _: 1
189          }),
190          createVNode(_component_el_col, { span: 8 }, {
191            default: withCtx(() => [
192              createVNode(_component_el_card, {
193                shadow: "hover",
194                class: "w-full",
195                "body-class": "flex flex-col gap-[4px]  h-[130px]"
196              }, {
197                default: withCtx(() => [
198                  _hoisted_12,
199                  createVNode(_component_el_select, {
200                    modelValue: unref(timeSelectValue),
201                    "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(timeSelectValue) ? timeSelectValue.value = $event : null),
202                    class: "w-full mt-[6px]",
203                    clearable: "",
204                    onChange: handleTimeSelectChange
205                  }, {
206                    default: withCtx(() => [
207                      createVNode(_component_el_option, {
208                        label: "Q1",
209                        value: "q1"
210                      }),
211                      createVNode(_component_el_option, {
212                        label: "Q2",
213                        value: "q2"
214                      }),
215                      createVNode(_component_el_option, {
216                        label: "Q3",
217                        value: "q3"
218                      }),
219                      createVNode(_component_el_option, {
220                        label: "Q4",
221                        value: "q4"
222                      }),
223                      createVNode(_component_el_option, {
224                        label: "全年",
225                        value: "year"
226                      })
227                    ]),
228                    _: 1
229                  }, 8, ["modelValue"])
230                ]),
231                _: 1
232              })
233            ]),
234            _: 1
235          })
236        ]),
237        _: 1
238      });
239    };
240  }
241});
242export {
243  _sfc_main as _
244};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.