Compare commits
No commits in common. "8ead6c20021280328c3be54304c49de09ed97d10" and "60a96f7d1d6059f82b8c74c9e3f8c66b69af990b" have entirely different histories.
8ead6c2002
...
60a96f7d1d
|
@ -1,7 +0,0 @@
|
||||||
VITE_NOW_TYPE = 'dist'
|
|
||||||
|
|
||||||
# VITE_PUSH_URL = 'ws://192.168.1.22:8787'
|
|
||||||
# VITE_BASE_URL = 'http://192.168.1.22:8546'
|
|
||||||
|
|
||||||
VITE_PUSH_URL ='wss://erp.lihaink.cn/pull'
|
|
||||||
VITE_BASE_URL = 'https://erp.lihaink.cn'
|
|
|
@ -1,4 +0,0 @@
|
||||||
VITE_NOW_TYPE = 'build'
|
|
||||||
|
|
||||||
VITE_PUSH_URL ='wss://erp.lihaink.cn/pull'
|
|
||||||
VITE_BASE_URL = 'https://erp.lihaink.cn'
|
|
|
@ -1,24 +0,0 @@
|
||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
pnpm-debug.log*
|
|
||||||
lerna-debug.log*
|
|
||||||
|
|
||||||
node_modules
|
|
||||||
|
|
||||||
dist-ssr
|
|
||||||
*.local
|
|
||||||
|
|
||||||
# Editor directories and files
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/extensions.json
|
|
||||||
.idea
|
|
||||||
.DS_Store
|
|
||||||
*.suo
|
|
||||||
*.ntvs*
|
|
||||||
*.njsproj
|
|
||||||
*.sln
|
|
||||||
*.sw?
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"recommendations": ["Vue.volar"]
|
|
||||||
}
|
|
10
README.md
|
@ -1,9 +1,3 @@
|
||||||
# Vue 3 + TypeScript + Vite
|
# cashier-mer
|
||||||
|
|
||||||
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
多门店收银台
|
||||||
|
|
||||||
## Recommended Setup
|
|
||||||
|
|
||||||
- [VS Code](https://code.visualstudio.com/) + [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (previously Volar) and disable Vetur
|
|
||||||
|
|
||||||
- Use [vue-tsc](https://github.com/vuejs/language-tools/tree/master/packages/tsc) for performing the same type checking from the command line, or for generating d.ts files for SFCs.
|
|
|
@ -1 +0,0 @@
|
||||||
import{D as U,_ as I,u as R,r as u,o as S,b as a,c as b,h as B,e as w,f as e,w as t,v,g as C,B as L,C as E,P as K,E as d}from"./index-D1f-ww4d.js";function N(l){return U.post("/login/account",l)}const M=l=>(L("data-v-4397c91e"),l=l(),E(),l),T={class:"body"},q={class:"login"},D=M(()=>w("div",{class:"title"},"里海收银系统 - 登录",-1)),P={__name:"index",setup(l){const p=R(),h=K(),y=u(null),_=u(null),n=u({account:"",password:"",terminal:3,scene:1}),i=()=>{if(!n.value.account)return d({message:"请填写账号",type:"error"});if(!n.value.password)return d({message:"请填写密码",type:"error"});N(n.value).then(s=>{var o;if((o=s.data)!=null&&o.token){if(!s.data.merchant||!s.data.merchant.service_phone)return d.error("请先完善商户信息");p.setToken(s.data.token),p.setUserInfo(s.data),h.push("/")}}).catch(s=>{})};return S(()=>{}),(s,o)=>{const k=a("User"),f=a("el-icon"),m=a("el-input"),c=a("el-form-item"),g=a("Lock"),x=a("el-button"),V=a("el-form");return b(),B("div",T,[w("div",q,[D,e(V,null,{default:t(()=>[e(c,null,{default:t(()=>[e(m,{ref_key:"accRef",ref:y,modelValue:n.value.account,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value.account=r),placeholder:"请输入账号",autofocus:!0,onKeydown:o[1]||(o[1]=v(r=>_.value.focus(),["enter"]))},{prefix:t(()=>[e(f,null,{default:t(()=>[e(k)]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(c,null,{default:t(()=>[e(m,{ref_key:"pwdRef",ref:_,modelValue:n.value.password,"onUpdate:modelValue":o[2]||(o[2]=r=>n.value.password=r),type:"password",placeholder:"请输入密码","show-password":"",onKeydown:v(i,["enter"])},{prefix:t(()=>[e(f,null,{default:t(()=>[e(g)]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(c,null,{default:t(()=>[e(x,{style:{width:"100%"},type:"primary",onClick:i},{default:t(()=>[C("登录")]),_:1})]),_:1})]),_:1})])])}}},j=I(P,[["__scopeId","data-v-4397c91e"]]);export{j as default};
|
|
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.my-order[data-v-27ca906a]{border-radius:1.2rem;height:100%;background-color:#fff;width:30rem;position:relative;overflow:hidden}.my-order .header-nav[data-v-27ca906a]{display:flex;flex-direction:column;justify-content:space-between;padding:1rem;height:3.5rem}.my-order .header-nav span[data-v-27ca906a]{color:#ff4a00}.my-order .header-nav .nav-item[data-v-27ca906a]{font-weight:700}.my-order .header-nav .nav-item-btn[data-v-27ca906a]{display:flex;justify-content:space-between;align-items:center}.my-order .header-input[data-v-27ca906a]{padding:1rem;padding-top:0;height:2.5rem;border-bottom:.0625rem solid #eee}.my-order .order-lists[data-v-27ca906a]{height:calc(100vh - 16.45rem);overflow-y:auto}.my-order .order-lists .item[data-v-27ca906a]{padding:1rem;border-bottom:.0625rem solid #eee}.my-order .order-lists .item .top[data-v-27ca906a]{display:flex;justify-content:space-between;align-items:flex-end}.my-order .order-lists .item .top .sn[data-v-27ca906a]{font-weight:700;font-size:.9rem}.my-order .order-lists .item .top .cahier[data-v-27ca906a]:before{content:"收银";font-weight:400;font-size:.7rem;padding:.1rem;margin-right:.2rem;border:.0625rem solid #2ec479;color:#2ec479;border-radius:.187rem}.my-order .order-lists .item .top .cahier2[data-v-27ca906a]:before{content:"平台";font-weight:400;font-size:.7rem;padding:.1rem;margin-right:.2rem;border:.0625rem solid #ff4a00;color:#ff4a00;border-radius:.187rem}.my-order .order-lists .item .top .create-time[data-v-27ca906a]{font-size:.8rem}.my-order .order-lists .item .shop[data-v-27ca906a]{display:flex;justify-content:space-between}.my-order .order-lists .item .shop .right[data-v-27ca906a]{flex-shrink:0;display:flex;flex-direction:column;justify-content:center}.my-order .order-lists .item .shop .right .money[data-v-27ca906a]{font-size:1rem;color:#ff4a00;font-weight:700}.my-order .order-lists .item .shop .right .count[data-v-27ca906a]{font-size:.7rem;color:#999}.my-order .order-lists .item .shop .left[data-v-27ca906a]{height:4.5rem;display:flex;align-items:center}.my-order .order-lists .item .shop .left .shop-img[data-v-27ca906a]{width:3.5rem;height:3.5rem;border-radius:.3rem;margin-right:.4rem}.my-order .order-lists .item .shop .left .shop-name[data-v-27ca906a]{font-size:.9rem;color:#333;display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;-webkit-line-clamp:3}.my-order .order-lists .item .bottom[data-v-27ca906a]{display:flex;justify-content:space-between;font-size:.9rem;color:#777}.my-order .order-lists .item .bottom .manage-btn[data-v-27ca906a]{color:#fff;background-color:#e6a23c;border-radius:.2rem;padding:0 .2rem;margin-left:.5rem}.my-order .order-lists .item-active[data-v-27ca906a]{background-color:#efefef}.my-order .load-end[data-v-27ca906a]{text-align:center;padding:1rem;color:#333;font-size:.8rem}.my-order .bottom-btn-fiexd[data-v-27ca906a]{position:absolute;bottom:0;left:0;width:100%;box-sizing:border-box;border-top:.0625rem solid #eee;background-color:#fff;z-index:100;height:5.2rem;padding:1rem 1.5rem}.my-order .bottom-btn-fiexd .btn[data-v-27ca906a]{width:100%;height:100%;font-size:1.2rem;border-radius:3rem}.my-order[data-v-0317eb70]{border-radius:1.2rem;height:100%;flex:1;background-color:#fff;position:relative;overflow:hidden}.my-order .detail[data-v-0317eb70]{height:calc(100vh - 10.25rem);box-sizing:border-box;position:relative}.my-order .detail .table[data-v-0317eb70]{padding:1rem 1rem 6rem;overflow-y:auto;height:100%}.my-order .detail .table .table-title[data-v-0317eb70]{font-weight:700}.my-order .detail .table .addAddress[data-v-0317eb70]{margin-top:1rem;margin-bottom:1.5rem}.my-order .detail .table .table-info[data-v-0317eb70]{display:flex;flex-wrap:wrap;color:#777;font-size:.9rem;padding-bottom:1rem;margin-bottom:1rem;border-bottom:.0625rem solid #eee}.my-order .detail .table .table-info[data-v-0317eb70]:last-child{border-bottom:none}.my-order .detail .table .table-info .info-item[data-v-0317eb70]{width:33%;display:flex;padding-top:1rem}.my-order .detail .table .table-info .info-item .info-item-title[data-v-0317eb70]{flex-shrink:0;padding-right:1rem}.my-card{display:flex}::-webkit-scrollbar{width:.315rem}::-webkit-scrollbar-track{background-color:#f1f1f1}::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:.315rem}::-webkit-scrollbar-thumb:hover{background-color:#999}
|
|
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.my-order[data-v-fa3e0699]{border-radius:1.2rem;height:100%;background-color:#fff;width:30rem;position:relative;overflow:hidden}.my-order .header-nav[data-v-fa3e0699]{display:flex;flex-direction:column;justify-content:space-between;padding:1rem;height:3.5rem}.my-order .header-nav span[data-v-fa3e0699]{color:#ff4a00}.my-order .header-nav .nav-item[data-v-fa3e0699]{font-weight:700}.my-order .header-nav .nav-item-btn[data-v-fa3e0699]{display:flex;justify-content:space-between;align-items:center}.my-order .header-input[data-v-fa3e0699]{padding:1rem;padding-top:0;height:2.5rem;border-bottom:.0625rem solid #eee}.my-order .order-lists[data-v-fa3e0699]{height:calc(100vh - 16.45rem);overflow-y:auto}.my-order .order-lists .item[data-v-fa3e0699]{padding:1rem;border-bottom:.0625rem solid #eee}.my-order .order-lists .item .top[data-v-fa3e0699]{display:flex;justify-content:space-between;align-items:flex-end}.my-order .order-lists .item .top .sn[data-v-fa3e0699]{font-weight:700;font-size:.9rem}.my-order .order-lists .item .top .cahier[data-v-fa3e0699]:before{content:"收银";font-weight:400;font-size:.7rem;padding:.1rem;margin-right:.2rem;border:.0625rem solid #2ec479;color:#2ec479;border-radius:.187rem}.my-order .order-lists .item .top .cahier2[data-v-fa3e0699]:before{content:"平台";font-weight:400;font-size:.7rem;padding:.1rem;margin-right:.2rem;border:.0625rem solid #ff4a00;color:#ff4a00;border-radius:.187rem}.my-order .order-lists .item .top .create-time[data-v-fa3e0699]{font-size:.8rem}.my-order .order-lists .item .shop[data-v-fa3e0699]{display:flex;justify-content:space-between}.my-order .order-lists .item .shop .right[data-v-fa3e0699]{flex-shrink:0;display:flex;flex-direction:column;justify-content:center}.my-order .order-lists .item .shop .right .money[data-v-fa3e0699]{font-size:1rem;color:#ff4a00;font-weight:700}.my-order .order-lists .item .shop .right .count[data-v-fa3e0699]{font-size:.7rem;color:#999}.my-order .order-lists .item .shop .left[data-v-fa3e0699]{display:flex;align-items:center;font-size:.8rem}.my-order .order-lists .item .bottom[data-v-fa3e0699]{display:flex;justify-content:space-between;font-size:.9rem;color:#777}.my-order .order-lists .item .bottom .manage-btn[data-v-fa3e0699]{color:#fff;background-color:#e6a23c;border-radius:.2rem;padding:0 .2rem;margin-left:.5rem}.my-order .order-lists .item-active[data-v-fa3e0699]{background-color:#efefef}.my-order .load-end[data-v-fa3e0699]{text-align:center;padding:1rem;color:#333;font-size:.8rem}.my-order .bottom-btn-fiexd[data-v-fa3e0699]{position:absolute;bottom:0;left:0;width:100%;box-sizing:border-box;border-top:.0625rem solid #eee;background-color:#fff;z-index:100;height:5.2rem;padding:1rem 1.5rem}.my-order .bottom-btn-fiexd .btn[data-v-fa3e0699]{width:100%;height:100%;font-size:1.2rem;border-radius:3rem}.el-drawer__header{margin-bottom:0}.el-drawer__body{padding-top:0}.dra-body[data-v-928e3cd0]{width:100%;height:100%}.dra-body .detail[data-v-928e3cd0]{height:100%;box-sizing:border-box;position:relative}.dra-body .detail .table[data-v-928e3cd0]{padding-bottom:1rem;overflow-y:auto;height:100%}.dra-body .detail .table .table-title[data-v-928e3cd0]{font-weight:700}.dra-body .detail .table .addAddress[data-v-928e3cd0]{margin-top:1rem;margin-bottom:1.5rem}.dra-body .detail .table .table-info[data-v-928e3cd0]{display:flex;flex-wrap:wrap;color:#777;font-size:.9rem;padding-bottom:1rem;margin-bottom:1rem;border-bottom:.0625rem solid #eee}.dra-body .detail .table .table-info[data-v-928e3cd0]:last-child{border-bottom:none}.dra-body .detail .table .table-info .info-item[data-v-928e3cd0]{width:33%;display:flex;padding-top:1rem}.dra-body .detail .table .table-info .info-item .info-item-title[data-v-928e3cd0]{flex-shrink:0;padding-right:1rem}.my-order[data-v-7bc9887f]{border-radius:1.2rem;height:100%;flex:1;background-color:#fff;position:relative;overflow:hidden}.my-order .detail[data-v-7bc9887f]{height:calc(100vh - 10.25rem);box-sizing:border-box;position:relative}.my-order .detail .table[data-v-7bc9887f]{padding:1rem 1rem 6rem;overflow-y:auto;height:100%}.my-order .detail .table .table-title[data-v-7bc9887f]{font-weight:700}.my-order .detail .table .addAddress[data-v-7bc9887f]{margin-top:1rem;margin-bottom:1.5rem}.my-order .detail .table .table-info[data-v-7bc9887f]{display:flex;flex-wrap:wrap;color:#777;font-size:.9rem;padding-bottom:1rem;margin-bottom:1rem;border-bottom:.0625rem solid #eee}.my-order .detail .table .table-info[data-v-7bc9887f]:last-child{border-bottom:none}.my-order .detail .table .table-info .info-item[data-v-7bc9887f]{width:33%;display:flex;padding-top:1rem}.my-order .detail .table .table-info .info-item .info-item-title[data-v-7bc9887f]{flex-shrink:0;padding-right:1rem}.my-card{display:flex}::-webkit-scrollbar{width:.315rem}::-webkit-scrollbar-track{background-color:#f1f1f1}::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:.315rem}::-webkit-scrollbar-thumb:hover{background-color:#999}
|
|
|
@ -1 +0,0 @@
|
||||||
import{b as t,c,h as a,e,f as o,w as d,g as l}from"./index-D1f-ww4d.js";const r={style:{width:"100vw",height:"100vh"}},_={style:{display:"flex","justify-content":"center","padding-top":"20vh"}},m={style:{display:"flex","flex-direction":"column","justify-content":"center","padding-left":"3rem"}},h=e("div",{style:{"font-size":"5rem","font-weight":"bold"}},"404",-1),p=e("div",{style:{"padding-bottom":"1rem"}},"您的页面没有找到",-1),v={__name:"index",setup(f){const s=()=>{window.location="/"};return(y,g)=>{const n=t("el-image"),i=t("el-button");return c(),a("div",r,[e("div",_,[o(n,{loading:"lazy",style:{width:"30rem",height:"20rem"},src:"/src/assets/icon-404-color.svg"}),e("div",m,[h,p,o(i,{type:"primary",onClick:s},{default:d(()=>[l("返回首页")]),_:1})])])])}}};export{v as default};
|
|
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.my-order[data-v-e01d9d71]{border-radius:1.2rem;height:100%;background-color:#fff;width:30rem;position:relative;overflow:hidden;display:flex;flex-direction:column}.my-order .header-nav[data-v-e01d9d71]{display:flex;flex-direction:column;justify-content:space-between;padding:1rem;height:7.5rem}.my-order .header-nav .nav-item[data-v-e01d9d71]{font-weight:700}.my-order .header-nav .nav-body .my-money[data-v-e01d9d71]{padding:.4rem 0;height:4rem}.my-order .header-nav .nav-body .my-money span[data-v-e01d9d71]{font-size:1.5rem;font-weight:700}.my-order .header-nav .nav-body .my-count[data-v-e01d9d71]{height:1.4rem;display:flex;justify-content:space-between;color:#777}.my-order .order-lists[data-v-e01d9d71]{flex:1;overflow-y:auto}.my-order .order-lists .item[data-v-e01d9d71]{padding:1rem;border-bottom:.0625rem solid #eee}.my-order .order-lists .item .own[data-v-e01d9d71]{font-size:.7rem;padding:.1rem .2rem;background-color:#2ec479;color:#fff;margin-left:1rem;border-radius:.2rem}.my-order .order-lists .item-active[data-v-e01d9d71]{background-color:#efefef}.my-order .order-footer[data-v-e01d9d71]{position:absolute;bottom:0;left:0;width:100%;box-shadow:0 -.0625rem .625rem #eee;background-color:#fff}.my-order .order-footer .input-btn[data-v-e01d9d71]{display:flex;padding:1rem 1.5rem;padding-bottom:0}.my-order .order-footer .input-btn .btn[data-v-e01d9d71]{margin-left:1rem}.my-order .order-footer .order-btn[data-v-e01d9d71]{height:3.2rem;padding:1rem 1.5rem}.my-order .order-footer .order-btn .btn[data-v-e01d9d71]{width:100%;height:100%;font-size:1.2rem;border-radius:3rem}input[data-v-e01d9d71]::-webkit-outer-spin-button,input[data-v-e01d9d71]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.my-order[data-v-129102fe]{border-radius:1.2rem;height:100%;flex:1;background-color:#fff;position:relative;overflow:hidden}.my-order .date[data-v-129102fe]{padding:1rem 1rem 0;display:flex;justify-content:space-between}.my-order .detail[data-v-129102fe]{height:calc(100vh - 10.25rem);box-sizing:border-box;position:relative}.my-order .detail .table[data-v-129102fe]{padding:1rem 1rem 6rem;overflow-y:auto;height:100%}.my-order .detail .table .table-title[data-v-129102fe]{font-weight:700}.my-order .detail .table .table-info[data-v-129102fe]{display:flex;flex-wrap:wrap;color:#777;font-size:.9rem;padding-bottom:1rem;margin-bottom:1rem;border-bottom:.0625rem solid #eee}.my-order .detail .table .table-info[data-v-129102fe]:last-child{border-bottom:none}.my-order .detail .table .table-info .info-item[data-v-129102fe]{width:33%;display:flex;padding-top:1rem}.my-order .detail .table .table-info .info-item .info-item-title[data-v-129102fe]{flex-shrink:0;padding-right:1rem}.my-card{display:flex}::-webkit-scrollbar{width:.315rem}::-webkit-scrollbar-track{background-color:#f1f1f1}::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:.315rem}::-webkit-scrollbar-thumb:hover{background-color:#999}
|
|
|
@ -1 +0,0 @@
|
||||||
.body[data-v-4397c91e]{width:100vw;height:100vh;box-sizing:border-box;background-image:url(https://lihai001.oss-cn-chengdu.aliyuncs.com/def/b84ef202404101425077785.png);background-size:100% 100%;background-repeat:no-repeat;display:flex;justify-content:center;align-items:center}.body .login[data-v-4397c91e]{width:18rem;background-color:#fff;border-radius:2rem;padding:2rem 3rem}.body .login .title[data-v-4397c91e]{text-align:center;font-size:1.3rem;padding-bottom:2rem;color:#333}
|
|
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.my-order[data-v-9d0ec279]{border-radius:1.2rem;height:100%;background-color:#fff;width:30rem;position:relative;overflow:hidden}.my-order .header-nav[data-v-9d0ec279]{display:flex;flex-direction:column;justify-content:space-between;padding:1rem;height:3.5rem}.my-order .header-nav span[data-v-9d0ec279]{color:#ff4a00}.my-order .header-nav .nav-item[data-v-9d0ec279]{font-weight:700}.my-order .header-nav .nav-item-btn[data-v-9d0ec279]{display:flex;justify-content:space-between;align-items:center}.my-order .header-input[data-v-9d0ec279]{padding:1rem;padding-top:0;height:2.5rem;border-bottom:.0625rem solid #eee}.my-order .order-lists[data-v-9d0ec279]{height:calc(100vh - 16.45rem);overflow-y:auto}.my-order .order-lists .item[data-v-9d0ec279]{padding:1rem;border-bottom:.0625rem solid #eee}.my-order .order-lists .item .top[data-v-9d0ec279]{display:flex;justify-content:space-between;align-items:flex-end}.my-order .order-lists .item .top .sn[data-v-9d0ec279]{font-weight:700;font-size:.9rem}.my-order .order-lists .item .top .cahier[data-v-9d0ec279]:before{content:"收银";font-weight:400;font-size:.7rem;padding:.1rem;margin-right:.2rem;border:.0625rem solid #2ec479;color:#2ec479;border-radius:.187rem}.my-order .order-lists .item .top .cahier2[data-v-9d0ec279]:before{content:"平台";font-weight:400;font-size:.7rem;padding:.1rem;margin-right:.2rem;border:.0625rem solid #ff4a00;color:#ff4a00;border-radius:.187rem}.my-order .order-lists .item .top .create-time[data-v-9d0ec279]{font-size:.8rem}.my-order .order-lists .item .shop[data-v-9d0ec279]{display:flex;justify-content:space-between}.my-order .order-lists .item .shop .right[data-v-9d0ec279]{flex-shrink:0;display:flex;flex-direction:column;justify-content:center}.my-order .order-lists .item .shop .right .money[data-v-9d0ec279]{font-size:1rem;color:#ff4a00;font-weight:700}.my-order .order-lists .item .shop .right .count[data-v-9d0ec279]{font-size:.7rem;color:#999}.my-order .order-lists .item .shop .left[data-v-9d0ec279]{height:4.5rem;display:flex;align-items:center}.my-order .order-lists .item .shop .left .shop-img[data-v-9d0ec279]{width:3.5rem;height:3.5rem;border-radius:.3rem;margin-right:.4rem}.my-order .order-lists .item .shop .left .shop-name[data-v-9d0ec279]{font-size:.9rem;color:#333;display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;-webkit-line-clamp:3}.my-order .order-lists .item .bottom[data-v-9d0ec279]{display:flex;justify-content:space-between;font-size:.9rem;color:#777}.my-order .order-lists .item .bottom .manage-btn[data-v-9d0ec279]{color:#fff;background-color:#e6a23c;border-radius:.2rem;padding:0 .2rem;margin-left:.5rem}.my-order .order-lists .item-active[data-v-9d0ec279]{background-color:#efefef}.my-order .load-end[data-v-9d0ec279]{text-align:center;padding:1rem;color:#333;font-size:.8rem}.my-order[data-v-4e281875]{border-radius:1.2rem;height:100%;flex:1;background-color:#fff;position:relative;overflow:hidden}.my-order .detail[data-v-4e281875]{height:calc(100vh - 10.25rem);box-sizing:border-box;position:relative}.my-order .detail .table[data-v-4e281875]{padding:1rem 1rem 6rem;overflow-y:auto;height:100%}.my-order .detail .table .table-title[data-v-4e281875]{font-weight:700}.my-order .detail .table .table-info[data-v-4e281875]{display:flex;flex-wrap:wrap;color:#777;font-size:.9rem;padding-bottom:1rem;margin-bottom:1rem;border-bottom:.0625rem solid #eee}.my-order .detail .table .table-info[data-v-4e281875]:last-child{border-bottom:none}.my-order .detail .table .table-info .info-item[data-v-4e281875]{width:33%;display:flex;padding-top:1rem}.my-order .detail .table .table-info .info-item .info-item-title[data-v-4e281875]{flex-shrink:0;padding-right:1rem}.my-card{display:flex}::-webkit-scrollbar{width:.315rem}::-webkit-scrollbar-track{background-color:#f1f1f1}::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:.315rem}::-webkit-scrollbar-thumb:hover{background-color:#999}
|
|
|
@ -1 +0,0 @@
|
||||||
import{f as i}from"./merchant-BH28HDnN.js";import{_ as d,r as a,b as l,s as p,z as m,c as u,h,e as f,f as e,w as v}from"./index-D1f-ww4d.js";const b={"element-loading-text":"加载中",class:"my-order"},g={class:"table"},x={__name:"indexCount",setup(w){const o=a([]),n=a({page_no:1,page_size:15}),r=a(!1);return(()=>{i(n.value).then(s=>{o.value=s.data.lists})})(),(s,B)=>{const t=l("el-table-column"),c=l("el-table"),_=p("loading");return m((u(),h("div",b,[f("div",g,[e(c,{data:o.value,style:{width:"100%"}},{default:v(()=>[e(t,{prop:"record_date",label:"时间",width:"260"}),e(t,{prop:"cashier_cash_total_amount",label:"现金收银金额(元)"}),e(t,{prop:"cashier_total_amount",label:"线上收银金额(元)"}),e(t,{prop:"platofrm_total_amount",label:"平台订单金额(元)"}),e(t,{prop:"total_amount",label:"总金额(元)"})]),_:1},8,["data"])])])),[[_,r.value]])}}},y=d(x,[["__scopeId","data-v-d25755c6"]]);export{y as default};
|
|
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.my-order[data-v-d25755c6]{box-sizing:border-box}.my-order .from[data-v-d25755c6]{width:100%;padding-bottom:1.25rem;display:grid;grid-template-columns:repeat(5,1fr);gap:1.25rem}.my-order .from .form-card[data-v-d25755c6]{border-radius:.8rem;height:5rem;background-color:#fff;font-size:1.3rem;font-weight:700;display:flex;flex-direction:column;justify-content:center;align-items:center}.my-order .from .form-card .tips[data-v-d25755c6]{font-size:.9rem;color:#999;font-weight:400}.my-order .from .red[data-v-d25755c6]{color:#ff4a00}.my-order .from .green[data-v-d25755c6]{color:#01c86f}.my-order .table[data-v-d25755c6]{background-color:#fff;border-radius:1.2rem;box-sizing:border-box;padding:1rem;overflow-y:scroll}[data-v-d25755c6]::-webkit-scrollbar{width:.315rem}[data-v-d25755c6]::-webkit-scrollbar-track{background-color:#f1f1f1;margin:1.25rem 0}[data-v-d25755c6]::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:.315rem}[data-v-d25755c6]::-webkit-scrollbar-thumb:hover{background-color:#999}
|
|
|
@ -1 +0,0 @@
|
||||||
import{D as a}from"./index-D1f-ww4d.js";function i(){return a.get("/merchant/Merchant/amount_account")}function r(n){return a.get("/merchant/Merchant/taking_lists",{params:n})}function c(){return a.get("/merchant/Merchant/taking_info")}function e(n){return a.post("/merchant/Merchant/withdraw",n)}function o(n){return a.get("/financial/FinancialRecord/lists",{params:n})}function s(n){return a.get("/financial/FinancialRecord/api_lists",{params:n})}export{i as a,c as b,e as c,r as d,s as e,o as f};
|
|
|
@ -1 +0,0 @@
|
||||||
import{_ as e,c as t,h as c}from"./index-D1f-ww4d.js";const n={},o={style:{width:"1rem",height:"100%"}};function r(s,_){return t(),c("div",o)}const i=e(n,[["render",r]]);export{i as p};
|
|
|
@ -1 +0,0 @@
|
||||||
.dra-body[data-v-6269680d]{width:100%;display:flex;flex-direction:column;align-items:center;text-align:center}.dra-body .header[data-v-6269680d]{width:25rem;display:flex}.dra-body .header>div[data-v-6269680d]{flex:1;border:.0625rem solid #ccc;text-align:center;padding:.6rem 0;cursor:pointer}.dra-body .header .left[data-v-6269680d]{border-right:none;border-radius:5rem 0 0 5rem}.dra-body .header .right[data-v-6269680d]{border-left:none;border-radius:0 5rem 5rem 0}.dra-body .header .active[data-v-6269680d]{background-color:#1890ff;color:#fff;transition:.3s;border-color:#1890ff}.dra-body .card1 .code-input[data-v-6269680d]{width:100%;height:3rem}.dra-body .card1 .tips[data-v-6269680d]{width:38rem;height:16rem;background:url(./pay-De0xbdxm.png);background-size:100% 100%;background-repeat:no-repeat}.cancel-btn[data-v-6269680d]{width:60%;border-color:#1890ff;color:#1890ff;border-radius:5rem;height:3rem;font-size:1.2rem}.drawer-body[data-v-6269680d]{width:100%;overflow-x:hidden}.counter[data-v-6269680d]{padding:1.25rem;border-radius:1.25rem;background-color:#f3f9ff}.counter .received[data-v-6269680d]{height:3rem;padding:0 1.25rem;border:.0625rem solid #1890ff;box-shadow:0 0 .18rem #1890ff;border-radius:.5rem;background-color:#fff;font-size:1.62rem;line-height:3rem;color:#333}.counter .balance[data-v-6269680d]{width:100%;box-sizing:border-box;padding:1.12rem 0 1.12rem .625rem;text-align:start;font-size:.95rem;color:#303133;display:flex;justify-content:space-between}.counter .balance .money[data-v-6269680d]{color:#ff4a00}.counter .balance .tips[data-v-6269680d]{font-size:.8rem;color:#999}.counter .keypad[data-v-6269680d]{display:grid;grid-template-columns:auto auto auto auto;grid-gap:.625rem}.counter .keypad .left[data-v-6269680d]{grid-column-end:span 3;display:grid;grid-template-columns:auto auto auto;grid-gap:.625rem}.counter .keypad .right[data-v-6269680d]{display:grid;grid-template-columns:auto;grid-gap:.625rem}.counter .keypad .el-button[data-v-6269680d]{height:3.875rem;width:8.125rem;margin:0!important;border:0;border-radius:.5rem;font-weight:500;font-size:1.75rem!important;line-height:3.87rem;color:#1890ff}.counter .keypad .el-button[data-v-6269680d]:focus{box-shadow:none}.counter .keypad .enter[data-v-6269680d]{grid-row-end:span 4;height:8.37rem;line-height:8.37rem;background-color:#1890ff;font-weight:500;font-size:1.35rem!important;color:#fff;position:relative}.counter .keypad .enter-disable[data-v-6269680d]{background-color:#ccc}
|
|
Before Width: | Height: | Size: 215 KiB |
|
@ -1 +0,0 @@
|
||||||
#receipt{padding:.625rem .625rem 1.25rem;font-size:.75rem;border:.0625rem solid #ccc;width:12.5rem}
|
|
|
@ -1 +0,0 @@
|
||||||
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31.92 32"><defs><style>.cls-1{fill:#333;fill-opacity:0;}.cls-2,.cls-3{fill:#1890ff;fill-rule:evenodd;isolation:isolate;}.cls-2{opacity:0.8;}</style></defs><title>cashier</title><rect class="cls-1" width="31.92" height="32"/><path class="cls-2" d="M23,12.36,12.28,23.11c-4.83,4.83,2.47,12.13,7.3,7.31L30.33,19.66C35.16,14.83,27.86,7.53,23,12.36Z"/><path class="cls-2" d="M19.64,23.11,8.89,12.36c-4.83-4.83-12.13,2.47-7.31,7.3L12.34,30.42c4.83,4.82,12.13-2.48,7.3-7.31Z"/><path class="cls-3" d="M20.58,11.16,16,15.79l-4.62-4.63a6.21,6.21,0,0,1,0-9.13A6.71,6.71,0,0,1,16,0C20.94.06,25.22,6.52,20.58,11.16Z"/></svg>
|
|
Before Width: | Height: | Size: 699 B |
|
@ -1,65 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="./cashier.svg" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>里海收银系统</title>
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"
|
|
||||||
></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
document.addEventListener("UniAppJSBridgeReady", function () {});
|
|
||||||
function receiveData(data) {
|
|
||||||
try {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data.type === "connect") {
|
|
||||||
window.postMessage(data);
|
|
||||||
}
|
|
||||||
} catch (error) {}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
/* 小屏幕 */
|
|
||||||
@media screen and (max-width: 576px) {
|
|
||||||
html {
|
|
||||||
font-size: 0.625rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 中等屏幕 */
|
|
||||||
@media screen and (min-width: 577px) and (max-width: 992px) {
|
|
||||||
html {
|
|
||||||
font-size: 0.625rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 大屏幕 */
|
|
||||||
@media screen and (min-width: 993px) and (max-width: 1336px) {
|
|
||||||
html {
|
|
||||||
font-size: 0.875rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 大屏幕 */
|
|
||||||
@media screen and (min-width: 1336px) and (max-width: 1900px) {
|
|
||||||
html {
|
|
||||||
font-size: 0.9375rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* 大屏幕 */
|
|
||||||
@media screen and (min-width: 1900px) {
|
|
||||||
html {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script type="module" crossorigin src="./assets/index-D1f-ww4d.js"></script>
|
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-B7YDDoo1.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1 +0,0 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
Before Width: | Height: | Size: 1.5 KiB |
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.my-order[data-v-afd5b49f]{border-radius:1.2rem;height:100%;background-color:#fff;width:30rem;position:relative;overflow:hidden}.my-order .header-nav[data-v-afd5b49f]{display:flex;flex-direction:column;justify-content:space-between;padding:1rem;height:3.5rem}.my-order .header-nav span[data-v-afd5b49f]{color:#ff4a00}.my-order .header-nav .nav-item[data-v-afd5b49f]{font-weight:700}.my-order .header-nav .nav-item-btn[data-v-afd5b49f]{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center}.my-order .header-input[data-v-afd5b49f]{padding:1rem;padding-top:0;height:2.5rem;border-bottom:.0625rem solid #eee}.my-order .order-list[data-v-afd5b49f]{height:calc(100vh - 16.45rem);overflow-y:auto}.my-order .order-list .item[data-v-afd5b49f]{padding:1rem;border-bottom:.0625rem solid #eee}.my-order .order-list .item .top[data-v-afd5b49f]{display:flex;justify-content:space-between;align-items:flex-end}.my-order .order-list .item .top .sn[data-v-afd5b49f]{font-weight:700;font-size:.9rem}.my-order .order-list .item .top .cahier[data-v-afd5b49f]:before{content:"收银";font-weight:400;font-size:.7rem;padding:.1rem;margin-right:.2rem;border:.0625rem solid #2ec479;color:#2ec479;border-radius:.187rem}.my-order .order-list .item .top .cahier2[data-v-afd5b49f]:before{content:"平台";font-weight:400;font-size:.7rem;padding:.1rem;margin-right:.2rem;border:.0625rem solid #ff4a00;color:#ff4a00;border-radius:.187rem}.my-order .order-list .item .top .create-time[data-v-afd5b49f]{font-size:.8rem}.my-order .order-list .item .shop[data-v-afd5b49f]{display:flex;justify-content:space-between}.my-order .order-list .item .shop .right[data-v-afd5b49f]{flex-shrink:0;display:flex;flex-direction:column;justify-content:center}.my-order .order-list .item .shop .right .money[data-v-afd5b49f]{font-size:1rem;color:#ff4a00;font-weight:700}.my-order .order-list .item .shop .right .count[data-v-afd5b49f]{font-size:.7rem;color:#999}.my-order .order-list .item .shop .left[data-v-afd5b49f]{height:4.5rem;display:flex;align-items:center}.my-order .order-list .item .shop .left .shop-img[data-v-afd5b49f]{width:3.5rem;height:3.5rem;border-radius:.3rem;margin-right:.4rem}.my-order .order-list .item .shop .left .shop-name[data-v-afd5b49f]{font-size:.9rem;color:#333;display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;-webkit-line-clamp:3}.my-order .order-list .item .bottom[data-v-afd5b49f]{display:flex;justify-content:space-between;font-size:.9rem;color:#777}.my-order .order-list .item-active[data-v-afd5b49f]{background-color:#efefef}.my-order .load-end[data-v-afd5b49f]{text-align:center;padding:1rem;color:#333;font-size:.8rem}.my-order-no-system .header-nav[data-v-afd5b49f]{height:5.5rem}.my-order-no-system .order-list[data-v-afd5b49f]{height:calc(100vh - 18.45rem)}.my-order[data-v-e6e9d4a9]{border-radius:1.2rem;height:100%;flex:1;background-color:#fff;position:relative;overflow:hidden}.my-order .header-nav[data-v-e6e9d4a9]{display:flex;background:linear-gradient(to bottom,#f5f5f5 50%,#fff 50%)}.my-order .header-nav .nav-item[data-v-e6e9d4a9]{height:4rem;width:8rem;cursor:pointer;display:flex;justify-content:center;align-items:center;font-size:1.2rem;background-color:#f5f5f5;border-radius:1rem 1rem 0 0}.my-order .header-nav .nav-item-active[data-v-e6e9d4a9]{background-color:#fff;position:relative;transition:.3s}.my-order .header-nav .nav-item-radius1[data-v-e6e9d4a9]{border-radius:0 0 1rem}.my-order .header-nav .nav-item-radius2[data-v-e6e9d4a9]{border-radius:0 0 0 1rem}.my-order .detail[data-v-e6e9d4a9]{height:calc(100vh - 10.25rem);box-sizing:border-box;position:relative}.my-order .detail .table[data-v-e6e9d4a9]{padding:1rem 1rem 6rem}.my-order .detail .table .table-title[data-v-e6e9d4a9]{font-weight:700;padding-top:1rem}.my-order .detail .table .table-info[data-v-e6e9d4a9]{display:flex;flex-wrap:wrap;color:#777;font-size:.9rem;padding-bottom:2rem;border-bottom:.0625rem solid #eee}.my-order .detail .table .table-info[data-v-e6e9d4a9]:last-child{border-bottom:none}.my-order .detail .table .table-info .info-item[data-v-e6e9d4a9]{width:33%;display:flex;padding-top:1rem}.my-order .detail .table .table-info .info-item .info-item-title[data-v-e6e9d4a9]{flex-shrink:0;padding-right:1rem}.my-order .detail .footer[data-v-e6e9d4a9]{height:6rem;box-sizing:border-box;padding:0 1.5rem;position:absolute;bottom:0;left:0;width:100%;box-shadow:0 -.0625rem .625rem #eee;display:flex;justify-content:space-between;align-items:center;background-color:#fff}.my-order .detail .footer .info[data-v-e6e9d4a9]{display:flex;align-items:flex-end}.my-order .detail .footer .info .ser[data-v-e6e9d4a9]{font-weight:700;margin-right:1rem}.my-order .detail .footer .info .price[data-v-e6e9d4a9]{margin-right:1rem}.my-order .detail .footer .info .price span[data-v-e6e9d4a9]{color:#ff4a00;font-size:1.2rem;font-weight:700}.my-order .detail .footer .handle .btn[data-v-e6e9d4a9]{border-radius:4rem;padding:1.2rem}
|
|
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.my-card{display:flex}::-webkit-scrollbar{width:.315rem}::-webkit-scrollbar-track{background-color:#f1f1f1}::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:.315rem}::-webkit-scrollbar-thumb:hover{background-color:#999}
|
|
|
@ -1 +0,0 @@
|
||||||
import{_ as U,u as I,r as u,o as L,b as n,c as R,h as S,e as w,f as e,w as t,k as v,g as b,v as K,x as B,A as C,E as d,K as E,L as N}from"./index-3-t8Fk7s.js";const M=l=>(K("data-v-59a7e82c"),l=l(),B(),l),T={class:"body"},A={class:"login"},$=M(()=>w("div",{class:"title"},"里海收银系统 - 登录",-1)),j={__name:"index",setup(l){const p=I(),y=C(),h=u(null),_=u(null),s=u({account:"",password:"",key:"",captchaVerification:"",code:""}),i=()=>{if(!s.value.account)return d({message:"请填写账号",type:"error"});if(!s.value.password)return d({message:"请填写密码",type:"error"});E(s.value).then(a=>{console.log(a),a.data&&(p.setToken(a.data.token),N().then(({data:o})=>{if(!o.service)return d({message:"请联系管理员开通服务",type:"error"});p.setUserInfo(o),y.push("/")}))}).catch(a=>{})};return L(()=>{}),(a,o)=>{const k=n("User"),f=n("el-icon"),m=n("el-input"),c=n("el-form-item"),g=n("Lock"),x=n("el-button"),V=n("el-form");return R(),S("div",T,[w("div",A,[$,e(V,null,{default:t(()=>[e(c,null,{default:t(()=>[e(m,{ref_key:"accRef",ref:h,modelValue:s.value.account,"onUpdate:modelValue":o[0]||(o[0]=r=>s.value.account=r),placeholder:"请输入账号",autofocus:!0,onKeydown:o[1]||(o[1]=v(r=>_.value.focus(),["enter"]))},{prefix:t(()=>[e(f,null,{default:t(()=>[e(k)]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(c,null,{default:t(()=>[e(m,{ref_key:"pwdRef",ref:_,modelValue:s.value.password,"onUpdate:modelValue":o[2]||(o[2]=r=>s.value.password=r),type:"password",placeholder:"请输入密码","show-password":"",onKeydown:v(i,["enter"])},{prefix:t(()=>[e(f,null,{default:t(()=>[e(g)]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(c,null,{default:t(()=>[e(x,{style:{width:"100%"},type:"primary",onClick:i},{default:t(()=>[b("登录")]),_:1})]),_:1})]),_:1})])])}}},z=U(j,[["__scopeId","data-v-59a7e82c"]]);export{z as default};
|
|
|
@ -1 +0,0 @@
|
||||||
import{o as r,d as o}from"./detail-SSwoB7VG.js";import{p as t}from"./padding-DTyMU7Be.js";import{c as a,h as s,f as e}from"./index-3-t8Fk7s.js";import"./pay.vue_vue_type_style_index_0_scoped_7f298acd_lang-BaAcCNPN.js";import"./moment-Cl4UOzQZ.js";import"./pay-Bt7FIL7i.js";const i={class:"my-card"},h={__name:"index",setup(c){return(d,l)=>(a(),s("div",i,[e(r,{style:{"flex-shrink":"0"},ref:"orderRef"},null,512),e(t),e(o,{ref:"detailRef"},null,512)]))}};export{h as default};
|
|
|
@ -1 +0,0 @@
|
||||||
.body[data-v-59a7e82c]{width:100vw;height:100vh;box-sizing:border-box;background-image:url(https://lihai001.oss-cn-chengdu.aliyuncs.com/def/b84ef202404101425077785.png);background-size:100% 100%;background-repeat:no-repeat;display:flex;justify-content:center;align-items:center}.body .login[data-v-59a7e82c]{width:18rem;background-color:#fff;border-radius:2rem;padding:2rem 3rem}.body .login .title[data-v-59a7e82c]{text-align:center;font-size:1.3rem;padding-bottom:2rem}
|
|
|
@ -1 +0,0 @@
|
||||||
import{b as t,c,h as a,e,f as o,w as d,g as l}from"./index-3-t8Fk7s.js";const r={style:{width:"100vw",height:"100vh"}},_={style:{display:"flex","justify-content":"center","padding-top":"20vh"}},m={style:{display:"flex","flex-direction":"column","justify-content":"center","padding-left":"3rem"}},h=e("div",{style:{"font-size":"5rem","font-weight":"bold"}},"404",-1),p=e("div",{style:{"padding-bottom":"1rem"}},"您的页面没有找到",-1),v={__name:"index",setup(f){const s=()=>{window.location="/"};return(y,g)=>{const n=t("el-image"),i=t("el-button");return c(),a("div",r,[e("div",_,[o(n,{loading:"lazy",style:{width:"30rem",height:"20rem"},src:"/src/assets/icon-404-color.svg"}),e("div",m,[h,p,o(i,{type:"primary",onClick:s},{default:d(()=>[l("返回首页")]),_:1})])])])}}};export{v as default};
|
|
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.dra-body[data-v-4a30c70d]{width:100%;display:flex;flex-direction:column;text-align:center}[data-v-4a30c70d] .el-upload--picture-card{--el-upload-picture-card-size: 3.75rem !important}[data-v-4a30c70d] .el-upload-list--picture-card .el-upload-list__item{height:3.75rem!important;width:3.75rem!important}.my-shop[data-v-22d63487]{background-color:#fff;border-radius:1.2rem;box-sizing:border-box;padding:1rem;overflow-y:scroll}[data-v-22d63487]::-webkit-scrollbar{width:.315rem}[data-v-22d63487]::-webkit-scrollbar-track{background-color:#f1f1f1;margin:1.25rem 0}[data-v-22d63487]::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:.315rem}[data-v-22d63487]::-webkit-scrollbar-thumb:hover{background-color:#999}.el-menu--horizontal[data-v-22d63487]{height:2.5rem}.el-form--inline .el-form-item[data-v-22d63487]{margin-right:1rem}
|
|
|
@ -1 +0,0 @@
|
||||||
import{h as S,i as Y}from"./pay.vue_vue_type_style_index_0_scoped_7f298acd_lang-BaAcCNPN.js";import{_ as w,u as P,r as o,b as h,j as k,q as N,c as f,h as b,e as t,t as d,s as D,f as r,w as x,g as F,v as M,x as V,A as j}from"./index-3-t8Fk7s.js";import{h as n}from"./moment-Cl4UOzQZ.js";const v=l=>(M("data-v-266c9d86"),l=l(),V(),l),q={"element-loading-text":"加载中",class:"my-order"},A={key:0,class:"from"},B={class:"form-card"},L=v(()=>t("div",{class:"tips"},"今日收银 平台+线上+现金 总金额",-1)),T={class:"form-card"},O=v(()=>t("div",{class:"tips"},"昨日收银 平台+线上+现金 总金额",-1)),E={class:"form-card"},R=v(()=>t("div",{class:"tips"},"本月收银 平台+线上+现金 总金额",-1)),U={class:"table"},z={__name:"indexCount",setup(l){const c=P(),m=o([]),g=j();o(1),o(null);const C=o({page:1,limit:15,staff_id:c.userInfo.service.service_id}),_=o(!1);o(0),(()=>{S(c.userInfo.service.mer_id,C.value).then(s=>{m.value=s.data})})();const a=o({});(()=>{_.value=!0,Y(c.userInfo.service.mer_id,{staff_id:c.userInfo.service.service_id}).then(s=>{a.value=s.data.data,_.value=!1})})();const I=(s,p)=>{let e="",i={};Number(n(s.day).format("MM"))>Number(n().format("MM"))?e=n().format("YYYY")-1+"-"+s.day.split("-").join("-"):e=n().format("YYYY")+"-"+s.day.split("-").join("-"),i.date=e,p.no==2&&(i.payType=1),p.no==3&&(i.payType=2),g.push({path:"order",query:i})};return(s,p)=>{const e=h("el-table-column"),i=h("el-table"),u=k("loading");return N((f(),b("div",q,[a.value.today?(f(),b("div",A,[t("div",B,[t("div",null,d((a.value.today.cashPayment+a.value.today.payPrice).toFixed(2)),1),L]),t("div",T,[t("div",null,d((a.value.yesterday.cashPayment+a.value.yesterday.payPrice).toFixed(2)),1),O]),t("div",E,[t("div",null,d((a.value.month.cashPayment+a.value.month.payPrice).toFixed(2)),1),R])])):D("",!0),t("div",U,[r(i,{data:m.value,style:{width:"100%"},onCellClick:I},{default:x(()=>[r(e,{prop:"day",label:"日期",width:"260"}),r(e,{prop:"total",label:"订单数量"}),r(e,{prop:"cash_payment",label:"现金收银金额"}),r(e,{prop:"cash_registe",label:"线上收银金额"}),r(e,{prop:"pay_price",label:"平台交易额"}),r(e,{label:"总金额"},{default:x(y=>[F(d(((+y.row.pay_price||0)+(+y.row.cash_payment||0)).toFixed(2)),1)]),_:1})]),_:1},8,["data"])])])),[[u,_.value]])}}},W=w(z,[["__scopeId","data-v-266c9d86"]]);export{W as default};
|
|
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.my-order[data-v-266c9d86]{box-sizing:border-box}.my-order .from[data-v-266c9d86]{width:100%;padding-bottom:1.25rem;display:grid;grid-template-columns:repeat(3,1fr);gap:1.25rem}.my-order .from .form-card[data-v-266c9d86]{border-radius:.8rem;height:5rem;background-color:#fff;font-size:1.3rem;font-weight:700;display:flex;flex-direction:column;justify-content:center;align-items:center}.my-order .from .form-card .tips[data-v-266c9d86]{font-size:.9rem;color:#999;font-weight:400}.my-order .from .red[data-v-266c9d86]{color:#ff4a00}.my-order .from .green[data-v-266c9d86]{color:#01c86f}.my-order .table[data-v-266c9d86]{background-color:#fff;border-radius:1.2rem;box-sizing:border-box;padding:1rem;overflow-y:scroll;cursor:pointer}[data-v-266c9d86]::-webkit-scrollbar{width:.315rem}[data-v-266c9d86]::-webkit-scrollbar-track{background-color:#f1f1f1;margin:1.25rem 0}[data-v-266c9d86]::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:.315rem}[data-v-266c9d86]::-webkit-scrollbar-thumb:hover{background-color:#999}
|
|
|
@ -1 +0,0 @@
|
||||||
@charset "UTF-8";.my-order[data-v-3c901223]{background-color:#fff;border-radius:1.2rem;box-sizing:border-box;padding:1rem;overflow-y:scroll}[data-v-3c901223]::-webkit-scrollbar{width:.315rem}[data-v-3c901223]::-webkit-scrollbar-track{background-color:#f1f1f1;margin:1.25rem 0}[data-v-3c901223]::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:.315rem}[data-v-3c901223]::-webkit-scrollbar-thumb:hover{background-color:#999}
|
|
|
@ -1 +0,0 @@
|
||||||
import{e as F,a as G,g as J,f as K}from"./pay.vue_vue_type_style_index_0_scoped_7f298acd_lang-BaAcCNPN.js";import{_ as Q,u as W,r as s,b as d,j as X,q as Y,c,h as m,f as t,w as o,g as r,t as Z,e as P,d as I,A as ee,E as h,v as te,x as ae}from"./index-3-t8Fk7s.js";import{p as oe}from"./pay-Bt7FIL7i.js";const le=v=>(te("data-v-3c901223"),v=v(),ae(),v),se={"element-loading-text":"加载中",class:"my-order"},ne={key:0},re={key:1,style:{color:"#ff4a00"}},ie={key:0},de={key:1,class:"flex"},ce=le(()=>P("span",null,"提单前请清空购物车, 避免提单的商品与购物车商品混合, 请确保购物车内无数据后再进行提单",-1)),ue={class:"dialog-footer"},pe={__name:"indexList",setup(v){const k=W(),C=s([]),b=ee(),g=s(1),f=s(null),n=s({page:1,limit:20}),y=s(!1),w=s(0),i=()=>{y.value=!0,g.value==1&&(n.value.paid=null),g.value==2&&(n.value.paid=0),F(k.userInfo.service.mer_id,n.value).then(e=>{C.value=e.data.list,w.value=e.data.count,y.value=!1})};i();const x=s(0);(()=>{G({staff_id:k.userInfo.service.service_id}).then(e=>{var a;x.value=(a=e.data.list)==null?void 0:a.length})})();const A=e=>{n.value.page=1,i()},B=e=>{n.value.page=e,i()},D=e=>{n.value.page=e,i()},N=e=>{n.value.page=e,i()},R=()=>{i()},$=e=>{f.value.setRePay({price:e.pay_price,order_id:e.group_order_id}),f.value.drawer=!0},E=e=>{J({order_sn:e}).then(a=>{a.data.paid==1||a.message=="支付成功"?(h({message:a.message,type:"success"}),i()):h({message:a.message,type:"error"})}).catch(a=>{})},L=s(""),U=()=>{_.value=!1,K({order_sn:L.value}).then(e=>{h({message:e.message,type:"success"}),b.push({name:"home"})})},_=s(!1),z=e=>{L.value=e,_.value=!0},O=()=>{b.push({name:"home"})};return(e,a)=>{const S=d("el-radio-button"),T=d("el-radio-group"),u=d("el-table-column"),p=d("el-button"),j=d("el-table"),q=d("el-pagination"),H=d("el-dialog"),M=X("loading");return Y((c(),m("div",se,[t(T,{modelValue:g.value,"onUpdate:modelValue":a[0]||(a[0]=l=>g.value=l),style:{"margin-bottom":"30px"},onChange:A},{default:o(()=>[t(S,{value:1},{default:o(()=>[r("全部")]),_:1}),t(S,{value:2},{default:o(()=>[r("未支付")]),_:1})]),_:1},8,["modelValue"]),t(j,{data:C.value,style:{width:"100%"}},{default:o(()=>[t(u,{prop:"group_order_id",label:"ID",width:"100"}),t(u,{prop:"order_sn",label:"订单号",width:"260"}),t(u,{prop:"total_price",label:"订单金额"}),t(u,{prop:"paid",label:"支付状态"},{default:o(l=>[l.row.paid==1?(c(),m("span",ne,"已支付")):(c(),m("span",re,"未支付"))]),_:1}),t(u,{prop:"create_time",label:"订单创建时间"}),t(u,{prop:"pay_time",label:"订单支付时间"},{default:o(l=>[l.row.pay_time?(c(),m("span",ie,Z(l.row.pay_time),1)):(c(),m("div",de,[t(p,{type:"primary",link:"",onClick:V=>$(l.row)},{default:o(()=>[r("重新支付")]),_:2},1032,["onClick"]),t(p,{type:"primary",link:"",onClick:V=>E(l.row.order_sn)},{default:o(()=>[r("检测状态")]),_:2},1032,["onClick"]),t(p,{type:"primary",link:"",onClick:V=>z(l.row.order_sn)},{default:o(()=>[r("提单")]),_:2},1032,["onClick"])]))]),_:1})]),_:1},8,["data"]),t(q,{"page-size":n.value.limit,layout:"prev, pager, next",total:w.value,onPrevClick:B,onNextClick:D,onCurrentChange:N},null,8,["page-size","total"]),t(oe,{ref_key:"payRef",ref:f,onPaySuccess:R},null,512),t(H,{modelValue:_.value,"onUpdate:modelValue":a[2]||(a[2]=l=>_.value=l),title:"提示",width:"500"},{footer:o(()=>[P("div",ue,[t(p,{onClick:a[1]||(a[1]=l=>_.value=!1)},{default:o(()=>[r("取消")]),_:1}),x.value>0?(c(),I(p,{key:0,onClick:O},{default:o(()=>[r(" 前去清空购物车 ")]),_:1})):(c(),I(p,{key:1,type:"primary",onClick:U},{default:o(()=>[r(" 确认提单 ")]),_:1}))])]),default:o(()=>[ce]),_:1},8,["modelValue"])])),[[M,y.value]])}}},fe=Q(pe,[["__scopeId","data-v-3c901223"]]);export{fe as default};
|
|
|
@ -1 +0,0 @@
|
||||||
import{o as r,d as t}from"./detail-SSwoB7VG.js";import{p as o}from"./padding-DTyMU7Be.js";import{c as s,h as a,f as e}from"./index-3-t8Fk7s.js";import"./pay.vue_vue_type_style_index_0_scoped_7f298acd_lang-BaAcCNPN.js";import"./moment-Cl4UOzQZ.js";import"./pay-Bt7FIL7i.js";const i={class:"my-card"},h={__name:"indexSystem",setup(m){return(c,d)=>(s(),a("div",i,[e(r,{style:{"flex-shrink":"0"},ref:"orderRef",isSystem:""},null,512),e(o),e(t,{ref:"detailRef"},null,512)]))}};export{h as default};
|
|
|
@ -1 +0,0 @@
|
||||||
import{_ as e,c as t,h as c}from"./index-3-t8Fk7s.js";const n={},o={style:{width:"1rem",height:"100%"}};function r(s,_){return t(),c("div",o)}const i=e(n,[["render",r]]);export{i as p};
|
|
|
@ -1 +0,0 @@
|
||||||
.dra-body[data-v-7f298acd]{width:100%;display:flex;flex-direction:column;align-items:center;text-align:center}.dra-body .header[data-v-7f298acd]{width:25rem;display:flex}.dra-body .header>div[data-v-7f298acd]{flex:1;border:.0625rem solid #ccc;text-align:center;padding:.6rem 0;cursor:pointer}.dra-body .header .left[data-v-7f298acd]{border-right:none;border-radius:5rem 0 0 5rem}.dra-body .header .right[data-v-7f298acd]{border-left:none;border-radius:0 5rem 5rem 0}.dra-body .header .active[data-v-7f298acd]{background-color:#1890ff;color:#fff;transition:.3s;border-color:#1890ff}.dra-body .card1 .code-input[data-v-7f298acd]{width:100%;height:3rem}.dra-body .card1 .tips[data-v-7f298acd]{width:38rem;height:16rem;background:url(./pay-De0xbdxm.png);background-size:100% 100%;background-repeat:no-repeat}.cancel-btn[data-v-7f298acd]{width:60%;border-color:#1890ff;color:#1890ff;border-radius:5rem;height:3rem;font-size:1.2rem}.drawer-body[data-v-7f298acd]{width:100%;overflow-x:hidden}.counter[data-v-7f298acd]{padding:1.25rem;border-radius:1.25rem;background-color:#f3f9ff}.counter .received[data-v-7f298acd]{height:3rem;padding:0 1.25rem;border:.0625rem solid #1890ff;box-shadow:0 0 .18rem #1890ff;border-radius:.5rem;background-color:#fff;font-size:1.62rem;line-height:3rem;color:#333}.counter .balance[data-v-7f298acd]{width:100%;box-sizing:border-box;padding:1.12rem 0 1.12rem .625rem;text-align:start;font-size:.95rem;color:#303133;display:flex;justify-content:space-between}.counter .balance .money[data-v-7f298acd]{color:#ff4a00}.counter .balance .tips[data-v-7f298acd]{font-size:.8rem;color:#999}.counter .keypad[data-v-7f298acd]{display:grid;grid-template-columns:auto auto auto auto;grid-gap:.625rem}.counter .keypad .left[data-v-7f298acd]{grid-column-end:span 3;display:grid;grid-template-columns:auto auto auto;grid-gap:.625rem}.counter .keypad .right[data-v-7f298acd]{display:grid;grid-template-columns:auto;grid-gap:.625rem}.counter .keypad .el-button[data-v-7f298acd]{height:3.875rem;width:8.125rem;margin:0!important;border:0;border-radius:.5rem;font-weight:500;font-size:1.75rem!important;line-height:3.87rem;color:#1890ff}.counter .keypad .el-button[data-v-7f298acd]:focus{box-shadow:none}.counter .keypad .enter[data-v-7f298acd]{grid-row-end:span 4;height:8.37rem;line-height:8.37rem;background-color:#1890ff;font-weight:500;font-size:1.35rem!important;color:#fff;position:relative}.counter .keypad .enter-disable[data-v-7f298acd]{background-color:#ccc}
|
|
Before Width: | Height: | Size: 215 KiB |
|
@ -1 +0,0 @@
|
||||||
import{G as t}from"./index-3-t8Fk7s.js";function n(r){return t.post("user/cart/create",r)}function s(r){return t.get("user/cart/lst",{params:r})}function o(r,e){return t.post(`user/cart/change/${r}`,e)}function u(r){return t.post("v2/order/check",r)}function c(r){return t.post("user/cart/delete",r)}function p(r){return t.post("v2/order/create",r)}function d(r,e){return t.post(`order/pay/${r}`,e)}function f(r){return t.get("micropay_query",{params:r})}function A(r,e){return t.get(`admin/${r}/order_list`,{params:e})}function m(r,e){return t.get(`verifier/${r}/order/${e}`)}function g(r){return t.get("order_lading",{params:r})}function $(r,e,i){return t.post(`verifier/${r}/${e}`,i)}function l(r,e){return t.get(`admin/${r}/statistics`,{params:e})}function v(r,e){return t.get(`admin/${r}/order_price`,{params:e})}function h(r,e){return t.get("order/list",{params:e})}export{s as a,o as b,c,n as d,A as e,g as f,f as g,v as h,l as i,$ as j,p as k,d as l,u as o,h as s,m as v};
|
|
|
@ -1 +0,0 @@
|
||||||
import{G as e}from"./index-3-t8Fk7s.js";function u(t,r){return e.get(`server/${t}/product/lst`,{params:r})}function p(t,r){return e.get(`store/product/detail/${t}`,{params:r})}function o(t,r){return e.post(`user_free_trial/${t}`,r)}function n(t,r){return e.get(`server/${t}/product/title`,{params:r})}function i(t,r,s){return e.post(`server/${t}/product/status/${r}`,s)}function c(t,r){return e.get(`server/${t}/category/list`,{params:r})}function d(t,r){return e.post(`server/${t}/product/create`,r)}function f(t,r,s){return e.post(`server/${t}/product/update/${r}`,s)}function g(t,r,s){return e.get(`server/${t}/product/detail/${r}`,{params:s})}function l(t){return e.get("product/spu/lst",{params:t})}function $(t,r){return e.get(`store/merchant/category/lst/${t}`,{params:r})}export{l as a,d as b,c,f as d,n as e,i as f,p as g,$ as m,g as p,u as s,o as u};
|
|
|
@ -1 +0,0 @@
|
||||||
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31.92 32"><defs><style>.cls-1{fill:#333;fill-opacity:0;}.cls-2,.cls-3{fill:#1890ff;fill-rule:evenodd;isolation:isolate;}.cls-2{opacity:0.8;}</style></defs><title>cashier</title><rect class="cls-1" width="31.92" height="32"/><path class="cls-2" d="M23,12.36,12.28,23.11c-4.83,4.83,2.47,12.13,7.3,7.31L30.33,19.66C35.16,14.83,27.86,7.53,23,12.36Z"/><path class="cls-2" d="M19.64,23.11,8.89,12.36c-4.83-4.83-12.13,2.47-7.31,7.3L12.34,30.42c4.83,4.82,12.13-2.48,7.3-7.31Z"/><path class="cls-3" d="M20.58,11.16,16,15.79l-4.62-4.63a6.21,6.21,0,0,1,0-9.13A6.71,6.71,0,0,1,16,0C20.94.06,25.22,6.52,20.58,11.16Z"/></svg>
|
|
Before Width: | Height: | Size: 699 B |
|
@ -1,49 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="./cashier.svg" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>里海收银系统</title>
|
|
||||||
<style>
|
|
||||||
/* 小屏幕 */
|
|
||||||
@media screen and (max-width: 576px) {
|
|
||||||
html {
|
|
||||||
font-size: 0.625rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 中等屏幕 */
|
|
||||||
@media screen and (min-width: 577px) and (max-width: 992px) {
|
|
||||||
html {
|
|
||||||
font-size: 0.625rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 大屏幕 */
|
|
||||||
@media screen and (min-width: 993px) and (max-width: 1336px) {
|
|
||||||
html {
|
|
||||||
font-size: 0.6875rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 大屏幕 */
|
|
||||||
@media screen and (min-width: 1336px) and (max-width: 1900px) {
|
|
||||||
html {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* 大屏幕 */
|
|
||||||
@media screen and (min-width: 1900px){
|
|
||||||
html {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script type="module" crossorigin src="./assets/index-3-t8Fk7s.js"></script>
|
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-BbwxVKIL.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1 +0,0 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
Before Width: | Height: | Size: 1.5 KiB |
64
index.html
|
@ -1,64 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="/cashier.svg" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>里海收银系统</title>
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"
|
|
||||||
></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
document.addEventListener("UniAppJSBridgeReady", function () {});
|
|
||||||
function receiveData(data) {
|
|
||||||
try {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data.type === "connect") {
|
|
||||||
window.postMessage(data);
|
|
||||||
}
|
|
||||||
} catch (error) {}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
/* 小屏幕 */
|
|
||||||
@media screen and (max-width: 576px) {
|
|
||||||
html {
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 中等屏幕 */
|
|
||||||
@media screen and (min-width: 577px) and (max-width: 992px) {
|
|
||||||
html {
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 大屏幕 */
|
|
||||||
@media screen and (min-width: 993px) and (max-width: 1336px) {
|
|
||||||
html {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 大屏幕 */
|
|
||||||
@media screen and (min-width: 1336px) and (max-width: 1900px) {
|
|
||||||
html {
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* 大屏幕 */
|
|
||||||
@media screen and (min-width: 1900px) {
|
|
||||||
html {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
<script type="module" src="/src/main.ts"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
32
package.json
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
"name": "cashier",
|
|
||||||
"private": true,
|
|
||||||
"version": "0.0.0",
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"dev": "vite",
|
|
||||||
"build": "vue-tsc && vite build --mode development",
|
|
||||||
"build:prod": "vue-tsc && vite build",
|
|
||||||
"preview": "vite preview"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
|
||||||
"axios": "^1.6.8",
|
|
||||||
"element-plus": "^2.6.3",
|
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"mitt": "^3.0.1",
|
|
||||||
"moment": "^2.30.1",
|
|
||||||
"pinia": "^2.1.7",
|
|
||||||
"print-js": "^1.6.0",
|
|
||||||
"sass": "^1.72.0",
|
|
||||||
"vue": "^3.4.21",
|
|
||||||
"vue-router": "^4.3.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@vitejs/plugin-vue": "^5.0.4",
|
|
||||||
"postcss-pxtorem": "^6.1.0",
|
|
||||||
"typescript": "^5.2.2",
|
|
||||||
"vite": "^5.2.0",
|
|
||||||
"vue-tsc": "^2.0.6"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
plugins: {
|
|
||||||
'postcss-pxtorem': {
|
|
||||||
rootValue: 16, // 设计稿宽度的 1/10
|
|
||||||
propList: ['*'], // 转换所有属性的px值
|
|
||||||
// selectorBlackList: ['html'], // 排除html选择器
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1 +0,0 @@
|
||||||
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31.92 32"><defs><style>.cls-1{fill:#333;fill-opacity:0;}.cls-2,.cls-3{fill:#1890ff;fill-rule:evenodd;isolation:isolate;}.cls-2{opacity:0.8;}</style></defs><title>cashier</title><rect class="cls-1" width="31.92" height="32"/><path class="cls-2" d="M23,12.36,12.28,23.11c-4.83,4.83,2.47,12.13,7.3,7.31L30.33,19.66C35.16,14.83,27.86,7.53,23,12.36Z"/><path class="cls-2" d="M19.64,23.11,8.89,12.36c-4.83-4.83-12.13,2.47-7.31,7.3L12.34,30.42c4.83,4.82,12.13-2.48,7.3-7.31Z"/><path class="cls-3" d="M20.58,11.16,16,15.79l-4.62-4.63a6.21,6.21,0,0,1,0-9.13A6.71,6.71,0,0,1,16,0C20.94.06,25.22,6.52,20.58,11.16Z"/></svg>
|
|
Before Width: | Height: | Size: 699 B |
|
@ -1 +0,0 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
Before Width: | Height: | Size: 1.5 KiB |
29
src/App.vue
|
@ -1,29 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { onMounted } from "vue";
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
document.body.style.setProperty("--el-color-primary", "#1890ff");
|
|
||||||
document.body.style.setProperty("--el-upload-picture-card-size", "60px");
|
|
||||||
document.body.style.setProperty("--el-upload-list-picture-card-size", "60px");
|
|
||||||
});
|
|
||||||
const screenWidth = window.innerWidth;
|
|
||||||
console.log("当前屏幕宽度:", screenWidth);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<router-view />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.el-button:focus {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 取消input的上下箭头
|
|
||||||
input::-webkit-outer-spin-button,
|
|
||||||
input::-webkit-inner-spin-button {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,46 +0,0 @@
|
||||||
import request from '@/utils/axios.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 获取余额和银行信息
|
|
||||||
*/
|
|
||||||
export function amountAccountApi() {
|
|
||||||
return request.get(`/merchant/Merchant/amount_account`)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 提现列表
|
|
||||||
*/
|
|
||||||
export function amountTakingListsApi(data) {
|
|
||||||
return request.get(`/merchant/Merchant/taking_lists`, {params: data})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 提现总次数和金额
|
|
||||||
*/
|
|
||||||
export function amountTakingInfoApi() {
|
|
||||||
return request.get(`/merchant/Merchant/taking_info`)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 提现操作
|
|
||||||
*/
|
|
||||||
export function amountWithdrawApi(data) {
|
|
||||||
return request.post(`/merchant/Merchant/withdraw`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 7日订单统计
|
|
||||||
*/
|
|
||||||
export function financialRecordApi(data) {
|
|
||||||
return request.get(`/financial/FinancialRecord/lists`, {params: data})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 余额明细
|
|
||||||
*/
|
|
||||||
export function financialRecordListsApi(data) {
|
|
||||||
return request.get(`/financial/FinancialRecord/api_lists`, {params: data})
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
import request from '@/utils/axios.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 商品列表
|
|
||||||
*/
|
|
||||||
export function storeListApi(id, data) {
|
|
||||||
return request.get(`server/${id}/product/lst`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 商品详情
|
|
||||||
*/
|
|
||||||
export function getAttrValue(id, data) {
|
|
||||||
return request.get(`store/product/detail/${id}`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 免审编辑
|
|
||||||
*/
|
|
||||||
export function userFreeTrialApi(id, data) {
|
|
||||||
return request.post(`user_free_trial/${id}`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 商品状态分类数量
|
|
||||||
*/
|
|
||||||
export function productTitleApi(id, data) {
|
|
||||||
return request.get(`server/${id}/product/title`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 上下架
|
|
||||||
*/
|
|
||||||
export function productStatusApi(mer_id, id, data) {
|
|
||||||
return request.post(`server/${mer_id}/product/status/${id}`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 平台分类
|
|
||||||
*/
|
|
||||||
export function categoryListApi(mer_id, data) {
|
|
||||||
return request.get(`server/${mer_id}/category/list`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 添加商品
|
|
||||||
*/
|
|
||||||
export function productCreateApi(mer_id, data) {
|
|
||||||
return request.post(`server/${mer_id}/product/create`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 编辑商品
|
|
||||||
*/
|
|
||||||
export function productUpdateApi(mer_id, id, data) {
|
|
||||||
return request.post(`server/${mer_id}/product/update/${id}`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 商品详情
|
|
||||||
*/
|
|
||||||
export function productDetailApi(mer_id, id, data) {
|
|
||||||
return request.get(`server/${mer_id}/product/detail/${id}`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 批发商品列表
|
|
||||||
*/
|
|
||||||
export function saleStoreListApi(data) {
|
|
||||||
return request.get(`/goods/goods/mer_list`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 店铺商品分类
|
|
||||||
*/
|
|
||||||
export function merchantCategoryListApi(data) {
|
|
||||||
return request.get(`goods/goodsclass/lists`, { params: data })
|
|
||||||
}
|
|
157
src/api/store.js
|
@ -1,157 +0,0 @@
|
||||||
import request from '@/utils/axios.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 加入购物车
|
|
||||||
*/
|
|
||||||
export function cartCreateApi(data) {
|
|
||||||
return request.post(`/order/cart/create`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 购物列表
|
|
||||||
*/
|
|
||||||
export function cartListApi(data) {
|
|
||||||
return request.get(`/order/cart/list`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 编辑购物车数据
|
|
||||||
*/
|
|
||||||
export function cartChangeApi(id, data) {
|
|
||||||
return request.post(`user/cart/change/${id}`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 结算
|
|
||||||
*/
|
|
||||||
export function orderCheckApi(data) {
|
|
||||||
return request.post(`/order/RetailOrder/checkOrder`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 删除商品
|
|
||||||
*/
|
|
||||||
export function cartDeleteApi(data) {
|
|
||||||
return request.post(`/order/cart/delete`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 支付
|
|
||||||
*/
|
|
||||||
export function orderCreateApi(data) {
|
|
||||||
return request.post(`/order/RetailOrder/createOrder`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 重新支付
|
|
||||||
*/
|
|
||||||
export function orderPayApi(id, data) {
|
|
||||||
return request.post(`order/pay/${id}`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 订单状态
|
|
||||||
*/
|
|
||||||
export function orderStatusApi(data) {
|
|
||||||
return request.get(`micropay_query`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 订单列表
|
|
||||||
*/
|
|
||||||
export function orderListApi(data) {
|
|
||||||
return request.get(`/order/retailOrder/merchant_order_list`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 核销订单列表
|
|
||||||
*/
|
|
||||||
export function verifierOrderListApi(id, code) {
|
|
||||||
return request.get(`verifier/${id}/order/${code}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 未支付订单列表
|
|
||||||
*/
|
|
||||||
export function groupOrderListApi(id, data) {
|
|
||||||
return request.get(`admin/${id}/group_order_list`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 提单
|
|
||||||
*/
|
|
||||||
export function orderLadingApi(data) {
|
|
||||||
return request.get(`order_lading`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 核销
|
|
||||||
*/
|
|
||||||
export function verifierApi(mer_id, id, data) {
|
|
||||||
return request.post(`verifier/${mer_id}/${id}`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 统计
|
|
||||||
*/
|
|
||||||
export function statisticsApi(mer_id, data) {
|
|
||||||
return request.get(`admin/${mer_id}/statistics`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 统计列表
|
|
||||||
*/
|
|
||||||
export function orderPriceApi(mer_id, data) {
|
|
||||||
return request.get(`admin/${mer_id}/order_price`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 收银订单列表
|
|
||||||
*/
|
|
||||||
export function saleOrderListApi(data) {
|
|
||||||
return request.get(`/order/retailOrder/order_list`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 采购订单提交
|
|
||||||
*/
|
|
||||||
export function createOrderApi(data) {
|
|
||||||
return request.post(`/order/OpurchaseOrder/createOrder`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 订单商品列表
|
|
||||||
*/
|
|
||||||
export function cashierinfoListApi(data) {
|
|
||||||
return request.get(`/order/cashierinfo/lists`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 商户给用户添加地址
|
|
||||||
*/
|
|
||||||
export function merchantCreateApi(data) {
|
|
||||||
return request.post(`/user/address/merchant_create`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 采购订单记录列表
|
|
||||||
*/
|
|
||||||
export function opurchaseOrderApi(data) {
|
|
||||||
return request.get(`/order/OpurchaseOrder/lists`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 采购订单子订单列表
|
|
||||||
*/
|
|
||||||
export function subOrdersListApi(data) {
|
|
||||||
return request.get(`/order/OpurchaseOrder/sub_orders`, { params: data })
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 摊贩订单数量统计
|
|
||||||
*/
|
|
||||||
export function merchantOrderCountApi(data) {
|
|
||||||
return request.get(`/order/retailOrder/merchant_order_count`, { params: data })
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
import request from '@/utils/axios.js'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 验证码
|
|
||||||
*/
|
|
||||||
export function captchaApi() {
|
|
||||||
return request.get(`captcha`)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @description 登录
|
|
||||||
*/
|
|
||||||
export function login(data) {
|
|
||||||
return request.post(`/login/account`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 信息
|
|
||||||
*/
|
|
||||||
export function info(data) {
|
|
||||||
return request.get(`user`, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 退出登录
|
|
||||||
*/
|
|
||||||
export function logout() {
|
|
||||||
return request.post(`logout`)
|
|
||||||
}
|
|
|
@ -1,66 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg width="859px" height="586px" viewBox="0 0 859 586" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<!-- Generator: Sketch 54 (76480) - https://sketchapp.com -->
|
|
||||||
<title>500-彩色-01</title>
|
|
||||||
<desc>Created with Sketch.</desc>
|
|
||||||
<g id="页面1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
||||||
<g id="500-彩色-01" transform="translate(-1.000000, -1.000000)">
|
|
||||||
<g id="图层_2" transform="translate(1.000000, 1.000000)">
|
|
||||||
<ellipse id="椭圆形" fill="#E7F4FE" fill-rule="nonzero" cx="452" cy="344" rx="406.2" ry="241.1"></ellipse>
|
|
||||||
<g id="编组" transform="translate(646.000000, 401.000000)" fill="#96CEF7" fill-rule="nonzero">
|
|
||||||
<path d="M20.7,9.5 L20.7,5.7 C20.7,2.6 23.2,0.1 26.3,0.1 L119.2,0.1 C122.3,0.1 124.8,2.6 124.8,5.7 L124.8,9.6 C124.8,12.7 122.3,15.1 119.3,15.1 L78.4,15.1 C75.3,15.1 72.8,17.6 72.8,20.7 L72.8,24.8 C72.8,27.9 75.3,30.4 78.4,30.4 L86.2,30.4 C89.2,30.4 91.7,32.8 91.8,35.9 L91.9,42.5 C91.9,45.6 89.4,48.1 86.3,48.1 L6.2,48.1 C3.1,48.1 0.6,45.6 0.6,42.5 L0.6,36.1 C0.6,33 3.1,30.6 6.1,30.5 L42.5,30.3 C45.5,30.3 48,27.9 48,24.8 L48.1,20.4 C48.2,17.3 45.6,14.7 42.5,14.7 L26.4,14.9 C23.3,15.1 20.7,12.6 20.7,9.5 Z" id="路径"></path>
|
|
||||||
<circle id="椭圆形" cx="144.6" cy="8.4" r="8.2"></circle>
|
|
||||||
</g>
|
|
||||||
<g id="编组" transform="translate(0.000000, 249.000000)" fill="#96CEF7" fill-rule="nonzero">
|
|
||||||
<path d="M158.3,12 L158.3,7.5 C158.3,3.8 155.3,0.8 151.6,0.8 L40.3,0.8 C36.6,0.8 33.6,3.8 33.6,7.5 L33.6,12.1 C33.6,15.8 36.6,18.7 40.2,18.7 L89.2,18.7 C92.9,18.7 95.9,21.7 95.9,25.4 L95.9,30.3 C95.9,34 92.9,37 89.2,37 L79.9,37 C76.3,37 73.3,39.9 73.2,43.5 L73.1,51.4 C73,55.1 76,58.2 79.8,58.2 L175.8,58.2 C179.5,58.2 182.5,55.2 182.5,51.5 L182.5,43.9 C182.5,40.2 179.5,37.3 175.9,37.2 L132.3,36.9 C128.7,36.9 125.8,34 125.7,30.4 L125.6,25.2 C125.5,21.5 128.6,18.4 132.3,18.4 L151.6,18.6 C155.2,18.7 158.3,15.7 158.3,12 Z" id="路径"></path>
|
|
||||||
<circle id="椭圆形" cx="9.9" cy="10.6" r="9.8"></circle>
|
|
||||||
</g>
|
|
||||||
<g id="XMLID_3_" transform="translate(306.000000, 202.000000)" fill-rule="nonzero">
|
|
||||||
<g id="编组">
|
|
||||||
<path d="M207.5,152.8 C207.5,152.8 205.5,167.9 218.6,174.6 L218.6,174.6 C213.1,184.2 206.2,193 198.3,200.7 L198.3,200.7 C178.2,164.9 157.7,186.2 157.7,186.2 C157.7,186.2 145.1,159.7 126.7,164.3 C144.9,152.4 163.5,139 181.6,125.3 C186.5,152.3 207.5,152.8 207.5,152.8 Z" id="路径" fill="#96CEF7"></path>
|
|
||||||
<path d="M218.7,174.6 L218.7,174.6 C205.6,167.9 207.5,152.8 207.5,152.8 C207.5,152.8 186.5,152.2 181.7,125.2 C198.4,112.5 214.7,99.4 230,86.7 C232.6,96.3 234,106.4 233.9,116.9 C233.9,138 228.4,157.6 218.7,174.6 Z" id="路径" fill="#309EED"></path>
|
|
||||||
<path d="M198.4,200.7 L198.4,200.7 C177.4,221 148.9,233.5 117.4,233.5 C114.6,233.5 111.9,233.4 109.2,233.2 L109.2,233.2 C109.2,233.2 100.2,217.1 112.9,208 C112.9,208 96.3,190.5 113.4,172.8 C117.8,170.1 122.3,167.2 126.7,164.3 C145.1,159.7 157.7,186.2 157.7,186.2 C157.7,186.2 178.3,164.9 198.4,200.7 Z" id="路径" fill="#309EED"></path>
|
|
||||||
<path d="M230,86.8 C214.7,99.5 198.4,112.6 181.7,125.3 C181.6,124.8 181.5,124.3 181.5,123.8 C177.3,95.3 205.7,84.4 205.7,84.4 C205.7,84.4 200.7,63.6 224.7,71.6 C226.8,76.4 228.6,81.5 230,86.8 Z" id="路径" fill="#309EED"></path>
|
|
||||||
<path d="M181.4,123.7 C181.5,124.2 181.6,124.7 181.6,125.2 C163.5,139 144.9,152.3 126.7,164.2 C123.7,164.9 120.6,166.5 117.3,169.1 C115.8,170.3 114.5,171.5 113.3,172.7 C88.3,188.2 64.3,200.5 43.4,207 C18.6,186.7 2.4,156.3 0.9,122.1 C0.9,122.1 0.9,122 0.9,122 C1.3,111.4 2.9,101 5.6,91.1 C10.4,92.2 23.3,94.8 29.1,90.6 C36.4,85.4 28.4,142.4 59.7,142.4 C91,142.4 93.4,90.2 93.4,90.2 C93.4,90.2 120.1,91.4 106.7,61.1 C106.7,61.1 124.5,62.6 129.3,44.7 C132.7,32.2 127.1,19.1 116.5,11.6 C112.3,8.6 106.8,5.2 99.6,1.5 C105.3,0.6 111.2,0.2 117.2,0.2 C165.4,0.2 206.8,29.5 224.5,71.2 C200.5,63.2 205.5,84 205.5,84 C205.5,84 177.2,95.2 181.4,123.7 Z M152,117 C152,117 159.6,110.4 157.8,104.2 C156,98 147.5,104.9 147.5,104.9 C147.5,104.9 146.9,86.2 130.5,92.8 C114.1,99.5 125,117 125,117 C137.8,130.8 152,117 152,117 Z" id="形状" fill="#96CEF7"></path>
|
|
||||||
<path d="M157.8,104.2 C159.6,110.4 152,117 152,117 C152,117 137.7,130.8 125,117 C125,117 114.1,99.5 130.5,92.8 C146.9,86.1 147.5,104.9 147.5,104.9 C147.5,104.9 156,98 157.8,104.2 Z" id="路径" fill="#309EED"></path>
|
|
||||||
<path d="M43.6,207.1 C64.5,200.6 88.5,188.3 113.5,172.8 C96.4,190.5 113,208 113,208 C100.3,217.1 109.3,233.2 109.3,233.2 L109.3,233.2 C84.4,231.5 61.7,222 43.6,207.1 Z" id="路径" fill="#96CEF7"></path>
|
|
||||||
<path d="M129.5,44.9 C124.6,62.8 106.9,61.3 106.9,61.3 C120.2,91.6 93.6,90.4 93.6,90.4 C93.6,90.4 91.2,142.6 59.9,142.6 C28.6,142.6 36.6,85.6 29.3,90.8 C23.4,95 10.5,92.4 5.8,91.3 C12.5,66.2 26,44 44.2,26.5 C59.9,13.8 79,5.1 99.9,1.9 C107.1,5.6 112.6,9 116.8,12 C127.3,19.3 132.9,32.4 129.5,44.9 Z" id="路径" fill="#309EED"></path>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<circle id="椭圆形" cx="423.4" cy="319" r="116.5"></circle>
|
|
||||||
<path d="M487,419.1 C484.6,420.5 482.1,421.9 479.6,423.2" id="路径" stroke="#000000"></path>
|
|
||||||
<path d="M459.6,429.9 C448.3,433.5 436.3,435.5 423.8,435.5 C359.5,435.5 307.3,383.3 307.3,319 C307.3,254.7 359.5,202.5 423.8,202.5 C488.1,202.5 540.3,254.6 540.3,319 C540.3,358.8 520.3,394 489.8,415" id="路径" stroke="#000000" stroke-width="2"></path>
|
|
||||||
<path d="M445.5,470.4 C523.151236,470.4 586.1,407.451236 586.1,329.8 C586.1,252.148764 523.151236,189.2 445.5,189.2 C367.848764,189.2 304.9,252.148764 304.9,329.8 C304.9,407.451236 367.848764,470.4 445.5,470.4 Z" id="椭圆形" stroke="#5C5C5C" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="3.0047,3.0047"></path>
|
|
||||||
<path d="M441.4,524 C547.217758,524 633,438.217758 633,332.4 C633,226.582242 547.217758,140.8 441.4,140.8 C335.582242,140.8 249.8,226.582242 249.8,332.4 C249.8,438.217758 335.582242,524 441.4,524 Z" id="椭圆形" stroke="#5C5C5C" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="2.994,2.994"></path>
|
|
||||||
<path d="M303.3,324 C303.3,324 236.4,436.7 338.2,411.2 C440,385.7 668.8,176 668.8,176" id="路径" stroke="#EF706D" stroke-width="2" stroke-dasharray="3,3"></path>
|
|
||||||
<path d="M304.8,330.5 C304.8,330.5 254.3,415.6 331.2,396.3 C408.1,377.1 652.2,153.4 652.2,153.4" id="路径" stroke="#EF706D" stroke-width="2" stroke-dasharray="3,3"></path>
|
|
||||||
<g id="XMLID_1_" transform="translate(624.000000, 0.000000)">
|
|
||||||
<g id="编组" transform="translate(0.000000, 19.000000)" fill-rule="nonzero">
|
|
||||||
<path d="M161.4,96 C179.2,122.5 186,145.3 176.8,154.4 C163.1,168.1 118.5,145.6 77.2,104.1 C59.5,86.3 45.3,68 35.9,51.7 C34.9,50 34,48.4 33.2,46.8 C31.4,43.5 29.9,40.3 28.6,37.2 C22.2,22.2 21.3,10.3 27.4,4.3 C35.9,-4.2 56.1,1.2 80.1,16.3 C95,25.6 111.2,38.7 127,54.6 C136.3,64 144.7,73.5 151.9,82.8 C155.3,87.3 158.5,91.7 161.4,96 Z M138.4,118.4 C143.7,113.1 130.7,91.5 109.3,70.1 C88,48.7 66.4,35.6 61.1,40.8 C55.8,46 68.9,67.7 90.2,89.1 C111.5,110.5 133.2,123.7 138.4,118.4 Z" id="形状" fill="#AFD7A3"></path>
|
|
||||||
<path d="M167.3,47.8 C172.5,60.9 174.4,78.5 161.3,96 C158.4,91.7 155.2,87.3 151.7,82.8 C172.5,69.5 165.6,44 165.6,44 C166.3,45.2 166.8,46.5 167.3,47.8 Z" id="路径" fill="#E7B976"></path>
|
|
||||||
<path d="M109.4,70.2 C130.7,91.6 143.8,113.2 138.5,118.5 C133.2,123.7 111.7,110.6 90.3,89.2 C68.9,67.8 55.9,46.2 61.2,40.9 C66.5,35.6 88,48.7 109.4,70.2 Z" id="路径" fill="#E7B976"></path>
|
|
||||||
<path d="M165.6,44 C165.6,44 172.4,69.5 151.8,82.8 C144.6,73.5 136.3,64 126.9,54.6 C111.1,38.7 94.8,25.7 80,16.3 C80,16.3 101.3,-3.4 138.4,16.1 C141.9,17.9 145.2,20.1 148.3,22.5 C150.6,24.3 152.8,26.3 154.8,28.4 C159.2,33 162.9,38.2 165.6,44 Z M132.3,24.4 C133,23.2 132.7,21.7 131.5,20.9 C130.3,20.2 128.7,20.5 128,21.7 C127.3,22.9 127.6,24.5 128.8,25.2 C130,25.9 131.6,25.6 132.3,24.4 Z M120.4,23.4 C121.9,23.5 123.3,22.7 123.7,21.3 C124,20.2 123.6,18.9 121.2,17.8 C117.1,15.8 109.4,16.3 106.2,16.6 C104.9,16.7 103.6,17.2 102.7,18 C99.6,20.6 102.7,23.8 106.3,23.1 C109.6,22.3 117.1,23 120.4,23.4 Z" id="形状" fill="#FED37C"></path>
|
|
||||||
<path d="M176,2.8 C177.2,3.5 154.8,28.4 154.8,28.4 C152.8,26.3 150.6,24.3 148.3,22.5 C148.3,22.6 174.8,2.1 176,2.8 Z" id="路径" fill="#AFD7A3"></path>
|
|
||||||
<path d="M131.5,20.9 C132.7,21.6 133.1,23.2 132.3,24.4 C131.6,25.6 130,26 128.8,25.2 C127.6,24.5 127.2,22.9 128,21.7 C128.7,20.5 130.3,20.2 131.5,20.9 Z" id="路径" fill="#FFFFFF"></path>
|
|
||||||
<path d="M123.7,21.2 C123.3,22.6 121.9,23.5 120.4,23.3 C117.1,22.9 109.6,22.2 106.3,22.9 C102.7,23.7 99.6,20.5 102.7,17.8 C103.7,16.9 104.9,16.5 106.2,16.4 C109.4,16.1 117.1,15.6 121.2,17.6 C123.6,18.9 124,20.2 123.7,21.2 Z" id="路径" fill="#FFFFFF"></path>
|
|
||||||
<path d="M3.9,161.6 C3.7,161.7 3.5,161.7 3.3,161.8 C2.2,159.9 1.1,158.1 0,156.2 C1.2,158 2.6,159.8 3.9,161.6 Z" id="路径" fill="#D8D7D7"></path>
|
|
||||||
</g>
|
|
||||||
<g id="编组" transform="translate(23.000000, 0.000000)" stroke="#000000" stroke-width="2">
|
|
||||||
<path d="M10.2,65.9 C8.4,62.6 6.9,59.4 5.6,56.3" id="路径"></path>
|
|
||||||
<path d="M12.9,70.8 C11.9,69.1 11,67.5 10.2,65.9" id="路径"></path>
|
|
||||||
<path d="M5.6,56.3 C-0.8,41.3 -1.7,29.4 4.4,23.4 C12.9,14.9 33.1,20.3 57.1,35.4 C72,44.7 88.2,57.8 104,73.7 C113.3,83.1 121.7,92.6 128.9,101.9 C132.4,106.4 135.6,110.8 138.5,115.1 C156.3,141.6 163.1,164.4 153.9,173.5 C140.2,187.2 95.6,164.7 54.3,123.2 C36.6,105.4 22.4,87.1 13,70.8" id="路径"></path>
|
|
||||||
<path d="M57,35.4 C57,35.4 78.3,15.7 115.4,35.2 C118.9,37 122.2,39.2 125.3,41.6 C127.6,43.4 129.8,45.4 131.8,47.5 C136.2,52.1 139.9,57.3 142.7,63.1 C143.3,64.3 143.9,65.6 144.4,66.9 C149.6,80 151.5,97.6 138.4,115.1" id="路径"></path>
|
|
||||||
<path d="M115.4,137.4 C110.1,142.6 88.6,129.5 67.2,108.1 C45.8,86.7 32.8,65.1 38.1,59.8 C43.4,54.6 64.9,67.7 86.3,89.1 C107.7,110.6 120.7,132.2 115.4,137.4 Z" id="路径"></path>
|
|
||||||
<path d="M125.3,41.6 C125.3,41.6 151.8,21.2 153,21.9 C154.2,22.6 131.8,47.5 131.8,47.5" id="路径"></path>
|
|
||||||
<path d="M149.4,15.2 L155.5,0.8" id="路径"></path>
|
|
||||||
<path d="M156.8,19.8 L166.9,10.1" id="路径"></path>
|
|
||||||
<path d="M159.3,25.7 L172.2,25" id="路径"></path>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<path d="M624,70.7 C624,70.7 631.6,66.6 639,70.7" id="路径" stroke="#FFFFFF"></path>
|
|
||||||
<path d="M657.2,22.8 C657.2,22.8 671.2,17.5 716.5,48.2" id="路径" stroke="#FFFFFF" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
||||||
<path d="M720.5,51 C720.5,51 776.5,94.6 796.4,142.7" id="路径" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 215 KiB |
|
@ -1 +0,0 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
|
Before Width: | Height: | Size: 496 B |
|
@ -1,751 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
export const Push = function Push(options) {
|
|
||||||
this.doNotConnect = 0;
|
|
||||||
options = options || {};
|
|
||||||
options.heartbeat = options.heartbeat || 25000;
|
|
||||||
options.pingTimeout = options.pingTimeout || 10000;
|
|
||||||
this.config = options;
|
|
||||||
this.uid = 0;
|
|
||||||
this.channels = {};
|
|
||||||
this.connection = null;
|
|
||||||
this.pingTimeoutTimer = 0;
|
|
||||||
Push.instances.push(this);
|
|
||||||
this.createConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
Push.prototype.checkoutPing = function() {
|
|
||||||
var _this = this;
|
|
||||||
_this.checkoutPingTimer && clearTimeout(_this.checkoutPingTimer);
|
|
||||||
_this.checkoutPingTimer = setTimeout(function () {
|
|
||||||
_this.checkoutPingTimer = 0;
|
|
||||||
if (_this.connection.state === 'connected') {
|
|
||||||
_this.connection.send('{"event":"pusher:ping","data":{}}');
|
|
||||||
if (_this.pingTimeoutTimer) {
|
|
||||||
clearTimeout(_this.pingTimeoutTimer);
|
|
||||||
_this.pingTimeoutTimer = 0;
|
|
||||||
}
|
|
||||||
_this.pingTimeoutTimer = setTimeout(function () {
|
|
||||||
_this.connection.closeAndClean();
|
|
||||||
if (!_this.connection.doNotConnect) {
|
|
||||||
_this.connection.waitReconnect();
|
|
||||||
}
|
|
||||||
}, _this.config.pingTimeout);
|
|
||||||
}
|
|
||||||
}, this.config.heartbeat);
|
|
||||||
};
|
|
||||||
|
|
||||||
Push.prototype.channel = function (name) {
|
|
||||||
return this.channels.find(name);
|
|
||||||
};
|
|
||||||
Push.prototype.allChannels = function () {
|
|
||||||
return this.channels.all();
|
|
||||||
};
|
|
||||||
Push.prototype.createConnection = function () {
|
|
||||||
if (this.connection) {
|
|
||||||
throw Error('Connection already exist');
|
|
||||||
}
|
|
||||||
var _this = this;
|
|
||||||
var url = this.config.url;
|
|
||||||
function updateSubscribed () {
|
|
||||||
for (var i in _this.channels) {
|
|
||||||
_this.channels[i].subscribed = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.connection = new Connection({
|
|
||||||
url: url,
|
|
||||||
app_key: this.config.app_key,
|
|
||||||
onOpen: function () {
|
|
||||||
_this.connection.state ='connecting';
|
|
||||||
_this.checkoutPing();
|
|
||||||
},
|
|
||||||
onMessage: function(params) {
|
|
||||||
if(_this.pingTimeoutTimer) {
|
|
||||||
clearTimeout(_this.pingTimeoutTimer);
|
|
||||||
_this.pingTimeoutTimer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
params = JSON.parse(params.data);
|
|
||||||
var event = params.event;
|
|
||||||
var channel_name = params.channel;
|
|
||||||
|
|
||||||
if (event === 'pusher:pong') {
|
|
||||||
_this.checkoutPing();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (event === 'pusher:error') {
|
|
||||||
throw Error(params.data.message);
|
|
||||||
}
|
|
||||||
var data = JSON.parse(params.data), channel;
|
|
||||||
if (event === 'pusher_internal:subscription_succeeded') {
|
|
||||||
channel = _this.channels[channel_name];
|
|
||||||
channel.subscribed = true;
|
|
||||||
channel.processQueue();
|
|
||||||
channel.emit('pusher:subscription_succeeded');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (event === 'pusher:connection_established') {
|
|
||||||
_this.connection.socket_id = data.socket_id;
|
|
||||||
_this.connection.updateNetworkState('connected');
|
|
||||||
_this.subscribeAll();
|
|
||||||
}
|
|
||||||
if (event.indexOf('pusher_internal') !== -1) {
|
|
||||||
console.log("Event '"+event+"' not implement");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
channel = _this.channels[channel_name];
|
|
||||||
if (channel) {
|
|
||||||
channel.emit(event, data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onClose: function () {
|
|
||||||
updateSubscribed();
|
|
||||||
},
|
|
||||||
onError: function () {
|
|
||||||
updateSubscribed();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Push.prototype.disconnect = function () {
|
|
||||||
this.connection.doNotConnect = 1;
|
|
||||||
this.connection.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
Push.prototype.subscribeAll = function () {
|
|
||||||
if (this.connection.state !== 'connected') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (var channel_name in this.channels) {
|
|
||||||
//this.connection.send(JSON.stringify({event:"pusher:subscribe", data:{channel:channel_name}}));
|
|
||||||
this.channels[channel_name].processSubscribe();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Push.prototype.unsubscribe = function (channel_name) {
|
|
||||||
if (this.channels[channel_name]) {
|
|
||||||
delete this.channels[channel_name];
|
|
||||||
if (this.connection.state === 'connected') {
|
|
||||||
this.connection.send(JSON.stringify({event:"pusher:unsubscribe", data:{channel:channel_name}}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Push.prototype.unsubscribeAll = function () {
|
|
||||||
var channels = Object.keys(this.channels);
|
|
||||||
if (channels.length) {
|
|
||||||
if (this.connection.state === 'connected') {
|
|
||||||
for (var channel_name in this.channels) {
|
|
||||||
this.unsubscribe(channel_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.channels = {};
|
|
||||||
};
|
|
||||||
Push.prototype.subscribe = function (channel_name) {
|
|
||||||
if (this.channels[channel_name]) {
|
|
||||||
return this.channels[channel_name];
|
|
||||||
}
|
|
||||||
if (channel_name.indexOf('private-') === 0) {
|
|
||||||
return createPrivateChannel(channel_name, this);
|
|
||||||
}
|
|
||||||
if (channel_name.indexOf('presence-') === 0) {
|
|
||||||
return createPresenceChannel(channel_name, this);
|
|
||||||
}
|
|
||||||
return createChannel(channel_name, this);
|
|
||||||
};
|
|
||||||
Push.instances = [];
|
|
||||||
|
|
||||||
function createChannel(channel_name, push)
|
|
||||||
{
|
|
||||||
var channel = new Channel(push.connection, channel_name);
|
|
||||||
push.channels[channel_name] = channel;
|
|
||||||
channel.subscribeCb = function () {
|
|
||||||
push.connection.send(JSON.stringify({event:"pusher:subscribe", data:{channel:channel_name}}));
|
|
||||||
}
|
|
||||||
channel.processSubscribe();
|
|
||||||
return channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createPrivateChannel(channel_name, push)
|
|
||||||
{
|
|
||||||
var channel = new Channel(push.connection, channel_name);
|
|
||||||
push.channels[channel_name] = channel;
|
|
||||||
channel.subscribeCb = function () {
|
|
||||||
__ajax({
|
|
||||||
url: push.config.auth,
|
|
||||||
type: 'POST',
|
|
||||||
data: {channel_name: channel_name, socket_id: push.connection.socket_id},
|
|
||||||
success: function (data) {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
data.channel = channel_name;
|
|
||||||
push.connection.send(JSON.stringify({event:"pusher:subscribe", data:data}));
|
|
||||||
},
|
|
||||||
error: function (e) {
|
|
||||||
throw Error(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
channel.processSubscribe();
|
|
||||||
return channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createPresenceChannel(channel_name, push)
|
|
||||||
{
|
|
||||||
return createPrivateChannel(channel_name, push);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*window.addEventListener('online', function(){
|
|
||||||
var con;
|
|
||||||
for (var i in Push.instances) {
|
|
||||||
con = Push.instances[i].connection;
|
|
||||||
con.reconnectInterval = 1;
|
|
||||||
if (con.state === 'connecting') {
|
|
||||||
con.connect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
|
|
||||||
function Connection(options) {
|
|
||||||
this.dispatcher = new Dispatcher();
|
|
||||||
__extends(this, this.dispatcher);
|
|
||||||
var properies = ['on', 'off', 'emit'];
|
|
||||||
for (var i in properies) {
|
|
||||||
this[properies[i]] = this.dispatcher[properies[i]];
|
|
||||||
}
|
|
||||||
this.options = options;
|
|
||||||
this.state = 'initialized'; //initialized connecting connected disconnected
|
|
||||||
this.doNotConnect = 0;
|
|
||||||
this.reconnectInterval = 1;
|
|
||||||
this.connection = null;
|
|
||||||
this.reconnectTimer = 0;
|
|
||||||
this.connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
Connection.prototype.updateNetworkState = function(state){
|
|
||||||
var old_state = this.state;
|
|
||||||
this.state = state;
|
|
||||||
if (old_state !== state) {
|
|
||||||
this.emit('state_change', { previous: old_state, current: state });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Connection.prototype.connect = function () {
|
|
||||||
this.doNotConnect = 0;
|
|
||||||
if (this.state === 'connected') {
|
|
||||||
console.log('networkState is "' + this.state + '" and do not need connect');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.reconnectTimer) {
|
|
||||||
clearTimeout(this.reconnectTimer);
|
|
||||||
this.reconnectTimer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.closeAndClean();
|
|
||||||
|
|
||||||
var options = this.options;
|
|
||||||
var websocket = new WebSocket(options.url+'/app/'+options.app_key);
|
|
||||||
|
|
||||||
this.updateNetworkState('connecting');
|
|
||||||
|
|
||||||
var _this = this;
|
|
||||||
websocket.onopen = function (res) {
|
|
||||||
_this.reconnectInterval = 1;
|
|
||||||
if (_this.doNotConnect) {
|
|
||||||
_this.updateNetworkState('disconnected');
|
|
||||||
websocket.close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (options.onOpen) {
|
|
||||||
options.onOpen(res);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (options.onMessage) {
|
|
||||||
websocket.onmessage = options.onMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
websocket.onclose = function (res) {
|
|
||||||
websocket.onmessage = websocket.onopen = websocket.onclose = websocket.onerror = null;
|
|
||||||
_this.updateNetworkState('disconnected');
|
|
||||||
if (!_this.doNotConnect) {
|
|
||||||
_this.waitReconnect();
|
|
||||||
}
|
|
||||||
if (options.onClose) {
|
|
||||||
options.onClose(res);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
websocket.onerror = function (res) {
|
|
||||||
_this.close();
|
|
||||||
if (!_this.doNotConnect) {
|
|
||||||
_this.waitReconnect();
|
|
||||||
}
|
|
||||||
if (options.onError) {
|
|
||||||
options.onError(res);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.connection = websocket;
|
|
||||||
}
|
|
||||||
|
|
||||||
Connection.prototype.closeAndClean = function () {
|
|
||||||
if(this.connection) {
|
|
||||||
var websocket = this.connection;
|
|
||||||
websocket.onmessage = websocket.onopen = websocket.onclose = websocket.onerror = null;
|
|
||||||
try {
|
|
||||||
websocket.close();
|
|
||||||
} catch (e) {}
|
|
||||||
this.updateNetworkState('disconnected');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Connection.prototype.waitReconnect = function () {
|
|
||||||
if (this.state === 'connected' || this.state === 'connecting') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!this.doNotConnect) {
|
|
||||||
this.updateNetworkState('connecting');
|
|
||||||
var _this = this;
|
|
||||||
if (this.reconnectTimer) {
|
|
||||||
clearTimeout(this.reconnectTimer);
|
|
||||||
}
|
|
||||||
this.reconnectTimer = setTimeout(function(){
|
|
||||||
_this.connect();
|
|
||||||
}, this.reconnectInterval);
|
|
||||||
if (this.reconnectInterval < 1000) {
|
|
||||||
this.reconnectInterval = 1000;
|
|
||||||
} else {
|
|
||||||
// 每次重连间隔增大一倍
|
|
||||||
this.reconnectInterval = this.reconnectInterval * 2;
|
|
||||||
}
|
|
||||||
// 有网络的状态下,重连间隔最大2秒
|
|
||||||
if (this.reconnectInterval > 2000 && navigator.onLine) {
|
|
||||||
_this.reconnectInterval = 2000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connection.prototype.send = function(data) {
|
|
||||||
if (this.state !== 'connected') {
|
|
||||||
console.trace('networkState is "' + this.state + '", can not send ' + data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.connection.send(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
Connection.prototype.close = function(){
|
|
||||||
this.updateNetworkState('disconnected');
|
|
||||||
this.connection.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
var __extends = (this && this.__extends) || function (d, b) {
|
|
||||||
for (var p in b) if (b.hasOwnProperty(p)) {d[p] = b[p];}
|
|
||||||
function __() { this.constructor = d; }
|
|
||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
||||||
};
|
|
||||||
|
|
||||||
function Channel(connection, channel_name) {
|
|
||||||
this.subscribed = false;
|
|
||||||
this.dispatcher = new Dispatcher();
|
|
||||||
this.connection = connection;
|
|
||||||
this.channelName = channel_name;
|
|
||||||
this.subscribeCb = null;
|
|
||||||
this.queue = [];
|
|
||||||
__extends(this, this.dispatcher);
|
|
||||||
var properies = ['on', 'off', 'emit'];
|
|
||||||
for (var i in properies) {
|
|
||||||
this[properies[i]] = this.dispatcher[properies[i]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Channel.prototype.processSubscribe = function () {
|
|
||||||
if (this.connection.state !== 'connected') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.subscribeCb();
|
|
||||||
};
|
|
||||||
|
|
||||||
Channel.prototype.processQueue = function () {
|
|
||||||
if (this.connection.state !== 'connected' || !this.subscribed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (var i in this.queue) {
|
|
||||||
this.queue[i]();
|
|
||||||
}
|
|
||||||
this.queue = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
Channel.prototype.trigger = function (event, data) {
|
|
||||||
if (event.indexOf('client-') !== 0) {
|
|
||||||
throw new Error("Event '" + event + "' should start with 'client-'");
|
|
||||||
}
|
|
||||||
var _this = this;
|
|
||||||
this.queue.push(function () {
|
|
||||||
_this.connection.send(JSON.stringify({ event: event, data: data, channel: _this.channelName }));
|
|
||||||
});
|
|
||||||
this.processQueue();
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////
|
|
||||||
var Collections = (function () {
|
|
||||||
var exports = {};
|
|
||||||
function extend(target) {
|
|
||||||
var sources = [];
|
|
||||||
for (var _i = 1; _i < arguments.length; _i++) {
|
|
||||||
sources[_i - 1] = arguments[_i];
|
|
||||||
}
|
|
||||||
for (var i = 0; i < sources.length; i++) {
|
|
||||||
var extensions = sources[i];
|
|
||||||
for (var property in extensions) {
|
|
||||||
if (extensions[property] && extensions[property].constructor &&
|
|
||||||
extensions[property].constructor === Object) {
|
|
||||||
target[property] = extend(target[property] || {}, extensions[property]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
target[property] = extensions[property];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.extend = extend;
|
|
||||||
function stringify() {
|
|
||||||
var m = ["Push"];
|
|
||||||
for (var i = 0; i < arguments.length; i++) {
|
|
||||||
if (typeof arguments[i] === "string") {
|
|
||||||
m.push(arguments[i]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m.push(safeJSONStringify(arguments[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return m.join(" : ");
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.stringify = stringify;
|
|
||||||
function arrayIndexOf(array, item) {
|
|
||||||
var nativeIndexOf = Array.prototype.indexOf;
|
|
||||||
if (array === null) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (nativeIndexOf && array.indexOf === nativeIndexOf) {
|
|
||||||
return array.indexOf(item);
|
|
||||||
}
|
|
||||||
for (var i = 0, l = array.length; i < l; i++) {
|
|
||||||
if (array[i] === item) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.arrayIndexOf = arrayIndexOf;
|
|
||||||
function objectApply(object, f) {
|
|
||||||
for (var key in object) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
||||||
f(object[key], key, object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.objectApply = objectApply;
|
|
||||||
function keys(object) {
|
|
||||||
var keys = [];
|
|
||||||
objectApply(object, function (_, key) {
|
|
||||||
keys.push(key);
|
|
||||||
});
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.keys = keys;
|
|
||||||
function values(object) {
|
|
||||||
var values = [];
|
|
||||||
objectApply(object, function (value) {
|
|
||||||
values.push(value);
|
|
||||||
});
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.values = values;
|
|
||||||
function apply(array, f, context) {
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
f.call(context || (window), array[i], i, array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.apply = apply;
|
|
||||||
function map(array, f) {
|
|
||||||
var result = [];
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
result.push(f(array[i], i, array, result));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.map = map;
|
|
||||||
function mapObject(object, f) {
|
|
||||||
var result = {};
|
|
||||||
objectApply(object, function (value, key) {
|
|
||||||
result[key] = f(value);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.mapObject = mapObject;
|
|
||||||
function filter(array, test) {
|
|
||||||
test = test || function (value) {
|
|
||||||
return !!value;
|
|
||||||
};
|
|
||||||
var result = [];
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
if (test(array[i], i, array, result)) {
|
|
||||||
result.push(array[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.filter = filter;
|
|
||||||
function filterObject(object, test) {
|
|
||||||
var result = {};
|
|
||||||
objectApply(object, function (value, key) {
|
|
||||||
if ((test && test(value, key, object, result)) || Boolean(value)) {
|
|
||||||
result[key] = value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.filterObject = filterObject;
|
|
||||||
function flatten(object) {
|
|
||||||
var result = [];
|
|
||||||
objectApply(object, function (value, key) {
|
|
||||||
result.push([key, value]);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.flatten = flatten;
|
|
||||||
function any(array, test) {
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
if (test(array[i], i, array)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.any = any;
|
|
||||||
function all(array, test) {
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
if (!test(array[i], i, array)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.all = all;
|
|
||||||
function encodeParamsObject(data) {
|
|
||||||
return mapObject(data, function (value) {
|
|
||||||
if (typeof value === "object") {
|
|
||||||
value = safeJSONStringify(value);
|
|
||||||
}
|
|
||||||
return encodeURIComponent(base64_1["default"](value.toString()));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.encodeParamsObject = encodeParamsObject;
|
|
||||||
function buildQueryString(data) {
|
|
||||||
var params = filterObject(data, function (value) {
|
|
||||||
return value !== undefined;
|
|
||||||
});
|
|
||||||
return map(flatten(encodeParamsObject(params)), util_1["default"].method("join", "=")).join("&");
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.buildQueryString = buildQueryString;
|
|
||||||
function decycleObject(object) {
|
|
||||||
var objects = [], paths = [];
|
|
||||||
return (function derez(value, path) {
|
|
||||||
var i, name, nu;
|
|
||||||
switch (typeof value) {
|
|
||||||
case 'object':
|
|
||||||
if (!value) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (i = 0; i < objects.length; i += 1) {
|
|
||||||
if (objects[i] === value) {
|
|
||||||
return {$ref: paths[i]};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
objects.push(value);
|
|
||||||
paths.push(path);
|
|
||||||
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
|
||||||
nu = [];
|
|
||||||
for (i = 0; i < value.length; i += 1) {
|
|
||||||
nu[i] = derez(value[i], path + '[' + i + ']');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nu = {};
|
|
||||||
for (name in value) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(value, name)) {
|
|
||||||
nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nu;
|
|
||||||
case 'number':
|
|
||||||
case 'string':
|
|
||||||
case 'boolean':
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}(object, '$'));
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.decycleObject = decycleObject;
|
|
||||||
function safeJSONStringify(source) {
|
|
||||||
try {
|
|
||||||
return JSON.stringify(source);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
return JSON.stringify(decycleObject(source));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.safeJSONStringify = safeJSONStringify;
|
|
||||||
return exports;
|
|
||||||
})();
|
|
||||||
|
|
||||||
var Dispatcher = (function () {
|
|
||||||
function Dispatcher(failThrough) {
|
|
||||||
this.callbacks = new CallbackRegistry();
|
|
||||||
this.global_callbacks = [];
|
|
||||||
this.failThrough = failThrough;
|
|
||||||
}
|
|
||||||
Dispatcher.prototype.on = function (eventName, callback, context) {
|
|
||||||
this.callbacks.add(eventName, callback, context);
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
Dispatcher.prototype.on_global = function (callback) {
|
|
||||||
this.global_callbacks.push(callback);
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
Dispatcher.prototype.off = function (eventName, callback, context) {
|
|
||||||
this.callbacks.remove(eventName, callback, context);
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
Dispatcher.prototype.emit = function (eventName, data) {
|
|
||||||
var i;
|
|
||||||
for (i = 0; i < this.global_callbacks.length; i++) {
|
|
||||||
this.global_callbacks[i](eventName, data);
|
|
||||||
}
|
|
||||||
var callbacks = this.callbacks.get(eventName);
|
|
||||||
if (callbacks && callbacks.length > 0) {
|
|
||||||
for (i = 0; i < callbacks.length; i++) {
|
|
||||||
callbacks[i].fn.call(callbacks[i].context || (window), data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (this.failThrough) {
|
|
||||||
this.failThrough(eventName, data);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
return Dispatcher;
|
|
||||||
}());
|
|
||||||
|
|
||||||
var CallbackRegistry = (function () {
|
|
||||||
function CallbackRegistry() {
|
|
||||||
this._callbacks = {};
|
|
||||||
}
|
|
||||||
CallbackRegistry.prototype.get = function (name) {
|
|
||||||
return this._callbacks[prefix(name)];
|
|
||||||
};
|
|
||||||
CallbackRegistry.prototype.add = function (name, callback, context) {
|
|
||||||
var prefixedEventName = prefix(name);
|
|
||||||
this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
|
|
||||||
this._callbacks[prefixedEventName].push({
|
|
||||||
fn: callback,
|
|
||||||
context: context
|
|
||||||
});
|
|
||||||
};
|
|
||||||
CallbackRegistry.prototype.remove = function (name, callback, context) {
|
|
||||||
if (!name && !callback && !context) {
|
|
||||||
this._callbacks = {};
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var names = name ? [prefix(name)] : Collections.keys(this._callbacks);
|
|
||||||
if (callback || context) {
|
|
||||||
this.removeCallback(names, callback, context);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.removeAllCallbacks(names);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
|
|
||||||
Collections.apply(names, function (name) {
|
|
||||||
this._callbacks[name] = Collections.filter(this._callbacks[name] || [], function (oning) {
|
|
||||||
return (callback && callback !== oning.fn) ||
|
|
||||||
(context && context !== oning.context);
|
|
||||||
});
|
|
||||||
if (this._callbacks[name].length === 0) {
|
|
||||||
delete this._callbacks[name];
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
};
|
|
||||||
CallbackRegistry.prototype.removeAllCallbacks = function (names) {
|
|
||||||
Collections.apply(names, function (name) {
|
|
||||||
delete this._callbacks[name];
|
|
||||||
}, this);
|
|
||||||
};
|
|
||||||
return CallbackRegistry;
|
|
||||||
}());
|
|
||||||
function prefix(name) {
|
|
||||||
return "_" + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
function __ajax(options){
|
|
||||||
options=options||{};
|
|
||||||
options.type=(options.type||'GET').toUpperCase();
|
|
||||||
options.dataType=options.dataType||'json';
|
|
||||||
params=formatParams(options.data);
|
|
||||||
|
|
||||||
var xhr;
|
|
||||||
if(window.XMLHttpRequest){
|
|
||||||
xhr=new XMLHttpRequest();
|
|
||||||
}else{
|
|
||||||
xhr=ActiveXObject('Microsoft.XMLHTTP');
|
|
||||||
}
|
|
||||||
|
|
||||||
xhr.onreadystatechange=function(){
|
|
||||||
if(xhr.readyState === 4){
|
|
||||||
var status=xhr.status;
|
|
||||||
if(status>=200 && status<300){
|
|
||||||
options.success&&options.success(xhr.responseText,xhr.responseXML);
|
|
||||||
}else{
|
|
||||||
options.error&&options.error(status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(options.type==='GET'){
|
|
||||||
xhr.open('GET',options.url+'?'+params,true);
|
|
||||||
xhr.send(null);
|
|
||||||
}else if(options.type==='POST'){
|
|
||||||
xhr.open('POST',options.url,true);
|
|
||||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
||||||
xhr.send(params);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatParams(data){
|
|
||||||
var arr=[];
|
|
||||||
for(var name in data){
|
|
||||||
arr.push(encodeURIComponent(name)+'='+encodeURIComponent(data[name]));
|
|
||||||
}
|
|
||||||
return arr.join('&');
|
|
||||||
}
|
|
||||||
|
|
||||||
// export const push = {
|
|
||||||
// a:6
|
|
||||||
// }
|
|
|
@ -1,10 +0,0 @@
|
||||||
<script setup>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div style="width: 1rem;height: 100%;"></div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
</style>
|
|
|
@ -1,682 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { ref, watch, nextTick, computed, onMounted, onUnmounted } from "vue";
|
|
||||||
import { orderCreateApi, orderStatusApi, orderPayApi } from "@/api/store.js";
|
|
||||||
import { ElMessage } from "element-plus";
|
|
||||||
import { audioplay } from "@/utils/audio.js";
|
|
||||||
import mitt from "@/utils/mitt.js";
|
|
||||||
import { useUserStore } from "@/store/user.js";
|
|
||||||
|
|
||||||
const drawer = ref(false);
|
|
||||||
const active = ref(1);
|
|
||||||
const input = ref("");
|
|
||||||
const codeRef = ref("");
|
|
||||||
|
|
||||||
const userStore = useUserStore();
|
|
||||||
|
|
||||||
const cancelClick = () => {
|
|
||||||
beforeClose();
|
|
||||||
};
|
|
||||||
|
|
||||||
const open = () => {
|
|
||||||
nextTick(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
loading.value = false;
|
|
||||||
input.value = "";
|
|
||||||
reLoad.value = true;
|
|
||||||
codeRef.value?.focus();
|
|
||||||
changeActive(active.value);
|
|
||||||
}, 300);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const changeActive = (e) => {
|
|
||||||
active.value = e;
|
|
||||||
if (active.value == 2) {
|
|
||||||
// 添加键盘事件监听器
|
|
||||||
window.addEventListener("keydown", keyboard);
|
|
||||||
} else {
|
|
||||||
window.removeEventListener("keydown", keyboard);
|
|
||||||
nextTick(() => {
|
|
||||||
input.value = "";
|
|
||||||
codeRef.value?.focus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const form = ref({});
|
|
||||||
const cart_id = ref([]);
|
|
||||||
const setForm = (e) => {
|
|
||||||
form.value = e.data;
|
|
||||||
cart_id.value = e.cart_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setRePay = (e) => {
|
|
||||||
form.value.total = e.price;
|
|
||||||
order_id.value = e.order_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
const emit = defineEmits(["paySuccess"]);
|
|
||||||
|
|
||||||
const reLoad = ref(false);
|
|
||||||
|
|
||||||
const numList = ref([
|
|
||||||
"1",
|
|
||||||
"2",
|
|
||||||
"3",
|
|
||||||
"4",
|
|
||||||
"5",
|
|
||||||
"6",
|
|
||||||
"7",
|
|
||||||
"8",
|
|
||||||
"9",
|
|
||||||
"0",
|
|
||||||
"00",
|
|
||||||
".",
|
|
||||||
]);
|
|
||||||
|
|
||||||
let timecount = 0; //刷新间隔
|
|
||||||
|
|
||||||
const regexWechat = /^(10|11|12|13|14|15)\d{16}$/; //微信条码正则 10-15开头18位
|
|
||||||
const regexPay = /^(25|26|27|28|29|30)\d{14,22}$/; //支付宝条码正则 25-30开头16-24位
|
|
||||||
|
|
||||||
const order_id = ref("");
|
|
||||||
// 支付
|
|
||||||
const handleEnter = () => {
|
|
||||||
loading.value = true;
|
|
||||||
codeRef.value.blur();
|
|
||||||
|
|
||||||
if (order_id.value) orderPay(order_id.value);
|
|
||||||
else {
|
|
||||||
let pay_type;
|
|
||||||
if (regexWechat.test(input.value)) pay_type = "9"; // 微信
|
|
||||||
else if (regexPay.test(input.value)) pay_type = "13"; // 支付宝
|
|
||||||
else {
|
|
||||||
loading.value = false;
|
|
||||||
input.value = "";
|
|
||||||
codeRef.value.focus();
|
|
||||||
return ElMessage.error("请输入正确的支付码");
|
|
||||||
}
|
|
||||||
orderCreateApi({
|
|
||||||
address_id: "",
|
|
||||||
key: form.value.key,
|
|
||||||
cart_id: cart_id.value,
|
|
||||||
pay_type: pay_type,
|
|
||||||
auth_code: input.value,
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
if (res.data.out_trade_no && res.msg == "支付成功") {
|
|
||||||
drawer.value = false;
|
|
||||||
ElMessage({
|
|
||||||
message: "支付成功",
|
|
||||||
type: "success",
|
|
||||||
});
|
|
||||||
// if(res.data.message) audioplay(res.data.message);
|
|
||||||
beforeClose(res.data);
|
|
||||||
} else {
|
|
||||||
if (res.msg == "用户支付中" && res.code == 1) {
|
|
||||||
ElMessage.warning(res.msg);
|
|
||||||
mitt.on("pay_success", (e) => {
|
|
||||||
ElMessage({
|
|
||||||
message: "支付成功",
|
|
||||||
type: "success",
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
mitt.off("pay_success");
|
|
||||||
}, 200);
|
|
||||||
drawer.value = false;
|
|
||||||
beforeClose(e);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// if (!res.data.group_order_sn) {
|
|
||||||
// order_id.value = res.data.result.order_id;
|
|
||||||
// loading.value = false;
|
|
||||||
// return ElMessage({
|
|
||||||
// message: res.message,
|
|
||||||
// type: "error",
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// order_id.value = res.data.group_order_id;
|
|
||||||
// count.value = 0;
|
|
||||||
// timecount = 0;
|
|
||||||
// getOrderStatus(res.data.group_order_sn);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
loading.value = false;
|
|
||||||
nextTick(() => {
|
|
||||||
codeRef.value?.focus();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const orderPay = (id) => {
|
|
||||||
let query;
|
|
||||||
if (active.value == 1) {
|
|
||||||
let pay_type;
|
|
||||||
if (regexWechat.test(input.value)) pay_type = "micropay";
|
|
||||||
else if (regexPay.test(input.value)) pay_type = "alipayBar";
|
|
||||||
else {
|
|
||||||
loading.value = false;
|
|
||||||
input.value = "";
|
|
||||||
codeRef.value.focus();
|
|
||||||
return ElMessage.error("请输入正确的支付码");
|
|
||||||
}
|
|
||||||
query = {
|
|
||||||
type: pay_type,
|
|
||||||
auth_code: input.value,
|
|
||||||
};
|
|
||||||
} else
|
|
||||||
query = {
|
|
||||||
type: "cash_payment",
|
|
||||||
};
|
|
||||||
orderPayApi(id, query)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.data.out_trade_no && res.msg == "支付成功") {
|
|
||||||
drawer.value = false;
|
|
||||||
ElMessage({
|
|
||||||
message: "支付成功",
|
|
||||||
type: "success",
|
|
||||||
});
|
|
||||||
// if(res.data.message) audioplay(res.data.message);
|
|
||||||
beforeClose(res.data);
|
|
||||||
} else {
|
|
||||||
order_id.value = res.data.group_order_id;
|
|
||||||
count.value = 0;
|
|
||||||
timecount = 0;
|
|
||||||
getOrderStatus(res.data.group_order_sn);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
input.value = "";
|
|
||||||
loading.value = false;
|
|
||||||
nextTick(() => {
|
|
||||||
codeRef.value?.focus();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const count = ref(0); // 累计请求3次, 如果3次都失败, 则只能重新支付
|
|
||||||
const getOrderStatus = (id) => {
|
|
||||||
if (!id) return;
|
|
||||||
count.value++;
|
|
||||||
timecount += 5000;
|
|
||||||
orderStatusApi({
|
|
||||||
order_sn: id,
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
if (res.data.trade_state == "SUCCESS") {
|
|
||||||
ElMessage({
|
|
||||||
message: res.message,
|
|
||||||
type: "success",
|
|
||||||
});
|
|
||||||
// if(res.data.message) audioplay(res.data.message);
|
|
||||||
beforeClose();
|
|
||||||
} else {
|
|
||||||
ElMessage({
|
|
||||||
message:
|
|
||||||
res.data.trade_state == "USERPAYING"
|
|
||||||
? "用户正在支付中"
|
|
||||||
: res.message,
|
|
||||||
type: "error",
|
|
||||||
});
|
|
||||||
input.value = "";
|
|
||||||
loading.value = false;
|
|
||||||
nextTick(() => {
|
|
||||||
codeRef.value?.focus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
if (reLoad.value && count.value < 3)
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
getOrderStatus(id);
|
|
||||||
},
|
|
||||||
15000 - timecount > 0 ? 15000 - timecount : 0
|
|
||||||
);
|
|
||||||
else {
|
|
||||||
input.value = "";
|
|
||||||
loading.value = false;
|
|
||||||
nextTick(() => {
|
|
||||||
codeRef.value?.focus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const beforeClose = (data) => {
|
|
||||||
window.removeEventListener("keydown", keyboard);
|
|
||||||
reLoad.value = false;
|
|
||||||
loading.value = false;
|
|
||||||
input.value = "";
|
|
||||||
collection.value = "";
|
|
||||||
collectionArray.value = [];
|
|
||||||
codeRef.value?.blur();
|
|
||||||
emit("paySuccess", data);
|
|
||||||
drawer.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const loading = ref(false);
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
drawer,
|
|
||||||
setForm,
|
|
||||||
setRePay,
|
|
||||||
beforeClose,
|
|
||||||
});
|
|
||||||
|
|
||||||
const collectionArray = ref([]);
|
|
||||||
const collection = ref(""); //输入的金额
|
|
||||||
const changePrice = computed(() => {
|
|
||||||
// 找零
|
|
||||||
if (+collection.value > 0) {
|
|
||||||
return (collection.value - form.value.total).toFixed(2);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
});
|
|
||||||
const defaultcalc = ref(false);
|
|
||||||
|
|
||||||
//清除计算机输入的数字
|
|
||||||
const delNum = (type) => {
|
|
||||||
if (type === -1) {
|
|
||||||
collectionArray.value = [];
|
|
||||||
} else {
|
|
||||||
collectionArray.value.pop();
|
|
||||||
}
|
|
||||||
collection.value = collectionArray.value.length
|
|
||||||
? collectionArray.value.join("")
|
|
||||||
: 0;
|
|
||||||
};
|
|
||||||
//输入实际收款金额
|
|
||||||
const numTap = (item) => {
|
|
||||||
if (defaultcalc.value === false) {
|
|
||||||
collection.value = "";
|
|
||||||
defaultcalc.value = true;
|
|
||||||
}
|
|
||||||
let x = String(collection.value).indexOf(".") + 1;
|
|
||||||
let y = String(collection.value).length - x;
|
|
||||||
console.log(x, y);
|
|
||||||
if (x === 0 || y < 2) {
|
|
||||||
if (collectionArray.value.join("") <= 9999999) {
|
|
||||||
collectionArray.value.push(item);
|
|
||||||
}
|
|
||||||
collection.value =
|
|
||||||
collectionArray.value.join("") > 99999999
|
|
||||||
? 99999999
|
|
||||||
: collectionArray.value.join("");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// 现金结算
|
|
||||||
const cashBnt = () => {
|
|
||||||
if (
|
|
||||||
changePrice.value === "" ||
|
|
||||||
changePrice.value === null ||
|
|
||||||
changePrice.value === undefined ||
|
|
||||||
+collection.value < +form.value.total
|
|
||||||
)
|
|
||||||
return ElMessage.error("收款金额应该大于等于应收金额");
|
|
||||||
if (order_id.value) orderPay(order_id.value);
|
|
||||||
else
|
|
||||||
orderCreateApi({
|
|
||||||
address_id: "",
|
|
||||||
cart_id: cart_id.value,
|
|
||||||
pay_type: "17", //现金支付 17
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
drawer.value = false;
|
|
||||||
ElMessage({
|
|
||||||
message: res.msg,
|
|
||||||
type: "success",
|
|
||||||
});
|
|
||||||
changeActive(1);
|
|
||||||
beforeClose();
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 监听键盘函数
|
|
||||||
const keyboard = (event) => {
|
|
||||||
let e = event || window.event;
|
|
||||||
let key = e.keyCode;
|
|
||||||
if (key == 37) return changeActive(2);
|
|
||||||
if (key == 120) return mitt.emit("F9");
|
|
||||||
if (key == 27) return beforeClose();
|
|
||||||
event.stopPropagation(); // 阻止事件冒泡传递
|
|
||||||
event.preventDefault(); // 阻止默认事件原有功能
|
|
||||||
switch (key) {
|
|
||||||
case 96:
|
|
||||||
case 48:
|
|
||||||
numTap(0);
|
|
||||||
break;
|
|
||||||
case 97:
|
|
||||||
case 49:
|
|
||||||
numTap(1);
|
|
||||||
break;
|
|
||||||
case 98:
|
|
||||||
case 50:
|
|
||||||
numTap(2);
|
|
||||||
break;
|
|
||||||
case 99:
|
|
||||||
case 51:
|
|
||||||
numTap(3);
|
|
||||||
break;
|
|
||||||
case 100:
|
|
||||||
case 52:
|
|
||||||
numTap(4);
|
|
||||||
break;
|
|
||||||
case 101:
|
|
||||||
case 53:
|
|
||||||
numTap(5);
|
|
||||||
break;
|
|
||||||
case 102:
|
|
||||||
case 54:
|
|
||||||
numTap(6);
|
|
||||||
break;
|
|
||||||
case 103:
|
|
||||||
case 55:
|
|
||||||
numTap(7);
|
|
||||||
break;
|
|
||||||
case 104:
|
|
||||||
case 56:
|
|
||||||
numTap(8);
|
|
||||||
break;
|
|
||||||
case 105:
|
|
||||||
case 57:
|
|
||||||
numTap(9);
|
|
||||||
break;
|
|
||||||
case 110:
|
|
||||||
numTap(".");
|
|
||||||
break;
|
|
||||||
case 190:
|
|
||||||
numTap(".");
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
delNum();
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
cashBnt();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 条码输入框是否聚焦
|
|
||||||
const isFocus = ref(false);
|
|
||||||
|
|
||||||
// 键盘事件
|
|
||||||
const aleft = () => {
|
|
||||||
if (!drawer.value || (isFocus.value && input.value.length > 0)) return;
|
|
||||||
if (active.value == 2) return changeActive(1);
|
|
||||||
};
|
|
||||||
const aright = () => {
|
|
||||||
if (!drawer.value || (isFocus.value && input.value.length > 0)) return;
|
|
||||||
if (active.value == 1) return changeActive(2);
|
|
||||||
};
|
|
||||||
onMounted(() => {
|
|
||||||
mitt.on("left", aleft);
|
|
||||||
mitt.on("right", aright);
|
|
||||||
});
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
mitt.off("left", aleft);
|
|
||||||
mitt.off("right", aright);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<el-drawer
|
|
||||||
size="60rem"
|
|
||||||
v-model="drawer"
|
|
||||||
direction="rtl"
|
|
||||||
@open="open"
|
|
||||||
:before-close="beforeClose"
|
|
||||||
>
|
|
||||||
<template #header>
|
|
||||||
<h4>选择支付方式</h4>
|
|
||||||
</template>
|
|
||||||
<template #default>
|
|
||||||
<div class="dra-body">
|
|
||||||
<div class="header">
|
|
||||||
<div
|
|
||||||
class="left"
|
|
||||||
:class="{ active: active == 1 }"
|
|
||||||
@click="changeActive(1)"
|
|
||||||
>
|
|
||||||
微信/支付宝
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="right"
|
|
||||||
:class="{ active: active == 2 }"
|
|
||||||
@click="changeActive(2)"
|
|
||||||
>
|
|
||||||
现金收款
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="color: #999; padding: 2rem 0 0.3rem 0">应收金额(元):</div>
|
|
||||||
<div style="color: #f5222d; padding-bottom: 2rem">
|
|
||||||
¥<span style="font-size: 1.6rem">{{ form.total }}</span>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-loading="loading"
|
|
||||||
element-loading-text="支付中"
|
|
||||||
class="card1"
|
|
||||||
v-if="active == 1"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
ref="codeRef"
|
|
||||||
v-model="input"
|
|
||||||
autofocus
|
|
||||||
class="code-input"
|
|
||||||
placeholder="请点击输入框聚焦扫码或输入编码号"
|
|
||||||
@keyup.enter="handleEnter"
|
|
||||||
@focus="isFocus = true"
|
|
||||||
@blur="isFocus = false"
|
|
||||||
/>
|
|
||||||
<div class="tips"></div>
|
|
||||||
</div>
|
|
||||||
<div class="card2" v-else>
|
|
||||||
<div class="drawer-body">
|
|
||||||
<div class="counter">
|
|
||||||
<div class="received">
|
|
||||||
<span v-if="collection">{{ collection }}</span>
|
|
||||||
<span v-else style="font-size: 1rem; color: #999"
|
|
||||||
>按下键盘输入客户支付金额</span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div class="balance" v-if="changePrice >= 0">
|
|
||||||
<div>
|
|
||||||
需找零(元):<span class="money">¥{{ changePrice }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="tips">按回车(Enter)确认支付</div>
|
|
||||||
</div>
|
|
||||||
<div class="balance" v-else>
|
|
||||||
<div>不够找零, 请支付更多金额</div>
|
|
||||||
<div class="tips">按下小键盘输入金额</div>
|
|
||||||
</div>
|
|
||||||
<div class="keypad">
|
|
||||||
<div class="left">
|
|
||||||
<el-button
|
|
||||||
v-for="item in numList"
|
|
||||||
:key="item"
|
|
||||||
@click="numTap(item)"
|
|
||||||
>{{ item }}</el-button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div class="right">
|
|
||||||
<el-button @click="delNum"
|
|
||||||
><el-icon><Delete /></el-icon
|
|
||||||
></el-button>
|
|
||||||
<el-button @click="delNum(-1)">C</el-button>
|
|
||||||
<el-button
|
|
||||||
class="enter"
|
|
||||||
:class="{ 'enter-disable': +collection < +form.total }"
|
|
||||||
:disabled="+collection < +form.total"
|
|
||||||
@click="cashBnt"
|
|
||||||
>
|
|
||||||
确认
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #footer>
|
|
||||||
<div style="width: 100%; display: flex; justify-content: center">
|
|
||||||
<el-button class="cancel-btn" @click="cancelClick">取消收款</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-drawer>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.dra-body {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
text-align: center;
|
|
||||||
.header {
|
|
||||||
width: 25rem;
|
|
||||||
display: flex;
|
|
||||||
& > div {
|
|
||||||
flex: 1;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
text-align: center;
|
|
||||||
padding: 0.6rem 0;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.left {
|
|
||||||
border-right: none;
|
|
||||||
border-radius: 5rem 0 0 5rem;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
border-left: none;
|
|
||||||
border-radius: 0 5rem 5rem 0;
|
|
||||||
}
|
|
||||||
.active {
|
|
||||||
background-color: #1890ff;
|
|
||||||
color: #fff;
|
|
||||||
transition: 300ms;
|
|
||||||
border-color: #1890ff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.card1 {
|
|
||||||
.code-input {
|
|
||||||
width: 100%;
|
|
||||||
height: 3rem;
|
|
||||||
}
|
|
||||||
.tips {
|
|
||||||
width: 38rem;
|
|
||||||
height: 16rem;
|
|
||||||
background: url("@/assets/pay.png");
|
|
||||||
background-size: 100% 100%;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.cancel-btn {
|
|
||||||
width: 60%;
|
|
||||||
border-color: #1890ff;
|
|
||||||
color: #1890ff;
|
|
||||||
border-radius: 5rem;
|
|
||||||
height: 3rem;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drawer-body {
|
|
||||||
width: 100%;
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.counter {
|
|
||||||
padding: 1.25rem;
|
|
||||||
border-radius: 1.25rem;
|
|
||||||
background-color: #f3f9ff;
|
|
||||||
|
|
||||||
.received {
|
|
||||||
height: 3rem;
|
|
||||||
padding: 0 1.25rem;
|
|
||||||
border: 1px solid #1890ff;
|
|
||||||
box-shadow: 0 0 0.18rem #1890ff;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
background-color: #ffffff;
|
|
||||||
font-size: 1.62rem;
|
|
||||||
line-height: 3rem;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.balance {
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 1.12rem 0 1.12rem 0.625rem;
|
|
||||||
text-align: start;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
color: #303133;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.money {
|
|
||||||
color: #ff4a00;
|
|
||||||
}
|
|
||||||
.tips {
|
|
||||||
font-size: 0.8rem;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.keypad {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: auto auto auto auto;
|
|
||||||
grid-gap: 0.625rem;
|
|
||||||
|
|
||||||
.left {
|
|
||||||
grid-column-end: span 3;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: auto auto auto;
|
|
||||||
grid-gap: 0.625rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: auto;
|
|
||||||
grid-gap: 0.625rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-button {
|
|
||||||
height: 3.875rem;
|
|
||||||
width: 8.125rem;
|
|
||||||
margin: 0 !important;
|
|
||||||
border: 0;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 1.75rem !important;
|
|
||||||
line-height: 3.87rem;
|
|
||||||
color: #1890ff;
|
|
||||||
|
|
||||||
&:focus {
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.enter {
|
|
||||||
grid-row-end: span 4;
|
|
||||||
height: 8.37rem;
|
|
||||||
line-height: 8.37rem;
|
|
||||||
background-color: #1890ff;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 1.35rem !important;
|
|
||||||
color: #ffffff;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.enter-disable {
|
|
||||||
background-color: #ccc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,6 +0,0 @@
|
||||||
const config = {
|
|
||||||
url: import.meta.env.VITE_BASE_URL + '/api',
|
|
||||||
upload: import.meta.env.VITE_BASE_URL + '/api/upload/image/field',
|
|
||||||
}
|
|
||||||
|
|
||||||
export default config;
|
|
|
@ -1,113 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import myHeader from "./myHeader.vue";
|
|
||||||
import myAside from "./myAside.vue";
|
|
||||||
import { ref, nextTick, onMounted, onUnmounted } from "vue";
|
|
||||||
import mitt from "@/utils/mitt.js";
|
|
||||||
import { useUserStore } from "@/store/user.js";
|
|
||||||
import { Push } from "@/common/push.js";
|
|
||||||
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const connection = new Push({
|
|
||||||
url: import.meta.env.VITE_PUSH_URL, // websocket地址
|
|
||||||
app_key: '2ce3ce22329517213caa7dad261f5695',
|
|
||||||
});
|
|
||||||
|
|
||||||
// 浏览器监听user-1
|
|
||||||
const user_channel = connection.subscribe(`store_merchant_${userStore.userInfo.merchant.mer_id}`);
|
|
||||||
// const user_channel = connection.subscribe(`store_merchant_${1}`);
|
|
||||||
|
|
||||||
// 当user-2频道有message事件的消息时
|
|
||||||
user_channel.on('message', function (data) {
|
|
||||||
console.log("收到消息--",data);
|
|
||||||
try {
|
|
||||||
if(data?.content?.type=='cash_register'&&data?.content?.msg=="您有一笔订单已支付"){
|
|
||||||
mitt.emit('pay_success', data?.content?.data);
|
|
||||||
}
|
|
||||||
if(data?.content?.type=='store_merchant'&&data?.content?.msg=="您有一笔新的订单"){
|
|
||||||
mitt.emit('new_order', data?.content);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 断线事件
|
|
||||||
user_channel.on('close', function () {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
const KeyboardEvent = (e)=>{
|
|
||||||
console.log('按下', e.keyCode);
|
|
||||||
if(e.keyCode == 16) mitt.emit('shift');
|
|
||||||
if(e.keyCode == 120) mitt.emit('F9');
|
|
||||||
if(e.keyCode == 13) mitt.emit('enter');
|
|
||||||
if(e.keyCode == 37) mitt.emit('left');
|
|
||||||
if(e.keyCode == 39) mitt.emit('right');
|
|
||||||
if(e.keyCode == 38) mitt.emit('up');
|
|
||||||
if(e.keyCode == 40) mitt.emit('down');
|
|
||||||
if(e.keyCode == 46) mitt.emit('delete');
|
|
||||||
if(e.keyCode == 45) mitt.emit('insert');
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(()=>{
|
|
||||||
window.addEventListener('keydown', KeyboardEvent);
|
|
||||||
console.log('开启键盘监听');
|
|
||||||
})
|
|
||||||
|
|
||||||
onUnmounted(()=>{
|
|
||||||
window.removeEventListener('keydown', KeyboardEvent);
|
|
||||||
console.log('关闭键盘监听');
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="common-layout">
|
|
||||||
<el-container>
|
|
||||||
<el-header>
|
|
||||||
<myHeader></myHeader>
|
|
||||||
</el-header>
|
|
||||||
<el-container>
|
|
||||||
<el-aside width="6.25rem">
|
|
||||||
<myAside></myAside>
|
|
||||||
</el-aside>
|
|
||||||
<el-main style="color: #333;">
|
|
||||||
<router-view v-slot="{ Component }" class="my-main">
|
|
||||||
<transition name="el-zoom-in-top">
|
|
||||||
<component :is="Component"></component>
|
|
||||||
</transition>
|
|
||||||
</router-view>
|
|
||||||
<!-- <transition name="el-zoom-in-top">
|
|
||||||
<router-view class="my-main"></router-view>
|
|
||||||
</transition> -->
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
</el-container>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.common-layout {
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
background-color: #001529;
|
|
||||||
.el-header {
|
|
||||||
color: #fff;
|
|
||||||
height: 4rem;
|
|
||||||
}
|
|
||||||
.el-aside {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.el-main {
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
width: calc(100vw - 6.25rem);
|
|
||||||
height: calc(100vh - 4rem);
|
|
||||||
border-radius: 2rem 0 0 0;
|
|
||||||
overflow-y: scroll;
|
|
||||||
padding: 1rem;
|
|
||||||
|
|
||||||
.my-main {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,170 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { useRoute, useRouter } from "vue-router";
|
|
||||||
import { ref, onMounted, onUnmounted } from "vue";
|
|
||||||
import mitt from "@/utils/mitt.js";
|
|
||||||
import { useOrderStore } from "@/store/order.js";
|
|
||||||
import { merchantOrderCountApi } from "@/api/store.js";
|
|
||||||
import { ElMessage } from "element-plus";
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const orderStore = useOrderStore();
|
|
||||||
// setInterval(()=>{
|
|
||||||
// setOrderCount(+orderStore.orderCount + 1)
|
|
||||||
// }, 2000)
|
|
||||||
|
|
||||||
const setOrderCount = (e = 1) => {
|
|
||||||
orderStore.setOrderCount(e)
|
|
||||||
list.value.forEach(item=>{
|
|
||||||
if(item.name == "order") item.count = e;
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
let isPlaying = false;
|
|
||||||
const newOrder = (e) => {
|
|
||||||
merchantOrderCountApi().then((res) => {
|
|
||||||
setOrderCount(res?.data?.order_count || 0);
|
|
||||||
});
|
|
||||||
ElMessage.success('您有新的订单');
|
|
||||||
if (isPlaying) return; //正在播放时有新订单直接跳过播放
|
|
||||||
// 创建音频对象
|
|
||||||
var audio = new Audio("/src/assets/order.mp3");
|
|
||||||
// 播放音频
|
|
||||||
audio.play();
|
|
||||||
isPlaying = true;
|
|
||||||
// 添加ended事件监听器来检测播放结束
|
|
||||||
audio.addEventListener('ended', function() {
|
|
||||||
isPlaying = false;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
newOrder({
|
|
||||||
msg: "您有一笔新的订单",
|
|
||||||
});
|
|
||||||
}, 2000);
|
|
||||||
|
|
||||||
const navTo = (name) => {
|
|
||||||
router.push({ name });
|
|
||||||
};
|
|
||||||
const list = ref([
|
|
||||||
{ name: "saleHome", title: "收银", ico: "Sell", count: 0 },
|
|
||||||
{ name: "saleOrder", title: "收银订单", ico: "DataLine", count: 0 },
|
|
||||||
{
|
|
||||||
name: "order",
|
|
||||||
title: "摊贩订单",
|
|
||||||
ico: "DataAnalysis",
|
|
||||||
count: +orderStore.orderCount,
|
|
||||||
},
|
|
||||||
{ name: "purchaseOrder", title: "采购订单", ico: "Van", count: 0 },
|
|
||||||
{ name: "orderCount", title: "订单统计", ico: "DocumentRemove", count: 0 },
|
|
||||||
{ name: "wallet", title: "余额提现", ico: "Wallet", count: 0 },
|
|
||||||
// { name: "test", title: "打印", ico: "Tickets", count: 0 },
|
|
||||||
]);
|
|
||||||
const aup = () => {
|
|
||||||
let index = list.value.findIndex((item) => item.name == route.name);
|
|
||||||
if (index == 0) index = list.value.length;
|
|
||||||
if (index > 0) navTo(list.value[index - 1].name);
|
|
||||||
};
|
|
||||||
const adown = () => {
|
|
||||||
let index = list.value.findIndex((item) => item.name == route.name);
|
|
||||||
if (index == list.value.length - 1) index = -1;
|
|
||||||
if (index < list.value.length - 1) navTo(list.value[index + 1].name);
|
|
||||||
};
|
|
||||||
onMounted(() => {
|
|
||||||
mitt.on("up", aup);
|
|
||||||
mitt.on("down", adown);
|
|
||||||
mitt.on("new_order", newOrder);
|
|
||||||
mitt.on("set-order-count-zero", ()=>{
|
|
||||||
setOrderCount(0);
|
|
||||||
});
|
|
||||||
merchantOrderCountApi().then((res) => {
|
|
||||||
setOrderCount(res?.data?.order_count || 0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
mitt.off("aup", aup);
|
|
||||||
mitt.off("adown", adown);
|
|
||||||
mitt.off("new_order", newOrder);
|
|
||||||
mitt.on("set-order-count-zero");
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="my-card">
|
|
||||||
<div
|
|
||||||
v-for="item in list"
|
|
||||||
:key="item.name"
|
|
||||||
class="list-item"
|
|
||||||
:class="{ active: route.name == item.name }"
|
|
||||||
@click="navTo(item.name)"
|
|
||||||
>
|
|
||||||
<el-icon size="2rem">
|
|
||||||
<component :is="item.ico" />
|
|
||||||
</el-icon>
|
|
||||||
<div>{{ item.title }}</div>
|
|
||||||
<div v-if="item.count" class="badge">{{ item.count }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.my-card {
|
|
||||||
width: 100%;
|
|
||||||
height: calc(100vh - 100px);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
padding-top: 1.5rem;
|
|
||||||
overflow: auto;
|
|
||||||
.list-item {
|
|
||||||
width: 4.5rem;
|
|
||||||
height: 4.5rem;
|
|
||||||
border-radius: 0.7rem;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 1.2rem;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background-color: #1890ff;
|
|
||||||
transition: 300ms;
|
|
||||||
}
|
|
||||||
.badge {
|
|
||||||
position: absolute;
|
|
||||||
top: -0.5rem;
|
|
||||||
right: -0.5rem;
|
|
||||||
background-color: #ff4a00;
|
|
||||||
font-size: 0.7rem;
|
|
||||||
padding: 0.2rem 0.5rem;
|
|
||||||
border-radius: 2rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* 修改滚动条的样式 */
|
|
||||||
::-webkit-scrollbar {
|
|
||||||
display: none; /* 隐藏滚动条 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 设置滚动条的轨道样式 */
|
|
||||||
::-webkit-scrollbar-track {
|
|
||||||
background-color: #f1f1f1; /* 设置轨道的背景色 */
|
|
||||||
margin: 1.25rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 设置滚动条的滑块样式 */
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
background-color: #ccc; /* 设置滑块的背景色 */
|
|
||||||
border-radius: 0.315rem; /* 设置滑块的圆角 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 设置滚动条鼠标悬停时的滑块样式 */
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
|
||||||
background-color: #999; /* 设置鼠标悬停时滑块的背景色 */
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,210 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { useUserStore } from "@/store/user.js";
|
|
||||||
import { onMounted, onUnmounted, ref } from "vue";
|
|
||||||
import { info, logout } from "@/api/user.js";
|
|
||||||
import { ElMessage } from "element-plus";
|
|
||||||
import { useRouter } from "vue-router";
|
|
||||||
import mitt from "@/utils/mitt.js";
|
|
||||||
import { usePrintStore } from "@/store/print.js";
|
|
||||||
import { printTicket } from "@/utils/EscPos.js";
|
|
||||||
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const printStore = usePrintStore();
|
|
||||||
|
|
||||||
const merInfo = ref({});
|
|
||||||
merInfo.value = userStore.userInfo;
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const onLogout = () => {
|
|
||||||
userStore.setUserInfo({});
|
|
||||||
userStore.setToken("");
|
|
||||||
router.push("/login");
|
|
||||||
};
|
|
||||||
|
|
||||||
const onRefresh = () => {
|
|
||||||
window.location.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
const dialogVisible = ref(false); //是否显示重新连接
|
|
||||||
|
|
||||||
// 连接打印机
|
|
||||||
const connect = () => {
|
|
||||||
console.log("连接打印机");
|
|
||||||
uni.getEnv((res) => {
|
|
||||||
if (res.h5) ElMessage.error("请使用APP连接打印机");
|
|
||||||
else {
|
|
||||||
printStore.setConnect(false);
|
|
||||||
printStore.setPrintAddress('');
|
|
||||||
dialogVisible.value = false;
|
|
||||||
uni.postMessage({
|
|
||||||
data: {
|
|
||||||
type: "connect",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
let isPrint = false; //是否正在打印小票
|
|
||||||
// 预打印
|
|
||||||
const printReceipt = (content = "") => {
|
|
||||||
console.log("预打印");
|
|
||||||
console.log(printTicket(content, true));
|
|
||||||
if (isPrint) return;
|
|
||||||
isPrint = true;
|
|
||||||
uni.getEnv((res) => {
|
|
||||||
if (res.h5) {
|
|
||||||
ElMessage.error("请使用APP打印小票");
|
|
||||||
isPrint = false;
|
|
||||||
} else {
|
|
||||||
APPprint(content);
|
|
||||||
setTimeout(() => {
|
|
||||||
isPrint = false;
|
|
||||||
}, 4000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// APP打印
|
|
||||||
const APPprint = (content = "") => {
|
|
||||||
let str = "";
|
|
||||||
if (content === "") {
|
|
||||||
str = printTicket({}, true); //打印自检
|
|
||||||
console.log(str);
|
|
||||||
} else str = content;
|
|
||||||
uni.postMessage({
|
|
||||||
data: {
|
|
||||||
type: "print",
|
|
||||||
content: str,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
mitt.on("printReceipt", printReceipt);
|
|
||||||
// 监听消息
|
|
||||||
window.addEventListener(
|
|
||||||
"message",
|
|
||||||
function (event) {
|
|
||||||
// alert(JSON.stringify(event.data));
|
|
||||||
if (event.data.type === "connect") {
|
|
||||||
let str = event.data.data.address;
|
|
||||||
printStore.setConnect(true);
|
|
||||||
printStore.setPrintAddress(str);
|
|
||||||
ElMessage.success("已连接打印机T58("+str+")");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
mitt.off("printReceipt", printReceipt);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="my-card">
|
|
||||||
<div class="card-header">
|
|
||||||
<div style="width: 4.5rem">
|
|
||||||
<el-image
|
|
||||||
style="height: 2.5rem; width: 2.5rem; margin: 0 auto"
|
|
||||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/12c93202404101530591311.png"
|
|
||||||
></el-image>
|
|
||||||
</div>
|
|
||||||
<div class="card-title">泸优采收银系统</div>
|
|
||||||
<div
|
|
||||||
style="
|
|
||||||
margin-left: 1rem;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
cursor: pointer;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<el-icon color="#fff" size="18" @click="onRefresh"><Refresh /></el-icon>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div style="margin-right: 1rem">
|
|
||||||
<el-button @click="mitt.emit('printReceipt')" type="primary">
|
|
||||||
<span>打印自检</span>
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
<div style="margin-right: 1rem" v-if="!printStore.is_connect||!printStore.printAddress">
|
|
||||||
<el-button @click="connect" type="warning">
|
|
||||||
<span>点击自动连接打印机</span>
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
<div style="margin-right: 1rem;font-size: 0.9rem;" v-else @click="dialogVisible = true">
|
|
||||||
<div>已连接打印机T58</div>
|
|
||||||
<div style="font-size: 0.7rem;color: #ccc;">({{ printStore.printAddress }})</div>
|
|
||||||
</div>
|
|
||||||
<el-dialog v-model="dialogVisible" title="提示" width="500">
|
|
||||||
<span>打印机已连接,是否重新连接</span>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
|
||||||
<el-button type="primary" @click="connect"> 重新连接 </el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
<el-dropdown trigger="hover">
|
|
||||||
<div class="el-dropdown-link">
|
|
||||||
<el-avatar :src="merInfo.avatar" icon="user-filled" />
|
|
||||||
<div class="info">
|
|
||||||
<div>
|
|
||||||
{{ merInfo.merchant.mer_name }}
|
|
||||||
</div>
|
|
||||||
<div>{{ merInfo.merchant.service_phone }}</div>
|
|
||||||
</div>
|
|
||||||
<el-icon class="el-icon--right">
|
|
||||||
<arrow-down />
|
|
||||||
</el-icon>
|
|
||||||
</div>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu>
|
|
||||||
<el-dropdown-item @click="onLogout">退出登录</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.my-card {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
.card-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
.card-title {
|
|
||||||
font-size: 1.6rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.card-body {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.el-dropdown-link {
|
|
||||||
width: auto;
|
|
||||||
display: flex;
|
|
||||||
color: #fff;
|
|
||||||
align-items: center;
|
|
||||||
.info {
|
|
||||||
margin: 0 0.5rem;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-around;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.el-dropdown {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
23
src/main.ts
|
@ -1,23 +0,0 @@
|
||||||
import { createApp } from 'vue'
|
|
||||||
import './style.css'
|
|
||||||
import App from './App.vue'
|
|
||||||
import ElementPlus from 'element-plus'
|
|
||||||
import 'element-plus/dist/index.css'
|
|
||||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
||||||
import router from './router'
|
|
||||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
|
||||||
import { createPinia } from 'pinia'
|
|
||||||
const app = createApp(App)
|
|
||||||
|
|
||||||
// 注册图标
|
|
||||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
||||||
app.component(key, component)
|
|
||||||
}
|
|
||||||
const pinia = createPinia();
|
|
||||||
|
|
||||||
app.use(router)
|
|
||||||
app.use(pinia)
|
|
||||||
app.use(ElementPlus, {
|
|
||||||
locale: zhCn,
|
|
||||||
})
|
|
||||||
app.mount('#app')
|
|
|
@ -1,87 +0,0 @@
|
||||||
import { createRouter, createWebHashHistory } from 'vue-router';
|
|
||||||
import layout from '@/layout/index.vue';
|
|
||||||
import { useUserStore } from '@/store/user.js';
|
|
||||||
|
|
||||||
|
|
||||||
const routes = [
|
|
||||||
{
|
|
||||||
path: '/',
|
|
||||||
name: 'layout',
|
|
||||||
component: layout,
|
|
||||||
redirect: '/saleHome',
|
|
||||||
meta: { title: '里海收银系统' },
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '/saleHome',
|
|
||||||
name: 'saleHome',
|
|
||||||
meta: { title: '收银' },
|
|
||||||
component: () => import('@/views/saleHome/index.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/saleOrder',
|
|
||||||
name: 'saleOrder',
|
|
||||||
meta: { title: '采购订单' },
|
|
||||||
component: () => import('@/views/saleOrder/index.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/order',
|
|
||||||
name: 'order',
|
|
||||||
meta: { title: '待提采购' },
|
|
||||||
component: () => import('@/views/order/index.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/purchaseOrder',
|
|
||||||
name: 'purchaseOrder',
|
|
||||||
meta: { title: '采购订单' },
|
|
||||||
component: () => import('@/views/purchaseOrder/index.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/orderCount',
|
|
||||||
name: 'orderCount',
|
|
||||||
meta: { title: '订单统计' },
|
|
||||||
component: () => import('@/views/saleOrder/indexCount.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/wallet',
|
|
||||||
name: 'wallet',
|
|
||||||
meta: { title: '提现' },
|
|
||||||
component: () => import('@/views/wallet/index.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/test',
|
|
||||||
name: 'test',
|
|
||||||
component: () => import('@/views/test/test.vue'),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/login',
|
|
||||||
name: 'login',
|
|
||||||
component: () => import('@/views/login/index.vue'),
|
|
||||||
},
|
|
||||||
// 注意:通配符路由要放在最后
|
|
||||||
{
|
|
||||||
path: '/:catchAll(.*)',
|
|
||||||
name: 'notFound',
|
|
||||||
component: () => import('@/views/notFound/index.vue') // 使用 404 页面组件
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const router = createRouter({
|
|
||||||
history: createWebHashHistory(),
|
|
||||||
routes
|
|
||||||
});
|
|
||||||
|
|
||||||
// 全局前置守卫
|
|
||||||
router.beforeEach((to, from, next) => {
|
|
||||||
const userStore = useUserStore();
|
|
||||||
|
|
||||||
// 如果用户访问的不是登录页面,并且未登录,则重定向到登录页面
|
|
||||||
if (to.name !== 'login' && !userStore.Token) {
|
|
||||||
next({ name: 'login' });
|
|
||||||
} else {
|
|
||||||
next(); // 放行
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default router;
|
|
|
@ -1,18 +0,0 @@
|
||||||
import { defineStore } from "pinia"
|
|
||||||
import { ref } from "vue"
|
|
||||||
|
|
||||||
export const useOrderStore = defineStore('order', () => {
|
|
||||||
|
|
||||||
const orderCount = ref(localStorage.getItem('orderCount')||0);
|
|
||||||
|
|
||||||
|
|
||||||
const setOrderCount = (e)=>{
|
|
||||||
orderCount.value = e;
|
|
||||||
localStorage.setItem('orderCount',e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
orderCount,
|
|
||||||
setOrderCount
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -1,26 +0,0 @@
|
||||||
import { defineStore } from "pinia"
|
|
||||||
import { ref } from "vue"
|
|
||||||
|
|
||||||
export const usePrintStore = defineStore('print', () => {
|
|
||||||
|
|
||||||
const is_connect = ref(localStorage.getItem('is_connect'));
|
|
||||||
const printAddress = ref(localStorage.getItem('print_address'));
|
|
||||||
|
|
||||||
|
|
||||||
const setConnect = (e)=>{
|
|
||||||
is_connect.value = e;
|
|
||||||
localStorage.setItem('is_connect',e);
|
|
||||||
}
|
|
||||||
|
|
||||||
const setPrintAddress = (e)=>{
|
|
||||||
printAddress.value = e;
|
|
||||||
localStorage.setItem('print_address',e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
is_connect,
|
|
||||||
setConnect,
|
|
||||||
printAddress,
|
|
||||||
setPrintAddress
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -1,24 +0,0 @@
|
||||||
import { defineStore } from "pinia"
|
|
||||||
import { ref } from "vue"
|
|
||||||
|
|
||||||
export const useUserStore = defineStore('user', () => {
|
|
||||||
const userInfo = ref(JSON.parse(localStorage.getItem('userInfo') || '{}'));
|
|
||||||
|
|
||||||
const Token = ref(localStorage.getItem('Token'));
|
|
||||||
|
|
||||||
const setUserInfo = (e)=>{
|
|
||||||
userInfo.value = e;
|
|
||||||
localStorage.setItem('userInfo',JSON.stringify(e));
|
|
||||||
}
|
|
||||||
const setToken = (e)=>{
|
|
||||||
Token.value = e;
|
|
||||||
localStorage.setItem('Token',e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
userInfo,
|
|
||||||
Token,
|
|
||||||
setUserInfo,
|
|
||||||
setToken
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -1,74 +0,0 @@
|
||||||
:root {
|
|
||||||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
||||||
line-height: 1.5;
|
|
||||||
font-weight: 400;
|
|
||||||
|
|
||||||
color-scheme: light dark;
|
|
||||||
color: rgba(255, 255, 255, 0.87);
|
|
||||||
background-color: #242424;
|
|
||||||
|
|
||||||
font-synthesis: none;
|
|
||||||
text-rendering: optimizeLegibility;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
font-weight: 500;
|
|
||||||
color: #646cff;
|
|
||||||
text-decoration: inherit;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #535bf2;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
display: flex;
|
|
||||||
place-items: center;
|
|
||||||
min-width: 320px;
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 3.2em;
|
|
||||||
line-height: 1.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
padding: 0.6em 1.2em;
|
|
||||||
font-size: 1em;
|
|
||||||
font-weight: 500;
|
|
||||||
font-family: inherit;
|
|
||||||
background-color: #1a1a1a;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: border-color 0.25s;
|
|
||||||
}
|
|
||||||
button:hover {
|
|
||||||
border-color: #646cff;
|
|
||||||
}
|
|
||||||
button:focus,
|
|
||||||
button:focus-visible {
|
|
||||||
outline: 4px auto -webkit-focus-ring-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
padding: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: light) {
|
|
||||||
:root {
|
|
||||||
color: #213547;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #747bff;
|
|
||||||
}
|
|
||||||
button {
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
import * as Esc from "@/utils/EscPostUtils.js";
|
|
||||||
|
|
||||||
const testObj = {
|
|
||||||
mer_name: "莲花农贸市场", //商户名称
|
|
||||||
service_phone: "0830-2669767", //客服电话
|
|
||||||
number: "PF171568087790938356", //单号
|
|
||||||
create_time: "2024-5-15 18:00:32", //下单时间
|
|
||||||
total_price: "29.96", //总价
|
|
||||||
pay_price: "29.96", //实付
|
|
||||||
pay_type: "微信支付", //支付方式
|
|
||||||
pay_number: "4200002159202405159003084211", //支付单号
|
|
||||||
goods: [
|
|
||||||
{
|
|
||||||
name: "白菜 大白菜", //商品名称
|
|
||||||
sell: "236.60", //单价
|
|
||||||
nums: "13", //数量
|
|
||||||
unit_name: "kg", //单位
|
|
||||||
total: "2896.34" //小计
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "小黄鸭", //商品名称
|
|
||||||
sell: "9.56", //单价
|
|
||||||
nums: "2", //数量
|
|
||||||
unit_name: "只", //单位
|
|
||||||
total: "19.38" //小计
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "卷心菜", //商品名称
|
|
||||||
sell: "15.37", //单价
|
|
||||||
nums: "8", //数量
|
|
||||||
unit_name: "斤", //单位
|
|
||||||
total: "134.38" //小计
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
export const printTicket = (obj = {}, test = false) => {
|
|
||||||
let str = "";
|
|
||||||
if(!obj || !obj.number) obj = testObj;
|
|
||||||
str += Esc.Size2(0) + Esc.Center() + Esc.boldFontOn() + obj.mer_name + "\n";
|
|
||||||
str += Esc.fillLine(" ") + Esc.boldFontOff() + "\n";
|
|
||||||
str += Esc.Left() + "单号: " + obj.number + "\n";
|
|
||||||
str += Esc.Left() + "下单时间: " + obj.create_time + "\n";
|
|
||||||
|
|
||||||
// 商品信息
|
|
||||||
str += Esc.fillLine("=") + "\n";
|
|
||||||
|
|
||||||
str += Esc.inline3("单价", "数量", "小计", " ", 1) + "\n";
|
|
||||||
obj.goods.forEach(item => {
|
|
||||||
str += Esc.Left() + item.name + "\n";
|
|
||||||
str += Esc.inline3(`${item.sell}元`, `${item.nums}${item.unit_name}`, `${item.total}元`, " ", 1) + "\n";
|
|
||||||
})
|
|
||||||
|
|
||||||
str += Esc.fillLine("=") + "\n";
|
|
||||||
|
|
||||||
str += Esc.Left() + "应付款: " + obj.total_price + "元" + "\n";
|
|
||||||
str += Esc.Left() + "实付款: " + obj.pay_price + "元" + "\n";
|
|
||||||
str += Esc.Left() + "支付方式: " + obj.pay_type + "\n";
|
|
||||||
str += Esc.Left() + "支付单号: " + obj.pay_number + "\n";
|
|
||||||
str += Esc.Left() + "联系电话: " + obj.service_phone + "\n";
|
|
||||||
str += Esc.fillLine("=") + "\n";
|
|
||||||
|
|
||||||
// 票尾
|
|
||||||
str += Esc.fillLine(" ") + "\n";
|
|
||||||
str += Esc.Center() + "欢迎下次光临!" + "\n";
|
|
||||||
str += Esc.feedLines(" ") + "\n";
|
|
||||||
// 切纸
|
|
||||||
str += Esc.cutPaper();
|
|
||||||
return str;
|
|
||||||
}
|
|
|
@ -1,288 +0,0 @@
|
||||||
// 此为指令集, 如非必要请不要进行修改操作, 以免打印效果异常
|
|
||||||
|
|
||||||
// 打印机纸宽58mm,页的宽度384,字符宽度为1,每行最多盛放32个字符
|
|
||||||
// 打印机纸宽80mm,页的宽度576,字符宽度为1,每行最多盛放48个字符
|
|
||||||
const PAGE_WIDTH = 384;
|
|
||||||
const MAX_CHAR_COUNT_EACH_LINE = 32;
|
|
||||||
|
|
||||||
//字符串转字节序列
|
|
||||||
export function stringToByte(str) {
|
|
||||||
var bytes = new Array();
|
|
||||||
var len, c;
|
|
||||||
len = str.length;
|
|
||||||
for (var i = 0; i < len; i++) {
|
|
||||||
c = str.charCodeAt(i);
|
|
||||||
if (c >= 0x010000 && c <= 0x10FFFF) {
|
|
||||||
bytes.push(((c >> 18) & 0x07) | 0xF0);
|
|
||||||
bytes.push(((c >> 12) & 0x3F) | 0x80);
|
|
||||||
bytes.push(((c >> 6) & 0x3F) | 0x80);
|
|
||||||
bytes.push((c & 0x3F) | 0x80);
|
|
||||||
} else if (c >= 0x000800 && c <= 0x00FFFF) {
|
|
||||||
bytes.push(((c >> 12) & 0x0F) | 0xE0);
|
|
||||||
bytes.push(((c >> 6) & 0x3F) | 0x80);
|
|
||||||
bytes.push((c & 0x3F) | 0x80);
|
|
||||||
} else if (c >= 0x000080 && c <= 0x0007FF) {
|
|
||||||
bytes.push(((c >> 6) & 0x1F) | 0xC0);
|
|
||||||
bytes.push((c & 0x3F) | 0x80);
|
|
||||||
} else {
|
|
||||||
bytes.push(c & 0xFF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
//字节序列转ASCII码
|
|
||||||
//[0x24, 0x26, 0x28, 0x2A] ==> "$&C*"
|
|
||||||
export function byteToString(arr) {
|
|
||||||
if (typeof arr === 'string') {
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
var str = '',
|
|
||||||
_arr = arr;
|
|
||||||
for (var i = 0; i < _arr.length; i++) {
|
|
||||||
var one = _arr[i].toString(2),
|
|
||||||
v = one.match(/^1+?(?=0)/);
|
|
||||||
if (v && one.length == 8) {
|
|
||||||
var bytesLength = v[0].length;
|
|
||||||
var store = _arr[i].toString(2).slice(7 - bytesLength);
|
|
||||||
for (var st = 1; st < bytesLength; st++) {
|
|
||||||
store += _arr[st + i].toString(2).slice(2);
|
|
||||||
}
|
|
||||||
str += String.fromCharCode(parseInt(store, 2));
|
|
||||||
i += bytesLength - 1;
|
|
||||||
} else {
|
|
||||||
str += String.fromCharCode(_arr[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
//居中
|
|
||||||
export function Center() {
|
|
||||||
var Center = [];
|
|
||||||
Center.push(27);
|
|
||||||
Center.push(97);
|
|
||||||
Center.push(1);
|
|
||||||
var strCenter = byteToString(Center);
|
|
||||||
return strCenter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//居左
|
|
||||||
export function Left() {
|
|
||||||
var Left = [];
|
|
||||||
Left.push(27);
|
|
||||||
Left.push(97);
|
|
||||||
Left.push(0);
|
|
||||||
var strLeft = byteToString(Left);
|
|
||||||
return strLeft;
|
|
||||||
}
|
|
||||||
//居右
|
|
||||||
export function Right() {
|
|
||||||
var right = [];
|
|
||||||
Left.push(27);
|
|
||||||
Left.push(97);
|
|
||||||
Left.push(2);
|
|
||||||
var strRight = byteToString(right);
|
|
||||||
return strRight;
|
|
||||||
}
|
|
||||||
//标准字体
|
|
||||||
export function Size1() {
|
|
||||||
var Size1 = [];
|
|
||||||
Size1.push(29);
|
|
||||||
Size1.push(33);
|
|
||||||
Size1.push(0);
|
|
||||||
var strSize1 = byteToString(Size1);
|
|
||||||
return strSize1;
|
|
||||||
}
|
|
||||||
//大号字体
|
|
||||||
/* 放大1倍 n = 0
|
|
||||||
* 长宽各放大2倍 n = 17 */
|
|
||||||
export function Size2(n) {
|
|
||||||
var Size2 = [];
|
|
||||||
Size2.push(29);
|
|
||||||
Size2.push(33);
|
|
||||||
Size2.push(n);
|
|
||||||
var strSize2 = byteToString(Size2);
|
|
||||||
return strSize2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 字体加粗
|
|
||||||
export function boldFontOn() {
|
|
||||||
var arr = []
|
|
||||||
arr.push(27)
|
|
||||||
arr.push(69)
|
|
||||||
arr.push(1)
|
|
||||||
var cmd = byteToString(arr);
|
|
||||||
return cmd
|
|
||||||
}
|
|
||||||
// 取消字体加粗
|
|
||||||
export function boldFontOff() {
|
|
||||||
var arr = []
|
|
||||||
arr.push(27)
|
|
||||||
arr.push(69)
|
|
||||||
arr.push(0)
|
|
||||||
var cmd = byteToString(arr);
|
|
||||||
return cmd
|
|
||||||
}
|
|
||||||
// 打印并走纸n行
|
|
||||||
export function feedLines(n = 1) {
|
|
||||||
var feeds = []
|
|
||||||
feeds.push(27)
|
|
||||||
feeds.push(100)
|
|
||||||
feeds.push(n)
|
|
||||||
var printFeedsLines = byteToString(feeds);
|
|
||||||
return printFeedsLines
|
|
||||||
}
|
|
||||||
// 切纸
|
|
||||||
export function cutPaper() {
|
|
||||||
var cut = []
|
|
||||||
cut.push(29)
|
|
||||||
cut.push(86)
|
|
||||||
cut.push(49)
|
|
||||||
var cutType = byteToString(cut);
|
|
||||||
return cutType
|
|
||||||
}
|
|
||||||
|
|
||||||
// 开钱箱
|
|
||||||
export function open_money_box() {
|
|
||||||
var open = []
|
|
||||||
open.push(27)
|
|
||||||
open.push(112)
|
|
||||||
open.push(0)
|
|
||||||
open.push(60)
|
|
||||||
open.push(255)
|
|
||||||
var openType = byteToString(open)
|
|
||||||
return openType
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化打印机
|
|
||||||
export function init() {
|
|
||||||
var arr = []
|
|
||||||
arr.push(27)
|
|
||||||
arr.push(68)
|
|
||||||
arr.push(0)
|
|
||||||
var str = byteToString(arr)
|
|
||||||
return str
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
设置左边距
|
|
||||||
len:
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function setLeftMargin(len = 1) {
|
|
||||||
var arr = []
|
|
||||||
arr.push(29)
|
|
||||||
arr.push(76)
|
|
||||||
arr.push(len)
|
|
||||||
var str = byteToString(arr)
|
|
||||||
return str
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置打印区域宽度
|
|
||||||
export function setPrintAreaWidth(width) {
|
|
||||||
var arr = []
|
|
||||||
arr.push(29)
|
|
||||||
arr.push(87)
|
|
||||||
arr.push(width)
|
|
||||||
var str = byteToString(arr)
|
|
||||||
return str
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param str
|
|
||||||
* @returns {boolean} str是否全是中文
|
|
||||||
*/
|
|
||||||
export function isChinese(str) {
|
|
||||||
return /^[\u4e00-\u9fa5]$/.test(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
// str是否全含中文或者中文标点
|
|
||||||
export function isHaveChina(str) {
|
|
||||||
if (escape(str).indexOf("%u") < 0) {
|
|
||||||
return 0
|
|
||||||
} else {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 返回字符串宽度(1个中文=2个英文字符)
|
|
||||||
* @param str
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
export function getStringWidth(str) {
|
|
||||||
let width = 0;
|
|
||||||
for (let i = 0, len = str.length; i < len; i++) {
|
|
||||||
width += isHaveChina(str.charAt(i)) ? 2 : 1;
|
|
||||||
}
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同一行输出str1, str2,str1居左, str2居右
|
|
||||||
* @param {string} str1 内容1
|
|
||||||
* @param {string} str2 内容2
|
|
||||||
* @param {string} fillWith str1 str2之间的填充字符
|
|
||||||
* @param {number} fontWidth 字符宽度 1/2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export function inline(str1, str2, fillWith = ' ', fontWidth = 1) {
|
|
||||||
const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth;
|
|
||||||
// 需要填充的字符数量
|
|
||||||
let fillCount = lineWidth - (getStringWidth(str1) + getStringWidth(str2)) % lineWidth;
|
|
||||||
let fillStr = new Array(fillCount).fill(fillWith.charAt(0)).join('');
|
|
||||||
return str1 + fillStr + str2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同一行输出三列,第一列居左,第二列居中,第三列居右
|
|
||||||
* @param {string} str1 内容1(左列)
|
|
||||||
* @param {string} str2 内容2(中列)
|
|
||||||
* @param {string} str3 内容3(右列)
|
|
||||||
* @param {string} fillWith 列之间的填充字符
|
|
||||||
* @param {number} fontWidth 字符宽度(默认为1)
|
|
||||||
*/
|
|
||||||
export function inline3(str1, str2, str3, fillWith = ' ', fontWidth = 1) {
|
|
||||||
const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth;
|
|
||||||
// 需要填充的字符数量
|
|
||||||
let fillCount = lineWidth - (getStringWidth(str1) + getStringWidth(str2) + getStringWidth(str3)) % lineWidth;
|
|
||||||
let count2 = Math.floor(fillCount / 2); //分别计算出两边各自需要填充的数量
|
|
||||||
let count1 = fillCount - count2;
|
|
||||||
if(fillCount>2){ //往左偏移两位, 防止打印时,小计与数量重叠
|
|
||||||
count1 -= 2;
|
|
||||||
count2 += 2;
|
|
||||||
}
|
|
||||||
let fillStr1 = new Array(count1).fill(fillWith.charAt(0)).join('');
|
|
||||||
let fillStr2 = new Array(count2).fill(fillWith.charAt(0)).join('');
|
|
||||||
return str1 + fillStr1 + str2 + fillStr2 + str3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用字符填充一整行
|
|
||||||
* @param {string} fillWith 填充字符
|
|
||||||
* @param {number} fontWidth 字符宽度 1/2
|
|
||||||
*/
|
|
||||||
export function fillLine(fillWith = '-', fontWidth = 1) {
|
|
||||||
const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth;
|
|
||||||
return new Array(lineWidth).fill(fillWith.charAt(0)).join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文字内容居中,左右用字符填充
|
|
||||||
* @param {string} str 文字内容
|
|
||||||
* @param {number} fontWidth 字符宽度 1/2
|
|
||||||
* @param {string} fillWith str1 str2之间的填充字符
|
|
||||||
*/
|
|
||||||
export function fillAround(str, fillWith = '-', fontWidth = 1) {
|
|
||||||
const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth;
|
|
||||||
let strWidth = getStringWidth(str);
|
|
||||||
// 内容已经超过一行了,没必要填充
|
|
||||||
if (strWidth >= lineWidth) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
// 需要填充的字符数量
|
|
||||||
let fillCount = lineWidth - strWidth;
|
|
||||||
// 左侧填充的字符数量
|
|
||||||
let leftCount = Math.round(fillCount / 2);
|
|
||||||
// 两侧的填充字符,需要考虑左边需要填充,右边不需要填充的情况
|
|
||||||
let fillStr = new Array(leftCount).fill(fillWith.charAt(0)).join('');
|
|
||||||
return fillStr + str + fillStr.substr(0, fillCount - leftCount);
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
|
|
||||||
export const audioplay = (text) => {
|
|
||||||
if(!text) return;
|
|
||||||
let ssu = new window.SpeechSynthesisUtterance(text);
|
|
||||||
window.speechSynthesis.speak(ssu);
|
|
||||||
}
|
|
|
@ -1,85 +0,0 @@
|
||||||
import axios from "axios";
|
|
||||||
import { ElMessage } from "element-plus";
|
|
||||||
import router from "@/router/index.js";
|
|
||||||
import { useUserStore } from "../store/user";
|
|
||||||
import config from "@/config";
|
|
||||||
|
|
||||||
const request = axios.create({
|
|
||||||
baseURL: config.url,
|
|
||||||
timeout: 60000
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// 请求拦截器
|
|
||||||
request.interceptors.request.use(
|
|
||||||
config => {
|
|
||||||
// 在发送请求之前做些什么,例如添加token、修改请求头等
|
|
||||||
const token = localStorage.getItem('Token');
|
|
||||||
if (token) {
|
|
||||||
config.headers['token'] = token;
|
|
||||||
}
|
|
||||||
|
|
||||||
return config;
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
// 处理请求错误
|
|
||||||
console.error(error);
|
|
||||||
return Promise.reject(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// 响应拦截器
|
|
||||||
request.interceptors.response.use(
|
|
||||||
response => {
|
|
||||||
// 对响应数据做些什么,例如解析数据、统一处理错误等
|
|
||||||
if (response.data.code === 401 || response.data.code === 40000 || (response.data.code === -1 && response.data.msg == '登录超时,请重新登录')) {
|
|
||||||
ElMessage({
|
|
||||||
message: response.data.msg,
|
|
||||||
type: 'error',
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
const userStore = useUserStore();
|
|
||||||
userStore.setUserInfo({});
|
|
||||||
userStore.setToken('');
|
|
||||||
router.push('/login');
|
|
||||||
}, 700)
|
|
||||||
}
|
|
||||||
if (response.data.code === 400) {
|
|
||||||
ElMessage({
|
|
||||||
message: response.data.msg,
|
|
||||||
type: 'error',
|
|
||||||
})
|
|
||||||
throw new Error(response.data.msg);
|
|
||||||
}
|
|
||||||
if (response.data.show) {
|
|
||||||
ElMessage({
|
|
||||||
message: response.data.msg,
|
|
||||||
type: 'error',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (response.data.code === 500) {
|
|
||||||
response.data.msg = JSON.parse(response.data.msg);
|
|
||||||
ElMessage({
|
|
||||||
message: response.data.msg?.msg || response.data.msg,
|
|
||||||
type: 'error',
|
|
||||||
})
|
|
||||||
throw new Error(response.data.msg);
|
|
||||||
}
|
|
||||||
console.log(response.data);
|
|
||||||
if (response.data.code === 0) {
|
|
||||||
return Promise.reject(response.data)
|
|
||||||
}
|
|
||||||
return response.data;
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
// 处理响应错误
|
|
||||||
console.error(error);
|
|
||||||
ElMessage({
|
|
||||||
message: error.response?.data?.msg || error,
|
|
||||||
type: 'error',
|
|
||||||
})
|
|
||||||
return Promise.reject(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
export default request;
|
|
|
@ -1,3 +0,0 @@
|
||||||
import miit from "mitt"
|
|
||||||
|
|
||||||
export default miit()
|
|