1 |
- "use strict";const r=require("../common/vendor.js"),d=require("../api/order.js"),c=require("../common/assets.js"),u={data(){return{orderId:null,order:null,orderCode:null,items:[],type:null,reasonsList:[],reasons:"请选择",explains:"",refundAmount:0}},onLoad(o){this.type=o.type,this.orderCode=o.orderCode,this.orderId=o.orderId,console.log(this.orderId),this.getStoreOrder(),this.getDicts()},methods:{getDicts(){var o={key:"store_after_sales_reasons"};d.Dicts(o).then(t=>{t.code==200?this.reasonsList=t.data:r.index.showToast({icon:"none",title:"请求失败"})})},getStoreOrder(){var o={orderId:this.orderId};d.getStoreOrderItems(o).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(o){console.log(o.detail.value),this.reasons=this.reasonsList[o.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 o=this.items.map(n=>n.productId),t=[],i=0;i<o.length;i++){var a={productId:o[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(o,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,(s,l,m)=>({a:JSON.parse(s.jsonInfo).image,b:r.t(JSON.parse(s.jsonInfo).productName),c:r.t(JSON.parse(s.jsonInfo).price.toFixed(2)),d:r.t(JSON.parse(s.jsonInfo).num),e: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(s=>e.refundAmount=s.detail.value),i:r.t(e.reasons),j:c._imports_0$9,k:r.o((...s)=>n.reasonsChange&&n.reasonsChange(...s)),l:e.reasons,m:e.reasonsList,n:e.explains,o:r.o(s=>e.explains=s.detail.value),p:r.o(s=>n.submit())})}const p=r._export_sfc(u,[["render",h]]);wx.createPage(p);
|