12345678910111213141516171819202122232425262728 |
- ;(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.f25f109a10.js','./index-legacy.f25f109a13.js','./index-legacy.f25f109a2.js','./index-legacy.f25f109a.js','./index-legacy.f25f109a7.js','./index-legacy.f25f109a8.js','./index-legacy.f25f109a12.js','./cart-legacy.e8d257f5.js','./index.module-legacy.f5231e7e.js','./index-legacy.e06a4f89.js','./index-legacy.890d473e.js','./index-legacy.fef83bdf.js','./index-legacy.7cce38f9.js','./address-legacy.743bd3e3.js','./index-legacy.372e7f90.js','./index-legacy.637f35563.js','./index-legacy.637f3556.js','./index-legacy.f25f109a3.js','./item-legacy.8c78baa8.js','./index-legacy.cddcfa89.js'],function(exports){'use strict';var defineComponent,ref,useRoute,onMounted,useRouter,createVNode,Card,CellGroup,Cell,Checkbox,SubmitBar,createTextVNode,Popup,Fragment,Toast,cartConfirm,formateAttr,styles,Address,request,moneyFormat,ColResult,state,ColProtocol,Payment,UseCoupons,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;Checkbox=module.G;SubmitBar=module.a0;createTextVNode=module.j;Popup=module.P;Fragment=module.F;Toast=module.T;},function(){},function(){},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){UseCoupons=module.U;ColPopup=module.C;UserAuth=module.a;},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();var cartUseAmount=ref({useBalance:false,balance:0,couponId:''});var paymentWay=ref([]);onMounted(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var _yield$request$post,code,data,res,paranValue,a;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:loading.value=true;// 获取用户余额
- _context.next=3;return getUserBalance();case 3:if(!route.query.cartIds){_context.next=20;break;}_context.prev=4;_context.next=7;return request.post('/api-mall-portal/order/generateConfirmOrder',{params:{cartIds:route.query.cartIds}});case 7:_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;return request.get('/api-student/sysConfig/queryByParamName',{params:{paramName:'payment_channel_action'}});case 13:res=_context.sent;paranValue=res.data.paranValue;paymentWay.value=paranValue?JSON.parse(paranValue):[];_context.next=20;break;case 18:_context.prev=18;_context.t0=_context["catch"](4);case 20: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 23:case"end":return _context.stop();}}},_callee,null,[[4,18]]);})));// 获取用户余额
- var getUserBalance=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var _yield$request$get,data;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return request.get('/api-student/userCashAccount/get');case 3:_yield$request$get=_context2.sent;data=_yield$request$get.data;cartUseAmount.value.balance=data.balance||0;_context2.next=10;break;case 8:_context2.prev=8;_context2.t0=_context2["catch"](0);case 10:case"end":return _context2.stop();}}},_callee2,null,[[0,8]]);}));return function getUserBalance(){return _ref2.apply(this,arguments);};}();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 _ref3=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(){var _address$value2;var ids,payAmount,body,_yield$request$post2,code,data;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:ids=cartConfirm.cartPromotionItemList.reduce(function(arr,value){arr.push(value.id);return arr;},[]);payAmount=cartConfirm.calcAmount.payAmount-cartConfirm.calcAmount.promotionAmount;body={cartIds:ids,memberReceiveAddressId:(_address$value2=address.value)===null||_address$value2===void 0?void 0:_address$value2.id,platformType:state.platformType,orderAmount:Number((payAmount>=0?payAmount:0).toFixed(2)),couponId:cartUseAmount.value.couponId,useBalance:cartUseAmount.value.useBalance// 是否使用余额
- };_context3.prev=3;_context3.next=6;return request.post('/api-mall-portal/order/generateOrder',{data:body});case 6:_yield$request$post2=_context3.sent;code=_yield$request$post2.code;data=_yield$request$post2.data;if(!(code===200)){_context3.next=15;break;}if(!(data.order.status===1)){_context3.next=13;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 _context3.abrupt("return");case 13: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 15:_context3.next=19;break;case 17:_context3.prev=17;_context3.t0=_context3["catch"](3);case 19:case"end":return _context3.stop();}}},_callee3,null,[[3,17]]);}));return function createOrder(){return _ref3.apply(this,arguments);};}();//认证成功
- var onAuthSuccess=function onAuthSuccess(){authPopup.value=false;console.log(state.user.data);_onSubmit();// 实名成功后自动支付
- };// {
- // moneyFormat(
- // cartConfirm.calcAmount.payAmount -
- // cartConfirm.calcAmount.promotionAmount
- // )
- // }
- var needPayPrice=function needPayPrice(){var payAmount=cartConfirm.calcAmount.payAmount-cartConfirm.calcAmount.promotionAmount;var price=Number((payAmount>=0?payAmount:0).toFixed(2));console.log(price);if(cartUseAmount.value.useBalance){price=price-cartUseAmount.value.balance<=0?0:Number((price-cartUseAmount.value.balance).toFixed(2));}return price;};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(UseCoupons,{"useSystem":"MALL","typeDetail":"MALLCOUPON","orderAmount":cartConfirm.calcAmount.totalAmount,"onCouponSelect":function onCouponSelect(coupon){console.log(coupon,'coupon');var discountPrice=coupon.map(function(n){return n.faceValue;}).reduce(function(total,n){return total+n;},0);var couponId=coupon.map(function(n){return n.couponCodeId;}).join(',');cartConfirm.calcAmount.promotionAmount=discountPrice;cartUseAmount.value.couponId=couponId;console.log(cartUseAmount,'coupon');// orderInfo.couponId = couponId
- }},null),createVNode(Cell,{"onClick":function onClick(){console.log(true,'111');cartUseAmount.value.useBalance=!cartUseAmount.value.useBalance;}},{title:"\u4F59\u989D\u652F\u4ED8\uFF08\u5269\u4F59\uFF1A\uFFE5".concat(moneyFormat(cartUseAmount.value.balance),"\uFF09"),'right-icon':function rightIcon(){return createVNode(Checkbox,{"modelValue":cartUseAmount.value.useBalance},null);}}),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(needPayPrice())])])];}})]),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,{"paymentWay":paymentWay.value,"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)])]);};}}));}};});})();
|