1 |
- import{s as e,c as s,E as r,v as o,o as t,a,b as d,d as l,w as n,u as i,an as c,e as u,f as p,x as f,y as m,F as y,g as _,j as I,t as h,z as P,aq as v,a9 as b,ar as g,ao as x,l as k,i as w,O as A,B as j}from"./index-dGICJBA1.js";import{_ as O}from"./s-address-item.DnGcX4w_.js";import{_ as T}from"./s-goods-item.Bqqcpp4w.js";import{_ as C}from"./phone-international-input.BSO1ObdH.js";import{a as E,_ as $}from"./s-layout.2n749i-h.js";import{f as D,p as M,d as Q}from"./useGoods.jFp9m3ab.js";import{_ as F}from"./_plugin-vue_export-helper.BCo6x5W8.js";/* empty css */import"./uni-icons.BZJC71FJ.js";import"./phone-international-input.vue_vue_type_style_index_0_scoped_0f0268ff_lang.DfrFtxCM.js";import"./s-menu-tools.BHmVopdZ.js";import"./s-search-block.vue_vue_type_style_index_0_scoped_f692e81a_lang.BkXbqiPQ.js";import"./s-layout.vue_vue_type_style_index_0_scoped_c1143e8c_lang.C9LLV9dD.js";import"./s-search-block.DW-gs1wX.js";const S=F({__name:"confirm",setup(F){e.$store("user").getWallet();const S=s((()=>e.$store("user").userWallet)),V=r(),B=o({orderPayload:{},orderInfo:{items:[],price:{}},addressInfo:{},showPoints:!1,showConsumptionPoints:!1,couponInfo:[],showDiscount:!1,currentMemberPoints:0,currentMemberConsumptionPoints:0,usedPoint:0,usedConsumptionPoints:0,currentTotalPrice:0,currentDeliveryPrice:0,orderIds:[]}),H=s((()=>D(B.orderInfo.price.payPrice-100*B.usedPoint-100*B.usedConsumptionPoints))),N=s((()=>{const e={};try{Object.keys(B.orderInfo.shopRespVOMap).forEach((s=>{const r=B.orderInfo.shopNameMap[s];r&&(e[r]=B.orderInfo.shopRespVOMap[s],e[r].remark="",e[r].shopId=s)}))}catch(s){}return e})),R=s((()=>{let e=0;return Object.values(N.value).forEach((s=>{s.items.forEach((s=>{e+=s.count}))})),e}));function q(){v("SELECT_ADDRESS",(e=>{!async function(e={}){b.isEmpty(e)||(B.addressInfo=e);await U()}(e.addressInfo)})),B.orderPayload.spuType?e.$router.go("/pages/user/address/list"):e.$router.go("/pages/user/dummyAddress/list")}function G(){if(!B.addressInfo.id)return void e.$helper.toast(h("confirm.select_shipping_address"));return s((()=>e.$store("user").userInfo)).value.havePayPassword?(console.log(B.orderInfo.shopAreaId,M(S.value.integralDO.redCurrentQuota),M(S.value.integralDO.greenCurrentQuota),H.value),1==B.orderInfo.shopAreaId&&parseFloat(M(S.value.integralDO.redCurrentQuota))<parseFloat(H.value)||2==B.orderInfo.shopAreaId&&parseFloat(M(S.value.integralDO.greenCurrentQuota))<parseFloat(H.value)?(e.$helper.toast("您的积分余额不足"),!1):void async function(){if(0===B.orderIds.length){const e=N.value,s={};Object.keys(e).forEach((r=>{const o=e[r];s[o.shopId]=o.remark}));const r=B.orderPayload.highPrecision?function(e,s){let r=Math.pow(10,s);return(Math.floor(e*r)/r).toFixed(s)}(B.orderInfo.price.virtualPayPrice/100,2):B.usedPoint,{code:o,data:t}=await c.createOrder({items:B.orderPayload.items,couponId:B.orderPayload.couponId,addressId:B.addressInfo.id,deliveryType:1==B.orderPayload.spuType?1:3,pointStatus:!1,combinationActivityId:B.orderPayload.combinationActivityId,combinationHeadId:B.orderPayload.combinationHeadId,seckillActivityId:B.orderPayload.seckillActivityId,payIntegral:r,payConsumptionPoints:B.usedConsumptionPoints,shopRemarks:s,areaId:B.orderInfo.shopAreaId});if(0!==o)return;B.orderIds=t.ids}B.orderPayload.items[0].cartId>0&&e.$store("cart").getList();x((async e=>{const{data:s,code:r}=await c.payOrder({orderIds:B.orderIds,payPassword:e});0===r&&j()}),(()=>{e.$helper.toast("取消支付")}))}()):(e.$helper.toast("请先设置支付密码后再操作"),g(),!1)}async function U(){const e=N.value;let s={};0!==Object.keys(e).length&&Object.keys(e).forEach((r=>{const o=e[r];s[r]=o.remark}));const{data:r,code:o}=await c.settlementOrder({items:B.orderPayload.items,couponId:B.orderPayload.couponId,addressId:B.addressInfo.id,deliveryType:1==B.orderPayload.spuType?1:3,pointStatus:!1,combinationActivityId:B.orderPayload.combinationActivityId,combinationHeadId:B.orderPayload.combinationHeadId,seckillActivityId:B.orderPayload.seckillActivityId,usedPoint:B.usedPoint,addressType:1==B.orderPayload.spuType?1:2});0===o&&(B.orderInfo=r,0!==Object.keys(s).length&&Object.keys(s).forEach((e=>{N.value[e].remark=s[e]})),B.orderInfo.address&&(B.addressInfo=B.orderInfo.address),B.currentMemberPoints=B.orderInfo.currentQuota>0?M(B.orderInfo.currentQuota):0,B.currentMemberConsumptionPoints=B.orderInfo.consumePoints>0?M(B.orderInfo.consumePoints):0,B.currentTotalPrice=D(B.orderInfo.price.payPrice),B.currentDeliveryPrice=D(B.orderInfo.price.deliveryPrice),2==B.orderPayload.spuPayType&&(B.usedPoint=B.currentTotalPrice-.01))}return t((async s=>{s.data?(B.orderPayload=JSON.parse(s.data),await U()):e.$helper.toast("参数不正确,请检查!")})),(e,s)=>{const r=k,o=w,t=a(d("s-address-item"),O),c=a(d("s-goods-item"),T),v=a(d("uni-easyinput"),C),b=A,g=a(d("su-fixed"),E),x=a(d("s-layout"),$);return u(),l(x,{title:i(h)("confirm.confirm_order")},{default:n((()=>[p(o,{class:"bg-white address-box ss-m-b-14 ss-r-b-10",onClick:q},{default:n((()=>[p(t,{item:B.addressInfo,spuType:B.orderPayload.spuType,hasBorderBottom:!1},{default:n((()=>[p(o,{class:"ss-rest-button"},{default:n((()=>[p(r,{class:"_icon-forward"})])),_:1})])),_:1},8,["item","spuType"])])),_:1}),(u(!0),f(y,null,m(N.value,((e,s)=>(u(),l(o,{class:"order-card-box ss-m-b-14",key:s},{default:n((()=>[p(o,{class:"title-text ss-p-x-20 ss-p-t-20"},{default:n((()=>[_(I(s),1)])),_:2},1024),(u(!0),f(y,null,m(e.items,(e=>{var s;return u(),l(c,{key:null==e?void 0:e.skuId,img:null==e?void 0:e.picUrl,title:null==e?void 0:e.spuName,skuText:null==(s=null==e?void 0:e.properties)?void 0:s.map((e=>e.valueName)).join(" "),price:e.highPrecisionPrice?null==e?void 0:e.highPrecisionPrice:null==e?void 0:e.price,num:null==e?void 0:e.count,areaId:B.orderInfo.shopAreaId},null,8,["img","title","skuText","price","num","areaId"])})),128)),p(o,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[p(o,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.shipping_fee")),1)])),_:1}),p(o,{class:"ss-flex ss-col-center"},{default:n((()=>[_(I(e.price.deliveryPrice?i(D)(e.price.deliveryPrice):i(h)("confirm.free_shipping")),1)])),_:2},1024)])),_:2},1024),p(o,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[p(o,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.order_note")),1)])),_:1}),p(o,{class:"ss-flex ss-col-center"},{default:n((()=>[p(v,{maxlength:"20",placeholder:i(h)("confirm.communication_advice"),modelValue:e.remark,"onUpdate:modelValue":s=>e.remark=s,inputBorder:!1,clearable:!1},null,8,["placeholder","modelValue","onUpdate:modelValue"])])),_:2},1024)])),_:2},1024),0==B.orderPayload.spuType?(u(),l(o,{key:0,class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[p(o,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.quantity")),1)])),_:1}),p(o,{class:"ss-flex ss-col-center"},{default:n((()=>[_(I(R.value),1)])),_:1})])),_:1})):(u(),l(o,{key:1,class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[p(o,{class:"item-title"},{default:n((()=>[_(I(i(h)("common.total")),1)])),_:1}),p(o,{class:"ss-flex ss-col-center"},{default:n((()=>[1==B.orderInfo.shopAreaId?(u(),l(o,{key:0,class:"points-red"})):P("",!0),2==B.orderInfo.shopAreaId?(u(),l(o,{key:1,class:"points-green"})):P("",!0),_(" "+I(i(D)(e.price.payPrice)),1)])),_:2},1024)])),_:2},1024))])),_:2},1024)))),128)),p(o,{class:"bg-white total-card-box ss-p-20 ss-m-b-14 ss-r-10"},{default:n((()=>[p(o,{class:"title-text"},{default:n((()=>[_(I(i(h)("confirm.price_details")),1)])),_:1}),p(o,{class:"total-box-content border-bottom"},{default:n((()=>[p(o,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:n((()=>[p(o,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.total_price"))+" "+I(i(h)("confirm.total_items",{count:R.value})),1)])),_:1}),p(o,{class:"ss-flex ss-col-center"},{default:n((()=>[1==B.orderInfo.shopAreaId?(u(),l(o,{key:0,class:"points-red"})):P("",!0),2==B.orderInfo.shopAreaId?(u(),l(o,{key:1,class:"points-green"})):P("",!0),p(r,{class:"item-value ss-m-r-24"},{default:n((()=>[_(I(i(D)(B.orderInfo.price.totalPrice)),1)])),_:1})])),_:1})])),_:1}),p(o,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:n((()=>[p(o,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.shipping_fee")),1)])),_:1}),p(o,{class:"ss-flex ss-col-center"},{default:n((()=>[p(r,{class:"item-value ss-m-r-24"},{default:n((()=>[_(I(i(D)(B.orderInfo.price.deliveryPrice)),1)])),_:1})])),_:1})])),_:1})])),_:1}),p(o,{class:"total-box-footer ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28"},{default:n((()=>[p(o,{class:"total-num ss-m-r-20"},{default:n((()=>[_(I(i(h)("confirm.total_items_count",{count:R.value})),1)])),_:1}),p(o,null,{default:n((()=>[_(I(i(h)("common.total"))+":",1)])),_:1}),p(o,{class:"total-num text-red ss-flex"},{default:n((()=>[1==B.orderInfo.shopAreaId?(u(),l(o,{key:0,class:"points-red"})):P("",!0),2==B.orderInfo.shopAreaId?(u(),l(o,{key:1,class:"points-green"})):P("",!0),B.orderPayload.highPrecision?(u(),l(r,{key:2},{default:n((()=>[_(I(i(Q)(B.orderInfo.price.virtualTotalPrice)),1)])),_:1})):2==B.orderPayload.spuPayType?(u(),l(r,{key:3},{default:n((()=>[_(I(i(D)(B.orderInfo.price.payPrice)-.01),1)])),_:1})):(u(),l(r,{key:4},{default:n((()=>[_(I(i(D)(B.orderInfo.price.payPrice)),1)])),_:1}))])),_:1})])),_:1}),p(o,{class:"ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28"},{default:n((()=>[_(" 我的余额: "),1==B.orderInfo.shopAreaId?(u(),l(o,{key:0,class:"points-red"})):P("",!0),2==B.orderInfo.shopAreaId?(u(),l(o,{key:1,class:"points-green"})):P("",!0),1==B.orderInfo.shopAreaId?(u(),l(r,{key:2},{default:n((()=>[_(I(i(M)(S.value.integralDO.redCurrentQuota)),1)])),_:1})):P("",!0),2==B.orderInfo.shopAreaId?(u(),l(r,{key:3},{default:n((()=>[_(I(i(M)(S.value.integralDO.greenCurrentQuota)),1)])),_:1})):P("",!0)])),_:1})])),_:1}),p(g,{bottom:"",opacity:!1,bg:"bg-white",placeholder:"",noFixed:!1,index:200},{default:n((()=>[p(o,{class:"footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center"},{default:n((()=>[p(o,{class:"total-box-footer ss-flex ss-col-center"},{default:n((()=>[p(o,{class:"total-num ss-font-30 text-red ss-flex ss-col-center"},{default:n((()=>[1==B.orderInfo.shopAreaId?(u(),l(o,{key:0,class:"points-red"})):P("",!0),2==B.orderInfo.shopAreaId?(u(),l(o,{key:1,class:"points-green"})):P("",!0),_(" "+I(H.value),1)])),_:1})])),_:1}),!i(V)||i(V)&&0==H.value?(u(),l(b,{key:0,class:"ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main",onClick:G},{default:n((()=>[_(I(i(h)("confirm.submit_order")),1)])),_:1})):P("",!0)])),_:1})])),_:1})])),_:1},8,["title"])}}},[["__scopeId","data-v-8d6b8a80"]]);export{S as default};
|