修复再来一单问题

This commit is contained in:
2025-12-16 17:00:32 +08:00
parent 251490e3ab
commit 645122c182
9 changed files with 170 additions and 84 deletions

View File

@@ -21,36 +21,42 @@ const baseUrlwws = debug ? proxyApiwws : "wss://czgeatws.sxczgkj.com/wss"; //
const version = "100"; const version = "100";
const autoRemoveCache = { const autoRemoveCache = {
count: 100000, count: 100000,
size: 100000, size: 100000,
}; };
uni.conf = { uni.conf = {
debug, debug,
baseUrl, baseUrl,
version, version,
autoRemoveCache, autoRemoveCache,
baseUrlwws, baseUrlwws,
}; };
console.log('uni.conf',uni.conf)
export const changeEnv = (env) => { export const changeEnv = (env) => {
if (env === "test") { if (env === "test") {
uni.conf = { let baseUrl = "http://192.168.1.42"
debug: true, // #ifdef H5
baseUrl: "http://192.168.1.42", baseUrl = "/api"
phpUrl:'http://192.168.1.42:8787/api/', // #endif
phpChatWx:'ws://192.168.1.42:2348', uni.conf = {
version: 100, debug: true,
autoRemoveCache, baseUrl,
baseUrlwws: "ws://192.168.1.42:2348", phpUrl: 'http://192.168.1.42:8787/api/',
}; phpChatWx: 'ws://192.168.1.42:2348',
} version: 100,
if (env === "prod") { autoRemoveCache,
uni.conf = { baseUrlwws: "ws://192.168.1.42:2348",
debug: false, };
baseUrl: "https://cashier.sxczgkj.com", }
version: 100, if (env === "prod") {
autoRemoveCache, uni.conf = {
baseUrlwws: "wss://czgeatws.sxczgkj.com/wss", debug: false,
}; baseUrl: "https://cashier.sxczgkj.com",
} version: 100,
}; autoRemoveCache,
baseUrlwws: "wss://czgeatws.sxczgkj.com/wss",
};
}
};

View File

@@ -21,7 +21,7 @@
<image class="icon" :src="item.url" mode="aspectFill" /> <image class="icon" :src="item.url" mode="aspectFill" />
<view class="method_list_top_cen"> <view class="method_list_top_cen">
<view class="name"> {{ item.name }} </view> <view class="name"> {{ item.name }} </view>
<view class="method_list_bom" v-if="item.type == 1"> <view class="method_list_bom" v-if="item.name == '余额支付'">
<text class="balance"> <text class="balance">
当前余额{{ orderVIP ? orderVIP.amount || 0 : 0 }}</text 当前余额{{ orderVIP ? orderVIP.amount || 0 : 0 }}</text
> >

View File

@@ -100,17 +100,61 @@ function close() {
function save() { function save() {
show.value = false; show.value = false;
// 保存图片到相册
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: code.value, filePath: code.value,
success: function () { success: function () {
uni.showToast({ uni.showToast({
title: "保存成功", title: "保存成功",
icon: 'none'
}); });
}, },
fail: function () { fail: function (err) {
uni.showToast({ console.log('保存失败原因:', err);
title: "保存失败", // 判断是否为授权拒绝(微信小程序授权拒绝的特征)
}); if (err.errMsg.includes('auth deny') || err.errMsg.includes('authorize fail')) {
// 弹出提示引导用户去设置页开启授权
uni.showModal({
title: '授权提示',
content: '保存图片需要授权访问相册,请前往设置开启授权',
showCancel: true,
cancelText: '取消',
confirmText: '去设置',
success: function (res) {
if (res.confirm) {
// 跳转到微信小程序的授权设置页
uni.openSetting({
success: function (settingRes) {
// 检查用户是否开启了相册授权
if (settingRes.authSetting['scope.writePhotosAlbum']) {
uni.showToast({
title: '授权成功,可重新保存',
icon: 'none'
});
} else {
uni.showToast({
title: '未开启授权,保存失败',
icon: 'none'
});
}
},
fail: function () {
uni.showToast({
title: '打开设置失败',
icon: 'none'
});
}
});
}
}
});
} else {
// 非授权问题的保存失败(如文件路径错误、系统问题等)
uni.showToast({
title: "保存失败",
icon: 'none'
});
}
}, },
}); });

