@uxda/appkit 4.2.55 → 4.2.56

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
@@ -1666,6 +1666,33 @@ const requestBrandWCPay = (params, Appcode = "") => {
1666
1666
  });
1667
1667
  });
1668
1668
  };
1669
+ const requestBrandWCPayByBean = (params, Appcode = "") => {
1670
+ return new Promise((resolve, reject) => {
1671
+ const $http = useHttp$2({
1672
+ Appcode,
1673
+ Tenant: params.tenant
1674
+ });
1675
+ $http.post(endpoints.\u83B7\u53D6\u6743\u76CA\u5FAE\u4FE1\u652F\u4ED8, {
1676
+ ...params
1677
+ }).then((response) => {
1678
+ if (!response.json) {
1679
+ showToast({
1680
+ title: response.message,
1681
+ icon: "none"
1682
+ });
1683
+ resolve(false);
1684
+ } else {
1685
+ requestWxH5Pay(response.json).then((result) => {
1686
+ if (result) {
1687
+ resolve(true);
1688
+ } else {
1689
+ resolve(false);
1690
+ }
1691
+ });
1692
+ }
1693
+ });
1694
+ });
1695
+ };
1669
1696
  var requestPayment$1 = {
1670
1697
  install($app) {
1671
1698
  $app.requestPayment = requestPayment;
@@ -2025,7 +2052,8 @@ var script$x = /* @__PURE__ */ defineComponent({
2025
2052
  props: {
2026
2053
  headerApp: { type: String, required: true },
2027
2054
  app: { type: String, required: true },
2028
- tenant: { type: String, required: true }
2055
+ tenant: { type: String, required: true },
2056
+ payFinishJumpUrl: { type: String, required: false }
2029
2057
  },
2030
2058
  emits: ["complete", "agree"],
2031
2059
  setup(__props, { emit: __emit }) {
@@ -2090,22 +2118,36 @@ var script$x = /* @__PURE__ */ defineComponent({
2090
2118
  return false;
2091
2119
  }
2092
2120
  state.buttonLoading = true;
2093
- wx.login({
2094
- success({ code }) {
2095
- requestPaymentByBean({
2096
- caseConfigId: amounts.value[state.selected].id,
2097
- amount: amounts.value[state.selected].paymentAmount,
2098
- app: props.app,
2099
- tenant: props.tenant,
2100
- user: code
2101
- }, props.headerApp).then((result) => {
2102
- state.buttonLoading = false;
2103
- if (result) {
2104
- emit("complete", { result: true, type: "wePay" });
2105
- }
2106
- });
2107
- }
2108
- });
2121
+ if (Taro.getEnv() === "WEB") {
2122
+ requestBrandWCPayByBean({
2123
+ caseConfigId: amounts.value[state.selected].id,
2124
+ amount: amounts.value[state.selected].paymentAmount,
2125
+ app: "loankitMp",
2126
+ tenant: props.tenant,
2127
+ accountAuthFlag: false,
2128
+ channelCode: "centergzh",
2129
+ payFinishJumpUrl: props.payFinishJumpUrl
2130
+ }).then((result) => {
2131
+ console.log(result);
2132
+ });
2133
+ } else {
2134
+ wx.login({
2135
+ success({ code }) {
2136
+ requestPaymentByBean({
2137
+ caseConfigId: amounts.value[state.selected].id,
2138
+ amount: amounts.value[state.selected].paymentAmount,
2139
+ app: props.app,
2140
+ tenant: props.tenant,
2141
+ user: code
2142
+ }, props.headerApp).then((result) => {
2143
+ state.buttonLoading = false;
2144
+ if (result) {
2145
+ emit("complete", { result: true, type: "wePay" });
2146
+ }
2147
+ });
2148
+ }
2149
+ });
2150
+ }
2109
2151
  };
2110
2152
  return (_ctx, _cache) => {
2111
2153
  const _component_nut_checkbox = Checkbox;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.2.55",
3
+ "version": "4.2.56",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -50,7 +50,7 @@
50
50
  import { computed, onMounted, reactive, ref } from 'vue'
51
51
  import RightsPicker, { Amount } from './RightsPicker.vue'
52
52
  import { endpoints, useHttp } from '../api'
53
- import { requestPaymentByBean } from '../services'
53
+ import { requestBrandWCPayByBean, requestPaymentByBean } from '../services'
54
54
  import Taro, { showToast } from '@tarojs/taro'
55
55
  import { useAmount } from '../../shared/composables/useAmount'
56
56
 
@@ -74,7 +74,11 @@ export interface RechargeViewProps {
74
74
  /**
75
75
  * 租户
76
76
  */
77
- tenant: string
77
+ tenant: string,
78
+ /**
79
+ * h5支付完成后跳转地址
80
+ */
81
+ payFinishJumpUrl?: ''
78
82
  }
79
83
 
80
84
  const props = defineProps<RechargeViewProps>()
@@ -157,22 +161,37 @@ const onPayClick = () => {
157
161
  return false
158
162
  }
159
163
  state.buttonLoading = true
160
- wx.login({
161
- success({ code }: { code: string }) {
162
- requestPaymentByBean({
163
- caseConfigId: amounts.value[state.selected].id,
164
- amount: amounts.value[state.selected].paymentAmount,
165
- app: props.app,
166
- tenant: props.tenant,
167
- user: code,
168
- }, props.headerApp).then(result => {
169
- state.buttonLoading = false
170
- if (result) {
171
- emit('complete', { result: true, type: 'wePay' })
172
- }
173
- })
174
- }
175
- })
164
+
165
+ if (Taro.getEnv() === 'WEB') {
166
+ requestBrandWCPayByBean({
167
+ caseConfigId: amounts.value[state.selected].id,
168
+ amount: amounts.value[state.selected].paymentAmount,
169
+ app: 'loankitMp',
170
+ tenant: props.tenant,
171
+ accountAuthFlag: false,
172
+ channelCode: 'centergzh',
173
+ payFinishJumpUrl: props.payFinishJumpUrl
174
+ }).then(result => {
175
+ console.log(result), 'result'
176
+ })
177
+ } else {
178
+ wx.login({
179
+ success({ code }: { code: string }) {
180
+ requestPaymentByBean({
181
+ caseConfigId: amounts.value[state.selected].id,
182
+ amount: amounts.value[state.selected].paymentAmount,
183
+ app: props.app,
184
+ tenant: props.tenant,
185
+ user: code,
186
+ }, props.headerApp).then(result => {
187
+ state.buttonLoading = false
188
+ if (result) {
189
+ emit('complete', { result: true, type: 'wePay' })
190
+ }
191
+ })
192
+ }
193
+ })
194
+ }
176
195
  }
177
196
  </script>
178
197
 
@@ -87,10 +87,40 @@ const requestBrandWCPay = (params: PaymentParams, Appcode = '') => {
87
87
  })
88
88
  }
89
89
 
90
+ const requestBrandWCPayByBean = (params: PaymentParams, Appcode = '') => {
91
+ return new Promise<boolean>((resolve, reject) => {
92
+ const $http = useHttp({
93
+ Appcode: Appcode,
94
+ Tenant: params.tenant,
95
+ })
96
+ $http
97
+ .post(endpoints.获取权益微信支付, {
98
+ ...params,
99
+ })
100
+ .then((response: any) => {
101
+ if (!response.json) {
102
+ showToast({
103
+ title: response.message,
104
+ icon: 'none',
105
+ })
106
+ resolve(false)
107
+ } else {
108
+ requestWxH5Pay(response.json).then((result) => {
109
+ if (result) {
110
+ resolve(true)
111
+ } else {
112
+ resolve(false)
113
+ }
114
+ })
115
+ }
116
+ })
117
+ })
118
+ }
119
+
90
120
  export default {
91
121
  install($app: DollarApp) {
92
122
  $app.requestPayment = requestPayment
93
123
  },
94
124
  }
95
125
 
96
- export { requestPayment, requestPaymentByBean, requestBrandWCPay }
126
+ export { requestPayment, requestPaymentByBean, requestBrandWCPay, requestBrandWCPayByBean }