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 i,j as d,p as c,t as u,u as f,i as m,ae as p,D as b,o as _,s as P,ab as y,k as I,r as x,F as w,z as h,g as v,af as g,a2 as k,C as T}from"./index-cf994c58.js";import{_ as M}from"./s-address-item.fdf96e4d.js";import{_ as V}from"./s-goods-item.822976f7.js";import{d as j,_ as C}from"./form.4667cac6.js";import{_ as A}from"./_plugin-vue_export-helper.1b428a4d.js";import{a as O,_ as S}from"./s-layout.bdc4f6eb.js";import{p as E,f as N}from"./useGoods.a949deab.js";/* empty css */const B=A({__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(_,{emit:P}){const y=_,I=e({currentMemberPoints:parseFloat(y.currentMemberPoints),currentTotalPrice:parseFloat(y.currentTotalPrice),points:0,disabled:!1}),x=s((()=>parseInt(I.currentTotalPrice-1)));t((()=>{I.points>I.currentMemberPoints&&(I.points=I.currentMemberPoints,o((()=>{I.points=I.currentMemberPoints}))),I.points>I.currentTotalPrice&&(console.log("newValue",I.points),console.log("state.currentTotalPrice",I.currentTotalPrice),I.points=I.currentTotalPrice,o((()=>{I.points=x.value}))),0==x.value&&(I.disabled=!0)}));const w=()=>{P("confirm",I.points)};return(e,s)=>{const t=m,o=p,y=b,h=r(a("su-popup"),j);return l(),n(h,{show:_.show,type:"bottom",round:"10",onClose:s[2]||(s[2]=e=>P("close")),showClose:"",backgroundColor:"#ffffff"},{default:i((()=>[d(t,{class:"title ss-m-t-16 ss-m-l-20 ss-flex"},{default:i((()=>[c("使用积分")])),_:1}),d(t,{class:"model-box ss-p-x-30"},{default:i((()=>[d(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"]),d(t,{class:"subtitle"},{default:i((()=>[c("您的可用积分 "+u(_.currentMemberPoints),1)])),_:1}),d(t,{class:"subtitle"},{default:i((()=>[c("当前订单价格¥"+u(I.currentTotalPrice)+",可使用的最高积分 "+u(f(x)),1)])),_:1})])),_:1}),d(t,{class:"modal-footer ss-flex"},{default:i((()=>[d(y,{class:"confirm-btn ss-reset-button",onClick:s[1]||(s[1]=e=>{I.points=0,P("confirm",I.points)})},{default:i((()=>[c("取消")])),_:1}),d(y,{class:"confirm-btn ss-reset-button",onClick:w},{default:i((()=>[c("确认")])),_:1})])),_:1})])),_:1},8,["show"])}}},[["__scopeId","data-v-0e780bd3"]]),D=A({__name:"confirm",setup(t){const o=e({orderPayload:{},orderInfo:{items:[],price:{}},addressInfo:{},showPoints:!1,couponInfo:[],showDiscount:!1,currentMemberPoints:0,usedPoint:0,currentTotalPrice:0}),p=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}));function j(){g("SELECT_ADDRESS",(e=>{!async function(e={}){k.isEmpty(e)||(o.addressInfo=e);await U()}(e.addressInfo)})),P.$router.go("/pages/user/address/list")}async function A(e){console.log(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=p.value,s=[];Object.keys(e).forEach((t=>{const o=e[t];console.log(t),s.push({[t]:o.remark})}));const{code:t,data:r}=await y.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,usedPoint:o.usedPoint,remarkList:s});if(0!==t)return;o.orderPayload.items[0].cartId>0&&P.$store("cart").getList();P.$router.redirect("/pages/pay/index",{id:r.payOrderId})}():P.$helper.toast("请选择收货地址")}async function U(){const{data:e,code:s}=await y.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.currentMemberPoints),o.currentTotalPrice=N(o.orderInfo.price.payPrice))}return _((async e=>{e.data?(o.orderPayload=JSON.parse(e.data),await U()):P.$helper.toast("参数不正确,请检查!")})),(e,s)=>{const t=T,_=m,P=r(a("s-address-item"),M),y=r(a("s-goods-item"),V),g=r(a("uni-easyinput"),C),k=r(a("s-points-pop"),B),E=b,U=r(a("su-fixed"),O),$=r(a("s-layout"),S);return l(),n($,{title:"确认订单"},{default:i((()=>[d(_,{class:"bg-white address-box ss-m-b-14 ss-r-b-10",onClick:j},{default:i((()=>[d(P,{item:o.addressInfo,hasBorderBottom:!1},{default:i((()=>[d(_,{class:"ss-rest-button"},{default:i((()=>[d(t,{class:"_icon-forward"})])),_:1})])),_:1},8,["item"])])),_:1}),(l(!0),I(w,null,x(f(p),((e,s)=>(l(),n(_,{class:"order-card-box ss-m-b-14",key:s},{default:i((()=>[d(_,{class:"title-text ss-p-x-20 ss-p-t-20"},{default:i((()=>[c(u(s),1)])),_:2},1024),(l(!0),I(w,null,x(e.items,(e=>(l(),n(y,{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)),d(_,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:i((()=>[d(_,{class:"item-title"},{default:i((()=>[c("运费")])),_:1}),d(_,{class:"ss-flex ss-col-center"},{default:i((()=>[c(u(e.price.deliveryPrice?"¥"+f(N)(e.price.deliveryPrice):"包邮"),1)])),_:2},1024)])),_:2},1024),d(_,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:i((()=>[d(_,{class:"item-title"},{default:i((()=>[c("订单备注")])),_:1}),d(_,{class:"ss-flex ss-col-center"},{default:i((()=>[d(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),d(_,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:i((()=>[d(_,{class:"item-title"},{default:i((()=>[c("总价")])),_:1}),d(_,{class:"ss-flex ss-col-center"},{default:i((()=>[c(u("¥"+f(N)(e.price.payPrice)),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128)),d(_,{class:"bg-white total-card-box ss-p-20 ss-m-b-14 ss-r-10"},{default:i((()=>[d(_,{class:"title-text"},{default:i((()=>[c(" 价格明细 ")])),_:1}),d(_,{class:"total-box-content border-bottom"},{default:i((()=>[d(_,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:i((()=>[d(_,{class:"item-title"},{default:i((()=>[c("商品总价 共"+u(o.orderInfo.items.length)+"件商品",1)])),_:1}),d(_,{class:"ss-flex ss-col-center"},{default:i((()=>[d(t,{class:"item-value ss-m-r-24"},{default:i((()=>[c(" ¥"+u(f(N)(o.orderInfo.price.totalPrice)),1)])),_:1})])),_:1})])),_:1}),d(_,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:i((()=>[d(_,{class:"item-title"},{default:i((()=>[c("运费")])),_:1}),d(_,{class:"ss-flex ss-col-center"},{default:i((()=>[d(t,{class:"item-value ss-m-r-24"},{default:i((()=>[c(" ¥"+u(f(N)(o.orderInfo.price.deliveryPrice)),1)])),_:1})])),_:1})])),_:1}),0===o.orderInfo.type?(l(),n(_,{key:0,class:"order-item ss-flex ss-col-center ss-row-between"},{default:i((()=>[d(_,{class:"item-title"},{default:i((()=>[c("积分抵扣")])),_:1}),d(_,{class:"ss-flex ss-col-center",onClick:s[0]||(s[0]=e=>o.showPoints=!0)},{default:i((()=>[d(t,{class:h(["item-value",o.usedPoint>0?"text-red":"text-disabled"])},{default:i((()=>[c(u(o.usedPoint>0?" 可抵扣"+o.usedPoint+"元":"不使用积分"),1)])),_:1},8,["class"]),d(t,{class:"_icon-forward item-icon"})])),_:1})])),_:1})):v("",!0)])),_:1}),d(_,{class:"total-box-footer ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28"},{default:i((()=>[d(_,{class:"total-num ss-m-r-20"},{default:i((()=>[c(" 共"+u(o.orderInfo.items.reduce(((e,s)=>e+s.count),0))+"件 ",1)])),_:1}),d(_,null,{default:i((()=>[c("合计:")])),_:1}),d(_,{class:"total-num text-red"},{default:i((()=>[c(" ¥"+u(f(N)(o.orderInfo.price.payPrice)),1)])),_:1})])),_:1})])),_:1}),d(k,{modelValue:o.couponInfo,"onUpdate:modelValue":s[1]||(s[1]=e=>o.couponInfo=e),currentMemberPoints:o.currentMemberPoints,currentTotalPrice:o.currentTotalPrice,show:o.showPoints,onConfirm:A,onClose:s[2]||(s[2]=e=>o.showPoints=!1)},null,8,["modelValue","currentMemberPoints","currentTotalPrice","show"]),d(U,{bottom:"",opacity:!1,bg:"bg-white",placeholder:"",noFixed:!1,index:200},{default:i((()=>[d(_,{class:"footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center"},{default:i((()=>[d(_,{class:"total-box-footer ss-flex ss-col-center"},{default:i((()=>[d(_,{class:"total-num ss-font-30 text-red"},{default:i((()=>[c(" ¥"+u(f(N)(o.orderInfo.price.payPrice)),1)])),_:1})])),_:1}),d(E,{class:"ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main",onClick:D},{default:i((()=>[c(" 提交订单 ")])),_:1})])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-c54f5a80"]]);export{D as default};
|