Compare commits

3 Commits

11 changed files with 906 additions and 705 deletions

View File

@@ -1,33 +0,0 @@
/** @type {import('prettier').Config} */
module.exports = {
// 打印宽度
printWidth: 100,
// 使用 4 空格缩进
tabWidth: 4,
// 使用 4 空格缩进,不使用制表符
useTabs: true,
// 行尾使用 LF (Unix 风格)
endOfLine: 'lf',
// 语句末尾使用分号
semi: false,
// 使用单引号
singleQuote: false,
// 对象和数组末尾不添加尾随逗号
trailingComma: 'none',
// JSX 引号使用单引号
jsxSingleQuote: false,
// 括号内侧空格
bracketSpacing: true,
// JSX 标签不换行
bracketSameLine: false,
// 箭头函数参数始终使用括号
arrowParens: 'always',
// HTML、Vue、Angular 和 Markdown 使用 LF
htmlWhitespaceSensitivity: 'css',
// Vue 文件脚本和样式缩进
vueIndentScriptAndStyle: false,
// 行注释位置在注释上方,不加空格
proseWrap: 'preserve',
// 根据文件类型自动推断
embeddedLanguageFormatting: 'auto',
};

17
.prettierrc.json Normal file
View File

@@ -0,0 +1,17 @@
{
"printWidth": 100,
"tabWidth": 4,
"useTabs": true,
"endOfLine": "lf",
"semi": false,
"singleQuote": false,
"trailingComma": "none",
"jsxSingleQuote": false,
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"htmlWhitespaceSensitivity": "css",
"vueIndentScriptAndStyle": true,
"proseWrap": "preserve",
"embeddedLanguageFormatting": "auto"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

View File

@@ -1756,6 +1756,8 @@ export default {
categoryTips:'请选择所有适用选项',
policy:'默认情况下,所有销售均遵循平台的许可政策——买家在下载后将获得使用许可',
learnMore:'了解更多',
requiredFieldTips:'请填写{field}',
requiredFieldTipsWithPage:'第 {index} 个商品:请填写{field}',
draftSaved: '草稿已保存',
draftDesc: '您的商品已保存为草稿。\n您可以继续编辑或稍后在“我的商品”中发布。',
listingLive:'商品已上架',

View File

@@ -1807,6 +1807,8 @@ export default {
categoryTips:'select all that apply',
policy:'By default, all sales follow the platform\'s licensing policy — buyers will receive a usage license upon download.',
learnMore:'Learn more',
requiredFieldTips:'Please fill in {field}',
requiredFieldTipsWithPage:'Listing {index}: Please fill in {field}',
draftSaved: 'Draft Saved',
draftDesc: 'Your listing has been saved as a draft. \nYou can continue editing or publish it later from My Listings.',
listingLive:'Listing Live',

View File

@@ -14,7 +14,26 @@
<div class="image-clip-dialog-box">
<div class="header" :class="{ 'is-product': data.isProduct }">
<div class="title">{{ data.title }}</div>
<div class="right">
<div class="right flex">
<div v-if="coverOrigin.length > 1" class="origin-container flex align-center">
<span>Crop from: </span>
<div class="origin-select flex align-center">
<div
class="origin-item sketch"
:class="{ selected: currentOrigin === 'sketch' }"
@click="handleChangeOrigin('sketch')"
>
Sketch
</div>
<div
class="origin-item product"
:class="{ selected: currentOrigin === 'mainProducImage' }"
@click="handleChangeOrigin('mainProductImage')"
>
Main product image
</div>
</div>
</div>
<div class="submit" v-if="!data.isPreview" @click="onSubmit">
<svg-icon name="seller-dui" size="24" />
</div>
@@ -28,7 +47,7 @@
ref="imageClipRef"
v-bind="$attrs"
:ratio="data.ratio"
:fixedBox="data.isProduct ? type !== 'apparel' : false"
:isProduct="isProduct"
:url="data.url"
:type="type"
@change="(v) => (data.preview_url = v)"
@@ -60,13 +79,17 @@
</template>
<script setup>
import { ref, computed } from "vue"
import { ref, reactive, computed } from "vue"
import ImageClip from "./image-clip.vue"
const props = defineProps({
type: {
type: String,
default: () => false
},
isProduct: {
type: Boolean,
default: () => false
}
})
@@ -94,9 +117,19 @@ const data = reactive({
callback: null,
isProduct: false // 是否商品编辑
})
const currentOrigin = ref("sketch")
const coverOrigin = ref([])
const handleChangeOrigin = (type) => {
currentOrigin.value = type
data.url = coverOrigin.value.filter((el) => el.type === type)[0].url
}
const show = ref(false)
const open = (url, callback, options) => {
if (!url || !callback) return
const open = (url, callback, options, origin) => {
if (!props.isProduct) {
if (!url || !callback) return
}
data.url = url
data.callback = callback
data.ratio = options.ratio || [1, 1]
@@ -107,6 +140,11 @@ const open = (url, callback, options) => {
if (options.hasOwnProperty("isPreview")) data.isPreview = options.isPreview
data.isProduct = options.isProduct
}
if (origin?.length) {
coverOrigin.value = origin
data.url = origin[0].url
}
console.log("-------", origin)
show.value = true
}
const onCancel = () => {
@@ -169,6 +207,34 @@ defineExpose({
font-size: 1.6rem;
color: #000;
}
.origin-container {
font-weight: 400;
color: #000;
font-size: 1.4rem;
.origin-select {
margin-left: 1.2rem;
height: 4.8rem;
border: 1px solid #c7c7c7;
border-radius: 3rem;
column-gap: 1.2rem;
padding: 0.8rem;
.origin-item {
height: 3.2rem;
line-height: 3.2rem;
border-radius: 2rem;
&.selected {
background-color: #000;
color: #fff;
}
&.sketch {
padding: 0 1.9rem;
}
&.product {
padding: 0 2.5rem;
}
}
}
}
}
}
> .content {
@@ -248,7 +314,7 @@ defineExpose({
}
&.is-cover {
> .preview-image > img {
// width: 29.7rem;
width: 29.7rem;
height: 37.5rem;
}
}

View File

@@ -7,13 +7,11 @@
crossOrigin="Anonymous"
:autoCrop="true"
:fixedNumber="ratio"
:fixed="type !== 'apparel'"
:fixed="isProduct ? type !== 'apparel' : true"
movable
centerBox
:fixedBox="fixedBox"
@realTime="onChange"
outputType="png"
v-bind="bindProps"
></VueCropper>
</div>
<div class="clip_opterate">
@@ -70,17 +68,6 @@
return height
})
const bindProps = computed(() => {
// :autoCropWidth="isProduct ? undefined : type === 'cover' ? 297 : 242"
// :autoCropHeight="isProduct ? undefined : autoCropHeight"
if (props.isProduct) {
return {
autoCropHeight: autoCropHeight.value,
autoCropWidth: props.type === "cover" ? 297 : 242
}
}
})
const onChange = (data) => {
if (attrs.onChange) {
getCropUrl().then((url) => attrs.onChange(url))
@@ -104,7 +91,8 @@
label.textContent = text
label.style.top = top
label.style.left = className === "label-v" ? "50%" : "0"
label.style.transform = className === "label-v" ? "translate(-50%, -50%)" : "translateY(-50%)"
label.style.transform =
className === "label-v" ? "translate(-50%, -50%)" : "translateY(-50%)"
return label
}
@@ -310,13 +298,22 @@
&[data-crop-type="cover"] {
.image-clip-body {
:deep(.vue-cropper .cropper-view-box::after) {
background-image: linear-gradient(to right, #4ba5ff 50%, transparent 50%),
background-image:
linear-gradient(to right, #4ba5ff 50%, transparent 50%),
linear-gradient(to right, #4ba5ff 50%, transparent 50%),
linear-gradient(to right, #4ba5ff 50%, transparent 50%),
linear-gradient(to bottom, #4ba5ff 50%, transparent 50%);
background-repeat: repeat-x, repeat-x, repeat-x, repeat-y;
background-size: 8px 1px, 8px 1px, 8px 1px, 1px 8px;
background-position: 0 2.67%, 0 63.47%, 0 92.8%, 50% 0;
background-size:
8px 1px,
8px 1px,
8px 1px,
1px 8px;
background-position:
0 2.67%,
0 63.47%,
0 92.8%,
50% 0;
}
}
}
@@ -325,12 +322,19 @@
&[data-crop-type="sketch"] {
.image-clip-body {
:deep(.vue-cropper .cropper-view-box::after) {
background-image: linear-gradient(to right, #4ba5ff 50%, transparent 50%),
background-image:
linear-gradient(to right, #4ba5ff 50%, transparent 50%),
linear-gradient(to right, #4ba5ff 50%, transparent 50%),
linear-gradient(to bottom, #4ba5ff 50%, transparent 50%);
background-repeat: repeat-x, repeat-x, repeat-y;
background-size: 8px 1px, 8px 1px, 1px 8px;
background-position: 0 2.67%, 0 97.6%, 50% 0;
background-size:
8px 1px,
8px 1px,
1px 8px;
background-position:
0 2.67%,
0 97.6%,
50% 0;
}
}
}

View File

@@ -1,9 +1,20 @@
import { Https } from "@/tool/https"
// 编辑时根据ID获取信息
export const fetchListingDetailById = (id) => {
return Https.axiosGet("/seller/listing/detail", { params: { id } })
}
interface SketchIDs {
designItemIds: Array
}
export const fetchSketchDetail = (data: SketchIDs) => {
interface DetailReturns {
clothes: string[]
designItemId: number
toProductImageUrls: string[]
}
// 获取designItemId对应的产品图
export const fetchSketchDetail = (data: SketchIDs): Array<DetailReturns> => {
let params = "?"
data.forEach((id, index) => {
if (index === data.length - 1) {
@@ -15,10 +26,40 @@ export const fetchSketchDetail = (data: SketchIDs) => {
return Https.axiosGet(`/api/seller/sketchDetail${params}`)
}
interface ImageObj {
id: number // 图片id,有值会更新,没有会自动新增
category: "cover" | "main_product" | "product" | "sketch" | "apparel" // 图片类型
}
interface DetailData {
id: number | string // 商品Id
title: string // 商品名
description: string // 商品描述
price: number // 价格
stock?: number // 库存
viewCount?: number // 浏览量
status: 0 | 1 | 2 // 0草稿 1发布 2删除
images: ImageObj[]
designFor: "male" | "female"
productCategory: "outwear" | "trousers" | "blouse" | "dress" | "skirt" | "accessories"
}
// 保存/更新表单
export const fetchUpdateListing = (data: DetailData) => {
return Https.axiosPost("/seller/listing/batch", data)
}
interface StatusData {
id: number | string
status: 0 | 1 | 2 // 0草稿 1发布 2删除
}
// 设置商品状态
export const fetchChangeStatus = (data: StatusData) => {
return Https.axiosPut("/seller/listing/status", data)
}
export const uploadFile = (file) => {
const formData = new FormData()
formData.append("file", file)
return Https.axiosPost("/seller/file/ upload", formData, {
return Https.axiosPost("/seller/file/upload", formData, {
headers: { "Content-Type": "multipart/form-data", Accept: "*/*" }
})
}

View File

@@ -20,85 +20,85 @@
</template>
<script setup lang="ts">
import { computed } from "vue"
import { computed } from "vue"
interface Option {
name: string | number
value: string | number | boolean
key: string
optype: boolean
}
const props = defineProps<{
modelValue: string | number | boolean | Array<string | number | boolean> | null
options: Option[] // 按钮选项数组
multiple?: boolean // 是否支持多选,默认为 false
}>()
const emit = defineEmits<{
(e: "update:modelValue", value: any): void
}>()
const multiple = props.multiple === true
const selectedValues = computed(() => {
if (!multiple) {
return typeof props.modelValue === 'undefined' || props.modelValue === null
? []
: [props.modelValue]
interface Option {
name: string | number
value: string | number | boolean
key: string
optype: boolean
}
return Array.isArray(props.modelValue) ? props.modelValue : []
})
const props = defineProps<{
modelValue: string | number | boolean | Array<string | number | boolean> | null
options: Option[] // 按钮选项数组
multiple?: boolean // 是否支持多选,默认为 false
}>()
const selectOption = (value: any) => {
if (multiple) {
const current = Array.isArray(props.modelValue) ? [...props.modelValue] : []
const index = current.indexOf(value)
if (index >= 0) {
current.splice(index, 1)
} else {
current.push(value)
const emit = defineEmits<{
(e: "update:modelValue", value: any): void
}>()
const multiple = props.multiple === true
const selectedValues = computed(() => {
if (!multiple) {
return typeof props.modelValue === "undefined" || props.modelValue === null
? []
: [props.modelValue]
}
emit("update:modelValue", current)
return
}
if (props.modelValue !== value) {
emit("update:modelValue", value)
return Array.isArray(props.modelValue) ? props.modelValue : []
})
const selectOption = (value: any) => {
if (multiple) {
const current = Array.isArray(props.modelValue) ? [...props.modelValue] : []
const index = current.indexOf(value)
if (index >= 0) {
current.splice(index, 1)
} else {
current.push(value.toLocaleLowerCase)
}
emit("update:modelValue", current)
return
}
if (props.modelValue !== value) {
emit("update:modelValue", value)
}
}
}
</script>
<style lang="less" scoped>
.radio-button-group {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.radio-button-group {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.radio-button {
border: 1px solid #d9d9d9;
height: 3.2rem;
min-width: 8rem;
padding: 0 1.7rem;
color: #000;
cursor: pointer;
border-radius: 2rem;
outline: none;
background-color: #fff;
font-size: 1.2rem;
transition: all 0.2s ease;
}
.radio-button {
border: 1px solid #d9d9d9;
height: 3.2rem;
min-width: 8rem;
padding: 0 1.7rem;
color: #000;
cursor: pointer;
border-radius: 2rem;
outline: none;
background-color: #fff;
font-size: 1.2rem;
transition: all 0.2s ease;
}
.radio-button:hover {
border-color: #000;
}
.radio-button:hover {
border-color: #000;
}
.radio-button.is-active {
color: #fff;
background-color: #000;
border-color: #000;
font-family: pingfang_medium;
}
.radio-button.is-active {
color: #fff;
background-color: #000;
border-color: #000;
font-family: pingfang_medium;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -41,7 +41,7 @@ const chooseItem = (item:any)=>{
const next = ()=>{
if(chooseList.value.length == 0)return
let designItemIds = chooseList.value.map((item:any)=>({designOutfitUrl:item.designOutfitUrl,designItemId:item.id}))
let designItemIds = chooseList.value.map((item:any)=>({designOutfitUrl:item.designOutfitUrl,designItemId:item.designItemId}))
router.push({
path:'/home/seller/myListings/edit',
state: {