diff --git a/api/shop.js b/api/shop.js index 5d4a97c9..e39a092d 100644 --- a/api/shop.js +++ b/api/shop.js @@ -17,5 +17,5 @@ export const apiArr = { queryOrder: '/api/v2/wechat/commodity/order/trade_query', // 查询订单 getComment: '/api/v2/wechat/commodity/review/list', // 获取评论 - mergePreorder: '/api/v2/wechat/commodity/order/merge_preorder', // 商品订单合并预下单 + mergePreorder: '/api/v2/wechat/commodity/order/preorder', // 商品订单合并预下单 } \ No newline at end of file diff --git a/packages/health/express/express.vue b/packages/health/express/express.vue deleted file mode 100644 index 757a5ef5..00000000 --- a/packages/health/express/express.vue +++ /dev/null @@ -1,667 +0,0 @@ - - - - - \ No newline at end of file diff --git a/packages/health/index/index.vue b/packages/health/index/index.vue deleted file mode 100644 index fd576ae4..00000000 --- a/packages/health/index/index.vue +++ /dev/null @@ -1,611 +0,0 @@ - - - - - \ No newline at end of file diff --git a/packages/health/reportDesc/reportDesc.vue b/packages/health/reportDesc/reportDesc.vue deleted file mode 100644 index c90b4312..00000000 --- a/packages/health/reportDesc/reportDesc.vue +++ /dev/null @@ -1,203 +0,0 @@ - - - - - \ No newline at end of file diff --git a/packages/health/reportList/reportList.vue b/packages/health/reportList/reportList.vue deleted file mode 100644 index 91c07691..00000000 --- a/packages/health/reportList/reportList.vue +++ /dev/null @@ -1,159 +0,0 @@ - - - - - \ No newline at end of file diff --git a/packages/health/selfTest/selfTest.vue b/packages/health/selfTest/selfTest.vue deleted file mode 100644 index 1d4edc9b..00000000 --- a/packages/health/selfTest/selfTest.vue +++ /dev/null @@ -1,204 +0,0 @@ - - - - - \ No newline at end of file diff --git a/packages/shop/groupPurchase/index.css b/packages/shop/groupPurchase/index.css index adca133c..e9f2bf7e 100644 --- a/packages/shop/groupPurchase/index.css +++ b/packages/shop/groupPurchase/index.css @@ -53,6 +53,8 @@ padding: 30rpx 20rpx; margin-top: -50rpx; border-radius: 50rpx 50rpx 0 0; + height: 60vh; + overflow-y: auto; } .goods-item { @@ -204,7 +206,7 @@ height: 140rpx; position: fixed; right: 33rpx; - bottom: 180rpx; + bottom: 80rpx; z-index: 10; } diff --git a/packages/shop/groupPurchase/index.vue b/packages/shop/groupPurchase/index.vue index 2527f10b..733b3b42 100644 --- a/packages/shop/groupPurchase/index.vue +++ b/packages/shop/groupPurchase/index.vue @@ -219,8 +219,21 @@ export default { if (this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity == 0) { this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity += this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].min_order_quantity this.carNum += this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].min_order_quantity - } else { + if (this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity == this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].total_stock) { + uni.showToast({ + title: '库存不足', + icon: 'none' + }); + return + } + if (this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity == this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].max_limit_quantity) { + uni.showToast({ + title: '一次最多购买' + this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].max_limit_quantity + '件', + icon: 'none' + }); + return + } this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity++; this.carNum++; } @@ -238,10 +251,10 @@ export default { // 减少货品数量 decreaseQuantity(goodsIndex, skuIndex) { if (this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity > 0) { - if(this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity == this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].min_order_quantity){ + if (this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity == this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].min_order_quantity) { this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity = 0 this.carNum = 0 - }else{ + } else { this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity--; this.carNum--; } diff --git a/packages/shop/groupPurchaseDetail/index.css b/packages/shop/groupPurchaseDetail/index.css index cb633889..d1388ecc 100644 --- a/packages/shop/groupPurchaseDetail/index.css +++ b/packages/shop/groupPurchaseDetail/index.css @@ -333,6 +333,14 @@ image { padding-bottom: 10rpx; } +.num{ + color: #808080; + font-size: 24rpx; + position: absolute; + right: 30rpx; + font-weight: 400; +} + .oldMoney { font-size: 40rpx; color: #C7C7C7; @@ -565,7 +573,7 @@ image { } .shadowBox1 { - height: 250rpx; + height: 300rpx; width: 100%; background-color: #fff; position: absolute; @@ -584,6 +592,17 @@ image { color: #000000; } +.shadowBox1Item_btn { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border: none; + background-color: #ffffff; +} + .shadowBox1Item image { width: 100rpx; height: 100rpx; diff --git a/packages/shop/groupPurchaseDetail/index.vue b/packages/shop/groupPurchaseDetail/index.vue index b3ac1fb0..78da38c5 100644 --- a/packages/shop/groupPurchaseDetail/index.vue +++ b/packages/shop/groupPurchaseDetail/index.vue @@ -49,19 +49,6 @@ {{ endTheCountdownSecond }} - - @@ -70,6 +57,7 @@ {{ currentGG.group_buy_price }} /{{ currentGG.goods_unit }} + 已售{{ soldOutNum }} | 剩余{{ currentGG.total_stock }} @@ -197,14 +185,18 @@ - - 微信好友 + - - 生成海报 + @@ -345,30 +337,8 @@ export default { carOrderList: [], // 新增评论数据 showReviewPopup: false, - // comments: [ - // { - // avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", - // username: "TP", - // product: "库尔勒香梨 10kg/箱", - // content: - // "踏入这家位于街角的餐厅,木质门框与暖黄灯光交织出温馨氛围,墙面上手绘的食材插画画透着文艺气息,开放式厨房的设计让食客能看见厨师处理食材的全过程,第一印象便给人以干净与安心。", - // images: ["https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png"], - // time: "2025-03-01 11:24:20", - // }, - // { - // avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", - // username: "TP", - // product: "库尔勒香梨 10kg/箱", - // content: - // "踏入这家位于街角的餐厅,木质门框与暖黄灯光交织出温馨氛围,墙面上手绘的食材插_draw着文艺气息,开放式厨房的设计让食客能看见厨师处理食材的全过程,第一印象便给人以干净与安心。", - // images: [ - // "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", - // "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", - // "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", - // ], - // time: "2025-03-01 11:24:20", - // }, - // ], + soldOutNum: 0, + show: false, showSize: false, showPurchase: false, @@ -419,31 +389,139 @@ export default { delta: 1, }); }, - // 分享微信 + // 分享给微信好友方法 - 触发分享给好友的聊天框 shareFriend() { - this.boxshadow2 = false; - return; - // uniapp 分享微信好友 - uni.share({ - provider: "weixin", - type: "link", - scene: "session", - link: "https://uniapp.dcloud.net.cn/", - title: "商品名称", - imageUrl: "", - success: (res) => { - uni.showToast({ - title: "分享成功", - icon: "success", - duration: 2000, + this.boxshadow1 = false; // 关闭分享弹窗 + + // 获取当前商品的分享信息 + const shareInfo = { + title: this.currentGG.goods_name || '商品分享', // 分享标题 + desc: this.currentGG.commodity_brief || '快来看看这款商品吧', // 分享描述 + link: `${window.location.origin}/pages/goodsDetail/index?id=${this.id}`, // 商品详情页链接 + imageUrl: this.picUrl + (this.currentGG.goods_carousel && this.currentGG.goods_carousel[0] || '') // 分享图片 + }; + + // 判断环境是否支持微信分享 + if (typeof WeixinJSBridge === 'undefined') { + // 尝试使用uni的分享API作为备选方案 + if (typeof uni.share !== 'undefined') { + uni.share({ + provider: 'weixin', + scene: 'WXSceneSession', + type: 0, + title: shareInfo.title, + summary: shareInfo.desc, + href: shareInfo.link, + imageUrl: shareInfo.imageUrl, + success: () => { + uni.showToast({ + title: '分享成功', + icon: 'success', + duration: 2000 + }); + }, + fail: (err) => { + console.error('分享失败', err); + uni.showToast({ + title: '分享失败,请重试', + icon: 'none', + duration: 2000 + }); + } }); - this.boxshadow1 = false; - }, - fail: (err) => { - console.log("分享失败", err); - this.boxshadow1 = false; - }, - }); + } else { + uni.showToast({ + title: '请在微信客户端打开', + icon: 'none' + }); + } + return; + } + + try { + // 主动触发微信分享给好友聊天框 + WeixinJSBridge.invoke('sendAppMessage', { + title: shareInfo.title, + desc: shareInfo.desc, + link: shareInfo.link, + img_url: shareInfo.imageUrl, + img_width: '120', + img_height: '120', + type: 'link', + data_url: '' + }, (res) => { + if (res.err_msg === 'sendAppMessage:ok') { + uni.showToast({ + title: '分享成功', + icon: 'success', + duration: 2000 + }); + } else if (res.err_msg === 'sendAppMessage:cancel') { + uni.showToast({ + title: '已取消分享', + icon: 'none', + duration: 2000 + }); + } else { + console.error('分享失败', res); + uni.showToast({ + title: '分享失败,请重试', + icon: 'none', + duration: 2000 + }); + } + }); + } catch (error) { + console.error('调用微信分享接口失败', error); + // 降级处理:使用wx.ready方式作为备选 + if (typeof wx !== 'undefined') { + wx.ready(() => { + // 设置分享给微信好友的回调 + wx.onMenuShareAppMessage({ + title: shareInfo.title, + desc: shareInfo.desc, + link: shareInfo.link, + imgUrl: shareInfo.imageUrl, + type: 'link', + success: () => { + uni.showToast({ + title: '分享成功', + icon: 'success', + duration: 2000 + }); + }, + cancel: () => { + uni.showToast({ + title: '已取消分享', + icon: 'none', + duration: 2000 + }); + }, + fail: (err) => { + console.error('分享失败', err); + uni.showToast({ + title: '分享失败,请重试', + icon: 'none', + duration: 2000 + }); + } + }); + // 提示用户点击右上角分享 + uni.showToast({ + title: '请点击右上角分享按钮', + icon: 'none' + }); + }); + + wx.error((err) => { + console.error('微信JS-SDK初始化失败', err); + uni.showToast({ + title: '分享功能加载失败', + icon: 'none' + }); + }); + } + } }, changeShadow() { this.boxshadow1 = false; @@ -689,6 +767,8 @@ export default { }) this.purchaseRecords = record this.totalCount = res.total_count + // 计算所有item.count的总和并赋值给soldOutNum + this.soldOutNum = record.reduce((total, item) => total + (item.count || 0), 0) }) }, formatDate(dateStr) { diff --git a/packages/shop/groupPurchaseSubmit/index.vue b/packages/shop/groupPurchaseSubmit/index.vue index 24d78299..24ffd787 100644 --- a/packages/shop/groupPurchaseSubmit/index.vue +++ b/packages/shop/groupPurchaseSubmit/index.vue @@ -43,7 +43,7 @@ ¥{{ item.commodity_goods_info.sales_price }}/{{ item.commodity_goods_info.goods_unit - }} + }} 运费 ¥{{ item.commodity_goods_info.freight }} @@ -365,30 +365,39 @@ export default { }, decreaseQuantity(item) { if (item.count > 0) { - item.count-- + if (item.count == item.commodity_goods_info.min_order_quantity) { + uni.showToast({ + title: '最少购买' + item.commodity_goods_info.min_order_quantity + '件', + icon: 'none' + }); + item.count = 0 + } else { + item.count-- + } this.changeCart(item) } }, increaseQuantity(item) { - if (item.commodity_goods_info.total_stock > 0) { - if (item.count < item.commodity_goods_info.total_stock) { - item.count++; - this.changeCart(item); - } else { + if (item.count == 0) { + item.count += item.commodity_goods_info.min_order_quantity + } else { + if (item.count == item.commodity_goods_info.total_stock) { uni.showToast({ title: '库存不足', icon: 'none' }); + return + } + if (item.count == item.commodity_goods_info.max_limit_quantity) { + uni.showToast({ + title: '一次最多购买' + item.commodity_goods_info.max_limit_quantity + '件', + icon: 'none' + }); + return } - } else if (item.count < item.commodity_goods_info.stock_quantity) { - item.count++; - this.changeCart(item); - } else { - uni.showToast({ - title: '库存不足', - icon: 'none' - }); } + item.count++; + this.changeCart(item); }, // 更改购物车 changeCart(item) { @@ -469,32 +478,34 @@ export default { request(apiArr.createOrder, "POST", params).then(res => { + console.log("🚀 ~ submitPayment ~ 创建订单接口...") // 根据平台设置不同的trans_type值 // 小程序: 71, App: 51 const systemInfo = uni.getSystemInfoSync(); let trans_type = 51; // 默认App环境 - + // 运行时判断是否为小程序环境 if (systemInfo.platform === 'devtools' || systemInfo.platform === 'unknown') { trans_type = 71; // 开发工具或未知环境默认为小程序 } - + // 条件编译:针对不同平台设置不同值 // #ifdef MP trans_type = 71; // 所有小程序平台 // #endif - + // #ifdef APP-PLUS trans_type = 51; // App平台 // #endif - + const param = { order_id: res.order_id, user_id: uni.getStorageSync('userId'), trans_type: trans_type } request(apiArr.mergePreorder, "POST", param).then(res => { - + console.log("🚀 ~ submitPayment ~ 调起微信支付...") + if (res && res.timeStamp && res.nonceStr && res.package && res.signType && res.paySign) { // 调用微信支付 uni.requestPayment({ diff --git a/packages/shop/shopCar/index.css b/packages/shop/shopCar/index.css index 952bf76c..604fe834 100644 --- a/packages/shop/shopCar/index.css +++ b/packages/shop/shopCar/index.css @@ -62,8 +62,8 @@ } .empty image { - width: 340rpx; - height: 253.51rpx; + width: 500rpx; + height: 500rpx; } .empty div { diff --git a/packages/shop/shopCar/index.vue b/packages/shop/shopCar/index.vue index 0ac93af3..0b8d0dcb 100644 --- a/packages/shop/shopCar/index.vue +++ b/packages/shop/shopCar/index.vue @@ -11,8 +11,10 @@ - - + + + + @@ -75,7 +77,8 @@ - + - + - - - - 啥也没有
- 赶紧去shopping吧~ -
-
+
@@ -488,38 +486,65 @@ export default { }, // 减少数量 - minus(carItem, goodsIndex) { + minus(carItem, goodsIndex, item) { let that = this; - const item = carItem.commodity_cart_and_goods_model; - if (carItem.count === 1) { - request(apiArr.deleteCar, "POST", { - ids: [item.id], - }).then((res) => { - carItem.commodity_cart_and_goods_model.splice(goodsIndex, 1); - // 如果商家没有商品了,移除该商家 - if (carItem.commodity_cart_and_goods_model.length === 0) { - const carIndex = this.shopCarList.indexOf(carItem); - if (carIndex !== -1) { - this.shopCarList.splice(carIndex, 1); + if (carItem.count > 0) { + if (carItem.count == carItem.commodity_goods_info.min_order_quantity) { + uni.showToast({ + title: '最少购买' + carItem.commodity_goods_info.min_order_quantity + '件', + icon: 'none' + }); + request(apiArr.deleteCar, "POST", { + ids: [carItem.id], + }).then((res) => { + item.splice(goodsIndex, 1); + // 如果商家没有商品了,移除该商家 + if (item.length === 0) { + const carIndex = this.shopCarList.indexOf(carItem); + if (carIndex == -1) { + this.shopCarList.splice(carIndex, 1); + } } - } - that.calcTotal(); - that.shopCarTotal = that.shopCarTotal - 1; - }); - } else { - this.shopCarTotal = this.shopCarTotal - 1; - carItem.count = carItem.count - 1; - this.handleQuantityChange(carItem.count, carItem); + that.calcTotal(); + that.shopCarTotal = that.shopCarTotal - 1; + }); + carItem.count = 0 + that.shopCarTotal = that.shopCarTotal - carItem.commodity_goods_info.min_order_quantity; + } else { + this.shopCarTotal = this.shopCarTotal - 1; + carItem.count = carItem.count - 1; + this.handleQuantityChange(carItem.count, carItem); + } this.calcTotal(); } }, // 添加数量 add(carItem, goodsIndex) { + if (carItem.count == 0) { + carItem.count = carItem.commodity_goods_info.min_order_quantity + this.shopCarTotal += carItem.commodity_goods_info.min_order_quantity; + } else { + if (carItem.count == carItem.commodity_goods_info.total_stock) { + uni.showToast({ + title: '库存不足', + icon: 'none' + }); + return + } + if (carItem.count == carItem.commodity_goods_info.max_limit_quantity) { + uni.showToast({ + title: '一次最多购买' + carItem.commodity_goods_info.max_limit_quantity + '件', + icon: 'none' + }); + return + } + carItem.count++; + this.shopCarTotal++; + } + const item = carItem.commodity_cart_and_goods_model; - this.shopCarTotal = this.shopCarTotal + 1; - carItem.count = carItem.count + 1; this.handleQuantityChange(carItem.count, carItem); this.calcTotal(); }, @@ -585,7 +610,6 @@ export default { }, //商品数量变化 handleQuantityChange(val, item) { - const params = { user_id: uni.getStorageSync("userId"), goods_id_and_count: [{ @@ -599,6 +623,7 @@ export default { title: "操作成功!", success() { }, }); + return Promise.resolve(); }); }, }, diff --git a/packages/shopEnter/index/index.vue b/packages/shopEnter/index/index.vue index 30f01d0c..2a54f9bc 100644 --- a/packages/shopEnter/index/index.vue +++ b/packages/shopEnter/index/index.vue @@ -1,90 +1,108 @@ \ No newline at end of file diff --git a/uni_modules/car-number-input/changelog.md b/uni_modules/car-number-input/changelog.md new file mode 100644 index 00000000..15131ca3 --- /dev/null +++ b/uni_modules/car-number-input/changelog.md @@ -0,0 +1,9 @@ +## 1.0.4(2022-10-13) +修复支付宝小程序图标显示问题 +## 1.0.3(2022-10-08) +修复图标显示问题,图片改用base64编码 +## 1.0.2(2022-09-21) +修复微信小程序新能源图标显示问题 +## 1.0.1(2022-09-19) +1.修复输入返回值赋值给默认值的问题 +2.修复新能源字体在谷歌浏览器展示问题 diff --git a/uni_modules/car-number-input/components/car-number-input/car-number-input.vue b/uni_modules/car-number-input/components/car-number-input/car-number-input.vue new file mode 100644 index 00000000..342d56a2 --- /dev/null +++ b/uni_modules/car-number-input/components/car-number-input/car-number-input.vue @@ -0,0 +1,315 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/car-number-input/package.json b/uni_modules/car-number-input/package.json new file mode 100644 index 00000000..d1745803 --- /dev/null +++ b/uni_modules/car-number-input/package.json @@ -0,0 +1,26 @@ +{ + "id": "car-number-input", + "displayName": "车牌选择组件+键盘(包含新能源车牌)", + "version": "1.0.4", + "description": "车牌输入组件+键盘,包含新能源车牌", + "keywords": [ + "车牌", + "车牌选择器", + "键盘", + "车牌键盘", + "车牌选择" + ], + "dcloudext": { + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "", + "type": "component-vue" + }, + "repository": "" +} \ No newline at end of file