12345678910111213141516171819 |
- ;(function(){function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}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.73abbe39.js','./index-legacy.f25f109a4.js','./index-legacy.f25f109a9.js','./index-legacy.f25f109a12.js','./index-legacy.f25f109a2.js','./index-legacy.f25f109a.js','./index-legacy.f25f109a11.js','./cart-legacy.e8d257f5.js','./index.module-legacy.f5231e7e.js','./index-legacy.e06a4f89.js','./index-legacy.4b2d517a.js','./index-legacy.c01b86ad.js','./index-legacy.564b8047.js','./address-legacy.743bd3e3.js','./index-legacy.dda51a96.js','./index-legacy.f25f109a7.js','./index-legacy.f25f109a8.js','./index-legacy.637f35563.js','./index-legacy.637f3556.js','./index-legacy.f25f109a3.js'],function(exports){'use strict';var defineComponent,ref,useRoute,onMounted,useRouter,createVNode,Card,CellGroup,Cell,SubmitBar,createTextVNode,Popup,Fragment,Toast,cartConfirm,formateAttr,styles,Address,request,moneyFormat,ColResult,state,ColProtocol,Payment,ColPopup,UserAuth,addressInfo,resestState,ColHeader;return{setters:[function(module){defineComponent=module.d;ref=module.M;useRoute=module.a4;onMounted=module.a5;useRouter=module.a6;createVNode=module.b;Card=module.a3;CellGroup=module.m;Cell=module.p;SubmitBar=module.a0;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;moneyFormat=module.m;ColResult=module.C;state=module.s;},function(module){ColProtocol=module.C;Payment=module.P;},function(module){ColPopup=module.C;UserAuth=module.U;},function(module){addressInfo=module.a;resestState=module.r;},function(module){ColHeader=module.C;},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;}// 判断是否有数据
- if(addressInfo.id){setAddress(_objectSpread({},addressInfo)||{});resestState();}case 16:case"end":return _context.stop();}}},_callee,null,[[2,11]]);})));var setAddress=function setAddress(result){address.value=result;};var agreeStatus=ref(false);var paymentPopup=ref(false);var authPopup=ref(false);var orderInfo=ref();//修复实名认证头部问题
- // watch(authPopup, (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.student.realName)||!(users!==null&&users!==void 0&&users.student.idCardNo)){authPopup.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,orderAmount:(cartConfirm.calcAmount.payAmount-cartConfirm.calcAmount.promotionAmount).toFixed(2)// couponId: orderInfo.couponId
- };_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=14;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?.order.orderSn || ''
- // orderInfo.actualPrice = data?.order.payAmount || 0
- orderInfo.value=data===null||data===void 0?void 0:data.pay;case 14:_context2.next=18;break;case 16:_context2.prev=16;_context2.t0=_context2["catch"](2);case 18:case"end":return _context2.stop();}}},_callee2,null,[[2,16]]);}));return function createOrder(){return _ref2.apply(this,arguments);};}();//认证成功
- var onAuthSuccess=function onAuthSuccess(){authPopup.value=false;console.log(state.user.data);_onSubmit();// 实名成功后自动支付
- };return function(){return createVNode(Fragment,null,[createVNode(ColHeader,null,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":true},{default:function _default(){return[createVNode(Cell,{"border":false,"title":"总额","value":'¥ '+moneyFormat(cartConfirm.calcAmount.totalAmount)},null)];}})]),createVNode("div",{"class":styles.payProtocol},[createVNode(ColProtocol,{"showHeader":true,"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-cartConfirm.calcAmount.promotionAmount)])])];}})]),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.value,"paymentType":"goodsPay","onBackOut":function onBackOut(){return paymentPopup.value=false;}},null)];}})]):createVNode(ColResult,{"buttonText":"去购物车","onClick":function onClick(){router.push({path:'/cart'});}},null)])]);};}}));}};});})();
|