diff --git a/src/router/index.ts b/src/router/index.ts index f3ab1f6..288abb4 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -65,6 +65,11 @@ const router = createRouter({ name:'account', component:()=>import('@/views/account/index.vue') }, + { + path:'/pay', + name:'pay', + component:()=>import('@/views/pay/index.vue') + }, { path: '/:pathMatch(.*)', name: '404', diff --git a/src/views/pay/index.vue b/src/views/pay/index.vue new file mode 100644 index 0000000..5140189 --- /dev/null +++ b/src/views/pay/index.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/src/views/shoppingCart/index.vue b/src/views/shoppingCart/index.vue index 6906c72..1287127 100644 --- a/src/views/shoppingCart/index.vue +++ b/src/views/shoppingCart/index.vue @@ -3,8 +3,6 @@
- -
diff --git a/src/views/shoppingCart/order-summary.vue b/src/views/shoppingCart/order-summary.vue index 968dd8b..650b302 100644 --- a/src/views/shoppingCart/order-summary.vue +++ b/src/views/shoppingCart/order-summary.vue @@ -62,11 +62,11 @@ }) const totalAmount = computed(() => props.list.reduce((pre, cur) => pre + cur.amount, 0).toFixed(2)) const handleCheckout = () => { - const ids = props.list.map((v: any) => v.listingId) - if (ids.length === 0) return - console.log('购买:', ids) - CreateOrder(ids, true).then((res) => { - router.go(0) + if (props.list.length === 0) return + const list = btoa(encodeURIComponent(JSON.stringify(props.list))) + router.push({ + name: 'pay', + query: { list } }) } diff --git a/src/views/shoppingCart/sc-list.vue b/src/views/shoppingCart/sc-list.vue index 23f5247..07c35e2 100644 --- a/src/views/shoppingCart/sc-list.vue +++ b/src/views/shoppingCart/sc-list.vue @@ -102,7 +102,8 @@ const props = defineProps({ title: { type: String, default: '' }, isMini: { type: Boolean, default: false }, - isView: { type: Boolean, default: false } + isView: { type: Boolean, default: false }, + list: { type: Array } }) const allAmount = computed(() => list.value.reduce((pre, cur) => pre + cur.amount, 0).toFixed(2)) const selectedCount = computed(() => list.value.filter((v) => v.checked).length) @@ -134,7 +135,7 @@ const list_ = ref([]) const list = computed(() => { - if(sortBy.value === 'BestSelling') { + if (sortBy.value === 'BestSelling') { return list_.value.sort((a, b) => b.salesVolume - a.salesVolume) } if (sortBy.value === 'PriceLowToHigh') { @@ -174,7 +175,11 @@ handleSelectedChange() }) } - GetList() + if (props.list) { + list_.value = props.list + } else { + GetList() + } const handleAllAllClick = (checked?: boolean) => { const checked_ = typeof checked === 'boolean' ? checked : !allSelected.value list.value.forEach((v) => (v.checked = v.status === SCART_STATUS.NORMAL ? checked_ : false))