View File

@@ -612,6 +612,9 @@ const showInviteCode = computed(() => {
) { ) {
return true; return true;
} }
if( config.openType == "auto" ){
return true;
}
if (!state.distributionUser && config.openType == "manual") { if (!state.distributionUser && config.openType == "manual") {
return true; return true;
} }

View File

@@ -760,6 +760,7 @@
usePoints.value = false; usePoints.value = false;
cartStore.setUserPoints(0); cartStore.setUserPoints(0);
} else { } else {
cartStore.fullReductionActivities = fullReductionActivities;
if (back_discountActivity) { if (back_discountActivity) {
calcDiscountActivity(); calcDiscountActivity();
} }
@@ -795,6 +796,9 @@
} }
console.log("当前满减门槛", discountActivity.value); console.log("当前满减门槛", discountActivity.value);
} }
let fullReductionActivities=[]
async function getDiscountActivity() { async function getDiscountActivity() {
const res = await discountActivityApi.config({ const res = await discountActivityApi.config({
shopId: uni.cache.get("shopId"), shopId: uni.cache.get("shopId"),
@@ -804,6 +808,7 @@
} }
discountActivityRes.value = res; discountActivityRes.value = res;
cartStore.fullReductionActivities = [res]; cartStore.fullReductionActivities = [res];
fullReductionActivities=[res];
calcDiscountActivity(); calcDiscountActivity();
} }

View File

@@ -85,7 +85,7 @@
<view class="footer-wrap"> <view class="footer-wrap">
<view class="btn" @click.stop="$u.debounce(isRemoveOrder(item,index),1000)" <view class="btn" @click.stop="$u.debounce(isRemoveOrder(item,index),1000)"
v-if="item.status == 'done' || item.status == 'cancelled'"> 删除订单 </view> v-if="item.status == 'done' || item.status == 'cancelled'"> 删除订单 </view>
<view class="btn s" @click.stop="$u.debounce(showpopupclick(item),1000)" <view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view> v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
<view class="btn s" @click.stop="agignOrder(item)" v-if="item.status == 'done'"> 再来一单 </view> <view class="btn s" @click.stop="agignOrder(item)" v-if="item.status == 'done'"> 再来一单 </view>

View File

@@ -1556,7 +1556,7 @@
} }
} }
let socketInitFinished = false let socketInitFinished = false
// 收到的消息变化 // 收到的消息变化
async function onMessage(Message) { async function onMessage(Message) {
@@ -1588,9 +1588,33 @@
} }
if (Message.operate_type == 'rottable_error') {
uni.showModal({
title: '提示',
content: Message.msg,
showCancel: true,
cancelText: '舍弃',
confirmText: '合并',
success(res) {
if (res.confirm) {
startUseTable({
is_hb: 2
})
} else {
startUseTable({
is_hb: 2,
give_up: 1
})
}
}
})
}
// 转桌成功 // 转桌成功
if (Message.operate_type == 'rottable' && Message.status == 1) { if (Message.operate_type == 'rottable') {
console.log('转桌成功了'); console.log('转桌成功了');
console.log(Message);
// uni.showToast({ // uni.showToast({
// title: '扫码成功,请下单', // title: '扫码成功,请下单',
@@ -1664,7 +1688,7 @@
} }
// 提示 // 提示
if (Message.status == 0 && Message.type != 'no_suit_num' && Message.type != 'time_discount') { if (Message.status == 0 && Message.type != 'no_suit_num' && Message.type != 'time_discount'&&Message.operate_type != 'rottable_error') {
uni.showToast({ uni.showToast({
title: Message.msg, title: Message.msg,
icon: 'none' icon: 'none'
@@ -2086,19 +2110,21 @@
} }
// 开始换桌 // 开始换桌
function startUseTable() { function startUseTable(par) {
tableShopInfo.value = uni.cache.get('shopInfo'); tableShopInfo.value = uni.cache.get('shopInfo');
const oldTableCode = uni.cache.get('tableCode'); const oldTableCode = uni.cache.get('tableCode');
const cartIds = cartStore.carts.map((item) => item.id); const cartIds = cartStore.carts.map((item) => item.id);
const data = { const data = {
is_hb: 1,
...par,
type: 'shopping', type: 'shopping',
operate_type: 'rottable', operate_type: 'rottable',
account: tableShopInfo.value.phone, account: tableShopInfo.value.phone,
table_code: oldTableCode, table_code: oldTableCode,
new_table_code: uni.cache.get('shopTable').tableCode, new_table_code: uni.cache.get('shopTable').tableCode,
cart_id: cartIds, cart_id: cartIds,
shop_id: tableShopInfo.value.id shop_id: tableShopInfo.value.id,
}; };
websocketsendMessage(data); websocketsendMessage(data);
@@ -2186,12 +2212,12 @@
const res = await APIhistoryOrder({ const res = await APIhistoryOrder({
tableCode: uni.cache.get('tableCode') tableCode: uni.cache.get('tableCode')
}); });
if(res&&res.id){ if (res && res.id) {
return uni.showModal({ return uni.showModal({
title:'提示', title: '提示',
content:'目标台桌使用中无法转桌', content: '目标台桌使用中无法转桌',
showCancel:false showCancel: false
}) })
} }
if (shopInfoRes.shopInfo.isTableFee === 1) { if (shopInfoRes.shopInfo.isTableFee === 1) {
@@ -2239,6 +2265,7 @@
if (e.one_more_order && e.order_id) { if (e.one_more_order && e.order_id) {
extraInitPar.one_more_order = 1 extraInitPar.one_more_order = 1
extraInitPar.order_id = e.order_id extraInitPar.order_id = e.order_id
extraInitPar.user_id = uni.cache.get('userInfo').id||''
} }
useSocket.connect({ useSocket.connect({

View File

@@ -426,7 +426,7 @@ export const useCartsStore = defineStore("cart", () => {
} }
// 提示 // 提示
if (Message.status == 0 && Message.type != "no_suit_num") { if (Message.status == 0 && Message.type != "no_suit_num"&& Message.operate_type != "rottable_error") {
uni.showToast({ uni.showToast({
title: Message.msg, title: Message.msg,
icon: "none", icon: "none",

View File

@@ -1,42 +1,43 @@
// vite.config.js正确的 CommonJS 配置) // vite.config.js正确的 CommonJS 配置)
const { defineConfig } = require("vite"); const {
defineConfig
} = require("vite");
const uni = require("@dcloudio/vite-plugin-uni").default; // uni 插件需要 .default const uni = require("@dcloudio/vite-plugin-uni").default; // uni 插件需要 .default
const AutoImport = require("unplugin-auto-import/vite"); // 旧版本 AutoImport 直接导出函数,无需 .default const AutoImport = require("unplugin-auto-import/vite"); // 旧版本 AutoImport 直接导出函数,无需 .default
module.exports = defineConfig({ module.exports = defineConfig({
plugins: [ plugins: [
uni(), uni(),
AutoImport({ AutoImport({
include: [/\.js$/, /\.vue$/, /\.vue\?vue/], include: [/\.js$/, /\.vue$/, /\.vue\?vue/],
imports: [ imports: [
"vue", "vue",
{ {
"@dcloudio/uni-app": [ "@dcloudio/uni-app": [
"onLoad", "onLoad",
"onShow", "onShow",
"onHide", "onHide",
"onUnload", "onUnload",
"onReady", "onReady",
"onReachBottom", "onReachBottom",
"onPageScroll", "onPageScroll",
"uni.request", "uni.request",
"uni.navigateTo", "uni.navigateTo",
"uni.showToast", "uni.showToast",
], ],
}, },
], ],
dts: "src/auto-imports.d.ts", dts: "src/auto-imports.d.ts",
}), }),
], ],
server: { server: {
hmr: true, proxy: {
proxy: { '/api': {
"/api": { // 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(/^\/api/, '')
secure: false, },
}, },
}, },
}, });
});