Files
lanecarford_front/src/views/login/customer.vue

333 lines
8.4 KiB
Vue
Raw Normal View History

2025-10-13 10:13:54 +08:00
<template>
2025-12-19 17:27:26 +08:00
<div
class="customer-container safe-area-top flex flex-column"
:class="{ 'form-mode': pageMode !== 'entry' }"
2025-12-19 17:27:26 +08:00
>
<div class="setting flex flex-between">
<SvgIcon name="left" size="70" @click.stop="handleBack" />
<SvgIcon name="profile_white" size="55" @click="handleOpenProfile" />
2025-12-19 17:27:26 +08:00
</div>
2025-10-13 10:13:54 +08:00
<template v-if="pageMode === 'entry'">
2025-12-19 17:27:26 +08:00
<div class="content flex-1 flex flex-center flex-column">
2025-10-13 10:13:54 +08:00
<div class="text">Who is Your Customer?</div>
2025-12-19 17:27:26 +08:00
<div class="btn-list flex flex-center">
<button class="sandblasted-blurred btn" @click="handleChangeMode('create')">
2025-12-19 17:27:26 +08:00
<span>Create</span>
</button>
<button class="sandblasted-blurred btn" @click="handleChangeMode('form')">
<span>Entry</span>
</button>
</div>
2025-10-13 10:13:54 +08:00
</div>
</template>
2025-10-14 16:42:09 +08:00
<template v-else>
2025-12-19 17:27:26 +08:00
<div class="form-container flex-1 flex flex-column flex-center">
2025-10-14 16:42:09 +08:00
<div class="text">
<div class="form-title">{{ formTitle }}</div>
2025-10-14 16:42:09 +08:00
<div class="description">
2025-12-23 15:52:20 +08:00
<p>Unlock personalized styling insights.</p>
<p>Enter a client profile to begin curating their next look with Styling Angel.</p>
2025-10-14 16:42:09 +08:00
</div>
</div>
<div class="glass-form" :class="{ create: pageMode === 'create' }">
<div class="form-field" v-if="pageMode === 'create'">
<label class="field-label">VIP ID</label>
<input
v-model="customerData.vipId"
type="text"
placeholder="Enter your ID"
class="form-input"
/>
</div>
2025-10-14 16:42:09 +08:00
<div class="form-field">
2025-12-19 17:27:26 +08:00
<label class="field-label">Nickname</label>
<input
v-model="customerData.nickname"
type="text"
2025-12-19 17:27:26 +08:00
placeholder="Enter name"
class="form-input"
/>
2025-10-14 16:42:09 +08:00
</div>
<button class="confirm-btn" @click="handleConfirm">Confirm</button>
</div>
<div v-if="pageMode === 'form'" class="show-all" @click="handleShowPopup(true)">
Show All
</div>
2025-10-14 16:42:09 +08:00
<div class="copyright">Powered by AiDLab for Lane Crawford</div>
</div>
</template>
2025-12-23 14:41:09 +08:00
<Profile ref="profileRef" @selected-customer="handleSelectCustomer" is-customer />
2025-10-13 10:13:54 +08:00
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { useRouter } from 'vue-router'
2025-11-03 10:34:17 +08:00
import { useGenerateStore, useUserInfoStore } from '@/stores'
2025-10-24 17:37:15 +08:00
import { showToast } from 'vant'
2025-12-23 14:19:00 +08:00
import { customerCheckin, createCustomer, type CreateCustomerParams } from '@/api/workshop'
import Profile from '../Workshop/profile.vue'
2025-12-23 14:19:00 +08:00
import MyEvent from '@/utils/myEvent'
const profileRef = ref<typeof Profile>(null)
const handleOpenProfile = () => {
profileRef.value.open()
}
2025-10-27 11:43:07 +08:00
const router = useRouter()
2025-10-27 11:43:07 +08:00
const generateStore = useGenerateStore()
type PageMode = 'form' | 'entry' | 'create'
2025-12-19 17:27:26 +08:00
const pageMode = ref<PageMode>('entry')
const formTitle = computed(() => {
return pageMode.value === 'entry' ? 'Customer ID' : 'Create Profile'
})
2025-10-27 11:08:26 +08:00
2025-10-13 10:13:54 +08:00
const handleChangeMode = (mode: PageMode) => {
pageMode.value = mode
}
2025-10-14 16:42:09 +08:00
2025-10-27 11:43:07 +08:00
const customerData = ref({
vipId: '',
nickname: ''
// email: ''
2025-10-24 17:37:15 +08:00
})
const handleConfirm = async () => {
if (pageMode.value === 'form') {
2025-12-23 14:19:00 +08:00
if (customerData.value.nickname === '') {
showToast({
message: 'please input the nickname'
})
return
}
customerCheckin({ nickname: customerData.value.nickname }).then((res) => {
useUserInfoStore().resetGenerateParams()
generateStore.setCustomerInfo(res)
2025-12-23 15:52:20 +08:00
MyEvent.emit('clear-generate-state')
router.push('/workshop/home')
})
} else {
2025-12-23 14:19:00 +08:00
if (customerData.value.vipId === '') {
showToast({
message: 'please input the VIP ID'
})
return
}
if (customerData.value.nickname === '') {
showToast({
message: 'please input the nickname'
})
return
}
createCustomer({
nickname: customerData.value.nickname,
vipId: customerData.value.vipId
} as CreateCustomerParams).then((res) => {
showToast({
message: 'Customer created successfully'
})
handleBack()
MyEvent.emit('update-customer-list')
})
}
}
const handleShowPopup = (flag: Boolean) => {
// showPopup.value = flag
profileRef.value.openSwitchCustomerPopup(flag)
}
2025-10-24 17:37:15 +08:00
const handleSelectCustomer = (value) => {
2025-12-23 14:19:00 +08:00
if (value) {
customerData.value.nickname = value.name
}
}
const handleBack = (e?: Event) => {
2025-12-23 14:19:00 +08:00
if (e) {
e.stopPropagation()
e.preventDefault()
}
if (pageMode.value !== 'entry') {
pageMode.value = 'entry'
customerData.value = {
vipId: '',
nickname: ''
}
return
}
router.go(-1)
2025-10-14 16:42:09 +08:00
}
2025-10-13 10:13:54 +08:00
</script>
<style lang="less" scoped>
.customer-container {
height: 100vh;
overflow: hidden;
color: #fff;
position: relative;
2025-12-19 17:27:26 +08:00
background: url('@/assets/images/no_shouder_bg.png') no-repeat center center;
2025-10-13 10:13:54 +08:00
background-size: cover;
background-position: center;
background-repeat: no-repeat;
&.form-mode {
2025-12-10 11:23:02 +08:00
background: url('@/assets/images/has_shouder_bg.png') no-repeat center center/cover;
2025-10-13 10:13:54 +08:00
}
.setting {
z-index: 1;
padding: 3.17rem 4.9rem 0 8.4rem;
2025-11-03 10:34:17 +08:00
font-size: 7rem;
2025-10-16 17:07:36 +08:00
.c-svg {
width: initial;
}
2025-10-13 10:13:54 +08:00
}
.content {
2025-12-19 17:27:26 +08:00
// margin-top: 55.3rem;
row-gap: 12.7rem;
2025-10-13 10:13:54 +08:00
.text {
font-family: 'satoshiBold';
font-size: 13rem;
line-height: 112.99%;
text-align: center;
letter-spacing: 2;
}
.start-btn {
font-size: 5.6rem;
width: 32.5rem;
height: 8.1rem;
border: 0.2rem solid #fff;
2025-10-13 10:13:54 +08:00
display: flex;
align-items: center;
justify-content: center;
border-radius: 4rem;
}
2025-12-19 17:27:26 +08:00
.btn-list {
column-gap: 17rem;
.btn {
height: 8.3rem;
width: 29.7rem;
line-height: 8.3rem;
font-size: 4.8rem;
border: 0.2rem solid #fff;
}
}
2025-10-13 10:13:54 +08:00
}
2025-10-14 16:42:09 +08:00
.form-container {
2025-12-19 17:27:26 +08:00
width: 78.8rem;
margin: 0 auto;
2025-10-14 16:42:09 +08:00
.text {
letter-spacing: 0.02rem;
}
.form-title {
font-family: 'satoshiBold';
font-size: 11rem;
line-height: 1.24em;
}
.description {
font-size: 3.6rem;
2025-10-14 16:42:09 +08:00
line-height: 141%;
letter-spacing: 0.08rem;
2025-12-19 17:27:26 +08:00
margin: 3.1rem 0 11rem 0;
2025-10-14 16:42:09 +08:00
font-family: 'satoshiRegular';
}
.glass-form {
2025-12-19 17:27:26 +08:00
height: 68.7rem;
width: 78.8rem;
border: 0.2rem solid #ffffff;
2025-10-14 16:42:09 +08:00
border-radius: 4.7rem;
2025-12-01 11:30:31 +08:00
padding: 11rem 7.5rem;
2025-10-14 16:42:09 +08:00
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
2025-11-20 14:38:51 +08:00
display: flex;
flex-direction: column;
&.create {
height: 78.8rem;
}
2025-10-14 16:42:09 +08:00
background: radial-gradient(
100% 100% at 0% 0%,
rgba(115, 115, 115, 0.4) 0%,
rgba(0, 0, 0, 0) 100%
);
backdrop-filter: blur(35px);
2025-12-01 11:30:31 +08:00
justify-content: flex-start;
2025-10-14 16:42:09 +08:00
.form-field {
2025-12-01 11:30:31 +08:00
margin-bottom: 6.8rem;
2025-10-14 16:42:09 +08:00
&.email {
margin-bottom: 6.8rem;
}
.field-label {
display: block;
color: #fff;
font-size: 3.6rem;
font-family: 'satoshiRegular';
margin-bottom: 3rem;
}
.form-input {
width: 100%;
height: 10rem;
line-height: 10rem;
border: 0.2rem solid #fff;
2025-10-14 16:42:09 +08:00
border-radius: 7rem;
padding: 0 5.5rem;
color: #fff;
font-size: 3.8rem;
font-family: 'satoshiRegular';
background: transparent;
&::placeholder {
color: rgba(255, 255, 255, 0.6);
}
}
}
.confirm-btn {
width: 100%;
height: 10rem;
line-height: 10rem;
background: #000;
border: none;
border-radius: 7rem;
color: #fff;
font-size: 4rem;
font-family: 'satoshiRegular';
cursor: pointer;
box-shadow: 0 0.2rem 8px rgba(0, 0, 0, 0.2);
2025-10-14 16:42:09 +08:00
}
}
2025-12-19 17:27:26 +08:00
.show-all {
margin-top: 4rem;
width: 19rem;
height: 7.6rem;
border-radius: 54px;
color: #000;
text-align: center;
line-height: 7.6rem;
background-color: #fff;
font-size: 3.1rem;
font-family: 'satoshiRegular';
}
.copyright {
2025-10-14 16:42:09 +08:00
font-family: 'satoshiRegular';
font-size: 3rem;
line-height: 124%;
letter-spacing: 0.08rem;
margin-top: 2.31rem;
2025-10-14 16:42:09 +08:00
text-align: center;
font-weight: 400;
2025-12-19 17:27:26 +08:00
margin-top: 11.5rem;
2025-10-14 16:42:09 +08:00
}
}
2025-10-13 10:13:54 +08:00
}
2025-12-01 11:30:31 +08:00
.c-svg {
width: initial;
}
2025-10-13 10:13:54 +08:00
</style>