diff --git a/.gitignore b/.gitignore index 39127f2..d7067c8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,13 @@ /unpackage node_modules/ .vscode/ -.hbuilderx/ \ No newline at end of file +.hbuilderx/ +/.idea/inspectionProfiles/Project_Default.xml +/.idea/.gitignore +/.idea/cashier_wx.iml +/.idea/jsLibraryMappings.xml +/.idea/misc.xml +/.idea/modules.xml +/.idea/uniappSupport.xml +/.idea/UniappTool.xml +/.idea/vcs.xml diff --git a/common/api/api.js b/common/api/api.js index 25abaa5..661392c 100644 --- a/common/api/api.js +++ b/common/api/api.js @@ -31,6 +31,14 @@ export const APIuser = (data) => { }) } +export const updateUserInfoReq = (data) => { + return request({ + url: url + '/user', + method: 'put', + data: data + }) +} + //获取手机号 export const APIuserphone = (data) => { return request({ diff --git a/common/api/market/package.js b/common/api/market/package.js new file mode 100644 index 0000000..df9d185 --- /dev/null +++ b/common/api/market/package.js @@ -0,0 +1,125 @@ +// 引入 request 文件 +import request from '@/common/api/request.js' +import { + prveUrl +} from './config.js' + +const orderPrveUrl = '/order' + +let platformType = ''; +let payType = ''; +// #ifdef MP-WEIXIN +platformType = 'wechat' +payType = 'wechatPay' +// #endif +// #ifdef MP-ALIPAY +platformType = 'alipay' +payType = 'aliPay' +// #endif + +export const getPackage = (data) => { + return request({ + url: prveUrl + '/user/package', + method: 'get', + data: data + }) +} + + +export const getPackageDetail = (data) => { + return request({ + url: prveUrl + '/user/package/detail/' + data.id, + method: 'get', + data + }) +} + +export const helpPage = (data) => { + return request({ + url: prveUrl + '/user/package/help/page', + method: 'get', + data: data + }) +} + + + + +export const order = (data) => { + return request({ + url: prveUrl + '/user/package/order', + method: 'get', + data: data + }) +} + + +export const createOrder = (data) => { + return request({ + url: prveUrl + '/user/package/order', + method: 'post', + data: data + }) +} + + + +export const cancel = (data) => { + return request({ + url: prveUrl + '/user/package/cancel', + method: 'get', + data: data + }) +} + +export const help = (data) => { + return request({ + url: prveUrl + '/user/package/help', + method: 'get', + data: data + }) +} + +export const orderDetail = (data) => { + return request({ + url: prveUrl + '/user/package/order/detail', + method: 'get', + data: data + }) +} + + +export const ppOrderPay = (data) => { + + // #ifdef MP-WEIXIN + const openId = uni.cache.get('userInfo').wechatOpenId; + // #endif + // #ifdef MP-ALIPAY + const openId = uni.cache.get('userInfo').alipayOpenId; + // #endif + return request({ + url: orderPrveUrl + '/user/ppOrder/pay', + method: 'post', + data: { + platformType, + payType, + openId, + ...data + } + }) + +} +export const applyRefund = (data) => { + return request({ + url: orderPrveUrl + '/user/ppOrder/applyRefund', + method: 'post', + data: data + }) +} +export const cancelRefund = (data) => { + return request({ + url: orderPrveUrl + '/user/ppOrder/cancelRefund', + method: 'post', + data: data + }) +} \ No newline at end of file diff --git a/common/api/order/gbOrder.js b/common/api/order/gbOrder.js new file mode 100644 index 0000000..16f2edc --- /dev/null +++ b/common/api/order/gbOrder.js @@ -0,0 +1,80 @@ +// 引入 request 文件 +import request from '@/common/api/request.js' +const url = '/order' + +let platformType = ''; +let payType=''; +// #ifdef MP-WEIXIN +platformType = 'wechat' +payType='wechatPay' +// #endif +// #ifdef MP-ALIPAY +platformType = 'alipay' +payType='aliPay' +// #endif + +export const warePage = (data) => { + return request({ + url: url + '/user/gbOrder/ware/page', + method: 'get', + data: data + }) +} + +export const wareDetail = (data) => { + return request({ + url: url + '/user/gbOrder/ware/detail', + method: 'get', + data: data + }) +} +export const record = (data) => { + return request({ + url: url + '/user/gbOrder/record/page', + method: 'get', + data: data + }) +} +export const recordDetail = (data) => { + return request({ + url: url + '/user/gbOrder/record/detail', + method: 'get', + data: data + }) +} + + + + +export const exchange = (data) => { + // #ifdef MP-WEIXIN + const openId=uni.cache.get('userInfo').wechatOpenId; + // #endif + // #ifdef MP-ALIPAY + const openId=uni.cache.get('userInfo').alipayOpenId; + // #endif + return request({ + url: url + '/user/gbOrder/exchange', + method: 'post', + data: { + platformType, + payType, + openId, + ...data + } + }) +} +export const applyRefund = (data) => { + return request({ + url: url + '/user/gbOrder/applyRefund', + method: 'post', + data: data + }) +} +export const cancelRefund = (data) => { + return request({ + url: url + '/user/gbOrder/cancelRefund', + method: 'post', + data: data + }) +} \ No newline at end of file diff --git a/common/api/request.js b/common/api/request.js index adda8b2..d708f06 100644 --- a/common/api/request.js +++ b/common/api/request.js @@ -1,138 +1,143 @@ -export default (params) => { - let url = params.url; - let method = params.method || "get"; - let data = params.data || {}; - let type = params.type || 1; - let toast = params.toast || true; - let token = uni.cache.get("token") || ""; - const shopId = uni.cache.get("shopId") * 1; - const userInfo = uni.cache.get("userInfo") || {}; - // #ifdef H5 - token = "21f0a0b10e1d40ce9c6464037fedb792"; - // #endif - let header = { - version: uni.conf.version, - type: uni.getSystemInfoSync().platform, - // #ifdef APP-PLUS - platformType: "APP", - // #endif - // #ifdef H5 - platformType: "H5", - // #endif - // #ifdef MP-WEIXIN - platformType: "WX", - // #endif - // #ifdef MP-ALIPAY - platformType: "ALI", - // #endif - token, - id: userInfo.id || "", - shopId: shopId || "", - userId: userInfo.id || "", - }; - if (toast) { - uni.showLoading({ - title: "加载中", - mask: true, - }); - } - return new Promise((resolve, reject) => { - const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒 - uni.request({ - url: uni.conf.baseUrl + url, - method: method, - header: header, - data: data, - timeout: timeoutDuration, - success(response) { - const res = response.data; - // 根据返回的状态码做出对应的操作 - //获取成功 - if (res.code == 200) { - uni.hideLoading(); - uni.hideToast(); - resolve(res.data ? res.data : true); - } else { - switch (res.code) { - case "501": - uni.cache.remove("shopId"); - // uni.showToast({ - // title: '', - // icon: "none", - // success: () => { - // } - // }) - setTimeout(() => { - uni.reLaunch({ - url: "/pages/index/index", - }); - }, 1000); - break; - case 404: - uni.showToast({ - title: "请求地址不存在...", - duration: 2000, - }); - break; - default: - // 是否提示 - if (toast) { - uni.showToast({ - title: (() => { - // 1. 获取原始提示文本(兜底空字符串避免报错) - const originMsg = res.message || res.msg || res.error || ""; - // 2. 定义要匹配的前缀 - const exceptionPrefix = "Exception:"; - // 3. 判断是否包含目标前缀 - if (originMsg.includes(exceptionPrefix)) { - // 截取前缀后的内容 → 去除首尾空格 → 限制最大20个字符 - return originMsg - .slice( - originMsg.indexOf(exceptionPrefix) + - exceptionPrefix.length - ) - .trim() - .slice(0, 20); - } else { - // 不包含则按原逻辑截取前20个字符 - return originMsg.slice(0, 20); - } - })(), - icon: "none", - success: () => { - // 修复:去掉多余的 res 参数(避免覆盖外层 res) - setTimeout(() => { - reject(false); - }, 1000); - }, - }); - } - break; - } - } - }, - fail(err) { - if (err.errMsg.indexOf("request:fail") !== -1) { - if (err.errMsg.indexOf("timeout") !== -1) { - if (toast) { - uni.showToast({ - title: `请求超时,请稍后重试`, - icon: "error", - duration: 2000, - }); - } - } - } - reject(err); - }, - complete() { - // 不管成功还是失败都会执行 - setTimeout((res) => { - uni.hideLoading(); - uni.hideToast(); - }, 10000); - }, - }); - }).catch((e) => {}); -}; +export default async (params) => { + let url = params.url; + let method = params.method || "get"; + let data = params.data || {}; + let type = params.type || 1; + let toast = params.toast || true; + let token = uni.cache.get("token") || ""; + const shopId = uni.cache.get("shopId") * 1; + const userInfo = uni.cache.get("userInfo") || {}; + // #ifdef H5 + token = "b61c8b0f1c9d47ad924e33c48b496ce6"; + // #endif + let header = { + version: uni.conf.version, + type: uni.getSystemInfoSync().platform, + // #ifdef APP-PLUS + platformType: "APP", + // #endif + // #ifdef H5 + platformType: "H5", + // #endif + // #ifdef MP-WEIXIN + platformType: "WX", + // #endif + // #ifdef MP-ALIPAY + platformType: "ALI", + // #endif + token, + id: userInfo.id || "", + shopId: shopId || "", + userId: userInfo.id || "", + }; + if (toast) { + uni.showLoading({ + title: "加载中", + mask: true, + }); + } + + return new Promise((resolve, reject) => { + const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒 + uni.request({ + url: uni.conf.baseUrl + url, + method: method, + header: header, + data: data, + timeout: timeoutDuration, + success(response) { + const res = response.data; + // 根据返回的状态码做出对应的操作 + //获取成功 + if (res.code == 200) { + uni.hideLoading(); + uni.hideToast(); + resolve(res.data ? res.data : true); + } else { + switch (res.code) { + case "501": + uni.cache.remove("shopId"); + // uni.showToast({ + // title: '', + // icon: "none", + // success: () => { + + // } + // }) + setTimeout(() => { + uni.reLaunch({ + url: "/pages/index/index", + }); + }, 1000); + break; + case 404: + uni.showToast({ + title: "请求地址不存在...", + duration: 2000, + }); + break; + default: + // 是否提示 + if (toast) { + uni.showToast({ + title: (() => { + // 1. 获取原始提示文本(兜底空字符串避免报错) + const originMsg = res.message || res.msg || + res + .error || ""; + // 2. 定义要匹配的前缀 + const exceptionPrefix = "Exception:"; + // 3. 判断是否包含目标前缀 + if (originMsg.includes(exceptionPrefix)) { + // 截取前缀后的内容 → 去除首尾空格 → 限制最大20个字符 + return originMsg + .slice( + originMsg.indexOf( + exceptionPrefix) + + exceptionPrefix.length + ) + .trim() + .slice(0, 20); + } else { + // 不包含则按原逻辑截取前20个字符 + return originMsg.slice(0, 20); + } + })(), + icon: "none", + success: () => { + // 修复:去掉多余的 res 参数(避免覆盖外层 res) + setTimeout(() => { + reject(false); + }, 1000); + }, + }); + } + break; + } + } + }, + fail(err) { + if (err.errMsg.indexOf("request:fail") !== -1) { + if (err.errMsg.indexOf("timeout") !== -1) { + if (toast) { + uni.showToast({ + title: `请求超时,请稍后重试`, + icon: "error", + duration: 2000, + }); + } + } + } + reject(err); + }, + complete() { + // 不管成功还是失败都会执行 + setTimeout((res) => { + uni.hideLoading(); + uni.hideToast(); + }, 10000); + }, + }); + }).catch((e) => {}); +}; \ No newline at end of file diff --git a/common/config.js b/common/config.js index 1c2f8d9..049fa46 100644 --- a/common/config.js +++ b/common/config.js @@ -1,5 +1,5 @@ // const debug = process.env.NODE_ENV == 'development' ? true : false; -const debug = false; +const debug = true; // false线上 true本地 // #ifdef H5 const proxyApi = "/api"; // #endif @@ -32,13 +32,14 @@ uni.conf = { baseUrlwws, }; -console.log('uni.conf',uni.conf) export const changeEnv = (env) => { if (env === "test") { let baseUrl = "http://192.168.1.42" + let baseUrlwws="ws://192.168.1.42:2348" // #ifdef H5 baseUrl = "/api" + baseUrlwws="http://192.168.1.42:2348" // #endif uni.conf = { debug: true, @@ -47,7 +48,7 @@ export const changeEnv = (env) => { phpChatWx: 'ws://192.168.1.42:2348', version: 100, autoRemoveCache, - baseUrlwws: "ws://192.168.1.42:2348", + baseUrlwws, }; } if (env === "prod") { @@ -59,4 +60,6 @@ export const changeEnv = (env) => { baseUrlwws: "wss://czgeatws.sxczgkj.com/wss", }; } -}; \ No newline at end of file +}; + +export default uni.conf \ No newline at end of file diff --git a/components/attract-popup.vue b/components/attract-popup.vue new file mode 100644 index 0000000..44791f3 --- /dev/null +++ b/components/attract-popup.vue @@ -0,0 +1,230 @@ + + + + + + diff --git a/components/drainage.vue b/components/drainage.vue index e0d1ceb..473365b 100644 --- a/components/drainage.vue +++ b/components/drainage.vue @@ -1,114 +1,93 @@ \ No newline at end of file + diff --git a/components/look-qrcode/look-qrcode.vue b/components/look-qrcode/look-qrcode.vue new file mode 100644 index 0000000..61dda9d --- /dev/null +++ b/components/look-qrcode/look-qrcode.vue @@ -0,0 +1,41 @@ + + + + + \ No newline at end of file diff --git a/components/modal.vue b/components/modal.vue new file mode 100644 index 0000000..5d90202 --- /dev/null +++ b/components/modal.vue @@ -0,0 +1,97 @@ + + + + diff --git a/components/order-finish-modal.vue b/components/order-finish-modal.vue index 8f6e73a..b2c6d25 100644 --- a/components/order-finish-modal.vue +++ b/components/order-finish-modal.vue @@ -1,43 +1,49 @@ - - diff --git a/framework/0-conf.js b/framework/0-conf.js index cf0810e..e69de29 100644 --- a/framework/0-conf.js +++ b/framework/0-conf.js @@ -1,34 +0,0 @@ -// const debug = process.env.NODE_ENV == 'development' ? true : false; -const debug = false -// #ifdef H5 -const proxyApi = "/api" -// #endif - -// #ifdef MP-WEIXIN || APP || MP-ALIPAY -const proxyApi = 'http://192.168.1.42' // 调试地址 -const proxyApiwws = 'ws://192.168.1.42:2348' // 调试地址 -// #endif - -// #ifdef H5 -const baseUrl = debug ? proxyApi : "http://192.168.1.42" -const baseUrlwws = 'ws://192.168.1.42:2348' -// #endif - -// #ifdef APP || MP-WEIXIN || MP-ALIPAY -const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.com' // 线上 -const baseUrlwws = debug ? proxyApiwws : 'wss://czgeatws.sxczgkj.com/wss' // 线上 -// #endif - - -const version = '100' -const autoRemoveCache = { - count: 100000, - size: 100000 -} -uni.conf = { - debug, - baseUrl, - version, - autoRemoveCache, - baseUrlwws -} \ No newline at end of file diff --git a/framework/8-cache.js b/framework/8-cache.js index b8b8f41..036e281 100644 --- a/framework/8-cache.js +++ b/framework/8-cache.js @@ -11,7 +11,9 @@ function get(key) { return '' } - + // #ifdef H5 + return res.value + // #endif if (res.expiretime && res.expiretime < Date.now()) { remove(key) diff --git a/framework/bootstrap.js b/framework/bootstrap.js index 81e3b14..235f167 100644 --- a/framework/bootstrap.js +++ b/framework/bootstrap.js @@ -1,4 +1,3 @@ -import './0-conf' import './1-utils' import './2-url' import './3-pro' diff --git a/groupBuying/components/modal.vue b/groupBuying/components/modal.vue new file mode 100644 index 0000000..5d90202 --- /dev/null +++ b/groupBuying/components/modal.vue @@ -0,0 +1,97 @@ + + + + diff --git a/groupBuying/components/status.vue b/groupBuying/components/status.vue new file mode 100644 index 0000000..1928bdb --- /dev/null +++ b/groupBuying/components/status.vue @@ -0,0 +1,74 @@ + + + + + \ No newline at end of file diff --git a/groupBuying/confirm-order/confirm-order.vue b/groupBuying/confirm-order/confirm-order.vue new file mode 100644 index 0000000..36d3c62 --- /dev/null +++ b/groupBuying/confirm-order/confirm-order.vue @@ -0,0 +1,250 @@ + + + + + \ No newline at end of file diff --git a/groupBuying/detail/index.vue b/groupBuying/detail/index.vue new file mode 100644 index 0000000..d6b8355 --- /dev/null +++ b/groupBuying/detail/index.vue @@ -0,0 +1,771 @@ + + + + + \ No newline at end of file diff --git a/groupBuying/goodsDetail/goodsDetail.vue b/groupBuying/goodsDetail/goodsDetail.vue new file mode 100644 index 0000000..2203cca --- /dev/null +++ b/groupBuying/goodsDetail/goodsDetail.vue @@ -0,0 +1,696 @@ + + + + \ No newline at end of file diff --git a/groupBuying/index/components/perpole-number.vue b/groupBuying/index/components/perpole-number.vue new file mode 100644 index 0000000..06511c0 --- /dev/null +++ b/groupBuying/index/components/perpole-number.vue @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/groupBuying/index/index.vue b/groupBuying/index/index.vue index 17fdc85..b748001 100644 --- a/groupBuying/index/index.vue +++ b/groupBuying/index/index.vue @@ -1,54 +1,72 @@ \ No newline at end of file diff --git a/groupBuying/static/image/copy.png b/groupBuying/static/image/copy.png new file mode 100644 index 0000000..4c09474 Binary files /dev/null and b/groupBuying/static/image/copy.png differ diff --git a/groupBuying/success/index.vue b/groupBuying/success/index.vue new file mode 100644 index 0000000..fe6a867 --- /dev/null +++ b/groupBuying/success/index.vue @@ -0,0 +1,934 @@ + + + + + \ No newline at end of file diff --git a/main.js b/main.js index cd79518..b371822 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,8 @@ import App from './App' import uviewPlus from '@/uni_modules/uview-plus' import './framework/bootstrap' +import config from '@/common/config.js' + // #ifndef VUE3 import Vue from 'vue' import './uni.promisify.adaptor' diff --git a/pages.json b/pages.json index 6980d60..3189a1a 100644 --- a/pages.json +++ b/pages.json @@ -354,10 +354,9 @@ // } // ] // } - ,{ + , { "root": "groupBuying", - "pages": [ - { + "pages": [{ "path": "index/index", "style": { "navigationBarTitleText": "拼团特惠", @@ -370,6 +369,76 @@ "navigationBarTitleText": "拼团特惠", "navigationStyle": "custom" } + }, + { + "path": "detail/index", + "style": { + "navigationBarTitleText": "订单详情", + "navigationStyle": "custom" + } + }, + { + "path": "goodsDetail/goodsDetail", + "style": { + "navigationBarTitleText": "拼团特惠" + } + }, + { + "path": "success/index", + "style": { + "navigationBarTitleText": "支付成功", + "navigationStyle": "custom" + } + }, + { + "path": "confirm-order/confirm-order", + "style": { + "navigationBarTitleText": "确认订单" + } + } + + ] + }, + { + "root": "userPackage", + "pages": [ + { + "path": "index/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "goodsDetail/goodsDetail", + "style": { + "navigationBarTitleText": "套餐详情" + } + }, + { + "path": "order/order", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "order/detail", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "confirm-order/confirm-order", + "style": { + "navigationBarTitleText": "确认订单" + } + }, + { + "path": "members/members", + "style": { + "navigationBarTitleText": "查看全部" + } } ] diff --git a/pages/index/indexs.vue b/pages/index/indexs.vue index 6e790d1..e169d01 100644 --- a/pages/index/indexs.vue +++ b/pages/index/indexs.vue @@ -5,28 +5,26 @@ - + - - - HI,欢迎回来 + HI,欢迎回来 会员身份 - 优惠券:{{allConfig.couponNum}} - 积分:{{allConfig.pointNum}} + 优惠券:{{ allConfig.couponNum }} + 积分:{{ allConfig.pointNum }} - @@ -52,11 +50,9 @@ -自助下单 快人一步- - - - + 快乐拼单 @@ -64,9 +60,10 @@ 一键分享,快速拼单 + - + 积分乐园 好物兑换 畅花积分 @@ -74,6 +71,14 @@ + + + 套餐推广 + 邀好友助力,套餐更优惠 + + + + @@ -85,15 +90,14 @@ 充值 充值享更多优惠 - + 股东共享 邀请好友,获得佣金 - - + @@ -112,27 +116,33 @@ + + + .msg-icon-wrapper { + position: relative; + margin-left: 30rpx; + } + + .my-msg-icon { + width: 50rpx; + height: 50rpx; + } + + // 角标样式 + .badge { + position: absolute; + top: -8rpx; + right: -8rpx; + min-width: 32rpx; + height: 32rpx; + background-color: #ff3b30; + border-radius: 16rpx; + display: flex; + align-items: center; + justify-content: center; + padding: 0 6rpx; + z-index: 10; + + .badge-text { + color: white; + font-size: 20rpx; + font-weight: bold; + line-height: 1; + text-align: center; + } + } + } + \ No newline at end of file diff --git a/scoreShop/detail/index.vue b/scoreShop/detail/index.vue index 6915d5b..1a06c87 100644 --- a/scoreShop/detail/index.vue +++ b/scoreShop/detail/index.vue @@ -166,7 +166,7 @@ uni.hideLoading() if (openId) { pointGoodsApi.exchange({ - pointsGoodsId: item.id, + paramId: item.id, shopId: item.shopId, number: 1, price: item.extraPrice, diff --git a/scoreShop/index/index.vue b/scoreShop/index/index.vue index 9d94857..268e5c9 100644 --- a/scoreShop/index/index.vue +++ b/scoreShop/index/index.vue @@ -87,8 +87,12 @@ // } function toDetail() { + if(!pointsUser.value||!pointsUser.value.id){ + return + } + uni.navigateTo({ - url: '/pages/user/member/billDetails?type=2&shopId=' + query.shopId + '&id=' + (pointsUser.value.id || + url: '/pages/user/member/billDetails?type=2&shopId=' + query.shopId + '&id=' + (pointsUser.value?pointsUser.value.id : '') }) } diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts index dc5e282..e69ecf0 100644 --- a/src/auto-imports.d.ts +++ b/src/auto-imports.d.ts @@ -38,6 +38,7 @@ declare global { const onRenderTriggered: typeof import('vue')['onRenderTriggered'] const onScopeDispose: typeof import('vue')['onScopeDispose'] const onServerPrefetch: typeof import('vue')['onServerPrefetch'] + const onShareAppMessage: typeof import('@dcloudio/uni-app')['onShareAppMessage'] const onShow: typeof import('@dcloudio/uni-app')['onShow'] const onUnload: typeof import('@dcloudio/uni-app')['onUnload'] const onUnmounted: typeof import('vue')['onUnmounted'] diff --git a/static/icon/copy.png b/static/icon/copy.png new file mode 100644 index 0000000..4c09474 Binary files /dev/null and b/static/icon/copy.png differ diff --git a/stores/carts-websocket.js b/stores/carts-websocket.js index 0d35364..facdd39 100644 --- a/stores/carts-websocket.js +++ b/stores/carts-websocket.js @@ -233,6 +233,10 @@ export const useWebSocket = defineStore('socketTask', () => { // 发送消息 const sendMessage = (data) => { + console.log('data',data) + if(!data){ + return + } if (isConnected.value && data) { // console.log('发送消息', data); socketTask.value.send({ diff --git a/stores/user.js b/stores/user.js index 19bb25c..f271a91 100644 --- a/stores/user.js +++ b/stores/user.js @@ -49,6 +49,7 @@ export const Storelogin = defineStore("login", { rawData: infoRes.rawData, source: "wechat", }); + console.log('APIuserlogin',res); if (res) { this.token = res.token; this.miniAppOpenId = res.userInfo @@ -95,6 +96,9 @@ export const Storelogin = defineStore("login", { }, }); // #endif + // #ifdef H5 + resolve(true) + // #endif }); }, }, @@ -115,6 +119,18 @@ export const productStore = defineStore("product", { getLocation() { return new Promise((resolve, reject) => { console.log("获取经纬度"); + // #ifdef H5 + resolve({ + accuracy: 65, + altitude: 0, + errMsg: "getLocation:ok", + horizontalAccuracy: 65, + latitude: 23.129163, + longitude: 113.264435, + speed: -1, + verticalAccuracy: 65, + }); + // #endif uni.getLocation({ type: "wgs84", altitude: true, @@ -167,6 +183,13 @@ export const productStore = defineStore("product", { */ async scanCodeactions(q) { console.log("扫码内容", q); + // #ifdef H5 + uni.navigateTo({ + url:'/pages/product/index' + }) + return + // #endif + return new Promise(async (resolve, reject) => { if (q) { console.log(q); @@ -206,7 +229,7 @@ export const productStore = defineStore("product", { } } } else { - // #ifdef APP || MP-WEIXIN || MP-ALIPAY + // #ifdef APP || MP-WEIXIN || MP-ALIPAY uni.scanCode({ success: async (res) => { let tableCode = this.getQueryString( @@ -298,11 +321,11 @@ export const productStore = defineStore("product", { ]) { resolve( true - ); + ); } else { reject( false - ); + ); } }, }); diff --git a/userPackage/components/modal.vue b/userPackage/components/modal.vue new file mode 100644 index 0000000..5d90202 --- /dev/null +++ b/userPackage/components/modal.vue @@ -0,0 +1,97 @@ + + + + diff --git a/userPackage/components/status.vue b/userPackage/components/status.vue new file mode 100644 index 0000000..f8e5a43 --- /dev/null +++ b/userPackage/components/status.vue @@ -0,0 +1,109 @@ + + + + + \ No newline at end of file diff --git a/userPackage/confirm-order/confirm-order.vue b/userPackage/confirm-order/confirm-order.vue new file mode 100644 index 0000000..5ba5823 --- /dev/null +++ b/userPackage/confirm-order/confirm-order.vue @@ -0,0 +1,356 @@ + + + + + \ No newline at end of file diff --git a/userPackage/goodsDetail/goodsDetail.vue b/userPackage/goodsDetail/goodsDetail.vue new file mode 100644 index 0000000..4248ee6 --- /dev/null +++ b/userPackage/goodsDetail/goodsDetail.vue @@ -0,0 +1,884 @@ + + + + \ No newline at end of file diff --git a/userPackage/index/components/perpole-number.vue b/userPackage/index/components/perpole-number.vue new file mode 100644 index 0000000..06511c0 --- /dev/null +++ b/userPackage/index/components/perpole-number.vue @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/userPackage/index/index.vue b/userPackage/index/index.vue new file mode 100644 index 0000000..1a5d17e --- /dev/null +++ b/userPackage/index/index.vue @@ -0,0 +1,861 @@ + + + + + \ No newline at end of file diff --git a/userPackage/members/members.vue b/userPackage/members/members.vue new file mode 100644 index 0000000..e8d05c9 --- /dev/null +++ b/userPackage/members/members.vue @@ -0,0 +1,72 @@ + + + + + \ No newline at end of file diff --git a/userPackage/order/detail.vue b/userPackage/order/detail.vue new file mode 100644 index 0000000..bdf5a83 --- /dev/null +++ b/userPackage/order/detail.vue @@ -0,0 +1,1120 @@ + + + + + \ No newline at end of file diff --git a/userPackage/order/order.vue b/userPackage/order/order.vue new file mode 100644 index 0000000..ddadfea --- /dev/null +++ b/userPackage/order/order.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/userPackage/static/image/copy.png b/userPackage/static/image/copy.png new file mode 100644 index 0000000..4c09474 Binary files /dev/null and b/userPackage/static/image/copy.png differ diff --git a/utils/countdown.js b/utils/countdown.js new file mode 100644 index 0000000..7358a9a --- /dev/null +++ b/utils/countdown.js @@ -0,0 +1,51 @@ +import dayjs from "dayjs" + +/** + * 计算剩余时间差(毫秒) + * @param {Object} item - 包含groupEndTime的订单/拼团对象 + * @returns {number} 剩余时间(毫秒) + */ +function returnRemainingTime(item,key) { + if(!item[key]) return 0; // 容错:无结束时间则返回0 + return dayjs(item[key]).valueOf() - dayjs().valueOf(); +} + +/** + * 将毫秒差格式化为 HH:MM:SS(最多72小时) + * @param {number} ms - 时间差(毫秒) + * @returns {string} 格式化后的时分秒(如 09:09:09、72:00:00、00:00:00) + */ +function formatTimeToHMS(ms) { + // 边界1:已过期/无剩余时间 → 显示00:00:00 + if (ms <= 0) return '00:00:00'; + + // 边界2:超过72小时 → 按72小时算(72*60*60*1000 = 259200000毫秒) + const maxMs = 72 * 60 * 60 * 1000; + const validMs = Math.min(ms, maxMs); + + // 转换为总秒数(取整,避免小数) + const totalSeconds = Math.floor(validMs / 1000); + + // 拆解小时、分钟、秒 + const hours = Math.floor(totalSeconds / 3600); + const remainingSeconds = totalSeconds % 3600; + const minutes = Math.floor(remainingSeconds / 60); + const seconds = remainingSeconds % 60; + + // 补零(确保两位数,如 9 → 09) + const pad = (num) => String(num).padStart(2, '0'); + return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`; +} + + +let timer = null +let nowTime = ref(Date.now()) +timer = setInterval(() => { + nowTime.value = Date.now() +}, 1000) + +// 组合使用:获取格式化后的剩余时间 +export function getRemainingHMS(item,key='groupEndTime') { + const ms = returnRemainingTime(item,key); + return formatTimeToHMS(ms); +} \ No newline at end of file diff --git a/utils/share.js b/utils/share.js new file mode 100644 index 0000000..0aef716 --- /dev/null +++ b/utils/share.js @@ -0,0 +1,6 @@ +export function wxShare(par) { + return { + ...par, + type: 2 + } +} \ No newline at end of file diff --git a/utils/uniapp.js b/utils/uniapp.js index 172e66c..3e45c8d 100644 --- a/utils/uniapp.js +++ b/utils/uniapp.js @@ -1,12 +1,13 @@ -export const back = () => { +export const back = (url) => { console.log('调用返回方法back'); try { const arr = getCurrentPages() if (arr.length >= 2) { return uni.navigateBack() } else { + uni.reLaunch({ - url: '/pages/index/index' + url: url?url:'/pages/index/index' }) } } catch (error) { diff --git a/utils/util.js b/utils/util.js index ac85718..d85b319 100644 --- a/utils/util.js +++ b/utils/util.js @@ -475,4 +475,24 @@ export function includesString(target, searchStr, options = {}) { // 4. 执行包含判断 return processedTarget.includes(processedSearch); +} + +/** + * 校验一维基础类型数组A的元素是否存在于数组B(支持部分/全部存在,默认全部存在) + * @param {Array} arrA - 待校验的一维数组 + * @param {Array} arrB - 参考的一维数组 + * @param {boolean} [partial=false] - 是否校验「部分存在」(true=部分存在,false=全部存在,默认false) + * @returns {boolean} 校验结果 + */ +export function checkArrayElementsExist(arrA, arrB, partial = false) { + // 边界处理:空数组特殊逻辑 + if (arrA.length === 0) return !partial + + // 转Set优化查找性能(一维数组核心优化) + const bSet = new Set(arrB) + + // 核心逻辑:partial=true → some(部分存在),partial=false → every(全部存在) + return partial ? + arrA.some(item => bSet.has(item)) : + arrA.every(item => bSet.has(item)) } \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 0c675b2..9eab6e6 100644 --- a/vite.config.js +++ b/vite.config.js @@ -14,6 +14,7 @@ module.exports = defineConfig({ "vue", { "@dcloudio/uni-app": [ + "onShareAppMessage", "onLoad", "onShow", "onHide",