confirm.js 8.0 KB

1
  1. "use strict";const e=require("../../common/vendor.js"),r=require("../../common/assets.js"),o=require("../../sheep/index.js"),s=require("../../sheep/api/trade/order.js");require("../../sheep/request/index.js");const a=require("../../sheep/hooks/useGoods.js");if(require("../../sheep/url/index.js"),require("../../sheep/store/index.js"),require("../../sheep/store/app.js"),require("../../sheep/api/promotion/diy.js"),require("../../sheep/platform/index.js"),require("../../sheep/platform/provider/wechat/index.js"),require("../../sheep/platform/provider/wechat/miniProgram.js"),require("../../sheep/api/member/auth.js"),require("../../sheep/api/member/social.js"),require("../../sheep/api/member/user.js"),require("../../sheep/platform/provider/apple/index.js"),require("../../sheep/platform/share.js"),require("../../sheep/router/index.js"),require("../../sheep/hooks/useModal.js"),require("../../sheep/helper/index.js"),require("../../sheep/helper/test.js"),require("../../sheep/helper/digit.js"),require("../../sheep/api/member/signin.js"),require("../../sheep/helper/throttle.js"),require("../../sheep/platform/pay.js"),require("../../sheep/api/pay/order.js"),require("../../sheep/store/user.js"),require("../../sheep/store/cart.js"),require("../../sheep/api/trade/cart.js"),require("../../sheep/api/pay/wallet.js"),require("../../sheep/api/promotion/coupon.js"),require("../../sheep/store/sys.js"),require("../../sheep/store/modal.js"),require("../../sheep/config/index.js"),require("../../sheep/config/zIndex.js"),require("../../sheep/util/index.js"),!Array){(e.resolveComponent("s-address-item")+e.resolveComponent("s-goods-item")+e.resolveComponent("uni-easyinput")+e.resolveComponent("s-points-pop")+e.resolveComponent("su-fixed")+e.resolveComponent("s-layout"))()}Math||((()=>"../../sheep/components/s-address-item/s-address-item.js")+(()=>"../../sheep/components/s-goods-item/s-goods-item.js")+(()=>"../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js")+(()=>"../../sheep/components/s-points-pop/s-points-pop.js")+(()=>"../../sheep/ui/su-fixed/su-fixed.js")+(()=>"../../sheep/components/s-layout/s-layout.js"))();const i={__name:"confirm",setup(i){const t=e.reactive({orderPayload:{},orderInfo:{items:[],price:{}},addressInfo:{},showPoints:!1,couponInfo:[],showDiscount:!1,currentMemberPoints:0,usedPoint:0,currentTotalPrice:0,currentDeliveryPrice:0}),d=e.computed((()=>{console.log(t.orderInfo.shopRespVOMap);const e={};try{Object.keys(t.orderInfo.shopRespVOMap).forEach((r=>{const o=t.orderInfo.shopNameMap[r];o&&(e[o]=t.orderInfo.shopRespVOMap[r],e[o].remark="",e[o].shopId=r)}))}catch(r){}return e})),n=e.computed((()=>{let e=0;return Object.values(d.value).forEach((r=>{r.items.forEach((r=>{e+=r.count}))})),e}));function p(){e.index.$once("SELECT_ADDRESS",(r=>{!async function(r={}){e.lodashExports.isEmpty(r)||(t.addressInfo=r);await l()}(r.addressInfo)})),console.log(t.orderPayload.spuType),t.orderPayload.spuType?o.sheep.$router.go("/pages/user/address/list"):o.sheep.$router.go("/pages/user/dummyAddress/list")}async function u(e){null==e&&(e=0);const r=t.currentTotalPrice;t.orderInfo.price.payPrice=100*(r-e),t.usedPoint=e,t.showPoints=!1}function c(){t.addressInfo.id?t.usedPoint>t.currentMemberPoints?o.sheep.$helper.toast("可用积分不足"):async function(){const e=d.value,r={};Object.keys(e).forEach((o=>{const s=e[o];r[s.shopId]=s.remark}));const a=t.orderPayload.highPrecision?function(e,r){let o=Math.pow(10,r);return(Math.floor(e*o)/o).toFixed(r)}(t.orderInfo.price.virtualPayPrice/100,2):t.usedPoint,{code:i,data:n}=await s.OrderApi.createOrder({items:t.orderPayload.items,couponId:t.orderPayload.couponId,addressId:t.addressInfo.id,deliveryType:1==t.orderPayload.spuType?1:3,pointStatus:!1,combinationActivityId:t.orderPayload.combinationActivityId,combinationHeadId:t.orderPayload.combinationHeadId,seckillActivityId:t.orderPayload.seckillActivityId,payIntegral:a,shopRemarks:r});if(0!==i)return;t.orderPayload.items[0].cartId>0&&o.sheep.$store("cart").getList();o.sheep.$router.redirect("/pages/pay/index",{id:n.payOrderId})}():o.sheep.$helper.toast("请选择收货地址")}async function l(){const e=d.value;let r={};0!==Object.keys(e).length&&Object.keys(e).forEach((o=>{const s=e[o];r[o]=s.remark}));const{data:o,code:i}=await s.OrderApi.settlementOrder({items:t.orderPayload.items,couponId:t.orderPayload.couponId,addressId:t.addressInfo.id,deliveryType:1==t.orderPayload.spuType?1:3,pointStatus:!1,combinationActivityId:t.orderPayload.combinationActivityId,combinationHeadId:t.orderPayload.combinationHeadId,seckillActivityId:t.orderPayload.seckillActivityId,usedPoint:t.usedPoint,addressType:1==t.orderPayload.spuType?1:2});0===i&&(t.orderInfo=o,0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{d.value[e].remark=r[e]})),t.orderInfo.address&&(t.addressInfo=t.orderInfo.address),t.currentMemberPoints=a.points2point(t.orderInfo.currentQuota),t.currentTotalPrice=a.fen2yuan(t.orderInfo.price.payPrice),t.currentDeliveryPrice=a.fen2yuan(t.orderInfo.price.deliveryPrice),2==t.orderPayload.spuPayType&&(t.usedPoint=t.currentTotalPrice-.01,console.log(t.spuType)))}return e.onLoad((async e=>{e.data?(t.orderPayload=JSON.parse(e.data),await l()):o.sheep.$helper.toast("参数不正确,请检查!")})),(o,s)=>e.e({a:e.p({item:t.addressInfo,spuType:t.orderPayload.spuType,hasBorderBottom:!1}),b:e.o(p),c:e.f(d.value,((o,s,i)=>e.e({a:e.t(s),b:e.f(o.items,((r,o,s)=>{var a;return{a:null==r?void 0:r.skuId,b:"b8acae45-2-"+i+"-"+s+",b8acae45-0",c:e.p({img:null==r?void 0:r.picUrl,title:null==r?void 0:r.spuName,skuText:null==(a=null==r?void 0:r.properties)?void 0:a.map((e=>e.valueName)).join(" "),price:r.highPrecisionPrice?null==r?void 0:r.highPrecisionPrice:null==r?void 0:r.price,num:null==r?void 0:r.count,virtualPirce:!!r.highPrecisionPrice})}})),c:e.t(o.price.deliveryPrice?"¥"+e.unref(a.fen2yuan)(o.price.deliveryPrice):"包邮"),d:"b8acae45-3-"+i+",b8acae45-0",e:e.o((e=>o.remark=e),s),f:e.p({maxlength:"20",placeholder:"建议留言前先与商家沟通",inputBorder:!1,clearable:!1,modelValue:o.remark})},0==t.orderPayload.spuType?{g:e.t(n.value)}:e.e({h:2==t.orderPayload.spuPayType},2==t.orderPayload.spuPayType?{i:r._imports_0}:{},{j:e.t(e.unref(a.fen2yuan)(o.price.payPrice))}),{k:s}))),d:0==t.orderPayload.spuType,e:e.t(n.value),f:2==t.orderPayload.spuPayType},2==t.orderPayload.spuPayType?{g:r._imports_0}:{},{h:t.orderPayload.highPrecision},t.orderPayload.highPrecision?{i:e.t(e.unref(a.fen2yuan6)(t.orderInfo.price.virtualTotalPrice))}:{j:e.t(e.unref(a.fen2yuan)(t.orderInfo.price.totalPrice))},{k:2==t.orderPayload.spuPayType},2==t.orderPayload.spuPayType?{l:r._imports_0}:{},{m:e.t(e.unref(a.fen2yuan)(t.orderInfo.price.deliveryPrice)),n:2!=t.orderPayload.spuPayType},2!=t.orderPayload.spuPayType?{o:e.t(t.usedPoint>0?" 可抵扣"+t.usedPoint+"元":"不使用积分"),p:e.n(t.usedPoint>0?"text-red":"text-disabled"),q:e.o((e=>t.showPoints=!0))}:{},{r:e.t(n.value),s:2==t.orderPayload.spuPayType},2==t.orderPayload.spuPayType?{t:r._imports_0}:{},{v:t.orderPayload.highPrecision},t.orderPayload.highPrecision?{w:e.t(e.unref(a.fen2yuan6)(t.orderInfo.price.virtualTotalPrice))}:2==t.orderPayload.spuPayType?{y:e.t(e.unref(a.fen2yuan)(t.orderInfo.price.payPrice)-.01)}:{z:e.t(e.unref(a.fen2yuan)(t.orderInfo.price.payPrice))},{x:2==t.orderPayload.spuPayType,A:e.o(u),B:e.o((e=>t.showPoints=!1)),C:e.o((e=>t.couponInfo=e)),D:e.p({currentMemberPoints:t.currentMemberPoints,currentTotalPrice:t.currentTotalPrice,currentDeliveryPrice:t.currentDeliveryPrice,show:t.showPoints,modelValue:t.couponInfo}),E:t.orderPayload.highPrecision},t.orderPayload.highPrecision?e.e({F:2==t.orderPayload.spuPayType},2==t.orderPayload.spuPayType?{G:r._imports_0}:{},{H:e.t(e.unref(a.fen2yuan6)(t.orderInfo.price.virtualPayPrice)-.01)}):2==t.orderPayload.spuPayType?e.e({J:2==t.orderPayload.spuPayType},2==t.orderPayload.spuPayType?{K:r._imports_0}:{},{L:e.t(t.usedPoint)}):{M:e.t(e.unref(a.fen2yuan)(t.orderInfo.price.payPrice))},{I:2==t.orderPayload.spuPayType,N:e.o(c),O:e.p({bottom:!0,opacity:!1,bg:"bg-white",placeholder:!0,noFixed:!1,index:200}),P:e.p({title:"确认订单"})})}},t=e._export_sfc(i,[["__scopeId","data-v-b8acae45"]]);wx.createPage(t);