|  | @@ -13,18 +13,35 @@ 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 {
 | 
	
		
			
				|  |  | +  deleteProductItemBuy,
 | 
	
		
			
				|  |  | +  getProductItemBuy,
 | 
	
		
			
				|  |  | +  productPlacing,
 | 
	
		
			
				|  |  | +} from '../../../../core/libs/requests'
 | 
	
		
			
				|  |  |  import PageHelper from '@/components/page-helper.vue'
 | 
	
		
			
				|  |  |  import BottomAppBar from '@/components/bottom-app-bar.vue'
 | 
	
		
			
				|  |  |  import { useUserStore } from '../../../../store'
 | 
	
		
			
				|  |  | +import { useRouter } from '../../../../core/utils/router'
 | 
	
		
			
				|  |  |  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 router = useRouter()
 | 
	
		
			
				|  |  |  const { userInfo } = storeToRefs(userStore)
 | 
	
		
			
				|  |  |  const a = ref(1)
 | 
	
		
			
				|  |  | +const selected = ref([])
 | 
	
		
			
				|  |  | +const points = computed(() =>
 | 
	
		
			
				|  |  | +  selected.value.reduce((acc, item) => acc + item.points * item.nums, 0),
 | 
	
		
			
				|  |  | +)
 | 
	
		
			
				|  |  | +const handleSelect = (product) => {
 | 
	
		
			
				|  |  | +  if (selected.value.map((it) => it.productId).includes(product.productId)) {
 | 
	
		
			
				|  |  | +    selected.value = selected.value.filter(({ productId }) => productId !== product.productId)
 | 
	
		
			
				|  |  | +  } else {
 | 
	
		
			
				|  |  | +    selected.value = [...selected.value, product]
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  const handleDelete = async (product: any) => {
 | 
	
		
			
				|  |  |    await requestToast(
 | 
	
		
			
				|  |  |      () =>
 | 
	
	
		
			
				|  | @@ -45,6 +62,30 @@ const handleDelete = async (product: any) => {
 | 
	
		
			
				|  |  |    )
 | 
	
		
			
				|  |  |    await pageHelperRef.value?.refresh()
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +const handlePlaceOrder = async () => {
 | 
	
		
			
				|  |  | +  if (!selected.value.length) {
 | 
	
		
			
				|  |  | +    uni.showToast({ title: '请选择商品', icon: 'none' })
 | 
	
		
			
				|  |  | +    return ''
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  const { code, data: res } = await requestToast(() =>
 | 
	
		
			
				|  |  | +    productPlacing({
 | 
	
		
			
				|  |  | +      isShoppingCart: 1,
 | 
	
		
			
				|  |  | +      userId: userInfo.value.userId,
 | 
	
		
			
				|  |  | +      list: selected.value.map(({ productId, prodcutName, productCoverImgUrl, nums, points }) => ({
 | 
	
		
			
				|  |  | +        productId,
 | 
	
		
			
				|  |  | +        productName: prodcutName,
 | 
	
		
			
				|  |  | +        orderImgUrl: productCoverImgUrl,
 | 
	
		
			
				|  |  | +        nums,
 | 
	
		
			
				|  |  | +        points,
 | 
	
		
			
				|  |  | +      })),
 | 
	
		
			
				|  |  | +      couponList: [],
 | 
	
		
			
				|  |  | +    }),
 | 
	
		
			
				|  |  | +  )
 | 
	
		
			
				|  |  | +  if (code === 0) {
 | 
	
		
			
				|  |  | +    // router.push(`/pages/home/mall/confirm-order`)
 | 
	
		
			
				|  |  | +    router.push(`/pages/home/mall/confirm-order/index?data=${JSON.stringify(res)}`)
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <template>
 | 
	
	
		
			
				|  | @@ -57,11 +98,15 @@ const handleDelete = async (product: any) => {
 | 
	
		
			
				|  |  |      >
 | 
	
		
			
				|  |  |        <template #default="{ source }">
 | 
	
		
			
				|  |  |          <div class="flex-grow flex flex-col gap-8">
 | 
	
		
			
				|  |  | +          <!-- {{ selected }} -->
 | 
	
		
			
				|  |  |            <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 class="flex items-center" @click="handleSelect(it)">
 | 
	
		
			
				|  |  | +                  <div
 | 
	
		
			
				|  |  | +                    class="w-4 h-4 rounded-full border border-black/60 border-solid"
 | 
	
		
			
				|  |  | +                    :class="`${selected.map((it) => it.productId).includes(it.productId) ? 'bg-black' : ''}`"
 | 
	
		
			
				|  |  | +                  ></div>
 | 
	
		
			
				|  |  |                  </div>
 | 
	
		
			
				|  |  |                  <div class="w-[110px] h-[110px] bg-[#f6f6f6] rounded-2xl">
 | 
	
		
			
				|  |  |                    <wd-img width="100%" height="100%" :src="it.productCoverImgUrl"></wd-img>
 | 
	
	
		
			
				|  | @@ -84,7 +129,8 @@ const handleDelete = async (product: any) => {
 | 
	
		
			
				|  |  |                        积分
 | 
	
		
			
				|  |  |                      </div>
 | 
	
		
			
				|  |  |                      <div class="flex-1"></div>
 | 
	
		
			
				|  |  | -                    <wd-input-number v-model="it.nums" />
 | 
	
		
			
				|  |  | +                    {{ it.nums }}
 | 
	
		
			
				|  |  | +                    <!-- <wd-input-number v-model="it.nums" /> -->
 | 
	
		
			
				|  |  |                    </div>
 | 
	
		
			
				|  |  |                  </div>
 | 
	
		
			
				|  |  |                </div>
 | 
	
	
		
			
				|  | @@ -106,10 +152,12 @@ const handleDelete = async (product: any) => {
 | 
	
		
			
				|  |  |      <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-[#ef4343] text-2xl font-normal font-['D-DIN_Exp'] leading-6">
 | 
	
		
			
				|  |  | +            {{ points }}
 | 
	
		
			
				|  |  | +          </div>
 | 
	
		
			
				|  |  |            <div class="text-black text-base font-normal font-['PingFang_SC'] leading-5">积分</div>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  | -        <div class="">
 | 
	
		
			
				|  |  | +        <div class="" @click="handlePlaceOrder">
 | 
	
		
			
				|  |  |            <TiltedButton size="large">
 | 
	
		
			
				|  |  |              <div
 | 
	
		
			
				|  |  |                class="w-[49px] h-[22px] text-white text-base font-normal font-['PingFang_SC'] leading-tight"
 |