From cd199c980f9735c45c63d78e17ae55ddd874c51f Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Fri, 19 Dec 2025 15:18:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=BC=E5=9B=A2=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=A5=97=E9=A4=90=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/api/market/package.js | 10 +- common/api/request.js | 279 +++--- groupBuying/components/status.vue | 8 + groupBuying/confirm-order/confirm-order.vue | 3 +- groupBuying/detail/index.vue | 84 +- groupBuying/goodsDetail/goodsDetail.vue | 46 +- groupBuying/index/index.vue | 27 +- groupBuying/success/index.vue | 56 +- pages.json | 22 +- pages/index/indexs.vue | 911 ++++++++++---------- stores/user.js | 3 + userPackage/goodsDetail/goodsDetail.vue | 877 +++++++++++++++++++ userPackage/index/index.vue | 90 +- userPackage/order/detail.vue | 770 +++++++++++++++++ userPackage/order/order.vue | 13 + 15 files changed, 2517 insertions(+), 682 deletions(-) create mode 100644 userPackage/goodsDetail/goodsDetail.vue create mode 100644 userPackage/order/detail.vue create mode 100644 userPackage/order/order.vue diff --git a/common/api/market/package.js b/common/api/market/package.js index 820ad69..b0a352f 100644 --- a/common/api/market/package.js +++ b/common/api/market/package.js @@ -11,10 +11,18 @@ export const getPackage = (data) => { } +export const getPackageDetail = (id) => { + return request({ + url: prveUrl + '/user/package/detail/'+id, + method: 'get', + }) +} + + export const order = (data) => { return request({ url: prveUrl + '/user/package/order', - method: 'get', + method: 'post', data: data }) } diff --git a/common/api/request.js b/common/api/request.js index 861e80f..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 = "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) => {}); -}; +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/groupBuying/components/status.vue b/groupBuying/components/status.vue index fb84b5d..1928bdb 100644 --- a/groupBuying/components/status.vue +++ b/groupBuying/components/status.vue @@ -35,6 +35,9 @@ import { computed } from 'vue' }, ]) const returnClass=computed(()=>{ + if(props.status=='已退款'){ + return 'gray'; + } const item=list.value.find(v=>props.status.includes(v.name)) return item?item.class:'' }) @@ -62,5 +65,10 @@ import { computed } from 'vue' color: #FF1C1C; background: rgba(255, 28, 28, 0.18); } + &.gray{ + color: #bbb; + background-color: #f7f7f7; + border-color: #bbb; + } } \ No newline at end of file diff --git a/groupBuying/confirm-order/confirm-order.vue b/groupBuying/confirm-order/confirm-order.vue index 10a1a2c..36d3c62 100644 --- a/groupBuying/confirm-order/confirm-order.vue +++ b/groupBuying/confirm-order/confirm-order.vue @@ -12,8 +12,7 @@ - {{item.wareJson - .wareName}} + {{item.wareName}} ¥ diff --git a/groupBuying/detail/index.vue b/groupBuying/detail/index.vue index dc7717a..89ca670 100644 --- a/groupBuying/detail/index.vue +++ b/groupBuying/detail/index.vue @@ -1,7 +1,7 @@ + \ No newline at end of file diff --git a/stores/user.js b/stores/user.js index 2070508..13ba86a 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('res',res); if (res) { this.token = res.token; this.miniAppOpenId = res.userInfo @@ -95,6 +96,8 @@ export const Storelogin = defineStore("login", { }, }); // #endif + + resolve(true) }); }, }, diff --git a/userPackage/goodsDetail/goodsDetail.vue b/userPackage/goodsDetail/goodsDetail.vue new file mode 100644 index 0000000..fa39e67 --- /dev/null +++ b/userPackage/goodsDetail/goodsDetail.vue @@ -0,0 +1,877 @@ + + + + \ No newline at end of file diff --git a/userPackage/index/index.vue b/userPackage/index/index.vue index 73d454b..8196e2d 100644 --- a/userPackage/index/index.vue +++ b/userPackage/index/index.vue @@ -39,23 +39,20 @@ - 阶梯优惠 + 阶梯优惠 - - 这里是商品名称啊啊嗷嗷啊啊 - - + + {{item.packageName}} + + {{item.description}} - - - - 拼团到手 - ¥{{item.groupPrice}} - - - 原价 - ¥{{item.originalPrice}} - + 已售{{item.saleNum||0}} + + + 最低到手 + ¥{{item.price}} + ¥{{item.originPrice}} + @@ -146,6 +143,10 @@ watch } from 'vue' + import { + APIusershopInfodetail + } from '@/common/api/member.js' + const canRefundStatus = ['待成团', '待核销'] function canRefund(item) { @@ -168,7 +169,7 @@ bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/dd298d6a503d432f832f3c7c2bb7fb0e.png', bg1: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/604c3f917daa41af9239145196c6d3f3.png', map: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/0a293f6e1a6a4e7b956379a5b6701104.png', - pin: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/4bcce5bdfa074f2a838a0209fac24241.png' + pin: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/8eaf3bdd44ce422889e5feeb30bcb2ea.png' } const shopInfo = ref(uni.cache.get('shopInfo')) @@ -245,7 +246,7 @@ size, shopId } = query - Api.record({ + Api.order({ page, size, shopId, @@ -275,23 +276,22 @@ function toDetail(item) { uni.navigateTo({ - url: '/groupBuying/goodsDetail/goodsDetail?wareId=' + item.id + '&shopId=' + item.shopId + url: '/userPackage/goodsDetail/goodsDetail?id=' + item.id + '&shopId=' + item.shopId }) } function toOrderDetail(item) { uni.navigateTo({ - url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId + url: '/userPackage/detail/index?detailId=' + item.id + '&shopId=' + item.shopId }) } function returnCoverImg(item) { - if (!item.wareImgs) { + if (!item.images) { return '' } - const arr = item.wareImgs.split(',') - return arr[0] + return item.images[0] } function refresh() { @@ -393,6 +393,17 @@ query, }) }) + + onLoad(() => { + APIusershopInfodetail({ + shopId: uni.cache.get('shopId') + }).then(res => { + console.log(res); + shopInfo.value = res.shopInfo + uni.cache.set('shopInfo', res.shopInfo) + }) + }) + onShow(getData) @@ -477,10 +488,11 @@ .img-box { position: relative; + .tag { position: absolute; - left:0; - top:0; + left: 0; + top: 0; padding: 8rpx 18rpx; border-radius: 16rpx 0; background: #4C2828; @@ -488,11 +500,20 @@ font-size: 700; } } - .name{ - font-size: 32rpx;font-weight: 700; color: #333333; + + .name { + font-size: 32rpx; + font-weight: 700; + color: #333333; } - .desc{ - + + .desc { + color: #666; + } + + .sale-number { + margin-top: 16rpx; + color: #999; } .numbers { @@ -520,19 +541,22 @@ } .info { - background-image: url(https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/604c3f917daa41af9239145196c6d3f3.png); - width: 410rpx; - height: 102rpx; + background: linear-gradient(270deg, #FFF7F4 44.8%, #ffffff00 89.37%); + width: 452rpx; + height: 92rpx; + border-radius: 12rpx; background-size: cover; transform: translateY(-10rpx); display: flex; .left { width: 306rpx; - color: #fff; padding: 16rpx 22rpx; + color: #eb532a; + } + .old-price{ + text-decoration: line-through; } - .right { padding-left: 16rpx; margin-top: 30rpx; diff --git a/userPackage/order/detail.vue b/userPackage/order/detail.vue new file mode 100644 index 0000000..7cfba96 --- /dev/null +++ b/userPackage/order/detail.vue @@ -0,0 +1,770 @@ + + + + + \ 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 @@ + + + + +