Merge branch 'test' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into test
This commit is contained in:
commit
99da7fcf5a
|
|
@ -5,7 +5,10 @@ ENV = 'development'
|
|||
# VUE_APP_BASE_API = 'http://192.168.2.42: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 = 'http://192.168.2.96:8000'
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ ENV = 'production'
|
|||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 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://pre-cashieradmin.sxczgkj.cn'
|
||||
VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.98:8000'
|
||||
# 如果接口是 http 形式, wss 需要改为 ws
|
||||
|
|
|
|||
|
|
@ -69,3 +69,15 @@ export function productGroupPut(data) {
|
|||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 拖动排序
|
||||
* @returns
|
||||
*/
|
||||
export function productCategorySort(data) {
|
||||
return request({
|
||||
url: "/api/pad/productCategory/sort",
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -438,3 +438,15 @@ export function formatDecimal(num = 0, decimal = 2, isInt = false) {
|
|||
return parseFloat(num).toFixed(decimal);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 传入数组,以及要交换位置的2个元素的下标
|
||||
* @param {*} arr
|
||||
* @param {*} i1
|
||||
* @param {*} i2
|
||||
* @returns
|
||||
*/
|
||||
export function swapArrayEle(arr, i1, i2) {
|
||||
arr[i1] = arr.splice(i2, 1, arr[i1])[0];
|
||||
return arr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
<template>
|
||||
<div>会员积分</div>
|
||||
</template>
|
||||
|
|
@ -130,12 +130,14 @@
|
|||
¥{{ scope.row.priceAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<!-- <el-table-column label="操作">
|
||||
<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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- </el-tab-pane> -->
|
||||
|
|
|
|||
|
|
@ -790,7 +790,7 @@ export default {
|
|||
this.form.selectSpec = JSON.stringify(this.selectSpec);
|
||||
this.form.specTableHeaders = JSON.stringify(this.specTableHeaders);
|
||||
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
|
||||
if (this.form.id) {
|
||||
await tbProductPut(this.form);
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@
|
|||
<el-form-item label="分类图片">
|
||||
<uploadImg ref="uploadImg" @success="res => form.pic = res[0]" @remove="form.pic = ''" />
|
||||
</el-form-item>
|
||||
<el-form-item label="颜色标识">
|
||||
<!-- <el-form-item label="颜色标识">
|
||||
<el-color-picker v-model="form.style"></el-color-picker>
|
||||
<div style="color: #999;">
|
||||
标识色用在无图模式时的商品点单按钮显示,可以更有效的从视觉.上进行商品分组。
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="开关">
|
||||
<el-switch v-model="form.isShow" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
|
|
|
|||
|
|
@ -17,9 +17,18 @@
|
|||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="btn_wrap">
|
||||
<div class="btn_wrap" v-if="!form.list.length">
|
||||
<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>
|
||||
</template>
|
||||
|
|
@ -43,6 +52,7 @@
|
|||
|
||||
<script>
|
||||
import shopList from '@/components/shopList/index.vue'
|
||||
import { tbProduct } from '@/api/shop.js'
|
||||
import { layoutlist, productGroup, productCategoryDetail, productGroupPut } from '@/api/pad.js'
|
||||
export default {
|
||||
components: { shopList },
|
||||
|
|
@ -71,9 +81,58 @@ export default {
|
|||
this.layoutlist()
|
||||
},
|
||||
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() {
|
||||
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
|
||||
let res = null
|
||||
if (this.form.id) {
|
||||
|
|
@ -99,7 +158,17 @@ export default {
|
|||
})
|
||||
}
|
||||
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.$emit('success')
|
||||
} 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 {
|
||||
flex: 1;
|
||||
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 {
|
||||
height: 100%;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<div class="app-container">
|
||||
<div class="left_menu">
|
||||
<div class="search_wrap">
|
||||
<el-input placeholder="名称/代码" v-model="query.name">
|
||||
<el-button slot="append" icon="el-icon-search"></el-button>
|
||||
<el-input placeholder="名称/代码" v-model="query.name" @change="searchCateory">
|
||||
<el-button slot="append" icon="el-icon-search" @click="searchCateory"></el-button>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="tree_wrap">
|
||||
|
|
@ -15,16 +15,18 @@
|
|||
<div class="header_wrap">
|
||||
<el-button type="primary" @click="addHandle">新建</el-button>
|
||||
</div>
|
||||
<div class="table">
|
||||
<el-table :data="tableData.list" border height="100%" v-loading="tableData.loading">
|
||||
<div class="table" id="table_drag">
|
||||
<el-table ref="table" :data="tableData.list" border height="100%" v-loading="tableData.loading"
|
||||
row-key="id">
|
||||
<el-table-column label="序号" type="index"></el-table-column>
|
||||
<el-table-column label="ID" prop="id" width="80"></el-table-column>
|
||||
<el-table-column label="菜品名称" prop="productNames"></el-table-column>
|
||||
<el-table-column label="类型" prop="padLayoutName"></el-table-column>
|
||||
<el-table-column label="所属小类" prop="productCategoryName"></el-table-column>
|
||||
<el-table-column label="自定义分类" prop="customName"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<el-table-column label="操作" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button type="text">拖动排序</el-button>
|
||||
<el-button type="text" v-if="isPcBowser">拖动排序</el-button>
|
||||
<el-button type="text" @click="editorHandle(scope.row, 1)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle(scope.row.id)">
|
||||
<el-button type="text" slot="reference">删除</el-button>
|
||||
|
|
@ -45,10 +47,12 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import Sortable from 'sortablejs'
|
||||
import AddPadPage from './components/addPadPage.vue'
|
||||
import { tbShopCategoryGet } from '@/api/shop'
|
||||
import { productGrouppage, productCategoryDelete } from '@/api/pad.js'
|
||||
import editor from 'mavon-editor';
|
||||
import { productGrouppage, productCategoryDelete, productCategorySort } from '@/api/pad.js'
|
||||
import { swapArrayEle } from '@/utils/index.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AddPadPage
|
||||
|
|
@ -59,6 +63,7 @@ export default {
|
|||
name: ''
|
||||
},
|
||||
selectCatory: '',
|
||||
treeDataOrgin: [],
|
||||
treeData: [],
|
||||
tableData: {
|
||||
loading: false,
|
||||
|
|
@ -71,8 +76,46 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
this.tbShopCategoryGet()
|
||||
if (this.isPcBowser) {
|
||||
this.$nextTick(() => {
|
||||
this.tableDrag()
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 搜索分类
|
||||
searchCateory() {
|
||||
this.treeData = this.treeDataOrgin.filter(item => {
|
||||
return item.name.includes(this.query.name)
|
||||
})
|
||||
},
|
||||
//表格拖拽
|
||||
tableDrag() {
|
||||
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
|
||||
new Sortable(el, {
|
||||
animation: 150,
|
||||
onEnd: async e => {
|
||||
// console.log('拖拽结束===', e);
|
||||
if (e.oldIndex == e.newIndex) return
|
||||
|
||||
let arr = swapArrayEle(this.tableData.list, e.oldIndex, e.newIndex)
|
||||
console.log(arr);
|
||||
let data = arr.map((item, index) => {
|
||||
return {
|
||||
id: item.id,
|
||||
sort: index
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
await productCategorySort(data)
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除
|
||||
async delTableHandle(id) {
|
||||
try {
|
||||
|
|
@ -97,7 +140,10 @@ export default {
|
|||
if (this.selectCatory.id) {
|
||||
this.$refs.AddPadPage.show()
|
||||
} else {
|
||||
this.$message.warning('请选择分类')
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: '请选择分类'
|
||||
})
|
||||
}
|
||||
},
|
||||
// 分类被点击
|
||||
|
|
@ -116,6 +162,7 @@ export default {
|
|||
sort: 'id,desc',
|
||||
shopId: localStorage.getItem('shopId')
|
||||
})
|
||||
this.treeDataOrgin = res.content
|
||||
this.treeData = res.content
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ export default {
|
|||
number: "0",
|
||||
show: false,
|
||||
timer: null,
|
||||
payPar:{}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -136,17 +137,10 @@ export default {
|
|||
this.$refs.refInputCode.focus();
|
||||
});
|
||||
} else {
|
||||
this.getPayUrl()
|
||||
this.tips = "请用户使用微信/支付宝扫描付款码";
|
||||
this.startGetOrderInfo();
|
||||
this.$nextTick(() => {
|
||||
QRCode.toCanvas(
|
||||
this.$refs.canvas,
|
||||
this.paymentQrcode,
|
||||
function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
number(newval) {
|
||||
|
|
@ -192,14 +186,28 @@ export default {
|
|||
this.close();
|
||||
this.$emit("confirm", this.form.code);
|
||||
},
|
||||
open() {
|
||||
this.show = true;
|
||||
this.form.money = Number(this.price).toFixed(2);
|
||||
if (this.openSwitch) {
|
||||
$getOrderPayUrl({ orderId: this.order.id,payAmount:this.price.toFixed(2) }).then((res) => {
|
||||
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) {
|
||||
this.show = true;
|
||||
this.form.money = Number(this.price).toFixed(2);
|
||||
this.payPar=data
|
||||
if (this.openSwitch) {
|
||||
// this.getPayUrl();
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.refInputCode.focus();
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,17 @@
|
|||
//判断商品是否可以下单
|
||||
export function isCanBuy(goods,isStock) {
|
||||
return goods.isGrounding && goods.isPauseSale == 0 && (isStock?goods.stockNumber > 0:true) ;
|
||||
export function isCanBuy(skuGoods,goods) {
|
||||
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项组合,生成全部结果
|
||||
export function generateCombinations(arr, k) {
|
||||
console.log(arr)
|
||||
console.log(k)
|
||||
let result = [];
|
||||
|
||||
function helper(index, current) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue