"use strict";const r=require("../common/vendor.js"),d=require("../api/order.js"),u=require("../common/assets.js"),c={data(){return{orderId:null,order:null,orderCode:null,items:[],type:null,reasonsList:[],reasons:"请选择",explains:"",refundAmount:0}},onLoad(s){this.type=s.type,this.orderCode=s.orderCode,this.orderId=s.orderId,console.log(this.orderId),this.getStoreOrder(),this.getDicts()},methods:{getDicts(){var s={key:"store_after_sales_reasons"};d.Dicts(s).then(n=>{n.code==200?this.reasonsList=n.data:r.index.showToast({icon:"none",title:"请求失败"})})},getStoreOrder(){var s={orderId:this.orderId};d.getStoreOrderItems(s).then(n=>{n.code==200?(this.order=n.order,this.items=n.items,this.order.isPayRemain==0?this.refundAmount=this.order.totalPrice.toFixed(2):this.refundAmount=this.order.totalPrice.toFixed(2)):r.index.showToast({icon:"none",title:"请求失败"})})},reasonsChange(s){console.log(s.detail.value),this.reasons=this.reasonsList[s.detail.value].dictLabel},submit(){if(this.reasons=="请选择"){r.index.showToast({icon:"none",title:"请选择原因"});return}if(this.refundAmount<0){r.index.showToast({icon:"none",title:"请输入退款金额"});return}for(var s=this.items.map(t=>t.productId),n=[],i=0;i{t.code==200?(r.index.showToast({icon:"success",title:"提交成功"}),setTimeout(function(){r.index.redirectTo({url:"./order"})},500)):r.index.showToast({icon:"none",title:t.msg})})}}};function h(s,n,i,a,e,t){return r.e({a:e.order!=null&&e.order.isPackage!=1},e.order!=null&&e.order.isPackage!=1?{b:r.f(e.items,(o,l,f)=>({a:JSON.parse(o.jsonInfo).image,b:r.t(JSON.parse(o.jsonInfo).productName),c:r.t(JSON.parse(o.jsonInfo).sku),d:r.t(JSON.parse(o.jsonInfo).price.toFixed(2)),e:r.t(JSON.parse(o.jsonInfo).num),f:l}))}:{},{c:e.order!=null&&e.order.isPackage==1&&e.order.packageJson!=null},e.order!=null&&e.order.isPackage==1&&e.order.packageJson!=null?{d:JSON.parse(e.order.packageJson).imgUrl,e:r.t(JSON.parse(e.order.packageJson).title),f:r.t(JSON.parse(e.order.packageJson).descs)}:{},{g:e.refundAmount,h:r.o(o=>e.refundAmount=o.detail.value),i:r.t(e.reasons),j:u._imports_0$9,k:r.o((...o)=>t.reasonsChange&&t.reasonsChange(...o)),l:e.reasons,m:e.reasonsList,n:e.explains,o:r.o(o=>e.explains=o.detail.value),p:r.o(o=>t.submit())})}const p=r._export_sfc(c,[["render",h]]);wx.createPage(p);