var e=(e,a,t)=>new Promise(((s,r)=>{var o=e=>{try{u(t.next(e))}catch(a){r(a)}},l=e=>{try{u(t.throw(e))}catch(a){r(a)}},u=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);u((t=t.apply(e,a)).next())}));import{_ as a}from"./uni-search-bar.48a9b35c.js";import{s as t,M as s,c as r,r as o,D as l,I as u,d as n,e as i,f as d,a as c,g as p,u as m,m as g,b as f,p as h}from"./index-45b322f7.js";import{_ as v}from"./su-sticky.dcc8e273.js";import{_ as I}from"./uni-load-more.575c3b96.js";import{_ as y}from"./s-layout.940eafb4.js";import{i as _}from"./itemList.bfc32ea9.js";import{_ as b}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uni-icons.c22fa7d9.js";import"./index.f474d5f6.js";const x=b({__name:"applyOrgSelect",setup(b){const x=t.$store("order"),j=t.$store("cart"),k=s({supplierId:"",goodsId:"",currentPageNo:1,pageSize:20,isLastPage:!1,loadStatus:""}),P=r((()=>x.malOrgRelation.depOrgId)),C=o([]),L=o(""),S=r((()=>""==L.value?"":L.value));function T(){w(),O()}function N(){L.value="",w(),O()}function z(a){a!=P.value&&function(a){e(this,null,(function*(){console.log(a),x.placeOrder(j.selectedList,j.receiptAddress.receiptId,a)}))}(a),t.$router.back()}function O(){return e(this,null,(function*(){const e=yield t.$api.baseData.getOrgList({isOr:!0,pageSize:k.pageSize,pageNum:k.currentPageNo,paramFilterList:[{searchField:"name",serarchText:S.value},{searchField:"number",serarchText:S.value},{searchField:"userId",serarchText:"1"}]});if(0==e.errorCode){let a=[];e.data.items.forEach((e=>{let t={type:"subLevelType"};t.id=e.orgId,t.number=e.orgNumber,t.name=e.orgName,a.push(t)})),C.value.push(...a),k.isLastPage=e.data.total<C.value.length||e.data.total==C.value.length,k.isLastPage?k.loadStatus="noMore":k.loadStatus="more"}}))}function w(){k.currentPageNo=1,C.value=[]}return l((e=>{w(),k.materialId=e.materialId,k.bizTypeId=e.bizTypeId,k.supplierId=e.supplierId,k.goodsId=e.goodsId,O()})),u((()=>{k.currentPageNo+=1,O()})),(e,t)=>{const s=c(f("uni-search-bar"),a),r=h,o=c(f("su-sticky"),v),l=c(f("uni-load-more"),I),u=c(f("s-layout"),y);return n(),i(u,null,{default:d((()=>[p(o,{bgColor:"#fff",stickyToTop:!1},{default:d((()=>[p(r,{class:"search-block ss-flex ss-row-center"},{default:d((()=>[p(s,{class:"search-bar",placeholder:"请搜索组织编号/名称",onConfirm:T,onCancel:N,modelValue:L.value,"onUpdate:modelValue":t[0]||(t[0]=e=>L.value=e)},null,8,["modelValue"])])),_:1})])),_:1}),p(r,null,{default:d((()=>[p(_,{listData:C.value,selectedItemId:m(P),onClickEntry:z},null,8,["listData","selectedItemId"])])),_:1}),C.value.length>0?(n(),i(l,{key:0,status:k.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:e.loadmore},null,8,["status","onClick"])):g("",!0)])),_:1})}}},[["__scopeId","data-v-2a124de5"]]);export{x as default};
