@tplc/business 0.2.90 → 0.3.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.
@@ -1,5 +1,38 @@
1
1
  import { LcbActionViewProps } from '../../lcb-action-view/types'
2
2
  import { ActionView } from '../../../action'
3
+ import { ButtonProps } from '@tplc/wot/types/components/wd-button/types'
4
+
5
+ export interface PageBtnProps {
6
+ buttonList: IPageBtn[]
7
+ size?: 'small' | 'medium' | 'large'
8
+ }
9
+ export interface IPageBtn {
10
+ buttonKey: string
11
+ buttonName: string
12
+ buttonType: number
13
+ popUpFlag: boolean
14
+ popUpTip: string
15
+ content: string
16
+ requestParam?: RequestParam
17
+ jumpType?: 1 | 2 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 88
18
+ jumpUrl: string
19
+ requestUrl: string
20
+ jumpPage?: string
21
+ styleContent: StyleContent2
22
+ buttonProps?: ButtonProps
23
+ }
24
+ interface StyleContent2 {
25
+ buttonType: string
26
+ style: Style
27
+ }
28
+
29
+ interface Style {
30
+ width: string
31
+ }
32
+
33
+ interface RequestParam {
34
+ orderNo: string
35
+ }
3
36
 
4
37
  export interface CurrentRightsDetail {
5
38
  coverImg: string
@@ -20,6 +53,7 @@ export interface UserLevelRightsList extends ActionView {
20
53
  icon: string
21
54
  userRightsConfigId: string
22
55
  userRightsContent: string
56
+ buttonList: IPageBtn[]
23
57
  userRightsSubTitle: string
24
58
  userRightsTitle: string
25
59
  link: LcbActionViewProps
@@ -0,0 +1,87 @@
1
+ <template>
2
+ <lcb-action-view
3
+ v-bind="item"
4
+ v-for="item in buttonList"
5
+ :key="item.buttonName"
6
+ @click="link({ item })"
7
+ @refresh="$emit('refresh')"
8
+ >
9
+ <wd-button v-bind="getBtnProps(item)" :size="size">{{ item.buttonName }}</wd-button>
10
+ </lcb-action-view>
11
+ <view class="absolute">
12
+ <wd-message-box />
13
+ </view>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ import type { ButtonProps } from '@tplc/wot/components/wd-button/types'
18
+ import type { IPageBtn, PageBtnProps } from '../../api'
19
+ import { useMessage } from '@tplc/wot'
20
+ const message = useMessage()
21
+ defineOptions({
22
+ name: 'BtnViews',
23
+ options: {
24
+ addGlobalClass: true,
25
+ virtualHost: true,
26
+ styleIsolation: 'shared',
27
+ },
28
+ })
29
+ withDefaults(defineProps<PageBtnProps>(), {
30
+ size: 'small',
31
+ })
32
+ const emits = defineEmits(['refresh'])
33
+ const getBtnProps = (item: IPageBtn) => {
34
+ return {
35
+ type: item.styleContent?.buttonType?.includes?.('theme') ? 'primary' : 'info',
36
+ plain: item.styleContent?.buttonType?.includes?.('Hollow'),
37
+ size: 'small',
38
+ ...item.buttonProps,
39
+ } as ButtonProps
40
+ }
41
+ async function link({ item }: { item: IPageBtn }) {
42
+ if (item.popUpFlag) {
43
+ message
44
+ .confirm({
45
+ msg: item.popUpTip,
46
+ title: item.content,
47
+ })
48
+ .then(async () => {
49
+ if (item.buttonType === 1) {
50
+ await uni.$lcb.http.post(item.requestUrl, item.requestParam)
51
+ emits('refresh')
52
+ }
53
+ })
54
+ .catch(console.log)
55
+ } else if (item.jumpType === 2) {
56
+ uni.navigateTo({
57
+ url: item.jumpUrl,
58
+ })
59
+ // 再次支付
60
+ } else if (item.buttonKey === 'orderPaymentBtn') {
61
+ const {
62
+ data: { paymentParams },
63
+ } = await uni.$lcb.http.post<any>(item.requestUrl, {
64
+ ...item.requestParam,
65
+ paymentPlatform: 'wechat',
66
+ paymentType: 'JSAPI',
67
+ })
68
+ uni.requestPayment({
69
+ provider: 'wxpay',
70
+ ...paymentParams,
71
+ success: () => {
72
+ uni.showToast({
73
+ title: '支付成功',
74
+ icon: 'success',
75
+ })
76
+ emits('refresh')
77
+ },
78
+ fail: () => {
79
+ uni.showToast({
80
+ title: '支付取消',
81
+ icon: 'none',
82
+ })
83
+ },
84
+ })
85
+ }
86
+ }
87
+ </script>
@@ -8,35 +8,31 @@
8
8
  :size="130"
9
9
  canvasId="qrCode"
10
10
  :value="modelValue.qrCode"
11
- v-if="modelValue.qrCode"
11
+ v-if="modelValue.qrCode && currentLevelFlag"
12
12
  />
13
- <view class="text-3 text-#969696 mt-3.5" v-if="modelValue.qrCodeTips">
13
+ <view class="text-3 text-#969696 mt-3.5" v-if="modelValue.qrCodeTips && currentLevelFlag">
14
14
  {{ modelValue.qrCodeTips }}
15
15
  </view>
16
- <wd-button
17
- type="primary"
18
- plain
19
- custom-class="!rounded-10rpx !mt-4 "
20
- @click="onDrawdown"
16
+ <template
21
17
  v-if="
22
18
  ['voucher', 'cashVoucher'].includes(modelValue.userRightsType) &&
23
19
  !hiddenDrawdown &&
24
20
  currentLevelFlag
25
21
  "
26
22
  >
27
- {{ translate('领取') }}
28
- </wd-button>
23
+ <BtnViews :buttonList="modelValue.buttonList" @refresh="emits('refresh')" />
24
+ </template>
29
25
  </view>
30
26
  </wd-popup>
31
27
  </template>
32
28
 
33
29
  <script setup lang="ts">
34
- import { useTranslate } from '@tplc/wot'
30
+ import BtnViews from '../BtnViews/index.vue'
35
31
  import { UserLevelRightsList } from '../../api'
36
32
  import mpHtml from 'mp-html/src/uni-app/components/mp-html/mp-html.vue'
37
33
  import { watch, ref } from 'vue'
38
- const { translate } = useTranslate()
39
34
  const show = ref(false)
35
+ const emits = defineEmits(['refresh'])
40
36
  defineProps<{
41
37
  hiddenDrawdown?: boolean
42
38
  currentLevelFlag?: boolean
@@ -48,11 +44,7 @@ watch(
48
44
  if (val) show.value = true
49
45
  },
50
46
  )
51
- const onDrawdown = () => {
52
- uni.navigateTo({
53
- url: `${uni.$lcb.internalPages.drawdown}?from=vip&id=${modelValue.value?.userRightsConfigId}`,
54
- })
55
- }
47
+
56
48
  const onClose = () => {
57
49
  show.value = false
58
50
  modelValue.value = undefined
@@ -46,7 +46,7 @@
46
46
  titleKey="userRightsTitle"
47
47
  @click="onItemClick"
48
48
  />
49
- <InfoDialog v-model="current" />
49
+ <InfoDialog v-model="current" currentLevelFlag />
50
50
  </view>
51
51
  </lcb-block>
52
52
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.2.90",
3
+ "version": "0.3.2",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -1,5 +1,35 @@
1
1
  import { LcbActionViewProps } from '../../lcb-action-view/types'
2
2
  import { ActionView } from '../../../action'
3
+ import { ButtonProps } from '@tplc/wot/types/components/wd-button/types'
4
+ export interface PageBtnProps {
5
+ buttonList: IPageBtn[]
6
+ size?: 'small' | 'medium' | 'large'
7
+ }
8
+ export interface IPageBtn {
9
+ buttonKey: string
10
+ buttonName: string
11
+ buttonType: number
12
+ popUpFlag: boolean
13
+ popUpTip: string
14
+ content: string
15
+ requestParam?: RequestParam
16
+ jumpType?: 1 | 2 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 88
17
+ jumpUrl: string
18
+ requestUrl: string
19
+ jumpPage?: string
20
+ styleContent: StyleContent2
21
+ buttonProps?: ButtonProps
22
+ }
23
+ interface StyleContent2 {
24
+ buttonType: string
25
+ style: Style
26
+ }
27
+ interface Style {
28
+ width: string
29
+ }
30
+ interface RequestParam {
31
+ orderNo: string
32
+ }
3
33
  export interface CurrentRightsDetail {
4
34
  coverImg: string
5
35
  effectiveDate: string
@@ -18,6 +48,7 @@ export interface UserLevelRightsList extends ActionView {
18
48
  icon: string
19
49
  userRightsConfigId: string
20
50
  userRightsContent: string
51
+ buttonList: IPageBtn[]
21
52
  userRightsSubTitle: string
22
53
  userRightsTitle: string
23
54
  link: LcbActionViewProps
@@ -32,3 +63,4 @@ export interface UserLevelRightsList extends ActionView {
32
63
  export declare const currentRightsDetail: () => Promise<
33
64
  import('../../../action').IResData<CurrentRightsDetail>
34
65
  >
66
+ export {}
@@ -0,0 +1,60 @@
1
+ import type { PageBtnProps } from '../../api'
2
+ declare const _default: import('vue').DefineComponent<
3
+ __VLS_WithDefaults<
4
+ __VLS_TypePropsToOption<PageBtnProps>,
5
+ {
6
+ size: string
7
+ }
8
+ >,
9
+ {},
10
+ unknown,
11
+ {},
12
+ {},
13
+ import('vue').ComponentOptionsMixin,
14
+ import('vue').ComponentOptionsMixin,
15
+ {
16
+ refresh: (...args: any[]) => void
17
+ },
18
+ string,
19
+ import('vue').PublicProps,
20
+ Readonly<
21
+ import('vue').ExtractPropTypes<
22
+ __VLS_WithDefaults<
23
+ __VLS_TypePropsToOption<PageBtnProps>,
24
+ {
25
+ size: string
26
+ }
27
+ >
28
+ >
29
+ > & {
30
+ onRefresh?: ((...args: any[]) => any) | undefined
31
+ },
32
+ {
33
+ size: 'small' | 'medium' | 'large'
34
+ },
35
+ {}
36
+ >
37
+ export default _default
38
+ type __VLS_WithDefaults<P, D> = {
39
+ [K in keyof Pick<P, keyof P>]: K extends keyof D
40
+ ? __VLS_Prettify<
41
+ P[K] & {
42
+ default: D[K]
43
+ }
44
+ >
45
+ : P[K]
46
+ }
47
+ type __VLS_Prettify<T> = {
48
+ [K in keyof T]: T[K]
49
+ } & {}
50
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
51
+ type __VLS_TypePropsToOption<T> = {
52
+ [K in keyof T]-?: {} extends Pick<T, K>
53
+ ? {
54
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>
55
+ }
56
+ : {
57
+ type: import('vue').PropType<T[K]>
58
+ required: true
59
+ }
60
+ }
@@ -16,11 +16,13 @@ declare const _default: import('vue').DefineComponent<
16
16
  import('vue').ComponentOptionsMixin,
17
17
  {
18
18
  'update:modelValue': (modelValue: UserLevelRightsList) => void
19
+ refresh: (...args: any[]) => void
19
20
  },
20
21
  string,
21
22
  import('vue').PublicProps,
22
23
  Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
23
24
  'onUpdate:modelValue'?: ((modelValue: UserLevelRightsList) => any) | undefined
25
+ onRefresh?: ((...args: any[]) => any) | undefined
24
26
  },
25
27
  {},
26
28
  {}