;(function(){function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}System.register(['./index-legacy.1bb96d98.js','./index-legacy.1cd7b6bb.js','./vendor-legacy.031e1374.js','./index-legacy.f25f109a7.js','./index-legacy.f25f109a2.js','./index-legacy.f25f109a.js','./index-legacy.f25f109a3.js','./index-legacy.f25f109a6.js','./index-legacy.f25f109a5.js','./index-legacy.637f35562.js','./index-legacy.637f35563.js','./item-legacy.75477924.js','./index-legacy.f25f109a8.js','./index-legacy.f25f109a4.js','./cart-legacy.eb028ecf.js'],function(exports){'use strict';var ColHeader,request,state,ColResult,defineComponent,Toast,Dialog,createVNode,Tabs,Tab,List,Fragment,CellGroup,Cell,Button,createTextVNode,isVNode,ActionSheet,Field,styles,Item;return{setters:[function(module){ColHeader=module.C;},function(module){request=module.r;state=module.s;ColResult=module.C;},function(module){defineComponent=module.d;Toast=module.T;Dialog=module.D;createVNode=module.a;Tabs=module.G;Tab=module.H;List=module.w;Fragment=module.F;CellGroup=module.C;Cell=module.q;Button=module.B;createTextVNode=module.j;isVNode=module.x;ActionSheet=module.A;Field=module.m;},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(module){styles=module.s;Item=module.I;},function(){},function(){},function(){}],execute:function execute(){function _isSlot(s){return typeof s==='function'||Object.prototype.toString.call(s)==='[object Object]'&&!isVNode(s);}var returnState={0:'待处理',1:'退货中',2:'已完成',3:'已拒绝'};var afterSale=exports('default',defineComponent({name:'after-sale',data:function data(){return{active:'0',list:[],dataShow:false,// 判断是否有数据
loading:false,finished:false,show:false,kmsShow:false,params:{pageNum:1,pageSize:20},returnGood:{},reason:'',// 退货原因
returnOrderSn:'',// 退货快递单号
returnGoodId:0// 退货申请服务单号
};},watch:{active:function active(){this.init();this.getList();}},mounted:function mounted(){this.getList();},methods:{init:function init(){this.params.pageNum=1;this.finished=false;this.list=[];},getList:function getList(){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var _res,_res$data;var res,data,list,i,isHave;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0://避免重复请求
console.log(_this.loading,_this.finished);if(!(_this.loading&&_this.finished)){_context.next=3;break;}return _context.abrupt("return");case 3:_this.loading=true;if(!(_this.active==='0')){_context.next=10;break;}_context.next=7;return _this.getIsReturnOrderList();case 7:res=_context.sent;_context.next=13;break;case 10:_context.next=12;return _this.getReturnList();case 12:res=_context.sent;case 13:if(res&&res.code===200&&res.data.list){data=res.data;if(Array.isArray(data.list)){list=[];// 过滤一个订单里面所有商品都申请了退货
for(i=0;i<data.list.length;i++){if(data.list[i].orderItemList){isHave=data.list[i].orderItemList.findIndex(function(n){return n.returnStatus<0;})>-1;if(isHave){list.push(data.list[i]);}}else{list.push(data.list[i]);}}_this.list=_this.list.concat(_this.list,list);}// this.list = [].concat(this.list, res.data.list)
_this.params.pageNum=res.data.pageNum+1;}_this.finished=_this.params.pageNum>=((_res=res)===null||_res===void 0?void 0:(_res$data=_res.data)===null||_res$data===void 0?void 0:_res$data.totalPage);_this.loading=false;case 16:case"end":return _context.stop();}}},_callee);}))();},//获取可退货列表
getIsReturnOrderList:function getIsReturnOrderList(){var _this2=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var res;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return request.get('/api-mall-portal/order/list',{params:_objectSpread(_objectSpread({},_this2.params),{},{status:'1,2,3'})});case 3:res=_context2.sent;return _context2.abrupt("return",res);case 7:_context2.prev=7;_context2.t0=_context2["catch"](0);case 9:return _context2.abrupt("return",{});case 10:case"end":return _context2.stop();}}},_callee2,null,[[0,7]]);}))();},// 获取退货申请
getReturnList:function getReturnList(){var _this3=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(){var res;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.prev=0;_context3.next=3;return request.post('/api-mall-portal/returnApply/list',{data:_objectSpread(_objectSpread({},_this3.params),{},{status:_this3.active==='1'?'0,1':'2,3'})});case 3:res=_context3.sent;return _context3.abrupt("return",res);case 7:_context3.prev=7;_context3.t0=_context3["catch"](0);case 9:return _context3.abrupt("return",{});case 10:case"end":return _context3.stop();}}},_callee3,null,[[0,7]]);}))();},// 设置退货参数
setReturnParams:function setReturnParams(item,n){this.returnGood.memberUsername=state.user.data.username;this.returnGood.orderId=item.id;this.returnGood.orderSn=item.orderSn;this.returnGood.productAttr=n.productAttr;this.returnGood.productBrand=n.productBrand;this.returnGood.productCount=n.productQuantity;this.returnGood.productId=n.productId;this.returnGood.productName=n.productName;this.returnGood.productPic=n.productPic;this.returnGood.productPrice=n.productPrice;this.returnGood.productRealPrice=n.productPrice;this.returnGood.proofPics='';this.returnGood.returnName=item.receiverName;this.returnGood.returnPhone=item.receiverPhone;this.returnGood.orderItemId=n.id;console.log(this.returnGood);},// 退商品
setReturnShop:function setReturnShop(){var _this4=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee4(){var res;return regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:if(_this4.reason){_context4.next=3;break;}Toast('请填写退货原因!');return _context4.abrupt("return");case 3:_context4.prev=3;_context4.next=6;return request.post('/api-mall-portal/returnApply/create',{data:_objectSpread(_objectSpread({},_this4.returnGood),{},{reason:_this4.reason})});case 6:res=_context4.sent;if(res.code===200){Toast({message:'退货申请成功',icon:'success'});setTimeout(function(){_this4.show=false;_this4.reason='';_this4.returnOrderSn='';_this4.active='1';},500);}_context4.next=12;break;case 10:_context4.prev=10;_context4.t0=_context4["catch"](3);case 12:_this4.returnGood={};case 13:case"end":return _context4.stop();}}},_callee4,null,[[3,10]]);}))();},// 填写快递单号
setReturnApplySn:function setReturnApplySn(){var _this5=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee5(){var _yield$request$post,code,data;return regeneratorRuntime.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:if(_this5.returnOrderSn){_context5.next=3;break;}Toast('请填写退货快递单号');return _context5.abrupt("return");case 3:_context5.prev=3;_context5.next=6;return request.post('/api-mall-portal/returnApply/deliverySn',{data:{deliverySn:_this5.returnOrderSn,id:_this5.returnGoodId}});case 6:_yield$request$post=_context5.sent;code=_yield$request$post.code;data=_yield$request$post.data;if(code===200){_this5.returnOrderSn='';_this5.kmsShow=false;_this5.init();_this5.getList();}_context5.next=14;break;case 12:_context5.prev=12;_context5.t0=_context5["catch"](3);case 14:case"end":return _context5.stop();}}},_callee5,null,[[3,12]]);}))();},//撤销申请
deleteReturnApply:function deleteReturnApply(){var _this6=this;Dialog.confirm({title:'提示',message:'是否撤销退货申请?',confirmButtonText:'撤销',confirmButtonColor:'var(--van-primary)'}).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee6(){var _yield$request$post2,code,data;return regeneratorRuntime.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.prev=0;_context6.next=3;return request.post('/api-mall-portal/returnApply/delete/'+_this6.returnGoodId);case 3:_yield$request$post2=_context6.sent;code=_yield$request$post2.code;data=_yield$request$post2.data;if(code===200){_this6.init();_this6.getList();}_context6.next=11;break;case 9:_context6.prev=9;_context6.t0=_context6["catch"](0);case 11:case"end":return _context6.stop();}}},_callee6,null,[[0,9]]);})));}},render:function render(){var _this7=this;var _slot;var tabs=[{name:'0',title:'全部'},{name:'1',title:'处理中'},{name:'2',title:'已处理'}];return createVNode("div",{"class":styles.shopOrder},[createVNode(ColHeader,null,null),createVNode(Tabs,{"active":this.active,"onUpdate:active":function onUpdateActive($event){return _this7.active=$event;},"color":"var(--van-primary)","lineWidth":28,"animated":true,"swipeable":true},_isSlot(_slot=tabs.map(function(tab){return createVNode(Tab,{"name":tab.name,"title":tab.title},{default:function _default(){return[_this7.list.length?createVNode(List,{"loading":_this7.loading,"finished":_this7.finished,"finishedText":" ","class":[styles.goodsList],"onLoad":_this7.getList},{default:function _default(){return[_this7.active===tab.name&&_this7.list.map(function(item){return createVNode(Fragment,null,[item.orderItemList&&item.orderItemList.length?item.orderItemList.map(function(n){return createVNode(CellGroup,{"class":styles.cellGroup},{default:function _default(){return[createVNode(Item,{"item":n},null),createVNode(Cell,{"center":true},{default:function _default(){return createVNode("div",{"class":styles.btnList},[_this7.active==='0'&&(item.status!==0||item.status!==6)&&n.returnStatus<0?createVNode(Button,{"size":"small","round":true,"type":"primary","onClick":function onClick(){_this7.show=true;_this7.setReturnParams(item,n);}},{default:function _default(){return[createTextVNode("\u9000\u8D27\u7533\u8BF7")];}}):null,n.returnStatus>=0?createVNode("div",null,[returnState[n.returnStatus]]):null]);}})];}});}):createVNode(CellGroup,{"class":styles.cellGroup},{default:function _default(){return[createVNode(Cell,{"title":item.createTime,"titleClass":styles.payTime,"value":returnState[item.status]},null),createVNode(Item,{"item":item},null),createVNode(Cell,{"center":true},{default:function _default(){return createVNode("div",{"class":styles.btnList},[item.status===1&&!item.deliverySn?createVNode(Button,{"size":"small","round":true,"onClick":function onClick(){_this7.returnGoodId=item.id;_this7.kmsShow=true;}},{default:function _default(){return[createTextVNode("\u586B\u5199\u9000\u8D27\u5FEB\u9012\u5355\u53F7")];}}):null,item.status<=1?createVNode(Button,{"size":"small","round":true,"type":"primary","onClick":function onClick(){_this7.returnGoodId=item.id;_this7.deleteReturnApply();}},{default:function _default(){return[createTextVNode("\u64A4\u9500\u7533\u8BF7")];}}):null,item.status===2?createVNode("div",{"class":styles.returnDes},[createTextVNode("\u8BE5\u5546\u54C1\u91D1\u989D\u5DF2\u4E8E "),item.handleTime,' ',createTextVNode("\u539F\u8DEF\u9000\u8FD8")]):item.status===3?createVNode("div",{"class":styles.returnDes},[createTextVNode("\u62D2\u7EDD\u539F\u56E0: "),item.handleNote]):null]);}})];}})]);})];}}):createVNode(ColResult,{"btnStatus":false,"classImgSize":"SMALL","tips":"暂无数据"},null)];}});}))?_slot:{default:function _default(){return[_slot];}}),createVNode(ActionSheet,{"show":this.show,"onUpdate:show":function onUpdateShow($event){return _this7.show=$event;},"title":"退货原因"},{default:function _default(){return[createVNode("div",{"style":{paddingTop:'15px'}},[createVNode(Field,{"class":[styles.field],"placeholder":"请输入退货原因","type":"textarea","rows":3,"modelValue":_this7.reason,"onUpdate:modelValue":function onUpdateModelValue($event){return _this7.reason=$event;}},null)]),createVNode("div",{"class":styles['btn-group']},[createVNode(Button,{"type":"primary","block":true,"round":true,"onClick":function onClick(){return _this7.setReturnShop();}},{default:function _default(){return[createTextVNode("\u786E\u5B9A")];}})])];}}),createVNode(ActionSheet,{"show":this.kmsShow,"onUpdate:show":function onUpdateShow($event){return _this7.kmsShow=$event;},"title":"填写退货快递单号"},{default:function _default(){return[createVNode(Field,{"modelValue":_this7.returnOrderSn,"onUpdate:modelValue":function onUpdateModelValue($event){return _this7.returnOrderSn=$event;},"class":[styles.field],"placeholder":"请输入退货快递单号"},null),createVNode("div",{"class":styles['btn-group']},[createVNode(Button,{"type":"primary","block":true,"round":true,"onClick":function onClick(){return _this7.setReturnApplySn();}},{default:function _default(){return[createTextVNode("\u786E\u5B9A")];}})])];}})]);}}));}};});})();
