diff --git a/common/api/request.js b/common/api/request.js index 651682b..f8881c2 100644 --- a/common/api/request.js +++ b/common/api/request.js @@ -1,5 +1,3 @@ - - export default async (params) => { let url = params.url; let method = params.method || "get"; @@ -9,7 +7,7 @@ export default async (params) => { let token = uni.cache.get("token") || ""; const shopId = uni.cache.get("shopId") * 1; const userInfo = uni.cache.get("userInfo") || {}; - + let header = { version: uni.conf.version, type: uni.getSystemInfoSync().platform, @@ -48,7 +46,7 @@ export default async (params) => { "id": "36434", "idCard": "612401199810058031", "isAc": 0, - "lastLoginTime": "2025-12-24 14:30:51", + "lastLoginTime": "2025-12-25 09:19:20", "nickName": "微信用户", "password": "", "payPwd": "e10adc3949ba59abbe56e057f20f883e", @@ -56,7 +54,7 @@ export default async (params) => { "realName": "叶明飞", "sex": 1, "status": 1, - "updateTime": "2025-12-24 14:29:51", + "updateTime": "2025-12-25 09:17:59", "usePayPwd": 0, "wechatAcOpenId": "1111", "wechatAcQrcode": "", diff --git a/common/config.js b/common/config.js index 177b59b..d36e877 100644 --- a/common/config.js +++ b/common/config.js @@ -23,7 +23,7 @@ function init() { // #ifdef H5 if (debug) { - baseUrl = "/api"; + baseUrl = "/testApi"; baseUrlwws = "http://192.168.1.42:2348"; } else { baseUrl = "/prodApi"; @@ -48,7 +48,7 @@ export const changeEnv = (env) => { let baseUrl = "http://192.168.1.42" let baseUrlwws = "ws://192.168.1.42:2348" // #ifdef H5 - baseUrl = "/api" + baseUrl = "/testApi" baseUrlwws = "http://192.168.1.42:2348" // #endif uni.conf = { diff --git a/pages/product/components/goods-modal.vue b/pages/product/components/goods-modal.vue index 22417aa..6d4f0ef 100644 --- a/pages/product/components/goods-modal.vue +++ b/pages/product/components/goods-modal.vue @@ -186,6 +186,10 @@ APIminiAppskuinfo, productRelated } from '@/common/api/product/product.js'; + //价格计算辅助函数 + import { + limitUtils + } from 'ysk-utils'; import GoodsPrice from '@/components/goods-price.vue'; import { computed, @@ -292,7 +296,7 @@ swiperCurrent.value = e.current; } - const emits = defineEmits(['prveImgs']) + const emits = defineEmits(['prveImgs', 'websocketsendMessage']) function prveImgs(images, currentUrl) { emits('prveImgs', images, currentUrl) @@ -353,8 +357,8 @@ }; // 提交选择并执行下一步操作的方法 const submitSelection = async () => { - if (!isProductAvailable(props.goods.productListitem.days, props.goods.productListitem.startTime, - props.goods.productListitem.endTime)) { + if (!isProductAvailable(props.goods.days, props.goods.startTime, + props.goods.endTime)) { uni.showToast({ title: '不在可售时间内' }); @@ -377,7 +381,7 @@ selectedGroupSnap.value = []; } console.log('props.goods', props.goods); - websocketsendMessage({ + emits('websocketsendMessage', { id: res ? res.cartListId : '', type: 'shopping', suitNum: props.goods.productListitem.suitNum, @@ -394,12 +398,13 @@ is_print: 1, product_type: props.goods.type, is_time_discount: showLimitDiscount(props.goods) - }); + }) // 清空套餐选中 selectedGroupSnap.value = []; showShopsku.value = false; } else { - websocketsendMessage({ + + emits('websocketsendMessage', { id: res ? res.cartListId : '', type: 'shopping', suitNum: props.goods.productListitem.suitNum, @@ -414,14 +419,21 @@ is_print: 1, product_type: props.goods.type, is_time_discount: showLimitDiscount(props.goods) - }); + }) + showShopsku.value = false; return; } }; - + function showLimitDiscount(item) { + if (!cartStore.limitTimeDiscount || !cartStore.limitTimeDiscount.id) { + return 0; + } + return limitUtils.canUseLimitTimeDiscount(item, cartStore.limitTimeDiscount, shopInfo, shopUserInfo.value, 'id') ? + 1 : 0; + } // 多规格 套餐 单规格添加数量 const shopCart = async (i) => { diff --git a/vite.config.js b/vite.config.js index d52247b..b43d49c 100644 --- a/vite.config.js +++ b/vite.config.js @@ -33,11 +33,11 @@ module.exports = defineConfig({ ], server: { proxy: { - '/api': { + '/testApi': { // target: 'https://cashier.sxczgkj.com', // 目标服务器地址 target: 'http://192.168.1.42/', // 目标服务器地址 changeOrigin: true, // 是否更改请求源 - rewrite: path => path.replace(/^\/api/, '') + rewrite: path => path.replace(/^\/testApi/, '') }, '/prodApi': { target: 'https://cashier.sxczgkj.com', // 目标服务器地址