|
@@ -1,34 +1,34 @@
|
|
|
<route lang="json5">
|
|
|
{
|
|
|
-style: {
|
|
|
-navigationBarTitleText: '品质商城',
|
|
|
-navigationBarBackgroundColor: '#fff',
|
|
|
-},
|
|
|
+ style: {
|
|
|
+ navigationBarTitleText: '品质商城',
|
|
|
+ navigationBarBackgroundColor: '#fff',
|
|
|
+ },
|
|
|
}
|
|
|
</route>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import {useRouter} from '../../../../core/utils/router'
|
|
|
-import {createProductItemBuy, getProduct, productPlacing} from '../../../../core/libs/requests'
|
|
|
-import {requestToast} from '../../../../core/utils/common'
|
|
|
-import {useUserStore} from '../../../../store'
|
|
|
-import {storeToRefs} from 'pinia'
|
|
|
+import { useRouter } from '../../../../core/utils/router'
|
|
|
+import { createProductItemBuy, getProduct, productPlacing } from '../../../../core/libs/requests'
|
|
|
+import { requestToast } from '../../../../core/utils/common'
|
|
|
+import { useUserStore } from '../../../../store'
|
|
|
+import { storeToRefs } from 'pinia'
|
|
|
import BottomAppBar from '@/components/bottom-app-bar.vue'
|
|
|
import ButtonEvo from '@/components/button-evo.vue'
|
|
|
-import {usePermissions} from '../../../../composables/permissions'
|
|
|
+import { usePermissions } from '../../../../composables/permissions'
|
|
|
import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html.vue'
|
|
|
-import {useToast} from 'wot-design-uni'
|
|
|
+import { useToast } from 'wot-design-uni'
|
|
|
|
|
|
const toast = useToast()
|
|
|
-const {clickByPermission} = usePermissions()
|
|
|
+const { clickByPermission } = usePermissions()
|
|
|
const userStore = useUserStore()
|
|
|
const router = useRouter()
|
|
|
-const {userInfo} = storeToRefs(userStore)
|
|
|
+const { userInfo } = storeToRefs(userStore)
|
|
|
const id = ref()
|
|
|
const show = ref(false)
|
|
|
const nums = ref(1)
|
|
|
const type = ref<'add2Cart' | 'orderNow'>()
|
|
|
-const {data, run: setData} = useRequest(() => getProduct(id.value))
|
|
|
+const { data, run: setData } = useRequest(() => getProduct(id.value))
|
|
|
|
|
|
const handleConfirm = async () => {
|
|
|
// 积分
|
|
@@ -50,7 +50,7 @@ const handleConfirm = async () => {
|
|
|
],
|
|
|
couponList: [],
|
|
|
}
|
|
|
- const {data: res, code} = await requestToast(() => productPlacing(body))
|
|
|
+ const { data: res, code } = await requestToast(() => productPlacing(body))
|
|
|
if (code !== 0) return
|
|
|
await router.push(`/pages/home/mall/confirm-order/index?data=${JSON.stringify(body)}`)
|
|
|
}
|
|
@@ -67,7 +67,7 @@ const handleConfirm = async () => {
|
|
|
},
|
|
|
],
|
|
|
}),
|
|
|
- {success: true, successTitle: '加入购物车成功'},
|
|
|
+ { success: true, successTitle: '加入购物车成功' },
|
|
|
)
|
|
|
show.value = false
|
|
|
}
|
|
@@ -75,19 +75,19 @@ const handleConfirm = async () => {
|
|
|
|
|
|
const handleClick = (product) => {
|
|
|
if (product?.isRestrict === 1 && product?.productRepertory === 0) {
|
|
|
- toast.show("库存不足")
|
|
|
+ toast.show('库存不足')
|
|
|
return null
|
|
|
}
|
|
|
- let levelIds = product.memberLevelIds.split(",");
|
|
|
+ const levelIds = product.memberLevelIds.split(',')
|
|
|
if (!levelIds.includes(String(userInfo.value.level.level))) {
|
|
|
- toast.show("您当前会员等级不符合兑换条件")
|
|
|
+ toast.show('您当前会员等级不符合兑换条件')
|
|
|
return null
|
|
|
}
|
|
|
// 否则,执行原来的点击逻辑
|
|
|
clickByPermission('mallExchange', () => {
|
|
|
- show.value = true;
|
|
|
- type.value = 'orderNow';
|
|
|
- });
|
|
|
+ show.value = true
|
|
|
+ type.value = 'orderNow'
|
|
|
+ })
|
|
|
}
|
|
|
onLoad(async (query: { id: string }) => {
|
|
|
id.value = query.id
|
|
@@ -138,7 +138,7 @@ onShareTimeline(() => ({
|
|
|
class="w-[66px] text-black/30 text-xs font-normal font-['PingFang_SC'] leading-3"
|
|
|
>
|
|
|
<!-- ¥60 -->
|
|
|
- <span style="text-decoration: line-through;">¥{{ data?.productPrice }}</span>
|
|
|
+ <span style="text-decoration: line-through">¥{{ data?.productPrice }}</span>
|
|
|
</div>
|
|
|
<div class="flex-1"></div>
|
|
|
<template v-if="String(data?.needPoints) !== '1'">
|
|
@@ -155,7 +155,9 @@ onShareTimeline(() => ({
|
|
|
<div class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-normal">
|
|
|
积分兑换说明:
|
|
|
</div>
|
|
|
- <div class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-[23px]">
|
|
|
+ <div
|
|
|
+ class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-[23px] whitespace-pre-wrap"
|
|
|
+ >
|
|
|
{{ data?.exchangeDesc }}
|
|
|
<!-- · 不限制兑换个数-->
|
|
|
<!-- <br />-->
|
|
@@ -192,7 +194,12 @@ onShareTimeline(() => ({
|
|
|
<ButtonEvo
|
|
|
block
|
|
|
size="lg"
|
|
|
- :disabled="(data?.isRestrict === 1 && data?.productRepertory == 0) || (!data?.memberLevelIds.split(',').includes(String(userInfo.level.level))) ? 'isDisabled': null"
|
|
|
+ :disabled="
|
|
|
+ (data?.isRestrict === 1 && data?.productRepertory == 0) ||
|
|
|
+ !data?.memberLevelIds.split(',').includes(String(userInfo.level.level))
|
|
|
+ ? 'isDisabled'
|
|
|
+ : null
|
|
|
+ "
|
|
|
@click="handleClick(data)"
|
|
|
>
|
|
|
立即兑换
|
|
@@ -222,13 +229,15 @@ onShareTimeline(() => ({
|
|
|
<div class="flex-1"></div>
|
|
|
<wd-input-number
|
|
|
v-model="nums"
|
|
|
- :max="data?.isRestrict === 1 && data?.purchaseLimit
|
|
|
- ? Math.min(data?.purchaseQuantity, data?.productRepertory)
|
|
|
- : data?.isRestrict === 1 && !data?.purchaseLimit
|
|
|
- ? data?.productRepertory
|
|
|
- : data?.isRestrict === 2 && data?.purchaseLimit
|
|
|
- ? data?.purchaseQuantity
|
|
|
- : 100"
|
|
|
+ :max="
|
|
|
+ data?.isRestrict === 1 && data?.purchaseLimit
|
|
|
+ ? Math.min(data?.purchaseQuantity, data?.productRepertory)
|
|
|
+ : data?.isRestrict === 1 && !data?.purchaseLimit
|
|
|
+ ? data?.productRepertory
|
|
|
+ : data?.isRestrict === 2 && data?.purchaseLimit
|
|
|
+ ? data?.purchaseQuantity
|
|
|
+ : 100
|
|
|
+ "
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|