This commit is contained in:
YeMingfei666 2024-10-25 18:21:21 +08:00
commit 516ce90284
10 changed files with 673 additions and 281 deletions

View File

@ -5,7 +5,10 @@ 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 = 'https://admintestpapi.sxczgkj.cn'
#预发布
VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
# 生产 # 生产
# 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,13 +3,13 @@ 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 = 'https://admintestpapi.sxczgkj.cn'
# 生产 # 生产
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn' # VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
# 预发布接口 # 预发布接口
# VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn' VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.98:8000' # VUE_APP_BASE_API = 'http://192.168.2.98:8000'
# 如果接口是 http 形式, wss 需要改为 ws # 如果接口是 http 形式, wss 需要改为 ws

View File

@ -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
}
});
}

View File

@ -130,12 +130,14 @@
{{ scope.row.priceAmount }} {{ scope.row.priceAmount }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <!-- <el-table-column label="操作">
<template v-slot="scope"> <template v-slot="scope">
<el-button v-if="detail.status=='closed'" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button> <template v-if="scope.row.status!='refund'">
<el-button v-if="detail.status=='closed'||detail.status=='refund'" type="text" size="mini" @click="tuikuan(scope.row)"><span >退款</span></el-button>
</template>
<el-button v-if="detail.status=='unpaid'" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button> <el-button v-if="detail.status=='unpaid'" type="text" size="mini" @click="tuiCai(scope.row)"><span >退菜</span></el-button>
</template> </template>
</el-table-column> </el-table-column> -->
</el-table> </el-table>
</div> </div>
<!-- </el-tab-pane> --> <!-- </el-tab-pane> -->

View File

@ -790,7 +790,7 @@ export default {
this.form.selectSpec = JSON.stringify(this.selectSpec); this.form.selectSpec = JSON.stringify(this.selectSpec);
this.form.specTableHeaders = JSON.stringify(this.specTableHeaders); this.form.specTableHeaders = JSON.stringify(this.specTableHeaders);
this.form.specInfo = JSON.stringify(this.form.skuList); this.form.specInfo = JSON.stringify(this.form.skuList);
this.form.skuList[0].costPrice = 0 // this.form.skuList[0].costPrice = 0
this.form.skuList[0].originPrice = this.form.skuList[0].salePrice this.form.skuList[0].originPrice = this.form.skuList[0].salePrice
if (this.form.id) { if (this.form.id) {
await tbProductPut(this.form); await tbProductPut(this.form);

View File

@ -17,9 +17,18 @@
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="btn_wrap"> <div class="btn_wrap" v-if="!form.list.length">
<div class="btn"> <div class="btn">
<el-button>一键生成菜单</el-button> <el-button @click="oneClick">一键生成菜单</el-button>
</div>
</div>
<div class="goods_list" v-else>
<div class="btn_wrap" :class="[`div${index + 1}`]" v-for="(item, index) in form.list"
:key="index" @click="selectGoods(item)">
<div class="info" :class="{ active: item.active }">
<span class="t1">{{ item.name }}</span>
<span class="t1">{{ item.lowPrice }}</span>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -43,6 +52,7 @@
<script> <script>
import shopList from '@/components/shopList/index.vue' import shopList from '@/components/shopList/index.vue'
import { tbProduct } from '@/api/shop.js'
import { layoutlist, productGroup, productCategoryDetail, productGroupPut } from '@/api/pad.js' import { layoutlist, productGroup, productCategoryDetail, productGroupPut } from '@/api/pad.js'
export default { export default {
components: { shopList }, components: { shopList },
@ -71,9 +81,58 @@ export default {
this.layoutlist() this.layoutlist()
}, },
methods: { methods: {
//
selectGoods(item) {
item.active = !item.active
},
//
async oneClick() {
try {
const res = await tbProduct({
categoryId: this.category,
page: 0,
size: 20,
sort: "id",
shopId: localStorage.getItem('shopId')
})
this.form.list = res.content.map((item, index) => {
if (index == 0 || index == 12) {
item.active = true
} else {
item.active = false
}
return item
})
} catch (error) {
console.log(error);
}
},
// //
async submitHandle() { async submitHandle() {
try { try {
if (this.typeList.find(item => item.id == this.typeListActive).code == 'text-menu') {
if (!this.form.list.length) {
this.$notify.error({
title: '错误',
message: '请生成菜单'
})
return
}
}
let isEmpty = true
this.form.list.map(item => {
if (!item.id) isEmpty = false
})
if (!isEmpty) {
this.$notify.error({
title: '错误',
message: '请添加商品'
})
return
}
this.loading = true this.loading = true
let res = null let res = null
if (this.form.id) { if (this.form.id) {
@ -99,7 +158,17 @@ export default {
}) })
} }
this.loading = false this.loading = false
this.$message.success(this.form.id ? '编辑成功' : '添加成功') if (this.form.id) {
this.$notify.success({
title: '提示',
message: '编辑成功'
})
} else {
this.$notify.success({
title: '提示',
message: '添加成功'
})
}
this.dialogVisible = false this.dialogVisible = false
this.$emit('success') this.$emit('success')
} catch (error) { } catch (error) {
@ -264,9 +333,139 @@ export default {
} }
} }
&.type6 {
.goods_list {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(10, 1fr);
grid-column-gap: 20px;
grid-row-gap: 0px;
.div1 {
grid-area: 1 / 1 / 2 / 2;
}
.div2 {
grid-area: 2 / 1 / 3 / 2;
}
.div3 {
grid-area: 3 / 1 / 4 / 2;
}
.div4 {
grid-area: 4 / 1 / 5 / 2;
}
.div5 {
grid-area: 5 / 1 / 6 / 2;
}
.div6 {
grid-area: 6 / 1 / 7 / 2;
}
.div7 {
grid-area: 7 / 1 / 8 / 2;
}
.div8 {
grid-area: 8 / 1 / 9 / 2;
}
.div9 {
grid-area: 9 / 1 / 10 / 2;
}
.div10 {
grid-area: 10 / 1 / 11 / 2;
}
.div11 {
grid-area: 1 / 2 / 2 / 3;
}
.div12 {
grid-area: 2 / 2 / 3 / 3;
}
.div13 {
grid-area: 3 / 2 / 4 / 3;
}
.div14 {
grid-area: 4 / 2 / 5 / 3;
}
.div15 {
grid-area: 5 / 2 / 6 / 3;
}
.div16 {
grid-area: 6 / 2 / 7 / 3;
}
.div17 {
grid-area: 7 / 2 / 8 / 3;
}
.div18 {
grid-area: 8 / 2 / 9 / 3;
}
.div19 {
grid-area: 9 / 2 / 10 / 3;
}
.div20 {
grid-area: 10 / 2 / 11 / 3;
}
}
}
.goods_list {
height: 100%;
}
.btn_wrap { .btn_wrap {
flex: 1; flex: 1;
height: 100%; height: 100%;
position: relative;
.info {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #ececec;
padding: 0 20px;
font-size: 16px;
font-weight: bold;
overflow: hidden;
&.active {
background-color: #BC1414;
color: #fff;
&::after {
content: "";
width: 120px;
height: 60px;
border: 22px solid #fff;
border-top: none;
border-right: none;
opacity: .3;
position: absolute;
top: -20px;
right: 10%;
transform: rotate(-45deg);
}
}
}
.btn { .btn {
height: 100%; height: 100%;

View File

@ -97,7 +97,10 @@ export default {
if (this.selectCatory.id) { if (this.selectCatory.id) {
this.$refs.AddPadPage.show() this.$refs.AddPadPage.show()
} else { } else {
this.$message.warning('请选择分类') this.$notify.error({
title: '错误',
message: '请选择分类'
})
} }
}, },
// //

View File

@ -118,6 +118,7 @@ export default {
number: "0", number: "0",
show: false, show: false,
timer: null, timer: null,
payPar:{}
}; };
}, },
watch: { watch: {
@ -136,17 +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,
function (error) {
console.log(error);
}
);
});
} }
}, },
number(newval) { number(newval) {
@ -192,14 +186,28 @@ export default {
this.close(); this.close();
this.$emit("confirm", this.form.code); this.$emit("confirm", this.form.code);
}, },
open() { getPayUrl(){
this.show = true; $getOrderPayUrl(this.payPar).then((res) => {
this.form.money = Number(this.price).toFixed(2);
if (this.openSwitch) {
$getOrderPayUrl({ orderId: this.order.id,payAmount:this.price.toFixed(2) }).then((res) => {
console.log(res); console.log(res);
this.paymentQrcode = res; this.paymentQrcode = res;
this.$nextTick(() => {
QRCode.toCanvas(
this.$refs.canvas,
this.paymentQrcode,{width: 160,
height: 160,},
function (error) {
console.log(error);
}
);
}); });
});
},
open(data) {
this.show = true;
this.form.money = Number(this.price).toFixed(2);
this.payPar=data
if (this.openSwitch) {
// this.getPayUrl();
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.refInputCode.focus(); this.$refs.refInputCode.focus();

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,17 @@
//判断商品是否可以下单 //判断商品是否可以下单
export function isCanBuy(goods,isStock) { export function isCanBuy(skuGoods,goods) {
return goods.isGrounding && goods.isPauseSale == 0 && (isStock?goods.stockNumber > 0:true) ; if(goods.typeEnum=='normal'){
//单规格
return goods.isGrounding&&goods.isPauseSale==0&&(goods.isStock?goods.stockNumber>0:true);
}else{
//多规格
return goods.isGrounding&&goods.isPauseSale==0&&skuGoods.isGrounding&&skuGoods.isPauseSale==0&&(goods.isStock?goods.stockNumber>0:true);
}
}
//字符匹配
export function $strMatch(matchStr,str){
return matchStr.toLowerCase().includes(str.toLowerCase())
} }
// 一个数组是否包含另外一个数组全部元素 // 一个数组是否包含另外一个数组全部元素
@ -15,6 +26,8 @@ export function arrayContainsAll(arr1, arr2) {
//n项 n-1项组合生成全部结果 //n项 n-1项组合生成全部结果
export function generateCombinations(arr, k) { export function generateCombinations(arr, k) {
console.log(arr)
console.log(k)
let result = []; let result = [];
function helper(index, current) { function helper(index, current) {