refundOrder.js 2.6 KB

12
  1. "use strict";const r=require("../common/vendor.js"),d=require("../api/order.js"),l=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,r.index.__f__("log","at pages_shop/refundOrder.vue:119",this.orderId),this.getStoreOrder(),this.getDicts()},methods:{getDicts(){var s={key:"store_after_sales_reasons"};d.Dicts(s).then(t=>{t.code==200?this.reasonsList=t.data:r.index.showToast({icon:"none",title:"请求失败"})})},getStoreOrder(){var s={orderId:this.orderId};d.getStoreOrderItems(s).then(t=>{t.code==200?(this.order=t.order,this.items=t.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){r.index.__f__("log","at pages_shop/refundOrder.vue:163",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(n=>n.productId),t=[],i=0;i<s.length;i++){var a={productId:s[i]};t.push(a)}var e={orderId:this.orderId,refundType:this.type,refundAmount:this.refundAmount,orderCode:this.orderCode,reasons:this.reasons,explains:this.explains,productList:t};d.applyAfterSales(e).then(n=>{n.code==200?(r.index.showToast({icon:"success",title:"提交成功"}),setTimeout(function(){r.index.redirectTo({url:"./order"})},500)):r.index.showToast({icon:"none",title:n.msg})})}}};function h(s,t,i,a,e,n){return r.e({a:e.order!=null&&e.order.isPackage!=1},e.order!=null&&e.order.isPackage!=1?{b:r.f(e.items,(o,u,f)=>({a:JSON.parse(o.jsonInfo).image,b:r.t(JSON.parse(o.jsonInfo).productName),c:r.t(JSON.parse(o.jsonInfo).price.toFixed(2)),d:r.t(JSON.parse(o.jsonInfo).num),e:u}))}:{},{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:l._imports_0$8,k:r.o((...o)=>n.reasonsChange&&n.reasonsChange(...o)),l:e.reasons,m:e.reasonsList,n:e.explains,o:r.o(o=>e.explains=o.detail.value),p:r.o(o=>n.submit())})}const p=r._export_sfc(c,[["render",h]]);wx.createPage(p);
  2. //# sourceMappingURL=../../.sourcemap/mp-weixin/pages_shop/refundOrder.js.map