修改代课下单本地测试环境

This commit is contained in:
2024-08-19 17:15:00 +08:00
parent e0be30bd02
commit 51e410a4be
4 changed files with 158 additions and 56 deletions

View File

@@ -5,7 +5,7 @@ ENV = 'development'
# VUE_APP_BASE_API = 'http://192.168.2.42:8000' # VUE_APP_BASE_API = 'http://192.168.2.42:8000'
# VUE_APP_BASE_API = 'http://192.168.2.133:8000' # VUE_APP_BASE_API = 'http://192.168.2.133:8000'
# 测试 # 测试
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn' VUE_APP_BASE_API = 'http://t361017w45.qicp.vip/'
# 生产 # 生产
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn' # VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.96:8000' # VUE_APP_BASE_API = 'http://192.168.2.96:8000'

View File

@@ -3,7 +3,7 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置 # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http # 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http
# 测试 # 测试
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn' VUE_APP_BASE_API = 'http://t361017w45.qicp.vip/'
# 生产 # 生产
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn' # VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.98:8000' # VUE_APP_BASE_API = 'http://192.168.2.98:8000'

View File

@@ -286,7 +286,7 @@ export function $cacheOrder(data) {
*/ */
export function $getCacheOrder(data) { export function $getCacheOrder(data) {
return request({ return request({
url: `/api/place/car`, url: `/api/place/pending/cart`,
method: "get", method: "get",
params:{ params:{
shopId: localStorage.getItem("shopId"), shopId: localStorage.getItem("shopId"),
@@ -295,3 +295,25 @@ export function $getCacheOrder(data) {
}); });
} }
// 会员点单/取消会员点单
export function $setUser(data) {
return request({
url: `/api/place/updateVip`,
method: "delete",
data:{
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 删除订单
export function $delOrder(data) {
return request({
url: `/api/place/order`,
method: "put",
data:{
shopId: localStorage.getItem("shopId"),
...data
}
});
}

View File

@@ -71,7 +71,13 @@
{{ table ? "桌台号:" + table.name : "桌台号/取餐号" }} {{ table ? "桌台号:" + table.name : "桌台号/取餐号" }}
</div> </div>
<el-button @click="clearCart" type="text" size="mini" :disabled="order.list.length<=0">清空</el-button> <el-button
@click="clearCart"
type="text"
size="mini"
:disabled="order.list.length <= 0"
>清空</el-button
>
<!-- <div <!-- <div
class="clear cur-pointer color-000 flex" class="clear cur-pointer color-000 flex"
@click="clearCart" @click="clearCart"
@@ -87,7 +93,11 @@
</div> </div>
<div class="flex row-between"> <div class="flex row-between">
<el-checkbox v-model="order.allPack" :disabled="!this.order.list.length">打包</el-checkbox> <el-checkbox
v-model="order.allPack"
:disabled="!this.order.list.length"
>打包</el-checkbox
>
<div class="flex"> <div class="flex">
<span class="color-666" style="margin-right: 5px" <span class="color-666" style="margin-right: 5px"
>{{ allNumber }}</span >{{ allNumber }}</span
@@ -108,24 +118,47 @@
<span>加菜/返回</span> <span>加菜/返回</span>
</button> </button>
<div style="width: 15px"></div> <div style="width: 15px"></div>
<button class="my-btn flex-1 success" @click="payOrder">
<span>立即支付</span>
</button>
</template> </template>
<template v-else>
<el-dropdown
split-button
size="medium"
type="success"
@command="changeIsPrint"
>
{{ isPrint ? "下单并打印制作单" : "仅下单(不打印)" }}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="false"
>仅下单(不打印)</el-dropdown-item
>
<el-dropdown-item :command="true"
>下单并打印制作单</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
<div style="width: 15px"></div>
<div class="flex-1">
<el-button
size="medium"
:disabled="!order.list.length"
@click="createOrderShow"
>
去结账
</el-button>
</div>
<button <!-- <button
v-if="!isCreateOrder"
class="my-btn flex-1 success" class="my-btn flex-1 success"
:class="{ disabled: !order.list.length }" :class="{ disabled: !order.list.length }"
:disabled="!order.list.length" :disabled="!order.list.length"
@click="createOrderShow" @click="createOrderShow"
> >
<span>去结账</span> <span>去结账</span>
</button> </button> -->
<button </template>
v-else
class="my-btn flex-1 success"
@click="payOrder"
>
<span>立即支付</span>
</button>
</div> </div>
<!-- <div class="flex mt-14"> <!-- <div class="flex mt-14">
@@ -369,7 +402,7 @@
(goods.query.categoryId !== '') & (goods.query.categoryId !== '') &
(goods.query.categoryId != item.categoryId), (goods.query.categoryId != item.categoryId),
}" }"
@click="addCart(item)" @click="goodsClick(item)"
v-for="(item, index) in goods.list" v-for="(item, index) in goods.list"
:key="index" :key="index"
> >
@@ -697,7 +730,7 @@
<div class="tollli_index">{{ index + 1 }}</div> <div class="tollli_index">{{ index + 1 }}</div>
<div class="tollli_price">{{ item.totalAmount }}</div> <div class="tollli_price">{{ item.totalAmount }}</div>
<div class="tollli_time_and_num"> <div class="tollli_time_and_num">
<div class="tollli_time">{{ item.created_at ||''}}</div> <div class="tollli_time">{{ item.created_at || "" }}</div>
<div class="tollli_num">({{ item.totalNumber }})</div> <div class="tollli_num">({{ item.totalNumber }})</div>
</div> </div>
</div> </div>
@@ -771,7 +804,10 @@ import {
$allPack, $allPack,
$createOrder, $createOrder,
$getMasterId, $getMasterId,
$cacheOrder,$getCacheOrder $cacheOrder,
$getCacheOrder,
$delOrder,
$setUser
} from "@/api/table"; } from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop"; import { tbShopCategoryGet } from "@/api/shop";
function returnReverseVal(val, isReturnString = true) { function returnReverseVal(val, isReturnString = true) {
@@ -796,6 +832,8 @@ export default {
}, },
data() { data() {
return { return {
//是否打印
isPrint: false,
// 备注 // 备注
note: { note: {
content: "", content: "",
@@ -1001,9 +1039,18 @@ export default {
}, },
}, },
watch: { watch: {
"vipUser.id":function(val){
$setUser({
tableId:this.table.tableId,
masterId:this.masterId,
vipUserId:val,
type:val===''?1:0
})
},
"prveOrder.list.length": function (val) { "prveOrder.list.length": function (val) {
if (val !== 0) { if (val !== 0) {
this.prveOrder.selCart = this.prveOrder.list[this.prveOrder.sel].carList; this.prveOrder.selCart =
this.prveOrder.list[this.prveOrder.sel].carList;
} else { } else {
this.prveOrder.selCart = []; this.prveOrder.selCart = [];
} }
@@ -1011,10 +1058,12 @@ export default {
}, },
"prveOrder.sel": function (val) { "prveOrder.sel": function (val) {
this.prveOrder.selCart = this.prveOrder.selCart =
this.prveOrder.list.length !== 0 ? this.prveOrder.list[val].carList : []; this.prveOrder.list.length !== 0
? this.prveOrder.list[val].carList
: [];
console.log(this.prveOrder.selCart); console.log(this.prveOrder.selCart);
if (val < 0) { if (val < 0) {
this.prveOrde.show=false this.prveOrde.show = false;
} }
}, },
// 本地缓存版本 // 本地缓存版本
@@ -1119,6 +1168,11 @@ export default {
this.getCategory(); this.getCategory();
}, },
methods: { methods: {
//改变是否打印
changeIsPrint(e) {
console.log(e);
this.isPrint = e;
},
refOrderNoteConfirm(note) { refOrderNoteConfirm(note) {
this.note.content = note; this.note.content = note;
}, },
@@ -1310,7 +1364,7 @@ export default {
//选择挂单确认 //选择挂单确认
async confirmChoosePrveOrder() { async confirmChoosePrveOrder() {
if (this.prveOrder.list.length <= 0) { if (this.prveOrder.list.length <= 0) {
return return;
} }
// const { sel } = this.prveOrder; // const { sel } = this.prveOrder;
// const order=this.prveOrder.list[sel]; // const order=this.prveOrder.list[sel];
@@ -1320,6 +1374,14 @@ export default {
// tableId:this.table.tableId, // tableId:this.table.tableId,
// masterId:order.carList[0].masterId // masterId:order.carList[0].masterId
// }) // })
const {masterId,tableId,userId}= await $cacheOrder({orderId:this.prveOrder.list[this.prveOrder.sel].orderId,isPending:false})
getCart({
masterId,
tableId,
vipUserId:userId?userId:''
})
return
this.order.list = this.prveOrder.list[this.prveOrder.sel].carList; this.order.list = this.prveOrder.list[this.prveOrder.sel].carList;
this.delPrveOrder(); this.delPrveOrder();
this.prveOrder.show = false; this.prveOrder.show = false;
@@ -1328,12 +1390,11 @@ export default {
async delPrveOrder() { async delPrveOrder() {
const { sel } = this.prveOrder; const { sel } = this.prveOrder;
const order = this.prveOrder.list[sel]; const order = this.prveOrder.list[sel];
const res=await $cacheOrder({ const res = await $delOrder({
orderId:order.orderId, orderId: order.orderId
isPending:false });
})
this.$notify({ this.$notify({
message: '删除成功', message: "删除成功",
type: "success", type: "success",
}); });
this.prveOrder.list.splice(sel, 1); this.prveOrder.list.splice(sel, 1);
@@ -1345,8 +1406,8 @@ export default {
//获取挂起订单 //获取挂起订单
async getCacheOrder() { async getCacheOrder() {
const res = await $getCacheOrder(); const res = await $getCacheOrder();
console.log(res) console.log(res);
this.prveOrder.list=res this.prveOrder.list = res;
}, },
async saveOrder() { async saveOrder() {
const res = await $cacheOrder({ const res = await $cacheOrder({
@@ -1360,8 +1421,8 @@ export default {
const masterId = await this.getMasterId(); const masterId = await this.getMasterId();
this.masterId = masterId; this.masterId = masterId;
this.$nextTick(() => { this.$nextTick(() => {
this.getCacheOrder() this.getCacheOrder();
}) });
}, },
// 删除购物车商品 // 删除购物车商品
removeCart() { removeCart() {
@@ -1427,7 +1488,7 @@ export default {
}, },
clearCart() { clearCart() {
if (this.order.list.length <= 0) { if (this.order.list.length <= 0) {
return return;
} }
this.$confirm("确定要清空点餐列表吗?", "提示", { this.$confirm("确定要清空点餐列表吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
@@ -1608,6 +1669,7 @@ export default {
this.note.content = ""; this.note.content = "";
this.vipUser = { id: "" }; this.vipUser = { id: "" };
this.allPack = false; this.allPack = false;
this.note.content = "";
}, },
//获取购物车数据 //获取购物车数据
async getCart() { async getCart() {
@@ -1652,7 +1714,8 @@ export default {
this.selGoods.title = item.name; this.selGoods.title = item.name;
this.selGoods.show = true; this.selGoods.show = true;
}, },
async addCart(item) { //根据右侧商品单规格多规格做不同处理
async goodsClick(item) {
if (item.typeEnum === "sku") { if (item.typeEnum === "sku") {
this.selGoods.data = item; this.selGoods.data = item;
this.selGoods.skuMap = {}; this.selGoods.skuMap = {};
@@ -1662,6 +1725,7 @@ export default {
} }
console.log(this.selGoods.skuMap); console.log(this.selGoods.skuMap);
let specSnap = ""; let specSnap = "";
// const canBudyGoods=specList.filter(v=>v)
this.selGoods.skuList = JSON.parse(item.skuResult.tagSnap).map((v) => { this.selGoods.skuList = JSON.parse(item.skuResult.tagSnap).map((v) => {
const values = v.value.split(","); const values = v.value.split(",");
specSnap += values[0] + ","; specSnap += values[0] + ",";
@@ -1732,7 +1796,7 @@ export default {
this.masterId = res.masterId; this.masterId = res.masterId;
this.getCart(); this.getCart();
// this.getPrveCart(); // this.getPrveCart();
this.getCacheOrder() this.getCacheOrder();
}, },
close() { close() {
this.informationdialogshow = false; this.informationdialogshow = false;
@@ -1807,6 +1871,21 @@ input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
} }
::v-deep .el-button--success {
background: #22bf64;
color: #fff;
}
::v-deep .el-tag--dark .el-tag--success {
background: #22bf64;
color: #fff;
}
::v-deep .flex-1 .el-button{
width: 100%;
}
::v-deep .el-button--medium {
padding-top: 12px;
padding-bottom: 12px;
}
::v-deep .number-box .el-input__inner::-webkit-inner-spin-button { ::v-deep .number-box .el-input__inner::-webkit-inner-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
@@ -1826,6 +1905,7 @@ input[type="number"]::-webkit-outer-spin-button {
margin-left: 10px; margin-left: 10px;
} }
} }
.lh-16 { .lh-16 {
line-height: 16px; line-height: 16px;
} }