diff --git a/App.vue b/App.vue index bf7d71b..36d4327 100644 --- a/App.vue +++ b/App.vue @@ -6,13 +6,15 @@ App.vue本身不是页面,这里不能编写视图元素,也就是没有 { + + }); onLaunch(() => { let that = this uni.hideTabBar() diff --git a/commons/goodsData.js b/commons/goodsData.js index 213984c..018f06b 100644 --- a/commons/goodsData.js +++ b/commons/goodsData.js @@ -43,21 +43,35 @@ export const $invoicingType = [{ value: '' }, { - text: '供应商入库', - value: 'purveyor' + text: '手动入库', + value: 'manual-in' }, { - text: '供应商退货', - value: 'reject' + text: '手动出库', + value: 'manual-out' }, { - text: '其他入库', - value: 'purchase' + text: '盘盈入库', + value: 'win-in' }, { - text: '其他出库', + text: '盘亏出库', + value: 'loss-out' + }, + { + text: '订单退款入库', value: 'other-out' + }, + { + text: '订单消费出库', + value: 'order-out' + }, + { + text: '损耗出库', + value: 'damage-out' } + + ] // 页面常用数据 diff --git a/commons/utils/directive.js b/commons/utils/directive.js new file mode 100644 index 0000000..5ce4160 --- /dev/null +++ b/commons/utils/directive.js @@ -0,0 +1,19 @@ + +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/goodsUtil.js b/commons/utils/goodsUtil.js index c5134e6..17326b3 100644 --- a/commons/utils/goodsUtil.js +++ b/commons/utils/goodsUtil.js @@ -20,14 +20,10 @@ 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) + && (item.returnNum < item.num) } else { - let goodsList = [] let data = false; - Object.entries(orderInfo.detailMap).map(([key, value]) => ( - goodsList = [...goodsList,...value] - )) - goodsList.some((v,i)=>{ + uni.$utils.objToArrary(orderInfo.detailMap).some((v,i)=>{ 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 diff --git a/commons/utils/index.js b/commons/utils/index.js index 3747ede..64b2c33 100644 --- a/commons/utils/index.js +++ b/commons/utils/index.js @@ -16,10 +16,28 @@ export const utils = { * 限制金额输入格式 * @param {Object} e */ - isPrice (e) { - return e.replace(/[^0-9.]/g, '').replace(/\.{2,}/g, "").replace(/^\./, '') + isMoney (e) { + return e.toString().replace(/[^0-9.]/g, '').replace(/^\./g, "").replace(".", "$#$").replace(/\./g, "").replace("$#$", ".").replace(/^(\-)*(\d+)\.(\d{0,2}).*$/, "$1$2.$3") }, + /** + * 判断菜品使用价格 + * @param {Object} e + */ + isGoodsPrice(item,user) { + let isVip = uni.getStorageSync("shopInfo").isMemberPrice&&user.id&&user.isVip + + let memberPrice = item.memberPrice ? item.memberPrice : item.price; + let price = isVip ? memberPrice : item.price; + price = item.discountSaleAmount ? item.discountSaleAmount : price + return price; + }, + + inputReg(value,key,regName){ + //判断regList对象是否存在属性 避免报错 + // utils.hasOwnProperty.call(utils,regName)&&(form[key]=utils[regName](value)) + }, + /** * 金额保留两位小数 * @param {Object} e @@ -138,6 +156,27 @@ export const utils = { } } } - } + }, + + /** + * 对象转数组 + * @param {Object} e + */ + objToArrary (obj) { + + if (Object.values(obj) && Array.isArray(Object.values(obj)[0])){ + // 是数组 + let arr = [] + Object.values(obj).forEach(item=>{ + arr = [...arr,...item] + }) + return arr + } else { + // 不是数组 + return Object.keys(obj).map(key => obj[key]) + } + + }, + } \ No newline at end of file diff --git a/commons/utils/returrn-data.js b/commons/utils/returrn-data.js deleted file mode 100644 index 3619e8e..0000000 --- a/commons/utils/returrn-data.js +++ /dev/null @@ -1,7 +0,0 @@ -export const objToArrary = (obj,keyNewName) => { - return Object.entries(obj).map(([key, value]) => ({ - key, - [keyNewName]:key, - ...value, - })) -} \ No newline at end of file diff --git a/commons/utils/websocket.js b/commons/utils/websocket.js index 77f80db..d7bcb6e 100644 --- a/commons/utils/websocket.js +++ b/commons/utils/websocket.js @@ -68,7 +68,7 @@ class WebsocketUtil { } this.heartbeatInterval = setInterval(() => { if (this.isOpen) { - this.send(JSON.stringify({"type": "ping_interval"})); + this.send(JSON.stringify({"type": "ping_interval","set": "onboc"})); } }, this.time); } diff --git a/components/JPasswordInput/JPasswordInput.vue b/components/JPasswordInput/JPasswordInput.vue new file mode 100644 index 0000000..79ed923 --- /dev/null +++ b/components/JPasswordInput/JPasswordInput.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/components/my-components/edit-discount.vue b/components/my-components/edit-discount.vue index 730575c..c34851f 100644 --- a/components/my-components/edit-discount.vue +++ b/components/my-components/edit-discount.vue @@ -67,16 +67,18 @@ form.discount = (newval*100/form.price).toFixed(2) } function discountInput(newval){ - form.currentPrice=(form.price*newval/100).toFixed(2) + form.currentPrice= uni.$utils.isMoney(form.price*newval/100).toFixed(2) } function currentPriceChange(newval){ if(newval<0){ - form.currentPrice=0 + form.currentPrice = '0.00' form.discount=100 return infoBox.showToast('实收金额不能小于0') } - if(newval>props.price){ - form.currentPrice=props.price + console.log(props.price) + console.log(newval) + if(newval > props.price){ + form.currentPrice = (uni.$utils.isMoney(props.price)*1).toFixed(2) form.discount=0 return infoBox.showToast('实收金额不能大于应付金额') } @@ -95,7 +97,7 @@ } const $form = { - price:props.price, + price: props.price, currentPrice: props.price, discount: 100 } @@ -103,7 +105,7 @@ ...$form }) watch(()=>props.price,(newval)=>{ - form.price=newval + form.price = (newval*1).toFixed(2) form.currentPrice=newval }) function resetForm() { @@ -116,9 +118,10 @@ function open() { model.value.open() - form.price=props.price + form.price= (props.price*1).toFixed(2) form.discount=props.discount form.currentPrice=(props.discount*props.price/100).toFixed(2) + console.log(form) } function close() { diff --git a/components/my-components/my-upload-file.vue b/components/my-components/my-upload-file.vue index dae69c2..58597ab 100644 --- a/components/my-components/my-upload-file.vue +++ b/components/my-components/my-upload-file.vue @@ -63,9 +63,7 @@ function FileUploadselect(e) { for (let i in e.tempFiles) { const file = e.tempFiles[i] - console.log(e) uploadFile(file).then(res => { - console.log(res); imgList.value.push({ url: res, path: file.path @@ -104,7 +102,6 @@ } function change() { - console.log(getFileList()); emits('change', getFileList()) } defineExpose({ diff --git a/config/appConfig.js b/config/appConfig.js index 16e9d4c..007f281 100644 --- a/config/appConfig.js +++ b/config/appConfig.js @@ -10,7 +10,8 @@ const appConfig = { // 环境变量相关 env: {}, - wss: "wss://sockets.sxczgkj.com/wss", + // wss: "wss://sockets.sxczgkj.com/wss", //测试环境 + wss: "wss://czgeatws.sxczgkj.com/wss", //正式环境 // 环境变量常量 ENV_ENUM: { DEVELOPMENT: 'development', // 本地调试地址 diff --git a/http/api/product.js b/http/api/product.js index 372a92b..d7efd3c 100644 --- a/http/api/product.js +++ b/http/api/product.js @@ -139,6 +139,33 @@ export function productReportDamage(data, urlType = 'product') { }) } +/** + * 商品商品-修改库存 + * @returns + */ +export function productModifyStock(data, urlType = 'product') { + return request({ + url: `${urlType}/admin/product/modifyStock`, + method: "POST", + data: { + ...data + } + }) +} + +/** + * 商品-库存变动记录 + * @returns + */ +export function productStockFlow(data, urlType = 'product') { + return request({ + url: `${urlType}/admin/product/stockFlow`, + method: "GET", + data: { + ...data + } + }) +} // 商品分类---------------------------------------------------------------------------------------------------- /** diff --git a/http/http.js b/http/http.js index 829da32..48fdc28 100644 --- a/http/http.js +++ b/http/http.js @@ -22,13 +22,14 @@ import { reject } from 'lodash'; let baseUrl = '/api/' // #endif // #ifndef H5 -let baseUrl = 'https://tapi.cashier.sxczgkj.cn/' -// #endif +// let baseUrl = 'https://tapi.cashier.sxczgkj.cn/' //预发布 // let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn' //正式 -// let baseUrl = 'https://cashieradmin.sxczgkj.cn' +let baseUrl = 'https://cashier.sxczgkj.com/' +// #endif + const loadingShowTime = 200 diff --git a/main.js b/main.js index f26d7dc..f4c4311 100644 --- a/main.js +++ b/main.js @@ -4,6 +4,7 @@ import envConfig from '@/env/config.js' import appConfig from '@/config/appConfig.js' import storageManage from '@/commons/utils/storageManage.js' import {utils} from '@/commons/utils/index.js' +import {directive} from '@/commons/utils/directive.js' import uviewPlus from 'uview-plus' // 设置node环境 @@ -37,7 +38,9 @@ export function createApp() { uni.$appName = appConfig.appName app.config.globalProperties.$utils = utils uni.$utils = utils - + + // 全局注册指令 + app.directive('only-number', directive.vOnlyNumber); return { app } diff --git a/pageBwc/index/index.vue b/pageBwc/index/index.vue index 03eb092..2d308f2 100644 --- a/pageBwc/index/index.vue +++ b/pageBwc/index/index.vue @@ -7,7 +7,7 @@ 用户消费结账时,成功充值 - + 倍的金额本单即可享受免单 @@ -17,7 +17,10 @@ 订单支付金额需满 - + + + + 元,才能使用 @@ -44,7 +47,7 @@ - \ No newline at end of file diff --git a/pageConsumables/index.vue b/pageConsumables/index.vue index 62817eb..fdb51b5 100644 --- a/pageConsumables/index.vue +++ b/pageConsumables/index.vue @@ -1,27 +1,18 @@ diff --git a/pageProduct/index/components/control.vue b/pageProduct/index/components/control.vue index f26e667..441b87b 100644 --- a/pageProduct/index/components/control.vue +++ b/pageProduct/index/components/control.vue @@ -1,38 +1,13 @@ \ No newline at end of file diff --git a/pageProduct/invoicing-check/invoicing-check.vue b/pageProduct/invoicing-check/invoicing-check.vue deleted file mode 100644 index 7670be8..0000000 --- a/pageProduct/invoicing-check/invoicing-check.vue +++ /dev/null @@ -1,204 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pageProduct/invoicing-list/components/list-item.vue b/pageProduct/invoicing-list/components/list-item.vue index 50c0b9a..a25f5f5 100644 --- a/pageProduct/invoicing-list/components/list-item.vue +++ b/pageProduct/invoicing-list/components/list-item.vue @@ -2,37 +2,17 @@ - + - {{data.type}} + {{getTypeName(data.inOutItem)}} - {{data.productName}} - - - ID:{{data.id}} - + {{data.productName}} + ID:{{data.id}} - + 订单号 {{data.orderNo||''}} @@ -40,59 +20,41 @@ 库存 - {{data.leftNumber}} + {{data.beforeNumber}} - - {{data.leftNumber+data.stockNumber}} + + {{data.afterNumber}} - - 剩余库存 - {{data.leftNumber+data.stockNumber}}{{data.unitName}} + {{data.afterNumber}}{{data.unitName}} + + + 备注 + {{data.remark}} - {{data.stockNumber}} - {{data.stockNumber}} + {{data.inOutNumber}} + {{data.inOutNumber}} {{data.unitName}} - - - \ No newline at end of file diff --git a/pageTable/index/index.vue b/pageTable/index/index.vue index 1ebd844..b9d531b 100644 --- a/pageTable/index/index.vue +++ b/pageTable/index/index.vue @@ -6,9 +6,9 @@ - - {{status.list[status.active].label }} + + {{pageData.statusName }} - - - {{item.label}} - - - - - - - - @@ -74,38 +62,25 @@ 桌号:{{actionSheet.title}} - + diff --git a/pagesOrder/tuikuan/tuikuan.vue b/pagesOrder/tuikuan/tuikuan.vue index 01f9b0e..752f449 100644 --- a/pagesOrder/tuikuan/tuikuan.vue +++ b/pagesOrder/tuikuan/tuikuan.vue @@ -39,7 +39,7 @@ {{item.number}} - @@ -93,8 +93,9 @@ + :color="$utils.ColorMain"> + @@ -102,8 +103,8 @@