2025-10-09 09:29:36 +08:00
|
|
|
|
// 每一个存储的模块,命名规则use开头,store结尾
|
|
|
|
|
|
import { defineStore } from 'pinia'
|
2025-10-21 10:20:57 +08:00
|
|
|
|
export const useGenerateStore = defineStore({
|
2025-10-23 16:37:59 +08:00
|
|
|
|
id: 'generate', // 必须指明唯一的pinia仓库的id
|
|
|
|
|
|
state: () => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
userData: {
|
|
|
|
|
|
title: '123123',
|
|
|
|
|
|
name: '123123',
|
|
|
|
|
|
describe: '',
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
style: {
|
|
|
|
|
|
id: -1,
|
|
|
|
|
|
oldId: -1,//表示从生成页面返回回来,需要调整的样式id
|
|
|
|
|
|
},
|
|
|
|
|
|
model: {
|
|
|
|
|
|
id: -1,
|
|
|
|
|
|
}
|
2025-10-21 13:46:27 +08:00
|
|
|
|
},
|
2025-10-23 17:01:13 +08:00
|
|
|
|
queryList: [],
|
|
|
|
|
|
|
|
|
|
|
|
/** 顾客照片信息 */
|
|
|
|
|
|
photoInfo: {
|
|
|
|
|
|
id: "",
|
|
|
|
|
|
url: "",
|
|
|
|
|
|
}
|
2025-10-23 16:37:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getters: {
|
2025-10-23 16:41:38 +08:00
|
|
|
|
/** 顾客id */
|
|
|
|
|
|
customerId: (state) => state.userData.style.id,
|
|
|
|
|
|
/** 进店记录id */
|
|
|
|
|
|
visitRecordId: (state) => state.userData.style.id,
|
|
|
|
|
|
/** 服装id */
|
|
|
|
|
|
styleId: (state) => state.userData.style.id,
|
|
|
|
|
|
/** 模特照片id */
|
|
|
|
|
|
modelPhotoId: (state) => state.userData.model.id,
|
|
|
|
|
|
/** 原始试穿id */
|
|
|
|
|
|
originalTryOnId: (state) => state.userData.style.id,
|
|
|
|
|
|
/** 顾客照片id */
|
2025-10-23 17:01:13 +08:00
|
|
|
|
customerPhotoId: (state) => state.photoInfo.id,
|
2025-10-23 16:37:59 +08:00
|
|
|
|
},
|
|
|
|
|
|
actions: {
|
|
|
|
|
|
selectStyle(data: any) {
|
|
|
|
|
|
this.userData.style.id = data.id
|
|
|
|
|
|
console.log(this.userData)
|
|
|
|
|
|
},
|
|
|
|
|
|
//生成后去掉id 设置oldId来修改样式
|
|
|
|
|
|
useStyleGenerate() {
|
|
|
|
|
|
this.userData.style.oldId = this.userData.style.id
|
|
|
|
|
|
this.userData.style.id = -1
|
|
|
|
|
|
},
|
|
|
|
|
|
updateStyle(data) {
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
if (data.id == this.userData.style.oldId) {
|
|
|
|
|
|
this.userData.style.oldId = -1
|
2025-10-23 13:43:42 +08:00
|
|
|
|
}
|
2025-10-09 09:29:36 +08:00
|
|
|
|
},
|
2025-10-23 16:37:59 +08:00
|
|
|
|
//模特相关
|
|
|
|
|
|
selectModel(data: any) {
|
|
|
|
|
|
this.userData.model.id = data.id
|
|
|
|
|
|
console.log(this.userData)
|
2025-10-23 17:01:13 +08:00
|
|
|
|
},
|
|
|
|
|
|
/** 更新顾客照片信息 */
|
|
|
|
|
|
updatePhotoInfo(data: any) {
|
|
|
|
|
|
this.photoInfo.id = data.visitRecordId || ""
|
|
|
|
|
|
this.photoInfo.url = data.defaultImageUrl || ""
|
|
|
|
|
|
},
|
2025-10-21 13:46:27 +08:00
|
|
|
|
}
|
2025-10-09 09:29:36 +08:00
|
|
|
|
})
|