diff --git a/App.vue b/App.vue index 72f9919..17069c5 100644 --- a/App.vue +++ b/App.vue @@ -3,6 +3,23 @@ export default { globalData: { + /** + * urlParams - 当前页面 URL 参数集合 + * + * 来源: + * 1. H5 环境下从 window.location(search + hash)解析 + * 2. 小程序/App 环境下从页面栈 currentPage.options 获取 + * 3. 分享/扫码进入时从 App.onLaunch/onShow 的 options.query 合并 + * + * 目前业务中实际使用的参数: + * - token {string} 用户登录凭证 + * - code {string} 淘宝后返回授权码 + * - state {string} 状态值,格式通常为 "uidxxx",用于提取用户 ID(淘宝授权返回) + * - exuid {string} 推广人/邀请人用户 ID(三方进入用户标识) + * - page_uri {string} 授权成功后需要跳转的目标页面路径(必须授权过的用户该参数才有效) + * + * 注:UrlQuery 支持获取任意 URL 参数,以上仅为业务代码中显式消费的字段 + */ urlParams: {} }, onLaunch: function(options) { diff --git a/components/bottom-nav/bottom-nav.vue b/components/bottom-nav/bottom-nav.vue index a6b396c..473eccc 100644 --- a/components/bottom-nav/bottom-nav.vue +++ b/components/bottom-nav/bottom-nav.vue @@ -8,6 +8,8 @@ diff --git a/pages/category/category.vue b/pages/category/category.vue index 6ec39eb..012c19e 100644 --- a/pages/category/category.vue +++ b/pages/category/category.vue @@ -82,6 +82,12 @@ {{ goods.couponValue }}元 + + + 预估消费券 + {{ $estimateCoupon(goods.tkmoney) }} + + @@ -103,6 +109,7 @@ + + diff --git a/unpackage/dist/cache/.vite/deps/_metadata.json b/unpackage/dist/cache/.vite/deps/_metadata.json index d316793..b492e34 100644 --- a/unpackage/dist/cache/.vite/deps/_metadata.json +++ b/unpackage/dist/cache/.vite/deps/_metadata.json @@ -1,8 +1,8 @@ { - "hash": "0694fca5", - "configHash": "6057985e", - "lockfileHash": "e3b0c442", - "browserHash": "9518c2ac", + "hash": "aee3647b", + "configHash": "43aa957d", + "lockfileHash": "32773baf", + "browserHash": "732cb9f3", "optimized": {}, "chunks": {} } \ No newline at end of file diff --git a/utils/index.js b/utils/index.js new file mode 100644 index 0000000..861a7cd --- /dev/null +++ b/utils/index.js @@ -0,0 +1,5 @@ +// 预估消费券函数 +export function estimateCoupon(tkmoney = 0, percentage = 0.3) { + let result = (tkmoney * percentage).toFixed(2); + return result; +}