"use strict";var e=Object.defineProperty,o=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,a=(o,t,r)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,s=(e,o,t)=>new Promise(((r,a)=>{var s=e=>{try{n(t.next(e))}catch(o){a(o)}},i=e=>{try{n(t.throw(e))}catch(o){a(o)}},n=e=>e.done?r(e.value):Promise.resolve(e.value).then(s,i);n((t=t.apply(e,o)).next())}));const i=require("../../../../common/vendor.js"),n=require("../../../../sheep/index.js"),p=require("../../../../sheep/api/trade/order.js"),l=require("../../../../sheep/api/trade/config.js"),u=require("../../../../sheep/hooks/useGoods.js"),d=require("../../../../sheep/api/trade/afterSale.js");if(!Array){(i.resolveComponent("s-goods-item")+i.resolveComponent("uni-easyinput")+i.resolveComponent("s-uploader")+i.resolveComponent("uni-forms")+i.resolveComponent("su-fixed")+i.resolveComponent("su-popup")+i.resolveComponent("s-layout")+i.resolveComponent("layout-default-uni"))()}Math||((()=>"../../../../sheep/components/s-goods-item/s-goods-item.js")+(()=>"../../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js")+(()=>"../../../../sheep/components/s-uploader/s-uploader.js")+(()=>"../../../../uni_modules/uni-forms/components/uni-forms/uni-forms.js")+(()=>"../../../../sheep/ui/su-fixed/su-fixed.js")+(()=>"../../../../sheep/ui/su-popup/su-popup.js")+(()=>"../../../../sheep/components/s-layout/s-layout.js"))();const m={__name:"apply",setup(e){const m=i.ref(null),c=i.reactive({orderId:0,itemId:0,order:{},item:{},config:{},wayList:[{text:"仅退款",value:"10"},{text:"退款退货",value:"20"}],reasonList:[],showModal:!1,currentValue:""}),f=i.reactive({way:"",applyReason:"",applyDescription:"",images:[]}),y=i.reactive({});function h(){return s(this,null,(function*(){const e=((e,s)=>{for(var i in s||(s={}))t.call(s,i)&&a(e,i,s[i]);if(o)for(var i of o(s))r.call(s,i)&&a(e,i,s[i]);return e})({orderItemId:c.itemId,refundPrice:c.item.payPrice},f),{code:s}=yield d.AfterSaleApi.createAfterSale(e);0===s&&(i.index.showToast({title:"申请成功"}),n.sheep.$router.go("/modules/mall/order/aftersale/list"))}))}function v(e){f.way=e.detail.value,c.reasonList="10"===f.way?c.config.afterSaleRefundReasons||[]:c.config.afterSaleReturnReasons||[],f.applyReason="",c.currentValue=""}function g(e){c.currentValue=e.detail.value}function w(){f.applyReason=c.currentValue,c.showModal=!1}return i.onLoad((e=>s(this,null,(function*(){if(!e.orderId||!e.itemId)return void n.sheep.$helper.toast("缺少订单信息,请检查");c.orderId=e.orderId,c.itemId=parseInt(e.itemId);const{code:o,data:t}=yield p.OrderApi.getOrder(c.orderId);0===o&&(c.order=t,c.item=t.items.find((e=>e.id===c.itemId))||{},10===c.order.status&&c.wayList.splice(1,1),c.config=(yield l.TradeConfigApi.getTradeConfig()).data)})))),(e,o)=>{var t;return i.e({a:i.p({img:c.item.picUrl,title:c.item.spuName,skuText:null==(t=c.item.properties)?void 0:t.map((e=>e.valueName)).join(" "),price:c.item.price,num:c.item.count}),b:i.f(c.wayList,((e,o,t)=>({a:f.type===e.value,b:e.value,c:i.t(e.text),d:o}))),c:i.o(v),d:i.t(i.unref(u.fen2yuan)(c.item.payPrice)),e:i.o((e=>c.showModal=!0)),f:f.applyReason},f.applyReason?{g:i.t(f.applyReason)}:{},{h:i.o((e=>c.showModal=!0)),i:i.o((e=>f.applyDescription=e)),j:i.p({inputBorder:!1,type:"textarea",maxlength:"120",autoHeight:!0,placeholder:"客官~请描述您遇到的问题,建议上传照片",modelValue:f.applyDescription}),k:i.o((e=>f.images=e)),l:i.p({fileMediatype:"image",limit:"9",mode:"grid",imageStyles:{width:"168rpx",height:"168rpx"},url:f.images}),m:i.sr(m,"bfeec098-3,bfeec098-1",{k:"form"}),n:i.o((e=>f=e)),o:i.p({rules:y,"label-position":"top",modelValue:f}),p:i.o((e=>i.unref(n.sheep).$router.go("/modules/mall/chat/index"))),q:i.o(h),r:i.p({bottom:!0,placeholder:!0}),s:i.f(c.reasonList,((e,o,t)=>({a:i.t(e),b:e,c:e===c.currentValue,d:e}))),t:i.o(g),v:i.o(w),w:i.o((e=>c.showModal=!1)),x:i.p({show:c.showModal,round:"10",showClose:!0}),y:i.p({title:"申请售后"})})}}},c=i._export_sfc(m,[["__scopeId","data-v-bfeec098"]]);wx.createPage(c);