From bcbaa47926988e9dd6dded29e78b91591ddcfe83 Mon Sep 17 00:00:00 2001 From: "X1627315083@163.com" <1627315083@qq.com> Date: Wed, 27 May 2026 10:49:29 +0800 Subject: [PATCH] fix --- src/components/CommodityItem.vue | 2 +- src/lang/en.ts | 15 ++++++++- src/lang/zh-cn.ts | 15 ++++++++- src/views/digitalDetail/index.vue | 51 +++++++++++++++++++------------ src/views/digitalItem/index.vue | 12 +++++++- 5 files changed, 72 insertions(+), 23 deletions(-) diff --git a/src/components/CommodityItem.vue b/src/components/CommodityItem.vue index 3c21bde..f79c31b 100644 --- a/src/components/CommodityItem.vue +++ b/src/components/CommodityItem.vue @@ -10,7 +10,7 @@ const props = defineProps({ default: 'aaa' }, price: { - type: String, + type: [String, Number], default: '111' }, download: { diff --git a/src/lang/en.ts b/src/lang/en.ts index 4e63a2b..17a272d 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -250,5 +250,18 @@ export default { }, checked: { All: 'All', - } + }, + digitalDetail:{ + Sketch: 'Sketch', + Illustration: 'Illustration', + Product: 'Product', + EditorialVisual: 'Editorial Visual', + Back: 'Back', + ReleaseIn: 'Release in', + CopyrightLicenseNotice: 'Copyright & License Notice', + LicenseIncludedInAsset: 'License Included in Asset', + LicenseIncludedInAssetInfo: 'All products on this platform are digital assets, not physical goods. Purchase grants a usage license only; copyright and intellectual property rights remain with the original creator, unless otherwise stated.', + BuyNow: 'Buy Now', + AddToCart: 'Add to Cart', + }, } \ No newline at end of file diff --git a/src/lang/zh-cn.ts b/src/lang/zh-cn.ts index b51d165..11426ae 100644 --- a/src/lang/zh-cn.ts +++ b/src/lang/zh-cn.ts @@ -250,5 +250,18 @@ export default { }, checked: { All: "全部" - } + }, + digitalDetail:{ + Sketch: "草图", + Illustration: "插画", + Product: "产品", + EditorialVisual: "编辑视觉", + Back: "返回", + ReleaseIn: "发布于", + CopyrightLicenseNotice: "版权与许可声明", + LicenseIncludedInAsset: "资产包含许可", + LicenseIncludedInAssetInfo: "本平台所有产品均为数字资产,非实物商品。购买仅授予使用许可;版权及知识产权仍归原作者所有,除非另有说明。", + BuyNow: "立即购买", + AddToCart: "加入购物车" + }, } diff --git a/src/views/digitalDetail/index.vue b/src/views/digitalDetail/index.vue index 7df2e78..95f03a9 100644 --- a/src/views/digitalDetail/index.vue +++ b/src/views/digitalDetail/index.vue @@ -6,6 +6,9 @@ import myEvent from '@/utils/myEvent' import { getListingDetailApi } from '@/api/listing' import { useRoute } from 'vue-router' import { ElMessage } from 'element-plus' +import { useI18n } from 'vue-i18n' +import { AddShoppingCart } from '@/api/shoppingCart' +import { CreateOrder } from '@/api/shoppingCart' //const props = defineProps({ @@ -13,6 +16,7 @@ import { ElMessage } from 'element-plus' //const emit = defineEmits([ //]) const route = useRoute() +const { t } = useI18n() const router = useRouter() let detail:any = ref({ @@ -28,24 +32,33 @@ const illustrationList = ref([]) const productList = ref([]) const editorialVisualList = ref([]) const addShopping = () => { - console.log(detail.value) - if(!detail.value.price) return ElMessage.warning('Please log in first.') + if(!detail.value.price) return ElMessage.warning(t('brandDetail.addShoppingTip')) let data = { cover: detail.value.images.cover[0], price: detail.value.price, shopName: detail.value.shopName, title: detail.value.title, + id: detail.value.id, } - myEvent.emit('addShopping', data) + AddShoppingCart({listingIds:[detail.value.id]}).then((res)=>{ + myEvent.emit('addShopping', data) + }) } + + const goShopping = () => { - if(!detail.value.price) return ElMessage.warning('Please log in first.') - router.push({path: '/shoppingCart'}) + if(!detail.value.price) return ElMessage.warning(t('brandDetail.addShoppingTip')) + CreateOrder( + [detail.value.id],true + ).then((res)=>{ + // if(res)router.push({path: '/shoppingCart') + }) + // router.push({path: '/shoppingCart'}) } const setImgList = (list)=>{ - sketchList.value = list.apparel.map((item:any) => {return {imgUrl:item}}) - illustrationList.value = list.sketch.map((item:any) => {return {imgUrl:item}}) - productList.value = list.main_product.map((item:any) => {return {imgUrl:item}}) + sketchList.value = list?.apparel?.map((item:any) => {return {imgUrl:item}}) + illustrationList.value = list?.sketch?.map((item:any) => {return {imgUrl:item}}) + productList.value = list?.main_product?.map((item:any) => {return {imgUrl:item}}) editorialVisualList.value = list.product.map((item:any) => {return {imgUrl:item}}) if(list.firstFrame){ @@ -85,7 +98,7 @@ defineExpose({})
-
Sketch
+
{{ $t('digitalDetail.Sketch') }}
@@ -95,13 +108,13 @@ defineExpose({})
-
Illustration
+
{{ $t('digitalDetail.Illustration') }}
-
Product
+
{{ $t('digitalDetail.Product') }}
@@ -109,7 +122,7 @@ defineExpose({})
-
Editorial Visual
+
{{ $t('digitalDetail.EditorialVisual') }}
@@ -122,7 +135,7 @@ defineExpose({})
- Back + {{ $t('digitalDetail.Back') }}
{{ detail.designFor?.toUpperCase() || ''}} / {{ detail.productCategory?.join(',')?.toUpperCase() || '' }}
@@ -135,7 +148,7 @@ defineExpose({})
{{ detail.shopName }}
- Release in {{ detail.updateTime }} + {{ $t('digitalDetail.ReleaseIn') }} {{ detail.updateTime }}
@@ -144,26 +157,26 @@ defineExpose({})
-
Copyright & License Notice
+
{{ $t('digitalDetail.CopyrightLicenseNotice') }}
- License Included in Asset + {{ $t('digitalDetail.LicenseIncludedInAsset') }}
- All products on this platform are digital assets, not physical goods. Purchase grants a usage license only; copyright and intellectual property rights remain with the original creator, unless otherwise stated. + {{ $t('digitalDetail.LicenseIncludedInAssetInfo') }}
-
Buy Now
+
{{ $t('digitalDetail.BuyNow') }}
- Add to Cart + {{ $t('digitalDetail.AddToCart') }}
diff --git a/src/views/digitalItem/index.vue b/src/views/digitalItem/index.vue index a620b17..aad0134 100644 --- a/src/views/digitalItem/index.vue +++ b/src/views/digitalItem/index.vue @@ -5,6 +5,10 @@ import MerchantInfo from "./merchant-info.vue"; import { useRouter } from "vue-router"; import scListNull from '@/views/shoppingCart/sc-list-null.vue' import { useI18n } from 'vue-i18n' +import { AddShoppingCart } from '@/api/shoppingCart' +import { ElMessage } from 'element-plus' +import myEvent from '@/utils/myEvent' + // 定义组件名称 defineOptions({ @@ -36,7 +40,13 @@ const searechTypeList = ref([ ]) const searechType = ref('updateTime') -const addShopping = (item) => {} +const addShopping = (item) => { + console.log(item) + if(!item.price) return ElMessage.warning(t('brandDetail.addShoppingTip')) + AddShoppingCart({listingIds:[item.id]}).then((res)=>{ + myEvent.emit('addShopping', item) + }) +} const openDetail = (item) => { scrollTop.value = digitalItemRef.value.scrollTop router.push({