storeOrderRefundSubmit.js 2.3 KB

1
  1. "use strict";const e=require("../common/vendor.js"),d=require("../common/assets.js"),c={data(){return{orderId:null,order:null,orderCode:null,items:[],type:null,reasonsOptions:[],reasons:"请选择",explains:"",refundAmount:0}},onLoad(s){this.type=s.type,this.orderId=s.orderId,this.getStoreOrderItems(),this.getDictByKey("sys_sales_reasons")},methods:{getDictByKey(s){var r={key:s};getDictByKey(r).then(n=>{n.code==200&&s=="sys_sales_reasons"&&(this.reasonsOptions=n.data)},n=>{})},getStoreOrderItems(){var s={orderId:this.orderId};getStoreOrderItems(s).then(r=>{r.code==200?(this.order=r.order,this.items=r.items,this.refundAmount=this.order.payMoney.toFixed(2)):e.index.showToast({icon:"none",title:"请求失败"})})},handleReasons(s){console.log(s.detail.value),this.reasons=this.reasonsOptions[s.detail.value].dictLabel},submit(){if(this.reasons=="请选择"){e.index.showToast({icon:"none",title:"请选择原因"});return}if(this.refundAmount<0){e.index.showToast({icon:"none",title:"请输入退款金额"});return}for(var s=this.items.map(a=>a.productId),r=[],n=0;n<s.length;n++){var i={productId:s[n]};r.push(i)}var o={refundAmount:this.refundAmount,orderId:this.orderId,refundType:this.type,reasons:this.reasons,explains:this.explains,productList:r};applyAfterSales(o).then(a=>{a.code==200?(e.index.showToast({icon:"success",title:"提交成功"}),setTimeout(function(){e.index.$emit("refreshOrder"),e.index.navigateBack({delta:1})},500)):e.index.showToast({icon:"none",title:a.msg})})}}};Array||e.resolveComponent("u--textarea")();const l=()=>"../uni_modules/uview-plus/components/u--textarea/u--textarea.js";Math||l();function h(s,r,n,i,o,a){return e.e({a:o.order!=null},o.order!=null?{b:e.f(o.items,(t,u,m)=>({a:JSON.parse(t.jsonInfo).image==""?"/static/images/drug.svg":JSON.parse(t.jsonInfo).image,b:e.t(JSON.parse(t.jsonInfo).productName),c:e.t(JSON.parse(t.jsonInfo).sku),d:e.t(JSON.parse(t.jsonInfo).price.toFixed(2)),e:e.t(JSON.parse(t.jsonInfo).num),f:u}))}:{},{c:o.refundAmount,d:e.o(t=>o.refundAmount=t.detail.value),e:e.t(o.reasons),f:d._imports_0$8,g:e.o((...t)=>a.handleReasons&&a.handleReasons(...t)),h:o.reasons,i:o.reasonsOptions,j:e.o(t=>o.explains=t),k:e.p({height:100,placeholder:"请描述申请售后服务的具体原因",count:100,modelValue:o.explains}),l:e.o(t=>a.submit())})}const p=e._export_sfc(c,[["render",h]]);wx.createPage(p);