代码优化

This commit is contained in:
GaoHao 2025-03-26 13:34:19 +08:00
parent e928fdfa2a
commit 413222a5f0
42 changed files with 166 additions and 531 deletions

View File

@ -1,7 +0,0 @@
export const ColorMain= '#318AFE';
export const ColorRed= '#F02C45';
export default{
ColorMain,ColorRed
}

View File

@ -1,30 +1,5 @@
import dayjs from "dayjs";
export const $types = [{
title: "计量商品",
desc: '单价购买',
value: 'normal'
},
{
title: "多规格",
desc: '多种不同规格',
value: 'sku'
},
{
title: "套餐组合",
desc: '选择多种组合',
value: 'group'
},
{
title: "称重商品",
desc: '按重量售卖',
value: 'weight'
},
{
title: "时价商品",
desc: '收银端可更改价格',
value: 'currentPrice'
}
]
// 商品默认sku
export const $defaultSku = {
@ -35,52 +10,3 @@ export const $defaultSku = {
suitNum: '',
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`,
}
// 库存记录筛选类型
export const $invoicingType = [{
text: '全部',
value: ''
},
{
text: '手动入库',
value: 'manual-in'
},
{
text: '手动出库',
value: 'manual-out'
},
{
text: '盘盈入库',
value: 'win-in'
},
{
text: '盘亏出库',
value: 'loss-out'
},
{
text: '订单退款入库',
value: 'other-out'
},
{
text: '订单消费出库',
value: 'order-out'
},
{
text: '损耗出库',
value: 'damage-out'
}
]
// 页面常用数据
export const $pageData = {
query: {
page: 0,
size: 10
},
totalElements: 0,
list: [],
hasAjax: false,
}

View File

@ -1,84 +0,0 @@
export default {
status: [
{
key: 'unpaid',
label: '待支付'
},
{
key: 'in-production',
label: '制作中'
},
{
key: 'wait-out',
label: '待取餐'
},
{
key: 'done',
label: '订单完成'
},
{
key: 'refunding',
label: '申请退单'
},
{
key: 'refund',
label: '退单'
},
{
key: 'part_refund',
label: '部分退单'
},
{
key: 'cancelled',
label: '取消订单'
},
// {
// key: 'merge',
// label: '合台'
// },
// {
// key: 'pending',
// label: '挂单'
// },
// {
// key: 'activate',
// label: '激活'
// },
// {
// key: 'paying',
// label: '支付中'
// }
],
dineMode: [
{
key: 'take-away',
label: '外卖'
},
{
key: 'take-out',
label: '自提'
},
{
key: 'dine-in',
label: '堂食'
}
],
orderType: [
{
key: 'cash',
label: '收银'
},
{
key: 'miniapp',
label: '小程序'
},
{
key: 'offline',
label: '线下'
},
{
key: 'return',
label: '退单'
}
]
}

View File

@ -1,35 +0,0 @@
export const $status = {
idle: {
label: "空闲",
type: "#3F9EFF",
},
using: {
label: "使用中",
type: "#fa5555",
},
subscribe: {
label: "预定",
type: "rgb(34, 191, 100)",
},
closed: {
label: "关台",
type: "rgb(221,221,221)",
},
opening: {
label: "开台中",
type: "#E6A23C",
},
cleaning: {
label: "待清台",
type: "#FAAD14",
},
// paying: {
// label: "结算中",
// type: "#E6A23C",
// },
unbind: {
label: "未绑定",
type: "rgb(221,221,221)",
}
}

75
commons/utils/dict.js Normal file
View File

@ -0,0 +1,75 @@
export default {
orderStatus: [
{ label: "待支付", type: "unpaid" },
{ label: "制作中", type: "in_production" },
{ label: "待取餐", type: "wait_out" },
{ label: "订单完成", type: "done" },
{ label: "申请退单", type: "refunding" },
{ label: "退单", type: "refund" },
{ label: "部分退单", type: "part_refund" },
{ label: "取消订单", type: "cancelled" },
],
orderType: [
{ label: "收银", type: "cash" },
{ label: "小程序", type: "miniapp" },
],
dineMode: [
{ label: "堂食", type: "dine-in" },
{ label: "外带", type: "take-out" },
{ label: "外卖", type: "take-away" },
],
payType: [
{ label: "主扫", type: "main_scan" },
{ label: "被扫", type: "back_scan" },
{ label: "微信小程序", type: "wechat_mini" },
{ label: "支付宝小程序", type: "alipay_mini" },
{ label: "会员支付", type: "vip_pay" },
{ label: "现金支付", type: "cash_pay" },
{ label: "挂账支付", type: "credit_pay" },
],
bizCodes: [
{ label: "现金充值", type: "cashIn" },
{ label: "微信小程序充值", type: "wechatIn" },
{ label: "支付宝小程序充值", type: "alipayIn" },
{ label: "充值奖励", type: "awardIn" },
{ label: "充值退款", type: "rechargeRefund" },
{ label: "订单消费", type: "orderPay" },
{ label: "订单退款", type: "orderRefund" },
{ label: "管理员充值", type: "adminIn" },
{ label: "管理员消费", type: "adminOut" },
],
platformType: [
{ label: '微信小程序', type: 'WX' },
{ label: '支付宝小程序', type: 'ALI' },
{ label: '收银机客户端', type: 'PC' },
{ label: 'PC管理端', type: 'WEB' },
{ label: 'APP管理端', type: 'APP' },
{ label: '收款码', type: 'H5' },
],
tableStatus: {
idle: { label: "空闲", type: "#3F9EFF" },
using: { label: "使用中", type: "#fa5555" },
subscribe: { label: "预定", type: "rgb(34, 191, 100)" },
closed: { label: "关台", type: "rgb(221,221,221)" },
opening: { label: "开台中", type: "#E6A23C" },
cleaning: { label: "待清台", type: "#FAAD14" },
paying: { label: "结算中", type: "#E6A23C" },
unbind: { label: "未绑定", type: "rgb(221,221,221)" }
},
invoicingType: [
{ label: '全部', type: '' },
{ label: '手动入库', type: 'manual-in' },
{ label: '手动出库', type: 'manual-out' },
{ label: '盘盈入库', type: 'win-in' },
{ label: '盘亏出库', type: 'loss-out' },
{ label: '订单退款入库', type: 'other-out' },
{ label: '订单消费出库', type: 'order-out' },
{ label: '损耗出库', type: 'damage-out' },
],
getDiceName(val,key){
let item = this[key].find(v => v.type == val)
console.log(item)
return item ? item.label : ''
}
}

View File

@ -1,19 +0,0 @@
export const directive = {
vOnlyNumber : {
mounted(el) {
// 当元素挂载时设置事件监听器
el.addEventListener('input', (event) => {
// 使用正则表达式只允许数字通过
event.target.value = event.target.value.replace(/[^\d]/g, '');
});
},
// 如果需要处理组件更新后的情况,可以添加 updated 钩子
updated(el) {
el.addEventListener('input', (event) => {
event.target.value = event.target.value.replace(/[^\d]/g, '');
});
}
}
}

View File

@ -1,13 +0,0 @@
/**
* 获取url链接参数
* @param {Object} url
* @param {Object} name
*/
export function getQueryString(url, name) {
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
}

View File

@ -178,5 +178,18 @@ export const utils = {
},
/**
* 获取url链接参数
* @param {Object} url
* @param {Object} name
*/
getQueryString(url, name) {
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
}

View File

@ -10,10 +10,8 @@
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import color from '@/commons/color.js'
import { ref } from 'vue'
const props = defineProps({
disabled: {
type: [Boolean],

View File

@ -3,8 +3,8 @@ import envConfig from '@/env/config.js'
// 全局配置项
import appConfig from '@/config/appConfig.js'
import storageManage from '@/commons/utils/storageManage.js'
import dict from '@/commons/utils/dict.js'
import {utils} from '@/commons/utils/index.js'
import {directive} from '@/commons/utils/directive.js'
import uviewPlus from 'uview-plus'
// 设置node环境
@ -38,9 +38,9 @@ export function createApp() {
uni.$appName = appConfig.appName
app.config.globalProperties.$utils = utils
uni.$utils = utils
app.config.globalProperties.$dict = dict
uni.$dict = dict
// 全局注册指令
app.directive('only-number', directive.vOnlyNumber);
return {
app
}

View File

@ -34,17 +34,10 @@
</template>
<script setup>
import {
computed,
ref,
watch,
watchEffect
} from 'vue';
import { computed, ref, watch, watchEffect } from 'vue';
import mySwitch from '@/components/my-components/my-switch.vue'
import go from '@/commons/utils/go.js';
import {
ColorMain
} from '@/commons/color.js'
const emits = defineEmits([ 'changeClick', 'del', 'statusChange'])

View File

@ -34,7 +34,6 @@
import { ref, computed, onMounted, reactive, getCurrentInstance } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js';
import color from '@/commons/color.js';
import { stockCheck } from '@/http/api/cons.js';

View File

@ -66,7 +66,6 @@
<script setup>
import { ref, computed, reactive, onMounted, getCurrentInstance } from 'vue';
import { onShow, onLoad } from '@dcloudio/uni-app';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import dayjs from 'dayjs';

View File

@ -92,7 +92,6 @@
<script setup>
import { onMounted, reactive, ref, computed, getCurrentInstance } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import color from '@/commons/color.js';
import { stockFlow,consStatistics } from '@/http/api/cons.js';
let datas = reactive({

View File

@ -66,7 +66,6 @@
<script setup>
import { ref, computed, reactive, getCurrentInstance } from 'vue';
import { onShow, onLoad } from '@dcloudio/uni-app';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import dayjs from 'dayjs';

View File

@ -83,7 +83,6 @@
import { onShow, onReachBottom } from '@dcloudio/uni-app'
import myRepayment from './components/my-repayment';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import { hasPermission } from '@/commons/utils/hasPermission.js';

View File

@ -33,7 +33,6 @@
</template>
<script setup>
import { ColorMain } from '@/commons/color.js'
const emits = defineEmits(['goodsClick', 'del'])
const props = defineProps({

View File

@ -42,16 +42,10 @@
</template>
<script setup>
import {
computed,
ref,
watchEffect
} from 'vue';
import { computed, ref, watchEffect } from 'vue';
import mySwitch from '@/components/my-components/my-switch.vue'
import go from '@/commons/utils/go.js';
import {
ColorMain
} from '@/commons/color.js'
const emits = defineEmits(['changeClick','edit', 'editName','editSort', 'del', 'isShowChange'])

View File

@ -31,21 +31,8 @@
</template>
<script setup>
import {
reactive,
ref,
watch,
onMounted,
computed
} from 'vue';
import {
returnSkuSnap,
returnTypeEnum,
returnCategory
} from '@/pageProduct/util.js'
import {
$tbShopUnit
} from '@/http/yskApi/goods.js'
import { reactive, ref, watch, computed } from 'vue';
const props = defineProps({
show: {
type: Boolean,
@ -63,32 +50,21 @@
}
})
function changeShowRecoders(show) {
recoders.show = show
}
const data = ref(props.item)
const emits = defineEmits(['update:show', 'save'])
const form = reactive({
note: ''
})
let popShow = ref(props.show)
let sort=ref('')
watch(()=>props.item.sort,(newval)=>{
sort.value=newval
})
watch(() => props.show, (newval) => {
popShow.value = newval
if (newval) {
data.value = props.item
}
})
const isSku = computed(() => {
// return data.value.typeEnum == ''
return false
})
watch(() => popShow.value, (newval) => {
emits('update:show', newval)
})

View File

@ -81,7 +81,7 @@
<view class="u-flex color-999 " @tap="delproGroupVo(index)">
<uni-icons type="minus-filled" :size="16"
:color="color.ColorRed"></uni-icons>
:color="$utils.ColorRed"></uni-icons>
<view class="u-m-l-10">删除套餐组</view>
</view>
</view>
@ -90,7 +90,7 @@
<view class="u-flex color-main u-font-24 u-m-l-24"
@click="proGroupVoAddGoods(index,item.goods)">
<up-icon name="plus" :size="12"
:color="color.ColorMain"></up-icon>
:color="$utils.ColorMain"></up-icon>
<view class="font-bold">添加商品</view>
</view>
</view>
@ -150,7 +150,7 @@
</view>
<up-icon @click="proGroupVoGoodsDel(index,goodsIndex)"
size="14" name="trash"
:color="color.ColorMain"></up-icon>
:color="$utils.ColorMain"></up-icon>
</view>
</view>
</view>
@ -173,7 +173,7 @@
<template v-if="FormData.groupType==1">
<view class="bg-fff u-flex u-p-t-24 u-p-b-24 border-r-12 "
@tap="proGroupVoPush">
<uni-icons type="plus-filled" :color="color.ColorMain"
<uni-icons type="plus-filled" :color="$utils.ColorMain"
:size="20"></uni-icons>
<view class="u-m-l-16">添加套餐组</view>
</view>
@ -181,7 +181,7 @@
<template v-else>
<view class="bg-fff u-flex u-p-t-24 u-p-b-24 border-r-12 "
@tap="proGroupVoAddGoods()">
<uni-icons type="plus-filled" :color="color.ColorMain"
<uni-icons type="plus-filled" :color="$utils.ColorMain"
:size="20"></uni-icons>
<view class="u-m-l-16">添加商品</view>
</view>
@ -423,29 +423,13 @@
</template>
<script setup>
import {
computed,
onBeforeUnmount,
reactive,
ref,
watch,
nextTick
} from 'vue';
import {
onLoad,
onShow,
onReady
} from '@dcloudio/uni-app';
import {
ColorMain
} from '@/commons/color.js'
import { computed, onBeforeUnmount, reactive, ref, watch, nextTick } from 'vue';
import { onLoad, onShow, onReady } from '@dcloudio/uni-app';
import dayjs from "dayjs";
import {
formatPrice
} from "@/commons/utils/format.js";
import { formatPrice } from "@/commons/utils/format.js";
import go from '@/commons/utils/go.js';
import color from '@/commons/color.js';
import chooseGoods from './components/choose-goods'
import chooseGuige from './components/choose-guige'
@ -458,7 +442,7 @@
import { hasPermission } from '@/commons/utils/hasPermission.js';
import { $types, $defaultSku } from '@/commons/goodsData.js'
import { $defaultSku } from '@/commons/goodsData.js'
import {
getCategoryList,

View File

@ -9,7 +9,7 @@
</view>
</view>
<view class="u-m-t-24">
<uni-data-checkbox :selectedColor="color.ColorMain" multiple v-model="item.cycleChecked"
<uni-data-checkbox :selectedColor="$utils.ColorMain" multiple v-model="item.cycleChecked"
:localdata="cycle"></uni-data-checkbox>
</view>
<view class="u-m-t-24">
@ -50,7 +50,6 @@
import { onLoad, onReady } from '@dcloudio/uni-app';
import { computed, ref } from 'vue';
import go from '@/commons/utils/go.js';
import color from '@/commons/color.js'
import { getProductDetail } from '@/http/api/product.js'

View File

@ -24,7 +24,7 @@
<view class="u-m-t-16">
<uni-data-checkbox @change="createResult" multiple :selectedColor="color.ColorMain"
<uni-data-checkbox @change="createResult" multiple :selectedColor="$utils.ColorMain"
v-model="item.selectSpecResult" :localdata="item.children">
</uni-data-checkbox>
@ -129,7 +129,7 @@
<button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow">
<view class="u-flex u-row-center">
<view class="u-m-r-6">批量修改</view>
<up-icon name="edit-pen" :color="color.ColorMain"></up-icon>
<up-icon name="edit-pen" :color="$utils.ColorMain"></up-icon>
</view>
</button>
</view>
@ -149,7 +149,6 @@
import infoBox from '@/commons/utils/infoBox.js'
import dayjs from "dayjs";
import go from '@/commons/utils/go.js';
import color from '@/commons/color.js';
import { $defaultSku } from '@/commons/goodsData.js'
import { hasPermission } from '@/commons/utils/hasPermission.js';

View File

@ -36,21 +36,8 @@
</template>
<script setup>
import {
reactive,
ref,
watch,
onMounted,
computed
} from 'vue';
import {
returnSkuSnap,
returnTypeEnum,
returnCategory
} from '@/pageProduct/util.js'
import {
$tbShopUnit
} from '@/http/yskApi/goods.js'
import { reactive, ref, watch, computed } from 'vue';
const props = defineProps({
show: {
type: Boolean,

View File

@ -1,30 +1,4 @@
import dayjs from "dayjs";
export const $types = [{
title: "计量商品",
desc: '单价购买',
value: 'normal'
},
{
title: "多规格",
desc: '多种不同规格',
value: 'sku'
},
{
title: "套餐组合",
desc: '选择多种组合',
value: 'group'
},
{
title: "称重商品",
desc: '按重量售卖',
value: 'weight'
},
{
title: "时价商品",
desc: '收银端可更改价格',
value: 'currentPrice'
}
]
// 商品默认sku
export const $defaultSku = {
@ -36,38 +10,3 @@ export const $defaultSku = {
suitNum: 1,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`,
}
// 库存记录筛选类型
export const $invoicingType = [{
text: '全部',
value: ''
},
{
text: '供应商入库',
value: 'purveyor'
},
{
text: '供应商退货',
value: 'reject'
},
{
text: '其他入库',
value: 'purchase'
},
{
text: '其他出库',
value: 'other-out'
}
]
// 页面常用数据
export const $pageData = {
query: {
page: 0,
size: 10
},
totalElements: 0,
list: [],
hasAjax: false,
}

View File

@ -85,7 +85,6 @@
<script setup>
import { computed, reactive, ref, watch, onMounted } from 'vue';
import { returnSkuSnap, returnTypeEnum, returnCategory } from '@/pageProduct/util.js'
import { formatPrice } from "@/commons/utils/format.js";
const emits = defineEmits(['update:show', 'save'])

View File

@ -112,7 +112,6 @@
<script setup>
import { reactive, ref, watch, onMounted, computed } from 'vue';
import { $invoicingType } from '@/commons/goodsData.js'
import { productStockFlow } from '@/http/api/product.js'
import go from '@/commons/utils/go.js'
const refForm = ref(null)
@ -173,22 +172,18 @@
getProductStockDetail()
}
})
let getTypeName = (type) => {
let item = $invoicingType.filter(item=> item.value == type)[0]
return item?item.text:''
}
async function getProductStockDetail(){
const { records }=await productStockFlow({
page: 1,
size: 2,
productId: props.goods.id,
})
console.log(records);
recoders.list = records.map(v=>{
return {
...v,
title: v.createTime,
content: getTypeName(v.inOutItem)+':'+Math.abs(v.inOutNumber)
content: uni.$dict.getDiceName(v.inOutItem,'invoicingType')+':'+Math.abs(v.inOutNumber)
}
})
}

