From e16e1e3bdcdbb9975a099275b1b7a211b2b3df8a Mon Sep 17 00:00:00 2001 From: Waiting Date: Sun, 19 Jan 2025 14:34:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(user):=20=E6=B7=BB=E5=8A=A0=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=AF=86=E7=A0=81=E8=AE=BE=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user/index.ts | 21 +- src/api/user/types.ts | 11 + src/components/pay-password-dialog.vue | 240 +++++++++++++++++++ src/manifest.json | 2 +- src/pages/mine/index.vue | 27 ++- src/pages/tab/user/index.vue | 28 +++ src/static/images/ic_member_pay_password.png | Bin 0 -> 4382 bytes src/static/styles/common.scss | 5 + src/store/modules/user/index.ts | 23 +- src/store/modules/user/types.ts | 3 +- tsconfig.json | 6 +- types/components.d.ts | 1 + 12 files changed, 350 insertions(+), 17 deletions(-) create mode 100644 src/components/pay-password-dialog.vue create mode 100644 src/pages/tab/user/index.vue create mode 100644 src/static/images/ic_member_pay_password.png diff --git a/src/api/user/index.ts b/src/api/user/index.ts index 79dfa05..fddf85c 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -1,7 +1,7 @@ /** * 用户信息相关接口 */ -import type { CouponBean, LoginParams, LoginResult, RegisterParams, TerminalBean } from './types'; +import type { CouponBean, LoginParams, LoginResult, RegisterParams, TerminalBean, SetPayPasswordParams, PayPasswordResponse } from './types'; import { get, post } from '@/utils/request'; import { UserBean } from '@/store/modules/user/types'; @@ -33,7 +33,9 @@ enum URL { tradeList = '/memberIncoming/wx_balance_records', terminal = 'wechat/coupons/terminal?companyId=', cardLink = '/wc/wechat/get_card_url', - registerCoupon = '/couponsStrategy/wx_register_coupon' + registerCoupon = '/couponsStrategy/wx_register_coupon', + setPayPassword = '/app/pay/set_paypwd', + payPasswordStatus = '/user/pay-password/status', } export const getUserProfile = () => get({ url: URL.profile }); @@ -76,3 +78,18 @@ export const getTradeList = (data: any) => post({ url: URL.tradeList, data export const getCardLink = () => get({ url: URL.cardLink }); export const getRegisterCoupon = () => get({ url: URL.registerCoupon }); + +/** + * 设置支付密码 + */ +export const setPayPassword = (data: SetPayPasswordParams) => post({ + url: URL.setPayPassword, + data +}); + +/** + * 获取支付密码状态 + */ +export const getPayPasswordStatus = () => get<{ hasPassword: boolean }>({ + url: URL.payPasswordStatus +}); diff --git a/src/api/user/types.ts b/src/api/user/types.ts index 4b1ca50..261e687 100644 --- a/src/api/user/types.ts +++ b/src/api/user/types.ts @@ -118,3 +118,14 @@ export interface TerminalBean { token: string; type: number; } + +export interface SetPayPasswordParams { + paywithpwd: number + oldpwd: string, + newpwd: string +} + +export interface PayPasswordResponse { + success: boolean + message: string +} diff --git a/src/components/pay-password-dialog.vue b/src/components/pay-password-dialog.vue new file mode 100644 index 0000000..ec9ddcc --- /dev/null +++ b/src/components/pay-password-dialog.vue @@ -0,0 +1,240 @@ + + + + + \ No newline at end of file diff --git a/src/manifest.json b/src/manifest.json index 1ea5929..9dce7a5 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -18,7 +18,7 @@ "modules": {} }, "mp-weixin": { - "appid": "wx67a750d0ceed4d88", + "appid": "wx92e663dc11d0c0a8", "setting": { "urlCheck": false }, diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue index e22e184..2fcb5e7 100644 --- a/src/pages/mine/index.vue +++ b/src/pages/mine/index.vue @@ -59,8 +59,11 @@ {{ item.title }} - + + + + @@ -71,10 +74,12 @@ import { isPending } from '@/utils/order'; import { getCardLink } from '@/api/user'; import { getOrderList } from '@/api/order'; import OfficialAccountDialog from '@/components/official-account-dialog.vue'; +import PayPasswordDialog from '@/components/pay-password-dialog.vue'; import { useUserStore } from '@/store'; const userStore = useUserStore(); const officialAccountDialogRef = ref(); +const payPasswordDialogRef = ref(null); const orderActionList = ref([{ title: '未支付', @@ -114,6 +119,11 @@ const serviceList = [ title: '联系商家', icon: assetsUrl('ic_member_service_contact.png'), path: '/pages/mine/subs/contact/index' + }, + { + title: '支付密码', + icon: '/static/images/ic_member_pay_password.png', + path: 'pay_password' } // ,{ // title: '推广中心', @@ -146,6 +156,7 @@ onShow(async () => { const { cardurl } = await getCardLink(); cardLink.value = cardurl; await userStore.getProfile(); + await userStore.getPayPasswordStatus(); } }); @@ -163,9 +174,19 @@ const openCard = () => { // }); }; +const showOfficialAccountDialog = () => { + officialAccountDialogRef.value.show(); +}; + +const showPayPasswordDialog = () => { + payPasswordDialogRef.value?.show(); +}; + const gotoPath = (path: string) => { if(path === 'follow_official_account') { showOfficialAccountDialog(); + } else if(path === 'pay_password') { + showPayPasswordDialog(); } else if(path === 'qrcode') { uni.switchTab({ url: '/pages/qrcode/index' @@ -178,10 +199,6 @@ const gotoPath = (path: string) => { goPath(path, true); } }; - -const showOfficialAccountDialog = () => { - officialAccountDialogRef.value.show(); -};