"use strict";var e=require("../common/vendor.js"),d=require("../api/integral.js");require("../common/request.js");const s={data:()=>({addressId:null,address:null,orderId:null,order:null,item:null}),onLoad(d){this.goodsId=d.goodsId;var s=this;e.index.$on("updateAddress",(e=>{s.addressId=e.addressId,s.address=e,s.address.address=e.province+e.city+e.district+e.detail})),this.getIntegralGoodsById()},methods:{getIntegralGoodsById(){var e={goodsId:this.goodsId};console.log(e),d.getIntegralGoodsById(e).then((e=>{200==e.code&&(this.item=e.data)}),(e=>{}))},openAddress(){e.index.navigateTo({url:"/pages_user/address"})},payOrder(){if(null!=this.addressId){var s={goodsId:this.goodsId,addressId:this.addressId};e.index.showLoading(),d.createOrder(s).then((d=>{200==d.code?e.index.redirectTo({url:"./integralOrderPaySuccess?orderId="+d.order.orderId}):e.index.showToast({icon:"none",title:d.msg})}),(e=>{}))}else e.index.showToast({icon:"none",title:"请选择收货地址"})}}};var r=e._export_sfc(s,[["render",function(d,s,r,o,t,a){return e.e({a:null==t.address},null==t.address?{b:e.o((e=>a.openAddress()))}:{},{c:null!=t.address},null!=t.address?e.e({d:e.t(t.address.realName),e:null!=t.address.phone},null!=t.address.phone?{f:e.t(t.address.phone)}:{},{g:e.t(t.address.address),h:e.o((e=>a.openAddress()))}):{},{i:""==t.item.imgUrl?"/static/images/drug.svg":t.item.imgUrl,j:e.t(t.item.goodsName),k:e.t(t.item.integral),l:e.t(t.item.integral),m:null!=t.item},null!=t.item?{n:e.o((e=>a.payOrder()))}:{})}]]);wx.createPage(r);
