This commit is contained in:
duan 2024-11-29 16:35:13 +08:00
commit 8e1991e1bf
28 changed files with 1960 additions and 162 deletions

View File

@ -3,10 +3,10 @@ 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://cashieradmin.sxczgkj.cn'
# 预发布接口
# VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'

68
src/api/Instead.js Normal file
View File

@ -0,0 +1,68 @@
// 代客下单
import request from "@/utils/request";
//就餐形式,默认堂食后付费
const useType='dine-in-after'
function getUseType(){
const type=localStorage.getItem("useType")
return type?type:useType
}
// 购物车-临时菜添加
export function $temporaryDishes(data) {
return request({
url: '/api/place/temporaryDishes',
method: "post",
data:{
shopId: localStorage.getItem("shopId"),
useType:getUseType(),
...data
}
});
}
// 购物车-单品改价
export function $updatePrice(data) {
return request({
url: '/api/place/updatePrice',
method: "put",
data:{
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 团购券-获取可使用团购券列表
export function $thirdPartyCoupon(data) {
return request({
url: '/api/thirdPartyCoupon/list',
method: "get",
params:{
shopId: localStorage.getItem("shopId"),
...data
}
});
}
//核销团购券商品
export function $checkCoupon(data) {
return request({
url: '/api/place/checkCoupon',
method: "post",
data:{
shopId: localStorage.getItem("shopId"),
...data
}
});
}
//整体等叫/取消等叫
export function $waitCall(data) {
return request({
url: '/api/place/waitCall',
method: "put",
data:{
useType:getUseType(),
shopId: localStorage.getItem("shopId"),
...data
}
});
}

199
src/api/coup/index.js Normal file
View File

@ -0,0 +1,199 @@
// 代客下单
import request from "@/utils/request-php";
// 抖音团购核销准备
export function $douyin_fulfilmentcertificateprepare(data) {
return request({
url: 'douyin/fulfilmentcertificateprepare',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音团购核销
export function $douyin_certificateprepare(data) {
return request({
url: 'douyin/certificateprepare',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音团购核销撤销
export function $douyin_fulfilmentcertificatecancel(data) {
return request({
url: 'douyin/fulfilmentcertificatecancel',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音团购核销记录
export function $douyin_orderlist(data) {
return request({
url: 'douyin/orderlist',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音门店列表
export function $douyin_storelist(data) {
return request({
url: 'douyin/storelist',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音绑定门店
export function $douyin_bindstore(data) {
return request({
url: 'douyin/bindstore',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 抖音订单查询
export function $douyin_orderquery(data) {
return request({
url: 'douyin/orderquery',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
//会员签入
export function $douyin_checkIn(data) {
return request({
url: 'douyin/checkIn',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
//美团
// 美团获取uisdk 绑定 链接
export function $meituan_getuisdkurl(data) {
return request({
url: 'meituan/getuisdkurl',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团获取uisdk 解绑 链接
export function $meituan_getuisdkuniurl(data) {
return request({
url: 'meituan/getuisdkuniurl',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团团购核销准备
export function $meituan_fulfilmentcertificateprepare(data) {
return request({
url: 'meituan/fulfilmentcertificateprepare',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团执行核销
export function $meituan_certificateprepare(data) {
return request({
url: 'meituan/certificateprepare',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团团购核销记录
export function $meituan_orderlist(data) {
return request({
url: 'meituan/orderlist',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团团购撤销
export function $meituan_fulfilmentcertificatecancel(data) {
return request({
url: 'meituan/fulfilmentcertificatecancel',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 美团查询绑定状态
export function $meituan_searchstorestatus(data) {
return request({
url: 'meituan/searchstorestatus',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
// 登出
export function $logout(data) {
return request({
url: 'user/logout',
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
/**
* 获取挂账列表
* 获取挂账列表
* @returns
*/
export function getCreditBuyerList(params) {
@ -15,7 +15,7 @@ export function getCreditBuyerList(params) {
}
/**
* 获取挂账详情
* 获取挂账详情
* @returns
*/
export function getCreditBuyerInfo(id) {
@ -38,6 +38,18 @@ export function addCreditBuyer(data) {
})
}
/**
* 编辑挂账人
* @returns
*/
export function editCreditBuyer(data) {
return request({
url: '/api/credit/buyer',
method: 'put',
data
})
}
/**
* 还款
* @returns

BIN
src/assets/images/scan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

101
src/utils/request-php.js Normal file
View File

@ -0,0 +1,101 @@
import axios from 'axios'
import router from '@/router/routers'
import { Notification } from 'element-ui'
import store from '../store'
import { getToken } from '@/utils/auth'
import Config from '@/settings'
import Cookies from 'js-cookie'
import { setToken } from '@/utils/globalCancelToken.js'
// 创建axios实例
const service = axios.create({
// baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/',
baseURL: 'https://czgdoumei.sxczgkj.com/index.php/api/', // api 的 base_url
timeout: Config.timeout // 请求超时时间
})
// request拦截器
service.interceptors.request.use(
config => {
if (getToken()) {
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
config.headers['Content-Type'] = 'application/json'
// 添加可取消请求配置
config.cancelToken = new axios.CancelToken(c => setToken(c))
return config
},
error => {
Promise.reject(error)
}
)
// response 拦截器
service.interceptors.response.use(
response => {
return response.data
},
error => {
console.log(error);
if (axios.isCancel(error)) {
console.log('请求已取消')
Notification.error({
title: '请求已取消',
duration: 5000
})
return Promise.reject('请求已取消')
}
// 兼容blob下载出错json提示
if (error.response.data instanceof Blob && error.response.data.type.toLowerCase().indexOf('json') !== -1) {
const reader = new FileReader()
reader.readAsText(error.response.data, 'utf-8')
reader.onload = function (e) {
const errorMsg = JSON.parse(reader.result).message
Notification.error({
title: errorMsg,
duration: 5000
})
}
} else {
let code = 0
try {
code = error.response.data.status
} catch (e) {
if (error.toString().indexOf('Error: timeout') !== -1) {
Notification.error({
title: '网络请求超时',
duration: 5000
})
return Promise.reject(error)
}
}
console.log(code)
if (code) {
if (code === 401) {
store.dispatch('LogOut').then(() => {
// 用户登录界面提示
Cookies.set('point', 401)
location.reload()
})
} else if (code === 403) {
router.push({ path: '/401' })
} else {
const errorMsg = error.response.data.message
if (errorMsg !== undefined) {
Notification.error({
title: errorMsg,
duration: 5000
})
}
}
} else {
Notification.error({
title: '接口请求失败',
duration: 5000
})
}
}
return Promise.reject(error)
}
)
export default service

View File

@ -127,7 +127,7 @@ export default {
* 重置
*/
reset() {
this.query = { ...this.resetQuery }
this.query.paymentMethod = ''
this.getTableData()
}
}

View File

@ -21,7 +21,7 @@
<el-input v-model="form.debtor" placeholder="请输入挂账人名称" />
</el-form-item>
<el-form-item label="手机号" prop="mobile" style="width: 100%;">
<el-input v-model="form.mobile" placeholder="请输入手机号" oninput="value= value.replace(/[^1-9]/g, '')" maxlength="11" />
<el-input v-model="form.mobile" placeholder="请输入手机号" oninput="value= value.replace(/[^0-9]/g, '')" maxlength="11" />
</el-form-item>
<el-form-item label="职位" prop="position" style="width: 100%;">
<el-input v-model="form.position" placeholder="请输入职位" />
@ -50,7 +50,7 @@
</template>
<script>
import { addCreditBuyer } from '@/api/credit'
import { addCreditBuyer, editCreditBuyer } from '@/api/credit'
export default {
// eslint-disable-next-line vue/require-prop-types
@ -131,8 +131,12 @@ export default {
try {
this.loading = true
if (!this.form.shopId) { this.form.shopId = localStorage.getItem('shopId') }
// eslint-disable-next-line no-unused-vars, prefer-const
let res = await addCreditBuyer(this.form)
let res
if (!this.form.id) {
res = await addCreditBuyer(this.form)
} else {
res = await editCreditBuyer(this.form)
}
this.$notify({
title: '成功',
message: `${this.form.id ? '编辑' : '添加'}成功`,

View File

@ -90,11 +90,11 @@ export default {
this.resetForm = { ...this.form }
},
methods: {
/**
* 确定
*/
async onSubmitHandle() {
// eslint-disable-next-line no-undef
onSubmitHandle: _.debounce(function async() {
this.$refs.form.validate(async valid => {
if (valid) {
try {
@ -120,7 +120,7 @@ export default {
}
}
})
},
}, 1000),
/**
* 打开
@ -135,6 +135,9 @@ export default {
this.form.id = row.id
}
this.form.repaymentMethod = row.repaymentMethod
this.form.debtor = row.debtor
this.form.owedAmount = row.owedAmount
this.form.accountBalance = row.accountBalance
this.dialogVisible = true
},

View File

@ -16,7 +16,7 @@
:value="item.value"
/>
</el-select>
<el-button type="primary" @click="getTableData()">
<el-button type="primary" @click="search">
查询
</el-button>
</div>
@ -119,7 +119,10 @@ export default {
this.getTableData()
},
methods: {
search() {
this.tableData.page = 1
this.getTableData()
},
/**
* 获取挂账人列表
*/

View File

@ -27,13 +27,13 @@
</el-form-item>
<template>
<el-form-item>
<el-select v-model="query.status" placeholder="全部状态" style="width: 140px;">
<el-select v-model="query.status" placeholder="全部状态" clearable style="width: 140px;">
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</template>
<el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button type="primary" @click="search">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-form-item>
</el-form>
@ -161,6 +161,10 @@ export default {
// this.tbShopCategoryGet()
},
methods: {
search() {
this.query.page = 1
this.getTableData()
},
/**
* 获取明细数据
*/
@ -172,6 +176,7 @@ export default {
let params = {
page: this.query.page,
size: this.query.size,
status: this.query.status,
creditBuyerId: this.query.creditBuyerId
}
if (this.query.createdAt.length > 0) {
@ -197,6 +202,7 @@ export default {
let params = {
page: this.query.page,
size: this.query.size,
status: this.query.status,
creditBuyerId: this.query.creditBuyerId
}
if (this.query.createdAt.length > 0) {
@ -222,7 +228,7 @@ export default {
if (type === 'payment' && this.repaymentMethod === 'order') {
this.$refs.creditRepayment.show({ creditBuyerId: this.query.creditBuyerId, repaymentMethod: this.repaymentMethod }, row)
} else if (type === 'paymentRecord') {
this.$refs.creditRepaymentRecord.show({ creditBuyerId: this.query.creditBuyerId, repaymentMethod: this.repaymentMethod }, row.id)
this.$refs.creditRepaymentRecord.show({ id: this.query.creditBuyerId, repaymentMethod: this.repaymentMethod }, row.orderId)
}
},
@ -318,7 +324,8 @@ export default {
* @param e
*/
sizeChange(e) {
this.tableData.size = e
console.log(e)
this.query.size = e
this.getTableData()
},

View File

@ -81,7 +81,8 @@ export default {
stocktakinNum: '', //
price: '', //
remark: "", //
stockNumber: 0
stockNumber: 0,
balance: ''
},
rules: {
stocktakinNum: [
@ -155,6 +156,7 @@ export default {
})
},
async show(obj) {
console.log(obj, 111)
let res = await hasPermission('允许耗材盘点');
if (!res) { return; }
this.form.remark = ''
@ -165,8 +167,9 @@ export default {
this.form = Object.assign(this.form, obj)
this.dialogVisible = true
this.form.conInfoId = obj.consId
this.form.stockNumber = obj.stockNumber
this.form.balance = obj.stockNumber
this.form.stockNumber = obj.balance < 0 ? 0 : obj.balance
// this.form.balance = obj.stockNumber
this.form.balance = obj.balance
this.form.price == null ? 0 : this.form.price
this.searhForm.productId = obj.id
this.getTableData()

View File

@ -125,10 +125,11 @@
{{ !scope.row.unit ?
(scope.row.defaultUnit ?
scope.row.defaultUnit== scope.row.conUnitTwo?
((scope.row.costPrice*scope.row.conUnitTwoConvert).toFixed(2)): scope.row.costPrice:scope.row.costPrice)
: scope.row.unit== scope.row.conUnitTwo?
((scope.row.costPrice*scope.row.conUnitTwoConvert).toFixed(2)): scope.row.costPrice}}
scope.row.defaultUnit == scope.row.conUnitTwo ?
((scope.row.costPrice * scope.row.conUnitTwoConvert).toFixed(2)) :
scope.row.costPrice : scope.row.costPrice)
: scope.row.unit == scope.row.conUnitTwo ?
((scope.row.costPrice * scope.row.conUnitTwoConvert).toFixed(2)) : scope.row.costPrice }}
/
{{ !scope.row.unit ? (scope.row.defaultUnit ? scope.row.defaultUnit :
scope.row.conUnit) : scope.row.unit }}
@ -156,10 +157,10 @@
<div class="tips" style="font-size: 16px;">入库前
{{ !scope.row.unit ?
(scope.row.defaultUnit ?
scope.row.defaultUnit== scope.row.conUnitTwo?
(scope.row.number/scope.row.conUnitTwoConvert): scope.row.number:scope.row.number)
: scope.row.unit== scope.row.conUnitTwo?
(scope.row.number/scope.row.conUnitTwoConvert): scope.row.number}}
scope.row.defaultUnit == scope.row.conUnitTwo ?
(scope.row.number / scope.row.conUnitTwoConvert) : scope.row.number : scope.row.number)
: scope.row.unit == scope.row.conUnitTwo ?
(scope.row.number / scope.row.conUnitTwoConvert) : scope.row.number }}
{{ !scope.row.unit ? (scope.row.defaultUnit ? scope.row.defaultUnit :
scope.row.conUnit) : scope.row.unit }}
@ -343,6 +344,17 @@ export default {
mounted() {
this.resetForm = { ...this.queryForm }
this.tbShopPurveyorGet()
console.log(this.$route.query.consdata)
if (this.$route.query.consdata) {
let arr = this.$route.query.consdata.map(item => {
item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
item.stockNumber = 0
item.costPrice = item.price
item.conInfoId = item.id
return item
})
this.tableData.list = [...this.tableData.list, ...arr]
}
},
methods: {
async querySearchAsync(queryString, cb) {//
@ -556,6 +568,7 @@ export default {
},
//
selectConsumable(res) {
console.log(res)
let arr = res.map(item => {
item.number = formatDecimal(item.stockNumber - item.stockConsume, 2, true)
item.stockNumber = 0

View File

@ -127,7 +127,7 @@
<el-button type="text" size="mini"
@click="typedialogshowsumbit(scope.row.id)">账单付款记录</el-button>
<el-button type="text" size="mini" @click="stockData.size = 10,
stockData.page = 0, gettbConsInfoFlowstock(scope.row)">出入库记录</el-button>
stockData.page = 0, gettbConsInfoFlowstock(scope.row)">货单记录</el-button>
</template>
</el-table-column>
</el-table>
@ -175,10 +175,10 @@
</el-table>
</el-dialog>
<!--入库记录 -->
<el-dialog title="出入库记录" :visible.sync="variabilityshow" width="75%">
<el-dialog title="货单记录" :visible.sync="variabilityshow" width="75%">
<div class="head-container">
<el-table ref="table" :data="stockData.data" v-loading="stockData.loading" row-key="id" height="450">
<el-table-column label="类型" prop="type">
<!-- <el-table-column label="类型" prop="type">
<template v-slot="scope">
{{ scope.row.type == 'reject' ? '退货出库' : '供应商入库' }}
</template>
@ -194,16 +194,23 @@
<template v-slot="scope">
{{ dayjs(scope.row.stockTime).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="耗材" prop="name" />
<el-table-column label="单价" prop="price" />
<el-table-column label="数量" prop="stockNumber" />
<el-table-column label="单位" prop="unit" />
</el-table>
</div>
<div class="head-container">
<el-pagination :total="stockData.total" :current-page="stockData.page + 1" :page-size="stockData.size"
<div class="head-container" style="display: flex; justify-content: space-between; align-items: center;">
<!-- <el-pagination :total="stockData.total" :current-page="stockData.page + 1" :page-size="stockData.size"
layout="total, sizes, prev, pager, next, jumper" @current-change="wstockChange" @size-change="(e) => {
stockData.size = e;
stockData.page = 0;
gettbConsInfoFlowstock();
}" />
}" /> -->
<div></div>
<div style="color: #43a9fe;" @click="func()">转出库单</div>
</div>
</el-dialog>
</div>
@ -315,6 +322,7 @@ export default {
total: 0,
id: ''
},
consdata: []//
}
},
filters: {
@ -463,29 +471,40 @@ export default {
this.stockData.page = e - 1;
this.gettbConsInfoFlowstock();
},
func() {
this.$router.push({
name: 'operation_in',
query: {
consdata: this.consdata
}
})
},
async gettbConsInfoFlowstock(item) {
console.log(item)
if (item) {
this.stockData.id = item.id
this.consdata = item.cons
this.stockData.data = item.conFlows
}
this.variabilityshow = true
this.stockData.loading = true;
// this.stockData.loading = true;
let arr = []
// if (this.query.createdAt.length) {
// arr = [this.query.createdAt[0] + ' 00:00:00', this.query.createdAt[1] + ' 23:59:59']
// } else {
// arr = []
// }
let res = await tbProductStockOperatepage({
page: this.stockData.page,
size: this.stockData.size,
shopId: localStorage.getItem("shopId"),
type: ["cons_in", "cons_out"],//id
purveyorId: this.stockData.id,//
createdAt: arr//id
})
this.stockData.loading = false;
this.stockData.data = res.content;
this.stockData.total = res.totalElements;
// let res = await tbProductStockOperatepage({
// page: this.stockData.page,
// size: this.stockData.size,
// shopId: localStorage.getItem("shopId"),
// type: ["cons_in", "cons_out"],//id
// purveyorId: this.stockData.id,//
// createdAt: arr//id
// })
// this.stockData.loading = false;
// this.stockData.data = res.content;
// this.stockData.total = res.totalElements;
},
}
}

View File

@ -31,7 +31,7 @@
</template>
</el-table-column>
<el-table-column prop="username" label="用户名" />
<el-table-column prop="requestIp" label="IP" />
<!-- <el-table-column prop="requestIp" label="IP" /> -->
<el-table-column :show-overflow-tooltip="true" prop="address" label="IP来源" />
<el-table-column prop="description" label="描述" />
<el-table-column prop="browser" label="浏览器" />

View File

@ -57,9 +57,9 @@
</el-form>
</div>
<div class="head-container">
<!-- <div class="head-container">
<div class="collect_wrap">
<!-- <div class="item">
<div class="item">
<div class="icon_wrap" style="--bg-color:#C978EE">
<i class="icon el-icon-s-goods"></i>
</div>
@ -69,6 +69,8 @@
</div>
</div> -->
<!-- <div class="item" v-for="item in payCountList" :key="item.payType">
</div>
<div class="item" v-for="item in payCountList" :key="item.payType">
<div class="icon_wrap" style="--bg-color:#fff">
<el-image class="img" :src="item.icon"></el-image>
</div>
@ -76,9 +78,10 @@
<div class="m">{{ item.payAmount || 0 }}</div>
<div class="t">{{ item.payType }}</div>
</div>
</div> -->
</div>
</div>
</div>
</div>-->
<div class="head-container">
<el-table :data="tableData.data" v-loading="tableData.loading">
<el-table-column label="订单号信息">

View File

@ -192,7 +192,18 @@ export default {
},
//
selectConfirmGoods(res) {
// this.form.list = res
const flag = this.form.list.filter(item => item.id == res[0].id)
if (flag.length) {
this.$notify({
title: '注意',
message: '请勿重复添加',
type: 'error'
})
} else {
this.$set(this.form.list, this.activeItem, { ...res[0] })
}
},
// tab
tabChange() {

View File

@ -7,8 +7,12 @@
</el-input>
</div>
<div class="tree_wrap">
<el-tree :data="treeData" node-key="id" highlight-current :props="{ label: 'name' }" default-expand-all
@node-click="treeItemClick"></el-tree>
<!-- <el-tree :data="treeData" node-key="id" highlight-current :props="{ label: 'name' }" default-expand-all
@node-click="treeItemClick"></el-tree> -->
<div class="item" :class="{ active: selectCatoryIndex == index }" v-for="(item, index) in treeData"
:key="item.id" @click="treeItemClick(item, index)">
{{ item.name }}
</div>
</div>
</div>
<div class="table_wrap">
@ -62,6 +66,7 @@ export default {
query: {
name: ''
},
selectCatoryIndex: 0,
selectCatory: '',
treeDataOrgin: [],
treeData: [],
@ -88,6 +93,12 @@ export default {
this.treeData = this.treeDataOrgin.filter(item => {
return item.name.includes(this.query.name)
})
if (this.treeData.length) {
this.selectCatoryIndex = 0
this.selectCatory = this.treeData[this.selectCatoryIndex]
this.getTableData()
}
},
//
tableDrag() {
@ -147,7 +158,8 @@ export default {
}
},
//
treeItemClick(data) {
treeItemClick(data, index) {
this.selectCatoryIndex = index
this.selectCatory = data
this.tableData.page = 1
this.getTableData()
@ -164,6 +176,7 @@ export default {
})
this.treeDataOrgin = res.content
this.treeData = res.content
this.selectCatory = res.content[this.selectCatoryIndex]
this.getTableData()
} catch (error) {
console.log(error)
@ -235,6 +248,22 @@ export default {
width: 100%;
height: calc(100% - 70px);
overflow-y: auto;
.item {
padding: 10px 15px;
font-size: 14px;
display: flex;
align-items: center;
&:hover {
cursor: pointer;
}
&.active {
background-color: #1890ff;
color: #fff;
}
}
}
}

View File

@ -4,8 +4,12 @@
:class="[isActive]"
@click="itemClick"
>
<span class="absolute pack" v-if="item.isPack === 'true'"> </span>
<span class="absolute tui" v-if="item.status === 'return'"> 退 </span>
<div class="absolute status-box">
<span class="pack" v-if="item.isPack === 'true'"> </span>
<span class="da" v-if="item.isPrint"> </span>
<span class="isWaitCall" v-if="item.isWaitCall"> </span>
<span class="tui" v-if="item.status === 'return'"> 退 </span>
</div>
<div class="flex u-col-top">
<div class="img">
<div
@ -14,6 +18,12 @@
>
<span>{{ item.name }}</span>
</div>
<div
class="isSeatFee img u-line-1 u-flex u-col-center u-row-center"
v-else-if="!item.productId"
>
<span> 临时菜 </span>
</div>
<img v-else :src="item.coverImg" class="" alt="" />
</div>
<div class="good-info u-p-t-6">
@ -30,7 +40,7 @@
</div>
<div class="" v-if="placeNum == 0">
<div class="note" v-if="item.note">备注:{{ item.note || "" }}</div>
<div class="note" v-if="item.note">备注:{{ item.note }}</div>
<div class="note flex" v-else>
<span>备注:</span>
<span class="el-icon-edit u-font-12" @click="editNote"></span>
@ -74,11 +84,23 @@
<span v-else> {{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
</div>
</template>
<template v-else-if="item.discountSaleAmount">
<div>{{ discountNewPrice }}</div>
<div class="free-price">
<span> {{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
</div>
</template>
<template v-else>
<div v-if="isSeatFee">{{ item.totalAmount }}</div>
<div v-else>
<div v-if="isShowVipPrice&&vipAllPrice!=allPrice">{{ vipAllPrice }}</div>
<div :class="{ 'free-price': isShowVipPrice&&vipAllPrice!=allPrice }">
<div v-if="isShowVipPrice && vipAllPrice != allPrice">
{{ vipAllPrice }}
</div>
<div
:class="{
'free-price': isShowVipPrice && vipAllPrice != allPrice,
}"
>
<span> {{ allPrice }}</span>
</div>
</div>
@ -142,13 +164,21 @@ export default {
};
},
computed: {
discountNewPrice(){
const item = this.item;
const originPrice=this.isShowVipPrice?this.vipAllPrice:this.allPrice
const discount=(this.item.discountSaleAmount*this.item.number)
return (originPrice-discount).toFixed(2)
},
vipAllPrice() {
const item = this.item;
const price =
this.isShowVipPrice &&
item.memberPrice != null &&
item.memberPrice != undefined
? (item.memberPrice<=0?item.salePrice:item.memberPrice)
? item.memberPrice <= 0
? item.salePrice
: item.memberPrice
: item.salePrice;
return (price * item.number + (item.packAmount || 0)).toFixed(2);
},
@ -262,27 +292,36 @@ export default {
justify-content: space-between;
background-color: rgba(0, 0, 0, 0);
transition: all 0.3s;
.pack {
.status-box {
width: 18px;
position: absolute;
top: 4px;
right: 100%;
display: flex;
flex-direction: column;
gap: 2px;
> span {
display: block;
width: 18px;
height: 18px;
background: #35ac6a;
border-radius: 4px 0 4px 0;
font-size: 12px;
color: #fff;
text-align: center;
line-height: 17px;
text-align: center;
color: #fff;
}
}
.isWaitCall {
background: #d3adf7;
}
.pack {
background: #35ac6a;
}
.da {
background: #35ac6a;
}
.tui {
right: 100%;
width: 18px;
height: 18px;
background: #ac4735;
border-radius: 4px 0 4px 0;
font-size: 12px;
color: #fff;
text-align: center;
line-height: 17px;
}
&.active {
background-color: rgba(0, 0, 0, 0.04);

View File

@ -0,0 +1,181 @@
<template>
<el-dialog title="选择挂账人" width="850px" :visible.sync="show" top="20px">
<div class="app-container">
<div class="head-container filtration">
<div class="r">
<el-input
v-model="tableData.keywords"
placeholder="按挂账人或手机号"
style="width: 138px"
/>
<!-- <el-select
v-model="tableData.status"
placeholder="全部状态"
clearable
style="width: 123px"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> -->
<el-button type="primary" @click="getTableData()"> 查询 </el-button>
</div>
</div>
<div class="head-container content">
<el-table
v-loading="tableData.loading"
:data="tableData.data"
@cell-click="cellClick"
>
<el-table-column label="ID" prop="id" />
<el-table-column label="挂账人" prop="debtor" />
<el-table-column label="手机号" prop="mobile" />
<el-table-column label="已挂账金额(元)" prop="owedAmount" />
<el-table-column label="可用挂账额度(元)" prop="remainingAmount" />
<el-table-column label="操作">
<template v-slot="scope">
<el-button type="text" @click="cellClick(scope.row)"
>选择</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="head-container">
<el-pagination
:total="tableData.total"
:current-page="tableData.page"
:page-size="tableData.size"
layout="total, sizes, prev, pager, next, jumper"
@current-change="paginationChange"
@size-change="sizeChange"
/>
</div>
</div>
</el-dialog>
</template>
<script>
import { getCreditBuyerList, delCreditBuyer } from "@/api/credit";
export default {
data() {
return {
show: false,
options: [
{
value: "1",
label: "启用",
},
{
value: "0",
label: "停用",
},
],
tableData: {
keywords: "",
status: "1",
data: [],
page: 1,
size: 10,
loading: false,
total: 0,
},
};
},
mounted() {
// this.getTableData();
},
methods: {
cellClick(row) {
this.$emit("confirm", row);
this.show = false;
},
open() {
this.getTableData();
this.show = true;
},
/**
* 获取挂账人列表
*/
async getTableData() {
this.tableData.loading = true;
try {
const res = await getCreditBuyerList({
page: this.tableData.page,
size: this.tableData.size,
keywords: this.tableData.keywords,
status: this.tableData.status,
shopId: localStorage.getItem("shopId"),
});
this.tableData.loading = false;
this.tableData.data = res.content;
this.tableData.total = res.totalElements;
} catch (error) {
console.log(error);
}
},
/**
* 删除挂账人
* @param id
*/
async delTableHandle(id) {
// eslint-disable-next-line no-unused-vars
const res = await delCreditBuyer(id);
this.getTableData();
},
/**
* 操作
*/
openDialog(row, type) {
if (type === "add") {
this.$refs.creditAdd.show();
} else if (type === "edit") {
this.$refs.creditAdd.show(row);
} else if (type === "repayment" && row.repaymentMethod === "total") {
this.$refs.creditRepayment.show(row);
} else if (type === "rePaymentRecord") {
this.$refs.creditRepaymentRecord.show(row);
}
},
//
resetHandle() {
this.page = 1;
this.getTableData();
},
//
sizeChange(e) {
this.tableData.size = e;
this.getTableData();
},
//
paginationChange(e) {
this.tableData.page = e;
this.getTableData();
},
},
};
</script>
<style scoped lang="scss">
.title {
font-weight: bold;
font-size: 16px;
color: #333333;
}
.filtration {
overflow: hidden;
.l {
float: left;
}
.r {
float: right;
}
}
</style>

View File

@ -6,6 +6,7 @@
<span> {{ number }}</span>
</slot>
</div>
<slot name="tips"></slot>
<div class="number_list_box">
<div class="yd-keyboard">
<div class="mini-number-box1">
@ -79,13 +80,18 @@ export default {
default: false,
},
max: {
type: Number,
type: [Number,String],
default: Infinity,
},
value: {
type: [String, Number],
default: 0,
},
//
isFloat: {
type: Boolean,
default: false,
}
},
data() {
return {
@ -102,14 +108,21 @@ export default {
},
methods: {
clearFunction() {
if(this.isFloat){
return this.keyboradAdd('.')
}
this.$emit("clear", this.number);
},
keyboradAdd(n) {
if(n=='.'&& `${this.number}`.includes('.')){
return
}
if (Number(this.number) == 0) {
return (this.number = n);
}
const newval = this.number + n;
if (newval > this.max) {
console.log(newval)
if (newval*1 > this.max*1) {
return this.$message( this.maxTips);
}
this.number = newval;

View File

@ -0,0 +1,205 @@
<template>
<el-dialog
title="单品改价"
width="410px"
:visible.sync="show"
@close="reset"
:modal="modal"
>
<div class="u-m-t-30 u-flex">
<div class="no-wrap u-m-r-20">价格更改</div>
<el-input
:min="min"
:max="max"
placeholder="减8.88元请输入8.88元"
v-model="price"
@blur="checkPrice"
type="number"
>
<template slot="append"></template>
</el-input>
</div>
<div class="u-m-t-16">
<span class="color-red">*</span>
<span>当前单品单价{{max }}</span>
</div>
<div class="u-m-t-30">
<div><span>更改原因</span> <span class="color-red">*</span></div>
</div>
<div class="u-flex u-flex-wrap tags">
<div
class="tag"
v-for="(tag, index) in tags"
@click="changeSel(tag)"
:key="index"
:class="{ active: tag.checked }"
>
{{ tag.label }}
</div>
</div>
<div class="u-m-t-20">
<el-input
type="textarea"
v-model="note"
size="medium"
placeholder="请输入自定义内容"
></el-input>
</div>
<div slot="footer">
<el-button size="medium" @click="close"> 取消 </el-button>
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
</div>
</el-dialog>
</template>
<script>
import { returnCartPrice } from "../util.js";
import {$updatePrice} from '@/api/Instead';
export default {
props: {
modal: {
type: Boolean,
default: true,
},
vipUser:{
type:Object,
default:()=>{
return {
isVip:false,
}
}
}
},
data() {
return {
max: 0,
min: 0,
price: '',
tagSel: -1,
show: false,
tags: [
{ label: "顾客投诉质量", checked: false },
{ label: "友情打折", checked: false },
{ label: "临时活动", checked: false },
],
note: "",
goods: {
productId: -999,
},
};
},
computed: {
isSeatFee() {
return returnIsSeatFee(this.goods);
},
},
methods: {
checkPrice(){
if(this.price>this.max||this.price<0){
this.$message.error(`改价的区间为${this.min}-${this.max}`);
}
if(this.price>this.max){
this.price=this.max;
}
if(this.price<0){
this.price=0;
}
},
changeSel(item) {
item.checked = !item.checked;
},
reset() {
this.note = "";
this.number = 1;
this.tags.map((v) => {
v.checked = false;
});
console.log(this.number);
},
delTag(index) {
this.tags.splice(index, 1);
},
addNote(tag) {
if (this.note.length <= 0) {
return (this.note = tag);
}
this.note = tag + "," + this.note;
},
open(item) {
this.goods = item ? item : this.goods;
this.max=returnCartPrice(this.goods,this.vipUser)
this.show = true;
if (item.productId != "-999") {
} else {
this.price = item.discountSaleAmount||'';
}
},
close() {
this.show = false;
this.number = 1;
},
async confirm() {
const selTag = this.tags
.filter((item) => item.checked)
.map((item) => item.label)
.join(",");
const note = selTag + (this.note.length > 0 ? "," + this.note : "");
if (!note) {
return this.$message.error("请输入更改原因");
}
const res=await $updatePrice({
cartId: this.goods.id,
saleAmount:this.price,
note:note,
})
this.$message.success("修改价格成功");
this.close();
this.$emit('updateCart',res)
// this.$emit("confirm", { note: note, num: this.number });
},
},
mounted() {},
};
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
margin-bottom: 14px;
margin-top: 14px;
padding: 0 20px;
}
::v-deep .el-tag {
margin-top: 10px;
margin-right: 10px;
margin-bottom: 5px;
cursor: pointer;
font-size: 15px;
line-height: 35px;
height: 35px;
}
.tags {
.tag {
margin: 10px 10px 0 0;
border: 1px solid #dcdfe6;
border-radius: 4px;
padding: 10px 13px;
font-size: 14px;
color: #666;
cursor: pointer;
&.active {
color: #1890ff;
background: #e8f4ff;
border-color: #a3d3ff;
}
}
}
::v-deep .el-dialog__body {
color: #333;
}
::v-deep input::-webkit-outer-spin-button,
::v-deep input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
</style>

View File

@ -0,0 +1,357 @@
<template>
<div class="select_desk">
<el-dialog width="410px" title="挂账" :visible.sync="show">
<div class="guazhangren u-flex u-row-between" @click="guazhangShow">
<template v-if="guazhangRen">
<div>
<div class="name">
{{ guazhangRen.debtor }}/{{ guazhangRen.position }}
</div>
<div class="u-m-t-6">手机号{{ guazhangRen.mobile }}</div>
</div>
<div>
<div class="">可用额度</div>
<div class="u-m-t-6">{{ guazhangRen.remainingAmount }}</div>
</div>
</template>
<template v-else>
<div class="color-999">选择挂账人/单位</div>
<span class="el-icon-caret-bottom"></span>
</template>
</div>
<div class="select_desk_dialog u-p-b-20">
<key-board
isCanEmpty
v-model="number"
isFloat
@clear="clear"
:max="payMoney"
:maxTips="'超出未结账金额'"
>
<div slot="clear">.</div>
<div
slot="tips"
class="color-red w-full u-p-l-20 u-text-left u-m-t-10 u-m-b-30"
>
{{ tips }}
</div>
<div slot="input" class="u-p-l-20 u-p-r-20 u-flex w-full">
<div class="font-bold u-font-32">¥</div>
<el-input
placeholder="请输入挂账金额"
v-model="number"
@input="inputNumber"
@change="inputChange"
@focus="inputFocus"
@blur="inputBlur"
:type="focus ? 'number' : 'text'"
>
</el-input>
</div>
</key-board>
<div class="confirm_btns">
<el-button size="medium" @click="close">取消</el-button>
<el-button type="primary" size="medium" @click="confirm"
>确定</el-button
>
</div>
</div>
</el-dialog>
<choose-guazhang
ref="refChooseGuazhang"
@confirm="chooseGuazhangConfirm"
></choose-guazhang>
</div>
</template>
<script>
import keyBoard from "./keyboard.vue";
import chooseGuazhang from "./choose-guazhang.vue";
export default {
components: { keyBoard, chooseGuazhang },
props: {
payMoney: {
type: [Number, String],
default: 0,
},
},
data() {
return {
guazhangRen: "",
number: "",
show: false,
hasOpen: false,
loading: false,
tips: "",
focus: false,
};
},
watch: {
number(newval) {
console.log(newval);
if (newval * 1 > this.payMoney * 1) {
this.number = this.payMoney;
this.number = newval;
}
if (newval * 1 > this.payMoney * 1) {
this.tips =
"已超出未结账金额";
} else {
const shengyu=this.payMoney - this.number
this.tips =shengyu>0?
"还需额外支付" + shengyu.toFixed(2) + "元":'';
}
},
},
methods: {
inputFocus() {
this.focus = true;
},
inputBlur() {
this.focus = false;
},
chooseGuazhangConfirm(e) {
this.guazhangRen = e;
},
guazhangShow() {
this.$refs.refChooseGuazhang.open();
},
inputNumber(e) {
console.log("inputNumber");
if (e * 1 > this.payMoney * 1) {
this.tips = "已超出未结账金额";
}
},
inputChange(e) {
if (e * 1 > this.payMoney * 1) {
this.tips = "已超出未结账金额";
}
console.log(e);
},
clear(e) {
console.log(e);
this.number = "";
},
confirm() {
if (this.number*1 > this.payMoney*1) {
return this.$message("已超出未结账金额");
}
if (this.number * 1 <= 0) {
return this.$message("支付金额不正确");
}
if (!this.guazhangRen) {
return this.$message("请选择挂账人");
}
this.$emit("confirm",this.guazhangRen, this.number);
this.close();
},
open(number) {
this.number = this.payMoney*1
this.show = true;
this.tips = "还需额外支付" + this.payMoney + "元";
},
close() {
this.show = false;
this.number = "";
},
},
mounted() {},
};
</script>
<style lang="scss" scoped>
::v-deep.el-button {
padding: 12px 20px;
}
::v-deep .carts .box_status {
margin-bottom: 0;
margin-top: 30px;
}
::v-deep .select_desk_dialog .el-input__inner {
border: none;
font-size: 32px;
}
::v-deep .el-input__inner::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
::v-deep .el-input__inner::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
::v-deep .el-button--success {
border-color: #22bf64;
background-color: #22bf64;
}
.select_desk .btn {
height: 34px;
}
.tags {
font-size: 16px;
&.using {
color: rgb(234, 64, 37);
}
&.wait {
color: rgb(252, 236, 79);
}
&.idle {
color: rgb(137, 234, 71);
}
&.closed {
color: rgb(221, 221, 221);
filter: grayscale(1);
}
}
::v-deep .inputs .el-input__inner {
border-color: transparent !important;
color: rgba(0, 0, 0, 0.8);
letter-spacing: 1.25px;
font-size: 20px;
}
.select_desk .select_desk_dialog {
display: flex;
flex-direction: column;
align-items: center;
}
.select_desk .select_desk_dialog .nav {
width: 286px;
height: 38px;
background: #dcf0e8;
justify-content: space-around;
}
.select_desk .select_desk_dialog .nav .li,
.select_desk .select_desk_dialog .nav {
border-radius: 4px;
display: flex;
align-items: center;
}
.select_desk .select_desk_dialog .nav .li {
width: 140px;
height: 34px;
color: #0fc161;
justify-content: center;
font-size: 14px;
cursor: pointer;
}
.select_desk .select_desk_dialog .nav .lion {
background: #0fc161;
color: #fff;
}
.select_desk .select_desk_dialog .inputs {
width: 370px;
line-height: 54px;
margin-top: 24px;
height: 54px;
margin-bottom: 20px;
background: #fff;
border: 1px solid #dcdfe6;
border-radius: 4px;
color: rgba(0, 0, 0, 0.8);
letter-spacing: 1.25px;
text-align: center;
font-size: 20px;
position: relative;
}
.select_desk .select_desk_dialog .inputs .close {
color: #aaa;
position: absolute;
right: 10px;
height: 30px;
width: 30px;
line-height: 30px;
top: 50%;
margin-top: -15px;
cursor: pointer;
}
.guazhangren {
padding: 12px 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
margin-top: 20px;
min-height: 58px;
color: #999;
cursor: pointer;
.name {
color: #3f9eff;
}
}
.select_desk .select_desk_dialog .keyboard {
display: flex;
flex-wrap: wrap;
width: 100%;
margin-top: 20px;
margin-bottom: 10px;
border-right: 1px solid #dcdfe6;
border-bottom: 1px solid #dcdfe6;
}
.select_desk .select_desk_dialog .keyboard .li {
height: 60px;
width: 33.333%;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
color: #212121;
cursor: pointer;
user-select: none;
border-left: 1px solid #dcdfe6;
border-top: 1px solid #dcdfe6;
transition: all 0.1s;
}
.select_desk .select_desk_dialog .keyboard .li:hover {
background: #dcdfe6;
}
.select_desk .select_desk_dialog .keyboard .li .icon {
font-size: 1.3em;
}
.select_desk .select_desk_dialog .keyboard .confirm {
height: 140px;
background: #ff9f2e;
position: absolute;
bottom: 0;
right: 0;
border-right: none;
}
.select_desk .select_desk_dialog .keyboard .confirm:hover {
background: #f88502;
}
.confirm_btns {
display: flex;
justify-content: space-between;
width: 100%;
}
.confirm_btns .el-button {
width: 175px;
}
</style>

View File

@ -8,12 +8,20 @@
<div>
<div>将临时菜添加至购物车不会影响总商品库</div>
<div class="u-m-t-16">
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="菜品名称">
<el-input v-model="form.name"></el-input>
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
<el-form-item label="菜品名称" prop="name">
<el-input
v-model="form.name"
placeholder="请输入菜品名称"
></el-input>
</el-form-item>
<el-form-item label="菜品分类">
<el-select v-model="form.category" filterable placeholder="选择分类">
<el-form-item label="菜品分类" prop="categoryId">
<el-select
v-model="form.categoryId"
@change="selectChange($event, 'form', 'categoryId')"
filterable
placeholder="选择分类"
>
<el-option
v-for="item in category"
:key="item.id"
@ -23,13 +31,22 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="价格">
<el-input v-model="form.price" placeholder="请输入价格" type="number">
<el-form-item label="价格" prop="price">
<el-input
v-model="form.price"
placeholder="请输入价格"
type="number"
>
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="单位">
<el-select v-model="form.unit" filterable placeholder="选择单位">
<el-form-item label="单位" prop="unit">
<el-select
v-model="form.unit"
filterable
placeholder="选择单位"
@change="selectChange($event, 'form', 'unit')"
>
<el-option
v-for="item in units"
:key="item.id"
@ -39,13 +56,16 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="下单数量">
<el-input v-model="form.num" placeholder="请输入下单数量" type="number">
<el-form-item label="下单数量" prop="num">
<el-input
v-model="form.num"
placeholder="请输入下单数量"
type="number"
>
</el-input>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.note" placeholder="请输入备注" >
</el-input>
<el-input v-model="form.note" placeholder="请输入备注"> </el-input>
</el-form-item>
</el-form>
</div>
@ -57,22 +77,32 @@
</el-dialog>
</template>
<script>
import { tbShopCategoryGet,tbShopUnit } from "@/api/shop";
import { tbShopCategoryGet, tbShopUnit } from "@/api/shop";
import * as $InsteadApi from "@/api/Instead";
export default {
data() {
return {
show: false,
rules: {
name: [{ required: true, message: "请输入菜品名称", trigger: "blur" }],
categoryId: [
{ required: true, message: "请选择菜品分类", trigger: "blur" },
],
price: [{ required: true, message: "请输入菜品价格", trigger: "blur" }],
unit: [{ required: true, message: "请选择菜品单位", trigger: "blur" }],
num: [{ required: true, message: "请输入下单数量", trigger: "blur" }],
},
form: {
name: "",
category:'',
categoryId: "",
price: "",
unit:'',
num:1,
note:''
unit: "",
num: 1,
note: "",
},
category:[],
units:[]
category: [],
units: [],
option:{}
};
},
@ -96,24 +126,52 @@ export default {
sort: "id",
shopId: localStorage.getItem("shopId"),
});
this.units = content
this.units = content;
},
reset() {
this.$refs.form.resetFields();
},
reset() {},
open() {
open(opt) {
this.show = true;
this.option=opt
},
close() {
this.show = false;
},
confirm() {
this.$emit("confirm", this.form);
//selectc
selectChange($event, ref, type) {
// this.$refs[ref][0].validateField(type)
this.$refs[ref].validateField(type);
},
async submit() {
const res = await $InsteadApi.$temporaryDishes({...this.option,...this.form});
console.log(res);
this.$notify({
title: "临时菜添加成功",
type: "success",
});
this.$emit("updateCart");
this.close();
},
confirm() {
this.$refs.form.validate((valid) => {
if (valid) {
console.log(valid);
// this.$emit("confirm", this.form);
// this.close();
this.submit();
} else {
console.log("error submit!!");
return false;
}
});
},
},
mounted() {
this.getCategory()
this.getUnit()
this.getCategory();
this.getUnit();
},
};
</script>

View File

@ -0,0 +1,165 @@
<template>
<div>
<el-dialog width="400px" :title="title" :visible.sync="show" @close="reset">
<div class="u-p-15">
<div class="u-m-t-20">
<el-alert
:closable="false"
v-if="tips"
:title="tips"
type="warning"
show-icon
>
</el-alert>
</div>
<div class="u-m-t-20">
<template>
<el-form label-width="90px" label-position="left">
<el-form-item label="团购代金券">
<el-input
v-model="form.code"
@change="codeInputChange"
placeholder="请扫码或者输入付款码"
ref="refInputCode"
></el-input>
</el-form-item>
<div class="u-flex u-row-center u-m-t-50">
<el-button size="medium" @click="close">取消</el-button>
<el-button size="medium" type="primary" @click="confirm"
>确定</el-button
>
</div>
</el-form>
</template>
</div>
</div>
</el-dialog>
<el-dialog width="400px" title="团购券商品" :visible.sync="tuanGoodsShow">
<tuan-quan-table
:data="canDikouGoods"
ref="refGoodsTable"
></tuan-quan-table>
<div class="u-flex u-row-center u-m-t-30 u-p-b-20">
<el-button size="medium" @click="tuanGoodsShow = false">取消</el-button>
<el-button size="medium" type="primary" @click="tuanGoodsConfirm"
>确定</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import { $thirdPartyCoupon } from "@/api/Instead";
import tuanQuanTable from "./tuan-quan-table.vue";
export default {
components: { tuanQuanTable },
props: {
cartGoods: {
type: Array,
default: () => [],
},
title: {
type: String,
default: "团购代金券核销",
},
},
filters: {
to2(n) {
return n.toFixed(2);
},
},
data() {
return {
canDikouGoods: [],
tuanQuan: {
goods: [],
},
tuanGoodsShow: false,
tips: "请使用扫码枪扫描团购代金券",
form: {
money: "",
code: "",
},
number: "0",
show: false,
timer: null,
payPar: {},
selGoodsArr: [],
};
},
watch: {
defaultTips(val) {
this.tips = val;
},
},
methods: {
codeInputChange(e) {
console.log(e);
// this.$emit("confirm", this.form.code);
},
reset() {
this.tuanQuan = {
goods: [],
};
this.form.code = "";
this.selGoodsArr = [];
},
tuanGoodsConfirm() {
const selGoods = this.$refs.refGoodsTable.getSelectRows();
if (selGoods.length == 0) {
return this.$message.error("请选择商品");
}
this.$emit("confirm", {
...this.tuanQuan,
goods: selGoods,
});
this.tuanGoodsShow = false;
this.show = false;
},
async confirm() {
if (!this.form.code) {
return this.$message.error("请输入或扫团购代金券");
}
const res = await $thirdPartyCoupon({
code: this.form.code,
});
this.tuanQuan = res;
this.tuanGoodsShow = true;
console.log(res);
// this.close();
// this.$emit("confirm", this.form.code);
},
open(data) {
this.show = true;
this.canDikouGoods=this.cartGoods.filter(item=>item.productId!='-999')
this.$nextTick(() => {
this.$refs.refInputCode.focus();
});
},
close() {
this.show = false;
},
numberInput(val) {
console.log(val);
this.number = `${Number(val)}`;
},
keyboradConfirm() {
this.$emit("confirm", this.number);
},
},
mounted() {
this.number = `${this.value}`;
this.tips = this.defaultTips;
},
};
</script>
<style lang="scss" scoped>
.codeImg {
width: 164px;
border: 1px solid rgb(220, 223, 230);
height: 164px;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,61 @@
<template>
<div>
<el-table
ref="table"
:data="data"
style="width: 100%"
@selection-change="handleSelectionChange"
@cell-click="cellClick"
>
<template v-if="type == 'edit'">
<el-table-column type="selection" width="55"> </el-table-column>
</template>
<el-table-column
prop="productName"
label="商品名称"
width="100"
></el-table-column>
<el-table-column prop="price" label="商品单价"></el-table-column>
<el-table-column prop="num" label="商品数量"></el-table-column>
<el-table-column prop="priceAmount" label="商品总价"></el-table-column>
</el-table>
</div>
</template>
<script>
export default {
props: {
type: {
type: String, //edit show
default: "edit",
},
data: {
type: Array,
default: () => [],
},
},
data() {
return {
selArr: [],
};
},
watch:{
},
methods: {
getSelectRows() {
return this.selArr;
},
handleSelectionChange(e) {
if (this.type == "edit") {
this.selArr = e;
}
},
cellClick(row) {
if (this.type == "edit") {
this.$refs.table.toggleRowSelection(row);
}
console.log(row);
},
},
};
</script>

View File

@ -399,11 +399,18 @@
<div slot="content">
<div
class="u-flex color-000 u-font-14 u-row-between"
v-if="vipDiscountPrice > 0"
v-if="vipDiscountPrice * 1 > 0"
>
<span class="font-bold">会员优惠 </span>
<span class="">{{ vipDiscountPrice }} </span>
</div>
<div
class="u-flex color-000 u-font-14 u-row-between"
v-if="discountSaleAmount * 1 > 0"
>
<span class="font-bold">单品改价优惠 </span>
<span class="">{{ discountSaleAmount }} </span>
</div>
</div>
<span> 已优惠{{ youhuiAllPrice }} </span>
<i class="el-icon-arrow-right"></i>
@ -500,7 +507,7 @@
<el-button
size="medium"
:disabled="
!order.list.length && !order.old.list.length
!order.list.length && order.old.list.length <= 0
"
@click="toCreateOrderDebounce(true)"
>
@ -639,21 +646,36 @@
>
退菜
</div>
<!-- <div
<div
@click="orderBtnsClick('print')"
:class="{ disabled: order.selIndex < 0 }"
class="btn"
>
{{ returnPrintText }}
</div>
<div
@click="refPopChangePriceShow"
:class="{ disabled: order.selIndex < 0 }"
class="btn"
>
单品改价
</div>
<div
class="btn"
@click="orderBtnsClick('isWaitCall')"
:class="{ disabled: order.selIndex < 0 }"
>
等叫
{{ returnWaingText }}
</div>
<div
class="btn no-wrap u-font-12"
@click="orderBtnsClick('AllWaitCall')"
:class="{ disabled: isCreateOrder}"
>
取消全部等叫
</div> -->
{{ returnWaingAllText }}
</div>
<!-- <div
class="btn"
@ -713,7 +735,7 @@
</div>
<template v-if="goods.list.length">
<div class="goods-list">
<!-- <div
<div
@click="lingshicaiShow"
class="goods-item lingshicai text-center color-999"
:class="{
@ -723,7 +745,7 @@
>
<span class="el-icon-plus" style="font-size: 26px"></span>
<div class="u-m-t-10">临时菜</div>
</div> -->
</div>
<div
class="goods-item"
:class="{
@ -933,8 +955,35 @@
</template>
</div>
</div>
<div class="u-flex flex-wrap">
<span class="font-bold no-wrap">团购代金券</span>
<div
class="border u-p-l-20 cur-pointer u-m-r-20 u-flex no-wrap u-p-t-10 u-p-b-10 border-r-4 selQuan"
@click="shouwTuanQuan"
>
<span class="color-999 u-p-r-10">代金券名称</span>
<span
class="el-icon-arrow-down color-999 u-m-r-10"
></span>
</div>
<img
style="width: 30px; height: 30px"
class="cur-pointer"
@click="shouwTuanQuan"
src="@/assets/images/scan.png"
/>
<!-- <el-button size="medium " type="text">
查看不可用券
</el-button> -->
</div>
<template v-if="tuanQuan">
<tuan-quan-table
:data="tuanQuan.goods"
type="show"
ref="refGoodsTable"
></tuan-quan-table>
</template>
<div class="u-flex flex-wrap u-m-t-20">
<span class="font-bold no-wrap">优惠券</span>
<div
class="border u-p-l-20 cur-pointer u-m-r-20 u-flex no-wrap u-p-t-10 u-p-b-10 border-r-4 selQuan"
@ -945,6 +994,7 @@
class="el-icon-arrow-down color-999 u-m-r-10"
></span>
</div>
<!-- <el-button size="medium " type="text">
查看不可用券
</el-button> -->
@ -1019,6 +1069,9 @@
:disabledPayType="disabledPayType"
>
</pay-type>
<el-button
:disabled="disabledPayType.includes('creditBuyer')"
@click="guazhangShow" size="medium">挂账</el-button>
<div style="margin-top: 20px">
<el-button type="primary" size="medium" @click="payOrder">
<span>立即支付</span>
@ -1413,7 +1466,25 @@
></return-cart>
<!-- 临时菜 -->
<cai-add ref="refPopAddCai"></cai-add>
<cai-add ref="refPopAddCai" @updateCart="getCart"></cai-add>
<!-- 单品改价 -->
<cart-change-price
ref="refPopChangePrice"
:vipUser="vipUser"
@updateCart="updateCartItem"
></cart-change-price>
<!-- 团购券 -->
<pop-tuan-quan
:cartGoods="createOrder.data.detailList || []"
ref="refPopTuanQuan"
@confirm="tuanQuanConfirm"
></pop-tuan-quan>
<!-- 挂账 -->
<popup-choose-guazhang
ref="refGuaZhang"
:payMoney="yinFuJinE"
@confirm="guazhangPayConfirm"
></popup-choose-guazhang>
</div>
</template>
@ -1431,6 +1502,11 @@ import chooseDinersNumber from "./components/choose-diners-number.vue";
import returnCart from "./components/return-cart.vue";
import moneyKeyboard from "./components/money-keyboard.vue";
import caiAdd from "./components/popup-linshiCai.vue";
import cartChangePrice from "./components/popup-cart-changePrice.vue";
import popTuanQuan from "./components/popup-tuan-quan.vue";
import tuanQuanTable from "./components/tuan-quan-table.vue";
import popupChooseGuazhang from "./components/popup-choose-guazhang.vue";
import dayjs from "dayjs";
import { tbShopInfo } from "@/api/user";
import { hasPermission } from "@/utils/limits.js";
@ -1463,7 +1539,9 @@ import {
$calcUsablePoints,
$calcDeDuctionPoints,
} from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop";
import { $checkCoupon,$waitCall } from "@/api/Instead";
import {
isCanBuy,
arrayContainsAll,
@ -1480,10 +1558,15 @@ import { returnProductCoupAllPrice } from "./quan_util.js";
//0n
let $goodsPayPriceMap = {};
import { $status } from "@/utils/table.js";
import PopupChooseGuazhang from "./components/popup-choose-guazhang.vue";
let $originTableList = [];
export default {
components: {
popupChooseGuazhang,
cartChangePrice,
popTuanQuan,
tuanQuanTable,
caiAdd,
quansPop,
returnCart,
@ -1496,9 +1579,12 @@ export default {
moneyDiscount,
cartItem,
chooseDinersNumber,
PopupChooseGuazhang,
},
data() {
return {
//
guazhangRen: "",
disabledPayType: [],
//
points: {
@ -1512,6 +1598,8 @@ export default {
value: 0,
toMoney: 0,
},
//
tuanQuan: "",
//
quansSelArr: [],
//
@ -1710,9 +1798,33 @@ export default {
},
},
timer: null,
isAllWaitCall: false,
};
},
computed: {
returnPrintText(){
if (this.order.selIndex < 0) {
return "免厨打";
}
return this.order.list[this.order.selIndex].isPrint
? "免厨打"
: "打印";
},
returnWaingText() {
if (this.order.selIndex < 0) {
return "等叫";
}
return this.order.list[this.order.selIndex].isWaitCall == 1
? "取消等叫"
: "等叫";
},
isHasWaiting() {
const waitingArr = this.order.list.filter((v) => v.isWaitCall == 1);
return waitingArr.length > 0 ? true : false;
},
returnWaingAllText() {
return this.isAllWaitCall ? "取消全部等叫" : "整单等叫";
},
pointsDiscountAmount() {
if (this.points.selected) {
return this.points.toMoney;
@ -1765,6 +1877,8 @@ export default {
!this.order.selGoods ||
this.order.old.list.length <= 0 ||
this.order.selGoods.status == "return"
||this.order.selGoods.useType=='dine-in'
||this.order.selGoods.useType=='dine-in-before'
);
},
title() {
@ -1918,8 +2032,28 @@ export default {
}, 0);
return (oldMemberPrice + nowMemberprice).toFixed(2);
},
discountSaleAmount() {
const oldTotal = this.order.old.list.reduce((a, b) => {
const bTotal = b.info
.filter((v) => v.discountSaleAmount && v.discountSaleAmount > 0)
.reduce((prve, cur) => {
return prve + cur.number * cur.discountSaleAmount;
}, 0);
return a + bTotal;
}, 0);
const nowTotal = this.order.list
.filter((v) => v.discountSaleAmount && v.discountSaleAmount > 0)
.reduce((a, b) => {
return a + b.number * b.discountSaleAmount;
}, 0);
return (oldTotal + nowTotal).toFixed(2);
},
youhuiAllPrice() {
return (this.vipDiscountPrice * 1 + this.allGiftMoney * 1).toFixed(2);
return (
this.vipDiscountPrice * 1 +
this.allGiftMoney * 1 +
this.discountSaleAmount * 1
).toFixed(2);
},
allNumber() {
const oldNumber = this.order.old.list.reduce((a, b) => {
@ -1975,7 +2109,7 @@ export default {
watch: {
yinFuJinE: function (newval) {
if (newval <= 0) {
this.disabledPayType = ["scanCode", "deposit"];
this.disabledPayType = ["scanCode", "deposit","creditBuyer"];
} else {
this.disabledPayType = [];
}
@ -2194,6 +2328,38 @@ export default {
this.open(this.$route.query);
},
methods: {
//
guazhangPayConfirm(guazhangren, price) {
this.guazhangRen = guazhangren;
this.pays({
creditBuyerId: this.guazhangRen.id,
payType: "creditBuyer",
});
},
//
guazhangShow() {
this.$refs.refGuaZhang.open();
},
//
shouwTuanQuan() {
this.$refs.refPopTuanQuan.open();
},
tuanQuanConfirm(e) {
console.log(e);
this.tuanQuan = e;
},
//
updateCartItem(res) {
if (res) {
// this.order.list[this.order.selIndex] = res;
this.$set(this.order.list, this.order.selIndex, res)
}
},
//
refPopChangePriceShow() {
const orderGoods = this.order.list[this.order.selIndex];
this.$refs.refPopChangePrice.open(orderGoods);
},
returnProDiscount(row) {
console.log(row);
//
@ -2216,18 +2382,22 @@ export default {
}
},
lingshicaiShow() {
this.$refs.refPopAddCai.open();
this.$refs.refPopAddCai.open({
masterId: this.masterId,
tableId: this.table.tableId,
vipUserId: this.vipUser.id,
});
},
delQuan(row) {
const index = this.quansSelArr.findIndex((v) => v.id == row.id);
console.log(index);
if (index != -1) {
this.quansSelArr.splice(index, 1);
this.quansSelArr
.map((v, index) => {
this.quansSelArr.map((v, index) => {
return {
...v,
discountAmount:v.type==2?this.returnProDiscount(v):v.discountAmount,
discountAmount:
v.type == 2 ? this.returnProDiscount(v) : v.discountAmount,
};
});
}
@ -2249,8 +2419,8 @@ export default {
this.vipUser.accountPoints,
this.points.res.maxUsablePoints || 0
);
if(!pointsRes.usable){
this.points.selected=false
if (!pointsRes.usable) {
this.points.selected = false;
}
}
return pointsRes;
@ -2298,7 +2468,8 @@ export default {
e.map((v, index) => {
return {
...v,
discountAmount:v.type==2? this.returnProDiscount(v):v.discountAmount,
discountAmount:
v.type == 2 ? this.returnProDiscount(v) : v.discountAmount,
};
});
this.quansSelArr = [...e];
@ -2892,7 +3063,7 @@ export default {
this.pays();
},
//
async pays() {
async pays(par) {
this.loading = true;
const userCouponInfos = this.quansSelArr.reduce((prve, cur) => {
const index = prve.findIndex((v) => v.userCouponId == cur.couponId);
@ -2907,6 +3078,15 @@ export default {
return prve;
}, []);
try {
//
if (this.tuanQuan && this.tuanQuan.goods.length > 0) {
await $checkCoupon({
code: this.tuanQuan.couponCode,
num: this.tuanQuan.number,
orderId: this.createOrder.data.id,
cartId: this.tuanQuan.goods.map((v) => v.cartId),
});
}
const res = await $payOrder({
tableId: this.table.tableId,
masterId: this.masterId,
@ -2915,8 +3095,9 @@ export default {
vipUserId: this.createOrder.data.memberId || this.vipUser.id,
discount: this.createOrder.discount,
code: this.createOrder.code,
userCouponInfos,
userCouponInfos: userCouponInfos.length > 0 ? userCouponInfos : "",
pointsNum: this.points.value,
...par,
});
this.loading = false;
this.payOrderSuccess();
@ -3044,7 +3225,16 @@ export default {
updateOrder(par = {}) {
let item = this.order.list[this.order.selIndex];
console.log(this.table);
const { productId, skuId, isPack, isGift, number, id } = item;
const {
productId,
skuId,
isPack,
isGift,
number,
id,
isPrint,
isWaitCall,
} = item;
$updateCart({
cartId: id,
masterId: this.masterId,
@ -3055,6 +3245,8 @@ export default {
num: number,
isPack: isPack === "true" ? true : false,
isGift: isGift === "true" ? true : false,
isPrint,
isWaitCall,
...par,
}).then((res) => {
this.$set(this.order.list, this.order.selIndex, {
@ -3107,7 +3299,7 @@ export default {
// },
//
orderBtnsClick(key) {
async orderBtnsClick(key) {
const orderGoods = this.order.list[this.order.selIndex];
if (this.key != "isJieZhang" && this.payAfter) {
this.createOrderClose();
@ -3132,6 +3324,27 @@ export default {
if (key === "del") {
return this.removeCart();
}
if (key === "print") {
const isPrint = orderGoods.isPrint;
this.updateOrder({ isPrint: !isPrint });
return;
}
if (key === "isWaitCall") {
const isWaitCall = orderGoods.isWaitCall;
this.updateOrder({ isWaitCall: !isWaitCall });
return;
}
if (key == "AllWaitCall") {
await $waitCall({
orderId:this.createOrder.data.id,
masterId:this.masterId,
tableId:this.table.tableId,
isWaitCall: !this.isAllWaitCall?1:0
})
this.isAllWaitCall=!this.isAllWaitCall;
this.getCart()
return;
}
if (key === "save") {
this.prveOrder.list.push({
cart: this.order.list,
@ -3532,6 +3745,7 @@ export default {
tableId: this.table.tableId,
num: this.skuGoods.number, // 0
isPack: false, //
isWaitCall:this.isAllWaitCall //
});
this.orderListPush({ ...res, specSnap: name });
// this.orderListPush({
@ -3637,6 +3851,7 @@ export default {
},
reset() {
// this.goods.list = [];
this.guazhangRen = "";
this.order.status = "";
this.loading = false;
this.table = "";
@ -3671,6 +3886,7 @@ export default {
//
setCart(res) {
console.log(res);
try {
const { seatFee } = res;
this.order.seatFee = seatFee
? {
@ -3690,6 +3906,32 @@ export default {
this.order.old.list = oldCart ? oldCart : [];
// this.order.gift.list = returnGiftArr(res.records);
console.log(this.order.old.list);
} catch (error) {
//
this.$confirm('购物车数据结构错误,是否清空购物车商品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$clearCart({
masterId: this.masterId,
tableId: this.table.tableId,
}).then((res) => {
this.order.list = [];
this.changeOrderSel(-1);
this.$message({
type: "success",
message: "清除成功!",
});
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}
},
//
async getCart() {
@ -3833,6 +4075,7 @@ export default {
tableId: this.table.tableId,
num: item.specList[0].suit, // 0
isPack: false, //
isWaitCall:this.isAllWaitCall //
});
this.orderListPush(res);
}
@ -4114,9 +4357,7 @@ input[type="number"]::-webkit-outer-spin-button {
background-color: #fff;
height: 100%;
}
::v-deep .el-button--text {
// color: #000;
}
::v-deep .meal_box .el-button-group {
width: 100%;
display: flex;
@ -4635,13 +4876,6 @@ input[type="number"]::-webkit-outer-spin-button {
background-color: #fff;
border: 1px solid #dcdfe6;
}
::v-deep .el-checkbox__input.is-checked .el-checkbox__inner {
// background-color: #22bf64;
// border-color: #22bf64;
}
::v-deep .el-checkbox__input.is-checked + .el-checkbox__label {
// color: #22bf64;
}
::v-deep .tag-group .el-tag--dark {
background: rgba(34, 191, 100, 0.1);

View File

@ -219,3 +219,13 @@ export function returnCouponAllPrice(coupArr, goodsArr, vipUser) {
const pointAllPrice=returnFullReductionCouponAllPrice(coupArr)
return (poductAllprice*1+pointAllPrice*1).toFixed(2);
}
//返回购物车商品价格
export function returnCartPrice(goods, vipUser) {
const price=goods.price||goods.salePrice
if(!vipUser||!vipUser.id ||!vipUser.isVip){
return price
}
const memberPrice = goods.memberPrice ? goods.memberPrice :price;
return memberPrice
}