qj-b2c-store 1.6.97 → 1.6.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{createContext as t,useReducer as e,useContext as n,useSyncExternalStore as c,useRef as i,useCallback as r,useEffect as s,useState as a,useMemo as d}from"react";import{addShoppingGoodsBySpec as l,addShoppingGoods as u,queryToContract as p,getTotalDiscountPrice as m,getResourceGoodsInfoBySkuCode as y,saveUsercoupon as g,getSetsupDisUtil as f,checkCollectExit as h,queryCollectPage as v,saveCollect as S,deleteCollectByCode as C,queryCouponListBySkuCode as b,queryPromotionListByGoodsCode as O,queryEvaluateGoodsPagetrue as P,saveFootprint as I,queryAddressBymerberCode as N,saveAddress as k,deleteAddress as L,updateAddress as M,updateShoppingGoodsNum as B,queryShoppingPage as T,queryShoppingToContract as j,deleteShoppingGoodsBatch as D,updateShoppingGoodsPmInfo as G,updateShoppingGoodsCheckState as A,queryUsercouponPageForC as R,find as w,syncContractBatchState as x,syncContractState as E,saveOrderToPay as F,paymentCommit as U,getFalgSettingForPaydate as J,calculateFreightFare as $,saveContract as q,queryUserConByGoods as V,syncContractPayState as Y,getContractByCode as _,checkRefund as W,confirmReceive as z,cancelContractC as H,queryContractPageC as K,cancelUnpayOrder as Q,queryExpressInfo as X,queryGoodsClassTree as Z,deleteCollectByCodeStr as oo,queryUseTemplate as to,saveEvaluateGoods as eo,saveEvaluateShop as no,queryFootprintPagePlat as co,deleteFootprintByCodeStr as io,getNotice as ro,getDoclist as so,queryPromotioByCodePage as ao,queryPromotioPage as lo,getRefundGoods as uo,saveRefund as po,queryRefCause as mo,getRefundByCode as yo,sendGoods as go,queryExpressPageForProp as fo,cancelAfterSales as ho,queryRefundPageBuy as vo,miniLogout as So}from"qj-b2c-api";export{calculateFreightFare,getFalgSettingForPaydate,paymentCommit,queryAddressBymerberCode,queryShoppingToContract,saveContract,saveOrderToPay,syncContractBatchState,syncContractPayState,syncContractState,updateShoppingGoodsNum}from"qj-b2c-api";import{getTotalDiscountPriceCache as Co,queryUpmupointsPageByPC as bo,saveOrderToBatchPay as Oo,querySkuToContractLR as Po,queryToContractCodeList as Io,queryUserServicePage as No,queryEvaluateGoodsPage as ko,deleteEvaluateGoods as Lo,queryDoclistForMenuPageAt as Mo,queryUpmpointsrulePage as Bo,querySignPage as To,saveSignForUser as jo,saveBaseUpmupointsclear as Do}from"b2c-api";import{getEnv as Go,taroMessage as Ao,getPagesRefreshStore as Ro,updatePagesRefreshStore as wo,navigatorHandler as xo,getTaro as Eo,navigatorBackImpl as Fo,reLaunchHandler as Uo,setStorage as Jo,getStorage as $o,taroModule as qo,getBaseUrl as Vo}from"@brushes/utils";import{noop as Yo,isFunction as _o,get as Wo,isEmpty as zo,groupBy as Ho,orderBy as Ko,difference as Qo,set as Xo,isUndefined as Zo,isEqual as ot}from"lodash-es";import{fullPath as tt,extendAddressData as et}from"@brushes/shared-utils";import{removeRequestCacheByKey as nt}from"@brushes/optimize";import{post as ct}from"@brushes/request";import it from"dayjs";function rt(c,i){const r=t(null),s=t(null);return[({children:t})=>{const[n,a]=e(c,i);return o(r.Provider,{value:a,children:o(s.Provider,{value:n,children:t})})},function(){return n(s)},function(){return n(r)}]}function st(o){let t=o;const e=new Set;return{getState:()=>t,setState:o=>{t=Object.assign(Object.assign({},t),o),e.forEach((o=>o(t)))},subscribe:o=>(e.add(o),()=>e.delete(o))}}const at=st({count:1,memberCode:"",isNeedButton:!1,goodsNum:1,goodsSupplynum:100,spec:[],orderType:0,offShelf:!1});function dt(o=o=>o){return c(at.subscribe,(()=>o(at.getState())))}function lt(o,t){var e={};for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&t.indexOf(n)<0&&(e[n]=o[n]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var c=0;for(n=Object.getOwnPropertySymbols(o);c<n.length;c++)t.indexOf(n[c])<0&&Object.prototype.propertyIsEnumerable.call(o,n[c])&&(e[n[c]]=o[n[c]])}return e}function ut(o,t,e,n){return new(e||(e=Promise))((function(c,i){function r(o){try{a(n.next(o))}catch(o){i(o)}}function s(o){try{a(n.throw(o))}catch(o){i(o)}}function a(o){var t;o.done?c(o.value):(t=o.value,t instanceof e?t:new e((function(o){o(t)}))).then(r,s)}a((n=n.apply(o,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const pt=o=>o.detail?o.detail.value:o.value?o.value:o,mt=(o,t)=>ut(void 0,void 0,void 0,(function*(){const e={specStr:JSON.stringify(o),goodsCode:t};return yield l(e)})),yt=(o,t)=>ut(void 0,void 0,void 0,(function*(){const e={skuId:o,goodsNum:t};return yield u(e)})),gt=(o,t)=>ut(void 0,void 0,void 0,(function*(){const e=Go(),n={skuId:o,goodsNum:t,isLocalMock:!e};return yield p(n)})),ft=(o,...t)=>ut(void 0,[o,...t],void 0,(function*(o,t=!1){return yield t?Co(o):m(o)}));function ht(o){const t=Go();return y({skuCode:o,isLocalMock:!t})}function vt(o=Yo){const t=o=>{const t=(o=>{const t=at.getState();switch(o.type){case"plus":return Object.assign(Object.assign({},t),{count:t.count+1});case"minus":return Object.assign(Object.assign({},t),{count:t.count-1});case"select":case"initGoodSku":case"popupImpl":return Object.assign(Object.assign({},t),o.payload);default:return t}})(o);at.setState(t)},e=()=>{o({visible:!0})};return{dispatch:t,openPopup:()=>{e(),t({type:"popupImpl",payload:{isNeedButton:!1}})},closePopup:()=>{o({visible:!1})},addCardPopup:()=>{e(),t({type:"popupImpl",payload:{orderType:0,isNeedButton:!0}})},buyOpenPopup:()=>{e(),t({type:"popupImpl",payload:{orderType:1,isNeedButton:!0}})}}}function St(o){const t=i(null);return t.current=_o(o)?o:Yo,r(((...o)=>t.current(...o)),[t])}function Ct(o,t,e,n=Yo){const{dispatch:c,closePopup:i}=vt(n);s((()=>{const o=Wo(t,"spec",[]),n=Wo(e,"[0]goodsMinnum",1);zo(o)||c({type:"initGoodSku",payload:{offShelf:!1,count:n||1,spec:o}})}),[t]);const r=(o,t)=>!!t&&o.every((o=>t.includes(`/${o}/`)||t.endsWith(o)||t.startsWith(o))),a=St(((o,t)=>{const n=at.getState(),{spec:i}=n;i[t]=o;const s=(a=i,e.find((o=>r(a,o.skuName)))||{});var a;const d=zo(s);c({type:"select",payload:{offShelf:d,count:s.goodsMinnum||1,spec:[...i]}}),d&&Ao("该规格已下架","none")})),d=()=>ut(this,void 0,void 0,(function*(){try{const t=at.getState(),{spec:e,count:n}=t,c=yield mt(e,o),{CartList:r=0}=Ro();wo({CartList:r+1});const s=Wo(c,"dataObj.skuId"),a=yield yt(s,n);yield Ao(a.msg||"添加成功"),i()}catch(o){yield Ao(o,"error")}})),l=()=>ut(this,void 0,void 0,(function*(){const t=at.getState(),{spec:e,count:n}=t,c=yield mt(e,o),i=Wo(c,"dataObj.skuId"),r=Wo(c,"dataObj.goodsType");if("06"===r)try{const o=Number(Wo(c,"dataObj.pricesetRefrice",0)),t=yield bo({},!1);if(o>Number(Wo(t,"list[0].upointsNum",0)))return void Ao("用户积分不足,不能兑换","none")}catch(o){return void console.log(o)}xo("orderDetermine",{skuId:i,goodsNum:n,goodsType:r})}));return{closePopup:i,addCardImpl:d,cashImpl:l,handleChooseSize:a,handleStep:(o,t,e)=>{const{count:n}=at.getState();n!==(t||1)||"minus"!==e?"plus"!==e||n!==o?c({type:e}):Ao("超库存","none"):Ao(`不能小于${t||1}`,"none")},addShoppingImpl:()=>{const o=at.getState(),{orderType:t}=o;0===t?d():l()}}}const bt=()=>{const[o,t]=a(!1);return{save:e=>ut(void 0,void 0,void 0,(function*(){if(!o)try{yield g(e),t(!0)}catch(o){}})),isPick:o}},Ot=()=>{const o=i(null),t=Eo(),e=o=>{if(!o)return;const e=document.createElement("a");e.href=o,e.download="poster.png",t.showToast({title:"生成成功",icon:"none",duration:2e3}),e.click()};return{init:(t,n)=>{const c=tt(Wo(t,"[0].goodsFileUrl","")),i=tt(Wo(t,"[1].goodsFileUrl","")),r=o.current;if(!r)return;const s=r.getContext("2d");s.fillStyle="#fff",s.fillRect(0,0,300,1600),s.fillStyle="#333",s.font="bold 14px sans-serif",s.fillText(n,10,560);const a=new Image;a.crossOrigin="Anonymous",a.src=c;const d=new Image;d.crossOrigin="Anonymous",d.src=i,a.onload=function(){s.drawImage(a,0,0,300,260)},d.onload=function(){s.drawImage(d,0,260,300,260)},setTimeout((()=>{const o=r.toDataURL("image/png");e(o)}),400)},canvasRef:o}},Pt={rsGoodsFileDomainList:[],rsSpecValueDomainList:[],goodsRemark:"",pricesetNprice:0,goodsName:"",dataPic:"",goodsShowname:"",goodsNum:0,goodsCode:"",skuNo:"",classtreeCode:"",brandCode:"",pntreeCode:"",memberCode:"",goodsThdate:"",goodsOdate:"",goodsDayinfo:"",rsSkuDomainList:[]},It=(o,t="")=>{const[e,n]=a(Pt);return s((()=>{ut(void 0,void 0,void 0,(function*(){try{let e=o;t&&(e=(yield f({key:t})).split("_")[0]);const c=yield ht(e);n(c||Pt)}catch(o){}}))}),[]),e},Nt=o=>d((()=>o.map((o=>({imgUrl:o.goodsFileUrl,link:""})))),[o]),kt={dataObj:""};function Lt({skuCode:o,dataPic:t,goodsName:e,pricesetNprice:n}){const[c,i]=a(kt);s((()=>{r()}),[]);const r=()=>ut(this,void 0,void 0,(function*(){const t={collectType:0,collectOpcode:o};try{const o=yield h(t);i(o)}catch(o){console.log(o)}})),d=()=>ut(this,void 0,void 0,(function*(){const c={collectType:0,collectOpcode:o,collectOppic:t,collectOpcont:e,collectOpnum:n,goodsOrigin:0};return yield S(c)})),l=()=>ut(this,void 0,void 0,(function*(){const o={collectType:0,collectCode:c.dataObj||""};return yield C(o)})),u=(o,t="success",e=1e3)=>{Eo().showToast({title:o,icon:t,duration:e})};return{handleCollect:()=>ut(this,void 0,void 0,(function*(){let o=kt;zo(c.dataObj)?(o=yield d(),u("收藏成功")):(o=yield l(),u("取消收藏成功")),i(o),nt(v)})),collection:c}}function Mt(o,t){return d((()=>({skuList:function(o){const t=Ho(Ko(o,["specValueValue"]),"specName");return t?Object.keys(t).map((o=>({skuName:o,skuOption:t[o]}))):[]}(o),spec:Wo(t,"[0]skuName","").split("/")})),[o])}const Bt=(o=[],t)=>{const e=o.find((o=>o.skuCode===t))||{};if(zo(e))return{};const{skuNo:n,classtreeCode:c,brandCode:i,pntreeCode:r,memberCode:s}=e;return{skuCode:t,skuNo:n,classtreeCode:c,brandCode:i,pntreeCode:r,memberCode:s}},Tt={promotionBegintime:"",pbName:"",discName:"",promotionCode:"",promotionName:"",couponOnceNums:0,couponOnceNumd:0,promotionEndtime:""};function jt(o,t){const[e,n]=a([]),[c,i]=a(!1);return s((()=>{(()=>{ut(this,void 0,void 0,(function*(){const e=Bt(o,t);if(zo(e))return;const c=yield b(e);n(c)}))})()}),[t,o]),{coupon:e,visible:c,setVisible:i}}function Dt(o,t){const[e,n]=a([]);return s((()=>{(()=>{ut(this,void 0,void 0,(function*(){const e=Bt(o,t);if(zo(e))return;const c=yield O(e);n(c)}))})()}),[t,o]),e}const Gt=o=>{const[t,e]=a([]);return s((()=>{ut(void 0,void 0,void 0,(function*(){try{if(!o)return;const t=yield P({goodsCode:o,page:1,rows:10});e(t.list||[])}catch(o){}}))}),[o]),t},At=()=>({handleShare:()=>{if(!Go())return;Eo().showShareMenu({withShareTicket:!0,success:()=>{console.log("share success")}})}}),Rt=o=>{s((()=>{ut(void 0,void 0,void 0,(function*(){try{const t=yield ht(o);I({footprintType:0,footprintOpcode:o,footprintOppic:t.dataPic,footprintOpcont:t.goodsName,footprintOpnum:t.pricesetNprice,footprintOpurl:""})}catch(o){console.log(o)}}))}),[])},wt=(o=[])=>{const t=dt((o=>o.spec)),e=d((()=>o.find((o=>((o,t="")=>!!t&&o.every((o=>t.includes(`/${o}/`)||t.endsWith(o)||t.startsWith(o))))(t,o.skuName)))||{}),[t,o]);return{spec:t,goodInfo:e}};function xt(o){const t=(t,e,n)=>ut(this,void 0,void 0,(function*(){try{yield ct("/web/um/address/updateAddress.json",Object.assign(Object.assign(Object.assign({},t),et),{addressId:o})),nt(N);let{AddressList:n=0}=Ro();wo({AddressList:++n}),e(),Fo(-1)}catch(o){n()}})),e=(o,t,e)=>ut(this,void 0,void 0,(function*(){try{yield k(Object.assign(Object.assign({},o),et)),nt(N);let{AddressList:e=0}=Ro();wo({AddressList:++e}),t(),Fo(-1)}catch(o){e()}}));return{onSubmit:(n,c,i)=>ut(this,void 0,void 0,(function*(){o?t(n,c,i):e(n,c,i)}))}}function Et(o){const[t,e]=a([]),[n,c]=a(!0);s((()=>{i()}),[o]);const i=()=>ut(this,void 0,void 0,(function*(){const o=Go(),t=yield N({isLocalMock:!o});e(t),c(!1)})),r=(o,t)=>{const e=t[o];return t[o]=t[0],t[o].addressDefault="0",t[0]=e,t[0].addressDefault="1",[...t]};return{list:t,skullShow:n,delAddress:o=>{if(!Go())return;Eo().showModal({title:"提示",content:"确认删除该地址吗?",success:t=>ut(this,void 0,void 0,(function*(){(null==t?void 0:t.confirm)&&(yield L({addressId:o.addressId}),nt(N),yield i())}))})},setDefault:(o,n)=>ut(this,void 0,void 0,(function*(){if("1"!==o.addressDefault){const{addressMember:c,addressPhone:s,provinceCode:a,provinceName:d,cityCode:l,cityName:u,areaCode:p,areaName:m,addressDetail:y,addressId:g,addressCode:f,dataState:h}=o,v={addressMember:c,addressPhone:s,provinceCode:a,provinceName:d,cityCode:l,cityName:u,areaCode:p,areaName:m,addressDetail:y,addressId:g,addressCode:f,dataState:h,addressDefault:"1"};e(r(n,t)),yield M(v),nt(N),yield i()}})),getAddressList:i,navigator:()=>{xo("addressEditor")}}}function Ft(o){return{handlerImpl:()=>{wo({PlaceOrderAddress:o.addressId,PlaceOrderAddressTabs:{addressId:o.addressId}}),Fo(-1)}}}const[Ut,Jt,$t]=rt((function(o,t){switch(t.type){case"select":return Object.assign(Object.assign({},o),{select:t.payload});case"update":return Object.assign(Object.assign({},o),t.payload);default:return o}}),{id:"",count:0,loading:!1,select:[]}),qt=()=>{const o=$t(),{select:t}=Jt();return{select:t,onChange:t=>{o({type:"select",payload:pt(t)})},handleStep:(t,e,n)=>ut(void 0,void 0,void 0,(function*(){if(0===e&&"minus"===n)return void Ao("不能小于0","none");const c="plus"===n?++e:--e;o({type:"update",payload:{id:t,count:c,loading:!0}})}))}},Vt=o=>{const[t,e]=a([]),[n,c]=a(0),r=i([]),l=$t(),{select:u,id:p,count:m}=Jt(),y=d((()=>{let o=0,e=0;return t.forEach((t=>{u.includes(t.shoppingGoodsId)&&(o+=t.goodsCamount,e+=t.goodsCamount*t.pricesetNprice)})),{num:o,amount:e}}),[u,t]);s((()=>{ut(void 0,void 0,void 0,(function*(){yield f("isFirst")}))}),[o]),s((()=>{p&&g(p,m)}),[p,m]);const g=(o,t)=>ut(void 0,void 0,void 0,(function*(){try{yield B({shoppingGoodsId:o,amount:t,goodWeight:0}),yield f()}catch(o){console.log(o)}})),f=(...o)=>ut(void 0,[...o],void 0,(function*(o=""){try{const t=Go(),n=yield T({isLocalMock:!t}),i=Wo(n,"list",[]),s=[];let a=0;i.forEach((o=>{const{shoppingGoodsList:t,disMoney:e=0}=Wo(o,"shoppingpackageList[0]",{shoppingGoodsList:[],disMoney:0});s.push(...t),a+=e||0})),r.current=s.map((o=>o.shoppingGoodsId)),o&&l({type:"select",payload:r.current}),l({type:"update",payload:{loading:!1}}),c(a),e(s)}catch(o){Ao(o.msg)}}));return{cartList:t,initImpl:f,disMoney:n,amount:y,selectAll:o=>{const t=pt(o);l({type:"select",payload:t.includes("true")?r.current:[]})},allCart:r,toOrderImpl:()=>{0!==u.length?(nt(j),xo("orderDetermine",{shoppingGoodsId:u.join(",")})):Ao("购物数量不能为空")},select:u,deleteCart:()=>ut(void 0,void 0,void 0,(function*(){try{yield D({shoppingGoodsIdStr:JSON.stringify(u)}),yield f()}catch(o){console.log(o)}}))}},Yt=(o,t,e=Yo)=>{const[n,c]=a([]),[r,d]=a(!1),l=i([]);s((()=>{ut(void 0,void 0,void 0,(function*(){yield u("isFirst")}))}),[o,t]);const u=(...o)=>ut(void 0,[...o],void 0,(function*(o=""){try{d(!0);const t=Go(),e=yield T({isLocalMock:!t});p(e,o)}catch(o){console.log(o)}finally{d(!1)}})),p=(o,t)=>{const e=Wo(o,"list",[]),n=[];e.forEach((o=>{const t=Wo(o,"shoppingpackageList",[]);n.push(...t)})),c(n),m(n,t)},m=(o,t)=>{const{list:n,disMoney:c}=y(o);l.current=n;const i=l.current.map((o=>o.shoppingGoodsId)),r={};t&&(r.select=i),e(Object.assign({disMoney:c,cartInfo:l.current},r))},y=o=>{let t=[],e=0;return o.forEach((o=>{e+=o.disMoney||0,t.push(...o.shoppingGoodsList)})),{list:t,disMoney:e}};return{cartList:n,loading:r,onChange:o=>{const t=pt(o).map((o=>Number(o)||o));e((o=>{var e,n;return e=t,n=o.select,ut(void 0,void 0,void 0,(function*(){console.log("updateGoodCheck",e,n);let o="";o=e.length>n.length?Qo(e,n).join(""):Qo(n,e).join("");const{shoppingCode:t}=l.current.find((t=>t.shoppingGoodsId===o))||{};try{yield A({shoppingGoodsIdStr:o,shoppingCode:t,checkState:+(n.length>e.length),channelCode:"channelCode"}),yield u()}catch(o){}})),{cartInfo:l.current,select:t}}))},handleStep:(o,t,e)=>{if(1===t&&"minus"===e)return void Ao("不能小于1","none");((o,t)=>{ut(void 0,void 0,void 0,(function*(){try{yield B({shoppingGoodsId:o,amount:t,goodWeight:0}),yield u()}catch(o){console.log(o)}}))})(o,"plus"===e?++t:--t)},updatePm:(o,t)=>ut(void 0,void 0,void 0,(function*(){try{yield G({shoppingGoodsId:o,promotionCode:t}),yield u()}catch(o){console.log(o)}}))}},_t={register:"/account/register/index",accountLogin:"/account/accountLogin/index",mobileLogin:"/account/mobileLogin/index",forgetPwd:"/account/forgetPwd/index",agreement:"/account/agreement/index",auth:"/account/auth/index",confirmPhone:"/account/confirmPhone/index",bindPhone:"/account/bindPhone/index"},Wt=["pages/index/index"],zt={addressId:"",addressInfo:{},contractPumode:"0"},Ht=(o,t="success",e=1e3)=>{Eo().showToast({title:o,icon:t,duration:e})};function Kt({target:o,defaultQuery:t,extendQuery:e},n){const c=o.value,i=((o,t,e)=>{const n=o.concat(t);let c={};for(let o of n)c[o]=e[o];return c})(t,e,n);xo(c,i)}const Qt=(o,t)=>{const e=Math.floor(o/1e3)%60,n=Math.floor(o/1e3/60)%60,c=Math.floor(o/1e3/60/60)%24;return`${Math.floor(o/1e3/60/60/24)}天 ${c}小时 ${n}分钟 ${e}秒${t}`};function Xt(o=[],t=[],e=Yo){const n=d((()=>t.filter((o=>0!==o.dataState)).map((o=>o.shoppingGoodsId))||[]),[t]),c=d((()=>{let e=0,n=[],c=0;for(let i of t)o.includes(i.shoppingGoodsId)&&0===i.dataState&&(n.push(i.shoppingGoodsId),e+=i.goodsCamount,c+=i.goodsCamount*i.pricesetNprice);return{num:e,canPayIds:n,amount:c}}),[o,t]),i=St((o=>(console.log(1111,o.map((o=>o.shoppingGoodsId))),o.map((o=>o.shoppingGoodsId))))),r=St((o=>{const n=pt(o);e({select:n.includes("true")?i(t):[]})})),s=St((()=>ut(this,void 0,void 0,(function*(){try{yield D({shoppingGoodsIdStr:JSON.stringify(o)}),e((o=>{let t=o.updateCount||0;return{updateCount:++t}}))}catch(o){console.log(o)}}))));return{toOrderImpl:St((()=>{0!==c.canPayIds.length?(nt(j),xo("orderDetermine",{shoppingGoodsId:c.canPayIds.join(",")})):Ao("购物数量不能为空")})),deleteCart:s,selectAll:r,cartDetail:c,clearAll:()=>ut(this,void 0,void 0,(function*(){try{yield D({shoppingGoodsIdStr:JSON.stringify(n)}),e((o=>{let t=o.updateCount||0;return{updateCount:++t}}))}catch(o){console.log(o)}})),ids:n}}function Zt(o=Yo){return{editorImpl:()=>{o((o=>({isEditor:!o.isEditor})))}}}const oe=()=>{const[o,t]=a([]),e=i(0),n=i(1),c=i(10),r=i([{id:0,label:"领取记录",dataState:"",styleName:"all",text:""},{id:1,label:"未使用",dataState:0,styleName:"unused",text:""},{id:2,label:"已使用",dataState:1,styleName:"used"},{id:3,label:"已失效",dataState:2,styleName:"overdue"}]);s((()=>{ut(void 0,void 0,void 0,(function*(){yield d()}))}),[]);const d=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield R({page:n.current,rows:c.current,dataState:r.current[e.current].dataState});t((t=>t.concat(o.list||[]))),n.current+=1}catch(o){console.log(o)}}));return{config:r,coe:e,list:o,setList:t,getList:d,switchTab:o=>ut(void 0,void 0,void 0,(function*(){e.current=o,n.current=1,t([]),yield d()}))}},te=()=>{const[o,t]=a([]),e=i(1);s((()=>{ut(void 0,void 0,void 0,(function*(){yield n()}))}),[]);const n=()=>ut(void 0,void 0,void 0,(function*(){e.current=1,t([]),yield c()})),c=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield R({page:e.current,rows:100,dataState:0,pbCode:"0004,0005"});t(o.list),e.current+=1}catch(o){console.log(o)}}));return{unusedList:o,getData:c,init:n}},ee=()=>{const[o,t]=a([]),e=i(1);s((()=>{ut(void 0,void 0,void 0,(function*(){yield n()}))}),[]);const n=()=>ut(void 0,void 0,void 0,(function*(){e.current=1,t([]),yield c()})),c=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield R({page:e.current,rows:100,dataState:1,pbCode:"0004,0005"});t(o.list),e.current+=1}catch(o){console.log(o)}}));return{usedList:o,getData:c,init:n}},ne=()=>{const[o,t]=a([]),e=i(1);s((()=>{ut(void 0,void 0,void 0,(function*(){yield n()}))}),[]);const n=()=>ut(void 0,void 0,void 0,(function*(){e.current=1,t([]),yield c()})),c=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield R({page:e.current,rows:100,dataState:2,pbCode:"0004,0005"});t(o.list),e.current+=1}catch(o){console.log(o)}}));return{overdueList:o,getData:c,init:n}},ce=(o,t,e)=>{const n=i(!0),c=i(0),[r,d]=a([]),[l,u]=a(!1);s((()=>{p("isFirst")}),[e]);const p=St((o=>{c.current=0,n.current=!0,m(e,o)})),m=St(((e,...i)=>ut(void 0,[e,...i],void 0,(function*({sortField:e="pricesetNprice",order:i=""},r=""){if(n.current){++c.current,u(!0);try{const s=yield w({distinctField:"goodsNo",sortField:e,order:i,goodsType:"00,40,50",page:c.current,rows:10,searchParam:t,classtreeCode:o});(zo(s.list)||s.list.length<10)&&(n.current=!1),u(!1),d((o=>r?s.list:o.concat(s.list)))}catch(o){--c.current}}}))));return{loading:l,getData:m,list:r}};function ie({contractBillcode:o,contractBbillcode:t}){const e=Eo(),[n,c]=a(!1),r=i(""),d=Go(),[l,u]=a([]),p=i({}),m=i({contMoney:0,orderMoney:0,logMoney:0,contractBillcode:""});s((()=>{(()=>{ut(this,void 0,void 0,(function*(){var e,n;try{if(t){const o=yield x({contractBbillcode:t,isLocalMock:!d}),n=yield Oo({contractBbillcode:null!==(e=o.dataObj)&&void 0!==e?e:"",isLocalMock:!d});m.current=n,u(n.payChannelList),p.current=n}else{const t=yield E({contractBillcode:o,isLocalMock:!d}),e=yield F({contractBillcode:null!==(n=t.dataObj)&&void 0!==n?n:"",isLocalMock:!d});m.current=e,u(e.payChannelList),p.current=e}}catch(o){console.log(44,o)}}))})()}),[]);const y=o=>{c(!0);const{ptradeSeqno:t,contractBlance:e,payChannelList:n}=p.current,{fchannelCode:i,faccountOuterNo:s=""}=g(n,o||r.current);return{ptradeSeqno:t,contractBlance:e,fchannelCode:i,faccountOuterNo:s}},g=(o,t)=>o.find((o=>"1"===t?o.ptfchannelAmt===t:o.fchannelCode===t))||{},f=()=>ut(this,void 0,void 0,(function*(){var o;const t=null!==(o=m.current.contractBillcode)&&void 0!==o?o:"";Jo("contractBillcode",{contractBillcode:t});const{ptradeSeqno:e,contractBlance:n,fchannelCode:c,faccountOuterNo:i}=y(),r=[{faccountIdType:"ACCOUNT",fchannelCode:c,orderAmount:m.current.orderMoney,faccountId:i}];return yield U({ptradeSeqno:e,payCommitStr:JSON.stringify(r),contractBlance:n})})),h=()=>ut(this,void 0,void 0,(function*(){try{const o=yield f();document.getElementById("v_html").innerHTML="<div>"+o.dataObj.htmlStr+"</div>",document.forms[0].submit(),c(!1)}catch(o){c(!1)}})),v=()=>ut(this,void 0,void 0,(function*(){try{const o=yield f();document.getElementById("v_html").innerHTML="<div>"+o.dataObj.htmlStr+"</div>",document.getElementById("paaspaysubmit").submit(),c(!1)}catch(o){c(!1)}})),S=()=>ut(this,void 0,void 0,(function*(){try{let o=(yield f()).dataObj.requestData;wx.requestPayment({timeStamp:o.timeStamp,nonceStr:o.nonceStr,package:o.package,signType:o.signType,paySign:o.paySign,success:function(o){var t;const e=null!==(t=m.current.contractBillcode)&&void 0!==t?t:"";Uo("result",{code:e})},fail:function(o){c(!1)},complete:function(o){c(!1)}})}catch(o){c(!1)}}));return{paymentImpl:()=>{var o;switch(r.current||Ao("请选择支付方式","none"),r.current){case"wechatmini":S();break;case"account":case"alipaywap":h();break;case"wechatwap":v();break;case"1":const{ptradeSeqno:t,contractBlance:n,fchannelCode:c,faccountOuterNo:i}=y("1"),r=[{faccountIdType:"ACCOUNT",fchannelCode:c,orderAmount:m.current.orderMoney,faccountId:i}],s=null!==(o=m.current.contractBillcode)&&void 0!==o?o:"";e.navigateTo({url:`/package/paypassword/index?code=${s}&ptradeSeqno=${t}&payCommitStr=${JSON.stringify(r)}&contractBlance=${n}`})}},channelList:l,handleRadio:o=>{r.current=pt(o)},contract:m,loading:n}}const re={provinceName:"",cityName:"",areaName:"",addressDetail:"",addressMember:"",addressPhone:"",addressDefault:""},se={contractSettlOpno:0,promotionCodes:null,shoppingCountPrice:0,totalDiscountPrice:0,accountsSumPrice:0,discount:0,freight:0,comDisMoney:0,copyComDisMoney:0},ae={dataPic:"",goodsName:"",goodsCamount:0,skuName:"",pricesetNprice:0};function de({skuId:o,goodsBeanStr:t,goodsNum:e,shoppingGoodsId:n,longContractgoodsBeanStr:c,scontractCode:r},d,l){const u=i([{dataPic:"",goodsName:"",goodsCamount:0,skuName:"",pricesetNprice:0}]),[p,m]=a([]),[y,g]=a(re),f=i(""),h=i([]),v=i([]),S=i([]),[C,b]=a(0),O=Go(),P=i(se),I=i([]);s((()=>{(()=>{ut(this,void 0,void 0,(function*(){b(0),P.current={contractSettlOpno:0,promotionCodes:null,shoppingCountPrice:0,totalDiscountPrice:0,accountsSumPrice:0,discount:0,freight:0,comDisMoney:0,copyComDisMoney:0},v.current=[],h.current=[],c?yield L((()=>Po({goodsBeanStr:decodeURIComponent(c),scontractCode:r}))):t&&t.trim()?yield L((()=>Io({goodsBeanStr:t}))):n&&n.trim()?yield L((()=>j({shoppingGoodsIdStr:`[${n}]`}))):o&&(yield L((()=>gt(o,e))))}))})()}),[d]);const k=()=>ut(this,void 0,void 0,(function*(){try{const o=yield V({pmContractGoodsDomainListStr:JSON.stringify(v.current)});m(o)}catch(o){console.log(74,o)}})),L=o=>ut(this,void 0,void 0,(function*(){try{const t=yield Promise.all([N({isLocalMock:!O}),o()]),[e=[],n=[]]=t,c=l?e.find((o=>o.addressId===l)):e.find((o=>"1"===o.addressDefault))||{};g(c),M(n,c),l=""}catch(o){console.log(o)}})),M=(o,t)=>{zo(o)||o.forEach((o=>{o.shoppingpackageList.forEach((o=>{P.current.comDisMoney+=o.disMoney,P.current.copyComDisMoney+=o.disMoney,o.shoppingGoodsList.forEach((t=>{v.current.push(t),P.current.shoppingCountPrice+=t.pricesetNprice*t.goodsCamount,t.contractGoodsGtype=0,f.current=o.promotionCode,"00"==t.goodsType&&J().then((o=>{}))})),o.disMoney>0&&h.current.push({contractSettlBlance:0==o.promotionInType?"PM":"COP",contractPmode:"0",contractSettlGmoney:Number(o.disMoney.toFixed(2)),contractSettlPmoney:Number(o.disMoney.toFixed(2)),contractSettlOpno:o.promotionCode,contractSettlOpemo:o.promotionName}),o.giftList?(o.shoppingGoodsList.forEach((o=>{o.ginfoCode=o.pmPromotionList.find((o=>"0001"==o.pbCode)).promotionCode})),u.current=[...o.shoppingGoodsList,...o.giftList]):u.current=o.shoppingGoodsList})),B(),O&&(c||T(),k(),A(t))}))},B=()=>{const{shoppingCountPrice:o,totalDiscountPrice:t,discount:e,comDisMoney:n,freight:c}=P.current;b(o-t-e-n+c)},T=()=>ut(this,void 0,void 0,(function*(){let t={};t=n?{shoppingGoodsIdStr:`[${decodeURIComponent(n)}]`}:{skuIdStr:JSON.stringify([{skuId:o,goodsNum:e}])};try{const o=yield $(Object.assign({isLocalMock:!O},t));P.current.freight=o.dataObj,B()}catch(o){console.log(180,o)}})),D=()=>{const{shoppingCountPrice:o,copyComDisMoney:t,discount:e}=P.current;return(o-t-e).toFixed(2)},G=()=>{const{shoppingCountPrice:o,copyComDisMoney:t,freight:e}=P.current;return(o-t+e).toFixed(2)},A=t=>{S.current=(t=>{const{addressMember:n,userName:c,provinceName:i,cityName:r,areaName:s,addressDetail:a,areaCode:d}=t;return[{contractPaytime:(new Date).valueOf(),goodsPbillno:0,goodsPmbillno:P.current.promotionCodes,contractProperty:"0",contractBlance:0,contractPmode:0,contractPumode:"0",goodsSupplierName:"",goodsSupplierCode:"",packageList:[{contractGoodsList:u.current,shoppingGoodsIdList:[],promotionCode:f.current,packageRemark:null}],packageMode:"",contractType:"50",ocContractSettlList:[],contractInmoney:G(),contractMoney:D(),goodsReceiptMem:n,goodsReceiptPhone:c,goodsReceiptArrdess:i+r+s+a,areaCode:d,contractNbillcode:null,skuIdList:o?[{skuId:+o,goodsNum:+e}]:[],giftSkuIdList:[]}]})(t);let n={rsSkuListStr:JSON.stringify(S.current)};ft(n).then((o=>{P.current.totalDiscountPrice=o.dataObj.totalDiscountPrice,P.current.contractSettlOpno=o.dataObj.contractSettlOpno,B()}))};return{savePayPrice:()=>{if(zo(y))return;(()=>{const{contractSettlOpno:o,totalDiscountPrice:t}=P.current;o&&0!=t&&h.current.push({contractSettlBlance:"UR",contractPmode:"0",contractSettlPmoney:t,contractSettlOpno:o})})(),Xo(S.current,"[0].ocContractSettlList",[...h.current,...I.current]);const o={orderDomainStr:JSON.stringify(S.current)};q(o).then((o=>{xo("paymentMode",{code:o.dataObj.contractBillcode})}))},address:y,list:u,payState:P,coupon:p,confirm:o=>{const{couponAmount:t,usercouponCode:e,promotionCode:n,discAmount:c}=o;I.current=[{contractSettlBlance:"COP",contractPmode:"0",contractSettlGmoney:+t,contractSettlPmoney:+c,contractSettlOpno:e,contractSettlOpemo:n}],P.current.discount=c,B()},amount:C}}const le={contractSettlBlance:"",contractEcurl:"",packageRemark:"",contractPmode:"",contractSettlGmoney:0,contractSettlPmoney:0,contractSettlOpno:"",contractSettlOpemo:"",freight:0,crp:{},_rechargeSmoney:0,cop:[]},ue=st(le);function pe(o=o=>o){return c(ue.subscribe,(()=>o(ue.getState())))}function me(o){const{shoppingCountPrice:t,comDisMoney:e,shoppingType:n,pricesetRefrice:c}=d((()=>{const t={shoppingCountPrice:0,comDisMoney:0,shoppingType:"",pricesetRefrice:0};return o.forEach((o=>{const{shoppingCountPrice:e,comDisMoney:n}=o;t.shoppingCountPrice+=e,t.comDisMoney+=n})),o.length>0&&(t.shoppingType=o[0].shoppingType||"",t.pricesetRefrice=o[0].pricesetRefrice||0),t}),[o]);return{shoppingCountPrice:t,comDisMoney:e,shoppingType:n,pricesetRefrice:c,changeContent:o=>{const t=pt(o);ue.setState({packageRemark:t})}}}const ye={provinceName:"",cityName:"",areaName:"",addressDetail:"",addressMember:"",addressPhone:"",addressDefault:"",addressId:"",provinceCode:"",userName:""};function ge(o,t,e,n,c){const[i,r]=a(ye);s((()=>{(()=>{ut(this,void 0,void 0,(function*(){try{const t=Go(),e=yield N({isLocalMock:!t,needCache:!0}),n=(()=>{const t=Ko(e,"addressDefault","asc"),n=t.find((t=>o===t.addressId))||{};return zo(n)?t.at(-1):n})();zt.addressInfo=n,zt.contractPumode="0",r(n),c||d(null==n?void 0:n.provinceCode)}catch(o){}}))})()}),[o]);const d=o=>ut(this,void 0,void 0,(function*(){let c={},i=$;c=n?{shoppingGoodsIdStr:`[${decodeURIComponent(n)}]`,areaCode:o}:{skuIdStr:JSON.stringify([{skuId:e,goodsNum:t}]),areaCode:o};try{const o=Go(),t=yield i(Object.assign({isLocalMock:!o},c));ue.setState({freight:t.dataObj})}catch(o){}}));return i}const fe={shoppingGoodsId:"",goodsNum:0,skuId:"",refreshNum:0,goodsBeanStr:"",longContractgoodsBeanStr:"",scontractCode:""},he={dataPic:"",goodsName:"",goodsCamount:0,skuName:"",pricesetNprice:0},ve={contractSettlOpno:0,upmMap:{},cop:[],pricesetRefrice:0,rebMoney:0,goodsCamount:0,shoppingCountPrice:0,totalDiscountPrice:0,accountsSumPrice:0,discount:0,freight:0,comDisMoney:0,copyComDisMoney:0,shoppingType:"",promotionCode:"",promotionCodes:""},Se=({shoppingGoodsId:o,goodsNum:t,skuId:e,goodsBeanStr:n,longContractgoodsBeanStr:c,scontractCode:r})=>{const[l,u]=a([]),[p,m]=a([]),[y,g]=a([]),f=i([]),[h,v]=a(0),[S,C]=a(0),[b,O]=a(0),P=pe(),{freight:I=0,crp:N,cop:k}=P,L=lt(P,["freight","crp","cop"]),M=i(0),B=i(null);s((()=>{ut(void 0,void 0,void 0,(function*(){ue.setState({freight:0,crp:{},cop:[],packageRemark:"",_rechargeSmoney:0,contractSettlBlance:"",contractPmode:"",contractEcurl:"",contractSettlGmoney:0,contractSettlPmoney:0,contractSettlOpno:"",contractSettlOpemo:""}),c?yield w((()=>Po({goodsBeanStr:decodeURIComponent(c),scontractCode:r}))):n&&n.trim()?yield w((()=>Io({goodsBeanStr:n}))):o&&o.trim()?yield w((()=>j({shoppingGoodsIdStr:`[${decodeURIComponent(o)}]`}))):e&&(yield w((()=>gt(e,t))))}))}),[]);const T=d((()=>{let o=0;p.forEach((t=>{o+=t.shoppingCountPrice}));let t=0;return k.forEach((e=>{["0005","B0005"].includes(e.pbCode)?t+=Number(o*(1-e.contractSettlGmoney/100).toFixed(2)):["0004","0003","B0004","B0003"].includes(e.pbCode)&&(t+=e.contractSettlPmoney)})),t}),[k]),D=d((()=>{if("06"===B.current)return I;const o=h-T+I-M.current-S-b;return console.log(h,T,I,M.current,S,b,"价格信息----"),o>=0?o:0}),[h,T,I,S,b]),G=d((()=>{const{contractSettlOpemo:o=0}=N;return D*+o/100}),[D,N]),A=d((()=>o=>{let t=0,e=0;o.forEach((o=>{t+=Wo(o,"upmMap.disamount",0),e+=Wo(o,"upmMap.integral",0)})),C(t),t>0&&f.current.push({contractSettlBlance:"INT",contractSettlPmoney:t,contractSettlGmoney:e})}),[]),R=(o,t)=>ut(void 0,void 0,void 0,(function*(){if(zo(o))return;const e=o[0]&&o[0].shoppingType||"",n=o[0]&&o[0].pricesetRefrice||0;"06"===e?yield(o=>ut(void 0,void 0,void 0,(function*(){if(o)try{const t=yield bo({},!0),e=Wo(t,"list[0].upointsNum",0),n=Number(o)||0,c=Math.min(n,e);C(c),c>0&&f.current.push({contractSettlBlance:"INT",contractSettlPmoney:c,contractSettlGmoney:c})}catch(o){console.error("查询用户积分失败",o),C(0)}else C(0)})))(n):(A(o),yield(o=>ut(void 0,void 0,void 0,(function*(){if(zo(o))O(0);else try{const t=[];o.forEach((o=>{t.push({packageList:[{contractGoodsList:o}]})}));const e=Go(),n={rsSkuListStr:JSON.stringify(t),isLocalMock:!e},c=yield ft(n,!0),i=Wo(c,"dataObj.totalDiscountPrice",0),r=Wo(c,"dataObj.contractSettlOpno","");O(i),i>0&&f.current.push({contractSettlBlance:"UR",contractSettlPmoney:i,contractSettlOpno:r})}catch(o){console.error("查询会员权益优惠失败",o)}})))(t))})),w=o=>ut(void 0,void 0,void 0,(function*(){try{const t=yield o();console.log(t,"datadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadata");const e=t.dataObj||t,{payState:n,shoppingGoodsList:c}=x(e);yield R(n,c)}catch(o){}})),x=o=>{if(zo(o))return{payState:[],shoppingGoodsList:[]};let t=[],e=[],n=[];return f.current=[],o.forEach((o=>{const c=Object.assign({},ve);c.shoppingType=o.shoppingType,B.current=o.shoppingType,c.pricesetRefrice=o.pricesetRefrice,c.upmMap=o.upmMap,M.current+=o.rebMoney;let i=[];o.shoppingpackageList.forEach((e=>{c.comDisMoney+=e.disMoney,c.copyComDisMoney+=e.disMoney;let n={channelCode:"",channelName:""};e.shoppingGoodsList.forEach(((o,i)=>{0===i&&(n=o),t.push(o),c.shoppingCountPrice+=o.pricesetNprice*o.goodsCamount,o.contractGoodsGtype=0,c.promotionCode=e.promotionCode,o.goodsType})),e.disMoney>0&&f.current.push({contractSettlBlance:0==e.promotionInType?"PM":8==e.promotionInType?"BMP":"COP",contractSettlGmoney:Number(e.disMoney.toFixed(2)),contractSettlPmoney:Number(e.disMoney.toFixed(2)),contractSettlOpno2:n.channelCode,contractSettlOpno1:n.channelName,contractSettlOpno:e.promotionCode,contractSettlOpemo:e.promotionName}),o.rebMoney>0&&f.current.push({contractSettlBlance:"REB",contractSettlGmoney:Number(o.rebMoney.toFixed(2)),contractSettlPmoney:Number(o.rebMoney.toFixed(2)),contractSettlOpno:e.promotionCode,contractSettlOpemo:e.promotionName,contractSettlOpno2:n.channelCode,contractSettlOpno1:n.channelName}),e.giftList&&(e.shoppingGoodsList=e.shoppingGoodsList.map((o=>(o.ginfoCode=o.pmPromotionList.find((o=>"0001"==o.pbCode)).promotionCode,o)))),i.push(...e.shoppingGoodsList,...e.giftList||[])})),n.push(c),e.push(i)})),m(n),u(e),g(t),E(n),{payState:n,shoppingGoodsList:t}},E=o=>{let t=0;o.forEach((o=>{const{shoppingCountPrice:e,totalDiscountPrice:n,discount:c,comDisMoney:i}=o;t+=e-n-c-i})),v(t)};return{amount:h,list:l,shoppingGoodsList:y,payState:p,ocContractSettlList:f,disCount:T,payPrice:D,creditMoney:G,orderStoreInfo:L,freight:I,rebMoney:M,pointsDeduction:S,urDiscount:b}},Ce=()=>{const[o,t]=a([]);return s((()=>{ut(void 0,void 0,void 0,(function*(){const{list:o}=yield ct("/web/pte/ptfpmode/queryPtfpmodesToStr.json");t(o)}))}),[]),{payList:o}},be=(o=[],t)=>{const[e,n]=a([]),[c,i]=a(!1),[r,l]=a([]),{payList:u}=Ce(),[p,m]=a([]),[y,g]=a({urechargeId:""}),[f,h]=a(!1),[v,S]=a(!1),{crp:C,contractEcurl:b,contractPmode:O}=pe();s((()=>{ut(void 0,void 0,void 0,(function*(){try{if(zo(o))return;const t=yield V({pmContractGoodsDomainListStr:JSON.stringify(o)});n(t)}catch(o){console.log(74,o)}}))}),[o]),s((()=>{ut(void 0,void 0,void 0,(function*(){const o=yield ct("web/crp/CrpUrecharge/queryCrpUrechargePage.json",{userinfoCode:$o("user").userInfoCode}),t=Wo(o,"list[0]",{}),e=yield ct("web/dd/falgSetting/queryFalgSettingPage.json",{flagSettingType:"creditSetting"});let n=Wo(e,"list",[]);n.some((o=>0===o.flagSettingInfo))||n.unshift({flagSettingInfo:0}),m(n),ue.setState({_rechargeSmoney:t.rechargeSmoney}),g(t)}))}),[]);const P=d((()=>C.contractSettlOpemo),[C]),I=d((()=>{var o,t;const{ptfpmodeName:e=""}=u.find((o=>o.ptfpmodeType===O))||{};return e||(ue.setState({contractPmode:null===(o=u[0])||void 0===o?void 0:o.ptfpmodeType,crp:{},contractEcurl:""}),null===(t=u[0])||void 0===t?void 0:t.ptfpmodeName)}),[u,O]),N=d((()=>r.map((o=>o.promotionName)).join(",")),[r]),k=()=>{const o=r.map((o=>{const{usercouponCode:t,promotionCode:e,discAmount:n}=o;return{pbCode:o.pbCode,contractSettlBlance:"COP",contractSettlGmoney:+n,contractSettlPmoney:+n,contractSettlOpno:t,contractSettlOpemo:e}}));ue.setState({cop:o})};return{coupon:e,visible:c,selectCoupon:N,onChange:o=>{const n=pt(o),c=e.filter((o=>t?n.includes(o.couponNo):n===o.couponNo));console.log(1111,r),l(c)},setVisible:i,creditList:p,creditInfo:y,creditVisible:f,setCreditVisible:h,onCreditChange:o=>{const t=pt(o);h(!1),ue.setState({crp:{contractSettlOpemo:t,contractSettlBlance:"CRP"}})},selectCredit:P,onPayChange:o=>{const t=pt(o);S(!1),ue.setState({contractPmode:t,crp:{},contractEcurl:""})},contractPmode:O,setPayVisible:S,payVisible:v,payList:u,payName:I,handleChooseImg:()=>{const o=Eo(),t=process.env.REACT_APP_BASE_URL;o.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album","camera"],success:function(e){o.uploadFile({url:`${process.env.REACT_APP_BASE_URL}web/oc/refund/uploadRefFile.json`,filePath:e.tempFilePaths[0],name:"file",header:{"saas-agent":"WEB"!==o.getEnv?"qj-wemini":"","saas-token":$o("saas-token")},success(o){const e=JSON.parse(o.data),n=Go();if("nologin"===e.errorCode)xo(n?"/account/auth/index":"/account/mobileLogin/index");else{const o=t+e.fileUrl;ue.setState({contractEcurl:o})}}})}})},contractEcurl:b,confirmImpl:()=>{i(!1),k()},couponValue:r,resetImpl:()=>{l([])}}};function Oe({ocContractSettlList:o,payState:t,goodsBeanStr:e,list:n},c="",r,s=""){const d=i([]),[l,u]=a(!1),{crp:p,_rechargeSmoney:m,contractPmode:y,contractEcurl:g,packageRemark:f,cop:h}=pe(),v=i(0),S=o=>{const{addressMember:e,userName:i,provinceCode:r,provinceName:s,cityName:a,areaName:d,addressDetail:l}=o;(o=>{if(o)return decodeURIComponent(o).split(",")})(c);let u={packageRemark:f};zo(p)||(u.creditType=p.contractSettlOpemo,u.creditAccount=m),g&&(u.contractEcurl=g);const h=zt.contractPumode||"0";return v.current=0,t.map(((o,t)=>(v.current+=o.shoppingCountPrice,Object.assign({contractPaytime:(new Date).valueOf(),goodsPbillno:0,goodsPmbillno:o.promotionCodes,contractProperty:"0",contractBlance:0,contractPmode:y,contractPumode:h,goodsSupplierName:"",goodsSupplierCode:"",packageList:[{contractGoodsList:n[t],shoppingGoodsIdList:(n[t]||[]).map((o=>o.shoppingGoodsId)),promotionCode:o.promotionCode,packageRemark:f}],packageMode:"",contractType:o.shoppingType,ocContractSettlList:[],goodsReceiptMem:e,goodsReceiptPhone:i,goodsReceiptArrdess:s+a+d+l,areaCode:r,contractNbillcode:null},u))))};return{savePayPrice:()=>ut(this,void 0,void 0,(function*(){const t=zt.addressInfo;if(zo(t))return void Ao("请选择收货地址");if(!y)return void Ao("请选择支付方式");if("1"===y&&!g)return void Ao("请上传附件");d.current=S(t);const n=h.map((o=>Object.assign(Object.assign({},o),{contractSettlGmoney:["0005","B0005"].includes(o.pbCode)?Number(v.current*(1-o.contractSettlGmoney/100).toFixed(2)):o.contractSettlGmoney,contractSettlPmoney:["0005","B0005"].includes(o.pbCode)?Number(v.current*(1-o.contractSettlPmoney/100).toFixed(2)):o.contractSettlPmoney})));let i=zo(p)?[...o.current,...n]:[...o.current,p,...n];i=i.map((o=>Object.assign(Object.assign({},o),{contractPmode:y}))),Xo(d.current,"[0].ocContractSettlList",i),u(!0);const a={orderDomainStr:JSON.stringify(d.current)};try{const o=yield q(a);(()=>{if(c){const{CartList:o=0}=Ro();wo({CartList:o+1})}})();const{contractBillcode:t,contractBbillcode:n}=Wo(o,"dataObj",{contractBillcode:"",contractBbillcode:""});y+""=="1"||"100"==p.creditType||0===r||e?Uo("result",s?{code:t,goodsType:s}:{code:t}):xo("paymentMode",s?{contractBbillcode:n||t,goodsType:s}:{contractBbillcode:n||t})}catch(o){}finally{u(!1)}})),loading:l}}const Pe={provinceName:"",cityName:"",areaName:"",addressDetail:"",addressMember:"",addressPhone:"",userinfoOcode:""};function Ie(o){const[t,e]=a(Pe);return s((()=>{(()=>{ut(this,void 0,void 0,(function*(){try{const t={page:1,rows:10};o&&(t.userinfoOcode=o);const n=Go(),c=yield No(Object.assign(Object.assign({},t),{isLocalMock:!n})),i=Array.isArray(c&&c.list)?c.list.map((o=>Object.assign(Object.assign({},o),{addressMember:o.userinfoCompname||"",addressPhone:o.userinfoTel||"",addressDetail:o.companyAddress||""}))):[],r=(()=>{const t=i.find((t=>o===t.userinfoOcode))||{};return zo(t)?i&&i[0]||{}:t})();zt.addressInfo=r,zt.contractPumode="1",e(r),ue.setState({freight:0})}catch(o){}}))})()}),[o]),t}const Ne={success:{icon:"zhifuchenggong",msg:"支付成功",buttonText:"查看订单",menuCode:"orderDetail",color:"#2ed82e"},error:{icon:"zhifushibai",info:"您的订单将保留15分钟,可点击下方“去支付”完成订单",buttonText:"去支付",menuCode:"paymentMode",color:"red"}};function ke(o){const[t,e]=a({icon:"daifahuo1",msg:"支付中",color:"#2ed82e",buttonText:"去支付",dataObj:{}}),[n,c]=a(!1),i=Go();return s((()=>{(()=>{ut(this,void 0,void 0,(function*(){const t=Wo(qo,"taroMenu[0].menuOpcode","index");if(i){Eo().setStorageSync("menuOpcode",t)}c(!0);try{const t=yield Y({contractBillcode:o,isLocalMock:!i}),{sysRecode:n,dataObj:c}=t,r=lt(t,["sysRecode","dataObj"]);e(Object.assign(Object.assign({dataObj:c,sysRecode:n},r),Ne[n]))}catch(t){e(Object.assign({dataObj:{contractBillcode:o},msg:t},Ne.error))}finally{c(!1)}}))})()}),[]),{result:t,loading:n}}function Le(o,t){const[e,n]=a(o);return s((()=>{const e=t.filter((o=>!(Zo(o)||zo(o)))).filter((o=>!Object.values(o).every((t=>Zo(t)||zo(o)))));let c=o;zo(e)||(c=e),n(c)}),[t]),e}const Me=[{name:"全部",code:""},{name:"待付款",code:"1"},{name:"待发货",code:"2"},{name:"待收货",code:"3"},{name:"已完成",code:"4"},{name:"待评价",code:"5",contractAppraise:0},{name:"已评价",code:"6",contractAppraise:1},{name:"已取消",code:"-1"}],Be=(o,t)=>{if(t){const{name:o=""}=Me.find((o=>o.contractAppraise===t))||{};return o}const{name:e=""}=Me.find((t=>t.code.split(",").includes(o+"")))||{};return e},Te={1:[{name:"取消订单",handler:"cancel"},{name:"立即支付",handler:"pay"}],2:[{name:"申请退款",handler:"applyRefund"}],3:[{name:"物流信息",handler:"expressInfo"},{name:"确认收货",handler:"confirmReceive"}],4:[{name:"物流信息",handler:"expressInfo"}],5:[{name:"物流信息",handler:"expressInfo"},{name:"发票申请",handler:"invoiceApply"},{name:"去评价",handler:"evaluate"}],99:[{name:"物流信息",handler:"expressInfo"},{name:"发票申请",handler:"invoiceApply"},{name:"查看评价",handler:"openEvaluate"}]},je={goodsList:[],contractPmode:"0",contractType:"",creditMoney:0,contractEcurl:"",dataState:"",goodsLogmoney:0,packageRemark:"",goodsReceiptMem:"",goodsReceiptPhone:"",goodsReceiptArrdess:"",dataBmoney:0,goodsPmoney:0,contractInmoney:0,contractBillcode:"",refundMoney:0,gmtCreate:"",goodsNum:0,contractId:0,contractPumode:"0"},De=o=>{const[t,e]=a(""),n=Go(),[c,i]=a(je);s((()=>{ut(void 0,void 0,void 0,(function*(){try{const t=yield _({contractBillcode:o,isLocalMock:!n});if(zo(t))return;e(Be(t.dataState)),i(t)}catch(o){console.log(45,o)}}))}),[]);const r=d((()=>Wo(c,"packageList[0].packageRemark","")),[c]),l=d((()=>{const o=Wo(c,"ocContractSettlList",[])||[],{contractSettlGmoney:t=0}=o.find((o=>"CRP"===o.contractSettlBlance))||{contractSettlGmoney:0};return t}),[c]);return{orderDetail:c,status:t,handleApplyBtn:(o,t)=>ut(void 0,void 0,void 0,(function*(){try{const{contractBillcode:e,skuCode:n}=o,c=yield W({contractBillcode:e,skuCode:n});if(!1===c.success)return void Ht(c.msg,"none");xo("refundType",{contractBillcode:e,skuCode:n,dataState:t})}catch(o){console.log(o)}})),creditMoney:l,packageRemark:r}};function Ge({dataState:o="",contractAppraise:t,contractType:e,contractId:n,contractBillcode:c,init:i,dataBmoney:r,skuCode:s}){const{handleApplyBtn:a}=De(c||""),l=d((()=>{const n=Te[t?99:o+""]||[];return"06"===e?n.filter((o=>"invoiceApply"!==o.handler)):n}),[o]),u=(()=>({expressInfo:()=>{xo("expressInfo",{code:c})},pay:()=>{xo("paymentMode",{contractBillcode:c})},evaluate:()=>{xo("evaluateDetail",{code:c})},openEvaluate:()=>{xo("evaluateViewDetail",{code:c})},confirmReceive:()=>ut(this,void 0,void 0,(function*(){try{const{msg:o}=yield z({contractBillcode:c});Ao(o,"none"),setTimeout((()=>{null==i||i()}),500)}catch(o){}})),cancel:()=>ut(this,void 0,void 0,(function*(){try{const{msg:o}=yield H({contractId:n});Ao(o,"none"),setTimeout((()=>{null==i||i()}),500)}catch(o){}})),invoiceApply:()=>{xo("addInvoice",{invlistOcode:c,invlistOpamt:r})},applyRefund:()=>{a({contractBillcode:c,skuCode:s},o)}}))();return{handlerImpl:o=>{u[o]()},operateArray:l}}const Ae={contractBillcode:"",contractType:"",goodsList:[{dataPic:"",goodsName:"",dataBmoney:0,goodsCamount:0,contractGoodsId:0,dataState:0}],dataBmoney:0,dataBnum:0,dataState:0,contractId:"",contractAppraise:0};function Re(o,t,e){const n=i(!1),[c,r]=a(!1),[d,l]=a([Ae]),u=i(0);s((()=>{p()}),[t]);const p=St((()=>{n.current=!1,u.current=0,m()})),m=St((()=>ut(this,void 0,void 0,(function*(){if(n.current)return;r(!0),++u.current;const{code:t,contractAppraise:c=""}=o;try{const o=Go(),i=(yield K({page:u.current,rows:10,contractAppraise:c,contractType:e,isLocalMock:!o,childFlag:!0,dataStateStr:"6"===t?"5":t})).list||[];n.current=zo(i)||i.length<10,l((o=>1!==u.current?o.concat(i):i)),r(!1)}catch(o){}}))));return{onScroll:m,data:d,loading:c,init:p,countdownCancel:o=>ut(this,void 0,void 0,(function*(){yield Q({contractId:o})}))}}const we={0:"在途",1:"揽收",2:"疑难",3:"签收",4:"退签",5:"派件",8:"清关",14:"拒签"},xe=o=>{const[t,e]=a({}),[n,c]=a({});return s((()=>{ut(void 0,void 0,void 0,(function*(){try{const t=Go(),n=yield _({contractBillcode:o,isLocalMock:!t});e(n);const i=Wo(n,"packageList[0].expressCode",""),r=Wo(n,"packageList[0].packageBillno"),s=yield X({expressNo:r,expressType:i,isLocalMock:!t});c(JSON.parse(s.dataObj))}catch(o){console.log(o)}}))}),[]),{info:t,detail:n,stateObj:we}};function Ee(){const[o,t]=a(""),[e,n]=a([]),c=Go();s((()=>{i()}),[]);const i=()=>ut(this,void 0,void 0,(function*(){try{let o=yield Z();n(o||[]);const e=Wo(o,"[0].goodsClassCode");t(e)}catch(o){console.log(o)}}));return{activeKey:o,navList:e,flag:c,setActiveKey:t}}const Fe=(o=0)=>{const[t,e]=a([{collectOpcont:"",collectOpnum:""}]),n=i(1),[c,r]=a(!1),[d,l]=a(""),[u,p]=a(!1),[m,y]=a(""),[g,f]=a(!1);s((()=>{h()}),[]);const h=()=>{n.current=1,e([]),S()},S=()=>ut(void 0,void 0,void 0,(function*(){try{const t=yield v({row:10,page:n.current,collectType:o});e((o=>o.concat(Wo(t,"dataObj.collectList.list",[])))),n.current+=1}catch(o){return console.log(o),[]}})),C=()=>{let o=[];for(let e=0;e<t.length;e++)o.push(t[e].collectCode);return o.toString()};return{collectionList:t,edit:c,setEdit:r,getData:S,collectCodeStr:d,getSelectItem:o=>{const e=pt(o);l(e.toString()),e.length===t.length?f(!0):f(!1)},delItem:()=>ut(void 0,void 0,void 0,(function*(){try{yield oo({collectCodeStr:d}),n.current=1,h()}catch(o){console.log(o)}})),init:h,checked:u,setChecked:p,handleSelectAll:o=>{pt(o).length?(p(!0),l(C())):p(!1)},selectAll:m,setSelectAll:y,selectAllChecked:g}},Ue=o=>{const[t,e]=a([]),n=i([]),c=i({}),r=Go();s((()=>{ut(void 0,void 0,void 0,(function*(){yield u(),yield d()}))}),[]);const d=()=>ut(void 0,void 0,void 0,(function*(){try{const t=yield _({contractBillcode:o,isLocalMock:!r}),n=l(Wo(t,"goodsList",[])),{contractBillcode:i,memberBcode:s,memberBname:a,memberCode:d,memberName:u}=n[0];c.current={contractBillcode:i,memberBcode:s,memberBname:a,memberCode:d,memberName:u},e(n)}catch(o){console.log(o)}})),l=o=>{for(let t=0;t<o.length;t++)o[t].upImgLength=!0,o[t].upImg=[],o[t].evaluateGoodsImgs="",o[t].evaluateScopeList=[n.current[0]],o[t].evaluateGoodsContent="";return o},u=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield to({applyTarget:"goods",isLocalMock:!r});n.current=o[0].templateValuesReList}catch(o){console.log(o)}}));return{orderInfo:t,changeStar:(o,c)=>{const i=[...t],r=[];for(let o=0;o<c;o++)r.push(n.current[o]);i[o].evaluateScopeList=r,e(i)},Submit:()=>ut(void 0,void 0,void 0,(function*(){try{yield eo({paramStr:JSON.stringify(t)}),yield no(Object.assign({paramStr:JSON.stringify(t)},c.current)),xo("orderlist",{indexId:6})}catch(o){console.log(o)}})),changeContent:(o,n)=>{const c=[...t];c[o].evaluateGoodsContent=pt(n),e(c)}}},Je=o=>{const[t,e]=a([]),n=Go(),c=Eo();s((()=>{ut(void 0,void 0,void 0,(function*(){yield i()}))}),[o]);const i=()=>ut(void 0,void 0,void 0,(function*(){try{const t=yield ko({contractBillcode:o,isLocalMock:!n}),c=Wo(t,"list",[]);e(c)}catch(o){console.log(o)}}));return{orderInfo:t,handleDelete:()=>ut(void 0,void 0,void 0,(function*(){try{const o=(t[0]||{}).evaluateGoodsId||8215;if(!o)return;yield Lo({evaluateGoodsId:o,isLocalMock:!n}),yield Ao("删除成功","none"),c.navigateBack({delta:1})}catch(o){console.log(o)}}))}},$e=()=>{const[o,t]=a([]),e=i(1),[n,c]=a(!1),[r,d]=a(""),[l,u]=a(!1),[p,m]=a(""),[y,g]=a(!1),[f,h]=a(!1),v=i(!1);s((()=>{S()}),[]);const S=()=>ut(void 0,void 0,void 0,(function*(){e.current=1,v.current=!1,t([]),yield C()})),C=()=>ut(void 0,void 0,void 0,(function*(){var o;if(!v.current){h(!0);try{const n=yield co();if(0===(null===(o=n.list)||void 0===o?void 0:o.length))return;if(t((o=>1===e.current?n.list:o.concat(n.list||[]))),n.list.length<10)return void(v.current=!0);e.current+=1}catch(o){return t([]),[]}finally{h(!1)}}})),b=()=>{let o=[];for(let t=0;t<collectionList.length;t++)o.push(collectionList[t].collectCode);return o.toString()};return{footprintList:o,edit:n,setEdit:c,getData:C,getSelectItem:o=>{const t=pt(o);d(t.toString())},delItem:()=>ut(void 0,void 0,void 0,(function*(){try{yield io({footprintCodeStr:r}),yield S(),c(!1)}catch(o){console.log(o)}})),init:S,checked:l,setChecked:u,handleSelectAll:o=>{pt(o).length?(u(!0),setCollectCodeStr(b())):u(!1)},selectAll:p,setSelectAll:m,selectAllChecked:y,loading:f}};function qe(o){const[t,e]=a([]);s((()=>{(()=>{ut(this,void 0,void 0,(function*(){try{const t=yield Mo({page:1,rows:o,tginfoMenuCode:"announcement"}),n=Wo(t,"list",[]);e(n)}catch(o){}}))})()}),[o]);return{content:d((()=>t.map((o=>o.doclistTitle))),[t]),navigator:o=>{const e=Wo(t,`${o}.doclistId`,"");xo("articleDetail",{noticeId:e})}}}const Ve=o=>{const[t,e]=a({});s((()=>{ut(void 0,void 0,void 0,(function*(){yield n()}))}),[]);const n=()=>ut(void 0,void 0,void 0,(function*(){try{const t=yield ro({noticeId:o});e(t)}catch(o){console.log(o)}}));return{info:t,setInfo:e}},Ye={doclistTitle:"",doclistTitle4:"",doclistContent:"",gmtCreate:""},_e=o=>{const[t,e]=a(Ye);return s((()=>{ut(void 0,void 0,void 0,(function*(){try{const t=Go(),n=yield so({doclistId:o,isLocalMock:!t});e(n)}catch(o){console.log(o)}}))}),[]),{info:t}},We=({defaultValue:o,goods:t},e)=>{const[n,c]=a(o),r=i();return s((()=>{ot(r.current,t)||(r.current=t,zo(t)?c(o):ut(void 0,void 0,void 0,(function*(){try{const o=yield w({[e]:t.toString(),distinctField:"goodsNo",goodsType:"00,40"});c(o.list)}catch(t){c(o)}})))}),[t]),{list:n}},ze=o=>{const[t,e]=a([]),[n,c]=a([]),{coupons:i,defaultValue:r}=o;s((()=>{d()}),[i]);const d=()=>ut(void 0,void 0,void 0,(function*(){if(0!==i.length)try{const o=yield ao({promotionCode:null==i?void 0:i.join(","),list:1});e(Wo(o,"list",[]))}catch(o){console.log(o)}else e(r)}));return{list:t,setList:e,takeCoupon:o=>ut(void 0,[o],void 0,(function*({promotionCode:o,couponAmount:t,index:e}){try{yield g({promotionCode:o,couponAmount:t})}catch(o){console.log(41,o)}finally{c((o=>o.concat(e)))}})),takeList:n}},He=t([{},Yo]);function Ke({initialValue:t,children:e}){return o(He.Provider,{value:a(t||{}),children:e})}function Qe(){const o=n(He);return o||[{},Yo]}const Xe=()=>{const[,o]=Qe();return{goTop:()=>{o((o=>{const{scrollTop:t}=o;return Object.assign(Object.assign({},o),{scrollTop:0===t?1:0})}))}}},Ze=({params:o})=>{const t=i([]),[e,n]=a([]),c=i(0),r=i(10);s((()=>{c.current=0,t.current=[],d()}),[o]);const d=()=>ut(void 0,void 0,void 0,(function*(){const e=Go();++c.current;try{const i=yield lo({isLocalMock:!e,pbCode:o,list:1,page:c.current,rows:r.current}),s=Wo(i,"list",[]);t.current.push(...s),n(t.current)}catch(o){console.log(o)}}));return{list:e,getData:d}},on=({contractBillcode:o,skuCode:t})=>{const[e,n]=a({}),[c,i]=a(!1),[r,d]=a(1),[l,u]=a(0),[p,m]=a(!1),[y,g]=a(!1);s((()=>{ut(void 0,void 0,void 0,(function*(){yield f()}))}),[]);const f=()=>ut(void 0,void 0,void 0,(function*(){m(!0);try{const e=Go(),c=(yield uo({contractBillcode:o,skuCode:t,isLocalMock:!e})).dataObj,{contractGoodsMoney:i,contractGoodsAremoney:r,goodsCamount:s,contractGoodsArefnum:a}=c,l=+i-+r;if(n(c),.01===l)return u(l),g(!0),void d(+s-+a);u(c.contractGoodsPrice)}catch(o){console.log(o)}finally{m(!1)}}));return{typeTip:c,setTypeTip:i,goodsNum:r,handleStep:o=>{if(y)return;const{goodsCamount:t,contractGoodsArefnum:n,contractGoodsMoney:c,contractGoodsAremoney:i,contractGoodsPrice:s}=e;if("plus"===o){const o=+t-+n;if(r>=o)return;u(o===r+1?c-i:(r+1)*s),d((o=>o+1))}else if("minus"===o){if(1===r)return;u((r-1)*s),d((o=>o-1))}},goodsInfo:e,goApply:(o,t,e,n)=>{xo("afterSalesApply",{refundType:o,contractBillcode:t,skuCode:e,goodsNum:n,goodsPrice:l})},loading:p,goodsPrice:l,stepLock:y}},tn=({contractBillcode:o,skuCode:t})=>{const[e,n]=a([]),[c,i]=a(!1),[r,d]=a(!1),[l,u]=a(""),[p,m]=a([]),[y,g]=a({}),[f,h]=a(""),[v,S]=a(!1),C=Go();s((()=>{ut(void 0,void 0,void 0,(function*(){yield b()}))}),[]);const b=()=>ut(void 0,void 0,void 0,(function*(){try{const e=yield uo({contractBillcode:o,skuCode:t,isLocalMock:!C});g(e.dataObj)}catch(o){console.log(o)}})),O=o=>o.map((o=>({refundFileUrl:o})));return{tip:"请与商家协商,确认达成一致后填写协商好的退款金额。",reasonList:e,popupVisible:c,popupLoading:r,handlePopupShow:()=>ut(void 0,void 0,void 0,(function*(){i((o=>!o)),c||0!==e.length||(yield ut(void 0,void 0,void 0,(function*(){d(!0);try{const o=yield mo({isLocalMock:!C});n(o)}catch(o){console.log(o)}finally{d(!1)}})))})),handleChooseReason:o=>{u(pt(o)),i(!1)},reason:l,handleChooseImg:()=>{const o=Eo();let t=Vo();"WEB"===o.getEnv()&&(t="/"),o.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album","camera"],success:function(e){o.uploadFile({url:`${t}web/oc/refund/uploadRefFile.json`,filePath:e.tempFilePaths[0],name:"file",formData:{tenantCode:"00000001"},fileName:e.tempFiles[0].originalFileObj.name,header:{"saas-agent":"WEB"===o.getEnv()?"qj-wap":"qj-wemini","saas-token":$o("saas-token")},success(o){const e=JSON.parse(o.data),n=Go();if("nologin"===e.errorCode)xo(n?"/account/auth/index":"/account/mobileLogin/index");else{const o=t.slice(0,-1)+e.fileUrl;m((t=>[...t,o]))}}})}})},placeholder:"描述补充,有助于商家更好的处理售后问题",imgGroup:p,handleDelImg:o=>{m((t=>[...t.slice(0,o),...t.slice(o+1)]))},limit:3,goodsInfo:y,handleFillInReason:o=>{h(pt(o))},handleSubmit:(o,t,e,n)=>ut(void 0,void 0,void 0,(function*(){const{contractGoodsCode:c,goodsCamount:i,contractGoodsPrice:r}=y;if(!l)return void Ht("请填写退款信息","none");S(!0);const s={ocRefundGoodsBeanList:[{memberCcode:y.memberCcode,contractGoodsCode:c,goodsCamount:i,refundGoodsNum:+o,refundGoodsAmt:n}],contractBillcode:t,refundMoney:n,refundEx:l,refundMeo:f,ocRefundFileDomainList:O(p),refundType:e};try{const o=yield po({params:JSON.stringify(s)});o.success&&(Ht(o.msg),setTimeout((()=>{xo("afterSalesList")}),1e3))}catch(o){console.log(o)}finally{S(!1)}})),loading:v}},en=({refundCode:o})=>{const[t,e]=a({}),[n,c]=a([]),[i,r]=a(!1),[d,l]=a(""),[u,p]=a(""),[m,y]=a(""),[g,f]=a(!1),h=Go();s((()=>{ut(void 0,void 0,void 0,(function*(){yield v()}))}),[]);const v=()=>ut(void 0,void 0,void 0,(function*(){f(!0);try{nt(yo);const t=yield yo({refundCode:o,isLocalMock:!h});1===t.dataState&&(yield S()),e(t)}catch(o){console.log(o)}finally{f(!1)}})),S=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield fo({dataState:1});c(o.list)}catch(o){console.log(o)}}));return{setAfterSalesDetailInfo:e,afterSalesDetailInfo:t,submitExpressInfo:()=>ut(void 0,void 0,void 0,(function*(){if(d&&u&&m)try{yield go({packageBillno:d,refundCode:o,packageCode:u,packageName:m}),nt(yo),yield v()}catch(o){console.log(o)}else Ht("请填写完成信息","error")})),companyList:n,handleCancelAfterSales:t=>ut(void 0,void 0,void 0,(function*(){try{yield ho({goodsCode:t,refundCode:o}),nt(yo),yield v()}catch(o){console.log(o)}})),popupShow:i,handlePopupShow:()=>{r((o=>!o))},chooseCompany:o=>{const t=pt(o).split("-");y(t[0]),p(t[1]),r(!1)},packageName:m,setPackageBillno:l,loading:g}},nn=(o,t)=>{const e=i(!1),[n,c]=a(!1),[r,d]=a([]),l=i(0),[u,p]=a(!0),m=Go();s((()=>{y()}),[t]);const y=St((()=>{l.current=0,d([]),g()})),g=St(((...t)=>ut(void 0,[...t],void 0,(function*(t={}){if(e.current)return;c(!0),++l.current;const{code:n}=o;try{const o=yield vo({page:l.current,rows:10,dataStates:n,isLocalMock:!m});e.current=zo(o.list)||o.list.length<10,0===o.list.length&&p(!1),d((t=>t.concat(o.list||[])))}catch(o){--l.current,console.log(o)}finally{c(!1)}}))));return{afterSalesList:r,onScroll:g,loading:n,init:y,goAfterSalesDetail:o=>{xo("afterSalesDetail",{refundCode:o})},haseData:u}},cn=[{name:"全部",code:""},{name:"进行中",code:"0,1,2,3,4,5"}],rn=()=>({mySettingGoBind:()=>{xo(_t.confirmPhone)},mySettingLogout:()=>ut(void 0,void 0,void 0,(function*(){const o=Eo();try{const t=yield So();o.removeStorage({key:"saas-token"}),Ht(t.msg),setTimeout((()=>{Fo(1)}),1e3)}catch(o){console.log(o)}}))});function sn(o){const t=i(!1),[e,n]=a(!1),[c,r]=a([]),[d,l]=a(!0),u=i(0);s((()=>{m()}),[o]);const p=St((o=>ut(this,void 0,void 0,(function*(){n(!0);try{const e=Go(),n=((yield No({page:o,rows:10,userinfoTypeStr:"0,1,2,3,11,12",isLocalMock:!e})).list||[]).map((o=>Object.assign(Object.assign({},o),{addressMember:o.userinfoCompname||"",addressPhone:o.userinfoTel||"",addressDetail:o.companyAddress||""})));t.current=zo(n)||n.length<10,r((t=>1===o?n:t.concat(n))),u.current=o,l(!1)}catch(t){1!==o&&--u.current,l(!1)}finally{n(!1)}})))),m=St((()=>{t.current=!1,u.current=0,r([]),l(!0),p(1)}));return{list:c,loading:e,skullShow:d,onScroll:St((()=>ut(this,void 0,void 0,(function*(){if(t.current)return;const o=u.current+1;yield p(o)})))),init:m}}function an(o){return{handlerImpl:()=>{wo({PlaceOrderPickupAddress:o.userinfoOcode,PlaceOrderAddressTabs:{userinfoOcode:o.userinfoOcode}}),Fo(-1)}}}const dn=()=>{const[o,t]=a(0),[e,n]=a([]),[c,i]=a(!1),[r,d]=a(!1);s((()=>{l()}),[]);const l=()=>ut(void 0,void 0,void 0,(function*(){i(!0);try{yield u(),yield p()}catch(o){console.log("初始化签到数据失败:",o)}finally{i(!1)}})),u=()=>ut(void 0,void 0,void 0,(function*(){var o;try{const e=null===(o=(yield Bo({})).list)||void 0===o?void 0:o.find((o=>"CheckIn"===o.pointsRuleApi));e&&t(e.pointsRuleNum||0)}catch(o){console.log("获取签到积分失败:",o)}})),p=()=>ut(void 0,void 0,void 0,(function*(){try{const o=it(),t=o.year(),e=o.month()+1,c=((yield To({year:t,month:e})).list||[]).map((o=>it(o.gmtCreate).format("YYYY-MM-DD")));n(c)}catch(o){console.log("获取签到记录失败:",o)}}));return{pointsNum:o,signedDates:e,loading:c,signing:r,handleSignin:()=>ut(void 0,void 0,void 0,(function*(){if(r)return;const t=it(),n=t.format("YYYY-MM-DD");if(e.includes(n)){if(Go()){Eo().showToast({title:"今日已签到",icon:"none",duration:2e3})}}else{d(!0);try{yield jo({signMap:t.date(),pointsNum:o,signAddr:"0",signLat:"0",signLong:"0"}),yield Do({paramStr:JSON.stringify({pointsRuleApi:"CheckIn",upointsClearOpcode:it().format("YYYY-MM-DD HH:mm:ss")})}),yield p();if(Go()){Eo().showToast({title:`签到成功,获得${o}积分`,icon:"success",duration:2e3})}}catch(o){console.log("签到失败:",o);if(Go()){Eo().showToast({title:o.msg||"签到失败,请重试",icon:"none",duration:2e3})}}finally{d(!1)}}})),refreshSignList:p}},ln=o=>{const[t,e]=a([]),[n,c]=a(!1);s((()=>{i()}),[o]);const i=()=>ut(void 0,void 0,void 0,(function*(){c(!0);try{const t=o.year(),n=o.month()+1,c=((yield To({year:t,month:n})).list||[]).map((o=>({date:it(o.signTime||o.gmtCreate).format("YYYY-MM-DD"),points:o.pointsNum||0})));e(c)}catch(o){console.log("获取签到明细失败:",o),e([])}finally{c(!1)}}));return{signinDetails:t,loading:n,refresh:i}};export{Ke as ApplicationContext,Ut as StoreProvider,yt as addCardSku,ye as addressInitial,cn as afterSalesTabConfig,mt as checkSkuSpec,Bt as computedParams,st as createStore,Te as detailButton,Qt as formatTime,ht as getGoodDetail,pt as getRadioValue,ft as getTotalDiscountPriceImpl,he as goodListIntialValue,ae as goodListMock,at as goodStore,le as initalOrderValue,Tt as initialCoupon,Pt as initialValue,ve as initialValueOrder,rt as makeStore,Kt as navigator,fe as orderGoodValue,Be as orderStatusImpl,Me as orderStatusList,ue as orderStore,Ae as orderType,Pe as pickupAddressInitial,vt as popupImplement,gt as queryToContractImpl,_t as routerMap,Wt as routerMapArr,Ht as showToast,bt as useAddCoupon,Ct as useAddShopping,Ft as useAddressItem,Et as useAddressList,tn as useAfterSalesApply,on as useAfterSalesChooseType,en as useAfterSalesDetail,nn as useAfterSalesList,ze as useAllCoupon,Qe as useApplicationContext,_e as useArticleDetail,Nt as useBanner,qt as useCartItem,Vt as useCartList,Yt as useCartListNext,Xt as useCartOperate,Zt as useCartTop,Fe as useCollectionList,jt as useCoupon,oe as useCouponList,Ot as useCreatePoster,Le as useCube,$t as useDispatchImpl,xt as useEditAddress,Gt as useEvaluate,Ue as useEvaluateDetail,Je as useEvaluateViewDetail,xe as useExpressInfo,$e as useFootprint,Xe as useGoTop,Lt as useGoodCollection,It as useGoodDetail,Rt as useGoodFootprint,Mt as useGoodSku,dt as useGoodSkuStore,wt as useGoodSpecAndPrice,We as useGoods,Ee as useGoodsClassify,ce as useGoodsList,At as useGoodsShare,St as useImmutableCallback,Ze as useMarketingPromotion,dn as useMemberSignin,rn as useMySetting,qe as useNotice,Ve as useNoticeDetail,ge as useOrderAddress,be as useOrderCoupon,De as useOrderDetail,Se as useOrderGood,me as useOrderInfo,Re as useOrderList,Ge as useOrderOperate,Oe as useOrderPay,Ie as useOrderPickupAddress,ie as useOrderResult,ke as useOrderResultResult,ne as useOverdue,Ce as usePayMode,an as usePickupPointItem,sn as usePickupPointList,de as usePlaceOrder,Dt as usePromotion,ln as useSigninDetail,Jt as useStore,pe as useSyncOrderStore,te as useUnused,ee as useUsed,zt as userAddressData};
1
+ import{jsx as o}from"react/jsx-runtime";import{createContext as t,useReducer as e,useContext as n,useSyncExternalStore as c,useRef as i,useCallback as r,useEffect as s,useState as a,useMemo as d}from"react";import{addShoppingGoodsBySpec as l,addShoppingGoods as u,queryToContract as p,getTotalDiscountPrice as m,getResourceGoodsInfoBySkuCode as y,saveUsercoupon as g,getSetsupDisUtil as f,checkCollectExit as h,queryCollectPage as v,saveCollect as S,deleteCollectByCode as C,queryCouponListBySkuCode as b,queryPromotionListByGoodsCode as O,queryEvaluateGoodsPagetrue as P,saveFootprint as I,queryAddressBymerberCode as N,saveAddress as k,deleteAddress as L,updateAddress as M,updateShoppingGoodsNum as B,queryShoppingPage as T,queryShoppingToContract as j,deleteShoppingGoodsBatch as D,updateShoppingGoodsPmInfo as G,updateShoppingGoodsCheckState as A,queryUsercouponPageForC as w,find as R,syncContractBatchState as x,syncContractState as E,saveOrderToPay as F,paymentCommit as U,getFalgSettingForPaydate as J,calculateFreightFare as $,saveContract as q,queryUserConByGoods as V,syncContractPayState as Y,getContractByCode as _,checkRefund as W,confirmReceive as z,cancelContractC as H,queryContractPageC as K,cancelUnpayOrder as Q,queryExpressInfo as X,queryGoodsClassTree as Z,deleteCollectByCodeStr as oo,queryUseTemplate as to,saveEvaluateGoods as eo,saveEvaluateShop as no,queryFootprintPagePlat as co,deleteFootprintByCodeStr as io,getNotice as ro,getDoclist as so,queryPromotioByCodePage as ao,queryPromotioPage as lo,getRefundGoods as uo,saveRefund as po,queryRefCause as mo,getRefundByCode as yo,sendGoods as go,queryExpressPageForProp as fo,cancelAfterSales as ho,queryRefundPageBuy as vo,miniLogout as So}from"qj-b2c-api";export{calculateFreightFare,getFalgSettingForPaydate,paymentCommit,queryAddressBymerberCode,queryShoppingToContract,saveContract,saveOrderToPay,syncContractBatchState,syncContractPayState,syncContractState,updateShoppingGoodsNum}from"qj-b2c-api";import{getTotalDiscountPriceCache as Co,queryUpmupointsPageByPC as bo,saveOrderToBatchPay as Oo,querySkuToContractLR as Po,queryToContractCodeList as Io,queryUserServicePage as No,queryEvaluateGoodsPage as ko,deleteEvaluateGoods as Lo,queryDoclistForMenuPageAt as Mo,queryUpmpointsrulePage as Bo,querySignPage as To,saveSignForUser as jo,saveBaseUpmupointsclear as Do}from"b2c-api";import{getEnv as Go,taroMessage as Ao,getPagesRefreshStore as wo,updatePagesRefreshStore as Ro,navigatorHandler as xo,getTaro as Eo,navigatorBackImpl as Fo,reLaunchHandler as Uo,setStorage as Jo,getStorage as $o,taroModule as qo,getBaseUrl as Vo}from"@brushes/utils";import{noop as Yo,isFunction as _o,get as Wo,isEmpty as zo,groupBy as Ho,orderBy as Ko,difference as Qo,set as Xo,isUndefined as Zo,isEqual as ot}from"lodash-es";import{fullPath as tt,extendAddressData as et}from"@brushes/shared-utils";import{removeRequestCacheByKey as nt}from"@brushes/optimize";import{post as ct}from"@brushes/request";import it from"dayjs";function rt(c,i){const r=t(null),s=t(null);return[({children:t})=>{const[n,a]=e(c,i);return o(r.Provider,{value:a,children:o(s.Provider,{value:n,children:t})})},function(){return n(s)},function(){return n(r)}]}function st(o){let t=o;const e=new Set;return{getState:()=>t,setState:o=>{t=Object.assign(Object.assign({},t),o),e.forEach((o=>o(t)))},subscribe:o=>(e.add(o),()=>e.delete(o))}}const at=st({count:1,memberCode:"",isNeedButton:!1,goodsNum:1,goodsSupplynum:100,spec:[],orderType:0,offShelf:!1});function dt(o=o=>o){return c(at.subscribe,(()=>o(at.getState())))}function lt(o,t){var e={};for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&t.indexOf(n)<0&&(e[n]=o[n]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var c=0;for(n=Object.getOwnPropertySymbols(o);c<n.length;c++)t.indexOf(n[c])<0&&Object.prototype.propertyIsEnumerable.call(o,n[c])&&(e[n[c]]=o[n[c]])}return e}function ut(o,t,e,n){return new(e||(e=Promise))((function(c,i){function r(o){try{a(n.next(o))}catch(o){i(o)}}function s(o){try{a(n.throw(o))}catch(o){i(o)}}function a(o){var t;o.done?c(o.value):(t=o.value,t instanceof e?t:new e((function(o){o(t)}))).then(r,s)}a((n=n.apply(o,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const pt=o=>o.detail?o.detail.value:o.value?o.value:o,mt=(o,t)=>ut(void 0,void 0,void 0,(function*(){const e={specStr:JSON.stringify(o),goodsCode:t};return yield l(e)})),yt=(o,t)=>ut(void 0,void 0,void 0,(function*(){const e={skuId:o,goodsNum:t};return yield u(e)})),gt=(o,t)=>ut(void 0,void 0,void 0,(function*(){const e=Go(),n={skuId:o,goodsNum:t,isLocalMock:!e};return yield p(n)})),ft=(o,...t)=>ut(void 0,[o,...t],void 0,(function*(o,t=!1){return yield t?Co(o):m(o)}));function ht(o){const t=Go();return y({skuCode:o,isLocalMock:!t})}function vt(o=Yo){const t=o=>{const t=(o=>{const t=at.getState();switch(o.type){case"plus":return Object.assign(Object.assign({},t),{count:t.count+1});case"minus":return Object.assign(Object.assign({},t),{count:t.count-1});case"select":case"initGoodSku":case"popupImpl":return Object.assign(Object.assign({},t),o.payload);default:return t}})(o);at.setState(t)},e=()=>{o({visible:!0})};return{dispatch:t,openPopup:()=>{e(),t({type:"popupImpl",payload:{isNeedButton:!1}})},closePopup:()=>{o({visible:!1})},addCardPopup:()=>{e(),t({type:"popupImpl",payload:{orderType:0,isNeedButton:!0}})},buyOpenPopup:()=>{e(),t({type:"popupImpl",payload:{orderType:1,isNeedButton:!0}})}}}function St(o){const t=i(null);return t.current=_o(o)?o:Yo,r(((...o)=>t.current(...o)),[t])}function Ct(o,t,e,n=Yo){const{dispatch:c,closePopup:i}=vt(n);s((()=>{const o=Wo(t,"spec",[]),n=Wo(e,"[0]goodsMinnum",1);zo(o)||c({type:"initGoodSku",payload:{offShelf:!1,count:n||1,spec:o}})}),[t]);const r=(o,t)=>!!t&&o.every((o=>t.includes(`/${o}/`)||t.endsWith(o)||t.startsWith(o))),a=St(((o,t)=>{const n=at.getState(),{spec:i}=n;i[t]=o;const s=(a=i,e.find((o=>r(a,o.skuName)))||{});var a;const d=zo(s);c({type:"select",payload:{offShelf:d,count:s.goodsMinnum||1,spec:[...i]}}),d&&Ao("该规格已下架","none")})),d=()=>ut(this,void 0,void 0,(function*(){try{const t=at.getState(),{spec:e,count:n}=t,c=yield mt(e,o),{CartList:r=0}=wo();Ro({CartList:r+1});const s=Wo(c,"dataObj.skuId"),a=yield yt(s,n);yield Ao(a.msg||"添加成功"),i()}catch(o){yield Ao(o,"error")}})),l=()=>ut(this,void 0,void 0,(function*(){const t=at.getState(),{spec:e,count:n}=t,c=yield mt(e,o),i=Wo(c,"dataObj.skuId"),r=Wo(c,"dataObj.goodsType");if("06"===r)try{const o=Number(Wo(c,"dataObj.pricesetRefrice",0)),t=yield bo({},!1);if(o>Number(Wo(t,"list[0].upointsNum",0)))return void Ao("用户积分不足,不能兑换","none")}catch(o){return void console.log(o)}xo("orderDetermine",{skuId:i,goodsNum:n,goodsType:r})}));return{closePopup:i,addCardImpl:d,cashImpl:l,handleChooseSize:a,handleStep:(o,t,e)=>{const{count:n}=at.getState();n!==(t||1)||"minus"!==e?"plus"!==e||n!==o?c({type:e}):Ao("超库存","none"):Ao(`不能小于${t||1}`,"none")},addShoppingImpl:()=>{const o=at.getState(),{orderType:t}=o;0===t?d():l()}}}const bt=()=>{const[o,t]=a(!1);return{save:e=>ut(void 0,void 0,void 0,(function*(){if(!o)try{yield g(e),t(!0)}catch(o){}})),isPick:o}},Ot=()=>{const o=i(null),t=Eo(),e=o=>{if(!o)return;const e=document.createElement("a");e.href=o,e.download="poster.png",t.showToast({title:"生成成功",icon:"none",duration:2e3}),e.click()};return{init:(t,n)=>{const c=tt(Wo(t,"[0].goodsFileUrl","")),i=tt(Wo(t,"[1].goodsFileUrl","")),r=o.current;if(!r)return;const s=r.getContext("2d");s.fillStyle="#fff",s.fillRect(0,0,300,1600),s.fillStyle="#333",s.font="bold 14px sans-serif",s.fillText(n,10,560);const a=new Image;a.crossOrigin="Anonymous",a.src=c;const d=new Image;d.crossOrigin="Anonymous",d.src=i,a.onload=function(){s.drawImage(a,0,0,300,260)},d.onload=function(){s.drawImage(d,0,260,300,260)},setTimeout((()=>{const o=r.toDataURL("image/png");e(o)}),400)},canvasRef:o}},Pt={rsGoodsFileDomainList:[],rsSpecValueDomainList:[],goodsRemark:"",pricesetNprice:0,goodsName:"",dataPic:"",goodsShowname:"",goodsNum:0,goodsCode:"",skuNo:"",classtreeCode:"",brandCode:"",pntreeCode:"",memberCode:"",goodsThdate:"",goodsOdate:"",goodsDayinfo:"",rsSkuDomainList:[]},It=(o,t="")=>{const[e,n]=a(Pt);return s((()=>{ut(void 0,void 0,void 0,(function*(){try{let e=o;t&&(e=(yield f({key:t})).split("_")[0]);const c=yield ht(e);n(c||Pt)}catch(o){}}))}),[]),e},Nt=o=>d((()=>o.map((o=>({imgUrl:o.goodsFileUrl,link:""})))),[o]),kt={dataObj:""};function Lt({skuCode:o,dataPic:t,goodsName:e,pricesetNprice:n}){const[c,i]=a(kt);s((()=>{r()}),[]);const r=()=>ut(this,void 0,void 0,(function*(){const t={collectType:0,collectOpcode:o};try{const o=yield h(t);i(o)}catch(o){console.log(o)}})),d=()=>ut(this,void 0,void 0,(function*(){const c={collectType:0,collectOpcode:o,collectOppic:t,collectOpcont:e,collectOpnum:n,goodsOrigin:0};return yield S(c)})),l=()=>ut(this,void 0,void 0,(function*(){const o={collectType:0,collectCode:c.dataObj||""};return yield C(o)})),u=(o,t="success",e=1e3)=>{Eo().showToast({title:o,icon:t,duration:e})};return{handleCollect:()=>ut(this,void 0,void 0,(function*(){let o=kt;zo(c.dataObj)?(o=yield d(),u("收藏成功")):(o=yield l(),u("取消收藏成功")),i(o),nt(v)})),collection:c}}function Mt(o,t){return d((()=>({skuList:function(o){const t=Ho(Ko(o,["specValueValue"]),"specName");return t?Object.keys(t).map((o=>({skuName:o,skuOption:t[o]}))):[]}(o),spec:Wo(t,"[0]skuName","").split("/")})),[o])}const Bt=(o=[],t)=>{const e=o.find((o=>o.skuCode===t))||{};if(zo(e))return{};const{skuNo:n,classtreeCode:c,brandCode:i,pntreeCode:r,memberCode:s}=e;return{skuCode:t,skuNo:n,classtreeCode:c,brandCode:i,pntreeCode:r,memberCode:s}},Tt={promotionBegintime:"",pbName:"",discName:"",promotionCode:"",promotionName:"",couponOnceNums:0,couponOnceNumd:0,promotionEndtime:""};function jt(o,t){const[e,n]=a([]),[c,i]=a(!1);return s((()=>{(()=>{ut(this,void 0,void 0,(function*(){const e=Bt(o,t);if(zo(e))return;const c=yield b(e);n(c)}))})()}),[t,o]),{coupon:e,visible:c,setVisible:i}}function Dt(o,t){const[e,n]=a([]);return s((()=>{(()=>{ut(this,void 0,void 0,(function*(){const e=Bt(o,t);if(zo(e))return;const c=yield O(e);n(c)}))})()}),[t,o]),e}const Gt=o=>{const[t,e]=a([]);return s((()=>{ut(void 0,void 0,void 0,(function*(){try{if(!o)return;const t=yield P({goodsCode:o,page:1,rows:10});e(t.list||[])}catch(o){}}))}),[o]),t},At=()=>({handleShare:()=>{if(!Go())return;Eo().showShareMenu({withShareTicket:!0,success:()=>{console.log("share success")}})}}),wt=o=>{s((()=>{ut(void 0,void 0,void 0,(function*(){try{const t=yield ht(o);I({footprintType:0,footprintOpcode:o,footprintOppic:t.dataPic,footprintOpcont:t.goodsName,footprintOpnum:t.pricesetNprice,footprintOpurl:""})}catch(o){console.log(o)}}))}),[])},Rt=(o=[])=>{const t=dt((o=>o.spec)),e=d((()=>o.find((o=>((o,t="")=>!!t&&o.every((o=>t.includes(`/${o}/`)||t.endsWith(o)||t.startsWith(o))))(t,o.skuName)))||{}),[t,o]);return{spec:t,goodInfo:e}};function xt(o){const t=(t,e,n)=>ut(this,void 0,void 0,(function*(){try{yield ct("/web/um/address/updateAddress.json",Object.assign(Object.assign(Object.assign({},t),et),{addressId:o})),nt(N);let{AddressList:n=0}=wo();Ro({AddressList:++n}),e(),Fo(-1)}catch(o){n()}})),e=(o,t,e)=>ut(this,void 0,void 0,(function*(){try{yield k(Object.assign(Object.assign({},o),et)),nt(N);let{AddressList:e=0}=wo();Ro({AddressList:++e}),t(),Fo(-1)}catch(o){e()}}));return{onSubmit:(n,c,i)=>ut(this,void 0,void 0,(function*(){o?t(n,c,i):e(n,c,i)}))}}function Et(o){const[t,e]=a([]),[n,c]=a(!0);s((()=>{i()}),[o]);const i=()=>ut(this,void 0,void 0,(function*(){const o=Go(),t=yield N({isLocalMock:!o});e(t),c(!1)})),r=(o,t)=>{const e=t[o];return t[o]=t[0],t[o].addressDefault="0",t[0]=e,t[0].addressDefault="1",[...t]};return{list:t,skullShow:n,delAddress:o=>{if(!Go())return;Eo().showModal({title:"提示",content:"确认删除该地址吗?",success:t=>ut(this,void 0,void 0,(function*(){(null==t?void 0:t.confirm)&&(yield L({addressId:o.addressId}),nt(N),yield i())}))})},setDefault:(o,n)=>ut(this,void 0,void 0,(function*(){if("1"!==o.addressDefault){const{addressMember:c,addressPhone:s,provinceCode:a,provinceName:d,cityCode:l,cityName:u,areaCode:p,areaName:m,addressDetail:y,addressId:g,addressCode:f,dataState:h}=o,v={addressMember:c,addressPhone:s,provinceCode:a,provinceName:d,cityCode:l,cityName:u,areaCode:p,areaName:m,addressDetail:y,addressId:g,addressCode:f,dataState:h,addressDefault:"1"};e(r(n,t)),yield M(v),nt(N),yield i()}})),getAddressList:i,navigator:()=>{xo("addressEditor")}}}function Ft(o){return{handlerImpl:()=>{Ro({PlaceOrderAddress:o.addressId,PlaceOrderAddressTabs:{addressId:o.addressId}}),Fo(-1)}}}const[Ut,Jt,$t]=rt((function(o,t){switch(t.type){case"select":return Object.assign(Object.assign({},o),{select:t.payload});case"update":return Object.assign(Object.assign({},o),t.payload);default:return o}}),{id:"",count:0,loading:!1,select:[]}),qt=()=>{const o=$t(),{select:t}=Jt();return{select:t,onChange:t=>{o({type:"select",payload:pt(t)})},handleStep:(t,e,n)=>ut(void 0,void 0,void 0,(function*(){if(0===e&&"minus"===n)return void Ao("不能小于0","none");const c="plus"===n?++e:--e;o({type:"update",payload:{id:t,count:c,loading:!0}})}))}},Vt=o=>{const[t,e]=a([]),[n,c]=a(0),r=i([]),l=$t(),{select:u,id:p,count:m}=Jt(),y=d((()=>{let o=0,e=0;return t.forEach((t=>{u.includes(t.shoppingGoodsId)&&(o+=t.goodsCamount,e+=t.goodsCamount*t.pricesetNprice)})),{num:o,amount:e}}),[u,t]);s((()=>{ut(void 0,void 0,void 0,(function*(){yield f("isFirst")}))}),[o]),s((()=>{p&&g(p,m)}),[p,m]);const g=(o,t)=>ut(void 0,void 0,void 0,(function*(){try{yield B({shoppingGoodsId:o,amount:t,goodWeight:0}),yield f()}catch(o){console.log(o)}})),f=(...o)=>ut(void 0,[...o],void 0,(function*(o=""){try{const t=Go(),n=yield T({isLocalMock:!t}),i=Wo(n,"list",[]),s=[];let a=0;i.forEach((o=>{const{shoppingGoodsList:t,disMoney:e=0}=Wo(o,"shoppingpackageList[0]",{shoppingGoodsList:[],disMoney:0});s.push(...t),a+=e||0})),r.current=s.map((o=>o.shoppingGoodsId)),o&&l({type:"select",payload:r.current}),l({type:"update",payload:{loading:!1}}),c(a),e(s)}catch(o){Ao(o.msg)}}));return{cartList:t,initImpl:f,disMoney:n,amount:y,selectAll:o=>{const t=pt(o);l({type:"select",payload:t.includes("true")?r.current:[]})},allCart:r,toOrderImpl:()=>{0!==u.length?(nt(j),xo("orderDetermine",{shoppingGoodsId:u.join(",")})):Ao("购物数量不能为空")},select:u,deleteCart:()=>ut(void 0,void 0,void 0,(function*(){try{yield D({shoppingGoodsIdStr:JSON.stringify(u)}),yield f()}catch(o){console.log(o)}}))}},Yt=(o,t,e=Yo)=>{const[n,c]=a([]),[r,d]=a(!1),l=i([]);s((()=>{ut(void 0,void 0,void 0,(function*(){yield u("isFirst")}))}),[o,t]);const u=(...o)=>ut(void 0,[...o],void 0,(function*(o=""){try{d(!0);const t=Go(),e=yield T({isLocalMock:!t});p(e,o)}catch(o){console.log(o)}finally{d(!1)}})),p=(o,t)=>{const e=Wo(o,"list",[]),n=[];e.forEach((o=>{const t=Wo(o,"shoppingpackageList",[]);n.push(...t)})),c(n),m(n,t)},m=(o,t)=>{const{list:n,disMoney:c}=y(o);l.current=n;const i=l.current.map((o=>o.shoppingGoodsId)),r={};t&&(r.select=i),e(Object.assign({disMoney:c,cartInfo:l.current},r))},y=o=>{let t=[],e=0;return o.forEach((o=>{e+=o.disMoney||0,t.push(...o.shoppingGoodsList)})),{list:t,disMoney:e}};return{cartList:n,loading:r,onChange:o=>{const t=pt(o).map((o=>Number(o)||o));e((o=>{var e,n;return e=t,n=o.select,ut(void 0,void 0,void 0,(function*(){console.log("updateGoodCheck",e,n);let o="";o=e.length>n.length?Qo(e,n).join(""):Qo(n,e).join("");const{shoppingCode:t}=l.current.find((t=>t.shoppingGoodsId===o))||{};try{yield A({shoppingGoodsIdStr:o,shoppingCode:t,checkState:+(n.length>e.length),channelCode:"channelCode"}),yield u()}catch(o){}})),{cartInfo:l.current,select:t}}))},handleStep:(o,t,e)=>{if(1===t&&"minus"===e)return void Ao("不能小于1","none");((o,t)=>{ut(void 0,void 0,void 0,(function*(){try{yield B({shoppingGoodsId:o,amount:t,goodWeight:0}),yield u()}catch(o){console.log(o)}}))})(o,"plus"===e?++t:--t)},updatePm:(o,t)=>ut(void 0,void 0,void 0,(function*(){try{yield G({shoppingGoodsId:o,promotionCode:t}),yield u()}catch(o){console.log(o)}}))}},_t={register:"/account/register/index",accountLogin:"/account/accountLogin/index",mobileLogin:"/account/mobileLogin/index",forgetPwd:"/account/forgetPwd/index",agreement:"/account/agreement/index",auth:"/account/auth/index",confirmPhone:"/account/confirmPhone/index",bindPhone:"/account/bindPhone/index"},Wt=["pages/index/index"],zt={addressId:"",addressInfo:{},contractPumode:"0"},Ht=(o,t="success",e=1e3)=>{Eo().showToast({title:o,icon:t,duration:e})};function Kt({target:o,defaultQuery:t,extendQuery:e},n){const c=o.value,i=((o,t,e)=>{const n=o.concat(t);let c={};for(let o of n)c[o]=e[o];return c})(t,e,n);xo(c,i)}const Qt=(o,t)=>{const e=Math.floor(o/1e3)%60,n=Math.floor(o/1e3/60)%60,c=Math.floor(o/1e3/60/60)%24;return`${Math.floor(o/1e3/60/60/24)}天 ${c}小时 ${n}分钟 ${e}秒${t}`};function Xt(o=[],t=[],e=Yo){const n=d((()=>t.filter((o=>0!==o.dataState)).map((o=>o.shoppingGoodsId))||[]),[t]),c=d((()=>{let e=0,n=[],c=0;for(let i of t)o.includes(i.shoppingGoodsId)&&0===i.dataState&&(n.push(i.shoppingGoodsId),e+=i.goodsCamount,c+=i.goodsCamount*i.pricesetNprice);return{num:e,canPayIds:n,amount:c}}),[o,t]),i=St((o=>(console.log(1111,o.map((o=>o.shoppingGoodsId))),o.map((o=>o.shoppingGoodsId))))),r=St((o=>{const n=pt(o);e({select:n.includes("true")?i(t):[]})})),s=St((()=>ut(this,void 0,void 0,(function*(){try{yield D({shoppingGoodsIdStr:JSON.stringify(o)}),e((o=>{let t=o.updateCount||0;return{updateCount:++t}}))}catch(o){console.log(o)}}))));return{toOrderImpl:St((()=>{0!==c.canPayIds.length?(nt(j),xo("orderDetermine",{shoppingGoodsId:c.canPayIds.join(",")})):Ao("购物数量不能为空")})),deleteCart:s,selectAll:r,cartDetail:c,clearAll:()=>ut(this,void 0,void 0,(function*(){try{yield D({shoppingGoodsIdStr:JSON.stringify(n)}),e((o=>{let t=o.updateCount||0;return{updateCount:++t}}))}catch(o){console.log(o)}})),ids:n}}function Zt(o=Yo){return{editorImpl:()=>{o((o=>({isEditor:!o.isEditor})))}}}const oe=()=>{const[o,t]=a([]),e=i(0),n=i(1),c=i(10),r=i([{id:0,label:"领取记录",dataState:"",styleName:"all",text:""},{id:1,label:"未使用",dataState:0,styleName:"unused",text:""},{id:2,label:"已使用",dataState:1,styleName:"used"},{id:3,label:"已失效",dataState:2,styleName:"overdue"}]);s((()=>{ut(void 0,void 0,void 0,(function*(){yield d()}))}),[]);const d=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield w({page:n.current,rows:c.current,dataState:r.current[e.current].dataState});t((t=>t.concat(o.list||[]))),n.current+=1}catch(o){console.log(o)}}));return{config:r,coe:e,list:o,setList:t,getList:d,switchTab:o=>ut(void 0,void 0,void 0,(function*(){e.current=o,n.current=1,t([]),yield d()}))}},te=()=>{const[o,t]=a([]),e=i(1);s((()=>{ut(void 0,void 0,void 0,(function*(){yield n()}))}),[]);const n=()=>ut(void 0,void 0,void 0,(function*(){e.current=1,t([]),yield c()})),c=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield w({page:e.current,rows:100,dataState:0,pbCode:"0004,0005"});t(o.list),e.current+=1}catch(o){console.log(o)}}));return{unusedList:o,getData:c,init:n}},ee=()=>{const[o,t]=a([]),e=i(1);s((()=>{ut(void 0,void 0,void 0,(function*(){yield n()}))}),[]);const n=()=>ut(void 0,void 0,void 0,(function*(){e.current=1,t([]),yield c()})),c=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield w({page:e.current,rows:100,dataState:1,pbCode:"0004,0005"});t(o.list),e.current+=1}catch(o){console.log(o)}}));return{usedList:o,getData:c,init:n}},ne=()=>{const[o,t]=a([]),e=i(1);s((()=>{ut(void 0,void 0,void 0,(function*(){yield n()}))}),[]);const n=()=>ut(void 0,void 0,void 0,(function*(){e.current=1,t([]),yield c()})),c=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield w({page:e.current,rows:100,dataState:2,pbCode:"0004,0005"});t(o.list),e.current+=1}catch(o){console.log(o)}}));return{overdueList:o,getData:c,init:n}},ce=(o,t,e)=>{const n=i(!0),c=i(0),[r,d]=a([]),[l,u]=a(!1);s((()=>{p("isFirst")}),[e]);const p=St((o=>{c.current=0,n.current=!0,m(e,o)})),m=St(((e,...i)=>ut(void 0,[e,...i],void 0,(function*({sortField:e="pricesetNprice",order:i=""},r=""){if(n.current){++c.current,u(!0);try{const s=yield R({distinctField:"goodsNo",sortField:e,order:i,goodsType:"00,40,50",page:c.current,rows:10,searchParam:t,classtreeCode:o});(zo(s.list)||s.list.length<10)&&(n.current=!1),u(!1),d((o=>r?s.list:o.concat(s.list)))}catch(o){--c.current}}}))));return{loading:l,getData:m,list:r}};function ie({contractBillcode:o,contractBbillcode:t}){const e=Eo(),[n,c]=a(!1),r=i(""),d=Go(),[l,u]=a([]),p=i({}),m=i({contMoney:0,orderMoney:0,logMoney:0,contractBillcode:""});s((()=>{(()=>{ut(this,void 0,void 0,(function*(){var e,n;try{if(t){const o=yield x({contractBbillcode:t,isLocalMock:!d}),n=yield Oo({contractBbillcode:null!==(e=o.dataObj)&&void 0!==e?e:"",isLocalMock:!d});m.current=n,u(n.payChannelList),p.current=n}else{const t=yield E({contractBillcode:o,isLocalMock:!d}),e=yield F({contractBillcode:null!==(n=t.dataObj)&&void 0!==n?n:"",isLocalMock:!d});m.current=e,u(e.payChannelList),p.current=e}}catch(o){console.log(44,o)}}))})()}),[]);const y=o=>{c(!0);const{ptradeSeqno:t,contractBlance:e,payChannelList:n}=p.current,{fchannelCode:i,faccountOuterNo:s=""}=g(n,o||r.current);return{ptradeSeqno:t,contractBlance:e,fchannelCode:i,faccountOuterNo:s}},g=(o,t)=>o.find((o=>"1"===t?o.ptfchannelAmt===t:o.fchannelCode===t))||{},f=()=>ut(this,void 0,void 0,(function*(){var o;const t=null!==(o=m.current.contractBillcode)&&void 0!==o?o:"";Jo("contractBillcode",{contractBillcode:t});const{ptradeSeqno:e,contractBlance:n,fchannelCode:c,faccountOuterNo:i}=y(),r=[{faccountIdType:"ACCOUNT",fchannelCode:c,orderAmount:m.current.orderMoney,faccountId:i}];return yield U({ptradeSeqno:e,payCommitStr:JSON.stringify(r),contractBlance:n})})),h=()=>ut(this,void 0,void 0,(function*(){try{const o=yield f(),t=JSON.parse(o.dataObj.htmlStr).Cshdk_Url;t?d?e.navigateTo({url:`/pages/webview/index?url=${encodeURIComponent(t)}`}):window.open(t,"_blank"):c(!1)}catch(o){c(!1)}})),v=()=>ut(this,void 0,void 0,(function*(){try{const o=yield f();document.getElementById("v_html").innerHTML="<div>"+o.dataObj.htmlStr+"</div>",document.forms[0].submit(),c(!1)}catch(o){c(!1)}})),S=()=>ut(this,void 0,void 0,(function*(){try{const o=yield f();document.getElementById("v_html").innerHTML="<div>"+o.dataObj.htmlStr+"</div>",document.getElementById("paaspaysubmit").submit(),c(!1)}catch(o){c(!1)}})),C=()=>ut(this,void 0,void 0,(function*(){try{let o=(yield f()).dataObj.requestData;wx.requestPayment({timeStamp:o.timeStamp,nonceStr:o.nonceStr,package:o.package,signType:o.signType,paySign:o.paySign,success:function(o){var t;const e=null!==(t=m.current.contractBillcode)&&void 0!==t?t:"";Uo("result",{code:e})},fail:function(o){c(!1)},complete:function(o){c(!1)}})}catch(o){c(!1)}}));return{paymentImpl:()=>{var o;switch(r.current||Ao("请选择支付方式","none"),r.current){case"wechatmini":C();break;case"account":case"alipaywap":v();break;case"wechatwap":S();break;case"ngpaygateway":h();break;case"1":const{ptradeSeqno:t,contractBlance:n,fchannelCode:c,faccountOuterNo:i}=y("1"),r=[{faccountIdType:"ACCOUNT",fchannelCode:c,orderAmount:m.current.orderMoney,faccountId:i}],s=null!==(o=m.current.contractBillcode)&&void 0!==o?o:"";e.navigateTo({url:`/package/paypassword/index?code=${s}&ptradeSeqno=${t}&payCommitStr=${JSON.stringify(r)}&contractBlance=${n}`})}},channelList:l,handleRadio:o=>{r.current=pt(o)},contract:m,loading:n}}const re={provinceName:"",cityName:"",areaName:"",addressDetail:"",addressMember:"",addressPhone:"",addressDefault:""},se={contractSettlOpno:0,promotionCodes:null,shoppingCountPrice:0,totalDiscountPrice:0,accountsSumPrice:0,discount:0,freight:0,comDisMoney:0,copyComDisMoney:0},ae={dataPic:"",goodsName:"",goodsCamount:0,skuName:"",pricesetNprice:0};function de({skuId:o,goodsBeanStr:t,goodsNum:e,shoppingGoodsId:n,longContractgoodsBeanStr:c,scontractCode:r},d,l){const u=i([{dataPic:"",goodsName:"",goodsCamount:0,skuName:"",pricesetNprice:0}]),[p,m]=a([]),[y,g]=a(re),f=i(""),h=i([]),v=i([]),S=i([]),[C,b]=a(0),O=Go(),P=i(se),I=i([]);s((()=>{(()=>{ut(this,void 0,void 0,(function*(){b(0),P.current={contractSettlOpno:0,promotionCodes:null,shoppingCountPrice:0,totalDiscountPrice:0,accountsSumPrice:0,discount:0,freight:0,comDisMoney:0,copyComDisMoney:0},v.current=[],h.current=[],c?yield L((()=>Po({goodsBeanStr:decodeURIComponent(c),scontractCode:r}))):t&&t.trim()?yield L((()=>Io({goodsBeanStr:t}))):n&&n.trim()?yield L((()=>j({shoppingGoodsIdStr:`[${n}]`}))):o&&(yield L((()=>gt(o,e))))}))})()}),[d]);const k=()=>ut(this,void 0,void 0,(function*(){try{const o=yield V({pmContractGoodsDomainListStr:JSON.stringify(v.current)});m(o)}catch(o){console.log(74,o)}})),L=o=>ut(this,void 0,void 0,(function*(){try{const t=yield Promise.all([N({isLocalMock:!O}),o()]),[e=[],n=[]]=t,c=l?e.find((o=>o.addressId===l)):e.find((o=>"1"===o.addressDefault))||{};g(c),M(n,c),l=""}catch(o){console.log(o)}})),M=(o,t)=>{zo(o)||o.forEach((o=>{o.shoppingpackageList.forEach((o=>{P.current.comDisMoney+=o.disMoney,P.current.copyComDisMoney+=o.disMoney,o.shoppingGoodsList.forEach((t=>{v.current.push(t),P.current.shoppingCountPrice+=t.pricesetNprice*t.goodsCamount,t.contractGoodsGtype=0,f.current=o.promotionCode,"00"==t.goodsType&&J().then((o=>{}))})),o.disMoney>0&&h.current.push({contractSettlBlance:0==o.promotionInType?"PM":"COP",contractPmode:"0",contractSettlGmoney:Number(o.disMoney.toFixed(2)),contractSettlPmoney:Number(o.disMoney.toFixed(2)),contractSettlOpno:o.promotionCode,contractSettlOpemo:o.promotionName}),o.giftList?(o.shoppingGoodsList.forEach((o=>{o.ginfoCode=o.pmPromotionList.find((o=>"0001"==o.pbCode)).promotionCode})),u.current=[...o.shoppingGoodsList,...o.giftList]):u.current=o.shoppingGoodsList})),B(),O&&(c||T(),k(),A(t))}))},B=()=>{const{shoppingCountPrice:o,totalDiscountPrice:t,discount:e,comDisMoney:n,freight:c}=P.current;b(o-t-e-n+c)},T=()=>ut(this,void 0,void 0,(function*(){let t={};t=n?{shoppingGoodsIdStr:`[${decodeURIComponent(n)}]`}:{skuIdStr:JSON.stringify([{skuId:o,goodsNum:e}])};try{const o=yield $(Object.assign({isLocalMock:!O},t));P.current.freight=o.dataObj,B()}catch(o){console.log(180,o)}})),D=()=>{const{shoppingCountPrice:o,copyComDisMoney:t,discount:e}=P.current;return(o-t-e).toFixed(2)},G=()=>{const{shoppingCountPrice:o,copyComDisMoney:t,freight:e}=P.current;return(o-t+e).toFixed(2)},A=t=>{S.current=(t=>{const{addressMember:n,userName:c,provinceName:i,cityName:r,areaName:s,addressDetail:a,areaCode:d}=t;return[{contractPaytime:(new Date).valueOf(),goodsPbillno:0,goodsPmbillno:P.current.promotionCodes,contractProperty:"0",contractBlance:0,contractPmode:0,contractPumode:"0",goodsSupplierName:"",goodsSupplierCode:"",packageList:[{contractGoodsList:u.current,shoppingGoodsIdList:[],promotionCode:f.current,packageRemark:null}],packageMode:"",contractType:"50",ocContractSettlList:[],contractInmoney:G(),contractMoney:D(),goodsReceiptMem:n,goodsReceiptPhone:c,goodsReceiptArrdess:i+r+s+a,areaCode:d,contractNbillcode:null,skuIdList:o?[{skuId:+o,goodsNum:+e}]:[],giftSkuIdList:[]}]})(t);let n={rsSkuListStr:JSON.stringify(S.current)};ft(n).then((o=>{P.current.totalDiscountPrice=o.dataObj.totalDiscountPrice,P.current.contractSettlOpno=o.dataObj.contractSettlOpno,B()}))};return{savePayPrice:()=>{if(zo(y))return;(()=>{const{contractSettlOpno:o,totalDiscountPrice:t}=P.current;o&&0!=t&&h.current.push({contractSettlBlance:"UR",contractPmode:"0",contractSettlPmoney:t,contractSettlOpno:o})})(),Xo(S.current,"[0].ocContractSettlList",[...h.current,...I.current]);const o={orderDomainStr:JSON.stringify(S.current)};q(o).then((o=>{xo("paymentMode",{code:o.dataObj.contractBillcode})}))},address:y,list:u,payState:P,coupon:p,confirm:o=>{const{couponAmount:t,usercouponCode:e,promotionCode:n,discAmount:c}=o;I.current=[{contractSettlBlance:"COP",contractPmode:"0",contractSettlGmoney:+t,contractSettlPmoney:+c,contractSettlOpno:e,contractSettlOpemo:n}],P.current.discount=c,B()},amount:C}}const le={contractSettlBlance:"",contractEcurl:"",packageRemark:"",contractPmode:"",contractSettlGmoney:0,contractSettlPmoney:0,contractSettlOpno:"",contractSettlOpemo:"",freight:0,crp:{},_rechargeSmoney:0,cop:[]},ue=st(le);function pe(o=o=>o){return c(ue.subscribe,(()=>o(ue.getState())))}function me(o){const{shoppingCountPrice:t,comDisMoney:e,shoppingType:n,pricesetRefrice:c}=d((()=>{const t={shoppingCountPrice:0,comDisMoney:0,shoppingType:"",pricesetRefrice:0};return o.forEach((o=>{const{shoppingCountPrice:e,comDisMoney:n}=o;t.shoppingCountPrice+=e,t.comDisMoney+=n})),o.length>0&&(t.shoppingType=o[0].shoppingType||"",t.pricesetRefrice=o[0].pricesetRefrice||0),t}),[o]);return{shoppingCountPrice:t,comDisMoney:e,shoppingType:n,pricesetRefrice:c,changeContent:o=>{const t=pt(o);ue.setState({packageRemark:t})}}}const ye={provinceName:"",cityName:"",areaName:"",addressDetail:"",addressMember:"",addressPhone:"",addressDefault:"",addressId:"",provinceCode:"",userName:""};function ge(o,t,e,n,c){const[i,r]=a(ye);s((()=>{(()=>{ut(this,void 0,void 0,(function*(){try{const t=Go(),e=yield N({isLocalMock:!t,needCache:!0}),n=(()=>{const t=Ko(e,"addressDefault","asc"),n=t.find((t=>o===t.addressId))||{};return zo(n)?t.at(-1):n})();zt.addressInfo=n,zt.contractPumode="0",r(n),c||d(null==n?void 0:n.provinceCode)}catch(o){}}))})()}),[o]);const d=o=>ut(this,void 0,void 0,(function*(){let c={},i=$;c=n?{shoppingGoodsIdStr:`[${decodeURIComponent(n)}]`,areaCode:o}:{skuIdStr:JSON.stringify([{skuId:e,goodsNum:t}]),areaCode:o};try{const o=Go(),t=yield i(Object.assign({isLocalMock:!o},c));ue.setState({freight:t.dataObj})}catch(o){}}));return i}const fe={shoppingGoodsId:"",goodsNum:0,skuId:"",refreshNum:0,goodsBeanStr:"",longContractgoodsBeanStr:"",scontractCode:""},he={dataPic:"",goodsName:"",goodsCamount:0,skuName:"",pricesetNprice:0},ve={contractSettlOpno:0,upmMap:{},cop:[],pricesetRefrice:0,rebMoney:0,goodsCamount:0,shoppingCountPrice:0,totalDiscountPrice:0,accountsSumPrice:0,discount:0,freight:0,comDisMoney:0,copyComDisMoney:0,shoppingType:"",promotionCode:"",promotionCodes:""},Se=({shoppingGoodsId:o,goodsNum:t,skuId:e,goodsBeanStr:n,longContractgoodsBeanStr:c,scontractCode:r})=>{const[l,u]=a([]),[p,m]=a([]),[y,g]=a([]),f=i([]),[h,v]=a(0),[S,C]=a(0),[b,O]=a(0),P=pe(),{freight:I=0,crp:N,cop:k}=P,L=lt(P,["freight","crp","cop"]),M=i(0),B=i(null);s((()=>{ut(void 0,void 0,void 0,(function*(){ue.setState({freight:0,crp:{},cop:[],packageRemark:"",_rechargeSmoney:0,contractSettlBlance:"",contractPmode:"",contractEcurl:"",contractSettlGmoney:0,contractSettlPmoney:0,contractSettlOpno:"",contractSettlOpemo:""}),c?yield R((()=>Po({goodsBeanStr:decodeURIComponent(c),scontractCode:r}))):n&&n.trim()?yield R((()=>Io({goodsBeanStr:n}))):o&&o.trim()?yield R((()=>j({shoppingGoodsIdStr:`[${decodeURIComponent(o)}]`}))):e&&(yield R((()=>gt(e,t))))}))}),[]);const T=d((()=>{let o=0;p.forEach((t=>{o+=t.shoppingCountPrice}));let t=0;return k.forEach((e=>{["0005","B0005"].includes(e.pbCode)?t+=Number(o*(1-e.contractSettlGmoney/100).toFixed(2)):["0004","0003","B0004","B0003"].includes(e.pbCode)&&(t+=e.contractSettlPmoney)})),t}),[k]),D=d((()=>{if("06"===B.current)return I;const o=h-T+I-M.current-S-b;return console.log(h,T,I,M.current,S,b,"价格信息----"),o>=0?o:0}),[h,T,I,S,b]),G=d((()=>{const{contractSettlOpemo:o=0}=N;return D*+o/100}),[D,N]),A=d((()=>o=>{let t=0,e=0;o.forEach((o=>{t+=Wo(o,"upmMap.disamount",0),e+=Wo(o,"upmMap.integral",0)})),C(t),t>0&&f.current.push({contractSettlBlance:"INT",contractSettlPmoney:t,contractSettlGmoney:e})}),[]),w=(o,t)=>ut(void 0,void 0,void 0,(function*(){if(zo(o))return;const e=o[0]&&o[0].shoppingType||"",n=o[0]&&o[0].pricesetRefrice||0;"06"===e?yield(o=>ut(void 0,void 0,void 0,(function*(){if(o)try{const t=yield bo({},!0),e=Wo(t,"list[0].upointsNum",0),n=Number(o)||0,c=Math.min(n,e);C(c),c>0&&f.current.push({contractSettlBlance:"INT",contractSettlPmoney:c,contractSettlGmoney:c})}catch(o){console.error("查询用户积分失败",o),C(0)}else C(0)})))(n):(A(o),yield(o=>ut(void 0,void 0,void 0,(function*(){if(zo(o))O(0);else try{const t=[];o.forEach((o=>{t.push({packageList:[{contractGoodsList:o}]})}));const e=Go(),n={rsSkuListStr:JSON.stringify(t),isLocalMock:!e},c=yield ft(n,!0),i=Wo(c,"dataObj.totalDiscountPrice",0),r=Wo(c,"dataObj.contractSettlOpno","");O(i),i>0&&f.current.push({contractSettlBlance:"UR",contractSettlPmoney:i,contractSettlOpno:r})}catch(o){console.error("查询会员权益优惠失败",o)}})))(t))})),R=o=>ut(void 0,void 0,void 0,(function*(){try{const t=yield o();console.log(t,"datadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadata");const e=t.dataObj||t,{payState:n,shoppingGoodsList:c}=x(e);yield w(n,c)}catch(o){}})),x=o=>{if(zo(o))return{payState:[],shoppingGoodsList:[]};let t=[],e=[],n=[];return f.current=[],o.forEach((o=>{const c=Object.assign({},ve);c.shoppingType=o.shoppingType,B.current=o.shoppingType,c.pricesetRefrice=o.pricesetRefrice,c.upmMap=o.upmMap,M.current+=o.rebMoney;let i=[];o.shoppingpackageList.forEach((e=>{c.comDisMoney+=e.disMoney,c.copyComDisMoney+=e.disMoney;let n={channelCode:"",channelName:""};e.shoppingGoodsList.forEach(((o,i)=>{0===i&&(n=o),t.push(o),c.shoppingCountPrice+=o.pricesetNprice*o.goodsCamount,o.contractGoodsGtype=0,c.promotionCode=e.promotionCode,o.goodsType})),e.disMoney>0&&f.current.push({contractSettlBlance:0==e.promotionInType?"PM":8==e.promotionInType?"BMP":"COP",contractSettlGmoney:Number(e.disMoney.toFixed(2)),contractSettlPmoney:Number(e.disMoney.toFixed(2)),contractSettlOpno2:n.channelCode,contractSettlOpno1:n.channelName,contractSettlOpno:e.promotionCode,contractSettlOpemo:e.promotionName}),o.rebMoney>0&&f.current.push({contractSettlBlance:"REB",contractSettlGmoney:Number(o.rebMoney.toFixed(2)),contractSettlPmoney:Number(o.rebMoney.toFixed(2)),contractSettlOpno:e.promotionCode,contractSettlOpemo:e.promotionName,contractSettlOpno2:n.channelCode,contractSettlOpno1:n.channelName}),e.giftList&&(e.shoppingGoodsList=e.shoppingGoodsList.map((o=>(o.ginfoCode=o.pmPromotionList.find((o=>"0001"==o.pbCode)).promotionCode,o)))),i.push(...e.shoppingGoodsList,...e.giftList||[])})),n.push(c),e.push(i)})),m(n),u(e),g(t),E(n),{payState:n,shoppingGoodsList:t}},E=o=>{let t=0;o.forEach((o=>{const{shoppingCountPrice:e,totalDiscountPrice:n,discount:c,comDisMoney:i}=o;t+=e-n-c-i})),v(t)};return{amount:h,list:l,shoppingGoodsList:y,payState:p,ocContractSettlList:f,disCount:T,payPrice:D,creditMoney:G,orderStoreInfo:L,freight:I,rebMoney:M,pointsDeduction:S,urDiscount:b}},Ce=()=>{const[o,t]=a([]);return s((()=>{ut(void 0,void 0,void 0,(function*(){const{list:o}=yield ct("/web/pte/ptfpmode/queryPtfpmodesToStr.json");t(o)}))}),[]),{payList:o}},be=(o=[],t)=>{const[e,n]=a([]),[c,i]=a(!1),[r,l]=a([]),{payList:u}=Ce(),[p,m]=a([]),[y,g]=a({urechargeId:""}),[f,h]=a(!1),[v,S]=a(!1),{crp:C,contractEcurl:b,contractPmode:O}=pe();s((()=>{ut(void 0,void 0,void 0,(function*(){try{if(zo(o))return;const t=yield V({pmContractGoodsDomainListStr:JSON.stringify(o)});n(t)}catch(o){console.log(74,o)}}))}),[o]),s((()=>{ut(void 0,void 0,void 0,(function*(){const o=yield ct("web/crp/CrpUrecharge/queryCrpUrechargePage.json",{userinfoCode:$o("user").userInfoCode}),t=Wo(o,"list[0]",{}),e=yield ct("web/dd/falgSetting/queryFalgSettingPage.json",{flagSettingType:"creditSetting"});let n=Wo(e,"list",[]);n.some((o=>0===o.flagSettingInfo))||n.unshift({flagSettingInfo:0}),m(n),ue.setState({_rechargeSmoney:t.rechargeSmoney}),g(t)}))}),[]);const P=d((()=>C.contractSettlOpemo),[C]),I=d((()=>{var o,t;const{ptfpmodeName:e=""}=u.find((o=>o.ptfpmodeType===O))||{};return e||(ue.setState({contractPmode:null===(o=u[0])||void 0===o?void 0:o.ptfpmodeType,crp:{},contractEcurl:""}),null===(t=u[0])||void 0===t?void 0:t.ptfpmodeName)}),[u,O]),N=d((()=>r.map((o=>o.promotionName)).join(",")),[r]),k=()=>{const o=r.map((o=>{const{usercouponCode:t,promotionCode:e,discAmount:n}=o;return{pbCode:o.pbCode,contractSettlBlance:"COP",contractSettlGmoney:+n,contractSettlPmoney:+n,contractSettlOpno:t,contractSettlOpemo:e}}));ue.setState({cop:o})};return{coupon:e,visible:c,selectCoupon:N,onChange:o=>{const n=pt(o),c=e.filter((o=>t?n.includes(o.couponNo):n===o.couponNo));console.log(1111,r),l(c)},setVisible:i,creditList:p,creditInfo:y,creditVisible:f,setCreditVisible:h,onCreditChange:o=>{const t=pt(o);h(!1),ue.setState({crp:{contractSettlOpemo:t,contractSettlBlance:"CRP"}})},selectCredit:P,onPayChange:o=>{const t=pt(o);S(!1),ue.setState({contractPmode:t,crp:{},contractEcurl:""})},contractPmode:O,setPayVisible:S,payVisible:v,payList:u,payName:I,handleChooseImg:()=>{const o=Eo(),t=process.env.REACT_APP_BASE_URL;o.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album","camera"],success:function(e){o.uploadFile({url:`${process.env.REACT_APP_BASE_URL}web/oc/refund/uploadRefFile.json`,filePath:e.tempFilePaths[0],name:"file",header:{"saas-agent":"WEB"!==o.getEnv?"qj-wemini":"","saas-token":$o("saas-token")},success(o){const e=JSON.parse(o.data),n=Go();if("nologin"===e.errorCode)xo(n?"/account/auth/index":"/account/mobileLogin/index");else{const o=t+e.fileUrl;ue.setState({contractEcurl:o})}}})}})},contractEcurl:b,confirmImpl:()=>{i(!1),k()},couponValue:r,resetImpl:()=>{l([])}}};function Oe({ocContractSettlList:o,payState:t,goodsBeanStr:e,list:n},c="",r,s=""){const d=i([]),[l,u]=a(!1),{crp:p,_rechargeSmoney:m,contractPmode:y,contractEcurl:g,packageRemark:f,cop:h}=pe(),v=i(0),S=o=>{const{addressMember:e,userName:i,provinceCode:r,provinceName:s,cityName:a,areaName:d,addressDetail:l}=o;(o=>{if(o)return decodeURIComponent(o).split(",")})(c);let u={packageRemark:f};zo(p)||(u.creditType=p.contractSettlOpemo,u.creditAccount=m),g&&(u.contractEcurl=g);const h=zt.contractPumode||"0";return v.current=0,t.map(((o,t)=>(v.current+=o.shoppingCountPrice,Object.assign({contractPaytime:(new Date).valueOf(),goodsPbillno:0,goodsPmbillno:o.promotionCodes,contractProperty:"0",contractBlance:0,contractPmode:y,contractPumode:h,goodsSupplierName:"",goodsSupplierCode:"",packageList:[{contractGoodsList:n[t],shoppingGoodsIdList:(n[t]||[]).map((o=>o.shoppingGoodsId)),promotionCode:o.promotionCode,packageRemark:f}],packageMode:"",contractType:o.shoppingType,ocContractSettlList:[],goodsReceiptMem:e,goodsReceiptPhone:i,goodsReceiptArrdess:s+a+d+l,areaCode:r,contractNbillcode:null},u))))};return{savePayPrice:()=>ut(this,void 0,void 0,(function*(){const t=zt.addressInfo;if(zo(t))return void Ao("请选择收货地址");if(!y)return void Ao("请选择支付方式");if("1"===y&&!g)return void Ao("请上传附件");d.current=S(t);const n=h.map((o=>Object.assign(Object.assign({},o),{contractSettlGmoney:["0005","B0005"].includes(o.pbCode)?Number(v.current*(1-o.contractSettlGmoney/100).toFixed(2)):o.contractSettlGmoney,contractSettlPmoney:["0005","B0005"].includes(o.pbCode)?Number(v.current*(1-o.contractSettlPmoney/100).toFixed(2)):o.contractSettlPmoney})));let i=zo(p)?[...o.current,...n]:[...o.current,p,...n];i=i.map((o=>Object.assign(Object.assign({},o),{contractPmode:y}))),Xo(d.current,"[0].ocContractSettlList",i),u(!0);const a={orderDomainStr:JSON.stringify(d.current)};try{const o=yield q(a);(()=>{if(c){const{CartList:o=0}=wo();Ro({CartList:o+1})}})();const{contractBillcode:t,contractBbillcode:n}=Wo(o,"dataObj",{contractBillcode:"",contractBbillcode:""});y+""=="1"||"100"==p.creditType||0===r||e?Uo("result",s?{code:t,goodsType:s}:{code:t}):xo("paymentMode",s?{contractBbillcode:n||t,goodsType:s}:{contractBbillcode:n||t})}catch(o){}finally{u(!1)}})),loading:l}}const Pe={provinceName:"",cityName:"",areaName:"",addressDetail:"",addressMember:"",addressPhone:"",userinfoOcode:""};function Ie(o){const[t,e]=a(Pe);return s((()=>{(()=>{ut(this,void 0,void 0,(function*(){try{const t={page:1,rows:10};o&&(t.userinfoOcode=o);const n=Go(),c=yield No(Object.assign(Object.assign({},t),{isLocalMock:!n})),i=Array.isArray(c&&c.list)?c.list.map((o=>Object.assign(Object.assign({},o),{addressMember:o.userinfoCompname||"",addressPhone:o.userinfoTel||"",addressDetail:o.companyAddress||""}))):[],r=(()=>{const t=i.find((t=>o===t.userinfoOcode))||{};return zo(t)?i&&i[0]||{}:t})();zt.addressInfo=r,zt.contractPumode="1",e(r),ue.setState({freight:0})}catch(o){}}))})()}),[o]),t}const Ne={success:{icon:"zhifuchenggong",msg:"支付成功",buttonText:"查看订单",menuCode:"orderDetail",color:"#2ed82e"},error:{icon:"zhifushibai",info:"您的订单将保留15分钟,可点击下方“去支付”完成订单",buttonText:"去支付",menuCode:"paymentMode",color:"red"}};function ke(o){const[t,e]=a({icon:"daifahuo1",msg:"支付中",color:"#2ed82e",buttonText:"去支付",dataObj:{}}),[n,c]=a(!1),i=Go();return s((()=>{(()=>{ut(this,void 0,void 0,(function*(){const t=Wo(qo,"taroMenu[0].menuOpcode","index");if(i){Eo().setStorageSync("menuOpcode",t)}c(!0);try{const t=yield Y({contractBillcode:o,isLocalMock:!i}),{sysRecode:n,dataObj:c}=t,r=lt(t,["sysRecode","dataObj"]);e(Object.assign(Object.assign({dataObj:c,sysRecode:n},r),Ne[n]))}catch(t){e(Object.assign({dataObj:{contractBillcode:o},msg:t},Ne.error))}finally{c(!1)}}))})()}),[]),{result:t,loading:n}}function Le(o,t){const[e,n]=a(o);return s((()=>{const e=t.filter((o=>!(Zo(o)||zo(o)))).filter((o=>!Object.values(o).every((t=>Zo(t)||zo(o)))));let c=o;zo(e)||(c=e),n(c)}),[t]),e}const Me=[{name:"全部",code:""},{name:"待付款",code:"1"},{name:"待发货",code:"2"},{name:"待收货",code:"3"},{name:"已完成",code:"4"},{name:"待评价",code:"5",contractAppraise:0},{name:"已评价",code:"6",contractAppraise:1},{name:"已取消",code:"-1"}],Be=(o,t)=>{if(t){const{name:o=""}=Me.find((o=>o.contractAppraise===t))||{};return o}const{name:e=""}=Me.find((t=>t.code.split(",").includes(o+"")))||{};return e},Te={1:[{name:"取消订单",handler:"cancel"},{name:"立即支付",handler:"pay"}],2:[{name:"申请退款",handler:"applyRefund"}],3:[{name:"物流信息",handler:"expressInfo"},{name:"确认收货",handler:"confirmReceive"}],4:[{name:"物流信息",handler:"expressInfo"}],5:[{name:"物流信息",handler:"expressInfo"},{name:"发票申请",handler:"invoiceApply"},{name:"去评价",handler:"evaluate"}],99:[{name:"物流信息",handler:"expressInfo"},{name:"发票申请",handler:"invoiceApply"},{name:"查看评价",handler:"openEvaluate"}]},je={goodsList:[],contractPmode:"0",contractType:"",creditMoney:0,contractEcurl:"",dataState:"",goodsLogmoney:0,packageRemark:"",goodsReceiptMem:"",goodsReceiptPhone:"",goodsReceiptArrdess:"",dataBmoney:0,goodsPmoney:0,contractInmoney:0,contractBillcode:"",refundMoney:0,gmtCreate:"",goodsNum:0,contractId:0,contractPumode:"0"},De=o=>{const[t,e]=a(""),n=Go(),[c,i]=a(je);s((()=>{ut(void 0,void 0,void 0,(function*(){try{const t=yield _({contractBillcode:o,isLocalMock:!n});if(zo(t))return;e(Be(t.dataState)),i(t)}catch(o){console.log(45,o)}}))}),[]);const r=d((()=>Wo(c,"packageList[0].packageRemark","")),[c]),l=d((()=>{const o=Wo(c,"ocContractSettlList",[])||[],{contractSettlGmoney:t=0}=o.find((o=>"CRP"===o.contractSettlBlance))||{contractSettlGmoney:0};return t}),[c]);return{orderDetail:c,status:t,handleApplyBtn:(o,t)=>ut(void 0,void 0,void 0,(function*(){try{const{contractBillcode:e,skuCode:n}=o,c=yield W({contractBillcode:e,skuCode:n});if(!1===c.success)return void Ht(c.msg,"none");xo("refundType",{contractBillcode:e,skuCode:n,dataState:t})}catch(o){console.log(o)}})),creditMoney:l,packageRemark:r}};function Ge({dataState:o="",contractAppraise:t,contractType:e,contractId:n,contractBillcode:c,init:i,dataBmoney:r,skuCode:s}){const{handleApplyBtn:a}=De(c||""),l=d((()=>{const n=Te[t?99:o+""]||[];return"06"===e?n.filter((o=>"invoiceApply"!==o.handler)):n}),[o]),u=(()=>({expressInfo:()=>{xo("expressInfo",{code:c})},pay:()=>{xo("paymentMode",{contractBillcode:c})},evaluate:()=>{xo("evaluateDetail",{code:c})},openEvaluate:()=>{xo("evaluateViewDetail",{code:c})},confirmReceive:()=>ut(this,void 0,void 0,(function*(){try{const{msg:o}=yield z({contractBillcode:c});Ao(o,"none"),setTimeout((()=>{null==i||i()}),500)}catch(o){}})),cancel:()=>ut(this,void 0,void 0,(function*(){try{const{msg:o}=yield H({contractId:n});Ao(o,"none"),setTimeout((()=>{null==i||i()}),500)}catch(o){}})),invoiceApply:()=>{xo("addInvoice",{invlistOcode:c,invlistOpamt:r})},applyRefund:()=>{a({contractBillcode:c,skuCode:s},o)}}))();return{handlerImpl:o=>{u[o]()},operateArray:l}}const Ae={contractBillcode:"",contractType:"",goodsList:[{dataPic:"",goodsName:"",dataBmoney:0,goodsCamount:0,contractGoodsId:0,dataState:0}],dataBmoney:0,dataBnum:0,dataState:0,contractId:"",contractAppraise:0};function we(o,t,e){const n=i(!1),[c,r]=a(!1),[d,l]=a([Ae]),u=i(0);s((()=>{p()}),[t]);const p=St((()=>{n.current=!1,u.current=0,m()})),m=St((()=>ut(this,void 0,void 0,(function*(){if(n.current)return;r(!0),++u.current;const{code:t,contractAppraise:c=""}=o;try{const o=Go(),i=(yield K({page:u.current,rows:10,contractAppraise:c,contractType:e,isLocalMock:!o,childFlag:!0,dataStateStr:"6"===t?"5":t})).list||[];n.current=zo(i)||i.length<10,l((o=>1!==u.current?o.concat(i):i)),r(!1)}catch(o){}}))));return{onScroll:m,data:d,loading:c,init:p,countdownCancel:o=>ut(this,void 0,void 0,(function*(){yield Q({contractId:o})}))}}const Re={0:"在途",1:"揽收",2:"疑难",3:"签收",4:"退签",5:"派件",8:"清关",14:"拒签"},xe=o=>{const[t,e]=a({}),[n,c]=a({});return s((()=>{ut(void 0,void 0,void 0,(function*(){try{const t=Go(),n=yield _({contractBillcode:o,isLocalMock:!t});e(n);const i=Wo(n,"packageList[0].expressCode",""),r=Wo(n,"packageList[0].packageBillno"),s=yield X({expressNo:r,expressType:i,isLocalMock:!t});c(JSON.parse(s.dataObj))}catch(o){console.log(o)}}))}),[]),{info:t,detail:n,stateObj:Re}};function Ee(){const[o,t]=a(""),[e,n]=a([]),c=Go();s((()=>{i()}),[]);const i=()=>ut(this,void 0,void 0,(function*(){try{let o=yield Z();n(o||[]);const e=Wo(o,"[0].goodsClassCode");t(e)}catch(o){console.log(o)}}));return{activeKey:o,navList:e,flag:c,setActiveKey:t}}const Fe=(o=0)=>{const[t,e]=a([{collectOpcont:"",collectOpnum:""}]),n=i(1),[c,r]=a(!1),[d,l]=a(""),[u,p]=a(!1),[m,y]=a(""),[g,f]=a(!1);s((()=>{h()}),[]);const h=()=>{n.current=1,e([]),S()},S=()=>ut(void 0,void 0,void 0,(function*(){try{const t=yield v({row:10,page:n.current,collectType:o});e((o=>o.concat(Wo(t,"dataObj.collectList.list",[])))),n.current+=1}catch(o){return console.log(o),[]}})),C=()=>{let o=[];for(let e=0;e<t.length;e++)o.push(t[e].collectCode);return o.toString()};return{collectionList:t,edit:c,setEdit:r,getData:S,collectCodeStr:d,getSelectItem:o=>{const e=pt(o);l(e.toString()),e.length===t.length?f(!0):f(!1)},delItem:()=>ut(void 0,void 0,void 0,(function*(){try{yield oo({collectCodeStr:d}),n.current=1,h()}catch(o){console.log(o)}})),init:h,checked:u,setChecked:p,handleSelectAll:o=>{pt(o).length?(p(!0),l(C())):p(!1)},selectAll:m,setSelectAll:y,selectAllChecked:g}},Ue=o=>{const[t,e]=a([]),n=i([]),c=i({}),r=Go();s((()=>{ut(void 0,void 0,void 0,(function*(){yield u(),yield d()}))}),[]);const d=()=>ut(void 0,void 0,void 0,(function*(){try{const t=yield _({contractBillcode:o,isLocalMock:!r}),n=l(Wo(t,"goodsList",[])),{contractBillcode:i,memberBcode:s,memberBname:a,memberCode:d,memberName:u}=n[0];c.current={contractBillcode:i,memberBcode:s,memberBname:a,memberCode:d,memberName:u},e(n)}catch(o){console.log(o)}})),l=o=>{for(let t=0;t<o.length;t++)o[t].upImgLength=!0,o[t].upImg=[],o[t].evaluateGoodsImgs="",o[t].evaluateScopeList=[n.current[0]],o[t].evaluateGoodsContent="";return o},u=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield to({applyTarget:"goods",isLocalMock:!r});n.current=o[0].templateValuesReList}catch(o){console.log(o)}}));return{orderInfo:t,changeStar:(o,c)=>{const i=[...t],r=[];for(let o=0;o<c;o++)r.push(n.current[o]);i[o].evaluateScopeList=r,e(i)},Submit:()=>ut(void 0,void 0,void 0,(function*(){try{yield eo({paramStr:JSON.stringify(t)}),yield no(Object.assign({paramStr:JSON.stringify(t)},c.current)),xo("orderlist",{indexId:6})}catch(o){console.log(o)}})),changeContent:(o,n)=>{const c=[...t];c[o].evaluateGoodsContent=pt(n),e(c)}}},Je=o=>{const[t,e]=a([]),n=Go(),c=Eo();s((()=>{ut(void 0,void 0,void 0,(function*(){yield i()}))}),[o]);const i=()=>ut(void 0,void 0,void 0,(function*(){try{const t=yield ko({contractBillcode:o,isLocalMock:!n}),c=Wo(t,"list",[]);e(c)}catch(o){console.log(o)}}));return{orderInfo:t,handleDelete:()=>ut(void 0,void 0,void 0,(function*(){try{const o=(t[0]||{}).evaluateGoodsId||8215;if(!o)return;yield Lo({evaluateGoodsId:o,isLocalMock:!n}),yield Ao("删除成功","none"),c.navigateBack({delta:1})}catch(o){console.log(o)}}))}},$e=()=>{const[o,t]=a([]),e=i(1),[n,c]=a(!1),[r,d]=a(""),[l,u]=a(!1),[p,m]=a(""),[y,g]=a(!1),[f,h]=a(!1),v=i(!1);s((()=>{S()}),[]);const S=()=>ut(void 0,void 0,void 0,(function*(){e.current=1,v.current=!1,t([]),yield C()})),C=()=>ut(void 0,void 0,void 0,(function*(){var o;if(!v.current){h(!0);try{const n=yield co();if(0===(null===(o=n.list)||void 0===o?void 0:o.length))return;if(t((o=>1===e.current?n.list:o.concat(n.list||[]))),n.list.length<10)return void(v.current=!0);e.current+=1}catch(o){return t([]),[]}finally{h(!1)}}})),b=()=>{let o=[];for(let t=0;t<collectionList.length;t++)o.push(collectionList[t].collectCode);return o.toString()};return{footprintList:o,edit:n,setEdit:c,getData:C,getSelectItem:o=>{const t=pt(o);d(t.toString())},delItem:()=>ut(void 0,void 0,void 0,(function*(){try{yield io({footprintCodeStr:r}),yield S(),c(!1)}catch(o){console.log(o)}})),init:S,checked:l,setChecked:u,handleSelectAll:o=>{pt(o).length?(u(!0),setCollectCodeStr(b())):u(!1)},selectAll:p,setSelectAll:m,selectAllChecked:y,loading:f}};function qe(o){const[t,e]=a([]);s((()=>{(()=>{ut(this,void 0,void 0,(function*(){try{const t=yield Mo({page:1,rows:o,tginfoMenuCode:"announcement"}),n=Wo(t,"list",[]);e(n)}catch(o){}}))})()}),[o]);return{content:d((()=>t.map((o=>o.doclistTitle))),[t]),navigator:o=>{const e=Wo(t,`${o}.doclistId`,"");xo("articleDetail",{noticeId:e})}}}const Ve=o=>{const[t,e]=a({});s((()=>{ut(void 0,void 0,void 0,(function*(){yield n()}))}),[]);const n=()=>ut(void 0,void 0,void 0,(function*(){try{const t=yield ro({noticeId:o});e(t)}catch(o){console.log(o)}}));return{info:t,setInfo:e}},Ye={doclistTitle:"",doclistTitle4:"",doclistContent:"",gmtCreate:""},_e=o=>{const[t,e]=a(Ye);return s((()=>{ut(void 0,void 0,void 0,(function*(){try{const t=Go(),n=yield so({doclistId:o,isLocalMock:!t});e(n)}catch(o){console.log(o)}}))}),[]),{info:t}},We=({defaultValue:o,goods:t},e)=>{const[n,c]=a(o),r=i();return s((()=>{ot(r.current,t)||(r.current=t,zo(t)?c(o):ut(void 0,void 0,void 0,(function*(){try{const o=yield R({[e]:t.toString(),distinctField:"goodsNo",goodsType:"00,40"});c(o.list)}catch(t){c(o)}})))}),[t]),{list:n}},ze=o=>{const[t,e]=a([]),[n,c]=a([]),{coupons:i,defaultValue:r}=o;s((()=>{d()}),[i]);const d=()=>ut(void 0,void 0,void 0,(function*(){if(0!==i.length)try{const o=yield ao({promotionCode:null==i?void 0:i.join(","),list:1});e(Wo(o,"list",[]))}catch(o){console.log(o)}else e(r)}));return{list:t,setList:e,takeCoupon:o=>ut(void 0,[o],void 0,(function*({promotionCode:o,couponAmount:t,index:e}){try{yield g({promotionCode:o,couponAmount:t})}catch(o){console.log(41,o)}finally{c((o=>o.concat(e)))}})),takeList:n}},He=t([{},Yo]);function Ke({initialValue:t,children:e}){return o(He.Provider,{value:a(t||{}),children:e})}function Qe(){const o=n(He);return o||[{},Yo]}const Xe=()=>{const[,o]=Qe();return{goTop:()=>{o((o=>{const{scrollTop:t}=o;return Object.assign(Object.assign({},o),{scrollTop:0===t?1:0})}))}}},Ze=({params:o})=>{const t=i([]),[e,n]=a([]),c=i(0),r=i(10);s((()=>{c.current=0,t.current=[],d()}),[o]);const d=()=>ut(void 0,void 0,void 0,(function*(){const e=Go();++c.current;try{const i=yield lo({isLocalMock:!e,pbCode:o,list:1,page:c.current,rows:r.current}),s=Wo(i,"list",[]);t.current.push(...s),n(t.current)}catch(o){console.log(o)}}));return{list:e,getData:d}},on=({contractBillcode:o,skuCode:t})=>{const[e,n]=a({}),[c,i]=a(!1),[r,d]=a(1),[l,u]=a(0),[p,m]=a(!1),[y,g]=a(!1);s((()=>{ut(void 0,void 0,void 0,(function*(){yield f()}))}),[]);const f=()=>ut(void 0,void 0,void 0,(function*(){m(!0);try{const e=Go(),c=(yield uo({contractBillcode:o,skuCode:t,isLocalMock:!e})).dataObj,{contractGoodsMoney:i,contractGoodsAremoney:r,goodsCamount:s,contractGoodsArefnum:a}=c,l=+i-+r;if(n(c),.01===l)return u(l),g(!0),void d(+s-+a);u(c.contractGoodsPrice)}catch(o){console.log(o)}finally{m(!1)}}));return{typeTip:c,setTypeTip:i,goodsNum:r,handleStep:o=>{if(y)return;const{goodsCamount:t,contractGoodsArefnum:n,contractGoodsMoney:c,contractGoodsAremoney:i,contractGoodsPrice:s}=e;if("plus"===o){const o=+t-+n;if(r>=o)return;u(o===r+1?c-i:(r+1)*s),d((o=>o+1))}else if("minus"===o){if(1===r)return;u((r-1)*s),d((o=>o-1))}},goodsInfo:e,goApply:(o,t,e,n)=>{xo("afterSalesApply",{refundType:o,contractBillcode:t,skuCode:e,goodsNum:n,goodsPrice:l})},loading:p,goodsPrice:l,stepLock:y}},tn=({contractBillcode:o,skuCode:t})=>{const[e,n]=a([]),[c,i]=a(!1),[r,d]=a(!1),[l,u]=a(""),[p,m]=a([]),[y,g]=a({}),[f,h]=a(""),[v,S]=a(!1),C=Go();s((()=>{ut(void 0,void 0,void 0,(function*(){yield b()}))}),[]);const b=()=>ut(void 0,void 0,void 0,(function*(){try{const e=yield uo({contractBillcode:o,skuCode:t,isLocalMock:!C});g(e.dataObj)}catch(o){console.log(o)}})),O=o=>o.map((o=>({refundFileUrl:o})));return{tip:"请与商家协商,确认达成一致后填写协商好的退款金额。",reasonList:e,popupVisible:c,popupLoading:r,handlePopupShow:()=>ut(void 0,void 0,void 0,(function*(){i((o=>!o)),c||0!==e.length||(yield ut(void 0,void 0,void 0,(function*(){d(!0);try{const o=yield mo({isLocalMock:!C});n(o)}catch(o){console.log(o)}finally{d(!1)}})))})),handleChooseReason:o=>{u(pt(o)),i(!1)},reason:l,handleChooseImg:()=>{const o=Eo();let t=Vo();"WEB"===o.getEnv()&&(t="/"),o.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album","camera"],success:function(e){o.uploadFile({url:`${t}web/oc/refund/uploadRefFile.json`,filePath:e.tempFilePaths[0],name:"file",formData:{tenantCode:"00000001"},fileName:e.tempFiles[0].originalFileObj.name,header:{"saas-agent":"WEB"===o.getEnv()?"qj-wap":"qj-wemini","saas-token":$o("saas-token")},success(o){const e=JSON.parse(o.data),n=Go();if("nologin"===e.errorCode)xo(n?"/account/auth/index":"/account/mobileLogin/index");else{const o=t.slice(0,-1)+e.fileUrl;m((t=>[...t,o]))}}})}})},placeholder:"描述补充,有助于商家更好的处理售后问题",imgGroup:p,handleDelImg:o=>{m((t=>[...t.slice(0,o),...t.slice(o+1)]))},limit:3,goodsInfo:y,handleFillInReason:o=>{h(pt(o))},handleSubmit:(o,t,e,n)=>ut(void 0,void 0,void 0,(function*(){const{contractGoodsCode:c,goodsCamount:i,contractGoodsPrice:r}=y;if(!l)return void Ht("请填写退款信息","none");S(!0);const s={ocRefundGoodsBeanList:[{memberCcode:y.memberCcode,contractGoodsCode:c,goodsCamount:i,refundGoodsNum:+o,refundGoodsAmt:n}],contractBillcode:t,refundMoney:n,refundEx:l,refundMeo:f,ocRefundFileDomainList:O(p),refundType:e};try{const o=yield po({params:JSON.stringify(s)});o.success&&(Ht(o.msg),setTimeout((()=>{xo("afterSalesList")}),1e3))}catch(o){console.log(o)}finally{S(!1)}})),loading:v}},en=({refundCode:o})=>{const[t,e]=a({}),[n,c]=a([]),[i,r]=a(!1),[d,l]=a(""),[u,p]=a(""),[m,y]=a(""),[g,f]=a(!1),h=Go();s((()=>{ut(void 0,void 0,void 0,(function*(){yield v()}))}),[]);const v=()=>ut(void 0,void 0,void 0,(function*(){f(!0);try{nt(yo);const t=yield yo({refundCode:o,isLocalMock:!h});1===t.dataState&&(yield S()),e(t)}catch(o){console.log(o)}finally{f(!1)}})),S=()=>ut(void 0,void 0,void 0,(function*(){try{const o=yield fo({dataState:1});c(o.list)}catch(o){console.log(o)}}));return{setAfterSalesDetailInfo:e,afterSalesDetailInfo:t,submitExpressInfo:()=>ut(void 0,void 0,void 0,(function*(){if(d&&u&&m)try{yield go({packageBillno:d,refundCode:o,packageCode:u,packageName:m}),nt(yo),yield v()}catch(o){console.log(o)}else Ht("请填写完成信息","error")})),companyList:n,handleCancelAfterSales:t=>ut(void 0,void 0,void 0,(function*(){try{yield ho({goodsCode:t,refundCode:o}),nt(yo),yield v()}catch(o){console.log(o)}})),popupShow:i,handlePopupShow:()=>{r((o=>!o))},chooseCompany:o=>{const t=pt(o).split("-");y(t[0]),p(t[1]),r(!1)},packageName:m,setPackageBillno:l,loading:g}},nn=(o,t)=>{const e=i(!1),[n,c]=a(!1),[r,d]=a([]),l=i(0),[u,p]=a(!0),m=Go();s((()=>{y()}),[t]);const y=St((()=>{l.current=0,d([]),g()})),g=St(((...t)=>ut(void 0,[...t],void 0,(function*(t={}){if(e.current)return;c(!0),++l.current;const{code:n}=o;try{const o=yield vo({page:l.current,rows:10,dataStates:n,isLocalMock:!m});e.current=zo(o.list)||o.list.length<10,0===o.list.length&&p(!1),d((t=>t.concat(o.list||[])))}catch(o){--l.current,console.log(o)}finally{c(!1)}}))));return{afterSalesList:r,onScroll:g,loading:n,init:y,goAfterSalesDetail:o=>{xo("afterSalesDetail",{refundCode:o})},haseData:u}},cn=[{name:"全部",code:""},{name:"进行中",code:"0,1,2,3,4,5"}],rn=()=>({mySettingGoBind:()=>{xo(_t.confirmPhone)},mySettingLogout:()=>ut(void 0,void 0,void 0,(function*(){const o=Eo();try{const t=yield So();o.removeStorage({key:"saas-token"}),Ht(t.msg),setTimeout((()=>{Fo(1)}),1e3)}catch(o){console.log(o)}}))});function sn(o){const t=i(!1),[e,n]=a(!1),[c,r]=a([]),[d,l]=a(!0),u=i(0);s((()=>{m()}),[o]);const p=St((o=>ut(this,void 0,void 0,(function*(){n(!0);try{const e=Go(),n=((yield No({page:o,rows:10,userinfoTypeStr:"0,1,2,3,11,12",isLocalMock:!e})).list||[]).map((o=>Object.assign(Object.assign({},o),{addressMember:o.userinfoCompname||"",addressPhone:o.userinfoTel||"",addressDetail:o.companyAddress||""})));t.current=zo(n)||n.length<10,r((t=>1===o?n:t.concat(n))),u.current=o,l(!1)}catch(t){1!==o&&--u.current,l(!1)}finally{n(!1)}})))),m=St((()=>{t.current=!1,u.current=0,r([]),l(!0),p(1)}));return{list:c,loading:e,skullShow:d,onScroll:St((()=>ut(this,void 0,void 0,(function*(){if(t.current)return;const o=u.current+1;yield p(o)})))),init:m}}function an(o){return{handlerImpl:()=>{Ro({PlaceOrderPickupAddress:o.userinfoOcode,PlaceOrderAddressTabs:{userinfoOcode:o.userinfoOcode}}),Fo(-1)}}}const dn=()=>{const[o,t]=a(0),[e,n]=a([]),[c,i]=a(!1),[r,d]=a(!1);s((()=>{l()}),[]);const l=()=>ut(void 0,void 0,void 0,(function*(){i(!0);try{yield u(),yield p()}catch(o){console.log("初始化签到数据失败:",o)}finally{i(!1)}})),u=()=>ut(void 0,void 0,void 0,(function*(){var o;try{const e=null===(o=(yield Bo({})).list)||void 0===o?void 0:o.find((o=>"CheckIn"===o.pointsRuleApi));e&&t(e.pointsRuleNum||0)}catch(o){console.log("获取签到积分失败:",o)}})),p=()=>ut(void 0,void 0,void 0,(function*(){try{const o=it(),t=o.year(),e=o.month()+1,c=((yield To({year:t,month:e})).list||[]).map((o=>it(o.gmtCreate).format("YYYY-MM-DD")));n(c)}catch(o){console.log("获取签到记录失败:",o)}}));return{pointsNum:o,signedDates:e,loading:c,signing:r,handleSignin:()=>ut(void 0,void 0,void 0,(function*(){if(r)return;const t=it(),n=t.format("YYYY-MM-DD");if(e.includes(n)){if(Go()){Eo().showToast({title:"今日已签到",icon:"none",duration:2e3})}}else{d(!0);try{yield jo({signMap:t.date(),pointsNum:o,signAddr:"0",signLat:"0",signLong:"0"}),yield Do({paramStr:JSON.stringify({pointsRuleApi:"CheckIn",upointsClearOpcode:it().format("YYYY-MM-DD HH:mm:ss")})}),yield p();if(Go()){Eo().showToast({title:`签到成功,获得${o}积分`,icon:"success",duration:2e3})}}catch(o){console.log("签到失败:",o);if(Go()){Eo().showToast({title:o.msg||"签到失败,请重试",icon:"none",duration:2e3})}}finally{d(!1)}}})),refreshSignList:p}},ln=o=>{const[t,e]=a([]),[n,c]=a(!1);s((()=>{i()}),[o]);const i=()=>ut(void 0,void 0,void 0,(function*(){c(!0);try{const t=o.year(),n=o.month()+1,c=((yield To({year:t,month:n})).list||[]).map((o=>({date:it(o.signTime||o.gmtCreate).format("YYYY-MM-DD"),points:o.pointsNum||0})));e(c)}catch(o){console.log("获取签到明细失败:",o),e([])}finally{c(!1)}}));return{signinDetails:t,loading:n,refresh:i}};export{Ke as ApplicationContext,Ut as StoreProvider,yt as addCardSku,ye as addressInitial,cn as afterSalesTabConfig,mt as checkSkuSpec,Bt as computedParams,st as createStore,Te as detailButton,Qt as formatTime,ht as getGoodDetail,pt as getRadioValue,ft as getTotalDiscountPriceImpl,he as goodListIntialValue,ae as goodListMock,at as goodStore,le as initalOrderValue,Tt as initialCoupon,Pt as initialValue,ve as initialValueOrder,rt as makeStore,Kt as navigator,fe as orderGoodValue,Be as orderStatusImpl,Me as orderStatusList,ue as orderStore,Ae as orderType,Pe as pickupAddressInitial,vt as popupImplement,gt as queryToContractImpl,_t as routerMap,Wt as routerMapArr,Ht as showToast,bt as useAddCoupon,Ct as useAddShopping,Ft as useAddressItem,Et as useAddressList,tn as useAfterSalesApply,on as useAfterSalesChooseType,en as useAfterSalesDetail,nn as useAfterSalesList,ze as useAllCoupon,Qe as useApplicationContext,_e as useArticleDetail,Nt as useBanner,qt as useCartItem,Vt as useCartList,Yt as useCartListNext,Xt as useCartOperate,Zt as useCartTop,Fe as useCollectionList,jt as useCoupon,oe as useCouponList,Ot as useCreatePoster,Le as useCube,$t as useDispatchImpl,xt as useEditAddress,Gt as useEvaluate,Ue as useEvaluateDetail,Je as useEvaluateViewDetail,xe as useExpressInfo,$e as useFootprint,Xe as useGoTop,Lt as useGoodCollection,It as useGoodDetail,wt as useGoodFootprint,Mt as useGoodSku,dt as useGoodSkuStore,Rt as useGoodSpecAndPrice,We as useGoods,Ee as useGoodsClassify,ce as useGoodsList,At as useGoodsShare,St as useImmutableCallback,Ze as useMarketingPromotion,dn as useMemberSignin,rn as useMySetting,qe as useNotice,Ve as useNoticeDetail,ge as useOrderAddress,be as useOrderCoupon,De as useOrderDetail,Se as useOrderGood,me as useOrderInfo,we as useOrderList,Ge as useOrderOperate,Oe as useOrderPay,Ie as useOrderPickupAddress,ie as useOrderResult,ke as useOrderResultResult,ne as useOverdue,Ce as usePayMode,an as usePickupPointItem,sn as usePickupPointList,de as usePlaceOrder,Dt as usePromotion,ln as useSigninDetail,Jt as useStore,pe as useSyncOrderStore,te as useUnused,ee as useUsed,zt as userAddressData};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qj-b2c-store",
3
- "version": "1.6.97",
3
+ "version": "1.6.98",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {