diff --git a/App.vue b/App.vue
index 8f3a6df..b388269 100644
--- a/App.vue
+++ b/App.vue
@@ -3,170 +3,167 @@
App.vue本身不是页面,这里不能编写视图元素,也就是没有
-->
\ No newline at end of file
+/** uni 组件样式覆盖 */
+@import "@/commons/style/uni-overwrite.scss";
+
diff --git a/commons/style/common.scss b/commons/style/common.scss
index bf82359..581b443 100644
--- a/commons/style/common.scss
+++ b/commons/style/common.scss
@@ -412,4 +412,16 @@ text {
/* #endif */
.u-flex-col{
flex-direction: column!important;
+}
+.font-700{
+ font-weight: 700;
+}
+.text-center{
+ text-align: center;
+}
+.bg-f7{
+ background-color: #F7F7F7;
+}
+.u-col-baseline{
+ align-items: baseline;
}
\ No newline at end of file
diff --git a/commons/style/vars.scss b/commons/style/vars.scss
index 65ad362..7394385 100644
--- a/commons/style/vars.scss
+++ b/commons/style/vars.scss
@@ -39,7 +39,7 @@ $J-f-size30: 30rpx;
$v-b-color-ed: #ededed;
//common.scss 分包页面以及组件里所用的颜色
-$my-main-color:#318AFE;
+$my-main-color:#3F9EFF;
$my-red-color:#F02C45;
//my-components
diff --git a/components/my-components/modal.vue b/components/my-components/modal.vue
new file mode 100644
index 0000000..f051d90
--- /dev/null
+++ b/components/my-components/modal.vue
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/components/my-components/my-login.vue b/components/my-components/my-login.vue
index d317361..dadea53 100644
--- a/components/my-components/my-login.vue
+++ b/components/my-components/my-login.vue
@@ -201,8 +201,8 @@
const getCode = () => {
getCodeImg().then(res => {
- vdata.formData.img = res.data.code
- vdata.formData.uuid = res.data.uuid
+ vdata.formData.img = res.code
+ vdata.formData.uuid = res.uuid
})
}
@@ -234,7 +234,7 @@
uni.removeStorageSync('tokenInfo')
uni.removeStorageSync('shopId')
// 登录成功
- loginFinishFunc(res.data)
+ loginFinishFunc(res)
}).catch(e => {
getCode()
})
diff --git a/data/index.js b/data/index.js
new file mode 100644
index 0000000..d5d94a3
--- /dev/null
+++ b/data/index.js
@@ -0,0 +1,8 @@
+export const servingStyles = [
+ { name: "即起", value: "READY_TO_SERVE" },
+ { name: "叫起", value: "PENDING_PREP" },
+ { name: "加急", value: "URGENT" },
+];
+export const returnServingStyleName = (value) => {
+ return servingStyles.find((item) => item.value === value)?.name || value;
+};
diff --git a/http/api/order.js b/http/api/order.js
index 95aa21d..8a2bcd9 100644
--- a/http/api/order.js
+++ b/http/api/order.js
@@ -1,116 +1,137 @@
-import http from '@/http/yskApi/http.js'
-const request = http.request
-
+import http from "@/http/yskApi/http.js";
+const request = http.request;
+const urlType = "/order";
/**
* 获取订单列表
* @returns
*/
-export function getOrderList(data, urlType = 'order') {
- return request({
- url: `/order/admin/order`,
- method: "GET",
- data: {
- ...data
- }
- })
+export function getOrderList(data) {
+ return request({
+ url: `/order/admin/order`,
+ method: "GET",
+ data: {
+ ...data,
+ },
+ });
}
/**
* 订单详情
* @returns
*/
-export function getOrderById(data, urlType = 'order') {
- return request({
- url: `/order/admin/order/getOrderById`,
- method: "GET",
- data: {
- ...data
- }
- })
+export function getOrderById(data) {
+ return request({
+ url: `/order/admin/order/getOrderById`,
+ method: "GET",
+ data: {
+ ...data,
+ },
+ });
+}
+
+/**
+ * 起菜, 上菜
+ */
+export function upOrderDetail(data) {
+ return request({
+ url: urlType + `/admin/order/upOrderDetail`,
+ method: "PUT",
+ data: {
+ ...data,
+ },
+ });
+}
+// 转桌
+export function mergeOrder(data) {
+ return request({
+ url: urlType + `/admin/order/mergeOrder`,
+ method: "POST",
+ data: {
+ ...data,
+ },
+ });
}
/**
* 历史订单(多次下单使用)
* @returns
*/
-export function getHistoryOrder(data, urlType = '/order') {
- return request({
- url: `/order/admin/order/historyOrder`,
- method: "GET",
- data: {
- ...data
- }
- })
+export function getHistoryOrder(data, urlType = "/order") {
+ return request({
+ url: `/order/admin/order/historyOrder`,
+ method: "GET",
+ data: {
+ ...data,
+ },
+ });
}
/**
* 生成订单
* @returns
*/
-export function createOrder(data, urlType = 'order') {
- return request({
- url: `/order/admin/order/createOrder`,
- method: "POST",
- data: {
- ...data
- }
- })
+export function createOrder(data) {
+ return request({
+ url: `/order/admin/order/createOrder`,
+ method: "POST",
+ data: {
+ ...data,
+ },
+ });
}
/**
* 订单退款 只传订单id
* @returns
*/
-export function refundOrder(data, urlType = 'order') {
- return request({
- url: `/order/admin/order/refundOrder`,
- method: "POST",
- data: {
- ...data
- }
- })
+export function refundOrder(data) {
+ return request({
+ url: `/order/admin/order/refundOrder`,
+ method: "POST",
+ data: {
+ ...data,
+ },
+ });
}
/**
* 订单打印
* @returns
*/
-export function printOrder(data, urlType = 'order') {
- return request({
- url: `/order/admin/order/print`,
- method: "POST",
- data: {
- ...data
- }
- })
+export function printOrder(data) {
+ return request({
+ url: `/order/admin/order/print`,
+ method: "POST",
+ data: {
+ ...data,
+ },
+ });
}
/**
* 清空历史订单
* @returns
*/
-export function cancelOrder(data, urlType = 'order') {
- return request({
- url: `/order/admin/order/cancelOrder`,
- method: "POST",
- data: {
- ...data
- }
- })
+export function cancelOrder(data) {
+ return request({
+ url: `/order/admin/order/cancelOrder`,
+ method: "POST",
+ data: {
+ ...data,
+ },
+ });
}
/**
* 清空某一次历史订单
* @returns
*/
-export function rmPlaceOrder(data, urlType = 'order') {
- return request({
- url: `/${urlType}/admin/order/rmPlaceOrder`,
- method: "POST",
- data: {
- ...data
- }
- })
+export function rmPlaceOrder(data) {
+ return request({
+ url: `/${urlType}/admin/order/rmPlaceOrder`,
+ method: "POST",
+ data: {
+ ...data,
+ },
+ });
}
-
-
diff --git a/http/websock.js b/http/websock.js
index 0e7a6c9..ccd13e2 100644
--- a/http/websock.js
+++ b/http/websock.js
@@ -83,6 +83,7 @@ class WebsocketUtil {
data: data,
success: (res) => {
// console.log('消息发送成功', res);
+ this.startHeartbeat();
},
fail: (error) => {
console.error('消息发送失败', error);
diff --git a/http/yskApi/account/shopStaff.js b/http/yskApi/account/shopStaff.js
new file mode 100644
index 0000000..7a17f82
--- /dev/null
+++ b/http/yskApi/account/shopStaff.js
@@ -0,0 +1,19 @@
+import http from '../http.js'
+const request = http.request
+import {accountUrl} from '../prveUrl.js'
+
+/**
+ * 当前登录员工信息
+ * @returns
+ */
+export function shopStaffInfo(params) {
+ return request({
+ url: accountUrl+`/admin/shopStaff/info`,
+ method: 'get',
+ params: {
+ shopId: uni.getStorageSync('shopId'),
+ ...params
+ }
+ })
+}
+
diff --git a/http/yskApi/http.js b/http/yskApi/http.js
index f6e7a30..2b19135 100644
--- a/http/yskApi/http.js
+++ b/http/yskApi/http.js
@@ -1,24 +1,22 @@
/**
* HTTP的封装, 基于uni.request
* 包括: 通用响应结果的处理 和 业务的增删改查函数
- *
+ *
* @author terrfly
* @site https://www.jeequan.com
* @date 2021/12/16 18:35
*/
// 导入全局属性
-import appConfig from '@/config/appConfig.js'
-import storageManage from '@/commons/utils/storageManage.js'
-import infoBox from "@/commons/utils/infoBox.js"
-import go from '@/commons/utils/go.js';
-import {
- reject
-} from 'lodash';
+import appConfig from "@/config/appConfig.js";
+import storageManage from "@/commons/utils/storageManage.js";
+import infoBox from "@/commons/utils/infoBox.js";
+import go from "@/commons/utils/go.js";
+import { reject } from "lodash";
// 测试服
// let baseUrl = 'http://192.168.1.31'
// let baseUrl = 'https://admintestpapi.sxczgkj.cn'
-// const proxyApiwws = 'ws://192.168.1.31:2348' // 调试地址
+// const proxyApiwws = 'ws://192.168.1.31:2348' // 调试地址
//预发布
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
@@ -27,189 +25,196 @@ import {
// let baseUrl = 'https://cashier.sxczgkj.com'
// 本地测
-let baseUrl = "http://192.168.1.42"
+let baseUrl = "http://192.168.1.42";
// #ifdef H5
-baseUrl = '/ysk'
+baseUrl = "/ysk";
// #endif
// let baseUrl = 'http://192.168.1.15:8000'
// 巩
// let baseUrl = 'http://192.168.1.9:8000'
-// 多少 ms 以内, 不提示loading
-const loadingShowTime = 200
-
+// 多少 ms 以内, 不提示loading
+const loadingShowTime = 200;
function getHeader() {
- const headerObject = {}
- headerObject["token"] = uni.getStorageSync('tokenInfo').tokenValue
- headerObject["shopId"] = uni.getStorageSync("shopId"),
- // shopId:shopInfo.value.id
- headerObject["Content-Type"] = 'application/json;charset=UTF-8'
- headerObject["platformType"] ="PAD"
- return headerObject
+ const headerObject = {};
+ headerObject["token"] = uni.getStorageSync("tokenInfo").tokenValue;
+ (headerObject["shopId"] = uni.getStorageSync("shopId")),
+ // shopId:shopInfo.value.id
+ (headerObject["Content-Type"] = "application/json;charset=UTF-8");
+ headerObject["platformType"] = "PAD";
+ return headerObject;
}
-// 通用处理逻辑
+// 通用处理逻辑
function commonsProcess(showLoading, httpReqCallback) {
+ // 判断是否请求完成(用作 是否loading )
+ // 包括: 'ing', 'ingLoading', 'finish'
+ let reqState = "ing";
- // 判断是否请求完成(用作 是否loading )
- // 包括: 'ing', 'ingLoading', 'finish'
- let reqState = 'ing'
+ // 是否已经提示的错误信息
+ let isShowErrorToast = false;
- // 是否已经提示的错误信息
- let isShowErrorToast = false
+ // 请求完成, 需要处理的动作
+ let reqFinishFunc = () => {
+ if (reqState == "ingLoading") {
+ // 关闭loading弹层
+ infoBox.hideLoading();
+ }
+ reqState = "finish"; // 请求完毕
+ };
+ // 明确显示loading
+ if (showLoading) {
+ // xx ms内响应完成,不提示loading
+ setTimeout(() => {
+ if (reqState == "ing") {
+ reqState = "ingLoading";
+ infoBox.showLoading();
+ }
+ }, loadingShowTime);
+ }
- // 请求完成, 需要处理的动作
- let reqFinishFunc = () => {
+ return httpReqCallback()
+ .then((httpData) => {
+ reqFinishFunc(); // 请求完毕的动作
+ // 从http响应数据中解构响应数据 [ 响应码、 bodyData ]
+ let { statusCode, data } = httpData;
+ // 避免混淆重新命名
+ let bodyData = data;
+ console.log('bodyData',bodyData)
- if (reqState == 'ingLoading') { // 关闭loading弹层
- infoBox.hideLoading()
- }
- reqState = 'finish' // 请求完毕
- }
+ if (statusCode == 500) {
+ isShowErrorToast = true;
+ return Promise.reject(bodyData); // 跳转到catch函数
+ }
+ if (statusCode == 401) {
+ isShowErrorToast = true;
- // 明确显示loading
- if (showLoading) {
- // xx ms内响应完成,不提示loading
- setTimeout(() => {
- if (reqState == 'ing') {
- reqState = 'ingLoading'
- infoBox.showLoading()
- }
- }, loadingShowTime)
- }
+ return Promise.reject(bodyData); // 跳转到catch函数
+ }
- return httpReqCallback().then((httpData) => {
- reqFinishFunc(); // 请求完毕的动作
- // 从http响应数据中解构响应数据 [ 响应码、 bodyData ]
- let {
- statusCode,
- data
- } = httpData
- // 避免混淆重新命名
- let bodyData = data
- if (statusCode == 500) {
- isShowErrorToast = true
- return Promise.reject(bodyData) // 跳转到catch函数
- }
- if (statusCode == 401) {
+ // http响应码不正确
+ if (statusCode != 200 && statusCode != 204 && statusCode != 201) {
+ isShowErrorToast = true;
+ data.message =
+ data.message == "Bad credentials" ? "用户名或密码错误" : data.message;
+ infoBox.showToast(data.message || "服务器异常");
+ return Promise.reject(bodyData); // 跳转到catch函数
+ }
+ // 构造请求成功的响应数据
+ if (bodyData.code == 501) {
+ return Promise.reject(bodyData); // 跳转到catch函数
+ }
+ return Promise.resolve(bodyData.data);
+ })
+ .catch((res) => {
+ if (res.code == 401 || res.code == 501) {
+ storageManage.token(null, true);
+ infoBox.showErrorToast(res.message || "请登录").then(() => {
+ uni.redirectTo({
+ url: "/pages/login/index",
+ });
+ reject();
+ });
+ }
- isShowErrorToast = true
+ if (res.status == 500) {
+ infoBox.showErrorToast(res.message || "服务器异常").then(() => {});
+ }
- return Promise.reject(bodyData) // 跳转到catch函数
- }
- // http响应码不正确
- if (statusCode != 200 && statusCode != 204 && statusCode != 201) {
- isShowErrorToast = true
- data.message = data.message == 'Bad credentials' ? '用户名或密码错误' : data.message
- infoBox.showToast(data.message || '服务器异常')
- return Promise.reject(bodyData) // 跳转到catch函数
- }
-
- // 构造请求成功的响应数据
- return Promise.resolve(bodyData)
+ reqFinishFunc(); // 请求完毕的动作
- }).catch(res => {
- if (res.status == 401) {
- storageManage.token(null, true)
- infoBox.showErrorToast(res.message || '请登录').then(() => {
- uni.redirectTo({
- url: '/pages/login/index'
- })
- reject()
- })
- }
-
- if (res.status == 500) {
- infoBox.showErrorToast(res.message || '服务器异常').then(() => {})
- }
-
- reqFinishFunc(); // 请求完毕的动作
-
- // 如果没有提示错误, 那么此处提示 异常。
- if (!isShowErrorToast) {
- infoBox.showErrorToast(`请求网络异常`)
- }
-
- return Promise.reject(res)
-
- }).finally(() => { // finally 是 then结束后再执行, 此处不适用。 需要在请求完成后立马调用: reqFinishFunc()
-
- });
+ // 如果没有提示错误, 那么此处提示 异常。
+ if (!isShowErrorToast) {
+ infoBox.showErrorToast(`请求网络异常`);
+ }
+ return Promise.reject(res);
+ })
+ .finally(() => {
+ // finally 是 then结束后再执行, 此处不适用。 需要在请求完成后立马调用: reqFinishFunc()
+ });
}
-
// 默认 显示loading(控制 xxs 内 不提示loading )
function req(uri, data, method = "GET", showLoading = true, extParams = {}) {
- return commonsProcess(showLoading, () => {
- return uni.request(
- Object.assign({
- url: baseUrl + uri,
- data: data,
- method: method,
- header: getHeader()
- }, extParams)
- )
- })
+ return commonsProcess(showLoading, () => {
+ return uni.request(
+ Object.assign(
+ {
+ url: baseUrl + uri,
+ data: data,
+ method: method,
+ header: getHeader(),
+ },
+ extParams
+ )
+ );
+ });
}
-
// 默认 显示loading(控制 xxs 内 不提示loading )
function request(args) {
- const {
- url,
- data,
- params,
- method = "GET",
- showLoading = true,
- extParams = {}
- } = args
- let headerObject = {}
- return commonsProcess(showLoading, () => {
- // console.log('baseUrl+');
- // console.log(baseUrl + url);
- return uni.request(
- Object.assign({
- url: baseUrl + url,
- data: params || data,
- method: method,
- header: getHeader()
- }, extParams)
- )
- })
+ const {
+ url,
+ data,
+ params,
+ method = "GET",
+ showLoading = true,
+ extParams = {},
+ } = args;
+ let headerObject = {};
+ return commonsProcess(showLoading, () => {
+ // console.log('baseUrl+');
+ // console.log(baseUrl + url);
+ return uni.request(
+ Object.assign(
+ {
+ url: baseUrl + url,
+ data: params || data,
+ method: method,
+ header: getHeader(),
+ },
+ extParams
+ )
+ );
+ });
}
-
-
// 上传
function upload(uri, data, file, showLoading = true, extParams = {}) {
- // 放置token
- let headerObject = {}
+ // 放置token
+ let headerObject = {};
- return commonsProcess(showLoading, () => {
- return uni.uploadFile(
- Object.assign({
- url: baseUrl + uri,
- formData: data,
- name: "file",
- filePath: file.path || file.url,
- header: getHeader()
- }, extParams)
- ).then((httpData) => {
- // uni.upload 返回bodyData 的是 string类型。 需要解析。
- httpData.data = JSON.parse(httpData.data)
- return Promise.resolve(httpData)
- }).catch(err => {
- uni.hideLoading()
- infoBox.showErrorToast(`上传失败`)
- })
- })
+ return commonsProcess(showLoading, () => {
+ return uni
+ .uploadFile(
+ Object.assign(
+ {
+ url: baseUrl + uri,
+ formData: data,
+ name: "file",
+ filePath: file.path || file.url,
+ header: getHeader(),
+ },
+ extParams
+ )
+ )
+ .then((httpData) => {
+ // uni.upload 返回bodyData 的是 string类型。 需要解析。
+ httpData.data = JSON.parse(httpData.data);
+ return Promise.resolve(httpData);
+ })
+ .catch((err) => {
+ uni.hideLoading();
+ infoBox.showErrorToast(`上传失败`);
+ });
+ });
}
export default {
- req: req,
- request,
- upload: upload
-}
\ No newline at end of file
+ req: req,
+ request,
+ upload: upload,
+};
diff --git a/main.js b/main.js
index 526da49..0645ca5 100644
--- a/main.js
+++ b/main.js
@@ -1,74 +1,85 @@
// 设置env配置文件
-import envConfig from '@/env/config.js'
+import envConfig from "@/env/config.js";
// 全局配置项
-import appConfig from '@/config/appConfig.js'
-import storageManage from '@/commons/utils/storageManage.js'
-import uviewPlus,{setConfig} from 'uview-plus'
-import dict from '@/commons/utils/dict.js'
+import appConfig from "@/config/appConfig.js";
+import storageManage from "@/commons/utils/storageManage.js";
+import uviewPlus, { setConfig } from "uview-plus";
+import dict from "@/commons/utils/dict.js";
// 下面的在特殊场景下才需要配置,通常不用配置即可直接使用uvire-plus框架。
-import {utils} from '@/commons/utils/index.js'
+import { utils } from "@/commons/utils/index.js";
-import * as Pinia from 'pinia';
+// const test= import.meta.glob([`./commons/utils/**/*.js`,`./stores/**/*.js`],{
+// eager: true,
+// import: "default",
+// })
+// console.log(test)
+
+import * as Pinia from "pinia";
+import { createUnistorage } from "pinia-plugin-unistorage";
// 调用setConfig方法,方法内部会进行对象属性深度合并,可以放心嵌套配置
// 需要在app.use(uview-plus)之后执行
setConfig({
- // 修改$u.config对象的属性
- config: {
- // 修改默认单位为rpx,相当于执行 uni.$u.config.unit = 'rpx'
- unit: 'px'
- },
- // 修改$u.props对象的属性
- props: {
- // 修改radio组件的size参数的默认值,相当于执行 uni.$u.props.radio.size = 30
- radio: {
- // size: 20
- }
- // 其他组件属性配置
- // ......
- }
-})
+ // 修改$u.config对象的属性
+ config: {
+ // 修改默认单位为rpx,相当于执行 uni.$u.config.unit = 'rpx'
+ unit: "px",
+ },
+ // 修改$u.props对象的属性
+ props: {
+ // 修改radio组件的size参数的默认值,相当于执行 uni.$u.props.radio.size = 30
+ radio: {
+ // size: 20
+ },
+ // 其他组件属性配置
+ // ......
+ },
+});
// 设置node环境
-envConfig.changeEnv(storageManage.env())
+envConfig.changeEnv(storageManage.env());
// import VConsole from 'vconsole';
-
+
// 初始化vConsole
// const vConsole = new VConsole({
- // defaultPlugins: ['console']
+// defaultPlugins: ['console']
// });
// #ifndef VUE3
-import App from './App'
+import App from "./App";
-import Vue from 'vue'
-Vue.config.productionTip = false
+import Vue from "vue";
+Vue.config.productionTip = false;
-App.mpType = 'app'
+App.mpType = "app";
const app = new Vue({
- ...App
-})
-app.$mount()
+ ...App,
+});
+app.$mount();
// #endif
// #ifdef VUE3
-import { createSSRApp } from 'vue'
-import App from './App.vue'
+import { createSSRApp } from "vue";
+import App from "./App.vue";
export function createApp() {
- const app = createSSRApp(App)
+ const app = createSSRApp(App);
app.use(Pinia.createPinia());
- app.use(uviewPlus)
- app.config.globalProperties.$appName = appConfig.appName
- uni.$appName = appConfig.appName
- app.config.globalProperties.$utils = utils
- uni.$utils = utils
- app.config.globalProperties.$dict = dict
- uni.$dict = dict
+ app.use(uviewPlus);
+ const store = Pinia.createPinia();
+ store.use(createUnistorage());
+ app.use(store);
+
+ app.config.globalProperties.$appName = appConfig.appName;
+ uni.$appName = appConfig.appName;
+ app.config.globalProperties.$utils = utils;
+ uni.$utils = utils;
+ app.config.globalProperties.$dict = dict;
+ uni.$dict = dict;
return {
app,
- Pinia, // 此处必须将 Pinia 返回
- }
+ Pinia, // 此处必须将 Pinia 返回
+ };
}
-// #endif
\ No newline at end of file
+// #endif
diff --git a/package.json b/package.json
index 90c3bd0..f61f078 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,8 @@
"jsencrypt": "^3.3.2",
"lodash": "^4.17.21",
"uview-plus": "^3.3.32",
- "ysk-utils": "^1.0.72"
+ "ysk-utils": "^1.0.78",
+ "pinia-plugin-unistorage": "^0.1.2"
},
"devDependencies": {
"copy-webpack-plugin": "^12.0.2",
diff --git a/pages.json b/pages.json
index 82227d4..02be26a 100644
--- a/pages.json
+++ b/pages.json
@@ -9,6 +9,15 @@
}
},
"pages": [
+ {
+ "pageId": "PAGES_INDEX_CHOOSE_TABLE",
+ "path": "pages/choose-table/choose-table",
+ "style": {
+ // "navigationBarTitleText": "代客下单"
+ "navigationBarTitleText": "",
+ "navigationStyle": "custom"
+ }
+ },
{
"pageId": "PAGES_CREATE_ORDER",
"path": "pagesCreateOrder/index/index",
@@ -18,6 +27,15 @@
"navigationStyle": "custom"
}
},
+ {
+ "pageId": "PAGES_TABLE_ORDER",
+ "path": "pagesCreateOrder/table-order/index",
+ "style": {
+ // "navigationBarTitleText": "台桌订单"
+ "navigationBarTitleText": "",
+ "navigationStyle": "custom"
+ }
+ },
{
"pageId": "PAGES_LOGIN",
"path": "pages/login/index",
diff --git a/pages/choose-table/choose-table.vue b/pages/choose-table/choose-table.vue
new file mode 100644
index 0000000..0090b97
--- /dev/null
+++ b/pages/choose-table/choose-table.vue
@@ -0,0 +1,332 @@
+
+
+
+
+
+ 台桌列表
+
+
+ {{
+ accountStore.shopStaff.name
+ }}
+
+
+
+
+
+
+ {{ value.label }} ({{ returnStatusTotal(key) }})
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+ {{ returnAreaText(item) }}
+
+
+ 点餐
+
+
+
+
+
+ {{ item.useNum || 0 }}/{{ item.maxCapacity }}人
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/choose-table/data.js b/pages/choose-table/data.js
new file mode 100644
index 0000000..0190c1d
--- /dev/null
+++ b/pages/choose-table/data.js
@@ -0,0 +1,11 @@
+export const tableStatus = {
+unbound: { label: "未绑定", type: "#909090" },
+ settled: { label: "待清台", type: "#FAAD14" },
+ ordering: { label: "点餐中", type: "#FF4D4F" },
+ unsettled: { label: "未结账", type: "#DD3F41" },
+cleaning: { label: "清理中", type: "#909090" },
+ idle: { label: "空闲", type: "#3F9EFF" },
+ closed: { label: "关台", type: "#DDDDDD" },
+ subscribe: { label: "预定", type: "#52C41A" },
+};
+
diff --git a/pages/login/index.vue b/pages/login/index.vue
index 4546bb2..4064789 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -1,220 +1,301 @@
-
-
- 欢迎回来,请登录
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ 银收客点餐
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
- {{ vdata.isShowPwd ? '隐藏' : '显示' }}
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ {{ vdata.isShowPwd ? "隐藏" : "显示" }}
+
+
+
+
-
-
-
-
-
-
-
- {{ vdata.sendMsgText }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ {{
+ vdata.sendMsgText
+ }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
-
-
-
-
-
+
+
diff --git a/pagesCreateOrder/choose-table/choose-table.vue b/pagesCreateOrder/choose-table/choose-table.vue
index a79db3b..fd3a7d6 100644
--- a/pagesCreateOrder/choose-table/choose-table.vue
+++ b/pagesCreateOrder/choose-table/choose-table.vue
@@ -188,7 +188,7 @@ async function getTable() {
// let state=status.list[status.active].key
// state=state?(state=='all'?'':state):''
const areaId = area.list[area.defaultCateIndex].id || "";
- let { data } = await $table.get({
+ let data = await $table.get({
...query,
areaId,
name: searchValue.value,
@@ -203,13 +203,11 @@ async function getTable() {
tables.originList = data.records;
}
async function getArea() {
- const { data } = await $tableArea.get({
+ const data = await $tableArea.get({
page: 0,
size: 300,
});
- data.records.unshift({
- name: "全部",
- });
+
area.list = data.records.map((v) => {
return {
...v,
diff --git a/pagesCreateOrder/choose-user/choose-user.vue b/pagesCreateOrder/choose-user/choose-user.vue
index 8fa7d73..2d167d6 100644
--- a/pagesCreateOrder/choose-user/choose-user.vue
+++ b/pagesCreateOrder/choose-user/choose-user.vue
@@ -116,7 +116,7 @@
const {
records,
totalRow
- }=res.data
+ }=res
hasAjax.value = true
list.length = records.length
for (let i in records) {
diff --git a/pagesCreateOrder/confirm-order/confirm-order.vue b/pagesCreateOrder/confirm-order/confirm-order.vue
index 9a8c378..eb98a45 100644
--- a/pagesCreateOrder/confirm-order/confirm-order.vue
+++ b/pagesCreateOrder/confirm-order/confirm-order.vue
@@ -611,8 +611,8 @@ async function getDiscountActivity() {
let res = await discountActivity({
shopId: uni.getStorageSync("shopId"),
});
- if (res.code == 200) {
- fullReductionActivities.value = res.data?[res.data]:[];
+ if (res) {
+ fullReductionActivities.value = res?[res]:[];
}
}
const websocketUtil = inject("websocketUtil"); // 注入 WebSocket 工具类实例
@@ -620,7 +620,7 @@ const websocketUtil = inject("websocketUtil"); // 注入 WebSocket 工具类实
const limitTimeDiscountRes = ref(null);
async function getLimit() {
const res = await limitTimeDiscountApi.limitTimeDiscount();
- limitTimeDiscountRes.value = res.data;
+ limitTimeDiscountRes.value = res;
if (pageData.table.tableCode) {
pageData.limitTimeDiscount = limitTimeDiscountRes.value;
@@ -695,7 +695,7 @@ async function getHistoryOrderDetail(tableCode) {
let res = await getHistoryOrder({
tableCode: tableCode,
});
- pageData.orderInfo = res.data;
+ pageData.orderInfo = res;
}
//餐位费
@@ -734,7 +734,7 @@ async function init() {
});
// 获取商品列表
let res = await getProductList({}, "product", false);
- $goods = res.data;
+ $goods = res;
// console.log("商品列表===",$goods)
getTableInfo(pageData.table);
}
@@ -896,16 +896,16 @@ async function getTbShopInfo() {
const res = await getShopInfo({
id: uni.getStorageSync("shopId"),
});
- pageData.shopInfo = res.data;
- seatFeeConfig.pricePerPerson = res.data.tableFee || 0;
- uni.setStorageSync("shopInfo", res.data);
+ pageData.shopInfo = res;
+ seatFeeConfig.pricePerPerson = res.tableFee || 0;
+ uni.setStorageSync("shopInfo", res);
}
/**
* 获取桌台信息
*/
async function getTableInfo(opt) {
- const { data: res } = await getShopTableDetail({
+ const res = await getShopTableDetail({
id: opt.id,
tableCode: opt.tableCode,
});
@@ -939,7 +939,7 @@ function watchChooseuser() {
const res = await shopUserDetail({
userId: data.userId,
});
- pageData.user = res.data;
+ pageData.user = res;
} else {
pageData.user = data;
}
@@ -1267,11 +1267,11 @@ async function createAnOrder() {
if (pageData.orderInfo && pageData.shopInfo.registerType != "before") {
par.orderId = pageData.orderInfo.id;
}
- let res = {data:{id:''}};
+ let res = {id:''}
if (goods.list.length) {
res = await createOrder(par);
console.log(res, "创建订单");
- if (res.code != 200) {
+ if (!res) {
uni.showToast({
title: res.msg || "创建订单失败!",
icon: "none",
@@ -1299,14 +1299,14 @@ async function createAnOrder() {
return go.to(
"PAGES_ORDER_PAY",
{
- orderId: res.data.id,
+ orderId: res.id,
isNowPay: true,
dinnerType: pageData.eatTypes.active,
},
"redirect"
);
} else {
- if(!res.data.id&&pageData.orderInfo.id){
+ if(!res.id&&pageData.orderInfo.id){
return go.to(
"PAGES_ORDER_PAY",
{
@@ -1322,7 +1322,7 @@ async function createAnOrder() {
go.to(
"PAGES_ORDER_DETAIL",
{
- id: res.data.id||pageData.orderInfo.id,
+ id: res.id||pageData.orderInfo.id,
dinnerType: pageData.eatTypes.active,
},
"redirect"
diff --git a/pagesCreateOrder/index/components/car.vue b/pagesCreateOrder/index/components/car.vue
index f86ef39..6662424 100644
--- a/pagesCreateOrder/index/components/car.vue
+++ b/pagesCreateOrder/index/components/car.vue
@@ -11,11 +11,13 @@
- 已选菜品({{ goodsNumber }})
+
+ 已选菜品({{ goodsNumber }})
+
清空点餐
-
- 合计:
- {{
- allPrice
- }}
- 元
-
-
- {{ item.name }}
- 限
-
+
+ {{ item.name }}
+ 限
+
{{
item.specInfo || ""
}}
@@ -182,7 +177,9 @@
v-if="v.is_time_discount || v.isTimeDiscount"
>
¥{{ returnLimitPrice({...v,number:v.num,salePrice:v.price}) }}¥{{
+ returnLimitPrice({ ...v, number: v.num, salePrice: v.price })
+ }}
X{{ v.num.toFixed(2) }}
@@ -203,18 +200,41 @@
+
-
-
-
-
- 返回
+
+ 合计:
+ ¥{{ allPrice }}
-
- 落单
+
+
+
+
+
+ 返回
+
+
+ 上菜方式:{{ returnServingStyleName(subStatus) }}
+
+
+
+ 落单
+
@@ -263,10 +283,41 @@
:ref="setModel"
name="remark"
>
+
+
+
+
+
+
+
+ 员工名称
+ {{
+ accountStore.shopStaff.name
+ }}
+
+
+ 员工账号
+
+
+
+
+
diff --git a/pagesCreateOrder/index/index.vue b/pagesCreateOrder/index/index.vue
index cd74da0..0eead6b 100644
--- a/pagesCreateOrder/index/index.vue
+++ b/pagesCreateOrder/index/index.vue
@@ -6,6 +6,14 @@
+
+
+ 返回
+
-
+
-
+
{{ data.table.name }}
-
-
+ -->
- 选择桌台
+ 换台
-
+
- 已点订单
+
+ 已点订单
-
+
搜索
-
-
-
-
- {{ data.userInfo.shopName }}
-
+ {{ accountStore.shopStaff.name }}
-
+
@@ -226,6 +238,7 @@
@updateSafeBottom="updateSafeBottom"
:instance="instance"
@updateCart="getCart"
+ @updateCartRemark="updateCartRemark"
:sysInfo="sysInfo"
:isCreateOrderToDetail="isCreateOrderToDetail"
@updateNumber="carsNumberChange"
@@ -235,6 +248,7 @@
:data="cars"
:orderInfo="data.orderInfo"
:historyOrder="data.historyOrder"
+ :tableCode="data.table.tableCode"
@clear="cleaCart"
>
@@ -295,7 +309,9 @@
import _ from "lodash";
import * as Api from "@/http/yskApi/Instead.js";
import * as limitTimeDiscountApi from "@/http/yskApi/limitTimeDiscount.js";
-import * as padApi from "@/http/yskApi/pad.js";
+
+
+
import {
$table,
$choseTable,
@@ -347,6 +363,13 @@ import { getNowCart } from "@/pagesCreateOrder/util.js";
// import yskUtils from "ysk-utils";
import yskUtils from "@/lib/index";
provide("yskUtils", yskUtils);
+
+import {useAccountStore} from '@/stores/account'
+const accountStore = useAccountStore()
+
+provide("accountStore", accountStore);
+
+
import {
$productCategory,
$layoutpage,
@@ -450,6 +473,7 @@ const layoutArr = {
};
const tabsEle = reactive({
scrollWidth: 0,
+ scroViewllLeft: 0,
tabsItems: [],
scrollLeft: 0,
});
@@ -494,7 +518,6 @@ function onMessage() {
data.isGoodsAdd = true;
// 如果是商品库存不足起售数量
if (msg.type == "no_suit_num") {
- // cartItem = getNowCart(msg.data, cartArr)
cartControls([], "del");
}
return;
@@ -602,15 +625,15 @@ function delCart(id) {
* 获取订单详情
*/
async function getHistoryOrderDetail() {
- if(shopInfo.registerType=='before'){
- return
+ if (shopInfo.registerType == "before") {
+ return;
}
data.historyOrder = [];
let res = await getHistoryOrder({
tableCode: data.table.tableCode,
});
- data.orderInfo = res.data;
- if (res.data) {
+ data.orderInfo = res;
+ if (res) {
data.historyOrder = Object.entries(data.orderInfo.detailMap).map(
([key, value]) => ({
info: value,
@@ -1018,10 +1041,13 @@ function changeCategorySel(index) {
function setTabsCurrentPosition(position = "center") {
const index = layoutData.category.sel;
+ console.log(tabsEle.tabsItems[index]);
+ console.log(tabsEle.scroViewllLeft);
tabsEle.scrollLeft =
tabsEle.tabsItems[index].left -
tabsEle.scrollWidth / 2 +
- tabsEle.tabsItems[index].width / 2;
+ tabsEle.tabsItems[index].width / 2 -
+ tabsEle.scroViewllLeft;
}
const shopInfo = uni.getStorageSync("shopInfo");
@@ -1042,13 +1068,13 @@ async function getGoodsData(max = 6, isGetPrve = false) {
try {
const res2 = await $productCategory(pageData.id);
layoutData.list[layoutData.current + i * fuhao] = {
- ...res2.data,
- padLayoutCode: res2.data.padLayoutCode
- ? res2.data.padLayoutCode
- : res2.data.productList.length <= 4
- ? layoutArr[res2.data.productList.length]
+ ...res2,
+ padLayoutCode: res2.padLayoutCode
+ ? res2.padLayoutCode
+ : res2.productList.length <= 4
+ ? layoutArr[res2.productList.length]
: "6-grid",
- productList: res2.data.productList.map((v) => {
+ productList: res2.productList.map((v) => {
v.salePrice = v.lowPrice;
const findGoodsInCar = cars.find((cars) => {
return cars.productId == v.id;
@@ -1140,16 +1166,15 @@ async function init() {
if (option.type == "add") {
setTabBar($category, $originGoods, []);
}
- // shopInfo.value = uni.getStorageSync('shopInfo').data
let shopInfo = await getShopInfo({
id: uni.getStorageSync("shopInfo").id,
});
- uni.setStorageSync("shopInfo", shopInfo.data);
+ uni.setStorageSync("shopInfo", shopInfo);
// 获取布局
// const getLayoutData = await getLayout({})
// 获取分类数据-获取商品分类
const categoryRes = await getCategory();
- $category = categoryRes.data;
+ $category = categoryRes;
let arr = [];
for (let i = 0; i < $category.length; i++) {
@@ -1166,8 +1191,8 @@ async function init() {
// }
// })
const content =
- res.data.records.length > 0
- ? res.data.records
+ res.records.length > 0
+ ? res.records
: [
{
productCategoryId: $category[i].id,
@@ -1194,7 +1219,7 @@ async function init() {
});
getLayoutGoodsInit();
// 获取商品数据
- const { data: goodsRes } = await getGoods();
+ const goodsRes = await getGoods();
const goods = goodsRes.filter((v) => {
let isShow = true;
if (v.type != "sku") {
@@ -1218,11 +1243,13 @@ function categoryEleInit() {
rect: true,
}).then((res) => {
tabsEle.scrollWidth = res.width;
+ tabsEle.scroViewllLeft = res.left;
});
for (let i in layoutData.category.list) {
getElRect("u-tab-item" + i, instance.value, {
rect: true,
}).then((res) => {
+ console.log(res);
tabsEle.tabsItems[i] = {
width: res.width,
left: res.left,
@@ -1317,9 +1344,11 @@ function chooseTable() {
// setTimeout(() => {
// changeCategorySel(0)
// }, 500)
- go.to("PAGES_CHOOSE_TABLE", {
- ...data.table,
- });
+
+ go.to("PAGES_INDEX_CHOOSE_TABLE");
+ // go.to("PAGES_CHOOSE_TABLE", {
+ // ...data.table,
+ // });
}
async function confirmModelConfirm(isCancel = false) {
@@ -1682,6 +1711,21 @@ function editCart(par, operate_type) {
}
const $cacheGoods = {};
+//修改购物车商品备注
+function updateCartRemark(e) {
+ let { remark, index, goods } = e;
+ cars[index].note = remark;
+ let params = {
+ number: e.num,
+ id: e.goods.id,
+ product_id: e.goods.product_id,
+ sku_id: e.goods.sku_id,
+ is_temporary: e.goods.is_temporary,
+ remark: remark,
+ };
+ editCart(params, "edit");
+}
+
//购物车商品数量改变
async function carsNumberChange(e) {
if (!data.isGoodsAdd) {
@@ -1909,7 +1953,7 @@ async function onSelTable() {
data.masterId = masterId;
const cartRes = await getCart();
cars.length = 0;
- const cartArr = getNowCart(cartRes.data);
+ const cartArr = getNowCart(cartRes);
for (let i in cartArr) {
cars.push(cartArr[i]);
}
@@ -1973,7 +2017,7 @@ let sysInfo = ref({
const limitTimeDiscountRes = ref(null);
async function getLimit() {
const res = await limitTimeDiscountApi.limitTimeDiscount();
- limitTimeDiscountRes.value = res.data;
+ limitTimeDiscountRes.value = res;
if (data.table.tableCode) {
data.limitTimeDiscount = limitTimeDiscountRes.value;
@@ -1990,11 +2034,22 @@ async function getLimit() {
console.log("limitTimeDiscount", data.limitTimeDiscount);
}
}
+
+async function getTableDetail() {
+ let res = await $returnTableDetail({
+ tableCode: data.table.tableCode,
+ });
+ console.log(res, "getTableDetail");
+ if(res){
+ data.table = res;
+ }
+}
onLoad(async (opt) => {
sysInfo.value = uni.getSystemInfoSync();
uni.hideTabBar();
// option = opt
Object.assign(data.table, opt);
+ await getTableDetail();
await getLimit();
if (opt.useType) {
uni.setStorageSync("useType", opt.useType);
@@ -2034,7 +2089,7 @@ onLoad(async (opt) => {
// right: 0;
// top: 0;
// bottom: 0;
- padding-right: 30rpx;
+ padding-right: 58rpx;
background-color: #fff;
white-space: nowrap;
}
@@ -2109,7 +2164,7 @@ $u-main-color: $my-main-color;
}
.u-tab-item {
- padding: 10px 16px;
+ padding: 28rpx 20rpx;
box-sizing: border-box;
display: flex;
align-items: center;
@@ -2118,6 +2173,7 @@ $u-main-color: $my-main-color;
color: #444;
font-weight: 400;
line-height: 1;
+ margin-right: 56rpx;
}
.u-tab-item-active {
diff --git a/pagesCreateOrder/table-order/components/choose-tables.vue b/pagesCreateOrder/table-order/components/choose-tables.vue
new file mode 100644
index 0000000..ac44257
--- /dev/null
+++ b/pagesCreateOrder/table-order/components/choose-tables.vue
@@ -0,0 +1,213 @@
+
+
+
+
+
+ {{ nullText }}
+ {{ goodsName }}
+
+
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+ {{ cancelText }}
+ {{ confirmText }}
+
+
+
+
+
+
+
+
diff --git a/pagesCreateOrder/table-order/components/controls.vue b/pagesCreateOrder/table-order/components/controls.vue
new file mode 100644
index 0000000..b2129ba
--- /dev/null
+++ b/pagesCreateOrder/table-order/components/controls.vue
@@ -0,0 +1,126 @@
+
+
+
+ 开单时间:
+ 2025/09/22 19:43
+
+
+ 就餐人数:
+ {{ cartStore.personCount}} 人
+
+
+
+ 员工名称:
+ {{accountStore.shopStaff.name}}
+
+ 订单操作
+
+
+ {{ item.name }}
+
+
+ 台桌操作
+
+
+ {{ item.name }}
+
+
+
+
+
+
diff --git a/pagesCreateOrder/table-order/components/discount.vue b/pagesCreateOrder/table-order/components/discount.vue
new file mode 100644
index 0000000..3bff793
--- /dev/null
+++ b/pagesCreateOrder/table-order/components/discount.vue
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ %
+
+
+ %
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 元
+
+
+ 元
+
+
+
+
+
+
+ 当前单品价格:{{price}}
+
+
+ 打折原因
+ *
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pagesCreateOrder/table-order/components/give-food.vue b/pagesCreateOrder/table-order/components/give-food.vue
new file mode 100644
index 0000000..5687dc6
--- /dev/null
+++ b/pagesCreateOrder/table-order/components/give-food.vue
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+
+
+ 赠菜原因
+ *
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+ 取消
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pagesCreateOrder/table-order/components/goods-list.vue b/pagesCreateOrder/table-order/components/goods-list.vue
new file mode 100644
index 0000000..81b55e5
--- /dev/null
+++ b/pagesCreateOrder/table-order/components/goods-list.vue
@@ -0,0 +1,224 @@
+
+
+
+
+
+
+ {{ item.productName }}
+
+ 赠
+
+ {{ returnSubStatusText(item) }}
+
+
+
+
+ {{ item.num }}
+
+
+ {{ returnPrice(item) }}
+
+
+ {{ item.price }}
+
+
+ {{
+ BigNumber(item.num).times(returnPrice(item)).toFixed(2)
+ }}
+
+
+
+
+
+
+
+
+
diff --git a/pagesCreateOrder/table-order/components/list.vue b/pagesCreateOrder/table-order/components/list.vue
new file mode 100644
index 0000000..bbcfc99
--- /dev/null
+++ b/pagesCreateOrder/table-order/components/list.vue
@@ -0,0 +1,610 @@
+
+
+
+ 第{{ orderIndex }}次下单
+
+
+
+
+ 限时折扣
+
+
+ 临时菜
+
+
+
+
+
+
+
+ {{
+ item.status == "part_refund" ? "部分已退" : "全部已退"
+ }}
+
+
+ {{ item.name || item.productName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 退款金额:
+ {{
+ item.refundNum * item.unitPrice
+ }}
+
+
+ 退菜数量:
+ {{
+ item.returnNum
+ }}
+
+
+
+ {{
+ item.skuName || ""
+ }}
+
+
+ 备注:{{ item.remark }}
+
+
+
+
+
+ ¥{{ toFixed(item.price * item.num, item) }}
+
+ ¥0
+
+
+
+
+ ¥{{ toFixed(item.price * item.num, item) }}
+
+ ¥{{
+ toFixed(item.discountSaleAmount * item.num, item)
+ }}
+
+
+
+ ¥{{ toFixed(item.price * item.num, item) }}
+
+ ¥{{ returnLimitTotalMoney(item) }}
+
+
+
+ ¥{{ toFixed(item.price * item.num, item) }}
+
+ ¥{{
+ toFixed(item.memberPrice * item.num, item)
+ }}
+
+
+
+
+ ¥
+ {{
+ toFixed(item.price * item.num, item)
+ }}
+
+
+
+
+ X{{ item.num || item.num }}
+
+
+
+
+
+
+
+ 退菜
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pagesCreateOrder/table-order/components/pack-number.vue b/pagesCreateOrder/table-order/components/pack-number.vue
new file mode 100644
index 0000000..bd70164
--- /dev/null
+++ b/pagesCreateOrder/table-order/components/pack-number.vue
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+
+ 取消
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pagesCreateOrder/table-order/components/remark.vue b/pagesCreateOrder/table-order/components/remark.vue
new file mode 100644
index 0000000..381ae03
--- /dev/null
+++ b/pagesCreateOrder/table-order/components/remark.vue
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+
+ 取消
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pagesCreateOrder/table-order/index.vue b/pagesCreateOrder/table-order/index.vue
new file mode 100644
index 0000000..3f33502
--- /dev/null
+++ b/pagesCreateOrder/table-order/index.vue
@@ -0,0 +1,683 @@
+
+
+
+
+
+
+ 返回
+
+ {{ returnAreaName }} {{ returnTableName }}
+
+
+
+
+
+
+
+
+
+
+
+ 合计:
+ ¥{{ cartStore.orderCostSummary.finalPayAmount }}
+
+
+ 继续加菜
+ 结算
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 转桌到
+
+
+
+
+
+ 转入类型
+
+
+
+
+
+
+
+ 购物车商品
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pagesOrder/detail/detail.vue b/pagesOrder/detail/detail.vue
index c4b0380..a7738b1 100644
--- a/pagesOrder/detail/detail.vue
+++ b/pagesOrder/detail/detail.vue
@@ -107,7 +107,7 @@
* 获取订单详情
*/
async function getOrderDetail () {
- let {data:res} = await getHistoryOrder({orderId: options.id})
+ let res = await getHistoryOrder({orderId: options.id})
// console.log("订单详情===",res)
if(res.userId){
let {data:resUser} = await shopUserDetail({userId:res.userId})
diff --git a/pagesOrder/index/index.vue b/pagesOrder/index/index.vue
index f895ebd..ef7ecf0 100644
--- a/pagesOrder/index/index.vue
+++ b/pagesOrder/index/index.vue
@@ -106,9 +106,7 @@
}
async function init() {
console.log(order.data.query);
- const {
- data
- } = await Api.tbOrderInfoData({
+ const data = await Api.tbOrderInfoData({
...order.data.query,
page: order.data.query.page,
keyword: search.val
diff --git a/pagesOrder/pay-order/pay-order.vue b/pagesOrder/pay-order/pay-order.vue
index 9b416ca..1ed05e0 100644
--- a/pagesOrder/pay-order/pay-order.vue
+++ b/pagesOrder/pay-order/pay-order.vue
@@ -441,8 +441,8 @@ async function getDiscountActivity() {
let res = await discountActivity({
shopId: uni.getStorageSync("shopId"),
});
- if (res.code == 200) {
- fullReductionActivities.value = res.data ? [res.data] : [];
+ if (res) {
+ fullReductionActivities.value = res ? [res] : [];
}
}
onLoad(async (opt) => {
@@ -476,7 +476,7 @@ async function init() {
onMessage();
});
// 获取订单详情
- const { data: orderRes } = await getHistoryOrder({ orderId: order.orderId });
+ const orderRes = await getHistoryOrder({ orderId: order.orderId });
if (orderRes.status == "cancelled") {
uni.showToast({
title: "订单已取消",
@@ -505,7 +505,7 @@ async function init() {
userId: order.userId || pageData.user.userId,
}).then((res) => {
if (res.code == 200) {
- pageData.user = res.data;
+ pageData.user = res;
getCalcUsablePoints();
if (orderRes.pointsNum) {
accountPoints.sel = true;
@@ -811,7 +811,7 @@ function getPayUrl() {
}
getOrderPayUrl(params).then((res) => {
console.log(res, "tishi");
- payCodeUrl.value = res.data;
+ payCodeUrl.value = res;
pageData.payUrlShow = true;
});
}
@@ -823,7 +823,7 @@ async function getPayType() {
const payTypeList = await getPayTypeList();
pays.payTypes.list = [];
const arr = ["cash", "member-account"];
- payTypeList.data.map((v) => {
+ payTypeList.map((v) => {
if (v.payType != "bank") {
let disabled = false;
if (orderCostSummary.value.finalPayAmount <= 0) {
@@ -880,11 +880,11 @@ async function getCalcUsablePoints() {
shopUserId: pageData.user.id,
orderAmount: pointsCanDicountMaxMoney.value,
});
- console.log("getCalcUsablePoints", res.data);
- pointDeductionRule.pointsPerYuan = res.data.equivalentPoints;
- pointDeductionRule.maxDeductionAmount = res.data.maxDeductionAmount;
- accountPoints.calcRes = res.data;
- accountPoints.num = res.data.maxUsablePoints;
+ console.log("getCalcUsablePoints", res);
+ pointDeductionRule.pointsPerYuan = res.equivalentPoints;
+ pointDeductionRule.maxDeductionAmount = res.maxDeductionAmount;
+ accountPoints.calcRes = res;
+ accountPoints.num = res.maxUsablePoints;
return res;
}
@@ -1039,8 +1039,8 @@ function getShopUserDetail() {
// shopId: uni.getStorageSync("shopInfo").id,
id: pageData.user.id,
}).then((res) => {
- if (res.data) {
- pageData.user = res.data;
+ if (res) {
+ pageData.user = res;
}
});
}
@@ -1051,9 +1051,9 @@ function getNewUserDiscount() {
getDiscountByUserId({
shopUserId: pageData.user.id,
}).then((res) => {
- if (res.data) {
- newUserDiscount.value = res.data.amount || 0;
- newUserDiscountRes.value = res.data;
+ if (res) {
+ newUserDiscount.value = res.amount || 0;
+ newUserDiscountRes.value = res;
}
});
}
@@ -1226,12 +1226,11 @@ async function pay(par) {
payStatus = "";
return false;
}
- console.log(payRes);
- if (payRes && payRes.code == 200) {
+ if (payRes ) {
paySuccess();
} else {
uni.showToast({
- title: payRes.msg || "支付失败",
+ title: "支付失败",
icon: "none",
});
}
@@ -1345,7 +1344,7 @@ function cashConfirmShow() {
*/
async function getHistoryAndUpdateGoodsList() {
// 获取订单详情
- const { data: orderRes } = await getHistoryOrder({ orderId: order.orderId });
+ const orderRes = await getHistoryOrder({ orderId: order.orderId });
if (orderRes.status == "cancelled") {
uni.showToast({
title: "订单已取消",
diff --git a/pagesOrder/quan/quan.vue b/pagesOrder/quan/quan.vue
index b8349d2..93a17ec 100644
--- a/pagesOrder/quan/quan.vue
+++ b/pagesOrder/quan/quan.vue
@@ -455,9 +455,9 @@ function formatCoupon() {
async function getQuan() {
const orderRes = await orderApi.tbOrderInfoDetail(option.orderId);
- if (orderRes.code == 200) {
- order.value = orderRes.data;
- Object.assign(limitTimeDiscount,orderRes.data.limitRate)
+ if (orderRes) {
+ order.value = orderRes
+ Object.assign(limitTimeDiscount,orderRes.limitRate)
}
console.log(order.value);
@@ -465,7 +465,7 @@ async function getQuan() {
const res = await $findCoupon({
shopUserId: option.shopUserId,
});
- couponList.value = res.data || [];
+ couponList.value = res || [];
formatCoupon();
myQuan.hasAjax = true;
}
@@ -575,8 +575,8 @@ async function getShopUser() {
const res = await shopUserDetail({
id: option.shopUserId,
});
- if (res.code == 200) {
- shopUserInfo.value = res.data;
+ if (res) {
+ shopUserInfo.value = res;
}
}
onLoad(async (opt) => {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7d8963d..e20a7a6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -32,12 +32,15 @@ importers:
lodash:
specifier: ^4.17.21
version: 4.17.21
+ pinia-plugin-unistorage:
+ specifier: ^0.1.2
+ version: 0.1.2
uview-plus:
specifier: ^3.3.32
version: 3.6.10
ysk-utils:
- specifier: ^1.0.72
- version: 1.0.72
+ specifier: ^1.0.78
+ version: 1.0.78
devDependencies:
copy-webpack-plugin:
specifier: ^12.0.2
@@ -528,6 +531,9 @@ packages:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
engines: {node: '>=8.6'}
+ pinia-plugin-unistorage@0.1.2:
+ resolution: {integrity: sha512-WXit2cGnm5rG6CDTcLSLehNWhyJS/Yq7WEeeXAapZbCnqoPJxlszqg7rT8S+OP47az0h5nlajGo+LuyMxUQ2uw==}
+
punycode@2.3.1:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@@ -688,8 +694,8 @@ packages:
webpack-cli:
optional: true
- ysk-utils@1.0.72:
- resolution: {integrity: sha512-Lum961KknoP/D6gOQ2vpM4qRaH7CZ8LbmHQlsZG0SKUguu09zr79UHpKBVWTem3HMxXqXSOFWSK+PVAyv9TcyQ==}
+ ysk-utils@1.0.78:
+ resolution: {integrity: sha512-Bgr5B3WWiy0nbgL91QVKoVPYm4wt13Rlav757zEjMVRHbmTjwFEhi3wJlYus0JGd52mbknSxXHMazAPHXwA7uQ==}
snapshots:
@@ -1141,6 +1147,8 @@ snapshots:
picomatch@2.3.1: {}
+ pinia-plugin-unistorage@0.1.2: {}
+
punycode@2.3.1: {}
queue-microtask@1.2.3: {}
@@ -1300,7 +1308,7 @@ snapshots:
- esbuild
- uglify-js
- ysk-utils@1.0.72:
+ ysk-utils@1.0.78:
dependencies:
bignumber.js: 9.3.1
loadsh: 0.0.4
diff --git a/static/iconImg/exit.svg b/static/iconImg/exit.svg
new file mode 100644
index 0000000..f38ca8b
--- /dev/null
+++ b/static/iconImg/exit.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/static/iconImg/logo.png b/static/iconImg/logo.png
new file mode 100644
index 0000000..575a9c7
Binary files /dev/null and b/static/iconImg/logo.png differ
diff --git a/static/iconImg/order.svg b/static/iconImg/order.svg
new file mode 100644
index 0000000..1927186
--- /dev/null
+++ b/static/iconImg/order.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/static/iconImg/perpole.svg b/static/iconImg/perpole.svg
new file mode 100644
index 0000000..018ab07
--- /dev/null
+++ b/static/iconImg/perpole.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/static/login/bg.png b/static/login/bg.png
new file mode 100644
index 0000000..2df7567
Binary files /dev/null and b/static/login/bg.png differ
diff --git a/stores/account.js b/stores/account.js
new file mode 100644
index 0000000..fdbf33c
--- /dev/null
+++ b/stores/account.js
@@ -0,0 +1,47 @@
+import { defineStore } from "pinia";
+import { shopStaffInfo } from "@/http/yskApi/account/shopStaff";
+import { login, getCodeImg } from "@/http/yskApi/login.js";
+
+export const useAccountStore = defineStore("account", {
+ state: () => {
+ return {
+ shopInfo: {},
+ //员工信息
+ shopStaff: {},
+ //员工账号
+ staffUserName: "",
+ loginInfo: {},
+ tokenInfo: {},
+ shopId: "",
+ loginType: "",
+ };
+ },
+ getters: {},
+ actions: {
+ //获取员工信息
+ async getShopStaffInfo() {
+ const res = await shopStaffInfo();
+ if (res) {
+ this.shopStaffInfo = res;
+ }
+ },
+ async login(params) {
+ const res = await login(params);
+ if (res) {
+ this.loginInfo = res;
+ this.shopInfo = res.shopInfo;
+ this.tokenInfo = res.tokenInfo;
+ this.shopId = res.shopInfo.id;
+ this.loginType = res.loginType;
+ this.shopStaff = res.shopStaff;
+ this.staffUserName = params.staffUserName
+ uni.setStorageSync("shopInfo", res.shopInfo);
+ uni.setStorageSync("tokenInfo", res.tokenInfo);
+ uni.setStorageSync("shopId", res.shopInfo.id);
+ uni.setStorageSync("loginType", res.loginType);
+ }
+ return res;
+ },
+ },
+ unistorage: true, // 开启后对 state 的数据读写都将持久化
+});
diff --git a/stores/cart.js b/stores/cart.js
index 3ddab8a..0eff5c5 100644
--- a/stores/cart.js
+++ b/stores/cart.js
@@ -1,15 +1,296 @@
// stores/counter.js
-import { defineStore } from 'pinia';
+import { defineStore } from "pinia";
+import yskUtils from "ysk-utils";
+import { getNowCart } from "@/pagesCreateOrder/util.js";
+import * as orderApi from "@/http/api/order.js";
-export const useCounterStore = defineStore('cart', {
- state: () => {
- return {
- selCoupon: [],
- };
- },
- actions: {
- setSelCoupon(coupon) {
- this.selCoupon = coupon
- },
- },
+export function formatCartGoods(goods) {
+ return {
+ ...goods,
+ // 商品单价(会员价或普通价)
+ salePrice: goods.salePrice || goods.price,
+ number: goods.number || goods.num,
+ isGift: goods.isGift || goods.is_gift || 0,
+ is_gift: goods.is_gift || goods.isGift || 0,
+ };
+}
+
+export const useCartStore = defineStore("cart", {
+ state: () => {
+ return {
+ WebsocketUtil: null,
+ //商品列表
+ goodsList: [],
+ //购物车列表
+ cartList: [],
+ //历史订单购物车数据
+ oldCartList: [],
+ //商品map
+ goodsMap: {},
+ //订单数据
+ order: null,
+ // 台桌
+ table: null,
+ //选择的优惠券
+ selCoupon: [],
+ //活动列表
+ activityList: [],
+ // 商家减免,初始配置:默认无减免(固定金额 0 元)
+ merchantReductionConfig: {
+ type: "fixed_amount",
+ fixedAmount: 0,
+ },
+ //积分规则
+ pointDeductionRule: {
+ pointsPerYuan: 0,
+ maxDeductionAmount: Infinity,
+ },
+ //使用积分数量
+ userPoints: 0,
+ //新客立减
+ newUserDiscount: 0,
+ //满减活动
+ fullReductionActivities: [],
+ // 商家霸王餐配置
+ freeDineConfig: null,
+ //店铺信息
+ shopInfo: {
+ tableFee: 0,
+ isTableFee: 0,
+ isMemberPrice: 0,
+ },
+ //店铺用户
+ shopUserInfo: {},
+ //限时折扣
+ limitTimeDiscount: null,
+ //当前点餐类型
+ currentDinnerType: "dine-in",
+ //就餐人数
+ personCount: 0, //就餐人数
+ };
+ },
+ getters: {
+ //餐费费
+ seatFeeConfig: (state) => {
+ return {
+ pricePerPerson: state.shopInfo.tableFee || 0,
+ personCount: state.personCount, //就餐人数
+ isEnabled: !state.shopInfo.isTableFee,
+ };
+ },
+ // 用户是否是会员
+ userIsVip: (state) => {
+ return state.shopUserInfo && state.shopUserInfo.isVip == 1;
+ },
+ //是否使用会员价
+ useVipPrice: (state) => {
+ if (state.shopInfo.isMemberPrice == 1 && state.userIsVip) {
+ return true;
+ }
+ return false;
+ },
+ orderExtraConfig: (state) => {
+ return {
+ // 引用扩展后的商家减免配置
+ merchantReduction: state.merchantReductionConfig,
+ additionalFee: 0,
+ pointDeductionRule: state.pointDeductionRule,
+ seatFeeConfig: state.seatFeeConfig,
+ currentStoreId: "",
+ userPoints: state.userPoints,
+ isMember: state.useVipPrice,
+ memberDiscountRate: 1,
+ newUserDiscount: state.newUserDiscount,
+ fullReductionActivities: state.fullReductionActivities,
+ currentDinnerType: state.currentDinnerType,
+ isFreeDine: false, //霸王餐
+ freeDineConfig: state.freeDineConfig,
+ limitTimeDiscount: state.limitTimeDiscount,
+ shopUserInfo: state.shopUserInfo,
+ };
+ },
+ //全部购物车数据
+ allCartList: (state) => {
+ // return [...state.oldCartList, ...state.cartList];
+ return state.oldCartList;
+ },
+ // 订单费用汇总
+ orderCostSummary: (state) => {
+ const costSummary =
+ yskUtils.OrderPriceCalculator.calculateOrderCostSummary(
+ state.allCartList,
+ state.currentDinnerType,
+ state.selCoupon,
+ state.activityList,
+ state.orderExtraConfig,
+ {},
+ new Date()
+ );
+ console.log(" 订单费用汇总", costSummary);
+ return costSummary;
+ },
+ },
+ actions: {
+ setSelCoupon(coupon) {
+ this.selCoupon = coupon;
+ },
+ /**
+ * 发送消息
+ */
+ sendMessage(message, isAutoAppendDefaultValue = true) {
+ if (!message) {
+ return;
+ }
+ if (!this.WebsocketUtil) {
+ return uni.showToast({
+ title: "socket未连接",
+ icon: "none",
+ });
+ }
+ if (!this.table || !this.table.tableCode) {
+ return uni.showToast({
+ title: "无台桌码",
+ icon: "none",
+ });
+ }
+ if (isAutoAppendDefaultValue) {
+ this.WebsocketUtil.send(
+ JSON.stringify({
+ table_code: this.table.tableCode,
+ shop_id: this.shopInfo.id || uni.getStorageSync("shopInfo").id,
+ account: uni.getStorageSync("tokenInfo").loginId,
+ ...message,
+ type: "pad",
+ })
+ );
+ } else {
+ this.WebsocketUtil.send(
+ JSON.stringify({
+ ...message,
+ })
+ );
+ }
+ },
+ //socket收到消息处理
+ onMessage(message) {
+ if (!message) {
+ return;
+ }
+ let msg = JSON.parse(message);
+ // console.log("socket收到消息", msg);
+ let cartItem;
+ if (msg.msg_id) {
+ this.WebsocketUtil.send(
+ JSON.stringify({
+ type: "receipt",
+ msg_id: msg.msg_id,
+ })
+ );
+ }
+ if (msg.status == 0) {
+ uni.showToast({
+ title: "添加失败",
+ icon: "none",
+ });
+ return false;
+ }
+
+ switch (msg.operate_type) {
+ case "pad_init":
+ this.cartList = msg.data;
+ this.limitTimeDiscount = msg.time_dis_info;
+ break;
+ case "pad_add":
+ case "add":
+ cartItem = getNowCart(msg.data, $goods, pageData.user);
+ cartControls(cartItem, "add");
+ break;
+ case "pad_edit":
+ case "bulk_edit":
+ this.sendMessage({
+ operate_type: "init",
+ });
+ this.getOrder();
+ break;
+ case "edit":
+ getCart();
+ break;
+ case "pad_del":
+ case "del":
+ cartItem = getNowCart(msg.data, $goods, pageData.user);
+ cartControls(cartItem, "del");
+ break;
+ case "pad_cleanup":
+ case "cleanup":
+ goods.list = [];
+ $seatFee.totalNumber = 0;
+ $seatFee.totalAmount = 0;
+ userNumbers.defaultCateIndex = 0;
+ init();
+ break;
+ case "product_update":
+ init();
+ break;
+ case "pad_batch":
+ init();
+ break;
+ }
+ },
+ /**
+ * socket通知购物车商品数量修改处理
+ */
+ cartControls(cartItem, type) {
+ if (!this.table) {
+ this.table = { tableCode: cartItem.table_code };
+ }
+ let cartIndex = 0;
+
+ this.cartList.map((item, index) => {
+ if (item.id == cartItem.id) {
+ cartIndex = index;
+ }
+ });
+
+ if (type == "del") {
+ this.cartList.splice(cartIndex, 1);
+ return;
+ }
+ if (type == "add") {
+ this.cartList.push({ ...cartItem, packNumber: cartItem.pack_number });
+ }
+ if (type == "edit") {
+ this.cartList[cartIndex].number = cartItem.number;
+ this.cartList[cartIndex].pack_number = cartItem.pack_number;
+ this.cartList[cartIndex].packNumber = cartItem.pack_number;
+ }
+ },
+ /**
+ *
+ * @returns 历史订单数据
+ */
+ async getOrder() {
+ const res = await orderApi.getOrderById({ orderId: this.order.id });
+ if (res) {
+ this.setOrder(res);
+ return res;
+ }
+ },
+ /**
+ * 设置历史订单数据,给商品列表赋值
+ */
+ setOrder(order) {
+ this.order = order;
+ this.oldCartList = Object.values(order.detailMap).reduce((pre, cur) => {
+ pre.push(
+ ...cur.map((v) => {
+ const goods = formatCartGoods(v);
+ return { ...goods, isHistory: true };
+ })
+ );
+ return pre;
+ }, []);
+
+ },
+ },
+ unistorage: true, // 开启后对 state 的数据读写都将持久化
});
diff --git a/stores/test.js b/stores/test.js
new file mode 100644
index 0000000..5d9d0c7
--- /dev/null
+++ b/stores/test.js
@@ -0,0 +1,24 @@
+import { defineStore } from "pinia";
+export const useTestStore = defineStore("test", {
+ state: () => {
+ return {
+ a: 2,
+ b:10
+ };
+ },
+ getters:{
+ //a+b
+ sum:(state)=>{
+ return state.a+state.b
+ },
+ //sub*2
+ sub:(state)=>{
+ return state.sum*2
+ }
+ },
+ actions: {
+ increment() {
+ this.count++;
+ },
+ },
+});
\ No newline at end of file