;(function(){function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}System.register(['./vendor-legacy.031e1374.js','./index-legacy.f25f109a4.js','./index-legacy.f25f109a10.js','./index-legacy.f25f109a20.js','./index-legacy.f25f109a2.js','./index-legacy.f25f109a.js','./index-legacy.f25f109a19.js','./cart-legacy.eb028ecf.js','./index.module-legacy.2b6ca4e3.js','./index-legacy.34c73938.js','./index-legacy.1cd7b6bb.js','./index-legacy.143c9aad.js','./index-legacy.123f1f76.js','./index-legacy.8c8f59a3.js','./index-legacy.820df6d5.js','./icon-address-legacy.93b9dd46.js','./index-legacy.f25f109a13.js','./index-legacy.f25f109a14.js','./icon_checkbox_default-legacy.e33240bc.js','./index-legacy.1bb96d98.js','./index-legacy.f25f109a8.js','./index-legacy.637f35565.js','./orderStatus-legacy.071c8548.js','./index-legacy.c75fe8a2.js','./index-legacy.d70883d8.js','./index-legacy.637f3556.js','./index-legacy.f25f109a3.js'],function(exports){'use strict';var defineComponent,ref,useRoute,onMounted,onUnmounted,reactive,watch,useRouter,createVNode,Card,CellGroup,Cell,SubmitBar,createTextVNode,Popup,Fragment,Toast,cartConfirm,formateAttr,styles,Address,request,listenerMessage,removeListenerMessage,moneyFormat,ColResult,state,postMessage,ColProtocol,Payment,ColPopup,UserAuth;return{setters:[function(module){defineComponent=module.d;ref=module.V;useRoute=module._;onMounted=module.a4;onUnmounted=module.a5;reactive=module.h;watch=module.U;useRouter=module.a2;createVNode=module.a;Card=module.as;CellGroup=module.C;Cell=module.q;SubmitBar=module.aq;createTextVNode=module.j;Popup=module.P;Fragment=module.F;Toast=module.T;},function(){},function(){},function(){},function(){},function(){},function(){},function(module){cartConfirm=module.c;formateAttr=module.f;},function(module){styles=module.s;},function(module){Address=module.A;},function(module){request=module.r;listenerMessage=module.l;removeListenerMessage=module.n;moneyFormat=module.m;ColResult=module.C;state=module.s;postMessage=module.p;},function(module){ColProtocol=module.C;},function(module){Payment=module.P;},function(module){ColPopup=module.C;},function(module){UserAuth=module.U;},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function execute(){var index=exports('default',defineComponent({name:'cartConfirm',setup:function setup(){var loading=ref(true);var route=useRoute();var address=ref();onMounted(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var _yield$request$post,code,data,a;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:loading.value=true;if(!route.query.cartIds){_context.next=13;break;}_context.prev=2;_context.next=5;return request.post('/api-mall-portal/order/generateConfirmOrder',{params:{cartIds:route.query.cartIds}});case 5:_yield$request$post=_context.sent;code=_yield$request$post.code;data=_yield$request$post.data;if(code===200){cartConfirm.calcAmount=data.calcAmount;cartConfirm.cartPromotionItemList=data.cartPromotionItemList;cartConfirm.memberReceiveAddressList=data.memberReceiveAddressList;}_context.next=13;break;case 11:_context.prev=11;_context.t0=_context["catch"](2);case 13:loading.value=false;if(cartConfirm.memberReceiveAddressList.length){a=cartConfirm.memberReceiveAddressList.find(function(n){return n.defaultStatus;})||cartConfirm.memberReceiveAddressList[0];if(a)address.value=a;}case 15:case"end":return _context.stop();}}},_callee,null,[[2,11]]);})));var setAddress=function setAddress(result){address.value=result;};onMounted(function(){listenerMessage('getAddress',function(result){setAddress((result===null||result===void 0?void 0:result.content)||{});});});onUnmounted(function(){removeListenerMessage('getAddress',function(){});});var agreeStatus=ref(false);var paymentPopup=ref(false);var authPopup=ref(false);var orderInfo=reactive({orderNo:'',actualPrice:0});//修复实名认证头部问题
watch(authPopup,function(value,oldValue){if(authPopup.value){// 设置是否显示导航栏 0 显示 1 不显示
postMessage({api:'setBarStatus',content:{status:0}});}else{postMessage({api:'setBarStatus',content:{status:1}});}});// 提交
var _onSubmit=function onSubmit(){var _address$value;if(!((_address$value=address.value)!==null&&_address$value!==void 0&&_address$value.id)){Toast('请选择收货地址');return;}if(!agreeStatus.value){Toast('请先阅读并同意《酷乐秀平台服务协议》');return;}var users=state.user.data;// 判断是否需要实名认证
if(!(users!==null&&users!==void 0&&users.realName)||!(users!==null&&users!==void 0&&users.idCardNo)){authPopup.value=true;return;}// 判断是否有订单号
if(orderInfo.orderNo){paymentPopup.value=true;return;}createOrder();};var router=useRouter();//创建订单
var createOrder=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var _address$value2;var ids,body,_yield$request$post2,code,data;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:ids=cartConfirm.cartPromotionItemList.reduce(function(arr,value){arr.push(value.id);return arr;},[]);body={cartIds:ids,memberReceiveAddressId:(_address$value2=address.value)===null||_address$value2===void 0?void 0:_address$value2.id,platformType:state.platformType};_context2.prev=2;_context2.next=5;return request.post('/api-mall-portal/order/generateOrder',{data:body});case 5:_yield$request$post2=_context2.sent;code=_yield$request$post2.code;data=_yield$request$post2.data;if(!(code===200)){_context2.next=15;break;}if(!(data.order.status===1)){_context2.next=12;break;}router.replace({path:"/shopTrade",query:{orderNo:data===null||data===void 0?void 0:data.order.orderSn,id:data===null||data===void 0?void 0:data.order.id}});return _context2.abrupt("return");case 12:paymentPopup.value=true;orderInfo.orderNo=(data===null||data===void 0?void 0:data.order.orderSn)||'';orderInfo.actualPrice=(data===null||data===void 0?void 0:data.order.payAmount)||0;case 15:_context2.next=19;break;case 17:_context2.prev=17;_context2.t0=_context2["catch"](2);case 19:case"end":return _context2.stop();}}},_callee2,null,[[2,17]]);}));return function createOrder(){return _ref2.apply(this,arguments);};}();//认证成功
var onAuthSuccess=function onAuthSuccess(){authPopup.value=false;_onSubmit();// 实名成功后自动支付
};return function(){return createVNode(Fragment,null,[loading.value?null:createVNode("div",null,[cartConfirm.cartPromotionItemList.length?createVNode("div",{"class":styles.cartConfirm},[createVNode("div",{"class":styles.cartConfirmBox},[createVNode(Address,{"item":address.value,"setAddress":setAddress},null)]),createVNode("div",{"style":{marginTop:'20px'},"class":[styles.cartBox,styles.cartConfirmBox]},[createVNode("div",{"class":styles.shopBox},[cartConfirm.cartPromotionItemList.map(function(item){return createVNode("div",{"class":[styles.cartItem],"style":{marginBottom:'10px'}},[createVNode(Card,{"price":moneyFormat(item.price),"desc":formateAttr(item.productAttr),"title":item.productName,"thumb":item.productPic,"num":item.quantity},null)]);})]),createVNode(CellGroup,{"border":false},{default:function _default(){return[createVNode(Cell,{"border":false,"title":"总额","value":'¥ '+moneyFormat(cartConfirm.calcAmount.totalAmount)},null)];}})]),createVNode("div",{"class":styles.payProtocol},[createVNode(ColProtocol,{"modelValue":agreeStatus.value,"onUpdate:modelValue":function onUpdateModelValue($event){return agreeStatus.value=$event;}},null),createVNode(SubmitBar,{"buttonText":"\u7ED3\u7B97(".concat(cartConfirm.cartPromotionItemList.length,")"),"buttonColor":"var(--van-primary)","disabled":cartConfirm.cartPromotionItemList.length===0,"onSubmit":function onSubmit(){return _onSubmit();}},{default:function _default(){return[createVNode("div",{"class":styles.confirmBottom},[createTextVNode("\u5408\u8BA1"),' ',createVNode("span",{"class":styles['price-des']},[createTextVNode("\xA5"),moneyFormat(cartConfirm.calcAmount.payAmount)])])];}})]),createVNode("div",{"style":{height:'var(--van-submit-bar-height)'}},null),createVNode(ColPopup,{"modelValue":authPopup.value,"onUpdate:modelValue":function onUpdateModelValue($event){return authPopup.value=$event;}},{default:function _default(){return[createVNode(UserAuth,{"onSuccess":onAuthSuccess},null)];}}),createVNode(Popup,{"show":paymentPopup.value,"closeOnClickOverlay":false,"position":"bottom","round":true,"closeOnPopstate":true,"safeAreaInsetBottom":true,"style":{minHeight:'30%'}},{default:function _default(){return[createVNode(Payment,{"modelValue":paymentPopup.value,"onUpdate:modelValue":function onUpdateModelValue($event){return paymentPopup.value=$event;},"orderInfo":orderInfo,"paymentType":"goodsPay","onBackOut":function onBackOut(){return paymentPopup.value=false;}},null)];}})]):createVNode(ColResult,{"buttonText":"去购物车","onClick":function onClick(){router.push({path:'/cart'});}},null)])]);};}}));}};});})();
