@uxda/appkit 4.3.5 → 4.3.6

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/index.js CHANGED
@@ -128,6 +128,7 @@ function requestWxH5Pay(options) {
128
128
  title: "\u63D0\u793A",
129
129
  content: "\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u5FAE\u4FE1\u652F\u4ED8\uFF0C\u8BF7\u5728\u5FAE\u4FE1\u5185\u7F6E\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00",
130
130
  confirmText: "\u786E\u5B9A",
131
+ confirmColor: "#017fff",
131
132
  success: () => {
132
133
  }
133
134
  });
@@ -3795,7 +3796,8 @@ var script$A = /* @__PURE__ */ defineComponent({
3795
3796
  headerApp: { type: String, required: true },
3796
3797
  app: { type: String, required: true },
3797
3798
  tenant: { type: String, required: true },
3798
- payFinishJumpUrl: { type: String, required: false }
3799
+ payFinishJumpUrl: { type: String, required: false },
3800
+ apps: { type: String, required: false }
3799
3801
  },
3800
3802
  emits: ["complete", "agree"],
3801
3803
  setup(__props, { emit: __emit }) {
@@ -3959,13 +3961,46 @@ var script$A = /* @__PURE__ */ defineComponent({
3959
3961
  });
3960
3962
  }
3961
3963
  }
