增加无台桌下单切换台桌
This commit is contained in:
parent
c473f30a37
commit
709036c050
|
|
@ -450,3 +450,14 @@ export function $returnOrder(data) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
//获取台桌详情状态
|
||||||
|
export function $returnTableDetail(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/tbShopTable/state',
|
||||||
|
method: "get",
|
||||||
|
params:{
|
||||||
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,7 @@ export default {
|
||||||
number: "0",
|
number: "0",
|
||||||
show: false,
|
show: false,
|
||||||
timer: null,
|
timer: null,
|
||||||
|
payPar:{}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -136,18 +137,10 @@ export default {
|
||||||
this.$refs.refInputCode.focus();
|
this.$refs.refInputCode.focus();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
this.getPayUrl()
|
||||||
this.tips = "请用户使用微信/支付宝扫描付款码";
|
this.tips = "请用户使用微信/支付宝扫描付款码";
|
||||||
this.startGetOrderInfo();
|
this.startGetOrderInfo();
|
||||||
this.$nextTick(() => {
|
|
||||||
QRCode.toCanvas(
|
|
||||||
this.$refs.canvas,
|
|
||||||
this.paymentQrcode,{width: 160,
|
|
||||||
height: 160,},
|
|
||||||
function (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
number(newval) {
|
number(newval) {
|
||||||
|
|
@ -193,14 +186,28 @@ export default {
|
||||||
this.close();
|
this.close();
|
||||||
this.$emit("confirm", this.form.code);
|
this.$emit("confirm", this.form.code);
|
||||||
},
|
},
|
||||||
|
getPayUrl(){
|
||||||
|
$getOrderPayUrl(this.payPar).then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
this.paymentQrcode = res;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
QRCode.toCanvas(
|
||||||
|
this.$refs.canvas,
|
||||||
|
this.paymentQrcode,{width: 160,
|
||||||
|
height: 160,},
|
||||||
|
function (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
open(data) {
|
open(data) {
|
||||||
this.show = true;
|
this.show = true;
|
||||||
this.form.money = Number(this.price).toFixed(2);
|
this.form.money = Number(this.price).toFixed(2);
|
||||||
|
this.payPar=data
|
||||||
if (this.openSwitch) {
|
if (this.openSwitch) {
|
||||||
$getOrderPayUrl({ orderId: this.order.id||data.id,payAmount:this.form.money||data.settlementAmount }).then((res) => {
|
// this.getPayUrl();
|
||||||
console.log(res);
|
|
||||||
this.paymentQrcode = res;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.refInputCode.focus();
|
this.$refs.refInputCode.focus();
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
@click="changeTable(item, index)"
|
@click="changeTable(item, index)"
|
||||||
>
|
>
|
||||||
<span> {{ item.name }}</span>
|
<span> {{ item.name }}</span>
|
||||||
<span :style="{ color: status[item.status].type }">
|
<span :style="{ color: returnTableColor(item.status) }">
|
||||||
{{
|
{{
|
||||||
status[item.status] ? status[item.status].label : ""
|
status[item.status] ? status[item.status].label : ""
|
||||||
}}</span
|
}}</span
|
||||||
|
|
@ -759,9 +759,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="u-m-t-20 color-999 text-center">{{
|
<div class="u-m-t-20 color-999 text-center">
|
||||||
goods.status=='end'?'没有更多了':'加载中'
|
{{ goods.status == "end" ? "没有更多了" : "加载中" }}
|
||||||
}}</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
class="no-search-result"
|
class="no-search-result"
|
||||||
|
|
@ -1255,6 +1255,7 @@ import {
|
||||||
$printOrder,
|
$printOrder,
|
||||||
tbShopTableGet,
|
tbShopTableGet,
|
||||||
$changeUseType,
|
$changeUseType,
|
||||||
|
$returnTableDetail,
|
||||||
} from "@/api/table";
|
} from "@/api/table";
|
||||||
import { tbShopCategoryGet } from "@/api/shop";
|
import { tbShopCategoryGet } from "@/api/shop";
|
||||||
import {
|
import {
|
||||||
|
|
@ -1307,6 +1308,11 @@ export default {
|
||||||
},
|
},
|
||||||
//台桌列表
|
//台桌列表
|
||||||
tableList: [],
|
tableList: [],
|
||||||
|
//台桌参数
|
||||||
|
tableQuery: {
|
||||||
|
page: 1,
|
||||||
|
size: 20,
|
||||||
|
},
|
||||||
tableShow: false,
|
tableShow: false,
|
||||||
status: $status,
|
status: $status,
|
||||||
//就餐人数
|
//就餐人数
|
||||||
|
|
@ -1355,7 +1361,7 @@ export default {
|
||||||
informationdialogshow: false,
|
informationdialogshow: false,
|
||||||
informationdialogshowedit: false,
|
informationdialogshowedit: false,
|
||||||
goods: {
|
goods: {
|
||||||
status:'loadmore',//loadmore end
|
status: "loadmore", //loadmore end
|
||||||
list: [],
|
list: [],
|
||||||
query: {
|
query: {
|
||||||
productId: "",
|
productId: "",
|
||||||
|
|
@ -1637,7 +1643,7 @@ export default {
|
||||||
"goods.query.categoryId": function (newval) {
|
"goods.query.categoryId": function (newval) {
|
||||||
this.goods.query.page = 1;
|
this.goods.query.page = 1;
|
||||||
this.goods.list = [];
|
this.goods.list = [];
|
||||||
this.goods.status='loadmore'
|
this.goods.status = "loadmore";
|
||||||
this.getGoods();
|
this.getGoods();
|
||||||
},
|
},
|
||||||
"useTypes.sel": function (newval, oldval) {
|
"useTypes.sel": function (newval, oldval) {
|
||||||
|
|
@ -1799,6 +1805,10 @@ export default {
|
||||||
this.open(this.$route.query.tableId ? this.$route.query : "");
|
this.open(this.$route.query.tableId ? this.$route.query : "");
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
returnTableColor(key) {
|
||||||
|
const item = $status[key];
|
||||||
|
return item ? item.type : "";
|
||||||
|
},
|
||||||
loadMoreGoods() {
|
loadMoreGoods() {
|
||||||
if (this.goods.query.page * this.goods.query.size < this.goods.total) {
|
if (this.goods.query.page * this.goods.query.size < this.goods.total) {
|
||||||
this.goods.query.page = this.goods.query.page + 1;
|
this.goods.query.page = this.goods.query.page + 1;
|
||||||
|
|
@ -1919,10 +1929,10 @@ export default {
|
||||||
if (!canJiesuan) {
|
if (!canJiesuan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.returnCreateOrderData();
|
const order= await this.returnCreateOrderData();
|
||||||
console.log(this.createOrder.data);
|
console.log(this.createOrder.data);
|
||||||
this.order.payType = "scanCode";
|
this.order.payType = "scanCode";
|
||||||
this.payTypeItemClick({ payType: "scanCode" });
|
this.payTypeItemClick({ payType: "scanCode",order });
|
||||||
this.payBeforeClear();
|
this.payBeforeClear();
|
||||||
},
|
},
|
||||||
async changeOrderUseType(useType) {
|
async changeOrderUseType(useType) {
|
||||||
|
|
@ -2075,6 +2085,7 @@ export default {
|
||||||
async getTable() {
|
async getTable() {
|
||||||
try {
|
try {
|
||||||
const { content, total } = await tbShopTableGet({
|
const { content, total } = await tbShopTableGet({
|
||||||
|
...this.tableQuery,
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
});
|
});
|
||||||
this.tableList = content.filter(
|
this.tableList = content.filter(
|
||||||
|
|
@ -2084,7 +2095,40 @@ export default {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeTable(item) {
|
async changeTable(item) {
|
||||||
|
if(this.table||this.order.list.length<=0){
|
||||||
|
this.table = item;
|
||||||
|
this.tableShow = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(item.status!='idle'){
|
||||||
|
return this.$message.error("该台桌已在使用中");
|
||||||
|
}
|
||||||
|
const res = await $returnTableDetail({
|
||||||
|
tableId: item.tableId,
|
||||||
|
});
|
||||||
|
let res1 = null;
|
||||||
|
if (res.cartCount > 0) {
|
||||||
|
try {
|
||||||
|
res1 = await this.$confirm(
|
||||||
|
"该台桌购物车里有商品,是否清除该台桌里的商品?",
|
||||||
|
"提示",
|
||||||
|
{
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
await $choseTable({
|
||||||
|
masterId: this.masterId,
|
||||||
|
tableId: item.tableId,
|
||||||
|
isClear: res1 == "confirm" ? true : false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.table = item;
|
this.table = item;
|
||||||
this.tableShow = false;
|
this.tableShow = false;
|
||||||
},
|
},
|
||||||
|
|
@ -2100,9 +2144,10 @@ export default {
|
||||||
}
|
}
|
||||||
this.pays();
|
this.pays();
|
||||||
},
|
},
|
||||||
payTypeItemClick(item) {
|
payTypeItemClick(item,order) {
|
||||||
console.log(item);
|
order=order?order:this.createOrder.data;
|
||||||
console.log(this.vipUser.id);
|
console.log('--------order------')
|
||||||
|
console.log(order)
|
||||||
if (item.payType == "vipPay") {
|
if (item.payType == "vipPay") {
|
||||||
return this.refChooseUserOpen();
|
return this.refChooseUserOpen();
|
||||||
}
|
}
|
||||||
|
|
@ -2112,7 +2157,7 @@ export default {
|
||||||
}
|
}
|
||||||
if (item.payType == "scanCode") {
|
if (item.payType == "scanCode") {
|
||||||
//扫码支付
|
//扫码支付
|
||||||
return this.refToggle("refWxScanCode", true, this.createOrder.data);
|
return this.refToggle("refWxScanCode", true, {orderId:order.id,payAmount: (this.createOrder.data.amount * order.discount).toFixed(2)});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ChangeDiscount(discount) {
|
ChangeDiscount(discount) {
|
||||||
|
|
@ -2246,7 +2291,7 @@ export default {
|
||||||
return this.refChooseUserOpen();
|
return this.refChooseUserOpen();
|
||||||
}
|
}
|
||||||
if (this.order.payType == "scanCode") {
|
if (this.order.payType == "scanCode") {
|
||||||
return this.refToggle("refWxScanCode", true, this.createOrder.data);
|
return this.refToggle("refWxScanCode", true, {orderId:this.createOrder.data.id,payAmount: (this.createOrder.data.amount * this.createOrder.discount).toFixed(2)});
|
||||||
}
|
}
|
||||||
if (this.order.payType == "deposit") {
|
if (this.order.payType == "deposit") {
|
||||||
return this.refToggle("refScanCode", true);
|
return this.refToggle("refScanCode", true);
|
||||||
|
|
@ -3168,10 +3213,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getGoods() {
|
async getGoods() {
|
||||||
if(this.goods.status=='end'){
|
if (this.goods.status == "end") {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
this.goods.status='loadmore'
|
this.goods.status = "loadmore";
|
||||||
const res = await getGoodsLists(this.goods.query);
|
const res = await getGoodsLists(this.goods.query);
|
||||||
let $goodsMap = {};
|
let $goodsMap = {};
|
||||||
const goods = res.records.filter((v) => {
|
const goods = res.records.filter((v) => {
|
||||||
|
|
@ -3190,7 +3235,8 @@ export default {
|
||||||
for (let i in goods) {
|
for (let i in goods) {
|
||||||
this.goods.list.push(goods[i]);
|
this.goods.list.push(goods[i]);
|
||||||
}
|
}
|
||||||
this.goods.status= this.goods.list.length>=res.total ? 'end' : 'loadmore'
|
this.goods.status =
|
||||||
|
this.goods.list.length >= res.total ? "end" : "loadmore";
|
||||||
this.goods.total = res.total;
|
this.goods.total = res.total;
|
||||||
this.$goodsData = goods;
|
this.$goodsData = goods;
|
||||||
},
|
},
|
||||||
|
|
@ -3246,7 +3292,7 @@ export default {
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
if (this.table.tableId) {
|
if (this.table.tableId) {
|
||||||
this.$router.replace({ path: "/table/table_list" });
|
this.$router.replace({ path: "/tool/table_list" });
|
||||||
} else {
|
} else {
|
||||||
this.$router.go(0);
|
this.$router.go(0);
|
||||||
// this.reset();
|
// this.reset();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue