"use strict";var o=require("../common/vendor.js"),c=require("../api/user.js"),t=require("../api/storeOrder.js");require("../common/request.js");const l={data(){return{addressId:null,wxPay:!0,address:null,orderId:null,order:null,items:null,couponText:"\u8BF7\u9009\u62E9\u4F18\u60E0\u5238",userCouponId:0,coupons:[],couponShow:!1,payMoney:0,discountMoney:0}},onLoad(n){this.orderId=n.orderId;var s=this;o.index.$on("updateAddress",u=>{s.addressId=u.addressId,s.address=u,s.address.address=u.province+u.city+u.district+u.detail})},onShow(){this.getStoreOrderById()},methods:{couponSelect(n){this.couponShow=!1,this.userCouponId=n.id,console.log(n),this.couponText=n.title,this.compute()},open(){},close(){this.couponShow=!1},openCoupon(){this.couponShow=!0},delCoupon(){this.userCouponId=0,this.couponText="\u8BF7\u9009\u62E9\u4F18\u60E0\u5238",this.compute()},compute(){var n={orderId:this.orderId,userCouponId:this.userCouponId};console.log(n),t.compute(n).then(s=>{s.code==200?(this.payMoney=s.data.payMoney,this.discountMoney=s.data.discountMoney):(this.userCouponId=0,this.couponText="\u8BF7\u9009\u62E9\u4F18\u60E0\u5238",o.index.showToast({icon:"none",title:s.msg}))},s=>{})},getMyEnableCouponList(){let n={couponType:2};this.order.orderType==2&&(n={couponType:"2,4"}),c.getMyEnableCouponList(n).then(s=>{s.code==200&&(this.coupons=s.data)},s=>{})},getStoreOrderById(){var n={orderId:this.orderId};console.log(n),t.getStoreOrderById(n).then(s=>{s.code==200&&(this.order=s.order,this.items=s.items,this.order.userName!=null&&(this.address={realName:this.order.userName,phone:this.order.userPhone,address:this.order.userAddress}),this.compute(),this.getMyEnableCouponList())},s=>{})},openAddress(){o.index.navigateTo({url:"/pages_user/address"})},payOrder(){var n={userCouponId:this.userCouponId,addressId:this.addressId,remark:this.order.remark,orderId:this.order.orderId},s=this;o.index.showLoading(),t.pay(n).then(u=>{u.code==200?o.index.redirectTo({url:"/pages_order/storeOrderPayment?orderId="+s.order.orderId}):o.index.showToast({icon:"none",title:u.msg})},u=>{})}}};Array||o.resolveComponent("u-popup")();const h=()=>"../uni_modules/uview-plus/components/u-popup/u-popup.js";Math||h();function a(n,s,u,I,e,d){return o.e({a:e.address==null},e.address==null?{b:o.o(r=>d.openAddress())}:{},{c:e.address!=null},e.address!=null?o.e({d:o.t(e.address.realName),e:e.address.phone!=null},e.address.phone!=null?{f:o.t(e.address.phone)}:{},{g:o.t(e.address.address),h:o.o(r=>d.openAddress())}):{},{i:o.f(e.items,(r,p,i)=>o.e({a:JSON.parse(r.jsonInfo).image==""?"/static/images/drug.svg":JSON.parse(r.jsonInfo).image,b:o.t(JSON.parse(r.jsonInfo).productName),c:o.t(JSON.parse(r.jsonInfo).sku)},e.order.orderType==1?{d:o.t(r.num)}:{},{e:p})),j:e.order.orderType==1,k:e.order!=null},e.order!=null?{l:o.t(e.order.totalPrice.toFixed(2))}:{},{m:e.order!=null},e.order!=null?{n:o.t(e.order.payPrice.toFixed(2))}:{},{o:e.order!=null&&(e.order.userCouponId==null||e.order.userCouponId==0)},e.order!=null&&(e.order.userCouponId==null||e.order.userCouponId==0)?o.e({p:o.t(e.couponText),q:e.userCouponId!=0},e.userCouponId!=0?{r:o.o(r=>d.delCoupon())}:{},{s:o.o(r=>d.openCoupon())}):{},{t:o.t(e.discountMoney.toFixed(2)),v:o.t(e.payMoney.toFixed(2)),w:e.wxPay,x:e.order!=null},e.order!=null?{y:e.order.remark,z:o.o(r=>e.order.remark=r.detail.value)}:{},{A:e.coupons.length>0},e.coupons.length>0?{B:o.f(e.coupons,(r,p,i)=>o.e({a:r.status==0},r.status==0?{}:{},{b:r.status!=0},r.status!=0?{}:{},{c:o.t(r.price.toFixed(2)),d:o.t(r.minPrice.toFixed(2)),e:o.t(r.title),f:r.status==0||r.status==2},r.status==0||r.status==2?{g:o.t(r.limitTime)}:{},{h:r.status==1},r.status==1?{i:o.t(r.useTime)}:{},{j:r.status==1},r.status==1?{}:{},{k:r.status==2},r.status==2?{}:{},{l:r.status==0},r.status==0?{}:{},{m:o.o(g=>d.couponSelect(r))}))}:{},{C:e.coupons.length==0},e.coupons.length==0?{}:{},{D:o.o(d.close),E:o.o(d.open),F:o.p({closeable:!0,show:e.couponShow,round:10,mode:"bottom"}),G:e.order!=null},e.order!=null?{H:o.t(e.payMoney.toFixed(2)),I:o.o(r=>d.payOrder())}:{})}var y=o._export_sfc(l,[["render",a],["__file","E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_order/storeOrderPay.vue"]]);l.__runtimeHooks=2;wx.createPage(y);