3962
- const onPayClick = () => {
3964
+ const onPayClick = async () => {
3963
3965
  if (selectBean.value && !isCombinedPayment.value) {
3964
3966
  showDialog.value = true;
3965
3967
  return;
3966
3968
  }
3969
+ if (isCombinedPayment.value) {
3970
+ const res = await checkBalance();
3971
+ if (!res) return;
3972
+ }
3967
3973
  proceedWechatPayment();
3968
3974
  };
3975
+ async function checkBalance() {
3976
+ const $http = useHttp$2();
3977
+ return new Promise((resolve, reject) => {
3978
+ state.buttonLoading = true;
3979
+ $http.get(endpoints$2.\u83B7\u53D6\u4F59\u989D\u660E\u7EC6, {
3980
+ app: props.apps
3981
+ }).then((data) => {
3982
+ state.buttonLoading = false;
3983
+ if (data.commonAccount < balance.value) {
3984
+ showModal({
3985
+ title: "\u6E29\u99A8\u63D0\u793A",
3986
+ content: "\u4E91\u8C46\u4E0D\u8DB3\uFF0C\u8BF7\u5237\u65B0\u540E\u518D\u6B21\u786E\u8BA4",
3987
+ showCancel: false,
3988
+ confirmText: "\u5237\u65B0",
3989
+ confirmColor: "#017fff",
3990
+ success: () => {
3991
+ balance.value = data.commonAccount;
3992
+ }
3993
+ });
3994
+ resolve(false);
3995
+ } else {
3996
+ resolve(true);
3997
+ }
3998
+ }).catch((error) => {
3999
+ state.buttonLoading = false;
4000
+ resolve(false);
4001
+ });
4002
+ });
4003
+ }
3969
4004
  return (_ctx, _cache) => {
3970
4005
  const _component_nut_checkbox = Checkbox;
3971
4006
  const _component_nut_button = Button;
@@ -5960,6 +5995,7 @@ var script$o = /* @__PURE__ */ defineComponent({
5960
5995
  showModal({
5961
5996
  content: toastMap[type],
5962
5997
  showCancel: false,
5998
+ confirmColor: "#017fff",
5963
5999
  confirmText: "\u77E5\u9053\u4E86"
5964
6000
  });
5965
6001
  }
@@ -8639,6 +8675,7 @@ var script$b = /* @__PURE__ */ defineComponent({
8639
8675
  title: "\u63D0\u793A",
8640
8676
  content: "\u786E\u5B9A\u8981\u9000\u51FA\u767B\u5F55\u5417\uFF1F",
8641
8677
  confirmText: "\u786E\u5B9A",
8678
+ confirmColor: "#017fff",
8642
8679
  success: async (e) => {
8643
8680
  if (e.confirm) {
8644
8681
  emits("logout");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.3.5",
3
+ "version": "4.3.6",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -152,6 +152,7 @@ function onHelpClick(type: string) {
152
152
  showModal({
153
153
  content: toastMap[type],
154
154
  showCancel: false,
155
+ confirmColor: '#017fff',
155
156
  confirmText: '知道了',
156
157
  })
157
158
  }
@@ -104,8 +104,9 @@
104
104
  import { computed, onMounted, reactive, ref } from "vue";
105
105
  import RightsPicker, { Amount } from "./RightsPicker.vue";
106
106
  import { endpoints, useHttp } from "../api";
107
+ import { endpoints as balanceEndpoints } from "../../balance/api";
107
108
  import { requestBrandWCPayByBean, requestPaymentByBean } from "../services";
108
- import Taro, { showToast, useRouter } from "@tarojs/taro";
109
+ import Taro, { showToast, useRouter, showModal } from "@tarojs/taro";
109
110
  import { useAmount } from "../../shared/composables/useAmount";
110
111
  import { isWechat } from "../../shared/composables/useDeviceEnv";
111
112
 
@@ -134,6 +135,10 @@ export interface RechargeViewProps {
134
135
  * h5支付完成后跳转地址
135
136
  */
136
137
  payFinishJumpUrl?: "";
138
+ /**
139
+ * 所有应用
140
+ **/
141
+ apps?: string;
137
142
  }
138
143
 
139
144
  const props = defineProps<RechargeViewProps>();
@@ -339,16 +344,59 @@ function proceedWechatPayment() {
339
344
  }
340
345
  }
341
346
 
342
- const onPayClick = () => {
347
+ const onPayClick = async () => {
343
348
  // 用云豆支付(纯云豆支付)
344
349
  if (selectBean.value && !isCombinedPayment.value) {
345
350
  showDialog.value = true;
346
351
  return;
347
352
  }
348
353
 
354
+ if (isCombinedPayment.value) {
355
+ // 检验云豆是否已经改变,改变则刷新选择
356
+ const res = await checkBalance()
357
+ if (!res) return
358
+ }
359
+
349
360
  // 纯微信支付
350
361
  proceedWechatPayment();
351
- };
362
+ }
363
+
364
+ /**
365
+ * 校验余额是否充足
366
+ */
367
+ async function checkBalance() {
368
+ const $http = useHttp()
369
+ return new Promise((resolve, reject) => {
370
+ state.buttonLoading = true;
371
+ $http
372
+ .get<any>(balanceEndpoints.获取余额明细, {
373
+ app: props.apps,
374
+ })
375
+ .then((data) => {
376
+ state.buttonLoading = false;
377
+ if (data.commonAccount < balance.value) {
378
+ showModal({
379
+ title: '温馨提示',
380
+ content: '云豆不足,请刷新后再次确认',
381
+ showCancel: false,
382
+ confirmText: '刷新',
383
+ confirmColor: '#017fff',
384
+ success: () => {
385
+ balance.value = data.commonAccount;
386
+ }
387
+ })
388
+ resolve(false)
389
+
390
+ } else {
391
+ resolve(true)
392
+ }
393
+ }).catch((error) => {
394
+ state.buttonLoading = false;
395
+ resolve(false)
396
+ })
397
+ })
398
+ }
399
+
352
400
  </script>
353
401
 
354
402
  <style lang="scss">
@@ -51,6 +51,7 @@ function requestWxH5Pay(options: PrePayOptions) {
51
51
  title: '提示',
52
52
  content: '当前环境不支持微信支付,请在微信内置浏览器中打开',
53
53
  confirmText: '确定',
54
+ confirmColor: '#017fff',
54
55
  success: () => {},
55
56
  })
56
57
  return
@@ -360,6 +360,7 @@ function toLogout() {
360
360
  title: "提示",
361
361
  content: "确定要退出登录吗?",
362
362
  confirmText: "确定",
363
+ confirmColor: '#017fff',
363
364
  success: async (e: any) => {
364
365
  if (e.confirm) {
365
366
  emits("logout");