"use strict";var e=Object.defineProperty,o=Object.defineProperties,t=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,s=(o,t,a)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[t]=a;const p=require("../../../../common/vendor.js"),d=require("../../../../sheep/api/trade/order.js"),i=require("../../../../sheep/api/product/history.js");if(!Array){(p.resolveComponent("uni-load-more")+p.resolveComponent("su-popup"))()}Math||(c+l+(()=>"../../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js")+(()=>"../../../../sheep/ui/su-popup/su-popup.js"))();const c=()=>"./goods.js",l=()=>"./order.js",u={__name:"select-popup",props:{mode:{type:String,default:"goods"},show:{type:Boolean,default:!1}},emits:["select","close"],setup(e,{emit:c}){const l=c,u=e;p.watch((()=>u.mode),(()=>{g.pagination.data=[],u.mode&&m(g.pagination.page)}));const g=p.reactive({loadStatus:"",pagination:{data:[],current_page:1,total:1,last_page:1}});function m(e,c=5){return l=this,m=null,y=function*(){g.loadStatus="loading";const l="goods"==u.mode?yield i.SpuHistoryApi.getBrowseHistoryPage({page:e,list_rows:c}):yield d.OrderApi.getOrderPage({page:e,list_rows:c}),m=p.lodash.concat(g.pagination.data,l.data.list);var y;g.pagination=(y=((e,o)=>{for(var t in o||(o={}))r.call(o,t)&&s(e,t,o[t]);if(a)for(var t of a(o))n.call(o,t)&&s(e,t,o[t]);return e})({},l.data),o(y,t({data:m}))),g.pagination.current_page{var t=e=>{try{r(y.next(e))}catch(t){o(t)}},a=e=>{try{r(y.throw(e))}catch(t){o(t)}},r=o=>o.done?e(o.value):Promise.resolve(o.value).then(t,a);r((y=y.apply(l,m)).next())}));var l,m,y}function y(){"noMore"!==g.loadStatus&&m(g.pagination.current_page+1)}return(o,t)=>({a:p.t("goods"==e.mode?"我的浏览":"我的订单"),b:p.f(g.pagination.data,((o,t,a)=>p.e("goods"==e.mode?{a:"84c38b2e-1-"+a+",84c38b2e-0",b:p.p({goodsData:o})}:{},"order"==e.mode?{c:"84c38b2e-2-"+a+",84c38b2e-0",d:p.p({orderData:o})}:{},{e:o.id,f:p.o((t=>l("select",{type:e.mode,data:o})),o.id)}))),c:"goods"==e.mode,d:"order"==e.mode,e:p.p({status:g.loadStatus,"content-text":{contentdown:"上拉加载更多"}}),f:p.o(y),g:p.o((e=>l("close"))),h:p.p({show:e.show,showClose:!0,round:"10",backgroundColor:"#eee"})})}},g=p._export_sfc(u,[["__scopeId","data-v-84c38b2e"]]);wx.createComponent(g);