@uxda/appkit 1.0.76 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -95,11 +95,12 @@ import { BalanceCard } from '@uxda/appkit'
95
95
 
96
96
  ```html
97
97
  <template>
98
- <balance-card @drill="onBalanceCardDrill" @recharge="onBalanceCardRecharge" />
98
+ <balance-card app="crm" @drill="onBalanceCardDrill" @recharge="onBalanceCardRecharge" />
99
99
  <template>
100
100
  ```
101
101
 
102
102
  #### 事件 emits
103
+ * app 配置到组件上的 app code
103
104
  * @drill 点击账户详情时发生
104
105
  * @recharge 点击充值按钮时发生
105
106
 
@@ -115,6 +116,10 @@ function onBalanceCardRecharge () {
115
116
  }
116
117
  ```
117
118
 
119
+ ### 方法 methods
120
+ * reload() 刷新数据
121
+
122
+
118
123
 
119
124
  ### 4️⃣ 余额不足提示框 &lt;balance-reminder&gt;
120
125
 
package/dist/appkit.css CHANGED
@@ -536,6 +536,9 @@ page {
536
536
  font-weight: 700;
537
537
  }
538
538
  .account-view {
539
+ height: 100vh;
540
+ }
541
+ .account-view .scroll-content {
539
542
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNzUwIiBoZWlnaHQ9IjQwNiIgdmlld0JveD0iMCAwIDc1MCA0MDYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0zODIuNSA0MDcuNUM1NzcuMzU3IDQwNy41IDc1My43ODggMzgxLjI0OCA4ODEuNTIxIDMzOC43OTFDOTQ1LjM4NiAzMTcuNTYzIDk5Ny4xMDQgMjkyLjI3NiAxMDMyLjg3IDI2NC4xNzFDMTA2OC42MiAyMzYuMDcxIDEwODguNSAyMDUuMDk3IDEwODguNSAxNzIuNUMxMDg4LjUgMTM5LjkwMyAxMDY4LjYyIDEwOC45MjkgMTAzMi44NyA4MC44Mjg5Qzk5Ny4xMDQgNTIuNzI0NSA5NDUuMzg2IDI3LjQzNjcgODgxLjUyMSA2LjIwODk4Qzc1My43ODggLTM2LjI0ODIgNTc3LjM1NyAtNjIuNSAzODIuNSAtNjIuNUMxODcuNjQzIC02Mi41IDExLjIxMjIgLTM2LjI0ODIgLTExNi41MjIgNi4yMDg5OEMtMTgwLjM4NiAyNy40MzY3IC0yMzIuMTA0IDUyLjcyNDUgLTI2Ny44NjcgODAuODI4OUMtMzAzLjYyNCAxMDguOTI5IC0zMjMuNSAxMzkuOTAzIC0zMjMuNSAxNzIuNUMtMzIzLjUgMjA1LjA5NyAtMzAzLjYyNCAyMzYuMDcxIC0yNjcuODY3IDI2NC4xNzFDLTIzMi4xMDQgMjkyLjI3NiAtMTgwLjM4NiAzMTcuNTYzIC0xMTYuNTIyIDMzOC43OTFDMTEuMjEyMiAzODEuMjQ4IDE4Ny42NDMgNDA3LjUgMzgyLjUgNDA3LjVaIiBmaWxsPSIjM0IzOTNDIiBzdHJva2U9ImJsYWNrIi8+Cjwvc3ZnPgo=");
540
543
  background-position: center -200px;
541
544
  background-repeat: no-repeat;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, reactive, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, createTextVNode, createStaticVNode, createCommentVNode, renderSlot, createVNode, ref, onMounted, unref, watch, computed, normalizeStyle, withDirectives, vShow } from 'vue';
2
- import Taro, { useDidShow, usePageScroll, usePullDownRefresh, useReachBottom } from '@tarojs/taro';
2
+ import Taro, { useDidShow } from '@tarojs/taro';
3
3
  import { Grid, GridItem, Button, Checkbox, Popup, OverLay, DatePicker } from '@nutui/nutui-taro';
4
4
  import dayjs from 'dayjs';
5
5
 
@@ -109,11 +109,11 @@ function requestPayment$2(json) {
109
109
 
110
110
  function useSafeArea() {
111
111
  const systemInfo = Taro.getSystemInfoSync(), capsule = Taro.getMenuButtonBoundingClientRect();
112
- const status = systemInfo.statusBarHeight || 0, gap = capsule.top - status, nav = capsule.height + gap * 2;
112
+ const status = systemInfo.statusBarHeight || 0, gap = capsule.top - status, nav = capsule.height + gap * 2, safeAreaBottom = systemInfo.safeArea?.bottom || 0, bottom = systemInfo.screenHeight - safeAreaBottom;
113
113
  return {
114
114
  status,
115
115
  nav,
116
- bottom: systemInfo.safeArea?.bottom || 0
116
+ bottom
117
117
  };
118
118
  }
119
119
 
@@ -906,6 +906,9 @@ const _hoisted_14$1 = [
906
906
  ];
907
907
  var script$7 = /* @__PURE__ */ defineComponent({
908
908
  __name: "BalanceCard",
909
+ props: {
910
+ app: { type: String, required: true, default: "" }
911
+ },
909
912
  emits: [
910
913
  /**
911
914
  * 跳账户详情
@@ -916,7 +919,8 @@ var script$7 = /* @__PURE__ */ defineComponent({
916
919
  */
917
920
  "recharge"
918
921
  ],
919
- setup(__props, { emit: __emit }) {
922
+ setup(__props, { expose: __expose, emit: __emit }) {
923
+ const props = __props;
920
924
  const balance = ref({
921
925
  total: 0,
922
926
  privileges: []
@@ -926,7 +930,9 @@ var script$7 = /* @__PURE__ */ defineComponent({
926
930
  };
927
931
  async function loadBalance() {
928
932
  const $http = useHttp();
929
- $http.get(endpoints.\u83B7\u53D6\u4F59\u989D\u660E\u7EC6, {}).then((data) => {
933
+ $http.get(endpoints.\u83B7\u53D6\u4F59\u989D\u660E\u7EC6, {
934
+ app: props.app
935
+ }).then((data) => {
930
936
  balance.value = data;
931
937
  });
932
938
  }
@@ -937,6 +943,9 @@ var script$7 = /* @__PURE__ */ defineComponent({
937
943
  useDidShow(() => {
938
944
  loadBalance();
939
945
  });
946
+ __expose({
947
+ reload: loadBalance
948
+ });
940
949
  return (_ctx, _cache) => {
941
950
  return openBlock(), createElementBlock("div", _hoisted_1$7, [
942
951
  createElementVNode("div", _hoisted_2$7, [
@@ -1416,19 +1425,20 @@ var script$2 = /* @__PURE__ */ defineComponent({
1416
1425
 
1417
1426
  script$2.__file = "src/balance/components/SecondBalance.vue";
1418
1427
 
1419
- const _hoisted_1$1 = /* @__PURE__ */ createElementVNode(
1428
+ const _hoisted_1$1 = { class: "scroll-content" };
1429
+ const _hoisted_2$1 = /* @__PURE__ */ createElementVNode(
1420
1430
  "label",
1421
1431
  null,
1422
1432
  "\u5C0F\u4E91\u8C46\u4F59\u989D",
1423
1433
  -1
1424
1434
  /* HOISTED */
1425
1435
  );
1426
- const _hoisted_2$1 = [
1427
- _hoisted_1$1
1436
+ const _hoisted_3$1 = [
1437
+ _hoisted_2$1
1428
1438
  ];
1429
- const _hoisted_3$1 = { class: "balance" };
1430
- const _hoisted_4$1 = { class: "bean-box spa-between" };
1431
- const _hoisted_5$1 = /* @__PURE__ */ createElementVNode(
1439
+ const _hoisted_4$1 = { class: "balance" };
1440
+ const _hoisted_5$1 = { class: "bean-box spa-between" };
1441
+ const _hoisted_6 = /* @__PURE__ */ createElementVNode(
1432
1442
  "div",
1433
1443
  { class: "bean-img" },
1434
1444
  [
@@ -1441,18 +1451,18 @@ const _hoisted_5$1 = /* @__PURE__ */ createElementVNode(
1441
1451
  -1
1442
1452
  /* HOISTED */
1443
1453
  );
1444
- const _hoisted_6 = { class: "bean-counts spa-between" };
1445
- const _hoisted_7 = { class: "counts number" };
1446
- const _hoisted_8 = { class: "search-time" };
1447
- const _hoisted_9 = /* @__PURE__ */ createElementVNode(
1454
+ const _hoisted_7 = { class: "bean-counts spa-between" };
1455
+ const _hoisted_8 = { class: "counts number" };
1456
+ const _hoisted_9 = { class: "search-time" };
1457
+ const _hoisted_10 = /* @__PURE__ */ createElementVNode(
1448
1458
  "div",
1449
1459
  { class: "title" },
1450
1460
  "\u6536\u652F\u660E\u7EC6",
1451
1461
  -1
1452
1462
  /* HOISTED */
1453
1463
  );
1454
- const _hoisted_10 = { class: "text number" };
1455
- const _hoisted_11 = /* @__PURE__ */ createElementVNode(
1464
+ const _hoisted_11 = { class: "text number" };
1465
+ const _hoisted_12 = /* @__PURE__ */ createElementVNode(
1456
1466
  "img",
1457
1467
  {
1458
1468
  style: { "margin-top": "-2px" },
@@ -1463,14 +1473,14 @@ const _hoisted_11 = /* @__PURE__ */ createElementVNode(
1463
1473
  -1
1464
1474
  /* HOISTED */
1465
1475
  );
1466
- const _hoisted_12 = /* @__PURE__ */ createElementVNode(
1476
+ const _hoisted_13 = /* @__PURE__ */ createElementVNode(
1467
1477
  "span",
1468
1478
  { class: "text" },
1469
1479
  "\u7B5B\u9009",
1470
1480
  -1
1471
1481
  /* HOISTED */
1472
1482
  );
1473
- const _hoisted_13 = /* @__PURE__ */ createElementVNode(
1483
+ const _hoisted_14 = /* @__PURE__ */ createElementVNode(
1474
1484
  "img",
1475
1485
  {
1476
1486
  class: "time-icon",
@@ -1480,24 +1490,24 @@ const _hoisted_13 = /* @__PURE__ */ createElementVNode(
1480
1490
  -1
1481
1491
  /* HOISTED */
1482
1492
  );
1483
- const _hoisted_14 = [
1484
- _hoisted_12,
1485
- _hoisted_13
1493
+ const _hoisted_15 = [
1494
+ _hoisted_13,
1495
+ _hoisted_14
1486
1496
  ];
1487
- const _hoisted_15 = { class: "operation-list" };
1488
- const _hoisted_16 = {
1497
+ const _hoisted_16 = { class: "operation-list" };
1498
+ const _hoisted_17 = {
1489
1499
  key: 0,
1490
1500
  class: "box"
1491
1501
  };
1492
- const _hoisted_17 = { class: "title number" };
1493
- const _hoisted_18 = { class: "item-type" };
1494
- const _hoisted_19 = { class: "item-detail" };
1495
- const _hoisted_20 = { class: "item-info spa-between" };
1496
- const _hoisted_21 = { class: "item-info-type" };
1497
- const _hoisted_22 = { class: "item-info-title" };
1498
- const _hoisted_23 = { class: "item-info-amount number" };
1499
- const _hoisted_24 = { class: "item-detail-remark" };
1500
- const _hoisted_25 = {
1502
+ const _hoisted_18 = { class: "title number" };
1503
+ const _hoisted_19 = { class: "item-type" };
1504
+ const _hoisted_20 = { class: "item-detail" };
1505
+ const _hoisted_21 = { class: "item-info spa-between" };
1506
+ const _hoisted_22 = { class: "item-info-type" };
1507
+ const _hoisted_23 = { class: "item-info-title" };
1508
+ const _hoisted_24 = { class: "item-info-amount number" };
1509
+ const _hoisted_25 = { class: "item-detail-remark" };
1510
+ const _hoisted_26 = {
1501
1511
  key: 0,
1502
1512
  class: "box-not-text"
1503
1513
  };
@@ -1509,6 +1519,7 @@ var script$1 = /* @__PURE__ */ defineComponent({
1509
1519
  emits: ["recharge"],
1510
1520
  setup(__props, { emit: __emit }) {
1511
1521
  const safeArea = useSafeArea();
1522
+ const refreshing = ref(false);
1512
1523
  const props = __props;
1513
1524
  const emit = __emit;
1514
1525
  const filterOpen = ref(false);
@@ -1619,29 +1630,26 @@ var script$1 = /* @__PURE__ */ defineComponent({
1619
1630
  filtering.page++;
1620
1631
  loadConsumptions(true);
1621
1632
  }
1622
- const scrollY = ref(0);
1623
- usePageScroll((e) => {
1633
+ const scrolled = ref(0);
1634
+ const onScroll = (e) => {
1624
1635
  const { scrollTop } = e;
1625
- scrollY.value = scrollTop;
1626
- });
1627
- usePullDownRefresh(() => {
1628
- if (popupOpen.value) {
1629
- Taro.stopPullDownRefresh();
1630
- return;
1631
- }
1636
+ scrolled.value = scrollTop;
1637
+ };
1638
+ const onPullDownRefresh = () => {
1639
+ refreshing.value = true;
1632
1640
  loadBalance();
1633
1641
  setTimeout(() => {
1634
- Taro.stopPullDownRefresh();
1642
+ refreshing.value = false;
1635
1643
  }, 500);
1636
- });
1637
- useReachBottom(() => {
1644
+ };
1645
+ const onReachBottom = () => {
1638
1646
  if (reachedLastPage.value) {
1639
1647
  return false;
1640
1648
  }
1641
1649
  loadNextPage();
1642
- });
1643
- const popupOpen = computed(() => {
1644
- return rulesPopupOpen.value || datePickerOpen.value || filterOpen.value;
1650
+ };
1651
+ const isAnyPopupOpen = computed(() => {
1652
+ return rulesPopupOpen.value || datePickerOpen.value || filterOpen.value || secondBalanceOpen.value;
1645
1653
  });
1646
1654
  const secondBalanceOpen = ref(false);
1647
1655
  function onSecondBalanceButtonClick() {
@@ -1673,173 +1681,181 @@ var script$1 = /* @__PURE__ */ defineComponent({
1673
1681
  resetDateRange();
1674
1682
  });
1675
1683
  return (_ctx, _cache) => {
1684
+ const _component_scroll_view = resolveComponent("scroll-view");
1676
1685
  const _component_nut_popup = resolveComponent("nut-popup");
1677
1686
  return openBlock(), createElementBlock(
1678
1687
  Fragment,
1679
1688
  null,
1680
1689
  [
1681
- createElementVNode(
1682
- "div",
1683
- {
1684
- class: normalizeClass(["account-view", { popupOpen: popupOpen.value }])
1685
- },
1686
- [
1687
- createVNode(unref(script$b), {
1688
- "color-mode": "dark",
1689
- title: "\u6211\u7684\u8D26\u6237",
1690
- class: normalizeClass({ "with-background": scrollY.value > 0 }),
1691
- onClose: onPageHeaderClose
1692
- }, null, 8, ["class"]),
1693
- createElementVNode("div", { class: "row jusify-right" }, [
1694
- createElementVNode("div", {
1695
- class: "small-bean-button",
1696
- onClick: onSecondBalanceButtonClick
1697
- }, [..._hoisted_2$1])
1698
- ]),
1699
- createElementVNode("div", _hoisted_3$1, [
1700
- createElementVNode("div", _hoisted_4$1, [
1701
- _hoisted_5$1,
1690
+ createVNode(_component_scroll_view, {
1691
+ class: normalizeClass(["account-view", { popupOpen: isAnyPopupOpen.value }]),
1692
+ "scroll-y": !isAnyPopupOpen.value,
1693
+ "refresher-enabled": !isAnyPopupOpen.value,
1694
+ "refresher-triggered": refreshing.value,
1695
+ onScroll,
1696
+ onRefresherrefresh: onPullDownRefresh,
1697
+ "lower-threshold": 50,
1698
+ onScrolltolower: onReachBottom
1699
+ }, {
1700
+ default: withCtx(() => [
1701
+ createElementVNode("div", _hoisted_1$1, [
1702
+ createVNode(unref(script$b), {
1703
+ "color-mode": "dark",
1704
+ title: "\u6211\u7684\u8D26\u6237",
1705
+ class: normalizeClass({ "with-background": scrolled.value > 0 }),
1706
+ onClose: onPageHeaderClose
1707
+ }, null, 8, ["class"]),
1708
+ createElementVNode("div", { class: "row jusify-right" }, [
1702
1709
  createElementVNode("div", {
1703
- class: "rule",
1704
- onClick: _cache[0] || (_cache[0] = ($event) => rulesPopupOpen.value = true)
1705
- }, "\u89C4\u5219\u8BF4\u660E")
1710
+ class: "small-bean-button",
1711
+ onClick: onSecondBalanceButtonClick
1712
+ }, [..._hoisted_3$1])
1706
1713
  ]),
1707
- createElementVNode("div", _hoisted_6, [
1708
- createElementVNode(
1709
- "div",
1710
- _hoisted_7,
1711
- toDisplayString(balance.value.total || 0),
1712
- 1
1713
- /* TEXT */
1714
- ),
1715
- createElementVNode("div", {
1716
- class: "pay",
1717
- onClick: gotoRecharge
1718
- }, "\u4E91\u8C46\u5145\u503C")
1719
- ])
1720
- ]),
1721
- createElementVNode(
1722
- "div",
1723
- {
1724
- class: normalizeClass(["operation-title spa-between", { "with-shadow": scrollY.value > 0 }]),
1725
- style: normalizeStyle({ top: `${unref(safeArea).status + unref(safeArea).nav}px` })
1726
- },
1727
- [
1728
- createElementVNode("div", _hoisted_8, [
1729
- _hoisted_9,
1730
- withDirectives(createElementVNode(
1731
- "div",
1732
- {
1733
- class: "time",
1734
- onClick: openDateFilter
1735
- },
1736
- [
1737
- createElementVNode(
1738
- "div",
1739
- _hoisted_10,
1740
- toDisplayString(dateRangeDisplay.value),
1741
- 1
1742
- /* TEXT */
1743
- ),
1744
- _hoisted_11
1745
- ],
1746
- 512
1747
- /* NEED_PATCH */
1748
- ), [
1749
- [vShow, filtering.dateFrom]
1750
- ])
1714
+ createElementVNode("div", _hoisted_4$1, [
1715
+ createElementVNode("div", _hoisted_5$1, [
1716
+ _hoisted_6,
1717
+ createElementVNode("div", {
1718
+ class: "rule",
1719
+ onClick: _cache[0] || (_cache[0] = ($event) => rulesPopupOpen.value = true)
1720
+ }, "\u89C4\u5219\u8BF4\u660E")
1751
1721
  ]),
1752
- createElementVNode("div", {
1753
- class: "search",
1754
- onClick: _cache[1] || (_cache[1] = ($event) => filterOpen.value = true)
1755
- }, [..._hoisted_14])
1756
- ],
1757
- 6
1758
- /* CLASS, STYLE */
1759
- ),
1760
- createElementVNode("div", _hoisted_15, [
1761
- consumptionGroups.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_16, [
1762
- (openBlock(true), createElementBlock(
1763
- Fragment,
1764
- null,
1765
- renderList(consumptionGroups.value, (item, index) => {
1766
- return openBlock(), createElementBlock("div", {
1767
- class: "box-detail",
1768
- key: index
1769
- }, [
1770
- createElementVNode(
1771
- "div",
1772
- _hoisted_17,
1773
- toDisplayString(item.date),
1774
- 1
1775
- /* TEXT */
1776
- ),
1777
- (openBlock(true), createElementBlock(
1778
- Fragment,
1779
- null,
1780
- renderList(item.consumptions, (it, i) => {
1781
- return openBlock(), createElementBlock("div", {
1782
- class: "item",
1783
- key: i
1784
- }, [
1785
- createElementVNode(
1786
- "div",
1787
- _hoisted_18,
1788
- toDisplayString(it.\u4EA4\u6613\u7C7B\u578B),
1789
- 1
1790
- /* TEXT */
1791
- ),
1792
- createElementVNode("div", _hoisted_19, [
1722
+ createElementVNode("div", _hoisted_7, [
1723
+ createElementVNode(
1724
+ "div",
1725
+ _hoisted_8,
1726
+ toDisplayString(balance.value.total || 0),
1727
+ 1
1728
+ /* TEXT */
1729
+ ),
1730
+ createElementVNode("div", {
1731
+ class: "pay",
1732
+ onClick: gotoRecharge
1733
+ }, "\u4E91\u8C46\u5145\u503C")
1734
+ ])
1735
+ ]),
1736
+ createElementVNode(
1737
+ "div",
1738
+ {
1739
+ class: normalizeClass(["operation-title spa-between", { "with-shadow": scrolled.value > 0 }]),
1740
+ style: normalizeStyle({ top: `${unref(safeArea).status + unref(safeArea).nav}px` })
1741
+ },
1742
+ [
1743
+ createElementVNode("div", _hoisted_9, [
1744
+ _hoisted_10,
1745
+ withDirectives(createElementVNode(
1746
+ "div",
1747
+ {
1748
+ class: "time",
1749
+ onClick: openDateFilter
1750
+ },
1751
+ [
1752
+ createElementVNode(
1753
+ "div",
1754
+ _hoisted_11,
1755
+ toDisplayString(dateRangeDisplay.value),
1756
+ 1
1757
+ /* TEXT */
1758
+ ),
1759
+ _hoisted_12
1760
+ ],
1761
+ 512
1762
+ /* NEED_PATCH */
1763
+ ), [
1764
+ [vShow, filtering.dateFrom]
1765
+ ])
1766
+ ]),
1767
+ createElementVNode("div", {
1768
+ class: "search",
1769
+ onClick: _cache[1] || (_cache[1] = ($event) => filterOpen.value = true)
1770
+ }, [..._hoisted_15])
1771
+ ],
1772
+ 6
1773
+ /* CLASS, STYLE */
1774
+ ),
1775
+ createElementVNode("div", _hoisted_16, [
1776
+ consumptionGroups.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_17, [
1777
+ (openBlock(true), createElementBlock(
1778
+ Fragment,
1779
+ null,
1780
+ renderList(consumptionGroups.value, (item, index) => {
1781
+ return openBlock(), createElementBlock("div", {
1782
+ class: "box-detail",
1783
+ key: index
1784
+ }, [
1785
+ createElementVNode(
1786
+ "div",
1787
+ _hoisted_18,
1788
+ toDisplayString(item.date),
1789
+ 1
1790
+ /* TEXT */
1791
+ ),
1792
+ (openBlock(true), createElementBlock(
1793
+ Fragment,
1794
+ null,
1795
+ renderList(item.consumptions, (it, i) => {
1796
+ return openBlock(), createElementBlock("div", {
1797
+ class: "item",
1798
+ key: i
1799
+ }, [
1800
+ createElementVNode(
1801
+ "div",
1802
+ _hoisted_19,
1803
+ toDisplayString(it.\u4EA4\u6613\u7C7B\u578B),
1804
+ 1
1805
+ /* TEXT */
1806
+ ),
1793
1807
  createElementVNode("div", _hoisted_20, [
1794
- createElementVNode("div", null, [
1808
+ createElementVNode("div", _hoisted_21, [
1809
+ createElementVNode("div", null, [
1810
+ createElementVNode(
1811
+ "div",
1812
+ _hoisted_22,
1813
+ toDisplayString(it.\u8D26\u6237\u7C7B\u578B),
1814
+ 1
1815
+ /* TEXT */
1816
+ ),
1817
+ createElementVNode(
1818
+ "div",
1819
+ _hoisted_23,
1820
+ toDisplayString(it.title),
1821
+ 1
1822
+ /* TEXT */
1823
+ )
1824
+ ]),
1795
1825
  createElementVNode(
1796
1826
  "div",
1797
- _hoisted_21,
1798
- toDisplayString(it.\u8D26\u6237\u7C7B\u578B),
1799
- 1
1800
- /* TEXT */
1801
- ),
1802
- createElementVNode(
1803
- "div",
1804
- _hoisted_22,
1805
- toDisplayString(it.title),
1827
+ _hoisted_24,
1828
+ toDisplayString(it.\u6536\u5165\u8FD8\u662F\u652F\u51FA == "\u652F\u51FA" ? "-" : "+") + toDisplayString(it.amount),
1806
1829
  1
1807
1830
  /* TEXT */
1808
1831
  )
1809
1832
  ]),
1810
1833
  createElementVNode(
1811
1834
  "div",
1812
- _hoisted_23,
1813
- toDisplayString(it.\u6536\u5165\u8FD8\u662F\u652F\u51FA == "\u652F\u51FA" ? "-" : "+") + toDisplayString(it.amount),
1835
+ _hoisted_25,
1836
+ toDisplayString(it.description),
1814
1837
  1
1815
1838
  /* TEXT */
1816
1839
  )
1817
- ]),
1818
- createElementVNode(
1819
- "div",
1820
- _hoisted_24,
1821
- toDisplayString(it.description),
1822
- 1
1823
- /* TEXT */
1824
- )
1825
- ])
1826
- ]);
1827
- }),
1828
- 128
1829
- /* KEYED_FRAGMENT */
1830
- ))
1831
- ]);
1832
- }),
1833
- 128
1834
- /* KEYED_FRAGMENT */
1835
- )),
1836
- reachedLastPage.value ? (openBlock(), createElementBlock("div", _hoisted_25, "\u6CA1\u6709\u66F4\u591A\u4E86")) : createCommentVNode("v-if", true)
1837
- ])) : (openBlock(), createBlock(script$3, { key: 1 }))
1840
+ ])
1841
+ ]);
1842
+ }),
1843
+ 128
1844
+ /* KEYED_FRAGMENT */
1845
+ ))
1846
+ ]);
1847
+ }),
1848
+ 128
1849
+ /* KEYED_FRAGMENT */
1850
+ )),
1851
+ reachedLastPage.value ? (openBlock(), createElementBlock("div", _hoisted_26, "\u6CA1\u6709\u66F4\u591A\u4E86")) : createCommentVNode("v-if", true)
1852
+ ])) : (openBlock(), createBlock(script$3, { key: 1 }))
1853
+ ])
1838
1854
  ])
1839
- ],
1840
- 2
1841
- /* CLASS */
1842
- ),
1855
+ ]),
1856
+ _: 1
1857
+ /* STABLE */
1858
+ }, 8, ["class", "scroll-y", "refresher-enabled", "refresher-triggered"]),
1843
1859
  createVNode(_component_nut_popup, {
1844
1860
  "pop-class": "consumption-rules-popup",
1845
1861
  visible: rulesPopupOpen.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "1.0.76",
3
+ "version": "1.1.2",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -1,80 +1,90 @@
1
1
  <template>
2
- <div class="account-view" :class="{ popupOpen }">
3
- <page-header color-mode="dark" title="我的账户"
4
- :class="{'with-background': scrollY > 0}"
5
- @close="onPageHeaderClose" />
6
- <div class="row jusify-right">
7
- <div class="small-bean-button" @click="onSecondBalanceButtonClick">
8
- <label>小云豆余额</label>
9
- </div>
10
- </div>
11
- <div class="balance">
12
- <div class="bean-box spa-between">
13
- <div class="bean-img">
14
- <img
15
- class="bean-icon"
16
- src="https://cdn.ddjf.com/static/images/bpms-workBench/gold-bean.png" />
17
- <div class="bean-tag tag">云豆</div>
2
+ <scroll-view class="account-view"
3
+ :class="{ popupOpen: isAnyPopupOpen }"
4
+ :scroll-y="!isAnyPopupOpen"
5
+ :refresher-enabled="!isAnyPopupOpen"
6
+ :refresher-triggered="refreshing"
7
+ @scroll="onScroll"
8
+ @refresherrefresh="onPullDownRefresh"
9
+ :lower-threshold="50"
10
+ @scrolltolower="onReachBottom">
11
+ <div class="scroll-content">
12
+ <page-header color-mode="dark" title="我的账户"
13
+ :class="{'with-background': scrolled > 0}"
14
+ @close="onPageHeaderClose" />
15
+ <div class="row jusify-right">
16
+ <div class="small-bean-button" @click="onSecondBalanceButtonClick">
17
+ <label>小云豆余额</label>
18
18
  </div>
19
- <div class="rule" @click="rulesPopupOpen = true">规则说明</div>
20
19
  </div>
21
- <div class="bean-counts spa-between">
22
- <div class="counts number">{{ balance.total || 0 }}</div>
23
- <div class="pay" @click="gotoRecharge">云豆充值</div>
20
+ <div class="balance">
21
+ <div class="bean-box spa-between">
22
+ <div class="bean-img">
23
+ <img
24
+ class="bean-icon"
25
+ src="https://cdn.ddjf.com/static/images/bpms-workBench/gold-bean.png" />
26
+ <div class="bean-tag tag">云豆</div>
27
+ </div>
28
+ <div class="rule" @click="rulesPopupOpen = true">规则说明</div>
29
+ </div>
30
+ <div class="bean-counts spa-between">
31
+ <div class="counts number">{{ balance.total || 0 }}</div>
32
+ <div class="pay" @click="gotoRecharge">云豆充值</div>
33
+ </div>
24
34
  </div>
25
- </div>
26
- <div class="operation-title spa-between"
27
- :class="{'with-shadow': scrollY > 0}"
28
- :style="{top: `${safeArea.status + safeArea.nav}px`}">
29
- <div class="search-time">
30
- <div class="title">收支明细</div>
31
- <div class="time" @click="openDateFilter" v-show="filtering.dateFrom">
32
- <div class="text number">{{ dateRangeDisplay }}</div>
35
+ <div class="operation-title spa-between"
36
+ :class="{'with-shadow': scrolled > 0}"
37
+ :style="{top: `${safeArea.status + safeArea.nav}px`}">
38
+ <div class="search-time">
39
+ <div class="title">收支明细</div>
40
+ <div class="time" @click="openDateFilter" v-show="filtering.dateFrom">
41
+ <div class="text number">{{ dateRangeDisplay }}</div>
42
+ <img
43
+ style="margin-top: -2px"
44
+ class="time-icon"
45
+ src="https://cdn.ddjf.com/static/images/bpms-workBench/clound-bean-down.png" />
46
+ </div>
47
+ </div>
48
+ <div class="search" @click="filterOpen = true">
49
+ <span class="text">筛选</span>
33
50
  <img
34
- style="margin-top: -2px"
35
51
  class="time-icon"
36
- src="https://cdn.ddjf.com/static/images/bpms-workBench/clound-bean-down.png" />
52
+ src="https://cdn.ddjf.com/static/images/bpms-workBench/clound-bean-select-icon.png" />
37
53
  </div>
38
54
  </div>
39
- <div class="search" @click="filterOpen = true">
40
- <span class="text">筛选</span>
41
- <img
42
- class="time-icon"
43
- src="https://cdn.ddjf.com/static/images/bpms-workBench/clound-bean-select-icon.png" />
44
- </div>
45
- </div>
46
- <div class="operation-list">
47
- <div class="box" v-if="consumptionGroups.length > 0">
48
- <div class="box-detail" v-for="(item, index) in consumptionGroups" :key="index">
49
- <div class="title number">{{ item.date }}</div>
50
- <div
51
- class="item"
52
- v-for="(it, i) in item.consumptions"
53
- :key="i">
54
- <div class="item-type">
55
- {{ it.交易类型 }}
56
- </div>
57
- <div class="item-detail">
58
- <div class="item-info spa-between">
59
- <div>
60
- <div class="item-info-type">
61
- {{ it.账户类型 }}
55
+ <div class="operation-list">
56
+ <div class="box" v-if="consumptionGroups.length > 0">
57
+ <div class="box-detail" v-for="(item, index) in consumptionGroups" :key="index">
58
+ <div class="title number">{{ item.date }}</div>
59
+ <div
60
+ class="item"
61
+ v-for="(it, i) in item.consumptions"
62
+ :key="i">
63
+ <div class="item-type">
64
+ {{ it.交易类型 }}
65
+ </div>
66
+ <div class="item-detail">
67
+ <div class="item-info spa-between">
68
+ <div>
69
+ <div class="item-info-type">
70
+ {{ it.账户类型 }}
71
+ </div>
72
+ <div class="item-info-title">{{ it.title }}</div>
73
+ </div>
74
+ <div class="item-info-amount number">
75
+ {{ it.收入还是支出 == '支出' ? '-' : '+' }}{{ it.amount }}
62
76
  </div>
63
- <div class="item-info-title">{{ it.title }}</div>
64
- </div>
65
- <div class="item-info-amount number">
66
- {{ it.收入还是支出 == '支出' ? '-' : '+' }}{{ it.amount }}
67
77
  </div>
78
+ <div class="item-detail-remark">{{ it.description }}</div>
68
79
  </div>
69
- <div class="item-detail-remark">{{ it.description }}</div>
70
80
  </div>
71
81
  </div>
82
+ <div class="box-not-text" v-if="reachedLastPage">没有更多了</div>
72
83
  </div>
73
- <div class="box-not-text" v-if="reachedLastPage">没有更多了</div>
84
+ <empty-view v-else></empty-view>
74
85
  </div>
75
- <empty-view v-else></empty-view>
76
86
  </div>
77
- </div>
87
+ </scroll-view>
78
88
  <nut-popup
79
89
  pop-class="consumption-rules-popup"
80
90
  v-model:visible="rulesPopupOpen"
@@ -115,7 +125,7 @@
115
125
  </template>
116
126
 
117
127
  <script lang="ts" setup>
118
- import Taro, { useDidShow, usePageScroll, usePullDownRefresh, useReachBottom } from '@tarojs/taro'
128
+ import Taro, { useDidShow } from '@tarojs/taro'
119
129
  import { computed, onMounted, reactive, ref, watch } from 'vue'
120
130
  import { endpoints, useHttp } from '../api'
121
131
  import { 账户流水筛选项, Balance, ConsumptionGroup, 账户流水 } from '../types'
@@ -130,6 +140,8 @@ import { useSafeArea } from '../../shared'
130
140
 
131
141
  const safeArea = useSafeArea()
132
142
 
143
+ const refreshing = ref(false)
144
+
133
145
  type AccountViewProps = {
134
146
  app: string
135
147
  }
@@ -242,15 +254,15 @@ async function loadConsumptions (append: boolean = false) {
242
254
  app: props.app,
243
255
  ...filtering
244
256
  }).then(response => {
245
- consumptionGroups.value = groupDataByDate(response.data)
246
- if (filtering.page >= response.totalPages) {
247
- filtering.page = response.totalPages
248
- reachedLastPage.value = true
249
- } else {
250
- reachedLastPage.value = false
251
- }
252
- Taro.hideLoading()
253
- })
257
+ consumptionGroups.value = groupDataByDate(response.data)
258
+ if (filtering.page >= response.totalPages) {
259
+ filtering.page = response.totalPages
260
+ reachedLastPage.value = true
261
+ } else {
262
+ reachedLastPage.value = false
263
+ }
264
+ Taro.hideLoading()
265
+ })
254
266
  }
255
267
 
256
268
  /**
@@ -290,38 +302,49 @@ function loadNextPage () {
290
302
  loadConsumptions(true)
291
303
  }
292
304
 
305
+ // 以下这一大段处理下拉刷新、上滑分页以及弹窗与页面滑动的逻辑
306
+ const scrolled = ref<number>(0)
293
307
 
294
- const scrollY = ref<number>(0)
295
- usePageScroll((e) => {
308
+ /**
309
+ * 记录 scroll-view 滚动的位置
310
+ */
311
+ const onScroll = (e) => {
296
312
  const { scrollTop } = e
297
- scrollY.value = scrollTop
298
- })
299
-
300
- usePullDownRefresh(() => {
301
- if (popupOpen.value) {
302
- Taro.stopPullDownRefresh()
303
- return
304
- }
313
+ scrolled.value = scrollTop
314
+ }
305
315
 
306
- // 页面下拉刷新
316
+ /**
317
+ * 下拉刷新 pull down refresh
318
+ */
319
+ const onPullDownRefresh = () => {
320
+ refreshing.value = true
321
+ // 重新请求余额数据
307
322
  loadBalance()
308
323
  setTimeout(() => {
309
- Taro.stopPullDownRefresh()
324
+ refreshing.value = false
310
325
  }, 500);
311
- })
326
+ }
312
327
 
313
328
  /**
314
329
  * 滑动到底部请求下一页并合并查询结果
315
330
  */
316
- useReachBottom(() => {
331
+ const onReachBottom = () => {
317
332
  if (reachedLastPage.value) {
318
333
  return false
319
334
  }
320
335
  loadNextPage()
321
- })
336
+ }
322
337
 
323
- const popupOpen = computed(() => {
324
- return rulesPopupOpen.value || datePickerOpen.value || filterOpen.value
338
+ /**
339
+ * 浮窗弹出时不允许
340
+ * 1. 下拉刷新
341
+ * 2. 上滑分页
342
+ */
343
+ const isAnyPopupOpen = computed(() => {
344
+ return rulesPopupOpen.value ||
345
+ datePickerOpen.value ||
346
+ filterOpen.value ||
347
+ secondBalanceOpen.value
325
348
  })
326
349
 
327
350
  const secondBalanceOpen = ref<boolean>(false)
@@ -367,9 +390,12 @@ onMounted(() => {
367
390
 
368
391
  <style lang="scss">
369
392
  .account-view {
370
- background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNzUwIiBoZWlnaHQ9IjQwNiIgdmlld0JveD0iMCAwIDc1MCA0MDYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0zODIuNSA0MDcuNUM1NzcuMzU3IDQwNy41IDc1My43ODggMzgxLjI0OCA4ODEuNTIxIDMzOC43OTFDOTQ1LjM4NiAzMTcuNTYzIDk5Ny4xMDQgMjkyLjI3NiAxMDMyLjg3IDI2NC4xNzFDMTA2OC42MiAyMzYuMDcxIDEwODguNSAyMDUuMDk3IDEwODguNSAxNzIuNUMxMDg4LjUgMTM5LjkwMyAxMDY4LjYyIDEwOC45MjkgMTAzMi44NyA4MC44Mjg5Qzk5Ny4xMDQgNTIuNzI0NSA5NDUuMzg2IDI3LjQzNjcgODgxLjUyMSA2LjIwODk4Qzc1My43ODggLTM2LjI0ODIgNTc3LjM1NyAtNjIuNSAzODIuNSAtNjIuNUMxODcuNjQzIC02Mi41IDExLjIxMjIgLTM2LjI0ODIgLTExNi41MjIgNi4yMDg5OEMtMTgwLjM4NiAyNy40MzY3IC0yMzIuMTA0IDUyLjcyNDUgLTI2Ny44NjcgODAuODI4OUMtMzAzLjYyNCAxMDguOTI5IC0zMjMuNSAxMzkuOTAzIC0zMjMuNSAxNzIuNUMtMzIzLjUgMjA1LjA5NyAtMzAzLjYyNCAyMzYuMDcxIC0yNjcuODY3IDI2NC4xNzFDLTIzMi4xMDQgMjkyLjI3NiAtMTgwLjM4NiAzMTcuNTYzIC0xMTYuNTIyIDMzOC43OTFDMTEuMjEyMiAzODEuMjQ4IDE4Ny42NDMgNDA3LjUgMzgyLjUgNDA3LjVaIiBmaWxsPSIjM0IzOTNDIiBzdHJva2U9ImJsYWNrIi8+Cjwvc3ZnPgo=");
371
- background-position: center -200px;
372
- background-repeat: no-repeat;
393
+ height: 100vh;
394
+ .scroll-content {
395
+ background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNzUwIiBoZWlnaHQ9IjQwNiIgdmlld0JveD0iMCAwIDc1MCA0MDYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0zODIuNSA0MDcuNUM1NzcuMzU3IDQwNy41IDc1My43ODggMzgxLjI0OCA4ODEuNTIxIDMzOC43OTFDOTQ1LjM4NiAzMTcuNTYzIDk5Ny4xMDQgMjkyLjI3NiAxMDMyLjg3IDI2NC4xNzFDMTA2OC42MiAyMzYuMDcxIDEwODguNSAyMDUuMDk3IDEwODguNSAxNzIuNUMxMDg4LjUgMTM5LjkwMyAxMDY4LjYyIDEwOC45MjkgMTAzMi44NyA4MC44Mjg5Qzk5Ny4xMDQgNTIuNzI0NSA5NDUuMzg2IDI3LjQzNjcgODgxLjUyMSA2LjIwODk4Qzc1My43ODggLTM2LjI0ODIgNTc3LjM1NyAtNjIuNSAzODIuNSAtNjIuNUMxODcuNjQzIC02Mi41IDExLjIxMjIgLTM2LjI0ODIgLTExNi41MjIgNi4yMDg5OEMtMTgwLjM4NiAyNy40MzY3IC0yMzIuMTA0IDUyLjcyNDUgLTI2Ny44NjcgODAuODI4OUMtMzAzLjYyNCAxMDguOTI5IC0zMjMuNSAxMzkuOTAzIC0zMjMuNSAxNzIuNUMtMzIzLjUgMjA1LjA5NyAtMzAzLjYyNCAyMzYuMDcxIC0yNjcuODY3IDI2NC4xNzFDLTIzMi4xMDQgMjkyLjI3NiAtMTgwLjM4NiAzMTcuNTYzIC0xMTYuNTIyIDMzOC43OTFDMTEuMjEyMiAzODEuMjQ4IDE4Ny42NDMgNDA3LjUgMzgyLjUgNDA3LjVaIiBmaWxsPSIjM0IzOTNDIiBzdHJva2U9ImJsYWNrIi8+Cjwvc3ZnPgo=");
396
+ background-position: center -200px;
397
+ background-repeat: no-repeat;
398
+ }
373
399
  .page-header {
374
400
  background-color: #3B393C;
375
401
  position: sticky;
@@ -40,6 +40,15 @@ import { endpoints, useHttp } from '../api'
40
40
  import { Balance } from '../types'
41
41
  import { useDidShow } from '@tarojs/taro'
42
42
 
43
+ type BalanceCardProps = {
44
+ app: string
45
+ }
46
+ const props = withDefaults(
47
+ defineProps<BalanceCardProps>(), {
48
+ app: ''
49
+ }
50
+ )
51
+
43
52
  const balance = ref<Balance>({
44
53
  total: 0,
45
54
  privileges: []
@@ -52,6 +61,7 @@ const gotoRecharge = () => {
52
61
  async function loadBalance () {
53
62
  const $http = useHttp()
54
63
  $http.get<Balance>(endpoints.获取余额明细, {
64
+ app: props.app
55
65
  }).then(data => {
56
66
  balance.value = data
57
67
  })
@@ -76,6 +86,11 @@ useDidShow(() => {
76
86
  loadBalance()
77
87
  })
78
88
 
89
+ defineExpose({
90
+ reload: loadBalance
91
+ })
92
+
93
+
79
94
  </script>
80
95
 
81
96
  <style lang="scss">
@@ -33,10 +33,12 @@ export function useSafeArea (): SafeArea {
33
33
  * 据说是胶囊上下间距
34
34
  */
35
35
  gap = capsule.top - status,
36
- nav = capsule.height + gap * 2
36
+ nav = capsule.height + gap * 2,
37
+ safeAreaBottom = systemInfo.safeArea?.bottom || 0,
38
+ bottom = systemInfo.screenHeight - safeAreaBottom
37
39
  return {
38
40
  status,
39
41
  nav,
40
- bottom: systemInfo.safeArea?.bottom || 0
42
+ bottom
41
43
  }
42
44
  }