feat: 切换customer
All checks were successful
git提交控制 AiDA WEB-Node.js main 分支构建部署 / build (20.19.0) (push) Has been skipped

This commit is contained in:
2025-12-23 14:41:09 +08:00
parent e8a72ec0aa
commit 65617baa96
3 changed files with 16 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ import { FlowType } from '@/types/enum'
//const props = defineProps({ //const props = defineProps({
//}) //})
const emit = defineEmits([ const emit = defineEmits([
'view-type' 'viewType'
]) ])
// const data = reactive({ // const data = reactive({
@@ -23,7 +23,7 @@ const historicalReview = ()=>{
} }
onMounted(()=>{ onMounted(()=>{
emit('view-type', 1) emit('viewType', 1)
}) })
onUnmounted(()=>{ onUnmounted(()=>{
}) })

View File

@@ -4,9 +4,13 @@ import router from '@/router'
import { showConfirmDialog } from 'vant' import { showConfirmDialog } from 'vant'
import { useUserInfoStore, useOverallStore } from '@/stores' import { useUserInfoStore, useOverallStore } from '@/stores'
import { LogOut } from '@/api/login' import { LogOut } from '@/api/login'
import { getCustomerList, type CustomerListParams } from '@/api/workshop' import { getCustomerList, type CustomerListParams,customerCheckin } from '@/api/workshop'
import MyEvent from '@/utils/myEvent' import MyEvent from '@/utils/myEvent'
const props = defineProps<{
isCustomer?: boolean
}>()
const userInfoStore = useUserInfoStore() const userInfoStore = useUserInfoStore()
const overallStore = useOverallStore() const overallStore = useOverallStore()
const emit = defineEmits(['view-type', 'selected-customer']) const emit = defineEmits(['view-type', 'selected-customer'])
@@ -148,6 +152,14 @@ const handleSelectCustomer = () => {
if (selectedCustomer) { if (selectedCustomer) {
emit('selected-customer', selectedCustomer) emit('selected-customer', selectedCustomer)
} }
if(!props.isCustomer){
// show.value = true
customerCheckin({ nickname: selectedCustomer.name }).then((res) => {
useUserInfoStore().resetGenerateParams()
MyEvent.emit('clear-generate-state')
useUserInfoStore().setCustomerInfo(res)
})
}
showSwitchCustomerPopup.value = false showSwitchCustomerPopup.value = false
} }

View File

@@ -58,7 +58,7 @@
</div> </div>
</template> </template>
<Profile ref="profileRef" @selected-customer="handleSelectCustomer" /> <Profile ref="profileRef" @selected-customer="handleSelectCustomer" is-customer />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">