123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <route lang="json5">
- {
- style: {
- navigationBarTitleText: '购物车',
- navigationBarBackgroundColor: '#fff',
- },
- }
- </route>
- <script setup lang="ts">
- import TiltedButton from '@/components/tilted-button.vue'
- import Product from '../components/product.vue'
- import { shoppingBag } from '@designer-hub/assets/src/assets/svgs/index'
- import InvertedTrapezoidButton from '@/components/inverted-trapezoid-button.vue'
- import TrapeziumButton from '@/components/trapezium-button.vue'
- import { deleteProductItemBuy, getProductItemBuy } from '../../../../core/libs/requests'
- import PageHelper from '@/components/page-helper.vue'
- import BottomAppBar from '@/components/bottom-app-bar.vue'
- import { useUserStore } from '../../../../store'
- import { storeToRefs } from 'pinia'
- import { requestToast } from '../../../../core/utils/common'
- import type { ComponentExposed } from 'vue-component-type-helpers'
- const pageHelperRef = ref<ComponentExposed<typeof PageHelper>>()
- const userStore = useUserStore()
- const { userInfo } = storeToRefs(userStore)
- const a = ref(1)
- const handleDelete = async (product: any) => {
- await requestToast(
- () =>
- deleteProductItemBuy({
- doList: [
- {
- productId: product.productId,
- userId: userInfo.value.userId,
- id: product.id,
- deleted: true,
- },
- ],
- }),
- {
- successTitle: '删除成功',
- success: true,
- },
- )
- await pageHelperRef.value?.refresh()
- }
- </script>
- <template>
- <view class="flex-grow flex flex-col gap-14 bg-white px-3.5 py-6">
- <PageHelper
- ref="pageHelperRef"
- :request="getProductItemBuy"
- :query="{ userId: userInfo.userId }"
- class="flex-grow flex flex-col"
- >
- <template #default="{ source }">
- <div class="flex-grow flex flex-col gap-8">
- <template v-for="(it, i) in source.list" :key="i">
- <wd-swipe-action>
- <div class="flex gap-3">
- <div class="flex items-center">
- <div class="w-4 h-4 rounded-full border border-black/60 border-solid"></div>
- </div>
- <div class="w-[110px] h-[110px] bg-[#f6f6f6] rounded-2xl">
- <wd-img width="100%" height="100%" :src="it.productCoverImgUrl"></wd-img>
- </div>
- <div class="flex flex-col justify-between flex-1">
- <div
- class="text-black/40 text-base font-normal font-['PingFang_SC'] leading-normal"
- >
- {{ it.prodcutName }}
- </div>
- <div class="flex items-center">
- <div
- class="text-[#ef4343] text-[22px] font-normal font-['D-DIN Exp'] leading-normal"
- >
- {{ it.points }}
- </div>
- <div
- class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-[34px]"
- >
- 积分
- </div>
- <div class="flex-1"></div>
- <wd-input-number v-model="it.nums" />
- </div>
- </div>
- </div>
- <template #right>
- <view class="h-full">
- <view
- class="inline-block h-full bg-[#ef4343] text-white flex items-center px-5"
- @click="handleDelete(it)"
- >
- 删除
- </view>
- </view>
- </template>
- </wd-swipe-action>
- </template>
- </div>
- </template>
- </PageHelper>
- <BottomAppBar fixed border>
- <div class="h-[63px] bg-white backdrop-blur-[20px] flex px-3.5 items-center justify-between">
- <div class="flex items-end gap-1.25">
- <div class="text-[#ef4343] text-2xl font-normal font-['D-DIN_Exp'] leading-6">0</div>
- <div class="text-black text-base font-normal font-['PingFang_SC'] leading-5">积分</div>
- </div>
- <div class="">
- <TiltedButton size="large">
- <div
- class="w-[49px] h-[22px] text-white text-base font-normal font-['PingFang_SC'] leading-tight"
- >
- <div
- class="w-[65px] h-[22px] text-white text-base font-normal font-['PingFang_SC'] leading-tight"
- >
- 去结算
- </div>
- </div>
- </TiltedButton>
- </div>
- </div>
- </BottomAppBar>
- </view>
- </template>
- <style scoped lang="scss"></style>
|