Files
aiot-platform-ui/apps/web-antd/dist/js/index-DbZFaShU.js

2 lines
7.9 KiB
JavaScript

var V=Object.defineProperty,j=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var R=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var W=(t,e,a)=>e in t?V(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,k=(t,e)=>{for(var a in e||(e={}))K.call(e,a)&&W(t,a,e[a]);if(R)for(var a of R(e))M.call(e,a)&&W(t,a,e[a]);return t},A=(t,e)=>j(t,z(e));var d=(t,e,a)=>new Promise((b,c)=>{var u=l=>{try{p(a.next(l))}catch(x){c(x)}},S=l=>{try{p(a.throw(l))}catch(x){c(x)}},p=l=>l.done?b(l.value):Promise.resolve(l.value).then(u,S);p((a=a.apply(t,e)).next())});import{bF as Y,au as H,aA as J,aL as Q,bD as X,a9 as g,$ as Z}from"./bootstrap-DsjPfOC_.js";import"./vxe-table-C9eY8pUC.js";import{g as ee,a as ae,p as te}from"./index-8spERGRp.js";import{g as re}from"./index-gowUcj3U.js";import{g as le}from"./rangePickerProps-CXRhwW6k.js";import{D as O}from"./dict-enum-DRf9W45H.js";import{b9 as h,m as oe,ab as B,b2 as _,bJ as w,j as m,u as i,ae as v,cW as I,ad as C,I as L,bb as $,bp as P,ai as ie,L as ne}from"../jse/index-index-CO0ZsLf2.js";import{_ as N}from"./summary-card.vue_vue_type_script_setup_true_lang-COdEzztD.js";import{_ as se}from"./table-action.vue_vue_type_script_setup_true_lang-BCG7vvPF.js";import{_ as ce}from"./page.vue_vue_type_script_setup_true_lang-BL-xU9lB.js";import{u as ue}from"./use-vxe-grid-z_YbcgDZ.js";import{D as E}from"./biz-mall-enum-CJxJyQZ4.js";import{b as pe}from"./AlertBuilder-ElnyTeiq.js";import"./dict-tag.vue_vue_type_script_setup_true_lang-BZwqGgTH.js";import"./count-to-animator.vue_vue_type_script_setup_true_lang-D4Pg5Pn4.js";import"./index-vahqJcxE.js";import"./circle-check-big-I5cuJCPZ.js";import"./x--itLcJVB.js";const D=Y(),y=h([]);re().then(t=>{var a;y.value=t;const e=(a=D==null?void 0:D.userInfo)==null?void 0:a.id;y.value=y.value.filter(b=>{var c;return(c=b.verifyUserIds)==null?void 0:c.includes(e)})});function de(){var t;return[{fieldName:"createTime",label:"创建时间",component:"RangePicker",componentProps:A(k({},le()),{allowClear:!0})},{fieldName:"pickUpStoreIds",label:"自提门店",component:"Select",componentProps:{options:y,labelField:"name",valueField:"id",placeholder:"请选择自提门店"},defaultValue:(t=y.value[0])==null?void 0:t.id},{fieldName:"no",label:"订单号",component:"Input",componentProps:{placeholder:"请输入订单号",allowClear:!0}},{fieldName:"userId",label:"用户 UID",component:"Input",componentProps:{placeholder:"请输入用户 UID",allowClear:!0}},{fieldName:"userNickname",label:"用户昵称",component:"Input",componentProps:{placeholder:"请输入用户昵称",allowClear:!0}},{fieldName:"userMobile",label:"用户电话",component:"Input",componentProps:{placeholder:"请输入用户电话",allowClear:!0}}]}function me(){return[{field:"no",title:"订单号",fixed:"left",minWidth:180},{field:"user.nickname",title:"用户信息",minWidth:100},{field:"brokerageUser.nickname",title:"推荐人信息",minWidth:100},{field:"spuName",title:"商品信息",minWidth:300,slots:{default:"spuName"}},{field:"payPrice",title:"实付金额(元)",formatter:"formatAmount2",minWidth:180},{field:"storeStaffName",title:"核销员",minWidth:160},{field:"pickUpStoreId",title:"核销门店",minWidth:160,formatter:({row:t})=>{var e;return((e=y.value.find(a=>a.id===t.pickUpStoreId))==null?void 0:e.name)||""}},{field:"payStatus",title:"支付状态",cellRender:{name:"CellDict",props:{type:O.INFRA_BOOLEAN_STRING}},minWidth:80},{field:"status",title:"订单状态",cellRender:{name:"CellDict",props:{type:O.TRADE_ORDER_STATUS}},minWidth:80},{field:"createTime",title:"下单时间",formatter:"formatDateTime",minWidth:160}]}const fe={class:"flex flex-row gap-4"},ge={class:"flex flex-col gap-2"},ve={class:"flex flex-1 flex-col gap-1"},he={class:"text-sm"},ye={class:"flex flex-wrap gap-1"},be={class:"text-xs text-gray-500"},Ee=oe({__name:"index",setup(t){const e=h();function a(){T.query()}function b(){return d(this,null,function*(){const r=yield T.formApi.getValues();r.deliveryType=E.PICK_UP.type,e.value=yield ae(r)})}function c(r){return d(this,null,function*(){if(r||(yield pe({component:()=>ne(X,{}),content:"请输入核销码",title:"核销订单",modelPropName:"value"}).then(n=>d(null,null,function*(){n&&(r=n)}))),!r)return;const f=g.loading({content:"订单核销中 ...",duration:0});try{yield te(r),g.success(Z("ui.actionMessage.operationSuccess")),a()}finally{f()}})}const u=h(""),S=h([]),p=h(""),l=h(!1);function x(){return d(this,null,function*(){try{if("serial"in navigator&&navigator.serial!==null&&typeof navigator.serial=="object"&&"requestPort"in navigator.serial)u.value=yield navigator.serial.requestPort();else{g.error("浏览器不支持扫码枪连接,请更换浏览器重试");return}S.value=yield navigator.serial.getPorts(),yield u.value.open({baudRate:9600,dataBits:8,stopBits:2}),g.success("成功连接扫码枪"),l.value=!0,yield F()}catch(r){console.error("Error connecting to serial port:",r)}})}function F(){return d(this,null,function*(){p.value=u.value.readable.getReader();let r="";for(;;){const{value:f,done:n}=yield p.value.read();if(n){p.value.releaseLock();break}const o=new TextDecoder().decode(f);if(r=`${r}${o}`,o.includes("\r")){const s=r.replace("\r","");r="",console.warn(`二维码数据:${s}`),yield c(s)}}})}function q(){return d(this,null,function*(){u.value===""?g.warning("请先连接或打开扫码枪"):(yield p.value.cancel(),yield u.value.close(),u.value="",console.warn("断开扫码枪连接"),g.success("已成功断开扫码枪连接"),l.value=!1)})}const[G,T]=ue({formOptions:{schema:de()},gridOptions:{cellConfig:{height:80},columns:me(),height:"auto",keepSource:!0,proxyConfig:{ajax:{query:(n,o)=>d(null,[n,o],function*({page:r},f){return yield b(),yield ee(k({pageNo:r.currentPage,pageSize:r.pageSize,deliveryType:E.PICK_UP.type},f))})}},rowConfig:{keyField:"id",isHover:!0},toolbarConfig:{refresh:!0,search:!0}}});return(r,f)=>(_(),B(i(ce),{"auto-content-height":""},{default:w(()=>[m(i(H),{class:"mb-2"},{default:w(()=>{var n,o,s,U;return[v("div",fe,[m(i(N),{class:"flex flex-1",title:"订单数量",icon:"icon-park-outline:transaction-order","icon-color":"bg-blue-100","icon-bg-color":"text-blue-500",value:((n=e.value)==null?void 0:n.orderCount)||0},null,8,["value"]),m(i(N),{class:"flex flex-1",title:"订单金额",icon:"streamline:money-cash-file-dollar-common-money-currency-cash-file","icon-color":"bg-purple-100","icon-bg-color":"text-purple-500",prefix:"¥",decimals:2,value:Number(i(I)(((o=e.value)==null?void 0:o.orderPayPrice)||0))},null,8,["value"]),m(i(N),{class:"flex flex-1",title:"退款单数",icon:"heroicons:receipt-refundAfterSale","icon-color":"bg-yellow-100","icon-bg-color":"text-yellow-500",value:((s=e.value)==null?void 0:s.afterSaleCount)||0},null,8,["value"]),m(i(N),{class:"flex flex-1",title:"退款金额",icon:"ri:refundAfterSale-2-line","icon-color":"bg-green-100","icon-bg-color":"text-green-500",prefix:"¥",decimals:2,value:Number(i(I)(((U=e.value)==null?void 0:U.afterSalePrice)||0))},null,8,["value"])])]}),_:1}),m(i(G),{class:"h-4/5","table-title":"核销订单"},{spuName:w(({row:n})=>[v("div",ge,[(_(!0),C(L,null,$(n.items,o=>(_(),C("div",{key:o.id,class:"flex items-start gap-2 text-left"},[m(i(J),{src:o.picUrl,alt:o.spuName,width:60,height:60,preview:{src:o.picUrl}},null,8,["src","alt","preview"]),v("div",ve,[v("span",he,P(o.spuName),1),v("div",ye,[(_(!0),C(L,null,$(o.properties,s=>(_(),B(i(Q),{key:s.propertyId,size:"small"},{default:w(()=>[ie(P(s.propertyName)+": "+P(s.valueName),1)]),_:2},1024))),128))]),v("span",be,P(i(I)(o.price))+" 元 x "+P(o.count),1)])]))),128))])]),"toolbar-tools":w(()=>[m(i(se),{actions:[{label:"核销",type:"primary",icon:"lucide:circle-check-big",auth:["trade:order:pick-up"],onClick:c.bind(null,void 0)},{label:l.value?"断开扫描枪":"连接扫描枪",type:"primary",icon:l.value?"lucide:circle-x":"lucide:circle-play",danger:l.value,onClick:l.value?q:x}]},null,8,["actions"])]),_:1})]),_:1}))}});export{Ee as default};