pages-order-confirm.cbebfeba.js 8.7 KB

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