From 891ee783a5e249738a5423b3e53e938a96c8c6e7 Mon Sep 17 00:00:00 2001 From: yindongqi Date: Mon, 14 Jul 2025 10:00:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E5=8A=9F=E8=83=BD=E4=B8=8E=E4=BC=98=E5=8C=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增商品券类型支持,包括商品券的领取、使用和展示 - 优化优惠券领取流程,支持兑换码兑换和自动跳转登录 - 新增优惠活动功能,支持活动商品折扣 - 重构优惠券页面布局,区分领取和使用页面 - 新增分销商信息编辑功能 - 优化小程序更新机制,改进更新提示流程 - 修复优惠券使用条件判断逻辑 - 调整UI样式,统一主题色为绿色 - 新增电话客服功能,支持动态电话号码 - 优化订单详情页,展示商品券信息 --- App.vue | 100 +- api/activity.js | 16 + api/coupon.js | 7 + api/distributor.js | 8 + api/goods.js | 7 + pages.json | 10 +- .../components/pages/coupons/coupons copy.vue | 563 ++++++++++ pages/components/pages/coupons/coupons.vue | 236 ++++- pages/components/pages/coupons/mycoupons.vue | 738 +++++++++++++ pages/components/pages/fenxiao/fenxiao.vue | 9 +- .../pages/fenxiao/fenxiaorequestform.vue | 103 +- pages/components/pages/login/login.vue | 15 +- pages/components/pages/mine/helpcenter.vue | 9 +- pages/components/pages/orders/detail.vue | 8 + pages/components/pages/packages/index.vue | 157 ++- pages/components/pages/pay/pay.vue | 280 ++++- pages/index/index.vue | 4 - pages/menu/coupon-float.vue | 217 ++++ pages/menu/menu.vue | 973 +++++++++++++----- pages/mine/mine.vue | 4 +- static/images/coupon-icon.png | Bin 0 -> 6370 bytes uni.scss | 3 +- 22 files changed, 3027 insertions(+), 440 deletions(-) create mode 100644 api/activity.js create mode 100644 pages/components/pages/coupons/coupons copy.vue create mode 100644 pages/components/pages/coupons/mycoupons.vue create mode 100644 pages/menu/coupon-float.vue create mode 100644 static/images/coupon-icon.png diff --git a/App.vue b/App.vue index 490e8d3..fb56dc9 100644 --- a/App.vue +++ b/App.vue @@ -12,56 +12,78 @@ import { import { APP_ID } from '@/config' // 检查更新逻辑 -const checkUpdate = () => { - // 兼容性检查(非必须,但建议) - if (!uni.canIUse('getUpdateManager')) { - uni.showModal({ - title: '提示', - content: '当前微信版本过低,请升级后使用', - showCancel: false - }); - return; - } - - const updateManager = uni.getUpdateManager(); - - // 检测是否有新版本 - updateManager.onCheckForUpdate((res) => { - if (res.hasUpdate) { - uni.showLoading({ title: '检测到新版本,下载中...' }); - } - }); - - // 新版本下载完成 - updateManager.onUpdateReady(() => { - uni.hideLoading(); - uni.showModal({ - title: '更新提示', - content: '新版本已准备好,立即重启应用?', - showCancel: false, - success: (res) => { - if (res.confirm) { - // 强制应用新版本并重启 - updateManager.applyUpdate(); - } +const autoUpdate = () => { + // 获取小程序更新机制兼容 + if (uni.canIUse("getUpdateManager")) { + // 获取更新管理器 + const updateManager = uni.getUpdateManager(); + //1. 检查小程序是否有新版本发布,向小程序后台请求完新版本信息 + updateManager.onCheckForUpdate((res) => { + // 请求完新版本信息的回调 + if (res.hasUpdate) { + //检测到新版本,需要更新,给出提示 + uni.showModal({ + title: "更新提示", + content: "检测到新版本,是否下载新版本并重启小程序?", + success: (res) => { + if (res.confirm) { + //2. 用户确定下载更新小程序,小程序下载及更新静默进行 + downLoadAndUpdate(updateManager); + } else if (res.cancel) { + //用户点击取消按钮的处理,如果需要强制更新,则给出二次弹窗,如果不需要,则这里的代码都可以删掉了 + uni.showModal({ + title: "温馨提示", + content: "本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦", + showCancel: false, //隐藏取消按钮 + confirmText: "确定更新", //只保留确定更新按钮 + success: (res) => { + if (res.confirm) { + //下载新版本,并重新应用 + downLoadAndUpdate(updateManager); + } + }, + }); + } + }, + }); } }); + } else { + // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示 + uni.showModal({ + title: "提示", + content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。", + }); + } +} + +/** + * 下载小程序新版本并重启应用 + */ +const downLoadAndUpdate = (updateManager) => { + uni.showLoading(); + //静默下载更新小程序新版本,更新完成后回调 + updateManager.onUpdateReady(() => { + uni.hideLoading(); + //新的版本已经下载好,调用 applyUpdate 应用新版本并重启 + updateManager.applyUpdate(); }); - // 下载失败处理 + // 更新失败回调 updateManager.onUpdateFailed(() => { - uni.hideLoading(); + // 新的版本下载失败 uni.showModal({ - title: '提示', - content: '更新失败,请删除小程序后重新搜索打开', - showCancel: false + title: "已经有新版本了哟~", + content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~", }); }); -}; +} + + onLaunch(() => { - checkUpdate(); + autoUpdate(); console.log('App Launch') }) diff --git a/api/activity.js b/api/activity.js new file mode 100644 index 0000000..10dc98e --- /dev/null +++ b/api/activity.js @@ -0,0 +1,16 @@ +import api from './api' + +/** + * 获取某个优惠活动 + */ +export function getpromotionactivity(id) { + return api.get(`/promotionactivity/get?id=${id}`, {}, { login: false }) +} + +/** +* 获取所有优惠活动 +*/ +export function getPromotionactivityInfo(data) { + return api.get(`/promotionactivity/page`, data, { login: true }) +} + diff --git a/api/coupon.js b/api/coupon.js index 3888787..797bfd9 100644 --- a/api/coupon.js +++ b/api/coupon.js @@ -14,6 +14,13 @@ export function couponMine(data) { return api.get(`/coupon/my`, data, { login: false }) } +/** + * couponMine + */ +export function couponCanUserMine(data) { + return api.get(`/coupon/use`, data, { login: false }) +} + /** * couponIndex let couponCount = (params = {}) => vm.$u.get('/coupon/count', params); */ diff --git a/api/distributor.js b/api/distributor.js index c26b643..b3bdb0b 100644 --- a/api/distributor.js +++ b/api/distributor.js @@ -21,3 +21,11 @@ export function getDistributorInfo(id) { export function getCommissionList(data) { return api.get(`/order/listByDistributor`, data, { login: true }) } + +/** + * 编辑分销商信息 + * @param {Object} data - 包含 id, name, phone, workUnit, recipientName, bankCardNumber, bankName + */ +export function editDistributor(data) { + return api.put(`/distributor/update`, data, { login: true }) +} diff --git a/api/goods.js b/api/goods.js index 79863f2..6a00862 100644 --- a/api/goods.js +++ b/api/goods.js @@ -13,3 +13,10 @@ export function menuGoods(data) { return api.get('/product/products', data, { login: false }) } +/** + * 获取某个商品信息 + */ +export function getGoods(id) { + return api.get('/product/detail/' + id, { login: false }) +} + diff --git a/pages.json b/pages.json index 9c2a8c3..76b363d 100644 --- a/pages.json +++ b/pages.json @@ -124,11 +124,19 @@ "path": "pages/coupons/coupons", "style": { "enablePullDownRefresh": true, - "navigationBarTitleText": "我的卡券", + "navigationBarTitleText": "领取卡券", "navigationBarTextStyle": "black", "navigationBarBackgroundColor": "#ffffff" } }, { + "path": "pages/coupons/mycoupons", + "style": { + "enablePullDownRefresh": true, + "navigationBarTitleText": "我的卡券", + "navigationBarTextStyle": "black", + "navigationBarBackgroundColor": "#ffffff" + } + },{ "path": "pages/mine/userinfo", "style": { "navigationBarTitleText": "用户信息", diff --git a/pages/components/pages/coupons/coupons copy.vue b/pages/components/pages/coupons/coupons copy.vue new file mode 100644 index 0000000..378d9bf --- /dev/null +++ b/pages/components/pages/coupons/coupons copy.vue @@ -0,0 +1,563 @@ + + + + + diff --git a/pages/components/pages/coupons/coupons.vue b/pages/components/pages/coupons/coupons.vue index 378d9bf..a527de0 100644 --- a/pages/components/pages/coupons/coupons.vue +++ b/pages/components/pages/coupons/coupons.vue @@ -1,6 +1,7 @@