import{_ as a}from"./uni-search-bar.48a9b35c.js";import{s as e,M as t,r as o,c as s,D as l,I as r,d as u,e as n,f as i,a as d,g as p,m as c,b as m,p as f}from"./index-45b322f7.js";import{_ as y}from"./su-sticky.dcc8e273.js";import{_ as g}from"./uni-load-more.575c3b96.js";import{_ as v}from"./s-layout.940eafb4.js";import{i as I}from"./itemList.bfc32ea9.js";import{_ as b}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uni-icons.c22fa7d9.js";import"./index.f474d5f6.js";const _=b({__name:"purTypeSelect",setup(b){const _=e.$store("order"),h=t({currentPageNo:1,pageSize:20,supplierId:"",goodsId:"",materialId:"",bizTypeId:"",isLastPage:!1,loadStatus:""}),P=o([]),T=o(""),x=s((()=>""==T.value?"*":T.value));function S(){C(),z()}function j(){T.value="",C(),z()}function k(a){let t=P.value.find((e=>e.id==a));_.modifyPurType(h.supplierId,h.goodsId,t),e.$router.back()}function z(){return a=this,t=null,o=function*(){h.loadStatus="loading";const a=yield e.$api.baseData.getPurType({datatype:1,biztype_id:BigInt(_.supplierIdToPlaceOrderEntityMap[h.supplierId].businessTypeId),route:"pbd_mallextdata",pageSize:h.pageSize,pageNo:h.pageNo,name:x.value,number:x.value});0==a.errorCode&&(a.data.rows.forEach((a=>a.type="subLevelType")),P.value.push(...a.data.rows),h.isLastPage=a.data.lastPage,console.log(P.value),a.data.lastPage?h.loadStatus="noMore":h.loadStatus="more")},new Promise(((e,s)=>{var l=a=>{try{u(o.next(a))}catch(e){s(e)}},r=a=>{try{u(o.throw(a))}catch(e){s(e)}},u=a=>a.done?e(a.value):Promise.resolve(a.value).then(l,r);u((o=o.apply(a,t)).next())}));var a,t,o}function C(){h.currentPageNo,P.value=[]}return l((a=>{C(),h.materialId=a.materialId,h.bizTypeId=a.bizTypeId,h.supplierId=a.supplierId,h.goodsId=a.goodsId,z()})),r((()=>{"noMore"!=h.loadStatus&&(h.currentPageNo+=1,z())})),(e,t)=>{const o=d(m("uni-search-bar"),a),s=f,l=d(m("su-sticky"),y),r=d(m("uni-load-more"),g),b=d(m("s-layout"),v);return u(),n(b,null,{default:i((()=>[p(l,{bgColor:"#fff",stickyToTop:!1},{default:i((()=>[p(s,{class:"search-block ss-flex ss-row-center"},{default:i((()=>[p(o,{class:"search-bar",placeholder:"请搜索采购类型编号/名称",onConfirm:S,onCancel:j,modelValue:T.value,"onUpdate:modelValue":t[0]||(t[0]=a=>T.value=a)},null,8,["modelValue"])])),_:1})])),_:1}),p(s,null,{default:i((()=>[p(I,{listData:P.value,onClickEntry:k},null,8,["listData"])])),_:1}),P.value.length>0?(u(),n(r,{key:0,status:h.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:e.loadmore},null,8,["status","onClick"])):c("",!0)])),_:1})}}},[["__scopeId","data-v-ba375b3a"]]);export{_ as default};
