diff --git a/commons/color.js b/commons/color.js deleted file mode 100644 index 5987b9e..0000000 --- a/commons/color.js +++ /dev/null @@ -1,7 +0,0 @@ -export const ColorMain= '#318AFE'; -export const ColorRed= '#F02C45'; - - -export default{ - ColorMain,ColorRed -} diff --git a/commons/goodsData.js b/commons/goodsData.js index 018f06b..68a1e21 100644 --- a/commons/goodsData.js +++ b/commons/goodsData.js @@ -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, -} \ No newline at end of file diff --git a/commons/orderEnum.js b/commons/orderEnum.js deleted file mode 100644 index 5962d41..0000000 --- a/commons/orderEnum.js +++ /dev/null @@ -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: '退单' - } - ] -} \ No newline at end of file diff --git a/commons/table-status.js b/commons/table-status.js deleted file mode 100644 index 713bc56..0000000 --- a/commons/table-status.js +++ /dev/null @@ -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)", - } -} \ No newline at end of file diff --git a/commons/utils/dict.js b/commons/utils/dict.js new file mode 100644 index 0000000..4b7a97c --- /dev/null +++ b/commons/utils/dict.js @@ -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 : '' + } +} \ No newline at end of file diff --git a/commons/utils/directive.js b/commons/utils/directive.js deleted file mode 100644 index 5ce4160..0000000 --- a/commons/utils/directive.js +++ /dev/null @@ -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, ''); - }); - } - } -} - diff --git a/commons/utils/getQueryString.js b/commons/utils/getQueryString.js deleted file mode 100644 index ed310c7..0000000 --- a/commons/utils/getQueryString.js +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/commons/utils/index.js b/commons/utils/index.js index 64b2c33..5a4848d 100644 --- a/commons/utils/index.js +++ b/commons/utils/index.js @@ -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; + }, } \ No newline at end of file diff --git a/components/my-components/my-radio.vue b/components/my-components/my-radio.vue index e6a6836..61c23fb 100644 --- a/components/my-components/my-radio.vue +++ b/components/my-components/my-radio.vue @@ -10,10 +10,8 @@ diff --git a/pageProduct/invoicing-list/invoicing-list.vue b/pageProduct/invoicing-list/invoicing-list.vue index 741f9c5..39efdfd 100644 --- a/pageProduct/invoicing-list/invoicing-list.vue +++ b/pageProduct/invoicing-list/invoicing-list.vue @@ -70,8 +70,7 @@ import { ref, reactive, computed, watch } from 'vue'; 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 diff --git a/pageProduct/util.js b/pageProduct/util.js index 575879b..88cdb41 100644 --- a/pageProduct/util.js +++ b/pageProduct/util.js @@ -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); diff --git a/pageRecharge/index.vue b/pageRecharge/index.vue index 0fcd180..74c663e 100644 --- a/pageRecharge/index.vue +++ b/pageRecharge/index.vue @@ -54,13 +54,13 @@ 充值时间 - + 状态 - + @@ -78,7 +78,7 @@ {{item}} - + @@ -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'; diff --git a/pageTable/index/components/table-item.vue b/pageTable/index/components/table-item.vue index 02ec2b1..b43b414 100644 --- a/pageTable/index/components/table-item.vue +++ b/pageTable/index/components/table-item.vue @@ -71,10 +71,9 @@ import { computed, ref } from 'vue'; 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 { hasPermission } from '@/commons/utils/hasPermission.js' + import { shopTableClear } from '@/http/api/table.js' + const emits = defineEmits(['more', 'update', 'bind']) const props = defineProps({ data: { @@ -88,26 +87,18 @@ default: () => {} } }) - const status = $status - function returnStutasText(key) { - key = returnIsUseing(key) - const item = status[key] - return item ? item.label : '' - } const computedClass = computed(() => { - const key = returnIsUseing(props.data.status) - return key + return props.data.status }) - function returnIsUseing(key) { - // return key = key == 'using' ? (props.data.orderId ? key : 'idle') : key - return key + function returnStutasText(key) { + const item = uni.$dict.tableStatus[key] + return item ? item.label : '' } - + 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') diff --git a/pageTable/index/index.vue b/pageTable/index/index.vue index b9d531b..09a2497 100644 --- a/pageTable/index/index.vue +++ b/pageTable/index/index.vue @@ -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 diff --git a/pagesCreateOrder/choose-table/choose-table.vue b/pagesCreateOrder/choose-table/choose-table.vue index 81ac570..1f3d4c3 100644 --- a/pagesCreateOrder/choose-table/choose-table.vue +++ b/pagesCreateOrder/choose-table/choose-table.vue @@ -66,7 +66,6 @@