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 7317398..367006e 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -302,4 +302,17 @@ export default { item: 'item', checkoutSelected: 'Checkout Selected', }, + 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 750464a..0282bf8 100644 --- a/src/lang/zh-cn.ts +++ b/src/lang/zh-cn.ts @@ -302,4 +302,17 @@ export default { item: '数字藏品', checkoutSelected: '结账已选', }, + 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({})