1 |
- import{z as e,c as s,al as t,a2 as o,m as r,n as a,f as l,g as i,w as n,k as d,u,v as c,j as p,a3 as f,I as m,J as y,o as P,s as b,aj as _,l as h,r as v,F as x,x as w,E as I,i as k,am as g,a6 as C,y as T}from"./index-a116b7fa.js";import{_ as M}from"./s-address-item.30defc6a.js";import{_ as j}from"./s-goods-item.e5b69bb0.js";import{_ as F,a as V}from"./phone-international-input.b9f6c8e6.js";import{_ as D}from"./_plugin-vue_export-helper.1b428a4d.js";import{a as O,_ as $}from"./s-layout.4ae51839.js";import{_ as E}from"./points.c381a8e1.js";import{p as A,f as N,a as S}from"./useGoods.6b315a78.js";/* empty css */const B=D({__name:"s-points-pop",props:{modelValue:{type:Object,default(){}},show:{type:Boolean,default:!1},currentMemberPoints:{type:Number,default:0},currentTotalPrice:{type:Number,default:0},currentDeliveryPrice:{type:Number,default:0}},emits:["confirm","close"],setup(P,{emit:b}){const _=P,h=b,v=e({points:0,disabled:!1}),x=s((()=>parseFloat(_.currentMemberPoints))),w=s((()=>parseFloat(_.currentTotalPrice))),I=s((()=>parseFloat(_.currentDeliveryPrice))),k=s((()=>w.value?(w.value-I.value).toFixed(2):w.value));t((()=>{const e=v.points.toString(),[s,t]=e.split(".");if(t){const e=parseFloat(`${s}.${t.slice(0,2)}`);o((()=>{v.points=e}))}v.points>x.value&&o((()=>{v.points=x.value})),v.points>k.value&&o((()=>{v.points=k.value})),(0==k.value||k.value<0)&&(v.disabled=!0),k.value>0&&(v.disabled=!1)}));const g=()=>{""===v.points&&(v.points=0),h("confirm",v.points)};return(e,s)=>{const t=p,o=f,b=m,_=y,x=r(a("su-popup"),F);return l(),i(x,{show:P.show,type:"bottom",round:"10",onClose:s[2]||(s[2]=e=>h("close")),showClose:"",backgroundColor:"#ffffff"},{default:n((()=>[d(t,{class:"title ss-m-t-16 ss-m-l-20 ss-flex"},{default:n((()=>[u("使用佣金")])),_:1}),d(t,{class:"model-box ss-p-x-30"},{default:n((()=>[d(o,{modelValue:v.points,"onUpdate:modelValue":s[0]||(s[0]=e=>v.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:v.disabled},null,8,["modelValue","disabled"])])),_:1}),d(t,{class:"modal-footer text-center"},{default:n((()=>[d(t,{class:"subtitle text-disabled"},{default:n((()=>[u("您的可用佣金"),d(b,{class:"text-red"},{default:n((()=>[u(c(P.currentMemberPoints),1)])),_:1})])),_:1}),d(t,{class:"subtitle text-disabled"},{default:n((()=>[u("当前订单价格"),d(b,{class:"text-red"},{default:n((()=>[u("¥"+c(w.value),1)])),_:1}),u(",可使用最高"),d(b,{class:"text-red"},{default:n((()=>[u(c(k.value),1)])),_:1}),u("佣金 ")])),_:1}),d(t,{class:"ss-flex ss-m-y-20 ss-col-center"},{default:n((()=>[d(_,{class:"confirm-btn ss-reset-button",onClick:s[1]||(s[1]=e=>{v.points=0,h("confirm",v.points)})},{default:n((()=>[u("取消")])),_:1}),d(_,{class:"confirm-btn ss-reset-button",onClick:g},{default:n((()=>[u("确认")])),_:1})])),_:1})])),_:1})])),_:1},8,["show"])}}},[["__scopeId","data-v-48558da0"]]),U=D({__name:"s-consumptionPoints-pop",props:{modelValue:{type:Object,default(){}},show:{type:Boolean,default:!1},currentMemberConsumptionPoints:{type:Number,default:0},currentTotalPrice:{type:Number,default:0},currentDeliveryPrice:{type:Number,default:0}},emits:["confirm","close"],setup(P,{emit:b}){const _=P,h=b,v=e({points:0,disabled:!1}),x=s((()=>parseFloat(_.currentMemberConsumptionPoints))),w=s((()=>parseFloat(_.currentTotalPrice))),I=s((()=>parseFloat(_.currentDeliveryPrice))),k=s((()=>w.value?(w.value-I.value).toFixed(2):w.value));t((()=>{const e=v.points.toString(),[s,t]=e.split(".");if(t){const e=parseFloat(`${s}.${t.slice(0,2)}`);o((()=>{v.points=e}))}v.points>x.value&&o((()=>{v.points=x.value})),v.points>k.value&&o((()=>{v.points=k.value})),(0==k.value||k.value<0)&&(v.disabled=!0),k.value>0&&(v.disabled=!1)}));const g=()=>{""===v.points&&(v.points=0),h("confirm",v.points)};return(e,s)=>{const t=p,o=f,b=m,_=y,x=r(a("su-popup"),F);return l(),i(x,{show:P.show,type:"bottom",round:"10",onClose:s[2]||(s[2]=e=>h("close")),showClose:"",backgroundColor:"#ffffff"},{default:n((()=>[d(t,{class:"title ss-m-t-16 ss-m-l-20 ss-flex"},{default:n((()=>[u("使用消费分")])),_:1}),d(t,{class:"model-box ss-p-x-30"},{default:n((()=>[d(o,{modelValue:v.points,"onUpdate:modelValue":s[0]||(s[0]=e=>v.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:v.disabled},null,8,["modelValue","disabled"])])),_:1}),d(t,{class:"modal-footer text-center"},{default:n((()=>[d(t,{class:"subtitle text-disabled"},{default:n((()=>[u("您的可用消费分"),d(b,{class:"text-red"},{default:n((()=>[u(c(P.currentMemberConsumptionPoints),1)])),_:1})])),_:1}),d(t,{class:"subtitle text-disabled"},{default:n((()=>[u("当前订单价格"),d(b,{class:"text-red"},{default:n((()=>[u("¥"+c(w.value),1)])),_:1}),u(",可使用最高"),d(b,{class:"text-red"},{default:n((()=>[u(c(k.value),1)])),_:1}),u("消费分 ")])),_:1}),d(t,{class:"ss-flex ss-m-y-20 ss-col-center"},{default:n((()=>[d(_,{class:"confirm-btn ss-reset-button",onClick:s[1]||(s[1]=e=>{v.points=0,h("confirm",v.points)})},{default:n((()=>[u("取消")])),_:1}),d(_,{class:"confirm-btn ss-reset-button",onClick:g},{default:n((()=>[u("确认")])),_:1})])),_:1})])),_:1})])),_:1},8,["show"])}}},[["__scopeId","data-v-c9479401"]]),H=D({__name:"confirm",setup(t){const o=e({orderPayload:{},orderInfo:{items:[],price:{}},addressInfo:{},showPoints:!1,showConsumptionPoints:!1,couponInfo:[],showDiscount:!1,currentMemberPoints:0,currentMemberConsumptionPoints:0,usedPoint:0,usedConsumptionPoints:0,currentTotalPrice:0,currentDeliveryPrice:0}),f=s((()=>{const e={};try{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)}))}catch(s){}return e})),F=s((()=>{let e=0;return Object.values(f.value).forEach((s=>{s.items.forEach((s=>{e+=s.count}))})),e}));function D(){g("SELECT_ADDRESS",(e=>{!async function(e={}){C.isEmpty(e)||(o.addressInfo=e);await J()}(e.addressInfo)})),o.orderPayload.spuType?b.$router.go("/pages/user/address/list"):b.$router.go("/pages/user/dummyAddress/list")}async function H(e){null==e&&(e=0);const s=o.currentTotalPrice;o.orderInfo.price.payPrice=100*(s-e),o.usedPoint=e,o.usedConsumptionPoints=0,o.showPoints=!1}function R(e){null==e&&(e=0);const s=o.currentTotalPrice;o.orderInfo.price.payPrice=100*(s-e),o.usedConsumptionPoints=e,o.usedPoint=0,o.showConsumptionPoints=!1}function G(){o.addressInfo.id?parseFloat(o.usedPoint)&&parseFloat(o.usedPoint)>parseFloat(o.currentMemberPoints)?b.$helper.toast("可用佣金不足"):parseFloat(o.usedConsumptionPoints)&&parseFloat(o.usedConsumptionPoints)>parseFloat(o.currentMemberConsumptionPoints)?b.$helper.toast("可用消费分不足"):parseFloat(o.usedPoint)&&parseFloat(o.usedConsumptionPoints)?b.$helper.toast("佣金不能搭配消费分使用"):async function(){const e=f.value,s={};Object.keys(e).forEach((t=>{const o=e[t];s[o.shopId]=o.remark}));const t=o.orderPayload.highPrecision?function(e,s){let t=Math.pow(10,s);return(Math.floor(e*t)/t).toFixed(s)}(o.orderInfo.price.virtualPayPrice/100,2):o.usedPoint,{code:r,data:a}=await _.createOrder({items:o.orderPayload.items,couponId:o.orderPayload.couponId,addressId:o.addressInfo.id,deliveryType:1==o.orderPayload.spuType?1:3,pointStatus:!1,combinationActivityId:o.orderPayload.combinationActivityId,combinationHeadId:o.orderPayload.combinationHeadId,seckillActivityId:o.orderPayload.seckillActivityId,payIntegral:t,payConsumptionPoints:o.usedConsumptionPoints,shopRemarks:s});if(0!==r)return;o.orderPayload.items[0].cartId>0&&b.$store("cart").getList();b.$router.redirect("/pages/pay/index",{id:a.payOrderId,type:1})}():b.$helper.toast("请选择收货地址")}async function J(){const e=f.value;let s={};0!==Object.keys(e).length&&Object.keys(e).forEach((t=>{const o=e[t];s[t]=o.remark}));const{data:t,code:r}=await _.settlementOrder({items:o.orderPayload.items,couponId:o.orderPayload.couponId,addressId:o.addressInfo.id,deliveryType:1==o.orderPayload.spuType?1:3,pointStatus:!1,combinationActivityId:o.orderPayload.combinationActivityId,combinationHeadId:o.orderPayload.combinationHeadId,seckillActivityId:o.orderPayload.seckillActivityId,usedPoint:o.usedPoint,addressType:1==o.orderPayload.spuType?1:2});0===r&&(o.orderInfo=t,0!==Object.keys(s).length&&Object.keys(s).forEach((e=>{f.value[e].remark=s[e]})),o.orderInfo.address&&(o.addressInfo=o.orderInfo.address),o.currentMemberPoints=o.orderInfo.currentQuota>0?A(o.orderInfo.currentQuota):0,o.currentMemberConsumptionPoints=o.orderInfo.consumePoints>0?A(o.orderInfo.consumePoints):0,o.currentTotalPrice=N(o.orderInfo.price.payPrice),o.currentDeliveryPrice=N(o.orderInfo.price.deliveryPrice),2==o.orderPayload.spuPayType&&(o.usedPoint=o.currentTotalPrice-.01))}return P((async e=>{e.data?(o.orderPayload=JSON.parse(e.data),await J()):b.$helper.toast("参数不正确,请检查!")})),(e,s)=>{const t=m,P=p,b=r(a("s-address-item"),M),_=r(a("s-goods-item"),j),g=r(a("uni-easyinput"),V),C=T,A=r(a("s-points-pop"),B),J=r(a("s-consumptionPoints-pop"),U),L=y,Q=r(a("su-fixed"),O),z=r(a("s-layout"),$);return l(),i(z,{title:"确认订单"},{default:n((()=>[d(P,{class:"bg-white address-box ss-m-b-14 ss-r-b-10",onClick:D},{default:n((()=>[d(b,{item:o.addressInfo,spuType:o.orderPayload.spuType,hasBorderBottom:!1},{default:n((()=>[d(P,{class:"ss-rest-button"},{default:n((()=>[d(t,{class:"_icon-forward"})])),_:1})])),_:1},8,["item","spuType"])])),_:1}),(l(!0),h(x,null,v(f.value,((e,s)=>(l(),i(P,{class:"order-card-box ss-m-b-14",key:s},{default:n((()=>[d(P,{class:"title-text ss-p-x-20 ss-p-t-20"},{default:n((()=>[u(c(s),1)])),_:2},1024),(l(!0),h(x,null,v(e.items,(e=>{var s;return l(),i(_,{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,virtualPirce:!!e.highPrecisionPrice},null,8,["img","title","skuText","price","num","virtualPirce"])})),128)),d(P,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[d(P,{class:"item-title"},{default:n((()=>[u("运费")])),_:1}),d(P,{class:"ss-flex ss-col-center"},{default:n((()=>[u(c(e.price.deliveryPrice?"¥"+w(N)(e.price.deliveryPrice):"包邮"),1)])),_:2},1024)])),_:2},1024),d(P,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[d(P,{class:"item-title"},{default:n((()=>[u("订单备注")])),_:1}),d(P,{class:"ss-flex ss-col-center"},{default:n((()=>[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),0==o.orderPayload.spuType?(l(),i(P,{key:0,class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[d(P,{class:"item-title"},{default:n((()=>[u("数量")])),_:1}),d(P,{class:"ss-flex ss-col-center"},{default:n((()=>[u(c(F.value),1)])),_:1})])),_:1})):(l(),i(P,{key:1,class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:n((()=>[d(P,{class:"item-title"},{default:n((()=>[u("总价")])),_:1}),d(P,{class:"ss-flex ss-col-center"},{default:n((()=>[2==o.orderPayload.spuPayType?(l(),i(C,{key:0,src:E,style:{width:"30rpx",height:"30rpx"}})):(l(),i(t,{key:1},{default:n((()=>[u("¥")])),_:1})),u(" "+c(w(N)(e.price.payPrice)),1)])),_:2},1024)])),_:2},1024))])),_:2},1024)))),128)),d(P,{class:"bg-white total-card-box ss-p-20 ss-m-b-14 ss-r-10"},{default:n((()=>[d(P,{class:"title-text"},{default:n((()=>[u(" 价格明细 ")])),_:1}),d(P,{class:"total-box-content border-bottom"},{default:n((()=>[d(P,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:n((()=>[d(P,{class:"item-title"},{default:n((()=>[u("商品总价 共"+c(F.value)+"件商品",1)])),_:1}),d(P,{class:"ss-flex ss-col-center"},{default:n((()=>[d(t,{class:"item-value ss-m-r-24"},{default:n((()=>[2==o.orderPayload.spuPayType?(l(),i(C,{key:0,src:E,style:{width:"30rpx",height:"30rpx"}})):(l(),i(t,{key:1},{default:n((()=>[u("¥")])),_:1})),o.orderPayload.highPrecision?(l(),i(t,{key:2},{default:n((()=>[u(c(w(S)(o.orderInfo.price.virtualTotalPrice)),1)])),_:1})):(l(),i(t,{key:3},{default:n((()=>[u(c(w(N)(o.orderInfo.price.totalPrice)),1)])),_:1}))])),_:1})])),_:1})])),_:1}),d(P,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:n((()=>[d(P,{class:"item-title"},{default:n((()=>[u("运费")])),_:1}),d(P,{class:"ss-flex ss-col-center"},{default:n((()=>[d(t,{class:"item-value ss-m-r-24"},{default:n((()=>[2==o.orderPayload.spuPayType?(l(),i(C,{key:0,src:E,style:{width:"30rpx",height:"30rpx"}})):(l(),i(t,{key:1},{default:n((()=>[u("¥")])),_:1})),u(" "+c(w(N)(o.orderInfo.price.deliveryPrice)),1)])),_:1})])),_:1})])),_:1}),2!=o.orderPayload.spuPayType?(l(),i(P,{key:0,class:"order-item ss-flex ss-col-center ss-row-between"},{default:n((()=>[d(P,{class:"item-title"},{default:n((()=>[u("佣金抵扣")])),_:1}),d(P,{class:"ss-flex ss-col-center",onClick:s[0]||(s[0]=e=>o.showPoints=!0)},{default:n((()=>[d(t,{class:I(["item-value",o.usedPoint>0?"text-red":"text-disabled"])},{default:n((()=>[u(c(o.usedPoint>0?" 抵扣"+o.usedPoint+"元":"不使用佣金"),1)])),_:1},8,["class"]),d(t,{class:"_icon-forward item-icon"})])),_:1})])),_:1})):k("",!0),2!=o.orderPayload.spuPayType?(l(),i(P,{key:1,class:"order-item ss-flex ss-col-center ss-row-between"},{default:n((()=>[d(P,{class:"item-title"},{default:n((()=>[u("消费分抵扣")])),_:1}),d(P,{class:"ss-flex ss-col-center",onClick:s[1]||(s[1]=e=>o.showConsumptionPoints=!0)},{default:n((()=>[d(t,{class:I(["item-value",o.usedConsumptionPoints>0?"text-red":"text-disabled"])},{default:n((()=>[u(c(o.usedConsumptionPoints>0?" 抵扣"+o.usedConsumptionPoints+"元":"不使用消费分"),1)])),_:1},8,["class"]),d(t,{class:"_icon-forward item-icon"})])),_:1})])),_:1})):k("",!0)])),_:1}),d(P,{class:"total-box-footer ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28"},{default:n((()=>[d(P,{class:"total-num ss-m-r-20"},{default:n((()=>[u(" 共"+c(F.value)+"件 ",1)])),_:1}),d(P,null,{default:n((()=>[u("合计:")])),_:1}),d(P,{class:"total-num text-red ss-flex"},{default:n((()=>[2==o.orderPayload.spuPayType?(l(),i(C,{key:0,src:E,class:"ss-m-r-10",style:{width:"30rpx",height:"30rpx"}})):(l(),i(t,{key:1},{default:n((()=>[u("¥")])),_:1})),o.orderPayload.highPrecision?(l(),i(t,{key:2},{default:n((()=>[u(c(w(S)(o.orderInfo.price.virtualTotalPrice)),1)])),_:1})):2==o.orderPayload.spuPayType?(l(),i(t,{key:3},{default:n((()=>[u(c(w(N)(o.orderInfo.price.payPrice)-.01),1)])),_:1})):(l(),i(t,{key:4},{default:n((()=>[u(c(w(N)(o.orderInfo.price.payPrice)),1)])),_:1}))])),_:1})])),_:1})])),_:1}),d(A,{modelValue:o.couponInfo,"onUpdate:modelValue":s[2]||(s[2]=e=>o.couponInfo=e),currentMemberPoints:o.currentMemberPoints,currentTotalPrice:o.currentTotalPrice,currentDeliveryPrice:o.currentDeliveryPrice,show:o.showPoints,onConfirm:H,onClose:s[3]||(s[3]=e=>o.showPoints=!1)},null,8,["modelValue","currentMemberPoints","currentTotalPrice","currentDeliveryPrice","show"]),d(J,{modelValue:o.couponInfo,"onUpdate:modelValue":s[4]||(s[4]=e=>o.couponInfo=e),currentMemberConsumptionPoints:o.currentMemberConsumptionPoints,currentTotalPrice:o.currentTotalPrice,currentDeliveryPrice:o.currentDeliveryPrice,show:o.showConsumptionPoints,onConfirm:R,onClose:s[5]||(s[5]=e=>o.showConsumptionPoints=!1)},null,8,["modelValue","currentMemberConsumptionPoints","currentTotalPrice","currentDeliveryPrice","show"]),d(Q,{bottom:"",opacity:!1,bg:"bg-white",placeholder:"",noFixed:!1,index:200},{default:n((()=>[d(P,{class:"footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center"},{default:n((()=>[d(P,{class:"total-box-footer ss-flex ss-col-center"},{default:n((()=>[o.orderPayload.highPrecision?(l(),i(P,{key:0},{default:n((()=>[2==o.orderPayload.spuPayType?(l(),i(C,{key:0,src:E,style:{width:"30rpx",height:"30rpx"}})):k("",!0),u(" "+c(w(S)(o.orderInfo.price.virtualPayPrice)-.01)+" ¥0.01 ",1)])),_:1})):2==o.orderPayload.spuPayType?(l(),i(P,{key:1,class:"total-num ss-font-30 text-red"},{default:n((()=>[2==o.orderPayload.spuPayType?(l(),i(C,{key:0,src:E,style:{width:"30rpx",height:"30rpx"}})):k("",!0),u(" "+c(o.usedPoint)+" ¥0.01 ",1)])),_:1})):(l(),i(P,{key:2,class:"total-num ss-font-30 text-red"},{default:n((()=>[u(" ¥"+c(w(N)(o.orderInfo.price.payPrice)),1)])),_:1}))])),_:1}),d(L,{class:"ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main",onClick:G},{default:n((()=>[u(" 提交订单 ")])),_:1})])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-d360715a"]]);export{H as default};
|