acdr-ui/dist/build/mp-weixin/modules/mall/chat/components/select-popup.js
2024-10-01 09:15:35 +08:00

2 lines
2.4 KiB
JavaScript

"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 d=require("../../../../common/vendor.js"),p=require("../../sheep/api/trade/order.js"),i=require("../../sheep/api/product/history.js");if(!Array){(d.resolveComponent("uni-load-more")+d.resolveComponent("su-popup"))()}Math||(l+u+(()=>"../../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js")+(()=>"../../sheep/ui/su-popup/su-popup.js"))();const l=()=>"./goods.js",u=()=>"./order.js",c={__name:"select-popup",props:{mode:{type:String,default:"goods"},show:{type:Boolean,default:!1}},emits:["select","close"],setup(e,{emit:l}){const u=l,c=e;d.watch((()=>c.mode),(()=>{g.pagination.data=[],c.mode&&m(g.pagination.page)}));const g=d.reactive({loadStatus:"",pagination:{data:[],current_page:1,total:1,last_page:1}});function m(e,l=5){return u=this,m=null,y=function*(){g.loadStatus="loading";const u="goods"==c.mode?yield i.SpuHistoryApi.getBrowseHistoryPage({page:e,list_rows:l}):yield p.OrderApi.getOrderPage({page:e,list_rows:l}),m=d.lodash.concat(g.pagination.data,u.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})({},u.data),o(y,t({data:m}))),g.pagination.current_page<g.pagination.last_page?g.loadStatus="more":g.loadStatus="noMore"},new Promise(((e,o)=>{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(u,m)).next())}));var u,m,y}function y(){"noMore"!==g.loadStatus&&m(g.pagination.current_page+1)}return(o,t)=>({a:d.t("goods"==e.mode?"我的浏览":"我的订单"),b:d.f(g.pagination.data,((o,t,a)=>d.e("goods"==e.mode?{a:"2d74deb1-1-"+a+",2d74deb1-0",b:d.p({goodsData:o})}:{},"order"==e.mode?{c:"2d74deb1-2-"+a+",2d74deb1-0",d:d.p({orderData:o})}:{},{e:o.id,f:d.o((t=>u("select",{type:e.mode,data:o})),o.id)}))),c:"goods"==e.mode,d:"order"==e.mode,e:d.p({status:g.loadStatus,"content-text":{contentdown:"上拉加载更多"}}),f:d.o(y),g:d.o((e=>u("close"))),h:d.p({show:e.show,showClose:!0,round:"10",backgroundColor:"#eee"})})}},g=d._export_sfc(c,[["__scopeId","data-v-2d74deb1"]]);wx.createComponent(g);