import{_ as a}from"./uni-search-bar.48a9b35c.js";import{s as e,M as t,c as s,r as o,D as l,d as r,e as u,f as n,a as i,g as d,u as c,m,l as p,b as f,p as g}from"./index-45b322f7.js";import{_ as v}from"./su-sticky.dcc8e273.js";import{_ as b}from"./uni-load-more.575c3b96.js";import{_ as h}from"./s-layout.940eafb4.js";import{i as y}from"./itemList.bfc32ea9.js";import{_}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uni-icons.c22fa7d9.js";import"./index.f474d5f6.js";const I=_({__name:"purchaserSelect",setup(_){const I=e.$store("order"),P=t({supplierId:"",goodsId:"",currentPageNo:1,pageSize:20,isLastPage:!1,loadStatus:""}),k=s((()=>I.reqInfo.reqPersonId)),x=o([]),C=o(""),j=s((()=>""==C.value?"*":C.value));function S(){I.modifyPurchaser({id:"",name:""}),e.$router.back()}function w(){D(),T()}function z(){C.value="",D(),T()}function L(a){if(a!=k.value){let e=x.value.find((e=>e.id==a));I.modifyPurchaser(e)}e.$router.back()}function T(){return a=this,t=null,s=function*(){P.loadStatus="loading";const a=yield e.$api.baseData.getPurchaserList({number:j.value,name:j.value,pageSize:P.pageSize,pageNo:P.currentPageNo});0==a.errorCode&&(console.log("数据长度："+a.data.totalCount),a.data.rows.forEach((a=>a.type="subLevelType")),x.value.push(...a.data.rows),P.isLastPage=a.data.lastPage,a.data.lastPage?P.loadStatus="noMore":P.loadStatus="more")},new Promise(((e,o)=>{var l=a=>{try{u(s.next(a))}catch(e){o(e)}},r=a=>{try{u(s.throw(a))}catch(e){o(e)}},u=a=>a.done?e(a.value):Promise.resolve(a.value).then(l,r);u((s=s.apply(a,t)).next())}));var a,t,s}function D(){P.currentPageNo=1,x.value=[]}return l((a=>{D(),P.materialId=a.materialId,P.bizTypeId=a.bizTypeId,P.supplierId=a.supplierId,P.goodsId=a.goodsId,T()})),(e,t)=>{const s=i(f("uni-search-bar"),a),o=g,l=i(f("su-sticky"),v),_=i(f("uni-load-more"),b),I=i(f("s-layout"),h);return r(),u(I,null,{default:n((()=>[d(l,{bgColor:"#fff",stickyToTop:!1},{default:n((()=>[d(o,{class:"search-block ss-flex ss-row-center"},{default:n((()=>[d(s,{class:"search-bar",placeholder:"请搜索人员编号/姓名",onConfirm:w,onCancel:z,modelValue:C.value,"onUpdate:modelValue":t[0]||(t[0]=a=>C.value=a)},null,8,["modelValue"])])),_:1})])),_:1}),d(o,{class:"ss-flex-col content-box"},{default:n((()=>[d(o,null,{default:n((()=>[d(y,{listData:x.value,selectedItemId:c(k),onClickEntry:L},null,8,["listData","selectedItemId"])])),_:1}),x.value.length>0?(r(),u(_,{key:0,status:P.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:e.loadmore},null,8,["status","onClick"])):m("",!0)])),_:1}),d(o,{class:"bottom-bar ss-col-center"},{default:n((()=>[d(o,{class:"clear-btn",onClick:S},{default:n((()=>[p("清空并退出")])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-4fbf7656"]]);export{I as default};
