商品弹窗代码修改

This commit is contained in:
2025-12-25 09:29:09 +08:00
parent cf562b28b0
commit f75f90d34f
4 changed files with 27 additions and 17 deletions

View File

@@ -1,5 +1,3 @@
export default async (params) => { export default async (params) => {
let url = params.url; let url = params.url;
let method = params.method || "get"; let method = params.method || "get";
@@ -9,7 +7,7 @@ export default async (params) => {
let token = uni.cache.get("token") || ""; let token = uni.cache.get("token") || "";
const shopId = uni.cache.get("shopId") * 1; const shopId = uni.cache.get("shopId") * 1;
const userInfo = uni.cache.get("userInfo") || {}; const userInfo = uni.cache.get("userInfo") || {};
let header = { let header = {
version: uni.conf.version, version: uni.conf.version,
type: uni.getSystemInfoSync().platform, type: uni.getSystemInfoSync().platform,
@@ -48,7 +46,7 @@ export default async (params) => {
"id": "36434", "id": "36434",
"idCard": "612401199810058031", "idCard": "612401199810058031",
"isAc": 0, "isAc": 0,
"lastLoginTime": "2025-12-24 14:30:51", "lastLoginTime": "2025-12-25 09:19:20",
"nickName": "微信用户", "nickName": "微信用户",
"password": "", "password": "",
"payPwd": "e10adc3949ba59abbe56e057f20f883e", "payPwd": "e10adc3949ba59abbe56e057f20f883e",
@@ -56,7 +54,7 @@ export default async (params) => {
"realName": "叶明飞", "realName": "叶明飞",
"sex": 1, "sex": 1,
"status": 1, "status": 1,
"updateTime": "2025-12-24 14:29:51", "updateTime": "2025-12-25 09:17:59",
"usePayPwd": 0, "usePayPwd": 0,
"wechatAcOpenId": "1111", "wechatAcOpenId": "1111",
"wechatAcQrcode": "", "wechatAcQrcode": "",

View File

@@ -23,7 +23,7 @@ function init() {
// #ifdef H5 // #ifdef H5
if (debug) { if (debug) {
baseUrl = "/api"; baseUrl = "/testApi";
baseUrlwws = "http://192.168.1.42:2348"; baseUrlwws = "http://192.168.1.42:2348";
} else { } else {
baseUrl = "/prodApi"; baseUrl = "/prodApi";
@@ -48,7 +48,7 @@ export const changeEnv = (env) => {
let baseUrl = "http://192.168.1.42" let baseUrl = "http://192.168.1.42"
let baseUrlwws = "ws://192.168.1.42:2348" let baseUrlwws = "ws://192.168.1.42:2348"
// #ifdef H5 // #ifdef H5
baseUrl = "/api" baseUrl = "/testApi"
baseUrlwws = "http://192.168.1.42:2348" baseUrlwws = "http://192.168.1.42:2348"
// #endif // #endif
uni.conf = { uni.conf = {

View File

@@ -186,6 +186,10 @@
APIminiAppskuinfo, APIminiAppskuinfo,
productRelated productRelated
} from '@/common/api/product/product.js'; } from '@/common/api/product/product.js';
//价格计算辅助函数
import {
limitUtils
} from 'ysk-utils';
import GoodsPrice from '@/components/goods-price.vue'; import GoodsPrice from '@/components/goods-price.vue';
import { import {
computed, computed,
@@ -292,7 +296,7 @@
swiperCurrent.value = e.current; swiperCurrent.value = e.current;
} }
const emits = defineEmits(['prveImgs']) const emits = defineEmits(['prveImgs', 'websocketsendMessage'])
function prveImgs(images, currentUrl) { function prveImgs(images, currentUrl) {
emits('prveImgs', images, currentUrl) emits('prveImgs', images, currentUrl)
@@ -353,8 +357,8 @@
}; };
// 提交选择并执行下一步操作的方法 // 提交选择并执行下一步操作的方法
const submitSelection = async () => { const submitSelection = async () => {
if (!isProductAvailable(props.goods.productListitem.days, props.goods.productListitem.startTime, if (!isProductAvailable(props.goods.days, props.goods.startTime,
props.goods.productListitem.endTime)) { props.goods.endTime)) {
uni.showToast({ uni.showToast({
title: '不在可售时间内' title: '不在可售时间内'
}); });
@@ -377,7 +381,7 @@
selectedGroupSnap.value = []; selectedGroupSnap.value = [];
} }
console.log('props.goods', props.goods); console.log('props.goods', props.goods);
websocketsendMessage({ emits('websocketsendMessage', {
id: res ? res.cartListId : '', id: res ? res.cartListId : '',
type: 'shopping', type: 'shopping',
suitNum: props.goods.productListitem.suitNum, suitNum: props.goods.productListitem.suitNum,
@@ -394,12 +398,13 @@
is_print: 1, is_print: 1,
product_type: props.goods.type, product_type: props.goods.type,
is_time_discount: showLimitDiscount(props.goods) is_time_discount: showLimitDiscount(props.goods)
}); })
// 清空套餐选中 // 清空套餐选中
selectedGroupSnap.value = []; selectedGroupSnap.value = [];
showShopsku.value = false; showShopsku.value = false;
} else { } else {
websocketsendMessage({
emits('websocketsendMessage', {
id: res ? res.cartListId : '', id: res ? res.cartListId : '',
type: 'shopping', type: 'shopping',
suitNum: props.goods.productListitem.suitNum, suitNum: props.goods.productListitem.suitNum,
@@ -414,14 +419,21 @@
is_print: 1, is_print: 1,
product_type: props.goods.type, product_type: props.goods.type,
is_time_discount: showLimitDiscount(props.goods) is_time_discount: showLimitDiscount(props.goods)
}); })
showShopsku.value = false; showShopsku.value = false;
return; 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) => { const shopCart = async (i) => {

View File

@@ -33,11 +33,11 @@ module.exports = defineConfig({
], ],
server: { server: {
proxy: { proxy: {
'/api': { '/testApi': {
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址 // target: 'https://cashier.sxczgkj.com', // 目标服务器地址
target: 'http://192.168.1.42/', // 目标服务器地址 target: 'http://192.168.1.42/', // 目标服务器地址
changeOrigin: true, // 是否更改请求源 changeOrigin: true, // 是否更改请求源
rewrite: path => path.replace(/^\/api/, '') rewrite: path => path.replace(/^\/testApi/, '')
}, },
'/prodApi': { '/prodApi': {
target: 'https://cashier.sxczgkj.com', // 目标服务器地址 target: 'https://cashier.sxczgkj.com', // 目标服务器地址