pages-order-confirm.921021fd.js 9.7 KB

1
  1. import{v as e,c as s,ac as t,ad as o,l as r,m as a,e as l,f as n,w as d,j as i,p as c,t as u,u as f,i as p,ae as m,C as b,D as _,o as P,s as y,ab as x,k as I,r as w,F as h,z as v,af as g,a2 as T}from"./index-b89c9d3e.js";import{_ as k}from"./s-address-item.0da4e0bd.js";import{_ as M}from"./s-goods-item.728d687d.js";import{d as j,_ as V}from"./form.c23f5f64.js";import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";import{a as O,_ as A}from"./s-layout.2a1d0055.js";import{p as E,f as S}from"./useGoods.c7bd7cb5.js";/* empty css */const N=C({__name:"s-points-pop",props:{modelValue:{type:Object,default(){}},show:{type:Boolean,default:!1},currentMemberPoints:{type:Number,default:0},currentTotalPrice:{type:Number,default:0}},emits:["confirm","close"],setup(P,{emit:y}){const x=P;console.log("props.currentTotalPrice",x.currentTotalPrice);const I=e({currentMemberPoints:parseFloat(x.currentMemberPoints),currentTotalPrice:parseFloat(x.currentTotalPrice),points:0,disabled:!1}),w=s((()=>(console.log("state.currentTotalPrice",parseInt(I.currentTotalPrice-1)),I.currentTotalPrice?parseInt(I.currentTotalPrice-1):I.currentTotalPrice)));t((()=>{I.points>I.currentMemberPoints&&o((()=>{I.points=I.currentMemberPoints})),console.log(I.points>w.value),I.points>w.value&&(console.log("newValue",I.points),console.log("state.currentTotalPrice",w.value),o((()=>{I.points=w.value}))),(0==w.value||w.value<0)&&(I.disabled=!0)}));const h=()=>{y("confirm",I.points)};return(e,s)=>{const t=p,o=m,x=b,v=_,g=r(a("su-popup"),j);return l(),n(g,{show:P.show,type:"bottom",round:"10",onClose:s[2]||(s[2]=e=>y("close")),showClose:"",backgroundColor:"#ffffff"},{default:d((()=>[i(t,{class:"title ss-m-t-16 ss-m-l-20 ss-flex"},{default:d((()=>[c("使用积分")])),_:1}),i(t,{class:"model-box ss-p-x-30"},{default:d((()=>[i(o,{modelValue:I.points,"onUpdate:modelValue":s[0]||(s[0]=e=>I.points=e),modelModifiers:{number:!0},class:"uni-input input-points ss-m-b-10",type:"number",placeholder:"请输入抵扣积分",oninput:"this.value=this.value.replace(/\\D/g);",disabled:I.disabled},null,8,["modelValue","disabled"]),c(" "+u(P.currentTotalPrice),1)])),_:1}),i(t,{class:"modal-footer text-center"},{default:d((()=>[i(t,{class:"subtitle text-disabled"},{default:d((()=>[c("您的可用积分"),i(x,{class:"text-red"},{default:d((()=>[c(u(P.currentMemberPoints),1)])),_:1})])),_:1}),i(t,{class:"subtitle text-disabled"},{default:d((()=>[c("当前订单价格"),i(x,{class:"text-red"},{default:d((()=>[c("¥"+u(I.currentTotalPrice),1)])),_:1}),c(",可使用的最高积分 "),i(x,{class:"text-red"},{default:d((()=>[c(u(f(w)),1)])),_:1})])),_:1}),i(t,{class:"ss-flex ss-m-y-20 ss-col-center"},{default:d((()=>[i(v,{class:"confirm-btn ss-reset-button",onClick:s[1]||(s[1]=e=>{I.points=0,y("confirm",I.points)})},{default:d((()=>[c("取消")])),_:1}),i(v,{class:"confirm-btn ss-reset-button",onClick:h},{default:d((()=>[c("确认")])),_:1})])),_:1})])),_:1})])),_:1},8,["show"])}}},[["__scopeId","data-v-fef5c710"]]),B=C({__name:"confirm",setup(t){const o=e({orderPayload:{},orderInfo:{items:[],price:{}},addressInfo:{},showPoints:!1,couponInfo:[],showDiscount:!1,currentMemberPoints:0,usedPoint:0,currentTotalPrice:0}),m=s((()=>{const e={};return Object.keys(o.orderInfo.shopRespVOMap).forEach((s=>{const t=o.orderInfo.shopNameMap[s];t&&(e[t]=o.orderInfo.shopRespVOMap[s],e[t].remark="",e[t].shopId=s)})),e})),j=s((()=>{let e=0;return Object.values(m.value).forEach((s=>{s.items.forEach((s=>{e+=s.count}))})),e}));function C(){g("SELECT_ADDRESS",(e=>{!async function(e={}){T.isEmpty(e)||(o.addressInfo=e);await U()}(e.addressInfo)})),y.$router.go("/pages/user/address/list")}async function B(e){null==e&&(e=0);const s=o.currentTotalPrice;o.orderInfo.price.payPrice=100*(s-e),o.usedPoint=e,o.showPoints=!1}function D(){o.addressInfo.id?async function(){const e=m.value,s={};Object.keys(e).forEach((t=>{const o=e[t];s[o.shopId]=o.remark}));const{code:t,data:r}=await x.createOrder({items:o.orderPayload.items,couponId:o.orderPayload.couponId,addressId:o.addressInfo.id,deliveryType:1,pointStatus:!1,combinationActivityId:o.orderPayload.combinationActivityId,combinationHeadId:o.orderPayload.combinationHeadId,seckillActivityId:o.orderPayload.seckillActivityId,payIntegral:o.usedPoint,shopRemarks:s});if(0!==t)return;o.orderPayload.items[0].cartId>0&&y.$store("cart").getList();y.$router.redirect("/pages/pay/index",{id:r.payOrderId})}():y.$helper.toast("请选择收货地址")}async function U(){const{data:e,code:s}=await x.settlementOrder({items:o.orderPayload.items,couponId:o.orderPayload.couponId,addressId:o.addressInfo.id,deliveryType:1,pointStatus:!1,combinationActivityId:o.orderPayload.combinationActivityId,combinationHeadId:o.orderPayload.combinationHeadId,seckillActivityId:o.orderPayload.seckillActivityId,usedPoint:o.usedPoint});0===s&&(o.orderInfo=e,o.orderInfo.address&&(o.addressInfo=o.orderInfo.address),o.currentMemberPoints=E(o.orderInfo.currentQuota),o.currentTotalPrice=S(o.orderInfo.price.payPrice))}return P((async e=>{e.data?(o.orderPayload=JSON.parse(e.data),await U()):y.$helper.toast("参数不正确,请检查!")})),(e,s)=>{const t=b,P=p,y=r(a("s-address-item"),k),x=r(a("s-goods-item"),M),g=r(a("uni-easyinput"),V),T=r(a("s-points-pop"),N),E=_,U=r(a("su-fixed"),O),$=r(a("s-layout"),A);return l(),n($,{title:"确认订单"},{default:d((()=>[i(P,{class:"bg-white address-box ss-m-b-14 ss-r-b-10",onClick:C},{default:d((()=>[i(y,{item:o.addressInfo,hasBorderBottom:!1},{default:d((()=>[i(P,{class:"ss-rest-button"},{default:d((()=>[i(t,{class:"_icon-forward"})])),_:1})])),_:1},8,["item"])])),_:1}),(l(!0),I(h,null,w(f(m),((e,s)=>(l(),n(P,{class:"order-card-box ss-m-b-14",key:s},{default:d((()=>[i(P,{class:"title-text ss-p-x-20 ss-p-t-20"},{default:d((()=>[c(u(s),1)])),_:2},1024),(l(!0),I(h,null,w(e.items,(e=>(l(),n(x,{key:null==e?void 0:e.skuId,img:null==e?void 0:e.picUrl,title:null==e?void 0:e.spuName,skuText:null==e?void 0:e.properties.map((e=>e.valueName)).join(" "),price:null==e?void 0:e.price,num:null==e?void 0:e.count},null,8,["img","title","skuText","price","num"])))),128)),i(P,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:d((()=>[i(P,{class:"item-title"},{default:d((()=>[c("运费")])),_:1}),i(P,{class:"ss-flex ss-col-center"},{default:d((()=>[c(u(e.price.deliveryPrice?"¥"+f(S)(e.price.deliveryPrice):"包邮"),1)])),_:2},1024)])),_:2},1024),i(P,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:d((()=>[i(P,{class:"item-title"},{default:d((()=>[c("订单备注")])),_:1}),i(P,{class:"ss-flex ss-col-center"},{default:d((()=>[i(g,{maxlength:"20",placeholder:"建议留言前先与商家沟通",modelValue:e.remark,"onUpdate:modelValue":s=>e.remark=s,inputBorder:!1,clearable:!1},null,8,["modelValue","onUpdate:modelValue"])])),_:2},1024)])),_:2},1024),i(P,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:d((()=>[i(P,{class:"item-title"},{default:d((()=>[c("总价")])),_:1}),i(P,{class:"ss-flex ss-col-center"},{default:d((()=>[c(u("¥"+f(S)(e.price.payPrice)),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128)),i(P,{class:"bg-white total-card-box ss-p-20 ss-m-b-14 ss-r-10"},{default:d((()=>[i(P,{class:"title-text"},{default:d((()=>[c(" 价格明细 ")])),_:1}),i(P,{class:"total-box-content border-bottom"},{default:d((()=>[i(P,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:d((()=>[i(P,{class:"item-title"},{default:d((()=>[c("商品总价 共"+u(f(j))+"件商品",1)])),_:1}),i(P,{class:"ss-flex ss-col-center"},{default:d((()=>[i(t,{class:"item-value ss-m-r-24"},{default:d((()=>[c(" ¥"+u(f(S)(o.orderInfo.price.totalPrice)),1)])),_:1})])),_:1})])),_:1}),i(P,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:d((()=>[i(P,{class:"item-title"},{default:d((()=>[c("运费")])),_:1}),i(P,{class:"ss-flex ss-col-center"},{default:d((()=>[i(t,{class:"item-value ss-m-r-24"},{default:d((()=>[c(" ¥"+u(f(S)(o.orderInfo.price.deliveryPrice)),1)])),_:1})])),_:1})])),_:1}),i(P,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:d((()=>[i(P,{class:"item-title"},{default:d((()=>[c("积分抵扣")])),_:1}),i(P,{class:"ss-flex ss-col-center",onClick:s[0]||(s[0]=e=>o.showPoints=!0)},{default:d((()=>[i(t,{class:v(["item-value",o.usedPoint>0?"text-red":"text-disabled"])},{default:d((()=>[c(u(o.usedPoint>0?" 可抵扣"+o.usedPoint+"元":"不使用积分"),1)])),_:1},8,["class"]),i(t,{class:"_icon-forward item-icon"})])),_:1})])),_:1})])),_:1}),i(P,{class:"total-box-footer ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28"},{default:d((()=>[i(P,{class:"total-num ss-m-r-20"},{default:d((()=>[c(" 共"+u(f(j))+"件 ",1)])),_:1}),i(P,null,{default:d((()=>[c("合计:")])),_:1}),i(P,{class:"total-num text-red"},{default:d((()=>[c(" ¥"+u(f(S)(o.orderInfo.price.payPrice)),1)])),_:1})])),_:1})])),_:1}),c(u(o.currentTotalPrice)+" ",1),i(T,{modelValue:o.couponInfo,"onUpdate:modelValue":s[1]||(s[1]=e=>o.couponInfo=e),currentMemberPoints:o.currentMemberPoints,currentTotalPrice:o.currentTotalPrice,show:o.showPoints,onConfirm:B,onClose:s[2]||(s[2]=e=>o.showPoints=!1)},null,8,["modelValue","currentMemberPoints","currentTotalPrice","show"]),i(U,{bottom:"",opacity:!1,bg:"bg-white",placeholder:"",noFixed:!1,index:200},{default:d((()=>[i(P,{class:"footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center"},{default:d((()=>[i(P,{class:"total-box-footer ss-flex ss-col-center"},{default:d((()=>[i(P,{class:"total-num ss-font-30 text-red"},{default:d((()=>[c(" ¥"+u(f(S)(o.orderInfo.price.payPrice)),1)])),_:1})])),_:1}),i(E,{class:"ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main",onClick:D},{default:d((()=>[c(" 提交订单 ")])),_:1})])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-06adbf32"]]);export{B as default};