|
@@ -24,7 +24,7 @@ import { useRouter } from '../../../../core/utils/router'
|
|
|
import dayjs from 'dayjs'
|
|
|
import { Coupon } from '../../../../core/libs/models'
|
|
|
import CouponCard from '@/pages/common/components/coupon-card.vue'
|
|
|
-import { select } from 'radash'
|
|
|
+import { select, sort } from 'radash'
|
|
|
|
|
|
const router = useRouter()
|
|
|
const userStore = useUserStore()
|
|
@@ -40,7 +40,27 @@ const { data: coupons, run: setCoupons } = useRequest(() =>
|
|
|
isUse: 0,
|
|
|
}),
|
|
|
)
|
|
|
-const paidPoints = computed(() => (data.value?.totalsPoints || 0).toString())
|
|
|
+const offerPoints = computed(() => {
|
|
|
+ const products = sort(data.value?.list, (it: any) => it.points).reverse()
|
|
|
+ let sumBrandPoints = 0
|
|
|
+ products.forEach((product: any) => {
|
|
|
+ if (selectedCoupons.value) {
|
|
|
+ selectedCoupons.value.forEach((coupon) => {
|
|
|
+ if (
|
|
|
+ coupon.buinessId === product.vendorId &&
|
|
|
+ coupon.productIds.split(',').includes(product.productId)
|
|
|
+ ) {
|
|
|
+ sumBrandPoints += product.points
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(sumBrandPoints)
|
|
|
+ return Number(sumBrandPoints)
|
|
|
+})
|
|
|
+const paidPoints = computed(() => {
|
|
|
+ return (data.value?.totalsPoints - offerPoints.value || 0).toString()
|
|
|
+})
|
|
|
const handlePay = async () => {
|
|
|
console.log(111)
|
|
|
|