View File

@ -7,7 +7,7 @@
<text class="u-m-l-20">{{data.sort}}</text>
</view>
<view class="color-333 u-m-l-42 u-flex">
<up-icon @click="editStock" name="edit-pen" :size="16" :color="ColorMain"></up-icon>
<up-icon @click="editStock" name="edit-pen" :size="16" :color="$utils.ColorMain"></up-icon>
<text class="stock u-m-l-4">库存:{{data.stockNumber}}</text>
</view>
</view>
@ -21,7 +21,7 @@
<view class="u-m-t-48 u-flex u-col-top u-relative">
<view v-if="props.showChecked">
<label class="radio">
<radio :color="ColorMain" style="transform: scale(0.7);" @click="radioClick"
<radio :color="$utils.ColorMain" style="transform: scale(0.7);" @click="radioClick"
:checked="props.data.checked" /><text></text>
</label>
</view>
@ -102,7 +102,7 @@
import { updateProduct,productOnOff,productMarkIsSoldOut } from '@/http/api/product.js'
import go from '@/commons/utils/go.js';
import {hasPermission} from '@/commons/utils/hasPermission.js';
import { ColorMain } from '@/commons/color.js'
const emits = defineEmits(['radioClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update',
'editStock'
])

View File

@ -203,7 +203,6 @@
size: 200
}).then(res => {
pageData.categoryList = returnAllCategory(res)
console.log(pageData.categoryList);
})
}

