2 Sitoutukset d8d6105b67 ... 52cea799e9

Tekijä SHA1 Viesti Päivämäärä
  liangan 52cea799e9 feat: 全局通用配置接口联调 2 päivää sitten
  liangan 77d2f50e4f feat: 我的收藏列表及收藏商品接口联调 2 päivää sitten

+ 21 - 0
src/api/common.ts

@@ -25,3 +25,24 @@ export function divisionsTreeList(data: any) {
 export function bannerList(data: any) {
   return http.post<any>(`${pre}/app/banner/list`, data)
 }
+/**
+ * 获取通用配置 入参code
+ * 开团红包收益结算推迟时间        red_envelope_settel_day_5001
+ *开团奖励佣金比例(%)        open_red_envelope_rate
+ * 拼团奖励佣金比例(%)        join_red_envelope_rate
+ *  提现利率(%)        withdraw_rate
+ *开团奖励佣金结算推迟时间(天)        red_envelope_settel_day_5002
+ *签到奖励佣金结算推迟时间(天)        red_envelope_settel_day_5003
+ *  直推奖励佣金结算推迟时间(天)        red_envelope_settel_day_5006
+ * 一级奖励佣金结算推迟时间        red_envelope_settel_day_5004
+ * 二级奖励佣金结算推迟时间        red_envelope_settel_day_5005
+ *  默认头像        default_avatar
+ *  邀请好友奖励佣金金额        invited_amount
+ * 签到奖励佣金金额        login_red_envelope_amount
+ *  用户签到奖励        user_sign_info
+ *  轮播图        banner
+ * @returns
+ */
+export function getConfigByCode(data: any) {
+  return http.get<any>(`${pre2}/config/getConfigByCode`, data)
+}

+ 24 - 0
src/api/mine.ts

@@ -72,3 +72,27 @@ export function memberConfigs() {
 export function myUsers(data: any) {
   return http.post<any>(`${pre1}/api/user/myUsers`, data)
 }
+
+/**
+ * 我的收藏-商品列表
+ * @returns
+ */
+export function myFavoriteProducts(data: any) {
+  return http.post<any>(`${pre}/app/mid/favorite/list`, data)
+}
+
+/**
+ * 我的收藏-新增 {productIdList:[1]}
+ * @returns
+ */
+export function myFavoriteAdd(data: any) {
+  return http.post<any>(`${pre}/app/mid/favorite/add`, data)
+}
+
+/**
+ * 我的收藏-删除  {id:1}
+ * @returns
+ */
+export function myFavoriteDel(data: any) {
+  return http.delete<any>(`${pre}/app/mid/favorite/delete`, data)
+}

+ 1 - 1
src/api/product.ts

@@ -6,7 +6,7 @@ const pre = import.meta.env.VITE_SERVER_BASEURL_PREFIX
  * @returns data.list[]
  */
 export function getList(data: any) {
-  return http.post<any>(`${pre}/app/combination/app/list`, data)
+  return http.post<any>(`${pre}/app/combination/app/list`, { ...data, isShow: 1 })
 }
 /**
  * 获取商品排名列表

+ 4 - 1
src/locale/bn.json

@@ -251,7 +251,7 @@
   "referEarn.howToShare": "- কীভাবে শেয়ার করে অর্থ উপার্জন করবেন -",
   "referEarn.step1": "বন্ধুদের আমন্ত্রণ শেয়ার করুন",
   "referEarn.step2": "আপনার বন্ধু গ্রুপে যোগ দিন",
-  "referEarn.step3": "আপনি ৳৫০ পুরস্কার পান",
+  "referEarn.step3": "আপনি ৳{0} পুরস্কার পান",
   "referEarn.invitedFriends": "আমন্ত্রিত বন্ধুরা",
   "checkout.title": "চেকআউট",
   "checkout.selected": "নির্বাচিত",
@@ -288,6 +288,9 @@
   "productDetail.details": "বিবরণ",
   "productDetail.home": "হোম",
   "productDetail.favorite": "পছন্দের",
+  "productDetail.favoriteSuccess": "পছন্দের তালিকায় যোগ করা হয়েছে",
+  "productDetail.unfavoriteSuccess": "পছন্দের তালিকা থেকে সরানো হয়েছে",
+  "productDetail.favoriteError": "অপারেশন ব্যর্থ, আবার চেষ্টা করুন",
   "productDetail.openGroup": "গ্রুপ খুলুন",
   "productDetail.quantity": "পরিমাণ",
   "topChampions.title": "শীর্ষ চ্যাম্পিয়ন",

+ 4 - 1
src/locale/en.json

@@ -252,7 +252,7 @@
   "referEarn.howToShare": "- How to Share and Earn Money -",
   "referEarn.step1": "Share Invite Friends",
   "referEarn.step2": "Your Friend Join Group",
-  "referEarn.step3": "You Get ৳50 Reward",
+  "referEarn.step3": "You Get ৳{0} Reward",
   "referEarn.invitedFriends": "Invited Friends",
   "checkout.title": "Checkout",
   "checkout.selected": "Selected",
@@ -289,6 +289,9 @@
   "productDetail.details": "Details",
   "productDetail.home": "Home",
   "productDetail.favorite": "Favorite",
+  "productDetail.favoriteSuccess": "Added to favorites",
+  "productDetail.unfavoriteSuccess": "Removed from favorites",
+  "productDetail.favoriteError": "Operation failed, please try again",
   "productDetail.openGroup": "Open Group",
   "productDetail.quantity": "Quantity",
   "topChampions.title": "Top Champions",

+ 4 - 1
src/locale/zh-Hans.json

@@ -251,7 +251,7 @@
   "referEarn.howToShare": "- 如何分享赚钱 -",
   "referEarn.step1": "分享邀请朋友",
   "referEarn.step2": "朋友加入群组",
-  "referEarn.step3": "您获得 ৳50 奖励",
+  "referEarn.step3": "您获得 ৳{0} 奖励",
   "referEarn.invitedFriends": "邀请的朋友",
   "checkout.title": "结账",
   "checkout.selected": "已选择",
@@ -288,6 +288,9 @@
   "productDetail.details": "详情",
   "productDetail.home": "首页",
   "productDetail.favorite": "收藏",
+  "productDetail.favoriteSuccess": "收藏成功",
+  "productDetail.unfavoriteSuccess": "已取消收藏",
+  "productDetail.favoriteError": "操作失败,请重试",
   "productDetail.openGroup": "开团",
   "productDetail.quantity": "数量",
   "topChampions.title": "冠军榜",

+ 1 - 1
src/pages/mine/mine.vue

@@ -49,7 +49,7 @@ const menuList = ref([
   { name: t('mine.menu.share'), url: '/pages/mine/share', icon: '/static/icons/share.png' },
   { name: t('mine.menu.favorite'), url: '/pages/mine/myFavorite', icon: '/static/icons/my-favorite.png' },
   { name: t('mine.menu.chat'), url: '', icon: '/static/icons/live-chat.png' },
-  { name: t('mine.menu.activity'), url: '', icon: '/static/icons/activity-group.png' },
+  { name: t('mine.menu.activity'), url: '/pages/referEarn/referEarn', icon: '/static/icons/activity-group.png' },
 ])
 const walletInfo = ref<any>({})
 async function getWalletInfo() {

+ 4 - 10
src/pages/mine/myFavorite.vue

@@ -13,7 +13,8 @@
 // eslint-disable-next-line unused-imports/no-unused-imports
 import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
 import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
-import { getList } from '@/api/product'
+import { myFavoriteProducts } from '@/api/mine'
+import { toPage } from '@/utils/page'
 
 defineOptions({
   name: 'MyFavorite', // 我的收藏
@@ -32,7 +33,7 @@ async function queryList(pageNo: number, pageSize: number) {
       page: pageNo,
       size: pageSize,
     }
-    const res = await getList(params)
+    const res = await myFavoriteProducts(params)
     paging.value.complete(res.data.list)
   }
   catch {
@@ -46,17 +47,10 @@ async function queryList(pageNo: number, pageSize: number) {
     <template v-if="dataList.length">
       <view class="px-24rpx py-24rpx">
         <view class="grid grid-cols-2 gap-22rpx">
-          <product v-for="(item, index) in dataList" :key="index" :height="340" :item="item" />
+          <product v-for="(item, index) in dataList" :key="index" :height="340" :item="item" @item-click="toPage('/pages/productDetail/productDetail', { productId: item.productId, id: item.id })" />
         </view>
       </view>
     </template>
-    <template v-else>
-      <view class="h-[50vh] flex items-center justify-center">
-        <text class="text-28rpx text-#999">
-          {{ $t('mine.pages.myFavorite.empty') }}
-        </text>
-      </view>
-    </template>
   </z-paging>
 </template>
 

+ 4 - 6
src/pages/productDetail/components/CustomTooltip.vue

@@ -15,8 +15,7 @@ const props = withDefaults(defineProps<Props>(), {
   visible: false,
   autoHide: true,
   autoHideDelay: 10000,
-  icon: 'shop',
-  iconSize: '32rpx',
+  icon: '/static/icons/gift.png',
   message: 'Full refund for unsuccessful group purchase $99.99 Receive red envelope rewards $1.8',
   highlightText1: '$99.99',
   highlightText2: '$1.8',
@@ -133,11 +132,10 @@ defineExpose({
     :style="{ width }"
   >
     <view class="flex items-center">
-      <wd-icon
+      <image
         v-if="icon"
-        :name="icon"
-        :size="iconSize"
-        class="mr-12rpx flex-shrink-0"
+        :src="icon"
+        class="mr-12rpx h-35rpx w-32rpx flex-shrink-0"
       />
       <view class="text-center">
         <text>Full refund for unsuccessful group purchase </text>

+ 74 - 6
src/pages/productDetail/productDetail.vue

@@ -12,10 +12,15 @@
 // eslint-disable-next-line unused-imports/no-unused-imports
 import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
 import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
+import { getConfigByCode } from '@/api/common'
+import { myFavoriteAdd, myFavoriteDel } from '@/api/mine'
 import { preOrder as _preOrder } from '@/api/order'
 import { getDetail, pinkList } from '@/api/product'
+import { getUserInfoHook, requireLogin } from '@/hooks/usePageAuth'
+import { t } from '@/locale'
 import { formatNumber } from '@/utils/index'
 import { getPageParams, goBack, toPage } from '@/utils/page'
+import { toast } from '@/utils/toast'
 import CustomTooltip from './components/CustomTooltip.vue'
 import NotificationCarousel from './components/NotificationCarousel.vue'
 
@@ -33,7 +38,11 @@ const safeAreaInsets = systemInfo.safeAreaInsets
 const paging = ref(null)
 // 类似mixins,如果是页面滚动务必要写这一行,并传入当前ref绑定的paging,注意此处是paging,而非paging.value
 useZPaging(paging)
-
+function goHome() {
+  uni.switchTab({
+    url: '/pages/index/index',
+  })
+}
 // 添加导航栏背景色变量
 const navBgColor = ref('transparent')
 const changeNavbarThreshold = 300 // 滚动到这个高度时改变导航栏颜色
@@ -191,11 +200,14 @@ function findMatchingAttrValue(selectedSpecs) {
     return selectedKeys.every(key => selectedSpecs[key] === attrValueSpecs[key])
   })
 }
+const rebate = ref<any>(0)
 // 查询商品详情
 async function queryDetail() {
   const res = await getDetail({ id: productId.value })
   console.log(res)
   detail.value = res.data
+  const rate = await getConfig()
+  rebate.value = formatNumber(rate * res.data.price)
   // 默认选择第一个规格
   setDefaultSpecs()
   paging.value.complete()
@@ -208,6 +220,20 @@ async function queryPinkInfo() {
   pinkInfo.value = res.data.list
 }
 
+async function getConfig() {
+  try {
+    const res = await getConfigByCode({ code: 'open_red_envelope_rate' })
+    console.log(res)
+    if (res.code === '200') {
+      return res.data.valueInfo / 100
+    }
+    else {
+      return 0
+    }
+  }
+  catch {}
+}
+
 // 设置默认规格选择
 function setDefaultSpecs() {
   if (detail.value.attr && detail.value.attr.length > 0) {
@@ -241,6 +267,35 @@ function setDefaultSpecs() {
   }
 }
 
+// 收藏/取消收藏
+async function toggleFavorite() {
+  if (!requireLogin()) {
+    return
+  }
+
+  try {
+    if (detail.value.isFavorite) {
+      // 取消收藏
+      const res = await myFavoriteDel({ id: productId.value })
+      if (res.code === '200') {
+        detail.value.isFavorite = false
+        toast.success(t('productDetail.unfavoriteSuccess'))
+      }
+    }
+    else {
+      // 添加收藏
+      const res = await myFavoriteAdd({ productIdList: [productId.value] })
+      if (res.code === '200') {
+        detail.value.isFavorite = true
+        toast.success(t('productDetail.favoriteSuccess'))
+      }
+    }
+  }
+  catch (error) {
+    console.error('收藏操作失败:', error)
+  }
+}
+
 // 预下单
 async function preOrder() {
   if (!requireLogin()) {
@@ -428,13 +483,26 @@ onShow(() => {
       <view class="flex gap-32rpx bg-white/60 px-28rpx py-30rpx backdrop-blur-20">
         <view class="flex items-center justify-between gap-20rpx">
           <view class="flex flex-col items-center justify-center">
-            <wd-icon color="#BDBDBD" name="home" size="40rpx" />
+            <image
+              src="/static/icons/go-home.png"
+              class="h-40rpx w-40rpx"
+              @click="goHome"
+            />
             <text class="text-18rpx text-#757575">
               {{ $t('productDetail.home') }}
             </text>
           </view>
-          <view class="flex flex-col items-center justify-center">
-            <wd-icon color="#BDBDBD" name="heart-filled" size="40rpx" />
+          <view class="flex flex-col items-center justify-center" @click="toggleFavorite">
+            <image
+              v-if="detail.isFavorite"
+              src="/static/icons/favorite-active.png"
+              class="h-40rpx w-40rpx"
+            />
+            <image
+              v-else
+              src="/static/icons/favorite.png"
+              class="h-40rpx w-40rpx"
+            />
             <text class="text-18rpx text-#757575">
               {{ $t('productDetail.favorite') }}
             </text>
@@ -447,8 +515,8 @@ onShow(() => {
             </view>
             <CustomTooltip
               v-model:visible="showTip"
-              :highlight-text1="`৳${detail.price}`"
-              highlight-text2="$1.8"
+              :highlight-text1="`৳${formatNumber(detail.price)}`"
+              :highlight-text2="`৳${rebate}`"
             />
           </view>
           <view class="rounded-r-full bg-[var(--wot-color-theme)] px-34rpx py-18rpx text-white" @click="openSku('join')">

+ 19 - 2
src/pages/referEarn/referEarn.vue

@@ -12,6 +12,7 @@
 // eslint-disable-next-line unused-imports/no-unused-imports
 import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
 import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
+import { getConfigByCode } from '@/api/common'
 import { myUsers } from '@/api/mine'
 import { goBack } from '@/utils/page'
 
@@ -39,6 +40,22 @@ async function queryList(pageNo: number, pageSize: number) {
     paging.value.complete(false)
   }
 }
+const invitedAmount = ref<any>(0)
+async function getConfig() {
+  try {
+    const res = await getConfigByCode({ code: 'invited_amount' })
+    console.log(res)
+    if (res.code === '200') {
+      invitedAmount.value = res.data.valueInfo
+    }
+  }
+  catch {
+
+  }
+}
+onLoad(() => {
+  getConfig()
+})
 </script>
 
 <template>
@@ -62,7 +79,7 @@ async function queryList(pageNo: number, pageSize: number) {
           <view class="mb-26rpx">
             {{ $t('referEarn.earnCash') }}
             <text class="text-[var(--wot-color-theme)]">
-              ৳50
+              ৳{{ invitedAmount }}
             </text>
           </view>
         </view>
@@ -99,7 +116,7 @@ async function queryList(pageNo: number, pageSize: number) {
             3
           </view>
           <view class="text-24rpx text-#8F3301 font-bold">
-            {{ $t('referEarn.step3') }}
+            {{ $t('referEarn.step3', [invitedAmount]) }}
           </view>
         </view>
       </view>

BIN
src/static/icons/favorite-active.png


BIN
src/static/icons/favorite.png


BIN
src/static/icons/gift.png


BIN
src/static/icons/go-home.png