From 69e6408d55c9f6276a3ffc823a1a4fcdecda9194 Mon Sep 17 00:00:00 2001 From: zhangyahui Date: Mon, 22 Dec 2025 15:01:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20customer=E9=A1=B5=E9=9D=A2=E6=96=B0?= =?UTF-8?q?=E5=A2=9Ecustomer&profile=E5=BC=B9=E7=AA=97=E5=88=87=E6=8D=A2cu?= =?UTF-8?q?stomer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icons/close_nocolor.svg | 6 + src/assets/icons/profile_white.svg | 4 + src/assets/images/checked.png | Bin 0 -> 1179 bytes src/views/Workshop/profile.vue | 605 ++++++++++++++++++----------- src/views/login/customer.vue | 97 +++-- 5 files changed, 448 insertions(+), 264 deletions(-) create mode 100644 src/assets/icons/close_nocolor.svg create mode 100644 src/assets/icons/profile_white.svg create mode 100644 src/assets/images/checked.png diff --git a/src/assets/icons/close_nocolor.svg b/src/assets/icons/close_nocolor.svg new file mode 100644 index 0000000..b31f6f4 --- /dev/null +++ b/src/assets/icons/close_nocolor.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/assets/icons/profile_white.svg b/src/assets/icons/profile_white.svg new file mode 100644 index 0000000..7103aca --- /dev/null +++ b/src/assets/icons/profile_white.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/images/checked.png b/src/assets/images/checked.png new file mode 100644 index 0000000000000000000000000000000000000000..a0054b0b9b9eb66350a5c7be2eb200ac4fed2f50 GIT binary patch literal 1179 zcmV;M1Z4Y(P))3oXye5`Na&0(_QTA$Z zklG~iX!b`K!;NdR2F#HF!^nFWVRJzzKB;4Z>`HBNyDp2QzMiENdpa*M4D6&f^*tHVR#c0)M~aRlf4HlzC!Tdf!CTa+nUKv{Z^Ao72VmWhMO$EF}8$TNncn_laAHdvn}@I z1-)fG@n5O2XIt&bK@$Jy-D*kDv$q)S$w9WV&}+q#z-+4~I~^qe>jU0VsXSvCu{2yP zXs&@e*Ua^R6|dA$@zf>&{80!%Fm>z0b z%pOBm>`oAYS0e4WJOs{Z!W(EvvPWexM*_VoO6bm|R&@AcOxnl*P?%Q_nJNI=n9rRUiW=t<2XJ%fBtx6l@T9%M@YHmaZL t*ITUayZPrqGMP*!lgVT - import { ref, reactive, onMounted, inject } from 'vue' - import router from '@/router' - import { showConfirmDialog } from 'vant' - import { useUserInfoStore, useOverallStore } from '@/stores' - import { LogOut } from '@/api/login' - const userInfoStore = useUserInfoStore() - const overallStore = useOverallStore() - const emit = defineEmits(['view-type']) - const show = ref(false) - const isEdit = ref(false) - const form = reactive({ - name: { msg: '', value: userInfoStore.state.userInfo.username }, - email: { msg: '', value: userInfoStore.state.userInfo.email }, - password: { show: false, msg: '', value: userInfoStore.state.userInfo.password } - }) - const open = () => { - isEdit.value = false - show.value = true - } - const close = () => { - show.value = false - } - const onEditItem = (item) => { - if (!form[item]) return - form[item].edit = true - } - const onSaveItem = (item) => { - if (!form[item]) return - form[item].edit = false - } - const switchCustomer = () => { - console.log('switchCustomer') - } - const edit = () => { - isEdit.value = true - } - const confirm = () => { - overallStore.setLoading(true) - setTimeout(() => { - overallStore.setLoading(false) - isEdit.value = false - }, 1000) - } - const logout = () => { - showConfirmDialog({ - title: 'Log out', - message: 'Are you sure you want to log out?', - confirmButtonText: 'Yes', - cancelButtonText: 'Cancel' - }) - .then(() => { - LogOut().then(() => { - userInfoStore.logOut() - router.push({ path: '/welcome' }) - }) - }) - .catch(() => {}) - } - defineExpose({ open }) +import { ref, reactive, onMounted, inject } from 'vue' +import router from '@/router' +import { showConfirmDialog } from 'vant' +import { useUserInfoStore, useOverallStore } from '@/stores' +import { LogOut } from '@/api/login' +const userInfoStore = useUserInfoStore() +const overallStore = useOverallStore() +const emit = defineEmits(['view-type', 'selected-customer']) +const show = ref(false) +const isEdit = ref(false) +const form = reactive({ + name: { msg: '', value: userInfoStore.state.userInfo.username }, + email: { msg: '', value: userInfoStore.state.userInfo.email }, + password: { show: false, msg: '', value: userInfoStore.state.userInfo.password } +}) +const open = () => { + isEdit.value = false + show.value = true +} +const close = () => { + show.value = false +} +const onEditItem = (item) => { + if (!form[item]) return + form[item].edit = true +} +const onSaveItem = (item) => { + if (!form[item]) return + form[item].edit = false +} +const switchCustomer = () => { + // console.log('switchCustomer') + handleShowPopup(true) +} +const edit = () => { + isEdit.value = true +} +const confirm = () => { + overallStore.setLoading(true) + setTimeout(() => { + overallStore.setLoading(false) + isEdit.value = false + }, 1000) +} +const logout = () => { + showConfirmDialog({ + title: 'Log out', + message: 'Are you sure you want to log out?', + confirmButtonText: 'Yes', + cancelButtonText: 'Cancel' + }) + .then(() => { + LogOut().then(() => { + userInfoStore.logOut() + router.push({ path: '/welcome' }) + }) + }) + .catch(() => {}) +} + +const showSwitchCustomerPopup = ref(false) + +const customerList = ref([ + { id: 'CUST001', nickname: 'Customer One', checked: true }, + { id: 'CUST002', nickname: 'Customer Two', checked: false }, + { id: 'CUST003', nickname: 'Customer Three', checked: false }, + { id: 'CUST004', nickname: 'Customer Four', checked: false }, + { id: 'CUST005', nickname: 'Customer Five', checked: false } +]) +// 打开customer选择时关闭profile弹窗 如果不是点击confirem关闭则重新打开profile弹窗 +const handleShowPopup = (flag: boolean) => { + showSwitchCustomerPopup.value = flag + show.value = !flag +} +const handleChangeChecked = (item) => { + customerList.value.forEach((customer) => { + customer.checked = customer.id === item.id + }) +} +const handleSelectCustomer = () => { + const selectedCustomer = customerList.value.find((customer) => customer.checked) + if (selectedCustomer) { + emit('selected-customer', selectedCustomer) + } + showSwitchCustomerPopup.value = false +} + +const openSwitchCustomerPopup = (flag = true) => { + showSwitchCustomerPopup.value = flag +} + +defineExpose({ open, close, openSwitchCustomerPopup }) diff --git a/src/views/login/customer.vue b/src/views/login/customer.vue index 413615e..ada4ffd 100644 --- a/src/views/login/customer.vue +++ b/src/views/login/customer.vue @@ -1,17 +1,17 @@