View File

@ -4,7 +4,7 @@
<view class="">
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="data.createTime"></uni-dateformat>
</view>
<view class="tag">{{getTypeName(data.inOutItem)}}</view>
<view class="tag">{{$dict.getDiceName(data.inOutItem,'invoicingType')}}</view>
</view>
<view class="u-flex u-text-left u-row-left u-m-t-30">
<view class="name up-line-1">{{data.productName}}</view>
@ -52,8 +52,7 @@
<script setup>
import { reactive } from 'vue';
import go from '@/commons/utils/go.js'
import { $invoicingType } from '@/commons/goodsData.js'
const props = defineProps({
data: {
type: Object,
@ -63,10 +62,6 @@
}
})
let getTypeName = (type) => {
let item = $invoicingType.filter(item=> item.value == type)[0]
return item?item.text:''
}
</script>

View File

@ -71,7 +71,6 @@
import myListItem from './components/list-item.vue';
import { $invoicingType } from '@/commons/goodsData.js'
import { productStockFlow } from '@/http/api/product.js'
@ -98,7 +97,7 @@
//
const types = reactive({
list:$invoicingType,
list: uni.$dict.invoicingType,
active: '',
show: false,
bottomHeight: 14

View File

@ -1,4 +1,4 @@
import { $types } from '@/commons/goodsData.js'
export function returnSkuSnap(goods) {
const selectSpec = typeof goods.selectSpec === 'string' ? JSON.parse(goods.selectSpec) : goods.selectSpec
let result = selectSpec.map(v => {
@ -9,11 +9,7 @@ export function returnSkuSnap(goods) {
})
return result
}
export function returnTypeEnum(type) {
const item = $types.find(v => v.title == type)
let result = item ? item.value : undefined
return result
}
export function returnCategory(cateName, cateList) {
console.log(cateName);
console.log(cateList);

View File

@ -54,13 +54,13 @@
<view class="u-flex u-col-center" @tap="timeToggle">
<text class="color-main">充值时间</text>
<view class="icon-down u-m-l-6">
<uni-icons type="right" :color="color.ColorMain" size="16"></uni-icons>
<uni-icons type="right" :color="$utils.ColorMain" size="16"></uni-icons>
</view>
</view>
<view class="u-flex u-col-center" @tap="showStatusToggle">
<text :class="{'color-main':nowStatusIndex>=1}">状态</text>
<view class="icon-down u-m-l-6">
<uni-icons type="right" :color="nowStatusIndex>=1 ? color.ColorMain:'#000'" size="16"></uni-icons>
<uni-icons type="right" :color="nowStatusIndex>=1 ? $utils.ColorMain:'#000'" size="16"></uni-icons>
</view>
</view>
<view style="width: 164rpx;"></view>
@ -78,7 +78,7 @@
<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
v-for="(item,index) in status" :key="index">
<view :class="{'color-main':nowStatusIndex===index}">{{item}}</view>
<uni-icons v-if="nowStatusIndex===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
<uni-icons v-if="nowStatusIndex===index" type="checkmarkempty" :color="$utils.ColorMain"></uni-icons>
</view>
<view :style="{height: statusBootom+'px'}"></view>
</view>
@ -138,7 +138,6 @@
import myModel from '@/components/my-components/my-model.vue'
import myDatePickerview from '@/components/my-components/my-date-pickerview'
import rechargeItem from './components/recharge-item.vue'
import color from '@/commons/color.js';
import $util from '@/commons/utils/getDateArea.js';
import go from '@/commons/utils/go.js';

View File

@ -72,8 +72,7 @@
import myButton from '@/components/my-components/my-button'
import go from '@/commons/utils/go.js'
import { hasPermission } from '@/commons/utils/hasPermission.js'
import { $status } from '@/commons/table-status.js'
import { $table } from '@/http/yskApi/table.js'
import { shopTableClear } from '@/http/api/table.js'
const emits = defineEmits(['more', 'update', 'bind'])
const props = defineProps({
@ -88,26 +87,18 @@
default: () => {}
}
})
const status = $status
const computedClass = computed(() => {
return props.data.status
})
function returnStutasText(key) {
key = returnIsUseing(key)
const item = status[key]
const item = uni.$dict.tableStatus[key]
return item ? item.label : ''
}
const computedClass = computed(() => {
const key = returnIsUseing(props.data.status)
return key
})
function returnIsUseing(key) {
// return key = key == 'using' ? (props.data.orderId ? key : 'idle') : key
return key
}
function returnStutasColor(key) {
key = returnIsUseing(key)
const item = status[key]
const item = uni.$dict.tableStatus[key]
return item ? item.type : ''
}
@ -151,16 +142,14 @@
* 清台
*/
function qingtai() {
const item = props.data
let item = props.data
uni.showModal({
title: '提示',
content: '确定要清台:' + props.data.name + '',
content: '确定要清台:' + item.name + '',
success(res) {
if (res.confirm) {
$table.update({
...item,
status: "idle",
qrcode: item.id,
shopTableClear({
id: item.id,
}).then(res => {
uni.$utils.showToast('清台成功')
emits('update')

View File

@ -69,11 +69,12 @@
import { onLoad, onReady, onShow, } from '@dcloudio/uni-app';
import { ref, reactive, computed, watch } from 'vue';
import { $status } from '@/commons/table-status.js'
import tableItem from './components/table-item'
import go from '@/commons/utils/go.js';
import myActionSheet from '@/components/my-components/my-action-sheet';
import tableItem from './components/table-item'
import { hasPermission } from '@/commons/utils/hasPermission.js'
import { getShopTable, shopTableBind, shopTableClear } from '@/http/api/table.js'
import { getShopArea } from '@/http/api/area.js'
import { printOrder } from '@/http/api/order.js'
@ -94,7 +95,7 @@
statusList: [[{
key: '',
label: '全部'
},...uni.$utils.objToArrary($status)]],
},...uni.$utils.objToArrary(uni.$dict.tableStatus)]],
statusName: '全部',
tabList: [],
area: {
@ -138,7 +139,7 @@
* 获取区域
*/
async function getArea() {
const res = await getShopArea({ name: '', page: 0, size: 300 })
const res = await getShopArea({ name: '', page: 1, size: 300 })
pageData.area.list = res.records
pageData.areaMap = res.records.reduce((prve, cur) => {
prve[cur.id] = cur.name

View File

@ -66,7 +66,6 @@
<script setup>
import { reactive, ref, watch } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import { $status } from '@/commons/table-status.js'
import { getShopTable } from '@/http/api/table.js'
import { getShopArea} from '@/http/api/area.js'
@ -149,7 +148,7 @@
* @param {Object} key
*/
function returnStutasText(key) {
const item = $status[key]
const item = uni.$dict.tableStatus[key]
return item ? item.label : ''
}
@ -158,7 +157,7 @@
* @param {Object} key
*/
function returnStutasColor(key) {
const item = $status[key]
const item = uni.$dict.tableStatus[key]
return item ? item.type : ''
}

View File

@ -42,7 +42,7 @@
<view class="list-tight-top">
<template v-if="lingshi.show">
<view id="lingshi" class="lingshi u-m-b-32" @tap="toLinshi">
<uni-icons type="plus-filled" size="24" :color="color.ColorMain"></uni-icons>
<uni-icons type="plus-filled" size="24" :color="$utils.ColorMain"></uni-icons>
<view class="u-m-t-24 color-main">临时菜</view>
</view>
</template>
@ -122,7 +122,6 @@
import myCar from './components/car'
import util from './util.js';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import { getNowCart } from '@/pagesCreateOrder/util.js'
import storageManage from '@/commons/utils/storageManage.js'

View File

@ -210,7 +210,7 @@
</view>
<view class="u-m-t-24" v-if="orderInfo.status == 'unpaid'||orderInfo.status == 'done'">
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
<my-button @tap="printOrder" type="cancel" :color="$utils.ColorMain">重新打印</my-button>
</view>
</view>
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide">
@ -268,7 +268,6 @@
<script setup>
import { computed, reactive } from 'vue';
import color from '@/commons/color.js'
import { hasPermission } from '@/commons/utils/hasPermission.js'
import { isTui, isTuiCai, isGift, canTuiKuan, canTuicai, mathFloorPrice } from '@/commons/utils/goodsUtil.js'

View File

@ -2,11 +2,11 @@
<view class="default-box-padding bg-fff border-r-12 u-m-t-24">
<view class="u-flex u-row-between">
<view>订单状态</view>
<view>{{returnStatus(data.status)}}</view>
<view>{{$dict.getDiceName(data.status,'orderStatus')}}</view>
</view>
<view class="u-flex u-row-between u-m-t-24">
<view>订单类型</view>
<view>{{returnUseType(data.dineMode)}}</view>
<view>{{$dict.getDiceName(data.dineMode,'dineMode')}}</view>
</view>
<view class="u-flex u-row-between u-m-t-24">
<view>桌位号</view>
@ -18,7 +18,7 @@
</view>
<view class="u-flex u-row-between u-m-t-24">
<view>支付方式</view>
<view>{{returnPayType(data.payType)||''}}</view>
<view>{{$dict.getDiceName(data.payType,'payType')||''}}</view>
</view>
<view class="u-flex u-row-between u-m-t-24">
<view>下单时间</view>
@ -46,7 +46,7 @@
<script setup>
import { ref } from 'vue';
import orderEnum from '@/commons/orderEnum.js'
const props = defineProps({
data: {
type: Object,
@ -63,35 +63,7 @@
}
}
})
const payTypeList = [
{name: '主扫', type:'main_scan'},
{name: '被扫', type:'back_scan'},
{name: '微信小程序', type:'wechat_mini'},
{name: '支付宝小程序', type:'alipay_mini'},
{name: '会员支付', type:'vip_pay'},
{name: '现金支付', type:'cash_pay'},
]
const payTypeName = ref(null)
/**
* 获取支付方式
*/
function returnPayType(payType) {
let item = payTypeList.find( v=> v.type == payType )
return item ? item.name : ''
}
function returnStatus(status) {
const item = orderEnum.status.find(v => v.key == status)
return item ? item.label : ''
}
function returnUseType(useType) {
if (!useType) {
return ''
}
return useType == "take-out" ? '自取' : '堂食';
}
</script>
<style lang="scss" scoped>

View File

@ -13,10 +13,7 @@
</template>
<script setup>
import {
reactive
} from 'vue';
import color from '@/commons/color.js'
import { reactive } from 'vue';
const itemStyle = reactive({
color: 'rgb(255,0,0)'
})

View File

@ -42,14 +42,8 @@
</template>
<script setup>
import orderEnum from '@/commons/orderEnum.js'
import { reactive, ref, watch } from 'vue';
import * as $time from '@/commons/utils/dayjs-time.js';
import color from '@/commons/color.js';
import {
reactive,
ref,
watch
} from 'vue';
const emits = defineEmits(['update:time', 'update:status','updateStatus'])
@ -91,7 +85,7 @@
})
const statusData = reactive({
allList: orderEnum.status,
allList: uni.$dict.orderStatus,
moreShow: false,
allListSel: -1,
list: [{
@ -145,7 +139,7 @@
console.log(i);
}
function statusConfirm(){
const status=statusData.allList[statusData.allListSel].key
const status=statusData.allList[statusData.allListSel].type
statusData.sel=status
emits('updateStatus',status)
moreShowHide()

View File

@ -1,23 +1,23 @@
<template>
<view class="bg-fff item" @click="toDetail">
<view class="u-flex u-p-b-22 border-bottom u-row-between u-col-center">
<view class="u-flex u-col-bottom">
<view class="u-flex u-col-bottom" style="align-items: center;">
<template v-if="data.tableName">
<view class="u-flex u-col-center">
<view class="u-font-40 color-333">{{data.tableName}}</view>
<view class="line" style="height: 16px;"></view>
</view>
</template>
<view class="">{{data.masterId}}</view>
<!-- <view class="">{{ $dict.getDiceName(data.platformType,'platformType') }}</view> -->
</view>
<view class="u-flex">
<view>
<text :class="[data.status]">{{returnStatus(data.status)}}</text>
<text :class="[data.status]">{{$dict.getDiceName(data.status,'orderStatus')}}</text>
</view>
<view class="line"></view>
<view class=" color-main">
<text>
{{sendTypeFilter(data.dineMode)}}
{{$dict.getDiceName(data.dineMode,'dineMode')}}
</text>
</view>
</view>
@ -99,10 +99,10 @@
<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 { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
const emits = defineEmits(['printOrder'])
const props = defineProps({
data: {
@ -156,25 +156,10 @@
goodsMapInit()
})
function formatTime(time) {
return dayjs(time).format('YYYY-MM-DD HH:mm:ss');
}
function returnStatus(status) {
const item = orderEnum.status.find(v => v.key == status)
return item ? item.label : ''
}
function sendTypeFilter(t) {
if (t) {
const item = orderEnum.dineMode.find(item => item.key == t)
return item ? item.label : '';
} else {
return t;
}
}
function toDetail() {
go.to('PAGES_ORDER_DETAIL', {
id: props.data.id

View File

@ -130,7 +130,6 @@
<script setup>
import { onLoad, onReady } from '@dcloudio/uni-app'
import { ref, reactive, watch, computed, onMounted } from 'vue';
import color from '@/commons/color.js'
import dayjs from 'dayjs';
import { getSafeBottomHeight } from '@/commons/utils/safe-bottom.js'
import go from '@/commons/utils/go.js'