1 |
- import{s as e,c as s,E as o,v as r,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 b,a9 as v,ar as x,ao as g,l as k,i as w,O as A,B as j}from"./index-CRW3onsz.js";import{_ as T}from"./s-address-item.2DP7Leco.js";import{_ as O}from"./s-goods-item.Cu1mS14n.js";import{_ as C}from"./phone-international-input.vKvR7wTz.js";import{a as E,_ as M}from"./s-layout.DKC65HXL.js";import{f as $,p as D,d as S}from"./useGoods.Dxoq0xk-.js";import{_ as V}from"./_plugin-vue_export-helper.BCo6x5W8.js";/* empty css */import"./uni-icons.CkO1HN9g.js";import"./phone-international-input.vue_vue_type_style_index_0_scoped_0f0268ff_lang.Dctrwx6t.js";import"./s-menu-tools.CNNsOrh3.js";import"./s-search-block.vue_vue_type_style_index_0_scoped_f692e81a_lang.CiL8L9B_.js";import"./s-layout.vue_vue_type_style_index_0_scoped_c1143e8c_lang.HuwOimZj.js";import"./s-search-block.9OtJrST_.js";const B=V({__name:"confirm",setup(V){e.$store("user").getWallet();const B=s((()=>e.$store("user").userWallet)),H=o(),N=r({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:[]}),Q=s((()=>$(N.orderInfo.price.payPrice-100*N.usedPoint-100*N.usedConsumptionPoints))),R=s((()=>{const e={};try{Object.keys(N.orderInfo.shopRespVOMap).forEach((s=>{const o=N.orderInfo.shopNameMap[s];o&&(e[o]=N.orderInfo.shopRespVOMap[s],e[o].remark="",e[o].shopId=s)}))}catch(s){}return e})),q=s((()=>{let e=0;return Object.values(R.value).forEach((s=>{s.items.forEach((s=>{e+=s.count}))})),e}));function F(){b("SELECT_ADDRESS",(e=>{!async function(e={}){v.isEmpty(e)||(N.addressInfo=e);await U()}(e.addressInfo)})),N.orderPayload.spuType?e.$router.go("/pages/user/address/list"):e.$router.go("/pages/user/dummyAddress/list")}function G(){N.addressInfo.id?async function(){if(0===N.orderIds.length){const o=R.value,r={};Object.keys(o).forEach((e=>{const s=o[e];r[s.shopId]=s.remark}));if(!s((()=>e.$store("user").userInfo)).value.havePayPassword)return e.$helper.toast("请先设置支付密码后再操作"),x(),!1;const t=N.orderPayload.highPrecision?function(e,s){let o=Math.pow(10,s);return(Math.floor(e*o)/o).toFixed(s)}(N.orderInfo.price.virtualPayPrice/100,2):N.usedPoint,{code:a,data:d}=await c.createOrder({items:N.orderPayload.items,couponId:N.orderPayload.couponId,addressId:N.addressInfo.id,deliveryType:1==N.orderPayload.spuType?1:3,pointStatus:!1,combinationActivityId:N.orderPayload.combinationActivityId,combinationHeadId:N.orderPayload.combinationHeadId,seckillActivityId:N.orderPayload.seckillActivityId,payIntegral:t,payConsumptionPoints:N.usedConsumptionPoints,shopRemarks:r,areaId:N.orderInfo.shopAreaId});if(0!==a)return;N.orderIds=d.ids}N.orderPayload.items[0].cartId>0&&e.$store("cart").getList();g((async e=>{const{data:s,code:o}=await c.payOrder({orderIds:N.orderIds,payPassword:e});0===o&&j()}),(()=>{e.$helper.toast("取消支付")}))}():e.$helper.toast(h("confirm.select_shipping_address"))}async function U(){const e=R.value;let s={};0!==Object.keys(e).length&&Object.keys(e).forEach((o=>{const r=e[o];s[o]=r.remark}));const{data:o,code:r}=await c.settlementOrder({items:N.orderPayload.items,couponId:N.orderPayload.couponId,addressId:N.addressInfo.id,deliveryType:1==N.orderPayload.spuType?1:3,pointStatus:!1,combinationActivityId:N.orderPayload.combinationActivityId,combinationHeadId:N.orderPayload.combinationHeadId,seckillActivityId:N.orderPayload.seckillActivityId,usedPoint:N.usedPoint,addressType:1==N.orderPayload.spuType?1:2});0===r&&(N.orderInfo=o,0!==Object.keys(s).length&&Object.keys(s).forEach((e=>{R.value[e].remark=s[e]})),N.orderInfo.address&&(N.addressInfo=N.orderInfo.address),N.currentMemberPoints=N.orderInfo.currentQuota>0?D(N.orderInfo.currentQuota):0,N.currentMemberConsumptionPoints=N.orderInfo.consumePoints>0?D(N.orderInfo.consumePoints):0,N.currentTotalPrice=$(N.orderInfo.price.payPrice),N.currentDeliveryPrice=$(N.orderInfo.price.deliveryPrice),2==N.orderPayload.spuPayType&&(N.usedPoint=N.currentTotalPrice-.01))}return t((async s=>{s.data?(N.orderPayload=JSON.parse(s.data),await U()):e.$helper.toast("参数不正确,请检查!")})),(e,s)=>{const o=k,r=w,t=a(d("s-address-item"),T),c=a(d("s-goods-item"),O),b=a(d("uni-easyinput"),C),v=A,x=a(d("su-fixed"),E),g=a(d("s-layout"),M);return u(),l(g,{title:i(h)("confirm.confirm_order")},{default:n((()=>[p(r,{class:"bg-white address-box ss-m-b-14 ss-r-b-10",onClick:F},{default:n((()=>[p(t,{item:N.addressInfo,spuType:N.orderPayload.spuType,hasBorderBottom:!1},{default:n((()=>[p(r,{class:"ss-rest-button"},{default:n((()=>[p(o,{class:"_icon-forward"})])),_:1})])),_:1},8,["item","spuType"])])),_:1}),(u(!0),f(y,null,m(R.value,((e,s)=>(u(),l(r,{class:"order-card-box ss-m-b-14",key:s},{default:n((()=>[p(r,{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:N.orderInfo.shopAreaId},null,8,["img","title","skuText","price","num","areaId"])})),128)),p(r,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[p(r,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.shipping_fee")),1)])),_:1}),p(r,{class:"ss-flex ss-col-center"},{default:n((()=>[_(I(e.price.deliveryPrice?i($)(e.price.deliveryPrice):i(h)("confirm.free_shipping")),1)])),_:2},1024)])),_:2},1024),p(r,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[p(r,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.order_note")),1)])),_:1}),p(r,{class:"ss-flex ss-col-center"},{default:n((()=>[p(b,{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==N.orderPayload.spuType?(u(),l(r,{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(r,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.quantity")),1)])),_:1}),p(r,{class:"ss-flex ss-col-center"},{default:n((()=>[_(I(q.value),1)])),_:1})])),_:1})):(u(),l(r,{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(r,{class:"item-title"},{default:n((()=>[_(I(i(h)("common.total")),1)])),_:1}),p(r,{class:"ss-flex ss-col-center"},{default:n((()=>[1==N.orderInfo.shopAreaId?(u(),l(r,{key:0,class:"points-red"})):P("",!0),2==N.orderInfo.shopAreaId?(u(),l(r,{key:1,class:"points-green"})):P("",!0),_(" "+I(i($)(e.price.payPrice)),1)])),_:2},1024)])),_:2},1024))])),_:2},1024)))),128)),p(r,{class:"bg-white total-card-box ss-p-20 ss-m-b-14 ss-r-10"},{default:n((()=>[p(r,{class:"title-text"},{default:n((()=>[_(I(i(h)("confirm.price_details")),1)])),_:1}),p(r,{class:"total-box-content border-bottom"},{default:n((()=>[p(r,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:n((()=>[p(r,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.total_price"))+" "+I(i(h)("confirm.total_items",{count:q.value})),1)])),_:1}),p(r,{class:"ss-flex ss-col-center"},{default:n((()=>[1==N.orderInfo.shopAreaId?(u(),l(r,{key:0,class:"points-red"})):P("",!0),2==N.orderInfo.shopAreaId?(u(),l(r,{key:1,class:"points-green"})):P("",!0),p(o,{class:"item-value ss-m-r-24"},{default:n((()=>[_(I(i($)(N.orderInfo.price.totalPrice)),1)])),_:1})])),_:1})])),_:1}),p(r,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:n((()=>[p(r,{class:"item-title"},{default:n((()=>[_(I(i(h)("confirm.shipping_fee")),1)])),_:1}),p(r,{class:"ss-flex ss-col-center"},{default:n((()=>[p(o,{class:"item-value ss-m-r-24"},{default:n((()=>[_(I(i($)(N.orderInfo.price.deliveryPrice)),1)])),_:1})])),_:1})])),_:1})])),_:1}),p(r,{class:"total-box-footer ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28"},{default:n((()=>[p(r,{class:"total-num ss-m-r-20"},{default:n((()=>[_(I(i(h)("confirm.total_items_count",{count:q.value})),1)])),_:1}),p(r,null,{default:n((()=>[_(I(i(h)("common.total"))+":",1)])),_:1}),p(r,{class:"total-num text-red ss-flex"},{default:n((()=>[1==N.orderInfo.shopAreaId?(u(),l(r,{key:0,class:"points-red"})):P("",!0),2==N.orderInfo.shopAreaId?(u(),l(r,{key:1,class:"points-green"})):P("",!0),N.orderPayload.highPrecision?(u(),l(o,{key:2},{default:n((()=>[_(I(i(S)(N.orderInfo.price.virtualTotalPrice)),1)])),_:1})):2==N.orderPayload.spuPayType?(u(),l(o,{key:3},{default:n((()=>[_(I(i($)(N.orderInfo.price.payPrice)-.01),1)])),_:1})):(u(),l(o,{key:4},{default:n((()=>[_(I(i($)(N.orderInfo.price.payPrice)),1)])),_:1}))])),_:1})])),_:1}),p(r,{class:"ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28"},{default:n((()=>[_(" 我的余额: "),1==N.orderInfo.shopAreaId?(u(),l(r,{key:0,class:"points-red"})):P("",!0),2==N.orderInfo.shopAreaId?(u(),l(r,{key:1,class:"points-green"})):P("",!0),1==N.orderInfo.shopAreaId?(u(),l(o,{key:2},{default:n((()=>[_(I(i(D)(B.value.integralDO.redCurrentQuota)),1)])),_:1})):P("",!0),2==N.orderInfo.shopAreaId?(u(),l(o,{key:3},{default:n((()=>[_(I(i(D)(B.value.integralDO.greenCurrentQuota)),1)])),_:1})):P("",!0)])),_:1})])),_:1}),p(x,{bottom:"",opacity:!1,bg:"bg-white",placeholder:"",noFixed:!1,index:200},{default:n((()=>[p(r,{class:"footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center"},{default:n((()=>[p(r,{class:"total-box-footer ss-flex ss-col-center"},{default:n((()=>[p(r,{class:"total-num ss-font-30 text-red ss-flex ss-col-center"},{default:n((()=>[1==N.orderInfo.shopAreaId?(u(),l(r,{key:0,class:"points-red"})):P("",!0),2==N.orderInfo.shopAreaId?(u(),l(r,{key:1,class:"points-green"})):P("",!0),_(" "+I(Q.value),1)])),_:1})])),_:1}),!i(H)||i(H)&&0==Q.value?(u(),l(v,{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-3cf35853"]]);export{B as default};
|