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