12 |
- "use strict";const e=require("../common/vendor.js"),u=require("../api/order.js"),a=require("../common/assets.js"),_=()=>"../components/evan-switch/evan-switch.js",y=()=>"../components/px-popup-bottom/px-popup-bottom.js",v={components:{EvanSwitch:_,popupBottom:y},data(){return{priceSum:null,cartsSelect:[],address:null,addressId:null,totalNum:null,orderKey:null,price:null,liveId:null,orderList:[],userInfo:null,userAddrLiat:[],temps:[],couponUserId:null,couponText:"请选择",couponsList:[],couponVisible:!1,priceAll:{payPrice:0,totalPostage:0,usedIntegral:0,totalPrice:0},carts:[],checked:!1,type:null,cartIds:null,confirmParam:[]}},onLoad(r){e.index.__f__("log","at pages_shop/confirmCreateOrder.vue:243","确认订单",r),this.orderKey=r.orderKey,this.type=r.type,this.type=="goods"&&(this.liveId=r.liveId,this.productId=r.productId,this.totalNum=Number(r.totalNum),this.price=Number(r.price),this.priceSum=this.price*this.totalNum),this.type=="cart"&&this.getChecked()},mounted(){this.getUserAddr(),e.index.$on("updateAddress",r=>{this.address=r,this.addressId=r.addressId})},beforeDestroy(){e.index.$off("updateAddress")},methods:{getChecked(){u.checked().then(r=>{r.code==200?(this.cartsSelect=r.rows,this.priceSum=r.rows.reduce((s,d)=>s+d.price*d.cartNum,0),e.index.__f__("log","at pages_shop/confirmCreateOrder.vue:296","获取购物车选中商品>>>>",this.priceSum)):e.index.showToast({title:r.msg,icon:"none"})},r=>{})},getUserAddr(){this.userInfo=JSON.parse(e.index.getStorageSync("userInfo")),u.userAddr(this.userInfo.userId).then(r=>{r.code==200?(e.index.__f__("log","at pages_shop/confirmCreateOrder.vue:313","用户收货地址>>>>",r.data),this.address=r.data.find(s=>s.isDefault==1)):e.index.showToast({title:r.msg,icon:"none"})},r=>{})},createCartLiveOrder(){let r={orderKey:this.orderKey,userName:this.address.realName,userPhone:this.address.phone,userAddress:this.address.province+this.address.city+this.address.district+this.address.detail};return u.cartOrder(r).then(s=>{if(s.code==200)return e.index.__f__("log","at pages_shop/confirmCreateOrder.vue:338","创建购物车订单res",s),this.OrderList=s.order,s.order;throw e.index.showToast({title:s.msg,icon:"none"}),new Error(s.msg)})},createLiveOrder(){let r={liveId:this.liveId,orderKey:this.orderKey,userName:this.address.realName,userPhone:this.address.phone,userAddress:this.address.province+this.address.city+this.address.district+this.address.detail,cartId:"5",productId:this.productId,totalNum:this.totalNum};return u.createliveOrder(r).then(s=>{if(s.code==200)return this.orderList=s.order,s.order;throw e.index.showToast({title:s.msg,icon:"none"}),new Error(s.msg)})},getWeixinOrderTemps:function(){getWeixinOrderTemps().then(r=>{r.code==200&&(this.temps=r.temp)},r=>{})},couponSelect(r){this.couponText="-¥"+r.couponPrice.toFixed(2),this.couponUserId=r.id,this.couponVisible=!1,this.computed()},openCoupon(){let r=this;var s={couponType:2,useMinPrice:this.price.payPrice};getMyEnableCouponList(s).then(d=>{this.couponVisible=!0,r.couponsList=d.data})},integralChange(r){this.form.useIntegral=r?1:0,this.computed()},openAddress(){e.index.navigateTo({url:"/pages_user/address"})},async submitOrder(){try{if(this.orderKey==null){e.index.showToast({icon:"none",title:"订单KEY不存在"});return}if(this.address==null){e.index.showToast({icon:"none",title:"收货地址不能为空"});return}let r;this.type=="cart"?r=await this.createCartLiveOrder():this.type=="goods"&&(r=await this.createLiveOrder()),e.index.__f__("log","at pages_shop/confirmCreateOrder.vue:440","orderList>>",r);const s=encodeURIComponent(JSON.stringify(r));e.index.navigateTo({url:`/pages_shop/paymentOrder?orderList=${s}`})}catch{e.index.showToast({title:res.msg,icon:"none"})}},async creatCartOrder(){try{if(this.orderKey==null){e.index.showToast({icon:"none",title:"订单KEY不存在"});return}if(this.address==null){e.index.showToast({icon:"none",title:"收货地址不能为空"});return}const r=await this.cartOrder(),s=encodeURIComponent(JSON.stringify(r));e.index.navigateTo({url:`/pages_shop/paymentOrder?orderList=${s}`})}catch(r){e.index.__f__("error","at pages_shop/confirmCreateOrder.vue:475","订单创建失败:",r),e.index.showToast({title:"提交失败",icon:"none"})}}}};Array||e.resolveComponent("popupBottom")();function x(r,s,d,N,t,c){var p,l,h;return e.e({a:t.address==null},t.address==null?{b:a._imports_0$8,c:e.o(o=>c.openAddress())}:{},{d:t.address!=null},t.address!=null?e.e({e:e.t(t.address.realName),f:t.address.phone!=null},t.address.phone!=null?{g:e.t(r.$parsePhone(t.address.phone))}:{},{h:e.t(t.address.province),i:e.t(t.address.city),j:e.t(t.address.district),k:e.t(t.address.detail),l:a._imports_0$8,m:e.o(o=>c.openAddress())}):{},{n:e.f(t.carts,(o,n,g)=>e.e({a:o.storeName&&o.storeName!="null"},o.storeName&&o.storeName!="null"?{b:e.t(o.storeName)}:{},{c:e.f(o.list,(i,f,L)=>{var m;return{a:i.productAttrImage?i.productAttrImage:i.productImage,b:e.t(r.utils.getDictLabelName("storeProductType",i.productType)),c:e.t(i.productName),d:e.t(i.productAttrName),e:e.t((m=i.price)==null?void 0:m.toFixed(2)),f:e.t(i.cartNum),g:f}})},t.price&&t.price.length>0?{d:e.t(t.price[n].payPostage==null||t.price[n].payPostage==0?"免运费":t.price[n].payPostage.toFixed(2))}:{},{e:o.markinfo,f:e.o(i=>o.markinfo=i.detail.value,n),g:n})),o:t.price&&t.price.length>0,p:e.t((p=t.priceSum)==null?void 0:p.toFixed(2)),q:e.t((l=t.priceSum)==null?void 0:l.toFixed(2)),r:e.t((h=t.priceSum)==null?void 0:h.toFixed(2)),s:e.o((...o)=>c.submitOrder&&c.submitOrder(...o)),t:t.couponsList.length>0},t.couponsList.length>0?{v:e.f(t.couponsList,(o,n,g)=>e.e({a:o.status==0},o.status==0?{b:a._imports_1$7}:{},{c:o.status!=0},o.status!=0?{d:a._imports_2$4}:{},{e:e.t(o.couponPrice),f:e.t(o.useMinPrice),g:e.t(o.couponTitle),h:e.t(o.limitTime),i:e.o(i=>c.couponSelect(o),n),j:n}))}:{},{w:t.couponsList.length==0},t.couponsList.length==0?{x:a._imports_2$1}:{},{y:e.sr("popup","5fa01107-0"),z:e.p({visible:t.couponVisible,title:" ",bgColor:"#f5f5f5",radius:"30",maxHeight:"60%"})})}const I=e._export_sfc(v,[["render",x],["__scopeId","data-v-5fa01107"]]);wx.createPage(I);
- //# sourceMappingURL=../../.sourcemap/mp-weixin/pages_shop/confirmCreateOrder.js.map
|