@uxda/appkit 4.1.46 → 4.1.50

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/dist/appkit.css CHANGED
@@ -393,7 +393,8 @@
393
393
  align-items: center;
394
394
  padding: 0 10px;
395
395
  border-radius: 0px;
396
- box-shadow: 0px -5px 14px -5px rgba(0, 0, 0, 0.1); /* 上边框阴影 */
396
+ box-shadow: 0px -5px 14px -5px rgba(0, 0, 0, 0.1);
397
+ /* 上边框阴影 */
397
398
  }
398
399
  .recharge-view2 .amount-footer .buy-amount .left {
399
400
  width: 70%;
package/dist/index.js CHANGED
@@ -1836,6 +1836,32 @@ var script$x = /* @__PURE__ */ defineComponent({
1836
1836
 
1837
1837
  script$x.__file = "src/payment/components/RightsPicker.vue";
1838
1838
 
1839
+ function useAmount() {
1840
+ function limitDecimal(value, precision = 1) {
1841
+ if (!value) return value;
1842
+ value = String(value);
1843
+ if (value.includes(".")) {
1844
+ value = value.slice(0, value.indexOf(".") + (precision + 1));
1845
+ }
1846
+ value = value.replace(/[^0-9.]/g, "");
1847
+ value = value.replace(/\.{2,}/g, ".");
1848
+ return value;
1849
+ }
1850
+ function formatAmount(value, digits = 2) {
1851
+ if (!value) {
1852
+ return "0";
1853
+ }
1854
+ return value.toLocaleString("en-US", {
1855
+ minimumFractionDigits: 0,
1856
+ maximumFractionDigits: digits
1857
+ });
1858
+ }
1859
+ return {
1860
+ limitDecimal,
1861
+ formatAmount
1862
+ };
1863
+ }
1864
+
1839
1865
  const _hoisted_1$t = { class: "view recharge-view2" };
1840
1866
  const _hoisted_2$k = { class: "flex-grow" };
1841
1867
  const _hoisted_3$f = {
@@ -1873,6 +1899,7 @@ var script$w = /* @__PURE__ */ defineComponent({
1873
1899
  emits: ["complete", "agree"],
1874
1900
  setup(__props, { emit: __emit }) {
1875
1901
  const props = __props;
1902
+ const { formatAmount } = useAmount();
1876
1903
  const emit = __emit;
1877
1904
  const state = reactive({
1878
1905
  agreed: false,
@@ -1972,13 +1999,13 @@ var script$w = /* @__PURE__ */ defineComponent({
1972
1999
  !selectBean.value ? (openBlock(), createElementBlock(
1973
2000
  "div",
1974
2001
  _hoisted_5$a,
1975
- "\u4F59\u989D " + toDisplayString(balance.value),
2002
+ "\u4F59\u989D " + toDisplayString(unref(formatAmount)(balance.value || 0)),
1976
2003
  1
1977
2004
  /* TEXT */
1978
2005
  )) : (openBlock(), createElementBlock(
1979
2006
  "div",
1980
2007
  _hoisted_6$5,
1981
- "\u6263\u51CF\u540E\u4F59\u989D " + toDisplayString((balance.value - amounts.value[state.selected].paymentAmount).toFixed(1)),
2008
+ "\u6263\u51CF\u540E\u4F59\u989D " + toDisplayString(unref(formatAmount)(balance.value - amounts.value[state.selected].paymentAmount)),
1982
2009
  1
1983
2010
  /* TEXT */
1984
2011
  ))
@@ -1991,7 +2018,7 @@ var script$w = /* @__PURE__ */ defineComponent({
1991
2018
  createElementVNode(
1992
2019
  "div",
1993
2020
  _hoisted_7$5,
1994
- "-" + toDisplayString(amounts.value[state.selected].paymentAmount),
2021
+ "-" + toDisplayString(unref(formatAmount)(amounts.value[state.selected].paymentAmount || 0)),
1995
2022
  1
1996
2023
  /* TEXT */
1997
2024
  ),
@@ -2031,7 +2058,7 @@ var script$w = /* @__PURE__ */ defineComponent({
2031
2058
  /* HOISTED */
2032
2059
  )),
2033
2060
  createTextVNode(
2034
- toDisplayString(currentAmount.value),
2061
+ toDisplayString(unref(formatAmount)(currentAmount.value)),
2035
2062
  1
2036
2063
  /* TEXT */
2037
2064
  )
@@ -2068,21 +2095,21 @@ var script$w = /* @__PURE__ */ defineComponent({
2068
2095
  createElementVNode(
2069
2096
  "div",
2070
2097
  _hoisted_14$2,
2071
- "\u4E91\u8C46\u6263\u51CF\uFF1A" + toDisplayString(amounts.value[state.selected].paymentAmount),
2098
+ "\u4E91\u8C46\u6263\u51CF\uFF1A" + toDisplayString(unref(formatAmount)(amounts.value[state.selected].paymentAmount || 0)),
2072
2099
  1
2073
2100
  /* TEXT */
2074
2101
  ),
2075
2102
  createElementVNode(
2076
2103
  "div",
2077
2104
  _hoisted_15$2,
2078
- "\u6743\u76CA\u589E\u52A0\uFF1A" + toDisplayString(amounts.value[state.selected].priceRightNum) + "\u7B14",
2105
+ "\u6743\u76CA\u589E\u52A0\uFF1A" + toDisplayString(unref(formatAmount)(amounts.value[state.selected].priceRightNum || 0)) + "\u7B14",
2079
2106
  1
2080
2107
  /* TEXT */
2081
2108
  ),
2082
2109
  createElementVNode(
2083
2110
  "div",
2084
2111
  _hoisted_16$2,
2085
- "\u6263\u51CF\u540E\u4E91\u8C46\u4F59\u989D\uFF1A" + toDisplayString((balance.value - amounts.value[state.selected].paymentAmount).toFixed(1)),
2112
+ "\u6263\u51CF\u540E\u4E91\u8C46\u4F59\u989D\uFF1A" + toDisplayString(unref(formatAmount)(balance.value - amounts.value[state.selected].paymentAmount)),
2086
2113
  1
2087
2114
  /* TEXT */
2088
2115
  )
@@ -2131,6 +2158,7 @@ var script$v = /* @__PURE__ */ defineComponent({
2131
2158
  ],
2132
2159
  setup(__props, { expose: __expose, emit: __emit }) {
2133
2160
  const props = __props;
2161
+ const { formatAmount } = useAmount();
2134
2162
  const balance = ref({
2135
2163
  total: 0,
2136
2164
  privileges: []
@@ -2176,7 +2204,7 @@ var script$v = /* @__PURE__ */ defineComponent({
2176
2204
  createElementVNode(
2177
2205
  "div",
2178
2206
  _hoisted_5$9,
2179
- toDisplayString(balance.value.total || 0),
2207
+ toDisplayString(unref(formatAmount)(balance.value.total || 0)),
2180
2208
  1
2181
2209
  /* TEXT */
2182
2210
  )
@@ -2691,6 +2719,7 @@ var script$p = /* @__PURE__ */ defineComponent({
2691
2719
  setup(__props, { emit: __emit }) {
2692
2720
  ref(false);
2693
2721
  const props = __props;
2722
+ const { formatAmount } = useAmount();
2694
2723
  const emit = __emit;
2695
2724
  const filterOpen = ref(false);
2696
2725
  const rulesPopupOpen = ref(false);
@@ -2904,7 +2933,7 @@ var script$p = /* @__PURE__ */ defineComponent({
2904
2933
  createElementVNode(
2905
2934
  "div",
2906
2935
  _hoisted_6$4,
2907
- toDisplayString(balance.value.total || 0),
2936
+ toDisplayString(unref(formatAmount)(balance.value.total || 0)),
2908
2937
  1
2909
2938
  /* TEXT */
2910
2939
  ),
@@ -2936,7 +2965,7 @@ var script$p = /* @__PURE__ */ defineComponent({
2936
2965
  createElementVNode(
2937
2966
  "span",
2938
2967
  null,
2939
- toDisplayString(item.count),
2968
+ toDisplayString(unref(formatAmount)(item.count || 0)),
2940
2969
  1
2941
2970
  /* TEXT */
2942
2971
  ),
@@ -2999,7 +3028,7 @@ var script$p = /* @__PURE__ */ defineComponent({
2999
3028
  createElementVNode(
3000
3029
  "div",
3001
3030
  _hoisted_15$1,
3002
- toDisplayString(item.count) + toDisplayString(item.unit),
3031
+ toDisplayString(unref(formatAmount)(item.count || 0)) + toDisplayString(item.unit),
3003
3032
  1
3004
3033
  /* TEXT */
3005
3034
  ),
@@ -3447,6 +3476,10 @@ var script$m = /* @__PURE__ */ defineComponent({
3447
3476
  {
3448
3477
  label: "\u5151\u6362",
3449
3478
  value: "exchange"
3479
+ },
3480
+ {
3481
+ label: "\u8FD4\u4F63",
3482
+ value: "rebate"
3450
3483
  }
3451
3484
  ]
3452
3485
  }
@@ -3634,6 +3667,7 @@ var script$k = /* @__PURE__ */ defineComponent({
3634
3667
  ],
3635
3668
  setup(__props, { expose: __expose, emit: __emit }) {
3636
3669
  const props = __props;
3670
+ const { formatAmount } = useAmount();
3637
3671
  const tab = ref("person");
3638
3672
  const promoter = ref({
3639
3673
  total: 0,
@@ -3696,7 +3730,7 @@ var script$k = /* @__PURE__ */ defineComponent({
3696
3730
  createElementVNode(
3697
3731
  "div",
3698
3732
  _hoisted_3$8,
3699
- toDisplayString(promoter.value.balance),
3733
+ toDisplayString(unref(formatAmount)(promoter.value.balance || 0)),
3700
3734
  1
3701
3735
  /* TEXT */
3702
3736
  ),
@@ -3728,13 +3762,13 @@ var script$k = /* @__PURE__ */ defineComponent({
3728
3762
  _cache[8] || (_cache[8] = createElementVNode(
3729
3763
  "div",
3730
3764
  { class: "promoter-card-ft-info" },
3731
- "\u9500\u552E\u7D2F\u8BA1\u6536\u76CA(\u7B14)",
3765
+ "\u9500\u552E\u7D2F\u8BA1\u6536\u76CA(\u5143)",
3732
3766
  -1
3733
3767
  /* HOISTED */
3734
3768
  )),
3735
3769
  createElementVNode("div", _hoisted_5$5, [
3736
3770
  createTextVNode(
3737
- toDisplayString(promoter.value.totalIncome) + " ",
3771
+ toDisplayString(unref(formatAmount)(promoter.value.totalIncome || 0)) + " ",
3738
3772
  1
3739
3773
  /* TEXT */
3740
3774
  ),
@@ -3766,7 +3800,7 @@ var script$k = /* @__PURE__ */ defineComponent({
3766
3800
  )),
3767
3801
  createElementVNode("div", _hoisted_7$3, [
3768
3802
  createTextVNode(
3769
- toDisplayString(promoter.value.totalRebateIncome) + " ",
3803
+ toDisplayString(unref(formatAmount)(promoter.value.totalRebateIncome || 0)) + " ",
3770
3804
  1
3771
3805
  /* TEXT */
3772
3806
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.1.46",
3
+ "version": "4.1.50",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -16,7 +16,7 @@
16
16
  <div class="rule" @click="rulesPopupOpen = true">规则说明</div>
17
17
  </div>
18
18
  <div class="bean-counts spa-between">
19
- <div class="counts number">{{ balance.total || 0 }}</div>
19
+ <div class="counts number">{{ formatAmount(balance.total || 0) }}</div>
20
20
  <div class="pay" @click="gotoRecharge">云豆充值</div>
21
21
  </div>
22
22
  </div>
@@ -26,7 +26,7 @@
26
26
  <div class="list">
27
27
  <div class="item star-item" v-for="(item, index) in balance.privileges.corporateStar" :key="index">
28
28
  <div class="item-count">
29
- <span>{{ item.count }}</span><span>{{ item.unit }}</span>
29
+ <span>{{ formatAmount(item.count || 0) }}</span><span>{{ item.unit }}</span>
30
30
  </div>
31
31
  <div class="item-title">
32
32
  <div>{{ item.title }}</div>
@@ -42,7 +42,7 @@
42
42
  <div class="title">AI审批权益</div>
43
43
  <div class="list">
44
44
  <div class="item" v-for="(item, index) in balance.privileges.aiapprove" :key="index">
45
- <div class="item-count">{{ item.count }}{{ item.unit }}</div>
45
+ <div class="item-count">{{ formatAmount(item.count || 0) }}{{ item.unit }}</div>
46
46
  <div class="item-title">{{ item.title }}</div>
47
47
  </div>
48
48
  </div>
@@ -130,6 +130,7 @@ import dayjs from 'dayjs'
130
130
  import EmptyView from '../../shared/components/EmptyView.vue'
131
131
  import Tip from './Tip.vue'
132
132
  import groupBy from 'lodash/groupBy'
133
+ import { useAmount } from '../../shared/composables/useAmount'
133
134
 
134
135
  const refreshing = ref(false)
135
136
 
@@ -140,6 +141,7 @@ const props = withDefaults(defineProps<AccountViewProps>(), {
140
141
  app: '',
141
142
  })
142
143
 
144
+ const { formatAmount } = useAmount()
143
145
  const emit = defineEmits(['recharge', 'trade'])
144
146
 
145
147
  const filterOpen = ref<boolean>(false)
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  <span class="baan-name">云豆</span>
11
11
  </div>
12
- <div class="bean-nums number">{{ balance.total || 0 }}</div>
12
+ <div class="bean-nums number">{{ formatAmount(balance.total || 0) }}</div>
13
13
  </div>
14
14
  <div class="card-row-right">
15
15
  <div class="account-info-entry" @click="gotoDetail">
@@ -43,6 +43,7 @@ import { ref } from 'vue'
43
43
  import { endpoints, useHttp } from '../api'
44
44
  import { Balance } from '../types'
45
45
  import { useDidShow } from '@tarojs/taro'
46
+ import { useAmount } from '../../shared/composables/useAmount'
46
47
 
47
48
  type BalanceCardProps = {
48
49
  app: string
@@ -51,6 +52,7 @@ const props = withDefaults(defineProps<BalanceCardProps>(), {
51
52
  app: '',
52
53
  })
53
54
 
55
+ const { formatAmount } = useAmount()
54
56
  const balance = ref<Balance>({
55
57
  total: 0,
56
58
  privileges: [],
@@ -71,6 +71,10 @@ const filterSections = ref<FilterSecion[]>([
71
71
  {
72
72
  label: '兑换',
73
73
  value: 'exchange'
74
+ },
75
+ {
76
+ label: '返佣',
77
+ value: 'rebate'
74
78
  }
75
79
  ]
76
80
  },
@@ -6,15 +6,15 @@
6
6
  </div>
7
7
  <div class="promoter-card-hd" @click="emits('blance', tab)"
8
8
  v-if="applyRecord.distributorFlag === 'Y' || applyRecord.accessCheckStatus === 'Y'">
9
- <div class="promoter-card-hd-num">{{ promoter.balance }}</div>
9
+ <div class="promoter-card-hd-num">{{ formatAmount(promoter.balance || 0) }}</div>
10
10
  <div class="promoter-card-hd-info">可提现余额(元)</div>
11
11
  <img class="arrow-img" src="https://cdn.ddjf.com/static/images/appkit/arrow.png" alt="">
12
12
  </div>
13
13
  <div class="promoter-card-ft">
14
14
  <div class="promoter-card-ft-item" v-if="applyRecord.accessCheckStatus === 'Y'" @click="emits('profits', tab)">
15
- <div class="promoter-card-ft-info">销售累计收益()</div>
15
+ <div class="promoter-card-ft-info">销售累计收益()</div>
16
16
  <div class="promoter-card-ft-num">
17
- {{ promoter.totalIncome }}
17
+ {{ formatAmount(promoter.totalIncome || 0) }}
18
18
  <img class="arrow-img" src="https://cdn.ddjf.com/static/images/appkit/arrow.png" alt="">
19
19
  </div>
20
20
  </div>
@@ -23,7 +23,7 @@
23
23
  <div class="promoter-card-ft-item" @click="emits('rebate', tab)" v-if="applyRecord.distributorFlag === 'Y'">
24
24
  <div class="promoter-card-ft-info">返佣累计收益(元)</div>
25
25
  <div class="promoter-card-ft-num">
26
- {{ promoter.totalRebateIncome }}
26
+ {{ formatAmount(promoter.totalRebateIncome || 0) }}
27
27
  <img class="arrow-img" src="https://cdn.ddjf.com/static/images/appkit/arrow.png" alt="">
28
28
  </div>
29
29
  </div>
@@ -36,6 +36,7 @@ import { ref, watch } from 'vue'
36
36
  import { endpoints, useHttp } from '../api'
37
37
  import { Promoter } from '../types'
38
38
  import { useDidShow } from '@tarojs/taro'
39
+ import { useAmount } from '../../shared/composables/useAmount'
39
40
 
40
41
  type PromoterCardProps = {
41
42
  useCase: string
@@ -48,6 +49,7 @@ const props = withDefaults(defineProps<PromoterCardProps>(), {
48
49
  isAdmin: true
49
50
  })
50
51
 
52
+ const { formatAmount } = useAmount()
51
53
  const tab = ref('person')
52
54
 
53
55
  const promoter = ref<Promoter>({
@@ -1,44 +1,42 @@
1
1
  <template>
2
2
  <view class="view recharge-view2">
3
3
  <view class="flex-grow">
4
- <rights-picker :items="amounts"
5
- :selected="state.selected"
6
- @change="onAmountSelect" />
4
+ <rights-picker :items="amounts" :selected="state.selected" @change="onAmountSelect" />
7
5
  <div class="bean-buy" v-if="amounts[state.selected]">
8
6
  <div class="left">
9
7
  <div class="title">使用云豆支付</div>
10
- <div class="amount" v-if="!selectBean">余额 {{balance}}</div>
11
- <div class="amount" v-else>扣减后余额 {{(balance - amounts[state.selected].paymentAmount).toFixed(1)}}</div>
8
+ <div class="amount" v-if="!selectBean">余额 {{ formatAmount(balance || 0) }}</div>
9
+ <div class="amount" v-else>扣减后余额 {{ formatAmount(balance - amounts[state.selected].paymentAmount) }}</div>
12
10
  </div>
13
11
  <div class="right" v-if="balance >= amounts[state.selected].paymentAmount" @click="selectBean = !selectBean">
14
- <div class="amount">-{{ amounts[state.selected].paymentAmount }}</div>
15
- <img class="icon" :src="selectBean ? 'https://cdn.ddjf.com/static/images/appkit/select.svg' : 'https://cdn.ddjf.com/static/images/appkit/not-select.svg'" />
12
+ <div class="amount">-{{ formatAmount(amounts[state.selected].paymentAmount || 0) }}</div>
13
+ <img class="icon"
14
+ :src="selectBean ? 'https://cdn.ddjf.com/static/images/appkit/select.svg' : 'https://cdn.ddjf.com/static/images/appkit/not-select.svg'" />
16
15
  </div>
17
- </div>
16
+ </div>
18
17
  </view>
19
18
  <view class="amount-footer">
20
19
  <view class="agreement" v-if="!selectBean">
21
- <nut-checkbox v-model="state.agreed">我已阅读并同意<a class="link inline" @click="onAgreementLinkClick">《大道云平台云豆充值服务协议》</a></nut-checkbox>
20
+ <nut-checkbox v-model="state.agreed">我已阅读并同意<a class="link inline"
21
+ @click="onAgreementLinkClick">《大道云平台云豆充值服务协议》</a></nut-checkbox>
22
22
  </view>
23
23
  <div class="buy-amount">
24
24
  <div class="left">
25
25
  待支付:
26
26
  <span class="amount">
27
- <i>¥</i>{{ currentAmount }}
27
+ <i>¥</i>{{ formatAmount(currentAmount) }}
28
28
  </span>
29
29
  </div>
30
- <nut-button block
31
- shape="square"
32
- :loading="state.buttonLoading"
33
- @click="onPayClick"
34
- class="recharge-button">购买</nut-button>
30
+ <nut-button block shape="square" :loading="state.buttonLoading" @click="onPayClick"
31
+ class="recharge-button">购买</nut-button>
35
32
  </div>
36
33
  </view>
37
- <nut-dialog title="确认购买" custom-class="trade-dialog" v-model:visible="showDialog" @cancel="showDialog = !showDialog" @ok="beanPay" >
34
+ <nut-dialog title="确认购买" custom-class="trade-dialog" v-model:visible="showDialog" @cancel="showDialog = !showDialog"
35
+ @ok="beanPay">
38
36
  <template v-if="amounts[state.selected]">
39
- <div class="item">云豆扣减:{{ amounts[state.selected].paymentAmount }}</div>
40
- <div class="item">权益增加:{{ amounts[state.selected].priceRightNum }}笔</div>
41
- <div class="item">扣减后云豆余额:{{ (balance - amounts[state.selected].paymentAmount).toFixed(1) }}</div>
37
+ <div class="item">云豆扣减:{{ formatAmount(amounts[state.selected].paymentAmount || 0) }}</div>
38
+ <div class="item">权益增加:{{ formatAmount(amounts[state.selected].priceRightNum || 0) }}笔</div>
39
+ <div class="item">扣减后云豆余额:{{ formatAmount(balance - amounts[state.selected].paymentAmount) }}</div>
42
40
  </template>
43
41
  </nut-dialog>
44
42
  </view>
@@ -50,6 +48,7 @@ import RightsPicker, { Amount } from './RightsPicker.vue'
50
48
  import { endpoints, useHttp } from '../api'
51
49
  import { requestPaymentByBean } from '../services'
52
50
  import Taro from '@tarojs/taro'
51
+ import { useAmount } from '../../shared/composables/useAmount'
53
52
 
54
53
  // 充值用户界面
55
54
  // 配置了必须的属性后
@@ -71,9 +70,10 @@ export interface RechargeViewProps {
71
70
  }
72
71
 
73
72
  const props = defineProps<RechargeViewProps>()
73
+ const { formatAmount } = useAmount()
74
74
 
75
75
  const emit = defineEmits<{
76
- (event: 'complete', value: {result: boolean, type: string}): void,
76
+ (event: 'complete', value: { result: boolean, type: string }): void,
77
77
  (event: 'agree'): void,
78
78
  }>()
79
79
 
@@ -101,7 +101,7 @@ const onAmountSelect = (selected: number) => {
101
101
  selectBean.value = false
102
102
  }
103
103
 
104
- const currentAmount = computed(()=>{
104
+ const currentAmount = computed(() => {
105
105
  return amounts.value[state.selected] && !selectBean.value ? amounts.value[state.selected].paymentAmount : 0
106
106
  })
107
107
 
@@ -115,13 +115,13 @@ onMounted(() => {
115
115
 
116
116
  // 云豆支付
117
117
  const showDialog = ref<boolean>(false)
118
- async function beanPay(){
118
+ async function beanPay() {
119
119
  const $http = useHttp()
120
- $http.post( `/payment/paymentCaseConfig/purchase/${amounts.value[state.selected].id}`).then((response: any) => {
120
+ $http.post(`/payment/paymentCaseConfig/purchase/${amounts.value[state.selected].id}`).then((response: any) => {
121
121
  if (response) {
122
122
  showDialog.value = false
123
- emit('complete', {result: response, type: 'bean'})
124
- }else {
123
+ emit('complete', { result: response, type: 'bean' })
124
+ } else {
125
125
  Taro.showToast({
126
126
  title: response.message,
127
127
  icon: 'none',
@@ -133,11 +133,11 @@ async function beanPay(){
133
133
 
134
134
  const onPayClick = () => {
135
135
  // 用云豆支付
136
- if(selectBean.value){
136
+ if (selectBean.value) {
137
137
  showDialog.value = true
138
- return
138
+ return
139
139
  }
140
-
140
+
141
141
  // 微信支付
142
142
  if (!selectBean.value && !state.agreed) {
143
143
  Taro.showToast({
@@ -148,7 +148,7 @@ const onPayClick = () => {
148
148
  }
149
149
  state.buttonLoading = true
150
150
  wx.login({
151
- success ({code}: {code: string}) {
151
+ success({ code }: { code: string }) {
152
152
  requestPaymentByBean({
153
153
  caseConfigId: amounts.value[state.selected].id,
154
154
  amount: amounts.value[state.selected].paymentAmount,
@@ -158,7 +158,7 @@ const onPayClick = () => {
158
158
  }).then(result => {
159
159
  state.buttonLoading = false
160
160
  if (result) {
161
- emit('complete', {result: true, type: 'wePay'})
161
+ emit('complete', { result: true, type: 'wePay' })
162
162
  }
163
163
  })
164
164
  }
@@ -171,10 +171,12 @@ const onPayClick = () => {
171
171
  height: 100%;
172
172
  display: flex;
173
173
  flex-direction: column;
174
+
174
175
  .flex-grow {
175
176
  flex-grow: 1;
176
177
  }
177
- .bean-buy{
178
+
179
+ .bean-buy {
178
180
  margin: 0 15px;
179
181
  padding: 10px;
180
182
  background: #FFFBF3;
@@ -182,16 +184,18 @@ const onPayClick = () => {
182
184
  display: flex;
183
185
  justify-content: space-between;
184
186
  align-items: center;
185
- .left{
186
- .title{
187
- color:#FD6701;
187
+
188
+ .left {
189
+ .title {
190
+ color: #FD6701;
188
191
  font-size: 14px;
189
192
  font-weight: 600;
190
- line-height: 20px;
193
+ line-height: 20px;
191
194
  margin-bottom: 6px;
192
195
  }
193
- .amount{
194
- color:#353535;
196
+
197
+ .amount {
198
+ color: #353535;
195
199
  font-size: 13px;
196
200
  line-height: 16px;
197
201
  background-image: url('https://cdn.ddjf.com/static/images/appkit/yundou.png');
@@ -200,16 +204,19 @@ const onPayClick = () => {
200
204
  padding-left: 24px;
201
205
  }
202
206
  }
203
- .right{
207
+
208
+ .right {
204
209
  display: flex;
205
210
  align-items: center;
206
- .amount{
207
- color:#353535;
211
+
212
+ .amount {
213
+ color: #353535;
208
214
  font-size: 15px;
209
215
  line-height: 20px;
210
216
  margin-right: 10px;
211
217
  }
212
- .icon{
218
+
219
+ .icon {
213
220
  display: block;
214
221
  width: 16px;
215
222
  height: 16px;
@@ -217,9 +224,11 @@ const onPayClick = () => {
217
224
  }
218
225
  }
219
226
  }
227
+
220
228
  .amount-footer {
221
229
  padding: 10px 0;
222
230
  padding-bottom: 20px;
231
+
223
232
  .agreement {
224
233
  font-size: 12px;
225
234
  display: flex;
@@ -227,27 +236,33 @@ const onPayClick = () => {
227
236
  align-items: cebter;
228
237
  height: 40px;
229
238
  }
230
- .buy-amount{
239
+
240
+ .buy-amount {
231
241
  display: flex;
232
242
  justify-content: space-between;
233
243
  align-items: center;
234
244
  padding: 0 10px;
235
245
  border-radius: 0px;
236
- box-shadow: 0px -5px 14px -5px rgba(0, 0, 0, 0.1); /* 上边框阴影 */
237
- .left{
246
+ box-shadow: 0px -5px 14px -5px rgba(0, 0, 0, 0.1);
247
+
248
+ /* 上边框阴影 */
249
+ .left {
238
250
  width: 70%;
239
- color:#353535;
251
+ color: #353535;
240
252
  font-size: 13px;
241
- .amount{
242
- color:#FD6701;
253
+
254
+ .amount {
255
+ color: #FD6701;
243
256
  font-size: 20px;
244
257
  font-weight: 600;
245
- i{
258
+
259
+ i {
246
260
  font-size: 14px;
247
261
  font-style: normal;
248
262
  }
249
263
  }
250
264
  }
265
+
251
266
  .recharge-button {
252
267
  background: linear-gradient(90deg, #FFEBC1 0%, #FFD7A7 52.29%, #FFB875 100%);
253
268
  color: #353535;
@@ -257,36 +272,43 @@ const onPayClick = () => {
257
272
  flex: 1;
258
273
  }
259
274
  }
275
+
260
276
  .nut-checkbox {
261
277
  line-height: 40px;
262
278
  }
279
+
263
280
  .nut-checkbox__label {
264
281
  margin-left: 8px;
265
282
  flex: flex;
266
283
  font-size: 12px;
267
284
  }
285
+
268
286
  .link {
269
287
  display: inline;
270
288
  color: #FD6701;
271
289
  }
272
290
  }
273
291
  }
274
- .trade-dialog{
275
- .nut-dialog__header{
292
+
293
+ .trade-dialog {
294
+ .nut-dialog__header {
276
295
  font-size: 16px;
277
296
  color: #262626
278
297
  }
279
- .item{
298
+
299
+ .item {
280
300
  font-size: 14px;
281
- color:#666666;
301
+ color: #666666;
282
302
  line-height: 21px;
283
303
  }
284
- .nut-dialog__footer-cancel{
304
+
305
+ .nut-dialog__footer-cancel {
285
306
  color: #353535 !important;
286
307
  border-color: #CCCCCC !important;
287
308
  }
309
+
288
310
  .nut-dialog__footer-ok {
289
- border:none;
311
+ border: none;
290
312
  color: #353535;
291
313
  background: linear-gradient(90deg, #FFEBC1 0%, #FFB875 100%);
292
314
  }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * 金额通用方法
3
+ */
4
+
5
+ export function useAmount() {
6
+ /**
7
+ * 限制数字小数位
8
+ */
9
+ function limitDecimal(value, precision = 1) {
10
+ if (!value) return value
11
+
12
+ value = String(value)
13
+
14
+ // 限制最多precision位小数
15
+ if (value.includes('.')) {
16
+ value = value.slice(0, value.indexOf('.') + (precision + 1))
17
+ }
18
+
19
+ // 移除非数字字符
20
+ value = value.replace(/[^0-9.]/g, '')
21
+
22
+ // 防止出现多个小数点
23
+ value = value.replace(/\.{2,}/g, '.')
24
+
25
+ return value
26
+ }
27
+
28
+ /**
29
+ * 格式化金额
30
+ */
31
+ function formatAmount(value: string | number, digits = 2) {
32
+ if (!value) {
33
+ return '0'
34
+ }
35
+
36
+ return value.toLocaleString('en-US', {
37
+ minimumFractionDigits: 0,
38
+ maximumFractionDigits: digits,
39
+ })
40
+ }
41
+
42
+ return {
43
+ limitDecimal,
44
+ formatAmount,
45
+ }
46
+ }
@@ -5,7 +5,7 @@ import { isMobilePhone, isIdentityCard } from 'validator'
5
5
 
6
6
  export function useValidator() {
7
7
  // 身份证号码校验
8
- function certNoValidator(value: unknown) {
8
+ function certNoValidator(value: string) {
9
9
  if (!value) {
10
10
  return '请输入身份证号'
11
11
  } else if (!isIdentityCard(value, 'zh-CN')) {
@@ -15,7 +15,7 @@ export function useValidator() {
15
15
  }
16
16
 
17
17
  // 电话号码校验
18
- function phoneValidator(value: unknown) {
18
+ function phoneValidator(value: string) {
19
19
  if (!value) {
20
20
  return '请输入手机号码'
21
21
  } else if (!isMobilePhone(value, 'zh-CN')) {