下单退款相关更新
This commit is contained in:
parent
c2135c6119
commit
994cf8bf2b
1
App.vue
1
App.vue
|
|
@ -9,6 +9,7 @@ App.vue本身不是页面,这里不能编写视图元素,也就是没有<tem
|
|||
import { provide } from 'vue';
|
||||
|
||||
import WebsocketUtil from '@/commons/utils/websocket.js'
|
||||
|
||||
const websocketUtil = new WebsocketUtil(appConfig.wss, 5000); // 创建 WebSocket 工具类实例
|
||||
provide('websocketUtil', websocketUtil); // 提供给所有子组件
|
||||
|
||||
|
|
|
|||
16
api/area.js
16
api/area.js
|
|
@ -1,16 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取区域列表
|
||||
* @returns
|
||||
*/
|
||||
export function getShopArea(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopArea`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
136
api/buyer.js
136
api/buyer.js
|
|
@ -1,136 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取挂账人分页
|
||||
* @returns
|
||||
*/
|
||||
export function getCreditBuyerPage(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取挂账人详情
|
||||
* @returns
|
||||
*/
|
||||
export function getCreditBuyerDetail(id, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer/${id}`,
|
||||
method: "GET",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加挂账人
|
||||
* @returns
|
||||
*/
|
||||
export function addCreditBuyer(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑挂账人
|
||||
* @returns
|
||||
*/
|
||||
export function editCreditBuyer(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除挂账人
|
||||
* @returns
|
||||
*/
|
||||
export function delCreditBuyer(id, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer/${id}`,
|
||||
method: "DELETE",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 还款
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerRepayment(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer/repayment`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 付款
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerOrderPay(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyerOrder/pay`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 还款记录
|
||||
* @returns
|
||||
*/
|
||||
export function creditRePaymentRecord(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/paymentRecord/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细分页
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerOrderList(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyerOrder/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细统计
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerOrderSummary(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyerOrder/summary`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取叫号队列
|
||||
* @returns
|
||||
*/
|
||||
export function getCallTableQueue(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/callTable/queue`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取叫号记录列表
|
||||
* @returns
|
||||
*/
|
||||
export function getCallRecord(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/callTable/callRecord`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取叫号桌型
|
||||
* @returns
|
||||
*/
|
||||
export function getCallTable(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/callTable`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取叫号号码
|
||||
* @returns
|
||||
*/
|
||||
export function callTableTakeNumber(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/callTable/takeNumber`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行叫号
|
||||
* @returns
|
||||
*/
|
||||
export function callTableCall(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/callTable/call`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改叫号状态
|
||||
* @returns
|
||||
*/
|
||||
export function updateCallTableState(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/callTable/updateState`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取分类分页
|
||||
* @returns
|
||||
*/
|
||||
export function categoryPage(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/category/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类添加
|
||||
* @returns
|
||||
*/
|
||||
export function addCategory(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/category`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类修改
|
||||
* @returns
|
||||
*/
|
||||
export function putCategory(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/category`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类删除
|
||||
* @returns
|
||||
*/
|
||||
export function delCategory(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/category/${id}`,
|
||||
method: "DELETE",
|
||||
})
|
||||
}
|
||||
194
api/cons.js
194
api/cons.js
|
|
@ -1,194 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取耗材分页
|
||||
* @returns
|
||||
*/
|
||||
export function getConsPage(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/cons/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取耗材列表
|
||||
* @returns
|
||||
*/
|
||||
export function getConsList(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/cons/list`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材添加
|
||||
* @returns
|
||||
*/
|
||||
export function addCons(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/cons`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材修改
|
||||
* @returns
|
||||
*/
|
||||
export function editCons(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/cons`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取耗材类别
|
||||
* @returns
|
||||
*/
|
||||
export function getConsGrpupPage(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/consGroup/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取耗材类别
|
||||
* @returns
|
||||
*/
|
||||
export function getConsGrpupList(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/consGroup/list`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增耗材类别
|
||||
* @returns
|
||||
*/
|
||||
export function addConsGrpup(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/consGroup`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改耗材类别
|
||||
* @returns
|
||||
*/
|
||||
export function editConsGrpup(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/consGroup`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用耗材类别
|
||||
* @returns
|
||||
*/
|
||||
export function consGrpupEnable(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/consGroup/enable/${id}`,
|
||||
method: "POST",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用耗材类别
|
||||
* @returns
|
||||
*/
|
||||
export function consGrpupDisable(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/consGroup/disable/${id}`,
|
||||
method: "POST",
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 耗材入库
|
||||
* @returns
|
||||
*/
|
||||
export function consStockIn(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/stock/in`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材出库
|
||||
* @returns
|
||||
*/
|
||||
export function stockOut(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/stock/out`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存盘点
|
||||
* @returns
|
||||
*/
|
||||
export function stockCheck(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/stock/check`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材报损
|
||||
* @returns
|
||||
*/
|
||||
export function stockReportDamage(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/stock/reportDamage`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 店铺优惠券列表
|
||||
* @returns
|
||||
*/
|
||||
export function getCouponList(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/coupon`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成订单后使用
|
||||
* @returns
|
||||
*/
|
||||
export function getFindCoupon(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/coupon/findCoupon`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺优惠券新增
|
||||
* @returns
|
||||
*/
|
||||
export function addCoupon(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/coupon`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺优惠券修改
|
||||
* @returns
|
||||
*/
|
||||
export function updateCoupon(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/coupon`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取当前店铺霸王餐配置信息列表
|
||||
* @returns
|
||||
*/
|
||||
export function getFreeDing(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/freeDing`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改霸王餐配置信息
|
||||
* @returns
|
||||
*/
|
||||
export function updateFreeDing(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/freeDing`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 交班记录-分页
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecord(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handoverRecord/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 交班记录-查看
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecordView(id, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handoverRecord/${id}`,
|
||||
method: "GET",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 交班记录-导出
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecordExport(id, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handoverRecord/export/${id}`,
|
||||
method: "GET",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银机-交班数据统计
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecordTotal(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handoverRecord/total`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银机-交班/关班
|
||||
* @returns
|
||||
*/
|
||||
export function getHandoverRecordHandover(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/handoverRecord/handover`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
24
api/index.js
24
api/index.js
|
|
@ -1,24 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @returns
|
||||
*/
|
||||
export function uploadFile(file, data, urlType = 'account') {
|
||||
return http.upload(`${urlType}/admin/common/upload`,data,file)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺权限列表
|
||||
* @returns
|
||||
*/
|
||||
export function getShopPermission(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopPermission`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
30
api/login.js
30
api/login.js
|
|
@ -1,30 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
* @returns
|
||||
*/
|
||||
export function authCaptcha(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/auth/captcha`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @returns
|
||||
*/
|
||||
export function login(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/auth/login`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
89
api/order.js
89
api/order.js
|
|
@ -1,89 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取订单列表
|
||||
* @returns
|
||||
*/
|
||||
export function getOrderList(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
* @returns
|
||||
*/
|
||||
export function getOrderById(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/getOrderById`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 历史订单(多次下单使用)
|
||||
* @returns
|
||||
*/
|
||||
export function getHistoryOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/historyOrder`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成订单
|
||||
* @returns
|
||||
*/
|
||||
export function createOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/createOrder`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款 只传订单id
|
||||
* @returns
|
||||
*/
|
||||
export function refundOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/refundOrder`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单打印
|
||||
* @returns
|
||||
*/
|
||||
export function printOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/print`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
86
api/pay.js
86
api/pay.js
|
|
@ -1,86 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取店铺订单支付URL
|
||||
* @returns
|
||||
*/
|
||||
export function getOrderPayUrl(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/pay/shopPayApi/orderPayUrl`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码支付
|
||||
* @returns
|
||||
*/
|
||||
export function scanPay(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/pay/scanPay`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 现金支付
|
||||
* @returns
|
||||
*/
|
||||
export function cashPay(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/pay/cashPay`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码/储值支付
|
||||
* @returns
|
||||
*/
|
||||
export function microPay(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/pay/microPay`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账支付
|
||||
* @returns
|
||||
*/
|
||||
export function creditPay(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/pay/creditPay`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员支付
|
||||
* @returns
|
||||
*/
|
||||
export function vipPay(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/pay/vipPay`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取支付方式列表
|
||||
* @returns
|
||||
*/
|
||||
export function getPayTypeList(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/payType`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取订单可用积分及抵扣金额(支付页面使用)
|
||||
* @returns
|
||||
*/
|
||||
export function calcUsablePoints(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/points/memberPoints/calcUsablePoints`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据积分计算可抵扣金额
|
||||
* @returns
|
||||
*/
|
||||
export function calcDeductionAmount(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/points/memberPoints/calcDeductionAmount`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付完成扣减积分
|
||||
* @returns
|
||||
*/
|
||||
export function payedDeductPoints(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/points/memberPoints/payedDeductPoints`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 消费赠送积分
|
||||
* @returns
|
||||
*/
|
||||
export function consumeAwardPoints(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/points/memberPoints/consumeAwardPoints`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取打印机列表
|
||||
* @returns
|
||||
*/
|
||||
export function getPrinter(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/printer`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打印机详情
|
||||
* @returns
|
||||
*/
|
||||
export function getPrinterDetail(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/printer/detail`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加打印机
|
||||
* @returns
|
||||
*/
|
||||
export function addPrinter(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/printer`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改打印机
|
||||
* @returns
|
||||
*/
|
||||
export function updatePrinter(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/printer`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除打印机
|
||||
* @returns
|
||||
*/
|
||||
export function delPrinter(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/printer`,
|
||||
method: "DELETE",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
305
api/product.js
305
api/product.js
|
|
@ -1,305 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
// 商品----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* 获取商品分页
|
||||
* @returns
|
||||
*/
|
||||
export function getProductPage(data, urlType = 'product' ,showLoading) {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
},
|
||||
showLoading
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
* @returns
|
||||
*/
|
||||
export function getProductList(data, urlType = 'product' ,showLoading) {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/list`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
},
|
||||
showLoading
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
* @returns
|
||||
*/
|
||||
export function getProductDetail (id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/${id}`,
|
||||
method: "GET",
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品
|
||||
* @returns
|
||||
*/
|
||||
export function addProduct(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
* @returns
|
||||
*/
|
||||
export function delProduct(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/${id}`,
|
||||
method: "DELETE",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品上下架
|
||||
* @returns
|
||||
*/
|
||||
export function productOnOff (data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/onOff`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品售罄
|
||||
* @returns
|
||||
*/
|
||||
export function productMarkIsSoldOut (data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/markIsSoldOut`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品
|
||||
* @returns
|
||||
*/
|
||||
export function updateProduct(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定耗材
|
||||
* @returns
|
||||
*/
|
||||
export function productBindCons(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/bind`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品报损
|
||||
* @returns
|
||||
*/
|
||||
export function productReportDamage(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/reportDamage`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 商品分类----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* 获取商品分类列表
|
||||
* @returns
|
||||
*/
|
||||
export function getCategoryList(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/category/list`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 商品单位----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* 获取商品单位列表
|
||||
* @returns
|
||||
*/
|
||||
export function getProdUnitList(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/unit/list`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 商品规格----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* 获取商品规格列表
|
||||
* @returns
|
||||
*/
|
||||
export function getSpecList(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/spec/list`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品规格
|
||||
* @returns
|
||||
*/
|
||||
export function addSpec(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/spec`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规格
|
||||
* @returns
|
||||
*/
|
||||
export function updateSpec(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/spec`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 快捷添加商品规格
|
||||
* @returns
|
||||
*/
|
||||
export function addSpecQuic(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/spec/quickAdd`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格
|
||||
* @returns
|
||||
*/
|
||||
export function delSpec(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/spec/${id}`,
|
||||
method: "DELETE",
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
// 商品分组----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* 获取商品分组列表
|
||||
* @returns
|
||||
*/
|
||||
export function getProdGroupPage(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/group/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品分组详情
|
||||
* @returns
|
||||
*/
|
||||
export function getProdGroupDetail(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/group/${id}`,
|
||||
method: "GET",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品分组添加
|
||||
* @returns
|
||||
*/
|
||||
export function addProdGroup(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/group`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品分组修改
|
||||
* @returns
|
||||
*/
|
||||
export function updateProdGroup(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/group`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品分组删除
|
||||
* @returns
|
||||
*/
|
||||
export function delProdGroup(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/group/${id}`,
|
||||
method: "DELETE",
|
||||
})
|
||||
}
|
||||
16
api/role.js
16
api/role.js
|
|
@ -1,16 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取角色列表
|
||||
* @returns
|
||||
*/
|
||||
export function getRoleList(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/role/list`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
58
api/shop.js
58
api/shop.js
|
|
@ -1,58 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取店铺详情
|
||||
* @returns
|
||||
*/
|
||||
export function getShopInfo(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopInfo/detail`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店铺详情
|
||||
* @returns
|
||||
*/
|
||||
export function editShopInfo(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopInfo`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前店铺拓展参数
|
||||
* @returns
|
||||
*/
|
||||
export function getShopExtend(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopExtend`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前店铺拓展参数
|
||||
* @returns
|
||||
*/
|
||||
export function editShopExtend(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopExtend`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取店铺用户概述信息
|
||||
* @returns
|
||||
*/
|
||||
export function shopUserSummary(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopUser/summary`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺用户列表
|
||||
* @returns
|
||||
*/
|
||||
export function shopUserList(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopUser`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺用户详情
|
||||
* @returns
|
||||
*/
|
||||
export function shopUserDetail(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopUser/detail`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺用户新增
|
||||
* @returns
|
||||
*/
|
||||
export function shopUserAdd(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopUser`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺用户修改
|
||||
* @returns
|
||||
*/
|
||||
export function shopUserPut(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopUser`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺用户余额修改
|
||||
* @returns
|
||||
*/
|
||||
export function shopUserMoney(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopUser/money`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
86
api/staff.js
86
api/staff.js
|
|
@ -1,86 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 员工列表
|
||||
* @returns
|
||||
*/
|
||||
export function shopStaffList(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopStaff`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工对应的权限idid
|
||||
* @returns
|
||||
*/
|
||||
export function getShopStaffPermission(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopStaff/permission`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工详情
|
||||
* @returns
|
||||
*/
|
||||
export function shopStaffDetail(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopStaff/detail`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工添加
|
||||
* @returns
|
||||
*/
|
||||
export function shopStaffAdd(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopStaff`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工修改
|
||||
* @returns
|
||||
*/
|
||||
export function shopStaffPut(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopStaff`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工删除
|
||||
* @returns
|
||||
*/
|
||||
export function shopStaffDel(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopStaff`,
|
||||
method: "DELETE",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 营业板块
|
||||
* @returns
|
||||
*/
|
||||
export function getTrade(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/data/summary/trade`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品销售汇总
|
||||
* @returns
|
||||
*/
|
||||
export function productSaleDate(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/data/summary/productSaleDate`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
58
api/table.js
58
api/table.js
|
|
@ -1,58 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取台桌列表
|
||||
* @returns
|
||||
*/
|
||||
export function getShopTable(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopTable`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取台桌详情
|
||||
* @returns
|
||||
*/
|
||||
export function getShopTableDetail(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopTable/detail`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 台桌清台
|
||||
* @returns
|
||||
*/
|
||||
export function shopTableClear(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopTable/clear`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 台桌绑定
|
||||
* @returns
|
||||
*/
|
||||
export function shopTableBind(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopTable/bind`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取供应商列表
|
||||
* @returns
|
||||
*/
|
||||
export function getVendorPage(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/vendor/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加供应商
|
||||
* @returns
|
||||
*/
|
||||
export function addVendor(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/vendor`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑供应商
|
||||
* @returns
|
||||
*/
|
||||
export function editVendor(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/vendor`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除供应商
|
||||
* @returns
|
||||
*/
|
||||
export function delVendor(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/vendor/${id}`,
|
||||
method: "DELETE",
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -20,6 +20,7 @@ export function canTuiKuan(orderInfo, item) {
|
|||
if( item ){
|
||||
return (orderInfo.status == 'done' || orderInfo.status == 'part_refund')
|
||||
&& item.status != 'return' && item.status != 'refund' && item.status != 'refunding'
|
||||
&& (item.returnAmount < item.num*item.unitPrice)
|
||||
} else {
|
||||
let goodsList = []
|
||||
let data = false;
|
||||
|
|
@ -27,7 +28,7 @@ export function canTuiKuan(orderInfo, item) {
|
|||
goodsList = [...goodsList,...value]
|
||||
))
|
||||
goodsList.some((v,i)=>{
|
||||
if( (orderInfo.status == 'done' || orderInfo.status == 'part_refund') && v.status != 'return' && v.status != 'refund' && v.status != 'refunding' ){
|
||||
if( orderInfo.refundAmount < orderInfo.payAmount || (orderInfo.status == 'done' || orderInfo.status == 'part_refund' ) && v.status != 'return' && v.status != 'refund' && v.status != 'refunding' && (v.returnNum+v.refundNum < v.num) ){
|
||||
data = true
|
||||
return data
|
||||
}
|
||||
|
|
@ -50,4 +51,15 @@ export function numSum(arr) {
|
|||
return a + b * 100
|
||||
}, 0)
|
||||
return (sum / 100).toFixed(2)
|
||||
}
|
||||
export function mathFloorPrice(price,item) {
|
||||
if( item ){
|
||||
if( item.productType == 'weight' || item.type == 'weight'){
|
||||
return (Math.floor(price * 100)/100).toFixed(2)
|
||||
} else {
|
||||
return parseFloat(price).toFixed(2)
|
||||
}
|
||||
} else {
|
||||
return parseFloat(price).toFixed(2)
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ class WebsocketUtil {
|
|||
this.reconnectTimeout = null; // 重连定时器
|
||||
this.heartbeatInterval = null; // 心跳定时器
|
||||
this.messageCallbacks = []; // 存储外部注册的消息回调函数的数组
|
||||
this.messageCallbacks = []; // 存储外部注册的消息回调函数的数组
|
||||
|
||||
// 初始化 WebSocket 连接
|
||||
this.initializeWebSocket();
|
||||
|
|
@ -27,7 +28,6 @@ class WebsocketUtil {
|
|||
url: this.url,
|
||||
success: () => {
|
||||
console.log('WebSocket连接成功');
|
||||
|
||||
return this.socketTask;
|
||||
},
|
||||
fail: (error) => {
|
||||
|
|
|
|||
|
|
@ -102,9 +102,7 @@
|
|||
const form = reactive({
|
||||
...$form
|
||||
})
|
||||
console.log(form)
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
form.currentPrice=newval
|
||||
})
|
||||
|
|
@ -129,7 +127,6 @@
|
|||
const emits = defineEmits(['confirm'])
|
||||
|
||||
function confirm() {
|
||||
console.log(form);
|
||||
emits('confirm',{...form,currentPrice:Number(form.currentPrice).toFixed(2)})
|
||||
close()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,3 +192,31 @@ export function stockReportDamage(data, urlType = 'product') {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材库存变动记录
|
||||
* @returns
|
||||
*/
|
||||
export function stockFlow(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/stock/flow`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材统计
|
||||
* @returns
|
||||
*/
|
||||
export function consStatistics(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/cons/statistics`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -84,3 +84,17 @@ export function vipPay(data, urlType = 'order') {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
* @returns
|
||||
*/
|
||||
export function queryOrderStatus(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/pay/queryOrderStatus`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@
|
|||
getConsGrpupList({
|
||||
page: 1,
|
||||
size: 30,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
}).then(res => {
|
||||
datas.typeList = res
|
||||
res.forEach(ele => {
|
||||
|
|
|
|||
|
|
@ -1,72 +1,60 @@
|
|||
<template>
|
||||
<view style="position: fixed;right: 50rpx;top: 80vh;background-color: #fff;border-radius: 50%;width: 65rpx;height: 65rpx;display: flex;align-items: center;justify-content: center;">
|
||||
<image src="./time.png" style="width: 50rpx;height: 50rpx;" @tap="popPu"
|
||||
mode=""></image>
|
||||
</view>
|
||||
<view :style="{height:showStatus?statusHeight:0}" class="tranistion status overflow-hide">
|
||||
<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
|
||||
v-for="(item,index) in datas.status" :key="index">
|
||||
<view :class="{'color-main':nowStatusIndex===index}">{{item.conTypeName}}</view>
|
||||
<uni-icons v-if="nowStatusIndex===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
|
||||
</view>
|
||||
<view :style="{height: '14px'}"></view>
|
||||
</view>
|
||||
<view class="viewrecordsTop">
|
||||
<view class="viewrecordsTop" v-if="datas.countList">
|
||||
<view style="padding:32rpx 16rpx;">
|
||||
<view @tap="getNewdata('addCountNumber')">
|
||||
<view @tap="getInOutType('in')">
|
||||
增加数量 <text
|
||||
style="color: #76ACF0;font-weight: bold;">{{datas.countList.addCountNumber?datas.countList.addCountNumber:'0'}}</text>
|
||||
style="color: #76ACF0;font-weight: bold;">{{datas.countList.inSumTotal?datas.countList.inSumTotal:'0'}}</text>
|
||||
</view>
|
||||
<view class="df viewdf">
|
||||
<view @tap="getNewdata('stockInNumber')"
|
||||
<view @tap="getNewdata('manual-in','in')"
|
||||
style="font-size: 24rpx;border-right: 1px solid #999; width: 142rpx;text-align: center;">
|
||||
<view style="color: #999999;">
|
||||
入库
|
||||
</view>
|
||||
<view class="">
|
||||
{{datas.countList.stockInNumber?datas.countList.stockInNumber:0}}
|
||||
{{datas.countList.stockInNum?datas.countList.stockInNum:0}}
|
||||
</view>
|
||||
</view>
|
||||
<view @tap="getNewdata('addNumber')" style="font-size: 24rpx;width: 178rpx;text-align: center;">
|
||||
<view @tap="getNewdata('win-in','in')" style="font-size: 24rpx;width: 178rpx;text-align: center;">
|
||||
<view style="color: #999999;">
|
||||
手动增加
|
||||
</view>
|
||||
<view class="">
|
||||
{{datas.countList.addNumber?datas.countList.addNumber:'0'}}
|
||||
{{datas.countList.winInNum?datas.countList.winInNum:'0'}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="padding:32rpx 16rpx;">
|
||||
<view class="" @tap="getNewdata('subCountNumber')">
|
||||
<view class="" @tap="getInOutType('out')">
|
||||
减少数量 <text
|
||||
style="color: #52BDA4;font-weight: bold;">{{datas.countList.subCountNumber?datas.countList.subCountNumber:0}}</text>
|
||||
style="color: #52BDA4;font-weight: bold;">{{datas.countList.outSumTotal?datas.countList.outSumTotal:0}}</text>
|
||||
</view>
|
||||
<view class="df viewdf">
|
||||
<view @tap="getNewdata('subNumber')"
|
||||
<view @tap="getNewdata('loss-out','out')"
|
||||
style="font-size: 24rpx;border-right: 1px solid #999; width: 112rpx;text-align: center;">
|
||||
<view style="color: #999999;">
|
||||
手动减少
|
||||
</view>
|
||||
<view class="">
|
||||
{{datas.countList.subNumber?datas.countList.subNumber:0}}
|
||||
{{datas.countList.lossOutNum?datas.countList.lossOutNum:0}}
|
||||
</view>
|
||||
</view>
|
||||
<view @tap="getNewdata('stockOutNumber')"
|
||||
<view @tap="getNewdata('manual-out','out')"
|
||||
style="font-size: 24rpx;border-right: 1px solid #999; width: 82rpx;text-align: center;">
|
||||
<view style="color: #999999;">
|
||||
出库
|
||||
</view>
|
||||
<view class="">
|
||||
{{datas.countList.stockOutNumber?datas.countList.stockOutNumber:0}}
|
||||
{{datas.countList.stockOutNum?datas.countList.stockOutNum:0}}
|
||||
</view>
|
||||
</view>
|
||||
<view @tap="getNewdata('saleNumber')" style="font-size: 24rpx;width: 112rpx;text-align: center;">
|
||||
<view @tap="getNewdata('order-out','out')" style="font-size: 24rpx;width: 112rpx;text-align: center;">
|
||||
<view style="color: #999999;">
|
||||
商品消耗
|
||||
</view>
|
||||
<view class="">
|
||||
{{datas.countList.saleNumber?datas.countList.saleNumber:0}}
|
||||
{{datas.countList.consumeNum?datas.countList.consumeNum:0}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -75,26 +63,22 @@
|
|||
<view class="viewrecords">
|
||||
<view v-for="item in datas.list" :key="item.id">
|
||||
<view class="">
|
||||
<view class="">
|
||||
{{item.createTime}}
|
||||
</view>
|
||||
<view class="">
|
||||
{{item.operator}} {{item.bizName}}
|
||||
</view>
|
||||
<view class=""> {{item.createTime}} </view>
|
||||
<view class=""> {{item.operator}} {{item.conName}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="">
|
||||
<view style="font-size: 24rpx;color: #666666;">
|
||||
库存 {{ inventory(item.balance,item.bizType,item.amount)}} <text
|
||||
:style="{color:item.bizType=='+'?'#1bca72':'red'}"> → {{ item.amount|0 }}</text>
|
||||
库存 {{ item.beforeNumber }} <text
|
||||
:style="{color:item.inOutType=='in'?'#1bca72':'red'}"> → {{ item.inOutNumber|0 }}</text>
|
||||
</view>
|
||||
<view style="font-size: 24rpx;color: #666666;">
|
||||
剩余库存 {{item.balance}}
|
||||
剩余库存 {{item.afterNumber}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view :style="{color:item.bizType=='+'?'#1bca72':'red'}" style="font-weight: 400;">
|
||||
{{ item.bizType }}{{ item.amount|0 }}
|
||||
<view :style="{color:item.inOutType=='in'?'#1bca72':'red'}" style="font-weight: 400;">
|
||||
{{ item.inOutType == 'in' ? '+' : '-' }}{{ item.inOutNumber|0 }}
|
||||
</view>
|
||||
<view style="font-size: 24rpx;color: #666666;">
|
||||
变动库存
|
||||
|
|
@ -103,24 +87,13 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<datePickerview @confirm="datePickerConfirm" ref="datePicker"></datePickerview>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
computed,
|
||||
getCurrentInstance
|
||||
} from 'vue';
|
||||
import datePickerview from './components/my-date-pickerview.vue'
|
||||
import { onMounted, reactive, ref, computed, getCurrentInstance } from 'vue';
|
||||
import color from '@/commons/color.js';
|
||||
import {
|
||||
tbConsInfoFlowstock,
|
||||
tbConsInfoFlowcount,
|
||||
tbConsTypes
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
import { stockFlow,consStatistics } from '@/http/api/cons.js';
|
||||
|
||||
let props = defineProps({
|
||||
item: {
|
||||
type: String
|
||||
|
|
@ -129,88 +102,55 @@
|
|||
|
||||
let datas = reactive({
|
||||
list: [],
|
||||
countList: null,
|
||||
// 类型
|
||||
status: [],
|
||||
statusTitle: "类型"
|
||||
countList: {},
|
||||
inOutType: '',
|
||||
inOutItem: '',
|
||||
})
|
||||
let showStatus = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
let items = JSON.parse(props.item)
|
||||
getlist()
|
||||
})
|
||||
const refs = getCurrentInstance()
|
||||
let popPu = () => {
|
||||
refs.ctx.$refs.datePicker.toggle()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 时间筛选
|
||||
* @param {Object} e
|
||||
*/
|
||||
function datePickerConfirm(e) {
|
||||
getlist("", e.start, e.end)
|
||||
}
|
||||
|
||||
function inventory(a, b, c) {
|
||||
let data = 0
|
||||
if (b == '-') {
|
||||
data = a + c
|
||||
} else {
|
||||
data = a - c
|
||||
}
|
||||
return data
|
||||
}
|
||||
let nowStatusIndex = ref(0)
|
||||
let columnName = ref('')
|
||||
let getNewdata = (d) => {
|
||||
columnName.value = d
|
||||
|
||||
function getNewdata (d,e) {
|
||||
datas.inOutType = e
|
||||
datas.inOutItem = d
|
||||
getlist()
|
||||
}
|
||||
|
||||
function changeNowStatusIndex(i) {
|
||||
nowStatusIndex.value = i
|
||||
showStatus.value = false
|
||||
datas.statusTitle = datas.status[i].conTypeName
|
||||
getlist(datas.status[i].id)
|
||||
|
||||
function getInOutType (e) {
|
||||
datas.inOutType = e
|
||||
getlist()
|
||||
}
|
||||
const statusHeight = computed(() => {
|
||||
return 30 * datas.status.length + 14 + 'px'
|
||||
})
|
||||
let getlist = (conTypeId = "", start, end, ) => {
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
function getlist (conTypeId = "", start, end, ) {
|
||||
let ids = JSON.parse(props.item)
|
||||
// 列表
|
||||
tbConsInfoFlowstock({
|
||||
page: 0,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
size: 30,
|
||||
consId: ids.id,
|
||||
column: columnName.value,
|
||||
conTypeId,
|
||||
|
||||
|
||||
stockFlow({
|
||||
conId: ids.id,
|
||||
inOutType: datas.inOutType,
|
||||
inOutItem: datas.inOutItem
|
||||
}).then(res => {
|
||||
datas.list = res.content
|
||||
datas.list = res.records
|
||||
})
|
||||
// 顶部数据
|
||||
tbConsInfoFlowcount({
|
||||
page: 0,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
size: 30,
|
||||
sort: "createTime,desc",
|
||||
conTypeId,
|
||||
startTime: start,
|
||||
endTime: end,
|
||||
consId: JSON.parse(props.item).id,
|
||||
consStatistics({
|
||||
conId: ids.id,
|
||||
}).then(res => {
|
||||
datas.countList = res
|
||||
})
|
||||
|
||||
// 获取顶部类型/
|
||||
tbConsTypes({
|
||||
page: 0,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
size: 100,
|
||||
}).then(res => {
|
||||
datas.status = res.content
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -159,34 +159,14 @@
|
|||
if ( !pageData.formData.orderId ) {
|
||||
creditBuyerRepayment(params).then((res) => {
|
||||
console.log(res.repaymentCount > 0)
|
||||
if (res.repaymentCount > 0) {
|
||||
uni.$u.toast('还款成功')
|
||||
emits('affirm')
|
||||
close();
|
||||
|
||||
} else {
|
||||
uni.$u.toast(res.repaymentMsg)
|
||||
setTimeout(()=>{
|
||||
emits('affirm')
|
||||
close();
|
||||
},2000)
|
||||
}
|
||||
emits('affirm')
|
||||
close();
|
||||
|
||||
})
|
||||
} else {
|
||||
creditBuyerOrderPay(params).then((res) => {
|
||||
if (!res.repaymentMsg) {
|
||||
uni.$u.toast('付款成功')
|
||||
emits('affirm')
|
||||
close();
|
||||
|
||||
} else {
|
||||
uni.$u.toast(res.repaymentMsg)
|
||||
setTimeout(()=>{
|
||||
emits('affirm')
|
||||
close();
|
||||
},2000)
|
||||
}
|
||||
emits('affirm')
|
||||
close();
|
||||
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
<view><text class="cell_label">付款时间</text><text class="cell_value">{{item.lastPaymentTime || '-'}}</text></view>
|
||||
</view>
|
||||
<view class="bottomBox">
|
||||
<view class="btn record" @tap="toUrl('PAGES_CREDIT_BUYER_REPAYMENTRECORD',{id: pageData.query.creditBuyerId, orderId: item.id})">账单付款记录</view>
|
||||
<view class="btn record" @tap="toUrl('PAGES_CREDIT_BUYER_REPAYMENTRECORD',{id: pageData.query.creditBuyerId, orderId: item.orderId})">账单付款记录</view>
|
||||
<view class="btn payment" @tap="repaymentOpen(item)" :style="{ backgroundColor: pageData.repaymentMethod == 'total' ? '#999' :''}">付款</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -11,35 +11,27 @@
|
|||
<view class="pageSalesSummaryContent">
|
||||
<view class="">
|
||||
<view class=""> 实收金额(元) </view>
|
||||
<view class=""> {{list.sale?list.sale.incomeAmountAll:0}} </view>
|
||||
<view class=""> {{list.saleAmount?list.saleAmount:0}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class=""> 优惠金额(元) </view>
|
||||
<view class=""> {{list.count?list.count.saveAmount:0}} </view>
|
||||
<view class=""> {{list.discountAmount?list.discountAmount:0}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class=""> 客单价(元) </view>
|
||||
<view class=""> {{list.count?list.count.unitPrice:0}} </view>
|
||||
<view class=""> {{list.customerUnitPrice?customerUnitPrice:0}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class=""> 会员消费(元) </view>
|
||||
<view class=""> {{list.vip?list.vip.useAmount:0}} </view>
|
||||
<view class=""> {{list.memberPayAmount?list.memberPayAmount:0}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="">
|
||||
新增会员(人)
|
||||
</view>
|
||||
<view class="">
|
||||
{{list.vip?list.vip.newFlow:0}}
|
||||
</view>
|
||||
<view class=""> 新增会员(人) </view>
|
||||
<view class=""> {{list.newMemberCount?list.newMemberCount:0}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="">
|
||||
翻台率(%)
|
||||
</view>
|
||||
<view class="">
|
||||
{{list.count?list.count.turnoverRate:0}}
|
||||
</view>
|
||||
<view class=""> 翻台率(%) </view>
|
||||
<view class=""> {{list.tableTurnoverRate?list.tableTurnoverRate:0}} </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="table-scroll">
|
||||
|
|
@ -64,8 +56,8 @@
|
|||
style="width: 22rpx;height: 30rpx;" mode=""></image>
|
||||
{{item.productName}}
|
||||
</view>
|
||||
<view class="head">{{item.num}}</view>
|
||||
<view class="head">{{item.salesAmount || '无'}}</view>
|
||||
<view class="head">{{item.number}}</view>
|
||||
<view class="head">{{item.amount || '无'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -107,7 +99,7 @@
|
|||
}
|
||||
]
|
||||
let selected = ref('today')
|
||||
let list = ref([])
|
||||
let list = ref({})
|
||||
const currentInstance = getCurrentInstance()
|
||||
let tableList = ref([])
|
||||
let day = ref(1)
|
||||
|
|
@ -177,7 +169,7 @@
|
|||
page: 1,
|
||||
size: 5
|
||||
}).then((res) => {
|
||||
tableList.value = res.productList.records
|
||||
tableList.value = res.records
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
<view class="constantboxitem" v-for="(item,index) in tableList" :key="index"
|
||||
@click="toDetail(item)">
|
||||
<view class="head">{{item.productName}}</view>
|
||||
<view class="head">{{item.num}}</view>
|
||||
<view class="head">{{item.salesAmount || '无'}}</view>
|
||||
<view class="head">{{item.number}}</view>
|
||||
<view class="head">{{item.amount || '无'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -43,10 +43,10 @@
|
|||
function gettableData() {
|
||||
productSaleDate({
|
||||
day: props.day,
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 50
|
||||
}).then((res) => {
|
||||
tableList.value = res.productList.records
|
||||
tableList.value = res.records
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -35,11 +35,9 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref } from 'vue';
|
||||
import { getCurrentInstance, ref, reactive } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import {
|
||||
summaryTrade,
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
|
||||
import dayjs from 'dayjs' //时间格式库
|
||||
import datePickerview from './my-date-pickerview.vue'
|
||||
|
||||
|
|
@ -47,17 +45,25 @@
|
|||
|
||||
let selected = ref('today')
|
||||
let showAll = ref(false);
|
||||
let $list = []
|
||||
|
||||
let list = ref()
|
||||
const pageData = reactive({
|
||||
list: [
|
||||
{payType: '微信小程序', key:'wechatPayAmount', payAmount: 0},
|
||||
{payType: '支付宝小程序', key:'aliPayAmount', payAmount: 0},
|
||||
{payType: '主扫收款', key:'scanPayAmount', payAmount: 0},
|
||||
{payType: '收款码收款', key:'', payAmount: 0},
|
||||
{payType: '现金收款', key:'cashPayAmount', payAmount: 0},
|
||||
{payType: '充值收款', key:'rechargeAmount', payAmount: 0},
|
||||
],
|
||||
})
|
||||
function toggleShowAll() {
|
||||
showAll.value = !showAll.value
|
||||
setList()
|
||||
}
|
||||
|
||||
function setList() {
|
||||
list.value = showAll.value ? $list : $list.slice(0, 4)
|
||||
list.value = showAll.value ? pageData.list : pageData.list.slice(0, 4)
|
||||
}
|
||||
let list = ref()
|
||||
const emit = defineEmits(['totalRevenue'])
|
||||
const timeList = [{
|
||||
label: '今天',
|
||||
|
|
@ -90,7 +96,12 @@
|
|||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 获取统计数据
|
||||
* @param {Object} start
|
||||
* @param {Object} end
|
||||
*/
|
||||
function getlist(start, end) {
|
||||
let startTime, endTime;
|
||||
if (selected.value == 'today') {
|
||||
|
|
@ -123,15 +134,30 @@
|
|||
beginDate: startTime,
|
||||
endDate: endTime,
|
||||
}).then((res) => {
|
||||
$list = res.sale.payCount
|
||||
for (var key in res) {
|
||||
pageData.list.map(item=>{
|
||||
if(item.key == key) {
|
||||
item.payAmount = res[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
setList()
|
||||
emit('totalRevenue', res.sale.incomeAmountAll)
|
||||
let incomeAmountAll = 0;
|
||||
pageData.list.map(item=>{
|
||||
incomeAmountAll += (item.payAmount||0)
|
||||
})
|
||||
emit('totalRevenue', incomeAmountAll)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 日期筛选确认
|
||||
* @param {Object} e
|
||||
*/
|
||||
function datePickerConfirm(e) {
|
||||
getlist(e.start, e.end)
|
||||
}
|
||||
|
||||
// 获取当前时间
|
||||
function getdate() {
|
||||
const dt = new Date();
|
||||
|
|
@ -143,6 +169,7 @@
|
|||
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
||||
return `${y}-${m}-${d}`;
|
||||
}
|
||||
|
||||
// 获取昨天时间
|
||||
const formatTime = () => {
|
||||
let strDate = getdate()
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@
|
|||
});
|
||||
|
||||
onLoad((options) => {
|
||||
shopName.value = uni.getStorageSync('shopName');
|
||||
shopName.value = uni.getStorageSync('shopInfo').shopName;
|
||||
});
|
||||
|
||||
// 启动加载
|
||||
|
|
|
|||
|
|
@ -85,14 +85,18 @@
|
|||
>{{item.name}}</view>
|
||||
</view>
|
||||
<view class="extend_content">
|
||||
<view class="preview">
|
||||
<view class="preview" v-if="vdata.extendInfo.autoKey != 'ticket_logo'">
|
||||
<view class="index_bg"><up-image v-if="'index_bg' == vdata.extendInfo.autoKey" :src="vdata.extendInfo.value"></up-image></view>
|
||||
<view class="my_bg"><up-image v-if="'my_bg' == vdata.extendInfo.autoKey" :src="vdata.extendInfo.value"></up-image></view>
|
||||
<view class="bg"><up-image v-if="'member_bg' == vdata.extendInfo.autoKey" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/cashier_admin_app_shopSet/'+vdata.extendInfo.autoKey+'.png'" ></up-image></view>
|
||||
<view class="member_bg"><up-image v-if="'member_bg' == vdata.extendInfo.autoKey" :src="vdata.extendInfo.value"></up-image></view>
|
||||
<view class="shopinfo_bg"><up-image v-if="'shopinfo_bg' == vdata.extendInfo.autoKey" :src="vdata.extendInfo.value"></up-image></view>
|
||||
<view class="shopinfo_bg_f" v-if="'shopinfo_bg' == vdata.extendInfo.autoKey"></view>
|
||||
<view class="bg"><up-image v-if="vdata.extendInfo.autoKey" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/cashier_admin_app_shopSet/'+vdata.extendInfo.autoKey+'.png'" ></up-image></view>
|
||||
<view class="bg" v-if="vdata.extendInfo.autoKey" ><up-image :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/cashier_admin_app_shopSet/'+vdata.extendInfo.autoKey+'.png'" ></up-image></view>
|
||||
</view>
|
||||
<view class="preview" v-else style="width: 359rpx;height: 232rpx">
|
||||
<view class="bg ticket_logo" v-if="vdata.extendInfo.autoKey == 'ticket_logo'" ><up-image :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/cashier_admin_app_shopSet/'+vdata.extendInfo.autoKey+'.png'" ></up-image></view>
|
||||
<view class="ticket_logo img" ><up-image v-if="'ticket_logo' == vdata.extendInfo.autoKey" :src="vdata.extendInfo.value"></up-image></view>
|
||||
</view>
|
||||
<view class="extend_img">
|
||||
<view class="extend_title">{{vdata.extendInfo.name}}背景图片</view>
|
||||
|
|
@ -418,7 +422,7 @@ let showMap = () => {
|
|||
display: flex;
|
||||
margin-top: 32rpx;
|
||||
.preview{
|
||||
width: 146rpx;
|
||||
min-width: 146rpx;
|
||||
height: 342rpx;
|
||||
position: relative;
|
||||
margin-right: 32rpx;
|
||||
|
|
@ -445,7 +449,7 @@ let showMap = () => {
|
|||
}
|
||||
|
||||
::v-deep .member_bg .u-image,::v-deep .member_bg .u-image__image{
|
||||
width: 134rpx!important;
|
||||
width: 34rpx!important;
|
||||
height: 63rpx!important;
|
||||
position: absolute;
|
||||
top: 22rpx;
|
||||
|
|
@ -461,6 +465,19 @@ let showMap = () => {
|
|||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
::v-deep .bg.ticket_logo,::v-deep .bg.ticket_logo .u-image,::v-deep .bg.ticket_logo .u-image__image{
|
||||
width: 359rpx!important;
|
||||
height: 232rpx!important;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
::v-deep .ticket_logo.img .u-image,::v-deep .ticket_logo.img .u-image__image{
|
||||
width: 96rpx!important;
|
||||
height: 50rpx!important;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 10rpx;
|
||||
}
|
||||
|
||||
.shopinfo_bg_f{
|
||||
width: 146rpx;
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@
|
|||
v-model="searchValue">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
<!-- <view class="u-flex">
|
||||
<image src="/pagesCreateOrder/static/images/icon-saoma.svg" class="icon-saoma" mode=""></image>
|
||||
</view> -->
|
||||
</view>
|
||||
<view>
|
||||
<picker @change="areaChange" range-key="name" :value="area.defaultCateIndex" :range="area.list">
|
||||
|
|
@ -103,7 +100,6 @@
|
|||
})
|
||||
onLoad(opt => {
|
||||
Object.assign(option, opt)
|
||||
console.log(option);
|
||||
getTable()
|
||||
getArea()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -44,11 +44,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,watch
|
||||
} from 'vue';
|
||||
import { reactive, nextTick, ref,watch } from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||
|
|
@ -111,7 +107,6 @@
|
|||
...$form
|
||||
})
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
form.currentPrice=newval
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
<template>
|
||||
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||
<template #desc>
|
||||
<!-- <view class="u-m-t-48 tab">
|
||||
<my-tabs :list="tabs" @change="tabsChange"></my-tabs>
|
||||
</view> -->
|
||||
<view class="u-text-left u-p-30 ">
|
||||
<template v-if="!current">
|
||||
<view>
|
||||
|
|
@ -80,12 +77,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { reactive, nextTick, ref, watch } from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||
|
|
@ -164,7 +156,6 @@
|
|||
...$form
|
||||
})
|
||||
watch(() => props.price, (newval) => {
|
||||
console.log(newval);
|
||||
form.price = newval
|
||||
form.currentPrice = newval
|
||||
})
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@
|
|||
<view class="block u-m-b-0">
|
||||
<view class="u-flex">
|
||||
<view>共</view>
|
||||
<view class="fen font-bold">{{goodsNumber}}</view>
|
||||
<view class="fen font-bold">{{goods.list.length}}</view>
|
||||
<view>份菜品</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -231,7 +231,7 @@
|
|||
<view>
|
||||
<text>桌位费</text>
|
||||
</view>
|
||||
<view>¥{{$seatFee.totalAmount||'0.00'}}</view>
|
||||
<view>¥{{$seatFee.totalAmount.toFixed(2)||'0.00'}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="$packFee>0">
|
||||
|
|
@ -256,7 +256,7 @@
|
|||
|
||||
<view class="u-flex price u-m-l-32">
|
||||
<view class="">实收金额</view>
|
||||
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
||||
<view class="font-bold u-font-32">¥{{allPrice }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -281,7 +281,7 @@
|
|||
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
|
||||
<one-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-remark>
|
||||
<pack-number @confirm="goodsOnePackNumberConfirm" title="打包" :ref="setModel" name="packNumber"></pack-number>
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
|
||||
<!-- <edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount> -->
|
||||
</view>
|
||||
|
||||
|
||||
|
|
@ -290,21 +290,23 @@
|
|||
<script setup>
|
||||
import { onLoad, onReady, onShow } from '@dcloudio/uni-app'
|
||||
import { ref, inject, onBeforeUnmount, reactive, computed, watch } from 'vue';
|
||||
import { getSafeBottomHeight } from '@/commons/utils/safe-bottom.js'
|
||||
|
||||
import modelDiscount from './components/discount'
|
||||
import giveFood from './components/give-food'
|
||||
import packNumber from './components/pack-number'
|
||||
import oneRemark from './components/remark'
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
// import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
|
||||
import { getSafeBottomHeight } from '@/commons/utils/safe-bottom.js'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import $storageManage from '@/commons/utils/storageManage.js'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import { getNowCart } from '@/pagesCreateOrder/util.js'
|
||||
import { number } from 'uview-plus/libs/function/test';
|
||||
|
||||
import { getShopInfo } from '@/http/api/shop.js'
|
||||
import { getShopTableDetail } from '@/http/api/table.js'
|
||||
import { getProductPage } from '@/http/api/product.js'
|
||||
import { getProductList } from '@/http/api/product.js'
|
||||
import { createOrder,getHistoryOrder } from '@/http/api/order.js'
|
||||
import { number } from 'uview-plus/libs/function/test';
|
||||
|
||||
const models = new Map();
|
||||
const modelData = reactive({
|
||||
|
|
@ -351,14 +353,15 @@
|
|||
// value: "take-away",
|
||||
// }
|
||||
],
|
||||
active: 'dine-in'
|
||||
active: 'dine-in',
|
||||
isShow: false,
|
||||
},
|
||||
form: {
|
||||
note: ""
|
||||
},
|
||||
orderInfo: {}
|
||||
})
|
||||
|
||||
const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例
|
||||
onLoad((opt) => {
|
||||
Object.assign(option, opt)
|
||||
console.log("opt====",opt);
|
||||
|
|
@ -368,13 +371,11 @@
|
|||
getTableInfo(opt)
|
||||
}
|
||||
getTbShopInfo()
|
||||
init()
|
||||
|
||||
})
|
||||
let bottomHeight = ref(100)
|
||||
onReady(() => {
|
||||
getSafeBottomHeight('safe-bottom').then(res => {
|
||||
console.log(res);
|
||||
bottomHeight.value = res
|
||||
})
|
||||
})
|
||||
|
|
@ -383,12 +384,14 @@
|
|||
})
|
||||
|
||||
watch(() => pageData.eatTypes.active, (newval) => {
|
||||
pageData.eatTypes.isShow = true
|
||||
changeUseType()
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
})
|
||||
onShow(() => {
|
||||
init()
|
||||
watchChooseuser()
|
||||
watchChooseTable()
|
||||
})
|
||||
|
|
@ -412,9 +415,9 @@
|
|||
* 打包费
|
||||
*/
|
||||
const $packFee = computed(() => {
|
||||
console.log("打包费===",goods.list)
|
||||
let packAmount = 0;
|
||||
return goods.list.reduce((prve, cur) => {
|
||||
return prve + ((cur.packFee||0)*parseFloat(cur.pack_number).toFixed(0))
|
||||
return prve + (cur.packFee||0)*parseFloat(cur.pack_number).toFixed(2)
|
||||
}, 0).toFixed(2)
|
||||
})
|
||||
|
||||
|
|
@ -447,11 +450,11 @@
|
|||
const goodsPrice = computed(() => {
|
||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
const lowMemberPrice = cur.lowMemberPrice ? cur.lowMemberPrice : cur.lowPrice
|
||||
const tPrice = (isVip.value ? lowMemberPrice : cur.lowPrice) * cur.number
|
||||
const tpackFee = cur.is_temporary !=1&&parseFloat(cur.pack_number).toFixed(0) > 0 ? cur.packFee*parseFloat(cur.pack_number).toFixed(0) : 0
|
||||
return prve + (cur.is_gift ? 0 : tPrice) + tpackFee
|
||||
const tPrice = Math.floor(((isVip.value ? lowMemberPrice : cur.lowPrice) * cur.number)*100)/100
|
||||
return prve + (cur.is_gift ? 0 : tPrice)
|
||||
}, 0)
|
||||
return ((goodsTotalPrice - discount_sale_amount.value) || 0).toFixed(2)
|
||||
const tpackFee = $packFee.value > 0 ? $packFee.value*1 : 0
|
||||
return ((goodsTotalPrice - discount_sale_amount.value + tpackFee) || 0).toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
@ -471,10 +474,8 @@
|
|||
goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
const tPrice = cur.lowPrice * cur.number
|
||||
const tpackFee = (cur.pack_number*1) > 0 ? cur.packFee * (cur.pack_number*1) : 0
|
||||
console.log(cur)
|
||||
return prve + tPrice + tpackFee
|
||||
}, 0)
|
||||
console.log(goodsTotalPrice)
|
||||
return (goodsTotalPrice + $seatFee.totalAmount) - allPrice.value
|
||||
} else {
|
||||
return (discount_sale_amount.value)
|
||||
|
|
@ -482,7 +483,19 @@
|
|||
return (goodsTotalPrice + discount_sale_amount.value * 1).toFixed(2)
|
||||
})
|
||||
|
||||
const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例
|
||||
/**
|
||||
* init
|
||||
*/
|
||||
async function init() {
|
||||
// 获取商品列表
|
||||
$goods = await getProductList({},'product', false)
|
||||
console.log("商品列表===",$goods)
|
||||
|
||||
|
||||
// 获取购物车数据
|
||||
getCart()
|
||||
}
|
||||
|
||||
/**
|
||||
* socket消息监听
|
||||
*/
|
||||
|
|
@ -511,7 +524,30 @@
|
|||
} else {
|
||||
delCart(cartItem.id)
|
||||
}
|
||||
|
||||
})
|
||||
if( pageData.eatTypes.isShow ){
|
||||
if( pageData.eatTypes.active == 'take-out') {
|
||||
cartItem.pack_number = cartItem.number
|
||||
} else {
|
||||
cartItem.pack_number = 0
|
||||
}
|
||||
let par = {
|
||||
type:'onboc',
|
||||
account: uni.getStorageSync("iToken").loginId,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
operate_type:'batch',
|
||||
table_code: pageData.table.tableCode,
|
||||
is_pack: pageData.eatTypes.active == 'take-out' ? 1 : 0,
|
||||
}
|
||||
updateCart(par)
|
||||
}
|
||||
// 是否更新就餐人数
|
||||
if (!$seatFee.totalNumber) {
|
||||
updateChoseCount()
|
||||
}
|
||||
|
||||
pageData.eatTypes.isShow = false
|
||||
break;
|
||||
case 'onboc_add':
|
||||
case 'add':
|
||||
|
|
@ -529,7 +565,10 @@
|
|||
break;
|
||||
case 'onboc_cleanup':
|
||||
case 'cleanup':
|
||||
goods.lis = []
|
||||
goods.list = []
|
||||
$seatFee.totalNumber = 0
|
||||
$seatFee.totalAmount = 0
|
||||
userNumbers.defaultCateIndex = 0
|
||||
break;
|
||||
case 'product_update':
|
||||
init()
|
||||
|
|
@ -562,6 +601,11 @@
|
|||
pageData.table.tableCode = cartItem.table_code
|
||||
}
|
||||
let cartIndex = 0;
|
||||
goods.list.map((item,index)=>{
|
||||
if(item.id == cartItem.id) {
|
||||
cartIndex = index;
|
||||
}
|
||||
})
|
||||
|
||||
if( type == 'del' ) {
|
||||
goods.list.splice(cartIndex, 1)
|
||||
|
|
@ -575,27 +619,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
async function init() {
|
||||
let goodsRes = await getGoods()
|
||||
// await getCart()
|
||||
$goods = goodsRes.records
|
||||
if (!$seatFee.totalNumber) {
|
||||
updateChoseCount()
|
||||
}
|
||||
getCart()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
function getGoods() {
|
||||
return getProductPage({
|
||||
page: 1,
|
||||
size: 300
|
||||
},'product', false)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取购物车数据
|
||||
|
|
@ -609,8 +632,6 @@
|
|||
operate_type:'init',
|
||||
table_code: pageData.table.tableCode,
|
||||
}))
|
||||
// pageData.eatTypes.active = useType == 'take-out' ? useType : useType.replace(
|
||||
// /-after|-before/g, '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -633,7 +654,6 @@
|
|||
return (index + 1) + '人'
|
||||
})
|
||||
}
|
||||
|
||||
getHistoryOrderDetail(opt.tableCode)
|
||||
}
|
||||
|
||||
|
|
@ -651,18 +671,6 @@
|
|||
* 就餐类型切换监听
|
||||
*/
|
||||
async function changeUseType() {
|
||||
const { registerType } = pageData.shopInfo
|
||||
//before 先付 after 后付
|
||||
const isPayAfter = registerType == "before" ? false : true;
|
||||
let useType = "take-out";
|
||||
if (pageData.eatTypes.active == "take-out") {
|
||||
uni.setStorageSync("useType", "take-out");
|
||||
} else {
|
||||
//堂食
|
||||
useType = `dine-in-${isPayAfter? "after" : "before"}`;
|
||||
uni.setStorageSync("useType", useType);
|
||||
}
|
||||
const tableId = useType == 'take-out' ? undefined : pageData.table.id;
|
||||
if (!goods.list.length) {
|
||||
return
|
||||
}
|
||||
|
|
@ -674,7 +682,6 @@
|
|||
* @param {Object} par
|
||||
*/
|
||||
function updateCart (par) {
|
||||
// 初始化购物车
|
||||
websocketUtil.send(JSON.stringify({
|
||||
type:'onboc',
|
||||
account: uni.getStorageSync("iToken").loginId,
|
||||
|
|
@ -699,20 +706,7 @@
|
|||
par[key] = item[key] == 0 ? 1 : 0
|
||||
updateCart(par)
|
||||
}
|
||||
|
||||
/**
|
||||
* 打包
|
||||
*/
|
||||
function toggleIsPack (item,key) {
|
||||
let par = {
|
||||
id: item.id,
|
||||
product_id: item.product_id ,
|
||||
sku_id: item.sku_id,
|
||||
pack_num: 0
|
||||
}
|
||||
par['pack_number'] = item['pack_number'] == 0 ? 1 : 0
|
||||
updateCart(par)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 单品打折
|
||||
|
|
@ -790,10 +784,20 @@
|
|||
const model = models.get(key)
|
||||
console.log("弹窗数据===",modelData.data)
|
||||
if( key == 'packNumber'){
|
||||
if( modelData.data.type == 'weight' && item.pack_number <= 0){
|
||||
let par = {
|
||||
id: modelData.data.id,
|
||||
product_id: modelData.data.product_id,
|
||||
sku_id: modelData.data.sku_id,
|
||||
pack_number: 1
|
||||
}
|
||||
updateCart(par)
|
||||
return false;
|
||||
}
|
||||
if( item.pack_number > 0 ){
|
||||
let par = {
|
||||
id: modelData.data.id,
|
||||
product_id: modelData.data.product_id ,
|
||||
product_id: modelData.data.product_id,
|
||||
sku_id: modelData.data.sku_id,
|
||||
pack_number: 0
|
||||
}
|
||||
|
|
@ -812,7 +816,7 @@
|
|||
}
|
||||
|
||||
function formatPrice(n) {
|
||||
return Number(n).toFixed(2)
|
||||
return (Math.floor(n*100)/100).toFixed(2)
|
||||
}
|
||||
|
||||
function rotatingTables() {
|
||||
|
|
@ -833,10 +837,9 @@
|
|||
userNumbers.defaultCateIndex = maxCapacity - 1
|
||||
return
|
||||
}
|
||||
console.log(pageData.table)
|
||||
if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id) {
|
||||
|
||||
if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id && goods.list.length > 0) {
|
||||
//不免餐位费
|
||||
|
||||
let seatFee = {
|
||||
totalNumber: userNumbers.defaultCateIndex * 1 + 1,
|
||||
totalAmount: (userNumbers.defaultCateIndex * 1 + 1) * pageData.shopInfo.tableFee,
|
||||
|
|
@ -852,7 +855,6 @@
|
|||
* @param {Object} e
|
||||
*/
|
||||
function userNumberChange(e) {
|
||||
console.log(e);
|
||||
userNumbers.defaultCateIndex = e.detail.value
|
||||
}
|
||||
|
||||
|
|
@ -870,7 +872,7 @@
|
|||
uni.$off('choose-table')
|
||||
uni.$on('choose-table', (data) => {
|
||||
pageData.table = data
|
||||
console.log(pageData.table);
|
||||
console.log("台桌信息",pageData.table);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -931,14 +933,11 @@
|
|||
}, 'redirect')
|
||||
} else {
|
||||
//后付
|
||||
console.log(option.isCreateOrderToDetail);
|
||||
if (option.isCreateOrderToDetail != '0') {
|
||||
console.log('PAGES_ORDER_DETAIL');
|
||||
go.to('PAGES_ORDER_DETAIL', {
|
||||
id: res.id
|
||||
}, 'redirect')
|
||||
} else {
|
||||
console.log('back');
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
|
|
|
|||
|
|
@ -70,17 +70,12 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import {
|
||||
formatPrice
|
||||
} from '@/commons/utils/format.js';
|
||||
import { formatPrice } from '@/commons/utils/format.js';
|
||||
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array,
|
||||
|
|
@ -92,14 +87,6 @@
|
|||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
user: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
id: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
|
@ -173,7 +160,8 @@
|
|||
const allPrice = computed(() => {
|
||||
console.log("购物车数据==",props.data)
|
||||
return props.data.reduce((prve, cur) => {
|
||||
return prve + cur.lowPrice * cur.number
|
||||
let price = Math.floor((cur.lowPrice * cur.number)*100)/100
|
||||
return prve + price
|
||||
}, 0).toFixed(2)
|
||||
})
|
||||
|
||||
|
|
@ -182,8 +170,9 @@
|
|||
result = props.data.reduce((prve, cur) => {
|
||||
return prve + cur.number
|
||||
}, 0)
|
||||
// console.log(result)
|
||||
return result >= 99 ? 99 : result
|
||||
console.log(result)
|
||||
result = result > 0 ? result.toFixed(2) : 0
|
||||
return result >= 99 ? 99 : parseFloat(result)
|
||||
})
|
||||
|
||||
function updateNumber(isAdd, index, goods) {
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@
|
|||
// 将数据保存进对应的值
|
||||
let arr = []
|
||||
let arrlength = 0
|
||||
datas.selectNumber = 0
|
||||
datas.skus.map(ele => {
|
||||
let group = {
|
||||
...ele,
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
<view class="boxoverlay" v-if="form&&form.goods">
|
||||
<view class="rect" @tap.stop>
|
||||
<view class="title">
|
||||
<view>
|
||||
标题
|
||||
</view>
|
||||
<view> 标题 </view>
|
||||
<view class="" @click="overlayshow = false">
|
||||
<up-icon name="close" color="#93969b" size="20"></up-icon>
|
||||
</view>
|
||||
|
|
@ -31,11 +29,9 @@
|
|||
<button @click="deleteLast">←</button>
|
||||
</view>
|
||||
<view class="classmoney">
|
||||
¥ {{ (form.goods.lowPrice * currentInput).toFixed(2) }}
|
||||
</view>
|
||||
<view class="classconfirm" @click="clickconfirm">
|
||||
确认
|
||||
¥ {{ (Math.floor((form.goods.lowPrice * currentInput)*100)/100).toFixed(2) }}
|
||||
</view>
|
||||
<view class="classconfirm" @click="clickconfirm"> 确认 </view>
|
||||
</view>
|
||||
</view>
|
||||
</up-overlay>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
</template>
|
||||
|
||||
<view class="bottom w-full">
|
||||
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser"
|
||||
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange"
|
||||
:table="data.table" :data="cars" @clear="cleaCart"></my-car>
|
||||
</view>
|
||||
<!-- 套餐选择规格 -->
|
||||
|
|
@ -105,8 +105,7 @@
|
|||
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel" :goodsData="selGoods"
|
||||
:title="guigeModelData.title" :sku-map="guigeModelData.chooseGoods.skuMap"
|
||||
:skus="guigeModelData.chooseGoods.skus"></guige-model>
|
||||
<!-- 添加附加费 -->
|
||||
<my-surcharge @confirm="surchargeConfirm" ref="surcharge" title="添加附加费"></my-surcharge>
|
||||
|
||||
<!-- 称重 -->
|
||||
<weigh-item ref="refweighitem" @weighgoodsUpdate='goodsUpdate'></weigh-item>
|
||||
</view>
|
||||
|
|
@ -116,28 +115,21 @@
|
|||
import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
|
||||
import { computed, reactive, ref, nextTick, watch, getCurrentInstance, onUnmounted, onBeforeUnmount } from 'vue';
|
||||
|
||||
import util from './util.js';
|
||||
import color from '@/commons/color.js';
|
||||
import guigeModel from './components/guige'
|
||||
import taocanModel from './components/taocanModel.vue'
|
||||
import weighItem from './components/weigh.vue'
|
||||
import listGoodsItem from './components/list-goods-item.vue'
|
||||
import mySurcharge from './components/surcharge'
|
||||
import myCar from './components/car'
|
||||
|
||||
import util from './util.js';
|
||||
import color from '@/commons/color.js';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import { getNowCart } from '@/pagesCreateOrder/util.js'
|
||||
import storageManage from '@/commons/utils/storageManage.js'
|
||||
import {
|
||||
$returnUseType
|
||||
} from './util.js'
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js'
|
||||
|
||||
import appConfig from '@/config/appConfig.js';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import WebsocketUtil from '@/commons/utils/websocket.js'
|
||||
|
||||
import { getShopTable,getShopTableDetail } from '@/http/api/table.js'
|
||||
import { getProductList } from '@/http/api/product.js'
|
||||
import { categoryPage } from '@/http/api/cateGory.js'
|
||||
|
|
@ -209,9 +201,7 @@
|
|||
option = opt
|
||||
console.log("opt===",opt)
|
||||
Object.assign(data.table, opt)
|
||||
if (opt.useType) {
|
||||
uni.setStorageSync('useType', opt.useType)
|
||||
}
|
||||
|
||||
uni.setNavigationBarTitle({
|
||||
title: (opt && opt.type == 'add') ? '顾客加菜' : '代客下单'
|
||||
})
|
||||
|
|
@ -221,7 +211,7 @@
|
|||
if(uni.getStorageSync("table_code")){
|
||||
data.table.tableCode = uni.getStorageSync("table_code")
|
||||
}
|
||||
init()
|
||||
// init()
|
||||
xiadanClick()
|
||||
})
|
||||
watch(() => data.table.id, (newval, oldval) => {
|
||||
|
|
@ -230,13 +220,13 @@
|
|||
}
|
||||
})
|
||||
onShow(() => {
|
||||
// watchChooseuser()
|
||||
watchChooseTable()
|
||||
watchUpdate()
|
||||
data.isGoodsAdd = true;
|
||||
nextTick(()=>{
|
||||
onMessage()
|
||||
})
|
||||
init()
|
||||
})
|
||||
onReady(() => {
|
||||
getElRect('list-tight-top').then(res => {
|
||||
|
|
@ -264,16 +254,12 @@
|
|||
let $category = []
|
||||
|
||||
async function init() {
|
||||
// console.log(option.type)
|
||||
if (option.type == 'add') {
|
||||
setTabBar($category, $originGoods, [])
|
||||
}
|
||||
let shopInfo = await getShopInfo({id:uni.getStorageSync('shopInfo').id})
|
||||
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(shopInfo)
|
||||
uni.setStorageSync('useType', useType)
|
||||
|
||||
// await getTableInfo()
|
||||
|
||||
console.log(shopInfo)
|
||||
uni.setStorageSync("shopInfo",shopInfo)
|
||||
// 获取分类数据
|
||||
let categoryRes = await categoryPage({ page: 1, size: 300 })
|
||||
$category = categoryRes.records
|
||||
|
|
@ -312,7 +298,8 @@
|
|||
console.log("onMessage===",msg)
|
||||
if( msg.msg == "收到了"){
|
||||
data.isCars = true;
|
||||
// initCart()
|
||||
data.isGoodsAdd = true;
|
||||
initCart()
|
||||
}
|
||||
if( msg.msg_id ){
|
||||
websocketUtil.send(JSON.stringify({
|
||||
|
|
@ -341,7 +328,7 @@
|
|||
data.table.tableCode = msg.table_code
|
||||
uni.setStorageSync("table_code",msg.table_code)
|
||||
}
|
||||
console.log("cartArr===",cartArr)
|
||||
console.log("商品信息===",cartArr)
|
||||
msg.data.map(item=>{
|
||||
cartItem = getNowCart(item,cartArr)
|
||||
console.log("cartItem===",cartItem)
|
||||
|
|
@ -398,8 +385,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 初始化购物车
|
||||
*/
|
||||
|
|
@ -411,9 +396,6 @@
|
|||
}
|
||||
console.log("购物车初始化参数===",params)
|
||||
websocketUtil.send(JSON.stringify(params))
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -426,9 +408,9 @@
|
|||
operate_type: operate_type,
|
||||
table_code: data.table.tableCode,
|
||||
product_id: '',
|
||||
is_print: 1,
|
||||
sku_id: '', //
|
||||
number: 1, //数量
|
||||
is_temporary: 0, //是否是临时菜
|
||||
}
|
||||
Object.assign(params, par)
|
||||
console.log('购物车添加菜品参数===',params)
|
||||
|
|
@ -511,7 +493,6 @@
|
|||
* @param {Object} item
|
||||
*/
|
||||
async function onChooseTable(item) {
|
||||
console.log('onChooseTable');
|
||||
if (!item) {
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.showModal({
|
||||
|
|
@ -533,8 +514,6 @@
|
|||
table_code: data.table.tableCode,
|
||||
new_table_code: item.tableCode,
|
||||
}
|
||||
console.log(cars)
|
||||
|
||||
if (data.table.id || cars.length <= 0) {
|
||||
data.table = {
|
||||
...item
|
||||
|
|
@ -576,11 +555,10 @@
|
|||
if( !data.isCars ){
|
||||
return infoBox.showToast('购物车加载失败请刷新重试...')
|
||||
}
|
||||
if( !data.isGoodsAdd ){ return; }
|
||||
if( !data.isGoodsAdd ){ return;infoBox.showToast('isGoodsAdd...') }
|
||||
let $goods = data.tabbar[index].foods[foodsindex]
|
||||
if ($goods.type !== 'sku') {
|
||||
//单规格
|
||||
console.log($goods)
|
||||
let goodsInCarIndex = cars.findIndex((carsGoods) => {
|
||||
return carsGoods.sku_id == $goods.skuList[0].id && carsGoods.product_id == $goods.id;
|
||||
});
|
||||
|
|
@ -609,6 +587,7 @@
|
|||
number: number,
|
||||
product_id: product_id,
|
||||
sku_id: sku_id,
|
||||
is_temporary: cartItem.is_temporary
|
||||
},'edit')
|
||||
data.isGoodsAdd = false;
|
||||
setSearchGoods(searchGoodsIndex, number)
|
||||
|
|
@ -624,6 +603,7 @@
|
|||
number: suitNum,
|
||||
product_id: product_id,
|
||||
sku_id: sku_id,
|
||||
is_temporary: 0, //是否是临时菜
|
||||
},'add')
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
|
|
@ -680,7 +660,6 @@
|
|||
* @param {Object} e
|
||||
*/
|
||||
async function carsNumberChange(e) {
|
||||
console.log("carsNumberChange===",e)
|
||||
if( !data.isGoodsAdd ){ return; }
|
||||
let $sku;
|
||||
let $goods;
|
||||
|
|
@ -714,7 +693,8 @@
|
|||
number: e.num,
|
||||
id: e.goods.id,
|
||||
product_id: e.goods.product_id,
|
||||
sku_id: e.goods.sku_id
|
||||
sku_id: e.goods.sku_id,
|
||||
is_temporary: e.goods.is_temporary
|
||||
},'edit')
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
|
|
@ -725,51 +705,44 @@
|
|||
* @param {Object} item
|
||||
*/
|
||||
async function taocanConfirm(d, item) {
|
||||
console.log(d)
|
||||
//添加
|
||||
editCart({
|
||||
number: item.skuList[0].suitNum,
|
||||
product_id: item.id,
|
||||
sku_id: item.skuList[0].id,
|
||||
pro_group_info: JSON.stringify(d),
|
||||
is_temporary: 0, //是否是临时菜
|
||||
},'add')
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
|
||||
const instance = getCurrentInstance();
|
||||
let selGoods = ref({});
|
||||
|
||||
/**
|
||||
* 打开规格弹窗
|
||||
* @param {Object} foodsindex
|
||||
* @param {Object} index
|
||||
*/
|
||||
function chooseGuige(foodsindex, index) {
|
||||
// if (!data.table.id) {
|
||||
// return infoBox.showToast('请先选择桌台', 0.5).then(res => {
|
||||
// chooseTable()
|
||||
// })
|
||||
// }
|
||||
|
||||
if( !data.isCars ){
|
||||
return infoBox.showToast('购物车加载失败请刷新重试...')
|
||||
}
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
console.log($goods)
|
||||
selGoods.value = $goods
|
||||
if ($goods.groupType == 1) {
|
||||
data.goodsData = $goods
|
||||
instance.ctx.$refs.taocanModelRef.open()
|
||||
} else {
|
||||
console.log($goods)
|
||||
guigeModelData.title = $goods.name
|
||||
const skuMap = returnSelGoodsSkuMap($goods.skuList)
|
||||
console.log(skuMap)
|
||||
// 多规格,和套餐规格区分.groupType=1 套餐多规格
|
||||
const selectSpecInfo = returnSelGoodsSkuList($goods.selectSpecInfo)
|
||||
setSkugoodsDefaultInit($goods, selectSpecInfo, skuMap, $goods.skuList)
|
||||
chooseGuigeModel.value.open()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//返回当前选中商品skuMap
|
||||
function returnSelGoodsSkuMap(specList) {
|
||||
const skuMap = {}
|
||||
|
|
@ -812,7 +785,6 @@
|
|||
* @param {Object} num
|
||||
*/
|
||||
async function guigeConfirm(sku, suitNum) {
|
||||
console.log(sku)
|
||||
if( !data.isGoodsAdd ){ return; }
|
||||
let goods = guigeModelData.chooseGoods.item
|
||||
let sku_id = sku.id
|
||||
|
|
@ -830,6 +802,7 @@
|
|||
number: newNumber,
|
||||
product_id: product_id,
|
||||
sku_id: sku_id,
|
||||
is_temporary: carGoods.is_temporary, //是否是临时菜
|
||||
},'edit')
|
||||
data.isGoodsAdd = false;
|
||||
} else {
|
||||
|
|
@ -838,6 +811,7 @@
|
|||
number: suitNum,
|
||||
product_id: product_id,
|
||||
sku_id: sku_id,
|
||||
is_temporary: 0, //是否是临时菜
|
||||
},'add')
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
|
|
@ -860,8 +834,9 @@
|
|||
} : false
|
||||
}
|
||||
|
||||
|
||||
//多规格商品弹窗时,找到默认可以下单的规格商品
|
||||
/**
|
||||
* 多规格商品弹窗时,找到默认可以下单的规格商品
|
||||
*/
|
||||
function findGoods(selectSpecInfo = [], goodsListMap = {}, skuList) {
|
||||
let skuMapNumber = selectSpecInfo.reduce((prve, cur) => {
|
||||
for (let i in cur.valueArr) {
|
||||
|
|
@ -869,10 +844,7 @@
|
|||
}
|
||||
return prve;
|
||||
}, {});
|
||||
console.log("selectSpecInfo",selectSpecInfo)
|
||||
console.log("skuMapNumber",guigeModelData.chooseGoods.item)
|
||||
let canBudyGoods = skuList.filter((v) => util.isCanBuy(v, guigeModelData.chooseGoods.item))
|
||||
console.log("canBudyGoods",canBudyGoods)
|
||||
return canBudyGoods[0];
|
||||
}
|
||||
|
||||
|
|
@ -894,7 +866,6 @@
|
|||
guigeModelData.chooseGoods.skus[index].sel = v;
|
||||
});
|
||||
}
|
||||
console.log("guigeModelData.chooseGoods.skus===",guigeModelData.chooseGoods.skus);
|
||||
setTagDisabled();
|
||||
}
|
||||
|
||||
|
|
@ -910,7 +881,10 @@
|
|||
setTagDisabled();
|
||||
|
||||
}
|
||||
//设置规格按钮的禁止状态
|
||||
|
||||
/**
|
||||
* 设置规格按钮的禁止状态
|
||||
*/
|
||||
function setTagDisabled() {
|
||||
const skuList = guigeModelData.chooseGoods.skus
|
||||
const skuMap = guigeModelData.chooseGoods.skuMap
|
||||
|
|
@ -925,7 +899,6 @@
|
|||
const matchArr = [];
|
||||
for (let key in skuMap) {
|
||||
let goods = skuMap[key];
|
||||
console.log(key)
|
||||
let keyArr = key.split(",");
|
||||
for (let spe of selArrAllGroup) {
|
||||
if (util.arrayContainsAll(keyArr, spe)) {
|
||||
|
|
@ -934,7 +907,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
console.log(matchArr);
|
||||
//全部规格都已下架
|
||||
if (!matchArr.length) {
|
||||
for (let k in skuList) {
|
||||
|
|
@ -975,8 +947,6 @@
|
|||
* 扫桌台码
|
||||
*/
|
||||
function scanCode() {
|
||||
// 只允许通过相机扫码
|
||||
console.log('scanCode');
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
success: async function(res) {
|
||||
|
|
@ -993,13 +963,10 @@
|
|||
title: '请扫描正确的桌台码'
|
||||
})
|
||||
}
|
||||
// uni.showModal({
|
||||
// title:'',
|
||||
// content:res.result
|
||||
// })
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function returnUrlPar(str) {
|
||||
let arr = str.split("?")[1].split("&"); //先通过?分解得到?后面的所需字符串,再将其通过&分解开存放在数组里
|
||||
let obj = {};
|
||||
|
|
@ -1009,8 +976,12 @@
|
|||
return obj
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商品数据处理
|
||||
* @param {Object} category
|
||||
* @param {Object} goods
|
||||
* @param {Object} cars
|
||||
*/
|
||||
function setTabBar(category, goods, cars) {
|
||||
const goodsCategoryMap = goods.reduce((prve, cur) => {
|
||||
if (!prve.hasOwnProperty(cur.categoryId)) {
|
||||
|
|
@ -1049,27 +1020,22 @@
|
|||
storageManage.cacheGoods(data.tabbar)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const surcharge = ref(null)
|
||||
|
||||
function surchargeConfirm(e) {
|
||||
data.tabbar[data.tabbar.length - 1].foods.unshift({
|
||||
...e,
|
||||
chooseNumber: 0
|
||||
})
|
||||
}
|
||||
|
||||
function surchargeShow() {
|
||||
surcharge.value.open()
|
||||
}
|
||||
|
||||
|
||||
let searchValue = ref('')
|
||||
let isSearch = ref(false)
|
||||
let searchResult = ref([])
|
||||
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function search() {
|
||||
if (searchValue.value === '') {
|
||||
isSearch.value = false
|
||||
return
|
||||
}
|
||||
isSearch.value = true
|
||||
searchResult.value = returnSearchGoods()
|
||||
}
|
||||
|
||||
function returnSearchGoods() {
|
||||
const newval = searchValue.value
|
||||
let arr = []
|
||||
|
|
@ -1094,16 +1060,6 @@
|
|||
return arr
|
||||
}
|
||||
|
||||
function search() {
|
||||
if (searchValue.value === '') {
|
||||
isSearch.value = false
|
||||
return
|
||||
}
|
||||
isSearch.value = true
|
||||
searchResult.value = returnSearchGoods()
|
||||
console.log(searchResult.value);
|
||||
}
|
||||
|
||||
function clearSearch() {
|
||||
isSearch.value = false
|
||||
}
|
||||
|
|
@ -1121,13 +1077,7 @@
|
|||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 称重
|
||||
*/
|
||||
|
|
@ -1157,10 +1107,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let isTabClickOver = true
|
||||
/**
|
||||
* 点击左边的栏目切换
|
||||
|
|
@ -1285,25 +1231,11 @@
|
|||
}
|
||||
}, 100)
|
||||
}
|
||||
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (user) => {
|
||||
console.log(user);
|
||||
data.vipUser = user ? user : {
|
||||
id: ''
|
||||
}
|
||||
setUser()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 台桌切换
|
||||
*/
|
||||
async function onSelTable() {
|
||||
// const cartRes = await getCart()
|
||||
// cars.length = 0
|
||||
// const cartArr = getNowCart(cartRes.records)
|
||||
// for (let i in cartArr) {
|
||||
// cars.push(cartArr[i])
|
||||
// }
|
||||
setTabBar($category, $originGoods, cars)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ export function getNowCart(carItem,goodsList,user) {
|
|||
carItem.lowPrice = item.salePrice
|
||||
carItem.lowMemberPrice = item.memberPrice
|
||||
carItem.specInfo = item.specInfo
|
||||
|
||||
if( uni.getStorageSync('shopInfo').isMemberPrice && user && user.id && user.isVip ){
|
||||
carItem.salePrice = item.memberPrice
|
||||
} else {
|
||||
|
|
@ -25,6 +26,7 @@ export function getNowCart(carItem,goodsList,user) {
|
|||
carItem.name = goodsItem.name
|
||||
carItem.coverImg = goodsItem.coverImg
|
||||
carItem.packFee = goodsItem.packFee
|
||||
carItem.type = goodsItem.type
|
||||
carItem.isGrounding = true;
|
||||
}
|
||||
carItem.number = parseFloat(carItem.number)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,11 @@
|
|||
<view class="item u-m-b-32" v-for="(item,index) in order.info" :key="index">
|
||||
<view class="u-flex u-col-top">
|
||||
<view class="u-flex">
|
||||
<image class="img" :src="item.coverImg||item.productImg" mode=""></image>
|
||||
|
||||
<image v-if="item.isTemporary == 0" class="img" :src="item.coverImg||item.productImg" mode=""></image>
|
||||
<view v-else style="background-color: #3f9eff; width: 152rpx;height: 152rpx;line-height: 152rpx;text-align: center;color: #fff;" >
|
||||
临时菜
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-p-l-32 u-flex-1">
|
||||
<view class="u-flex u-row-between u-col-top">
|
||||
|
|
@ -37,30 +41,35 @@
|
|||
{{item.name||item.productName}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-8">
|
||||
<view class="u-m-r-20 u-flex" v-if="item.isGift">
|
||||
<uni-tag text="赠送"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
<view class="u-flex u-m-t-8" style="flex-direction: column;align-items: flex-start;">
|
||||
<view class="u-flex u-m-b-8">
|
||||
<view class="u-m-r-20 u-flex" v-if="item.isGift">
|
||||
<uni-tag text="赠送"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex " v-if="item.userCouponId">
|
||||
<uni-tag :text=" productCouponDikou(item)"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex" v-if="item.packNumber > 0">
|
||||
<uni-tag
|
||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||
size="small" text="打包" inverted type="success" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex " v-if="item.userCouponId">
|
||||
<uni-tag :text=" productCouponDikou(item)"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex" v-if="item.packNumber > 0">
|
||||
<uni-tag
|
||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||
size="small" text="打包" inverted type="success" />
|
||||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount">
|
||||
<view class="color-666">退款金额:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.unitPrice*item.refundNum}}</view>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnNum">
|
||||
<view class="color-666">退菜数量:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnNum}}</view>
|
||||
<view class="u-flex u-m-t-8">
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.refundNum>0">
|
||||
<view class="color-666">退款金额:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.refundNum*item.unitPrice}}</view>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnNum">
|
||||
<view class="color-666">退菜数量:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnNum}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="color-999 u-font-24 u-m-t-8">{{item.skuName||''}}</view>
|
||||
|
||||
|
|
@ -70,8 +79,9 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-text-right u-m-t-28">
|
||||
<template v-if="item.refundNum>0">
|
||||
<view>¥{{(returnTotalMoney(item)-item.refundNum*item.unitPrice).toFixed(2)}}</view>
|
||||
<template v-if="item.refundNum>0||item.returnNum>0">
|
||||
<!-- <view>¥{{mathFloorPrice( - mathFloorPrice(parseFloat(item.returnNum*item.unitPrice),item) - mathFloorPrice(parseFloat(item.refundNum*item.unitPrice),item))}}</view> -->
|
||||
<view>¥{{mathFloorPrice( parseFloat(mathFloorPrice(item.num*item.unitPrice),item) - (parseFloat(mathFloorPrice(item.returnNum*item.unitPrice,item)) + parseFloat(mathFloorPrice(item.refundNum*item.unitPrice,item))))}}</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else-if="item.userCouponId">
|
||||
|
|
@ -99,24 +109,29 @@
|
|||
</view>
|
||||
</view>
|
||||
<template v-if="canTuicai(orderInfo,item)">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-24" v-if="item.returnNum*item.returnAmount<item.payAmount">
|
||||
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-24" v-if="item.returnNum*item.unitPrice<item.num*item.unitPrice">
|
||||
<my-button :width="128" :height="48" plain shape="circle" @tap="tuicai(item,index)"><text
|
||||
class="no-wrap">退菜</text></my-button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="canTuiKuan(orderInfo,item)">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20">
|
||||
<my-button :width="128" :height="48" plain shape="circle" @tap="tuikuan(item,index)"><text
|
||||
class="no-wrap">{{item.userCouponId?'退券':'退款' }}</text> </my-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-m-t-32">
|
||||
<template v-if="seatFeePrice&&seatFeePrice>0">
|
||||
<view class="u-flex u-row-between border-top u-p-t-32 u-p-b-32 u-col-top">
|
||||
<view class="no-wrap u-m-r-32">桌位费</view>
|
||||
<view>{{seatFeePrice||'0.00'}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="allPpackFee&&allPpackFee>0">
|
||||
<view class="u-flex u-row-between border-top u-p-t-32 u-p-b-32 u-col-top">
|
||||
<view class="no-wrap u-m-r-32">打包费</view>
|
||||
<view>{{allPpackFee||'0.00'}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex u-row-between border-top u-p-t-32">
|
||||
<view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
|
|
@ -136,6 +151,8 @@
|
|||
<view class="color-red u-m-r-6 ">
|
||||
已优惠¥{{youhuiAllPrice}}
|
||||
</view>
|
||||
<!-- <up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon> -->
|
||||
|
||||
</view>
|
||||
<!-- <view>
|
||||
<text>小计¥</text>
|
||||
|
|
@ -144,12 +161,12 @@
|
|||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<template v-if="orderInfo.refundAmount">
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<view>退款金额</view>
|
||||
<view class="color-999">
|
||||
<text class="">{{(orderInfo.refundAmount).toFixed(2)}}</text>
|
||||
<text class="">{{mathFloorPrice(orderInfo.refundAmount)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
|
|
@ -177,13 +194,13 @@
|
|||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.originAmount.toFixed(2)}}</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.payAmount.toFixed(2)}}</text>
|
||||
<text class="font-bold u-font-32">{{mathFloorPrice(orderInfo.payAmount)}}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -240,22 +257,11 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive
|
||||
} from 'vue';
|
||||
import { computed, reactive } from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js'
|
||||
import {
|
||||
isTui,
|
||||
isTuiCai,
|
||||
isGift,
|
||||
canTuiKuan,
|
||||
canTuicai,
|
||||
numSum
|
||||
} from '@/commons/utils/goodsUtil.js'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import { isTui, isTuiCai, isGift, canTuiKuan, canTuicai, mathFloorPrice } from '@/commons/utils/goodsUtil.js'
|
||||
|
||||
const pop = reactive({
|
||||
youhui: false
|
||||
})
|
||||
|
|
@ -313,6 +319,7 @@
|
|||
res.useType = props.orderInfo.useType
|
||||
res.tableId = props.orderInfo.tableId
|
||||
arr.push(res)
|
||||
|
||||
})
|
||||
})
|
||||
uni.navigateTo({
|
||||
|
|
@ -326,12 +333,10 @@
|
|||
const goodsNumber = computed(() => {
|
||||
let result = 0
|
||||
result = props.data.reduce((a, b) => {
|
||||
const bTotal = b.info.reduce((prve, cur) => {
|
||||
return prve + (cur.number || cur.num) * 1;
|
||||
}, 0);
|
||||
const bTotal = b.info.length
|
||||
return a + bTotal
|
||||
}, 0)
|
||||
return result
|
||||
return result.toFixed(0)
|
||||
})
|
||||
function returnProductCoupPrice(item) {
|
||||
if (!item.isMember) {
|
||||
|
|
@ -353,7 +358,6 @@
|
|||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
console.log(n);
|
||||
return n.toFixed(2)
|
||||
})
|
||||
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
||||
|
|
@ -366,7 +370,7 @@
|
|||
}
|
||||
|
||||
function returnTotalMoney(item) {
|
||||
return (item.payAmount).toFixed(2)
|
||||
return (Math.floor(item.num*item.unitPrice*100)/100).toFixed(2)
|
||||
}
|
||||
function returnCanTuiMoney(item) {
|
||||
// if (props.orderInfo.status == 'unpaid') {
|
||||
|
|
@ -377,7 +381,7 @@
|
|||
} else if (item.price != item.unitPrice) {
|
||||
return item.price*item.num
|
||||
} else {
|
||||
return item.payAmount
|
||||
return (Math.floor(item.num*item.unitPrice*100)/100).toFixed(2)
|
||||
}
|
||||
|
||||
// }
|
||||
|
|
@ -390,8 +394,6 @@
|
|||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
console.log(goodsTotal);
|
||||
console.log(seatFeePrice.value);
|
||||
return (goodsTotal + seatFeePrice.value * 1).toFixed(2)
|
||||
})
|
||||
const TuiKuanPrice = computed(() => {
|
||||
|
|
@ -412,12 +414,7 @@
|
|||
return prve + curTotal
|
||||
}, 0)
|
||||
})
|
||||
const cantuiSeatFee = computed(() => {
|
||||
let seatFee = props.orderInfo.seatInfo ? (props.orderInfo.seatInfo.seatAmount) : 0
|
||||
const bili = Math.floor((seatFee / canTuiKuanPrice.value) * 100) / 100
|
||||
seatFee = Math.floor((props.orderInfo.amount - props.orderInfo.refundAmount) * bili * 100) / 100
|
||||
return seatFee
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -435,18 +432,24 @@
|
|||
function tuikuan(item, index) {
|
||||
hasPermission('允许退款').then(res => {
|
||||
if (res) {
|
||||
console.log(item)
|
||||
if (Array.isArray(item)) {
|
||||
let arr = [];
|
||||
console.log(item)
|
||||
item.map(v=>{
|
||||
v.info.map(obj=>{
|
||||
obj.number = 0
|
||||
let infoLit = JSON.parse(JSON.stringify(v.info))
|
||||
infoLit.map((obj,i)=>{
|
||||
obj.number = '0.00'
|
||||
obj.skuName = obj.skuName || ''
|
||||
obj.priceAmount = obj.priceAmount ? obj.priceAmount : (obj.num*obj.unitPrice).toFixed(2)
|
||||
obj.unitPrice = obj.unitPrice
|
||||
obj.num = obj.num - obj.returnNum - obj.refundNum
|
||||
obj.priceAmount = mathFloorPrice(obj.num*obj.unitPrice ,obj)
|
||||
})
|
||||
|
||||
arr = [...arr,...v.info]
|
||||
arr = [...arr,...infoLit]
|
||||
})
|
||||
arr.map((v,e)=>{
|
||||
if( v.num <= 0){
|
||||
// arr.splice(e, 1)
|
||||
}
|
||||
})
|
||||
emits('tuikuan', arr)
|
||||
} else {
|
||||
|
|
@ -464,30 +467,21 @@
|
|||
emits('printOrder')
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 桌位费
|
||||
*/
|
||||
const seatFeePrice = computed(() => {
|
||||
if (!props.seatFee.seatAmount) {
|
||||
return 0
|
||||
}
|
||||
const n = props.seatFee.seatAmount * (isTui(props.seatFee) ? 0 : 1)
|
||||
const n = props.orderInfo.seatNum > 0 ? props.orderInfo.seatNum*props.orderInfo.seatAmount : 0
|
||||
return n.toFixed(2)
|
||||
})
|
||||
|
||||
const discountAmount = computed(() => {
|
||||
if (props.orderInfo.discountAmount) {
|
||||
return props.orderInfo.discountAmount
|
||||
}
|
||||
return (props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio))
|
||||
})
|
||||
const goodsOriginAllPrice = computed(() => {
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.reduce((a,
|
||||
b) => {
|
||||
return a + (b.num * b.price)
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -517,71 +511,69 @@
|
|||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
// 菜品金额
|
||||
const productCoupPrice = computed(() => {
|
||||
if (props.orderInfo.status == 'done') {
|
||||
return props.orderInfo.productCouponDiscountAmount
|
||||
}
|
||||
const goodsPrice = props.data.reduce((a, b) => {
|
||||
const curTotal = b.info.filter(v => !v.isGift && v.userCouponId).reduce((prve,
|
||||
const curTotal = b.info.filter(v => !v.isGift).reduce((prve,
|
||||
cur) => {
|
||||
const isVip = props.user.isVip && cur.isMember
|
||||
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
|
||||
const price = isVip ? memberPrice : cur.price
|
||||
const curTotal = price * cur.num
|
||||
return prve + curTotal
|
||||
console.log(cur)
|
||||
let Total = Math.floor(cur.unitPrice * cur.num * 100) / 100
|
||||
return prve + Total - (cur.returnNum*cur.unitPrice) - (cur.refundNum*cur.unitPrice)
|
||||
}, 0)
|
||||
console.log("菜品金额111==",curTotal)
|
||||
return a + curTotal
|
||||
}, 0)
|
||||
console.log("菜品金额==",goodsPrice)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
const allPpackFee = computed(() => {
|
||||
//不是退菜只要有打包费的都计算,包括赠送
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.packNumber > 0).reduce((a,
|
||||
b) => {
|
||||
return a + parseFloat(b.packAmount*b.packNumber).toFixed(2)*1
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
const packFee = computed(() => {
|
||||
//不是退菜只要有打包费的都计算,包括赠送
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.status !== "return" && (v.returnNum+v.refundNum < v.num)).reduce((a,
|
||||
b) => {
|
||||
return a + parseFloat((b.packAmount*(b.num-(b.returnNum+b.refundNum)>b.packNumber?b.packNumber:b.num-(b.returnNum+b.refundNum))).toFixed(2))
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
const allPrice = computed(() => {
|
||||
let seatAmount = (props.orderInfo.seatNum * props.orderInfo.seatAmount) || 0
|
||||
const total = productCoupPrice.value*1 + seatAmount*1 + packFee.value*1
|
||||
console.log(seatAmount*1)
|
||||
console.log(packFee.value*1)
|
||||
console.log(total)
|
||||
return (total <= 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 已优惠金额
|
||||
*/
|
||||
const youhuiAllPrice = computed(() => {
|
||||
console.log(productCoupPrice)
|
||||
const n = props.orderInfo.originAmount - props.orderInfo.orderAmount + vipDiscountPrice.value * 1
|
||||
const n = vipDiscountPrice.value * 1
|
||||
return (n < 0 ? 0 : n).toFixed(2)
|
||||
})
|
||||
|
||||
const packFee = computed(() => {
|
||||
//不是退菜只要有打包费的都计算,包括赠送
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.status !== "return").reduce((a,
|
||||
b) => {
|
||||
return a + b.packAmount
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
|
||||
})
|
||||
const allPrice = computed(() => {
|
||||
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.reduce((a,
|
||||
b) => {
|
||||
return a + (b.status == 'unpaid' ? b.payAmount : b.status == 'return' ? 0 : b
|
||||
.payAmount * 1)
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
|
||||
if (props.orderInfo.status == 'unpaid') {
|
||||
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
|
||||
return (n < 0 ? 0 : n).toFixed(2)
|
||||
}
|
||||
const returnAmount = props.orderInfo.seatInfo && props.orderInfo.seatInfo.seatAmount ? props.orderInfo
|
||||
.seatInfo.seatAmount : 0
|
||||
const canReturnAmount = props.orderInfo.seatInfo && props.orderInfo.seatInfo.canReturnAmount ? props
|
||||
.orderInfo.seatInfo.canReturnAmount : 0
|
||||
const total = props.orderInfo.amount - (seatAmount ? seatAmount : canReturnAmount)
|
||||
return (total <= 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -6,17 +6,16 @@
|
|||
{{data.productName}}
|
||||
</view>
|
||||
<view class="u-flex u-m-t-32" :class="{'gray':data.productId=='-999'}">
|
||||
<up-number-box :min="0" :max="data.num" :buttonSize="44" v-model="number" integer
|
||||
<up-number-box :min="0" :max="maxNum" :buttonSize="44" v-model="number" integer
|
||||
:disabled="data.productId=='-999'">
|
||||
<template #minus>
|
||||
<view class="minus number-box-btn">
|
||||
</view>
|
||||
<view class="minus number-box-btn"></view>
|
||||
</template>
|
||||
<template #input>
|
||||
<view class="u-flex-1 u-row-center u-text-center input">
|
||||
<up-input :disabled="data.productId=='-999'" @change="parseIntNumber($event,false)"
|
||||
@blur="parseIntNumber($event,true)" v-model="number" border="none"
|
||||
type="number"></up-input>
|
||||
type="digit"></up-input>
|
||||
</view>
|
||||
</template>
|
||||
<template #plus>
|
||||
|
|
@ -83,6 +82,8 @@
|
|||
let model = ref(null)
|
||||
let modelShow = ref(props.show)
|
||||
let number = ref(0)
|
||||
let maxNum = ref(0)
|
||||
|
||||
const tags = ref([{
|
||||
label: "点错",
|
||||
checked: false
|
||||
|
|
@ -110,16 +111,12 @@
|
|||
})
|
||||
|
||||
function parseIntNumber(val, isNow) {
|
||||
console.log(val)
|
||||
let newval = val * 1
|
||||
if (newval > props.data.num) {
|
||||
newval = props.data.num
|
||||
}
|
||||
// 判断是否是称重商品。如果是可以输入小数
|
||||
if (props.data.isWeight != 1) {
|
||||
if (newval < 1) {
|
||||
newval = 1
|
||||
}
|
||||
if (newval > props.data.num - props.data.returnNum) {
|
||||
newval = props.data.num - props.data.returnNum
|
||||
}
|
||||
|
||||
if (isNow) {
|
||||
number.value = newval * 1
|
||||
return
|
||||
|
|
@ -149,9 +146,8 @@
|
|||
|
||||
function open() {
|
||||
model.value.open()
|
||||
if (props.data.productId == '-999') {
|
||||
number.value = props.data.num
|
||||
}
|
||||
number.value = props.data.num - props.data.returnNum
|
||||
maxNum.value = props.data.num - props.data.returnNum
|
||||
}
|
||||
|
||||
function close() {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
*/
|
||||
async function getOrderDetail () {
|
||||
let res = await getHistoryOrder({orderId: options.id})
|
||||
console.log(res)
|
||||
console.log("订单详情===",res)
|
||||
if(res.userId){
|
||||
shopUserDetail({userId:res.userId}).then(res=>{
|
||||
if(res){
|
||||
|
|
@ -125,13 +125,12 @@
|
|||
info: value,
|
||||
placeNum: key
|
||||
}))
|
||||
console.log("goodsList===",orderDetail.goodsList);
|
||||
orderDetail.info = res
|
||||
console.log("orderDetail===",orderDetail);
|
||||
}
|
||||
|
||||
function onSeatFeeTuicai(seatFee) {
|
||||
seatFee={...seatFee,num:seatFee.num,productName:seatFee.productName}
|
||||
console.log(seatFee);
|
||||
tuicai.show = true
|
||||
tuicai.isSeatFee = seatFee
|
||||
tuicai.selGoods = seatFee
|
||||
|
|
@ -143,7 +142,6 @@
|
|||
}
|
||||
|
||||
async function onSeatFeeTuiKuan(seatFee) {
|
||||
console.log(seatFee,'调试1');
|
||||
const canTuikuan=await hasTuiKuan()
|
||||
if(!canTuikuan){
|
||||
return
|
||||
|
|
@ -177,10 +175,8 @@
|
|||
tuicai.selGoods = goods
|
||||
}
|
||||
async function tuicaiConfirm(e) {
|
||||
console.log(e)
|
||||
const res = await refundOrder(e)
|
||||
tuicai.show = false
|
||||
console.log(res)
|
||||
if(res){
|
||||
go.back()
|
||||
}else{
|
||||
|
|
@ -216,9 +212,9 @@
|
|||
if(!canTuikuan){
|
||||
return
|
||||
}
|
||||
console.log(goods,'debug');
|
||||
if (Array.isArray(goods)) {
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
orderInfo: JSON.stringify(orderDetail.info),
|
||||
goodsList:JSON.stringify(goods)
|
||||
|
||||
})
|
||||
|
|
@ -229,11 +225,10 @@
|
|||
goods.unitPrice = goods.unitPrice
|
||||
goods.userCouponId = goods.userCouponId ? goods.userCouponId:''
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
orderInfo: JSON.stringify(orderDetail.info),
|
||||
goodsList:JSON.stringify([goods])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -280,7 +275,6 @@
|
|||
function watchEmit() {
|
||||
uni.$off('orderDetail:update')
|
||||
uni.$once('orderDetail:update', (newval) => {
|
||||
console.log(newval);
|
||||
getOrderDetail()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
<view class="u-m-l-16">{{formatTime(data.createTime)}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-font-32">{{goosZhonglei}}种商品,共{{goodsNumber}}件</view>
|
||||
<view class="u-font-32">共{{data.goods.length}}件商品</view>
|
||||
<view class="border-bottom u-p-b-32">
|
||||
<view class="" v-for="(item,index) in data.goods" :key="index">
|
||||
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
|
||||
|
|
@ -38,8 +38,8 @@
|
|||
{{item.skuName}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-flex-1 u-row-right">
|
||||
<view>×{{item.num}}</view>
|
||||
<view class="u-flex u-flex-1 u-row-right" style="align-items: center;">
|
||||
<view style="margin-right: 10rpx;">×{{item.num}}</view>
|
||||
<template v-if="item.userCouponId">
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text class="line-th">¥{{item.payAmount}}</text>
|
||||
|
|
@ -109,10 +109,11 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import orderEnum from '@/commons/orderEnum.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
|
||||
const emits = defineEmits(['printOrder'])
|
||||
const props = defineProps({
|
||||
data: {
|
||||
|
|
@ -139,17 +140,7 @@
|
|||
|
||||
const priceSize = 9
|
||||
let minWidth=ref(36)
|
||||
|
||||
/**
|
||||
* 计算菜品价格
|
||||
* @param {Object} item
|
||||
*/
|
||||
function goodsPriceAmount(item) {
|
||||
const total=(item.payAmount * item.num).toFixed(2)
|
||||
const minW=total.length * priceSize + 15
|
||||
minWidth.value=minW<minWidth.value?minWidth.value:minW
|
||||
return total
|
||||
}
|
||||
|
||||
|
||||
function computedPriceStyle() {
|
||||
return {
|
||||
|
|
@ -166,7 +157,6 @@
|
|||
} else {
|
||||
$goodsMap[goods.productId] = goods.num * 1
|
||||
goosZhonglei.value += 1
|
||||
goodsNumber.value += goods.num * 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,11 +251,12 @@
|
|||
returnProductCoupAllPrice,
|
||||
returnProductCanUseNum
|
||||
} from '../quan_util.js'
|
||||
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
|
||||
|
||||
import { getCouponList } from '@/http/api/coupon.js'
|
||||
import { getHistoryOrder } from '@/http/api/order.js'
|
||||
import { getPayTypeList } from '@/http/api/payType.js'
|
||||
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl } from '@/http/api/pay.js'
|
||||
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl,queryOrderStatus } from '@/http/api/pay.js'
|
||||
import { shopUserDetail } from '@/http/api/shopUser.js'
|
||||
import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/http/api/points.js'
|
||||
|
||||
|
|
@ -390,22 +391,45 @@
|
|||
const packAmount = computed(() => {
|
||||
if(pageData.goodsList){
|
||||
let price = pageData.goodsList.filter(v => v.packNumber > 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + (b.packNumber * b.packAmount)
|
||||
console.log(b)
|
||||
return a + ((b.packAmount||0)*b.packNumber).toFixed(2)*1
|
||||
}, 0)
|
||||
console.log(price)
|
||||
return price
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
* 桌位费
|
||||
*/
|
||||
const tableFee = computed(() => {
|
||||
return order.seatNum > 0 ? order.seatNum*order.seatAmount : 0
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 菜品金额
|
||||
*/
|
||||
const originPrice = computed(() => {
|
||||
console.log("order===",order)
|
||||
if(pageData.goodsList){
|
||||
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + (b.num * b.price)
|
||||
return a + parseFloat(mathFloorPrice(b.num * b.unitPrice,b))
|
||||
}, 0)
|
||||
return (goodsPrice + (pageData.seatNum*uni.getStorageSync("shopInfo").tableFee||0) + packAmount.value).toFixed(2)
|
||||
console.log("菜品原金额===",goodsPrice)
|
||||
return (parseFloat(goodsPrice) + parseFloat(tableFee.value) + parseFloat(packAmount.value)).toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const newOriginPrice = computed(() => {
|
||||
if(pageData.goodsList){
|
||||
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + parseFloat(mathFloorPrice(b.num * b.unitPrice,b) - mathFloorPrice(b.returnNum*b.unitPrice,b) - mathFloorPrice(b.refundNum*b.unitPrice,b))
|
||||
}, 0)
|
||||
console.log("减去退款退费的菜品金额===",goodsPrice)
|
||||
console.log("桌位费===", tableFee.value)
|
||||
return (goodsPrice + tableFee.value + packAmount.value).toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -468,7 +492,7 @@
|
|||
* 支付金额
|
||||
*/
|
||||
const payPrice = computed(() => {
|
||||
console.log("originPrice===",originPrice.value)
|
||||
console.log("originPrice===",newOriginPrice.value)
|
||||
console.log("vipDiscount===",vipDiscount.value)
|
||||
console.log("discountSaleAmount===",discountSaleAmount.value)
|
||||
console.log("pointCanDicountPrice===",pointCanDicountPrice.value)
|
||||
|
|
@ -476,7 +500,7 @@
|
|||
console.log("discount===",discount.value)
|
||||
console.log("fullCouponDiscountAmount===",fullCouponDiscountAmount.value)
|
||||
console.log("accountPoints===",accountPoints)
|
||||
let total = (originPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
let total = (newOriginPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
console.log("payPrice===",total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
|
|
@ -486,13 +510,12 @@
|
|||
* 积分使用前金额
|
||||
*/
|
||||
const orderAmount = computed(() => {
|
||||
let total = (originPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
let total = (newOriginPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value
|
||||
console.log(total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
watch(() => accountPoints.sel, (newval) => {
|
||||
if (newval) {
|
||||
calcDeDuctionPoints()
|
||||
|
|
@ -943,12 +966,27 @@
|
|||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
let res;
|
||||
let timer;
|
||||
if( error.code == 211 && error.msg == '等待用户付款'){
|
||||
uni.showLoading({
|
||||
title: '支付中...'
|
||||
})
|
||||
timer = setInterval(async ()=>{
|
||||
res = await queryOrderStatus({orderId: pars.orderId})
|
||||
if ( res == 'done') {
|
||||
clearInterval(timer)
|
||||
uni.hideLoading()
|
||||
paySuccess()
|
||||
}
|
||||
console.log(res)
|
||||
},1000)
|
||||
}
|
||||
payStatus = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
|
|
@ -959,13 +997,14 @@
|
|||
infoBox.showToast('支付成功')
|
||||
payStatus = 'success'
|
||||
setTimeout(() => {
|
||||
uni.removeStorageSync("table_code")
|
||||
// uni.$emit('orderDetail:update')
|
||||
uni.$emit('get:table')
|
||||
uni.$emit('update:orderDetail')
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}, 500)
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
|
|||
return price * coup.num
|
||||
|
||||
}
|
||||
|
||||
|
||||
//返回新的商品列表,过滤掉退菜的,退单的商品
|
||||
export function returnNewGoodsList(arr) {
|
||||
let goods_list = []
|
||||
|
|
@ -44,7 +46,6 @@ export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
|||
if (selCoupNumber >= findGoodsTotalNumber) {
|
||||
return false
|
||||
}
|
||||
console.log(selCoupNumber,findGoodsTotalNumber);
|
||||
return findGoodsTotalNumber < selCoupNumber ? false : true
|
||||
}
|
||||
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
||||
|
|
@ -61,7 +62,6 @@ export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
|||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
|
||||
const discountAmount = (price * coup.num).toFixed(2)
|
||||
console.log(discountAmount);
|
||||
|
||||
// const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
|
||||
// const canUse=discountAmount>0
|
||||
|
|
@ -96,7 +96,6 @@ export function returnProductPayPrice(goods,vipUser){
|
|||
}
|
||||
//返回商品券抵扣的商品价格
|
||||
export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMember=true){
|
||||
console.log(productPriceArr);
|
||||
return productPriceArr.slice(startIndex,startIndex+num).reduce((prve,cur)=>{
|
||||
let curPrice=0
|
||||
if(typeof cur==='object'){
|
||||
|
|
@ -110,13 +109,10 @@ export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMembe
|
|||
|
||||
//返回商品券可抵扣的商品数量
|
||||
export function returnProductCanUseNum(productPriceArr,startIndex,num){
|
||||
console.log(productPriceArr);
|
||||
console.log(num);
|
||||
let n=0;
|
||||
for(let i=0;i<num;i++){
|
||||
if(productPriceArr[startIndex*1+i]){
|
||||
n+=1
|
||||
console.log(n);
|
||||
}else{
|
||||
break
|
||||
}
|
||||
|
|
@ -136,12 +132,10 @@ export function returnGoodsPayPriceMap(goodsArr){
|
|||
Object.values(goodsArr).forEach(item=>{
|
||||
goods_arr = [...goods_arr,...Object.values(item)]
|
||||
})
|
||||
console.log(goods_arr)
|
||||
return goods_arr.reduce((prve,cur)=>{
|
||||
if(!prve.hasOwnProperty(cur.productId)){
|
||||
prve[cur.productId]=[]
|
||||
}
|
||||
console.log(Math.ceil(cur.num))
|
||||
let arr = new Array(Math.ceil(cur.num)).fill(cur).map(v=>{
|
||||
return {
|
||||
memberPrice:v.memberPrice?v.memberPrice:v.price,
|
||||
|
|
@ -149,7 +143,6 @@ export function returnGoodsPayPriceMap(goodsArr){
|
|||
}
|
||||
})
|
||||
prve[cur.productId].push(...arr)
|
||||
console.log(prve)
|
||||
return prve
|
||||
},{})
|
||||
|
||||
|
|
@ -167,7 +160,6 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
|||
let coupMap={}
|
||||
for(let i in coupArr){
|
||||
const coup=coupArr[i]
|
||||
console.log(coup)
|
||||
if(coupMap.hasOwnProperty(coup.proId)){
|
||||
coupMap[coup.proId].push(coup)
|
||||
}else{
|
||||
|
|
@ -192,15 +184,12 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
|
|||
})
|
||||
goodsPayPriceMap[coup.proId]=goodsMap[coup.proId].reduce((prve,cur)=>{
|
||||
const arr=new Array(cur.number).fill(cur.payPrice)
|
||||
console.log(arr);
|
||||
prve.push(...arr)
|
||||
return prve
|
||||
},[])
|
||||
}
|
||||
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
|
||||
console.log(coup);
|
||||
const coupNum = Math.min(goodsPayPriceMap[coup.proId].length,coup.number)
|
||||
console.log(coupNum);
|
||||
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,23 @@
|
|||
<template>
|
||||
<view class="min-page bg-gray u-p-30">
|
||||
<view class="bg-fff u-p-24 border-r-12 u-flex u-row-between">
|
||||
<view>全退</view>
|
||||
<view>
|
||||
<my-radio v-model="allTui" :disabled="option.productId=='-999'"></my-radio>
|
||||
<view class="bg-fff u-p-l-30 u-p-r-30 ">
|
||||
<view class="myTabs u-m-t-20">
|
||||
<my-tabs :list="pageData.tabsList" :modelValue="pageData.tabsIndex" :textKey="'label'" @change="tabsChange"></my-tabs>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view v-if="pageData.tabsIndex == 2" class="bg-fff u-p-24 border-r-12 u-flex u-row-between" style="margin-top: 30rpx;">
|
||||
<up-input type="digit" placeholder="请输入退款金额" @change="parseIntNumber($event)" border="surround" v-model="pageData.modify" >
|
||||
<template #prefix>
|
||||
<up-text text="¥" margin="0 3px 0 0" type="tips" ></up-text>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-font-24 u-font-24">
|
||||
<text class="color-red">*</text>
|
||||
<text>客座费只能全退</text>
|
||||
</view>
|
||||
<view class="bg-fff border-r-12 list u-m-t-32">
|
||||
<view v-if="pageData.tabsIndex != 2" class="bg-fff border-r-12 list u-m-t-32">
|
||||
<view class="u-flex u-row-between border-top item u-p-t-32 u-p-b-32"
|
||||
v-for="(item,index) in orderDetail.goodsList" :key="index">
|
||||
<view>
|
||||
|
|
@ -43,23 +50,30 @@
|
|||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
|
||||
<view>支付金额</view>
|
||||
<view>
|
||||
{{to2(totalPrice)}}元
|
||||
{{to2(orderDetail.info.payAmount)}}元
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
|
||||
<view>剩余可退金额</view>
|
||||
<view class="color-red">
|
||||
{{to2(orderDetail.info.payAmount - orderDetail.info.refundAmount)}}元
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
|
||||
<view>退款金额</view>
|
||||
<view class="color-red">
|
||||
{{to2(tuikuanPrice)}}元
|
||||
{{to2(pageData.tabsIndex == 1 ? alltuikuanPrice : (pageData.tabsIndex == 2 ? pageData.modify : tuikuanPrice))}}元
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
|
||||
<!-- <view class="bg-fff u-p-24 border-r-12 u-m-t-32">
|
||||
<view>退回优惠券</view>
|
||||
<view class="u-font-24 color-999 u-m-t-16" v-if="!option.userCouponId">
|
||||
该订单未使用优惠券
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
|
||||
<view>
|
||||
<text class="color-red">*</text>
|
||||
|
|
@ -92,36 +106,25 @@
|
|||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import { refundOrder } from '@/http/api/order.js'
|
||||
|
||||
let allTui = ref(false)
|
||||
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
|
||||
let note = ref('')
|
||||
const tuikuan = reactive({
|
||||
list: ['点错', '数量点错', '客人要求', '协商退费'],
|
||||
sel: -1
|
||||
})
|
||||
const pageData = reactive({
|
||||
tabsList: [
|
||||
{label: '部分退款', value: 0},
|
||||
{label: '全部退款', value: 1},
|
||||
{label: '自定义退款', value: 2},
|
||||
],
|
||||
tabsIndex: 0,
|
||||
modify: '',
|
||||
})
|
||||
|
||||
const option=reactive({
|
||||
productId:'-999'
|
||||
})
|
||||
onLoad((opt) => {
|
||||
console.log(JSON.parse(opt.goodsList));
|
||||
|
||||
orderDetail.goodsList = JSON.parse(opt.goodsList)
|
||||
option.productId = orderDetail.goodsList[0].productId
|
||||
option.orderId = orderDetail.goodsList[0].orderId
|
||||
if(option.productId=='-999'){
|
||||
allTui.value=true
|
||||
}
|
||||
})
|
||||
watch(() => allTui.value, (newval) => {
|
||||
orderDetail.goodsList.map(v => {
|
||||
v.number = newval ? v.num : 0
|
||||
})
|
||||
})
|
||||
|
||||
function changeTuiKuanSel(i) {
|
||||
tuikuan.sel = i
|
||||
}
|
||||
const orderDetail = reactive({
|
||||
goodsList: [],
|
||||
info: {},
|
||||
|
|
@ -129,53 +132,120 @@
|
|||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
onLoad((opt) => {
|
||||
orderDetail.info = JSON.parse(opt.orderInfo)
|
||||
orderDetail.goodsList = JSON.parse(opt.goodsList)
|
||||
console.log(orderDetail)
|
||||
option.productId = orderDetail.goodsList[0].productId
|
||||
option.orderId = orderDetail.goodsList[0].orderId
|
||||
})
|
||||
|
||||
/**
|
||||
* tabs切换
|
||||
* @param {Object} i
|
||||
*/
|
||||
function tabsChange(i) {
|
||||
pageData.tabsIndex = pageData.tabsList[i].value
|
||||
if( pageData.tabsIndex == 0){ // 部分退款
|
||||
orderDetail.goodsList.map(v => {
|
||||
v.number = '0.00'
|
||||
})
|
||||
}
|
||||
if( pageData.tabsIndex == 1){ // 全部退款
|
||||
orderDetail.goodsList.map(v => {
|
||||
v.number = v.num.toFixed(2)
|
||||
})
|
||||
}
|
||||
if( pageData.tabsIndex == 2){ // 自定义退款
|
||||
orderDetail.goodsList.map(v => {
|
||||
v.number = '0.00'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function changeTuiKuanSel(i) {
|
||||
tuikuan.sel = i
|
||||
}
|
||||
function parseIntNumber (e) {
|
||||
if ( e > (orderDetail.info.payAmount - orderDetail.info.refundAmount) ) {
|
||||
setTimeout(()=>{
|
||||
pageData.modify = (orderDetail.info.payAmount - orderDetail.info.refundAmount).toFixed(2)
|
||||
},100)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 菜品总数量
|
||||
*/
|
||||
const totalNumber = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve + cur.num * 1
|
||||
}, 0)
|
||||
})
|
||||
|
||||
/**
|
||||
* 退款菜品总数量
|
||||
*/
|
||||
const tuikuanNumber = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve + cur.number * 1
|
||||
}, 0)
|
||||
})
|
||||
|
||||
const totalPrice = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve + cur.priceAmount * 1
|
||||
}, 0)
|
||||
})
|
||||
|
||||
/**
|
||||
* 退款总金额
|
||||
*/
|
||||
const tuikuanPrice = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
const n=(cur.number/cur.num*100) * cur.priceAmount
|
||||
console.log(n)
|
||||
console.log((n/100).toFixed(2))
|
||||
console.log(parseFloat(prve) + parseFloat((n/100).toFixed(2)))
|
||||
return parseFloat(prve) + parseFloat((n/100).toFixed(2))
|
||||
const n= mathFloorPrice(cur.number * cur.unitPrice,cur)
|
||||
return (parseFloat(prve) + parseFloat(n)).toFixed(2)
|
||||
}, 0)
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 剩余退款金额
|
||||
*/
|
||||
const surplusRefundPrice = computed(() => {
|
||||
return orderDetail.info.payAmount - orderDetail.goodsList.reduce((prve, cur) => {
|
||||
const n = parseFloat( mathFloorPrice(cur.refundNum * cur.unitPrice,cur))
|
||||
return (parseFloat(prve) + parseFloat(n)).toFixed(2)*1
|
||||
}, 0)
|
||||
})
|
||||
|
||||
/**
|
||||
* 退款总金额
|
||||
*/
|
||||
const alltuikuanPrice = computed(() => {
|
||||
return orderDetail.info.payAmount - orderDetail.goodsList.reduce((prve, cur) => {
|
||||
const n = parseFloat( mathFloorPrice(cur.refundNum * cur.unitPrice,cur))
|
||||
return (parseFloat(prve) + parseFloat(n)).toFixed(2)*1
|
||||
}, 0)
|
||||
})
|
||||
|
||||
function to2(n) {
|
||||
return Number(n).toFixed(2);
|
||||
}
|
||||
|
||||
function changeItem(item, step) {
|
||||
if( item.num <= 0){
|
||||
return
|
||||
}
|
||||
if(item.productId=='-999'){
|
||||
return
|
||||
}
|
||||
console.log(item);
|
||||
if( pageData.tabsIndex != 0) {
|
||||
return;
|
||||
}
|
||||
let newval = item.number * 1 + step * 1;
|
||||
if (newval <= 0) {
|
||||
newval = 0;
|
||||
}
|
||||
if (newval >= (item.num-(item.refundNum>0?item.refundNum:0))) {
|
||||
newval = (item.num-(item.refundNum>0?item.refundNum:0));
|
||||
if (newval >= (item.num)) {
|
||||
newval = item.num
|
||||
}
|
||||
item.number = newval;
|
||||
allTui.value = totalNumber.value == tuikuanNumber.value ? true : false;
|
||||
console.log(totalNumber.value)
|
||||
console.log(tuikuanNumber.value)
|
||||
item.number = newval.toFixed(2);
|
||||
pageData.tabsIndex = totalNumber.value == tuikuanNumber.value ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -186,20 +256,18 @@
|
|||
if(!canTuikuan){
|
||||
return infoBox.showToast('您没有退款权限')
|
||||
}
|
||||
if (tuikuanNumber.value <= 0) {
|
||||
if (pageData.tabsIndex != 2&&tuikuanNumber.value <= 0) {
|
||||
return infoBox.showToast('退款商品数量不能为0!')
|
||||
}
|
||||
|
||||
const selTag=tuikuan.list[tuikuan.sel]
|
||||
const noteResult=`${selTag?selTag:''}${note.value?(','+note.value):''}`
|
||||
if (!noteResult) {
|
||||
return infoBox.showToast('请输入或选择退款原因!')
|
||||
}
|
||||
let refundAmount = orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve + (cur.number * 1 * cur.unitPrice)
|
||||
}, 0)
|
||||
|
||||
let params = {
|
||||
orderId: option.orderId,
|
||||
refundAmount: refundAmount.toFixed(2),
|
||||
refundReason: noteResult,
|
||||
refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
|
||||
return {
|
||||
|
|
@ -209,6 +277,16 @@
|
|||
}
|
||||
})
|
||||
}
|
||||
if( pageData.tabsIndex == 2){
|
||||
params.modify = true
|
||||
params.refundAmount = (pageData.modify*1).toFixed(2)
|
||||
} else {
|
||||
params.modify = false
|
||||
params.refundAmount = pageData.tabsIndex == 1 ? alltuikuanPrice.value : tuikuanPrice.value
|
||||
}
|
||||
if ( pageData.tabsIndex == 2 && params.refundAmount > orderDetail.info.payAmount){
|
||||
return infoBox.showToast('退款金额不能大于付款金额!')
|
||||
}
|
||||
await refundOrder(params)
|
||||
infoBox.showToast('退款请求提交成功')
|
||||
setTimeout(()=>{
|
||||
|
|
|
|||
Loading…
Reference in New Issue