| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952 |
- @extends('layouts.app')
- @section('title')查询-订单管理@endsection
- @section('content')
- <div class="container-fluid">
- <div style="min-width: 4120px;">{{--4070--}}
- <div id="list" class="d-none">
- <div id="form_div"></div>
- <div class="ml-3 form-inline" id="btn">
- <div class="dropdown">
- <button type="button"
- class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
- data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
- 导出Excel
- </button>
- <div class="dropdown-menu">
- <a class="dropdown-item" @click="orderExport(false)" href="javascript:">导出勾选内容</a>
- <a class="dropdown-item" @click="orderExport(true)" href="javascript:">导出所有页</a>
- </div>
- </div>
- <div class="custom-control custom-checkbox ml-1">
- <input type="checkbox" class="custom-control-input" id="customCheck" name="is_merge"
- v-model="is_merge">
- <label class="custom-control-label" for="customCheck">导出是否格式化</label>
- </div>
- @can('订单管理-批量备注')
- <button @click="modal()" type="button" class="btn btn-sm ml-2 btn-outline-primary">批量备注追加
- </button>@endcan
- @can('订单管理-编辑')
- <span class="btn btn-sm btn-outline-dark tooltipTarget ml-1" @click="freezeAll"
- style="cursor: pointer" title="订单的冻结条件要只局限在“创建订单”,“分配完成”,“拣货完成”,“播种完成”">冻结</span>
- <button type="button" @click="thaw(null,true)"
- class="btn btn-sm btn-outline-danger tooltipTarget ml-1" title="解除已冻结订单"
- style="opacity: 0.7">解冻
- </button>
- <span class="btn btn-sm btn-outline-dark tooltipTarget ml-1" @click="deAllocationAll"
- style="cursor: pointer" title="订单的取消分配条件要只局限在“分配完成”或“部分分配”">取消分配</span>
- <span class="btn btn-sm btn-outline-primary tooltipTarget ml-1" @click="allocation()"
- style="cursor: pointer" title="仅能分配未分配订单">订单分配</span>
- <button type="button" @click="resetLogisticsGetMark()"
- class="btn btn-sm ml-1 btn-outline-success">重置快递获取标记
- </button>
- <button type="button" @click="resetInterfaceReturnMark()"
- class="btn btn-sm ml-1 btn-outline-secondary">重置接口回传标记
- </button>
- @endcan
- @can('订单管理-订单-生成问题件')
- <button @click="orderIssueTag()" type="button" class="btn btn-sm ml-1 btn-outline-primary">
- 标记问题件
- </button>
- @endcan
- @can('订单管理-订单-生成退货单')
- <button class="btn btn-sm btn-outline-dark ml-1" @click="isRejectedBillExist()"
- style="opacity: 0.7">生成退货单
- </button>
- @endcan
- <button class="btn btn-sm ml-1 btn-primary" @click="copyLogisticNumber()">复制快递单号</button>
- @can('订单管理-订单-生成工单')
- <button class="btn btn-sm ml-1 btn-outline-success" @click="checkWorkOrderOrCreateWorkOrder">生成工单</button>
- @endcan
- @can('订单管理-订单-一键回传')
- <button class="btn btn-sm ml-1 btn-success tooltipTarget"
- title="订单一键回传必须满足条件:订单状态为“分配完成,部分拣货,拣货完成,播种完成”;订单未冻结;订单有快递单号"
- @click="manualBack()">一键回传
- </button>
- @endcan
- @can('订单管理-订单-一键揽收')
- <button class="btn btn-sm ml-1 btn-success tooltipTarget" title="目前仅中通可用,默认重量0.01kg,默认揽收不需要任何条件"
- @click="collectUpload()">一键揽收</button>
- @endcan
- </div>
- <div class="modal fade " style="top: 20%" id="myModal" tabindex="-1" role="dialog"
- aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
- </button>
- </div>
- <div class="modal-body">
- <input class="form-control" v-model="content" placeholder="注释内容">
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
- <button type="button" @click="batchComments()" class="btn btn-primary">批量备注追加</button>
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal -->
- </div>
- <table class="table table-striped table-bordered table-hover card-body td-min-width-80" id="table">
- <tr v-for="(order,i) in orders" @click="selectedColor(order.orderno)"
- :style="{'background-color': order.orderno==selectedStyle?'#aac7ea':''}">
- <td>
- <input class="checkItem" type="checkbox" :value="order.orderno">
- </td>
- <td class="text-nowrap">
- <span >@{{ i+1 }}</span>
- @can('订单管理-问题件')
- <a :href="'{{url("order/issue/index")}}'+'?orderCode='+order.orderno"
- target="order/issue/index?addtime=15">
- <span v-show="order.is_order_issue" class="badge badge-pill badge-danger">问题件</span>
- </a>
- @else
- <span v-show="order.is_order_issue" class="badge badge-pill badge-danger">问题件</span>
- @endcan
- <br v-show="order.is_order_issue">
- @can('订单管理-工单处理')
- <a :href="'{{url("order/workOrder/index")}}'+'?client_code='+order.soreference1" target="order/workOrder/index">
- <span v-show="order['is_work_order']" class="badge badge-pill badge-primary">工单</span>
- </a>
- @else
- <span v-show="order['is_work_order']" class="badge badge-pill badge-primary">工单</span>
- @endcan
- </td>
- <td class="text-dark font-weight-bold text-nowrap"><span>@{{ order.orderno }}</span></td>
- <td class="text-muted text-nowrap"><span>@{{ order.ordercodename }}</span></td>
- <td class="text-nowrap"><span>@{{ order.addtime }}</span></td>
- <td class="text-nowrap"><span>@{{ order.issuepartyname }}</span></td>
- <td class="text-nowrap"><span>@{{ order.customer_descr_c }}</span></td>
- <td class="text-nowrap"><span>@{{ order.soreference1 }}</span></td>
- <td class="text-muted text-nowrap"><span>@{{ order.carriername }}</span></td>
- <td class="text-nowrap">
- <div v-if="picktotraceidMap[order.orderno] && picktotraceidMap[order.orderno].length>1"
- class="text-center">
- <span v-for="(picktotraceid,key) in picktotraceidMap[order.orderno]"
- v-if="order.is_unfold">
- @{{ isDB(order.carriername) ? (order.code5+'#'+(key+1)) : picktotraceid }}<br>
- </span>
- <button class="btn btn-sm btn-outline-info"
- :style="order.is_unfold ? 'opacity:0.7' : ''" @click="isUnfold(order)">
- <span v-if="order.is_unfold" class="mt-1">收起</span>
- <span v-else>分箱 @{{ picktotraceidMap[order.orderno].length }} 件,展开单号</span>
- </button>
- </div>
- <span v-else v-text="(order.carriername !==null && order.carriername.includes('唯品顺丰')) ? order.code5 : order.soreference5"></span>
- </td>
- <td class="text-muted text-wrap text-letter">
- <div class="text-overflow-warp-200 warp-min-200"
- :class="order.is_encryption ? 'text-danger' : ''"><span
- v-if="order.is_encryption">*加密*</span><span v-else>@{{ order.c_contact }}</span>
- </div>
- </td>
- <td class="text-muted text-wrap text-letter">
- <div class="text-overflow-warp-200 warp-min-200"
- :class="order.is_encryption ? 'text-danger' : ''"><span
- v-if="order.is_encryption">*加密*</span><span v-else>@{{ order.c_tel2?order.c_tel2:order.c_tel1 }}</span>
- </div>
- </td>
- <td class="text-nowrap"><span> @{{ order.c_province }}</span></td>
- <td class="text-nowrap"><span> @{{ order.c_city }}</span></td>
- <td class="text-nowrap">
- <div class="text-overflow-warp-200 warp-min-200">@{{ order.c_district }}</div>
- </td>
- <td class="text-muted text-wrap text-letter">
- <div class="text-overflow-warp-200 warp-min-200"
- :class="order.is_encryption ? 'text-danger' : ''"><span
- v-if="order.is_encryption">*加密*</span><span v-else>@{{ order.c_address1 }}</span>
- </div>
- </td>
- <td class="text-nowrap"><span>@{{ order.waveno }}</span></td>
- <td class="text-nowrap"><span> @{{ order.warehouseid }}</span></td>
- <td class="text-nowrap"><span v-if="order.edisendflag2=='Y'">是</span><span
- v-if="order.edisendflag2=='N'">否</span><span v-if="order.edisendflag2=='W'">错误</span>
- </td>
- <td class="text-nowrap"><span>@{{ order.edisendtime2 }}</span></td>
- <td class="text-center" style="min-width: 900px">
- <div :class="commodities[order.orderno]&&commodities[order.orderno].length==1 ? '' : 'up'"
- :id="'order-'+i">
- <div v-for="oracleDOCOrderDetail in commodities[order.orderno]" class="row">
- <div class="col-2 border border-1">@{{ oracleDOCOrderDetail.sku }}</div>
- <div class="col-2 border border-1">@{{ oracleDOCOrderDetail.alternate_sku1 }}</div>
- <div class="col-2 border border-1" @dblclick.stop="replaceText(i)">
- <div class="w-100"
- :class="order.replaceText ? 'text-overflow-warp-100' : 'text-overflow-replace-100 cursor-pointer'">
- @{{ oracleDOCOrderDetail.descr_c }}
- </div>
- </div>
- <div class="col-1 border border-1">@{{ oracleDOCOrderDetail.qtyordered }}</div>
- <div class="col-2 border border-1">@{{ oracleDOCOrderDetail.lotnum }}</div>
- <div class="col-1 m-0 p-0 border border-1">@{{
- oracleDOCOrderDetail.orderdetailcodename }}
- </div>
- <div class="col-2 border border-1">@{{ oracleDOCOrderDetail.checktime }}</div>
- </div>
- </div>
- <div class="row text-center cursor-pointer"
- v-if="commodities[order.orderno]&&commodities[order.orderno].length>1">
- <b @click="unfold(i)" class="col-12 cursor-pointer" v-if="!upList[i]">共有 @{{
- commodities[order.orderno].length }} 件商品,点击展开</b>
- <b class="col-12" @click="unfold(i)" v-else>点击收起明细</b>
- </div>
- </td>
- <td><span>@{{ order.notes }}</span></td>
- <td><span>@{{ order.manualflag}}</span></td>
- <td><span>@{{ order.erpcancelflag }}</span></td>
- <td><span>@{{ order.picking_print_flag }}</span></td>
- <td><span>@{{ order.edisendflag }}</span></td>
- <td><span>@{{ order.ediremarks2}}</span></td>
- <td>
- @can('订单管理-编辑')
- <button v-if="order.releasestatus!=='H'" @click="freeze(order.orderno,order.waveno)"
- class="btn btn-sm btn-outline-dark text-nowrap"
- :disabled="!(order.ordercodename==='创建订单'||order.ordercodename==='分配完成'||order.ordercodename==='拣货完成'||order.ordercodename==='播种完成')">
- 冻结
- </button>
- <button v-else @click="thaw(order.orderno,false,order)"
- class="btn btn-sm btn-outline-danger text-nowrap"
- :disabled="!(order.ordercodename==='创建订单'||order.ordercodename==='分配完成'||order.ordercodename==='拣货完成'||order.ordercodename==='播种完成')">
- 解冻
- </button>
- @else
- <span>@{{ order.releasestatus }}</span>
- @endcan
- </td>
- <td>
- @can('订单管理-编辑')
- <button v-if="order.sostatus=='40'||'30'"
- @click="deAllocation(order.orderno,order.waveno)"
- class="btn btn-sm btn-outline-dark text-nowrap"
- :disabled="!(order.sostatus==='40'|| order.sostatus==='30')">取消分配
- </button>
- @else
- <span>@{{ order.sostatus }}</span>
- @endcan
- </td>
- </tr>
- </table>
- <button type="button" @click="pageUp()" :readonly="page>1?false:true" class="btn btn-sm "
- :class="page>1?'btn-outline-info':''">上一页
- </button>
- <button type="button" @click="pageDown()" :readonly="maxPage == 0 ? false : (page<maxPage?false:true)"
- class="btn btn-sm m-3"
- :class="maxPage == 0 ? 'btn-outline-info' : (page<maxPage?'btn-outline-info':'')">下一页
- </button>
- <input @keyup.enter="pageSkip($event)" class="form-control-sm ml-3 tooltipTarget" placeholder="此处输入页数"
- title="去往指定页">
- <span class="text-muted m-1">@{{ pagePlaceholder }}</span>
- <span class="text-muted m-1" v-if="maxPage != 0">共 @{{ sum }} 条</span>
- <div class="modal fade " id="checkModal" tabindex="-1" role="dialog" aria-labelledby="checkModalLabel"
- aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="checkModalLabel">标记问题件提示</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"
- @click="changeRemark">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <div class="alert" id="alert-message">
- @{{ message.checkOrderIssueMessage }}
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal"
- @click="message.checkOrderIssueMessage=''">关闭
- </button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade " id="exampleModal" tabindex="-1" role="dialog"
- aria-labelledby="exampleModalLabel"
- aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered modal-xl">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="exampleModalLabel">输入问题件信息</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"
- @click="changeRemark">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <div class="form-group row m-0 p-0">
- <label class="col-md-1 col-sm-2 text-right">问题类别</label>
- <select name="order_issues_type_id" v-model="typeId" class="form-control col-4"
- id="orderIssueType" @focus="focusOnModal($event)">
- <option value></option>
- <option v-for="type in orderIssueType" :value="type.id">@{{ type.name }}
- </option>
- </select>
- <label class="col-md-1 col-sm-2 text-right">
- 快递
- </label>
- <div class="col-4">
- <textarea class="form-control m-0">@{{ tagOrder.logisticInfo }}</textarea>
- <button type="button" class="btn btn-sm btn-outline-primary"
- @click="copyLogisticInfo">复制
- </button>
- </div>
- </div>
- <div class="form-group row m-0">
- <label class="col-md-1 col-sm-2 text-right">情况说明</label>
- <label for="result_explain"></label>
- <textarea name="result_explain" v-model="result_explain" class="form-control col-4"
- id="result_explain"></textarea>
- <label class="col-md-1 col-sm-2 text-right">
- 商家
- </label>
- <div class="col-4">
- <textarea class="form-control m-0 row">@{{ tagOrder.merchantInfo }}</textarea>
- <button type="button" class="btn btn-sm btn-outline-primary"
- @click="copyMerchantInfo">复制
- </button>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal"
- @click="changeRemark">关闭
- </button>
- <button type="button" class="btn btn-sm btn-primary" @click="orderIssueTagSubmit">提交
- </button>
- </div>
- </div>
- </div>
- </div>
- @can('订单管理-订单-生成工单')
- @include('order.index._work_order_modal')
- @include('order.index._work_order_info_modal')
- @endcan
- <textarea id="clipboardDiv" style="opacity:0"></textarea>
- </div>
- </div>
- </div>
- @endsection
- @section('lastScript')
- <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
- <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
- <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
- <script>
- let vue = new Vue({
- el: "#list",
- data: {
- page: Number('{{$page}}'),
- paginate: Number('{{$request['paginate'] ?? 50}}'),
- maxPage: 1,
- sum: 0,
- owners: [
- @foreach($customers as $customer)
- {
- name: '{{$customer->code}}', value: '{{$customer->name}}'
- },
- @endforeach
- ],
- logistics: [
- @foreach($logistics as $logistic)
- {
- name: '{{$logistic->name}}', value: '{{$logistic->name}}'
- },
- @endforeach
- ],
- orders: {!! $orders !!},
- commodities: {!! $commodities !!},
- content: '',
- codes: [
- @foreach($codes as $code)
- {
- name: '{{$code->code}}', value: '{{$code->codename_c}}'
- },
- @endforeach
- ],
- selectedStyle: '',
- picktotraceidMap: {!! $picktotraceids !!},
- pagePlaceholder: "",
- typeId: '',
- result_explain: '',
- orderIssueType: {!! $orderIssueType !!},
- is_merge: false,
- message: {
- checkOrderIssueMessage: '',
- },
- tagOrders: [],
- tagOrder: {
- logisticInfo: '',
- merchantInfo: '',
- },
- upList: {},
- workOrder: {
- types:
- @can("订单管理-工单处理-客服编辑")
- ['拦截','取消拦截', '信息更改', '快递异常', '错漏发', '破损', '快递丢件']
- @elsecan("订单管理-工单处理-货主编辑")
- ['拦截','取消拦截','信息更改', '快递异常', '错漏发', '破损']
- @else
- ['']
- @endcan
- ,
- orderIssueType: 0,
- type:null, // 快递异常时填写
- remark: {
- name: null, // 联系人
- phone: null, // 联系号码
- province: null, // 省
- city: null, // 市
- district: null, // 区
- adder: null, // 详细地址
- info: null,
- },
- packageImages: [], // 外包装图片
- commodityImages: [], // 内物破损图片
- dealImages: [], // 交易截图
- commodities: [],
- logistic_number: null, // 快递单号
- price: null,
- },
- expressAbnormalTypes:['在途异常','签收未收到'],
- exeSign: {},
- workOrderInfos:[],
- workOrderIndex:null,
- workOrderInfo:{
- id:'',
- type:'',
- clientCode:'',
- logistic_numbers:[],
- detail:{
- price:'',
- return_logistic_number:'',
- reissue_logistic_number:'',
- },
- commodities:[],
- packagesImages:[],
- commodityImages:[],
- dealImages:[],
- refundImages:[],
- remark:'',
- issue_name:'',
- },
- isBaoShi:@can('订单管理-工单处理-宝时编辑') true @else false @endcan,
- },
- mounted: function () {
- this.initData();
- $(".up").slideUp();
- $(".tooltipTarget").tooltip({'trigger': 'hover'});
- $("#list").removeClass('d-none');
- if (this.orders.length > 0) {
- this.maxPage = Math.ceil(this.orders[0].counted / this.paginate);
- this.sum = this.orders[0].counted;
- }
- if (this.getQueryVariable('alternate_sku1')) {
- this.maxPage = 0;
- this.pagePlaceholder = '当前页数:' + this.page;
- } else {
- this.pagePlaceholder = '当前页数:' + this.page + '/' + this.maxPage;
- }
- let data = [
- [{name: 'codename_c', type: 'select', placeholder: '订单状态', data: this.codes},
- {
- name: 'orderdate_start', type: 'time', tip: ['选择显示日期的起始时间', '选择显示日期的起始时间'],
- rules: {
- date_relevance: {
- date: ['orderdate_start', 'orderdate_end'],
- relevance: 'addtime',
- killing: 'relevance',
- default: [31, 92, 183, 366]
- }
- }
- },
- {name: 'orderno', type: 'input', tip: '可支持多SO号,糊模查找需要在左边打上%符号', placeholder: 'SO号'},
- {
- name: 'carriername',
- type: 'select_multiple_select',
- tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的承运人'],
- placeholder: ['承运人', '定位或多选承运人'],
- data: this.logistics
- },
- {
- name: ['notes', 'addtime'],
- type: 'input_select',
- tip: ['右侧选择查询范围,默认为一月内', '查询范围,范围越短搜索越快'],
- placeholder: ['备注', ''],
- data: [{name: '31', value: '近一月'}, {name: '92', value: '近三月'}, {
- name: '183',
- value: '近半年'
- }, {name: '366', value: '近一年'}, {name: '0', value: '不限'},],
- rules: {
- son: {
- addtime: {
- default: '31',
- required_without_all_if: ['orderdate_start', 'orderdate_end']
- }
- },
- date_relevance: {
- date: ['orderdate_start', 'orderdate_end'],
- relevance: 'addtime',
- killing: 'date',
- default: [31, 92, 183, 366]
- }
- }
- },
- {name: 'issuepartyname', type: 'input', tip: '糊模查找需要在左边打上%符号', placeholder: '店铺名称'},
- {
- name: 'edisendflag2',
- type: 'select',
- tip: '快递获取标记',
- placeholder: '快递获取标记',
- data: [{name: 'Y', value: '是'}, {name: 'N', value: '否'}, {name: 'W', value: '错误'},]
- },
- {
- name: 'edisendflag',
- type: 'select',
- tip: '接口回传标记',
- placeholder: '接口回传标记',
- data: [{name: 'Y', value: 'Y'}, {name: 'N', value: 'N'}, {
- name: 'W',
- value: 'W'
- }, {name: 'R', value: 'R'},]
- }
- ],
- [
- {name: 'codename_c_end', type: 'select', placeholder: '订单状态范围', data: this.codes},
- {
- name: 'orderdate_end', type: 'time', tip: ['选择显示指定日期的结束时间', '选择显示指定日期的结束时间'],
- rules: {
- date_relevance: {
- date: ['orderdate_start', 'orderdate_end'],
- relevance: 'addtime',
- killing: 'relevance',
- default: [31, 92, 183, 366]
- }
- }
- },
- {
- name: 'customerid', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的客户'],
- placeholder: ['货主', '定位或多选货主'], data: this.owners
- },
- {name: 'soreference5', type: 'input', tip: '可支持多快递单号,糊模查找需要在左边打上%符号', placeholder: '多快递单号'},
- {
- name: 'soreference1',
- type: 'input',
- tip: '支持多客户订单号精确和模糊查找,糊模查找需要在右边打上%符号,多单号可用逗号或者空格分隔',
- placeholder: '客户订单号'
- },
- {name: 'waveno', type: 'input', tip: '可支持多波次编号,模糊查找需要在左边打上%的符号', placeholder: '波次编号'},
- {name: 'alternate_sku1', type: 'input', tip: '产品条码,模糊查找需要在左边打上%的符号', placeholder: '产品条码'},
- {name: 'c_contact', type: 'input', tip: '可支持多收货人名称:15天以内模糊搜索,15天以外精确搜索', placeholder: '收货人名称'},
- ],
- [
- {name: 'c_tel2', type: 'input', tip: '收货人电话:15天以内模糊搜索,15天以外精确搜索', placeholder: '收货人电话'},
- {name: 'c_province', type: 'input', tip: '省:15天以内模糊搜索,15天以外精确搜索', placeholder: '省'},
- {name: 'c_city', type: 'input', tip: '市:15天以内模糊搜索,15天以外精确搜索', placeholder: '市'},
- {name: 'c_district', type: 'input', tip: '区:15天以内模糊搜索,15天以外精确搜索', placeholder: '区'},
- {
- name: 'releasestatus',
- type: 'select',
- tip: '是否冻结冻结',
- placeholder: '是否冻结',
- data: [{name: 'H', value: '是'}, {name: 'N', value: '否'}]
- },
- {name: 'checktime_start', type: 'time', tip: ['选择显示复核时间的起始日期', "选择显示复核时间的起始时间"]},
- {name: 'checktime_end', type: 'time', tip: ['选择显示复核时间的结束日期', '选择显示复核时间的结束时间']},
- {
- name: 'is_display_all',
- type: 'checkbox',
- tip: '是否隐藏装箱完成以后的状态',
- data: [{name: 'ture', value: '隐藏完成状态'}]
- },
- ],
- [
- {
- name: 'restrict_time',
- type: 'select',
- tip: '查询限定时间范围',
- placeholder: '查询时间范围',
- data: [{name: '1', value: '一天内'}, {name: '7', value: '一周内'}, {
- name: "30",
- value: "一月内"
- }, {name: "90", value: "本季度"}]
- },
- {
- name: 'manualflag',
- type: 'select',
- tip: '是否人工回传',
- placeholder: '是否人工回传',
- data: [{name: 'Y', value: '是'}, {name: 'N', value: '否'}]
- },
- /*{name: 'delayedDeliver', type: 'input', tip: 'M:延时发货,填写整数,单位/时', placeholder: '历史延时发货'},*/
- {name: 'presentDelayed', type: 'input', tip: 'M:延时发货,填写整数,单位/时', placeholder: '延时发货'},
- ],
- ];
- this.form = new query({
- el: "#form_div",
- condition: data,
- appendDom: "btn",
- });
- this.form.init();
- let column = [
- {name: 'index', value: '序号', neglect: true},
- {name: 'orderno', value: '编号'},
- {name: 'ordercodename', value: '订单状态'},
- {name: 'addtime', value: '接口下发时间'},
- {name: 'issuepartyname', value: '店铺名称'},
- {name: 'customer_descr_c', value: '客户'},
- {name: 'soreference1', value: '客户订单号'},
- {name: 'carriername', value: '承运人'},
- {name: 'soreference5', value: '快递单号'},
- {name: 'c_contact', value: '收货人名称'},
- {name: 'c_tel2', value: '收货人电话'},
- {name: 'c_province', value: '省'},
- {name: 'c_city', value: '市'},
- {name: 'c_district', value: '区'},
- {name: 'c_address1', value: '收货人地址'},
- {name: 'waveno', value: '波次编号'},
- {name: 'warehouseid', value: '仓库'},
- {name: 'edisendflag2', value: '快递获取标记'},
- {name: 'edisendtime2', value: '快递获取时间'},
- {
- name: "commodity", type: "multi", title: "商品信息", rows: [
- {value: "商品编码", col: "2"},
- {value: "商品条码", col: "2"},
- {value: "商品名称", col: "2"},
- {value: "订单数量", col: "1"},
- {value: "批次号", col: "2"},
- {value: "明细状态", col: "1"},
- {value: "复核时间", col: "2"}
- ]
- },
- {name: 'notes', value: '备注'},
- {name: 'manualflag', value: '人工回传标记'},
- {name: 'erpcancelflag', value: '接口取消标记'},
- {name: 'picking_print_flag', value: '拣货单打印标记'},
- {name: 'edisendflag', value: '接口回传标记'},
- {name: 'ediremarks2', value: '接口回传异常备注'},
- {name: 'update', value: '订单冻结', neglect: true},
- {name: 'remove', value: '取消分配', neglect: true},
- ];
- new Header({
- el: "table",
- name: "order",
- column: column,
- data: this.orders,
- restorationColumn: 'addtime',
- fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
- }).init();
- },
- watch: {
- result_explain: function () {
- this.setLogisticInfo();
- this.setMerchantInfo();
- },
- 'workOrder.orderIssueType':function(newValue){
- if (newValue === null) return;
- if (['破损','错漏发','快递异常'].includes(newValue)){
- this.fillWorkOrderCommodity();
- }
- },
- },
- computed:{
- },
- methods: {
- initData() {
- this.orders.forEach((order) => {
- if (order.c_contact && order.c_contact.length > 50 && order.c_contact.substring(0, 3) === '~Ag') order.is_encryption = true;
- });
- let start = "{{$request["orderdate_start"] ?? ''}}";
- let end = "{{$request["orderdate_end"] ?? ''}}";
- let time = "{{$request["restrict_time"] ?? ''}}";
- if (time)this.changeURLParam("restrict_time", time);
- if (start)this.changeURLParam("orderdate_start", start);
- if (end)this.changeURLParam("orderdate_end", end);
- },
- changeURLParam(name, value) {
- let url = document.URL, resultUrl = ''
- let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
- let r = window.location.search.substr(1).match(reg);
- let replaceText = name + '=' + value;
- if (r != null) {
- let tmp = url.replace(name + '=' + r[2], replaceText);
- resultUrl = (tmp);
- } else {
- if (url.match('[\?]')) {
- resultUrl = url + '&' + replaceText;
- } else {
- resultUrl = url + '?' + replaceText;
- }
- }
- history.replaceState(null, null, resultUrl)
- },
- getQueryVariable(variable) {
- let query = window.location.search.substring(1);
- let vars = query.split("&");
- for (let i = 0; i < vars.length; i++) {
- let pair = vars[i].split("=");
- if (pair[0] == variable) {
- return pair[1];
- }
- }
- return (false);
- },
- pageUp() {
- if (this.page <= 1) return;
- this.href(this.page - 1);
- },
- pageDown() {
- if (this.page >= this.maxPage && this.maxPage !== 0) return;
- this.href(this.page + 1);
- },
- pageSkip(e) {
- if (Number(e.target.value) <= 0 || Number(e.target.value) > this.maxPage) {
- tempTip.setDuration(2000);
- tempTip.show('页数不存在! ');
- return
- }
- this.href(e.target.value);
- },
- href(page) {
- let url = document.URL;
- if (url.indexOf('page=' + this.page) !== -1) {
- url = url.replace("page=" + this.page, "page=" + page);
- } else {
- if (url.indexOf('?') === -1) url += "?page=" + page;
- else url += "&page=" + page;
- }
- window.location.href = url;
- },
- unfold(index) {
- this.$set(this.upList, index, this.upList[index] ? !this.upList[index] : true);
- $("#order-" + index).slideToggle();
- },
- orderExport(checkAllSign) {
- let url = '{{url('order/index/export')}}';
- let token = '{{ csrf_token() }}';
- excelExport(checkAllSign, checkData, url, this.sum, token, {is_merge: this.is_merge});
- },
- modal() {
- $("#myModal").modal('show');
- },
- //批量冻结
- freezeAll: function () {
- let _this = this;
- if (checkData.length === 0) {
- tempTip.show('没有勾选记录');
- return
- }
- if (!confirm("确定要标记所有勾选内容为'冻结'吗")) {
- return;
- }
- axios.post('{{url('order/freezeAll')}}', {checkData: checkData}).then(function (response) {
- if (response.data.success) {
- _this.orders.forEach(function (order) {
- checkData.forEach(function (checkedId) {
- if (order.orderno === checkedId) {
- order.releasestatus = 'H';
- order.waveno = '*';
- }
- });
- });
- tempTip.setDuration(1000);
- tempTip.showSuccess('标记勾选内容为冻结成功');
- } else {
- tempTip.setDuration(2500);
- tempTip.show('标记勾选内容冻结失败,错误:' + response.data.fail_info);
- }
- }).catch(function (e) {
- tempTip.setDuration(2500);
- tempTip.show('标记勾选内容冻结失败,网络连接错误:' + e);
- })
- },
- //订单分配
- allocation() {
- if (this.exeSign.allocation) return;
- if (checkData.length === 0) {
- tempTip.show('没有勾选记录');
- return;
- }
- let arr = [];
- checkData.forEach(no => {
- this.orders.some(order => {
- if (order.orderno === no) {
- let obj = {
- "status": order.sostatus,
- "number": order.soreference5,
- "warehouse": order.warehouseid,
- "code": order.orderno,
- };
- arr.push(obj);
- return true;
- }
- });
- });
- window.tempTip.confirm("确定要分配这些订单吗?", () => {
- this.exeSign.allocation = true;
- axios.post("{{url('order/allocation')}}", {list: arr}).then((res) => {
- tempTip.setDuration(3000);
- this.exeSign.allocation = false;
- switch (res.data.status) {
- case "success":
- tempTip.showSuccess('订单分配成功');
- setTimeout(function () {
- window.location.reload();
- }, 3000);
- break;
- case "fail":
- tempTip.show(res.data.msg);
- break;
- default:
- tempTip.confirm(res.data.msg, function () {
- window.location.reload();
- });
- }
- }).catch((e) => {
- this.exeSign.allocation = false;
- tempTip.setDuration(2500);
- tempTip.show('分配失败,预期之外的错误:' + e);
- })
- })
- },
- //批量取消分配
- deAllocationAll() {
- let _this = this;
- if (checkData.length === 0) {
- tempTip.show('没有勾选记录');
- return
- }
- if (!confirm("确定要所有勾选内容'取消分配'吗")) {
- return;
- }
- axios.post('{{url('order/deAllocationAll')}}', {checkData: checkData}).then(function (response) {
- if (response.data.success) {
- _this.orders.forEach(function (order) {
- checkData.forEach(function (checkedId) {
- if (order.orderno === checkedId) {
- order.sostatus = '00';
- order.waveno = '*';
- }
- });
- });
- tempTip.setDuration(1000);
- tempTip.showSuccess('标记勾选内容取消分配成功');
- window.location.reload();
- } else {
- tempTip.setDuration(2500);
- tempTip.show('标记勾选内容取消分配失败,错误:' + response.data.fail_info);
- }
- }).catch(function (e) {
- tempTip.setDuration(2500);
- tempTip.show('标记勾选内容取消分配失败,网络连接错误:' + e);
- })
- },
- batchComments() {
- let _this = this;
- if (checkData.length < 1 || !this.content) {
- $("#myModal").modal('hide');
- tempTip.setDuration(3000);
- if (checkData.length < 1) tempTip.showSuccess('没有勾选任何记录');
- else tempTip.showSuccess('没有输入任何内容');
- return;
- }
- axios.post('{{url('order/create/batchComments')}}', {checkData: checkData, content: this.content})
- .then(function (response) {
- let sign = [];
- _this.orders.every(function (order) {
- if (sign.length === response.data.length) return false;
- response.data.every(function (data) {
- if (order.orderno === data.orderno) {
- order.notes = data.notes;
- sign.push(order.orderno);
- return false;
- }
- return true;
- });
- return true;
- });
- tempTip.setDuration(3000);
- tempTip.showSuccess('注释完毕!')
- _this.content = '';
- }).catch(function (err) {
- tempTip.setDuration(4000);
- tempTip.show('网络错误:' + err)
- });
- $("#myModal").modal('hide');
- },
- selectedColor(orderno) {
- if (orderno == this.selectedStyle) return;
- this.selectedStyle = orderno;
- },
- freeze(orderno, waveno) {
- if (!confirm('确定要冻结“' + orderno + '”吗?')) return;
- let _this = this;
- axios.post('{{url('order/freeze')}}', {orderno: orderno, waveno: waveno})
- .then(function (response) {
- if (response.data.success) {
- _this.orders.some(function (order) {
- if (order.orderno === orderno) {
- order.releasestatus = 'H';
- order.waveno = '*';
- return true;
- }
- });
- tempTip.setDuration(3000);
- tempTip.showSuccess('订单已被冻结!');
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('网络异常:' + err);
- });
- },
- thaw(orderno = null, is_batch = false, order = null) {
- if (!orderno) orderno = checkData;
- if (!confirm('确定要解冻“' + orderno + '”吗?')) return;
- let _this = this;
- axios.post('{{url('order/thaw')}}', {orderno: orderno})
- .then(function (response) {
- if (response.data.success) {
- if (is_batch) {
- orderno.forEach(order_no => {
- _this.orders.some(function (order) {
- if (order.orderno === order_no) {
- order.releasestatus = 'N';
- return true;
- }
- });
- });
- } else {
- order.releasestatus = 'N';
- }
- tempTip.setDuration(3000);
- tempTip.showSuccess('订单已成功解冻!');
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('网络异常:' + err);
- });
- },
- deAllocation(orderno, waveno) {
- if (!confirm('确定要取消分配“' + orderno + '”吗?')) return;
- let _this = this;
- axios.post('{{url('order/deAllocation')}}', {orderno: orderno, waveno: waveno})
- .then(function (response) {
- if (response.data.success) {
- _this.orders.some(function (order) {
- if (order.orderno === orderno) {
- order.sostatus = '00';
- order.waveno = '*';
- return true;
- }
- });
- tempTip.setDuration(3000);
- tempTip.showSuccess('订单已被取消分配!');
- window.location.reload();
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('网络异常:' + err);
- });
- },
- isUnfold(order) {
- if (!order.is_unfold) {
- this.$set(order, 'is_unfold', true);
- return;
- }
- order.is_unfold = false;
- },
- orderIssueTag() {
- if (checkData.length === 0) {
- tempTip.setDuration(2000);
- tempTip.show('没有勾选记录');
- return;
- }
- this.isExistByOrderNos();
- },
- orderIssueTagSubmit() {
- if (this.typeId === '') {
- $("#orderIssueType").addClass('is-invalid');
- return;
- } else {
- $("#result_explain #result_explain").removeClass('is-invalid');
- $("#exampleModal").modal('hide');
- }
- let _this = this;
- tempTip.setDuration(1999);
- tempTip.waitingTip('处理中,请稍候');
- let data = {orderNos: checkData, typeId: this.typeId, result_explain: this.result_explain};
- axios.post("{{url('apiLocal/order/issue/orderIssueTag')}}", data).then(function (res) {
- tempTip.setDuration(5000);
- tempTip.cancelWaitingTip();
- if (res.data.success) {
- tempTip.setDuration(3000);
- tempTip.showSuccess('已标记为问题件');
- _this.orders.forEach(item => {
- if (checkData.includes(item.orderno)) item.is_order_issue = true;
- });
- } else {
- if (res.data.exitsOrderNos) {
- _this.message.checkOrderIssueMessage = res.data.fail_info + res.data.exitsOrderNos;
- $("#checkModal").modal('show');
- } else {
- tempTip.setDuration(3000);
- tempTip.show(res.data.fail_info);
- }
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.cancelWaitingTip();
- tempTip.show('网络链接异常' + err);
- })
- },
- //重置快递获取标记
- resetLogisticsGetMark() {
- if (checkData.length < 1) {
- tempTip.setDuration(3000);
- tempTip.showSuccess('未选择任何单号');
- return
- }
- if (!confirm('确定要重置这些单的快递获取标记吗?')) return;
- let url = '{{url('order/resetLogisticsGetMark')}}';
- let _this = this;
- axios.post(url, {orderno: checkData})
- .then(function (response) {
- if (response.data.success) {
- checkData.forEach(orderno => {
- _this.orders.some(order => {
- if (order.orderno === orderno && order.edisendflag2 === 'W') {
- order.edisendflag2 = "N";
- return true;
- }
- });
- });
- tempTip.setDuration(2000);
- tempTip.showSuccess('重置快递获取标记成功!');
- } else {
- tempTip.setDuration(3000);
- tempTip.show(response.data.data);
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show("网络错误:" + err)
- })
- },
- resetInterfaceReturnMark() {
- if (checkData.length < 1) {
- tempTip.setDuration(3000);
- tempTip.showSuccess('未选择任何单号');
- return
- }
- if (!confirm('确定要重置接口回传标记吗?')) return;
- let url = '{{url('order/resetInterfaceReturnMark')}}';
- let _this = this;
- axios.post(url, {orderno: checkData}).then(function (response) {
- if (response.data.success) {
- checkData.forEach(orderno => {
- _this.orders.some(order => {
- if (order.orderno === orderno) {
- order.edisendflag = "N";
- return true;
- }
- });
- });
- tempTip.setDuration(2000);
- tempTip.showSuccess('重置接口回传标记成功!');
- } else {
- tempTip.setDuration(5000);
- tempTip.show(response.data.fail_info);
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show("网络错误:" + err)
- });
- },
- changeRemark() {
- this.typeId = '';
- this.result_explain = '';
- },
- focusOnModal(e) {
- $(e.target).removeClass('is-invalid');
- },
- isRejectedBillExist() {
- if (checkData.length === 0) {
- tempTip.show('没有勾选记录');
- return
- }
- tempTip.confirm("是否要生成“" + checkData + "”的退货单?", () => {
- let _this = this;
- let arr = [];
- window.tempTip.setDuration(9999);
- window.tempTip.waitingTip("生成中,请稍等......")
- this.orders.forEach(order => {
- if (checkData.includes(order.orderno)) arr.push(order.soreference1);
- });
- axios.post('{{url('order/isRejectedBillExist')}}', {data: arr})
- .then(function (response) {
- if (!response.data.success) {
- tempTip.confirm(response.data.data + ',已存在,是否仍要生成退货单?', function () {
- _this.createRejectedBill();
- window.tempTip.cancelWaitingTip();
- }, function () {
- window.tempTip.cancelWaitingTip();
- });
- return;
- }
- _this.createRejectedBill();
- }).catch(function (error) {
- tempTip.setDuration(3000);
- tempTip.cancelWaitingTip();
- tempTip.show('网络错误:' + error);
- });
- });
- },
- createRejectedBill() {
- let url = '{{url('order/createRejectedBill')}}';
- axios.post(url, {data: checkData})
- .then(res => {
- if (res.data.success) {
- tempTip.cancelWaitingTip();
- tempTip.setDuration(2000);
- tempTip.showSuccess("生成退货单成功!");
- } else {
- tempTip.cancelWaitingTip();
- tempTip.setDuration(3000);
- tempTip.show(res.data.data);
- }
- })
- .catch(err => {
- tempTip.cancelWaitingTip();
- tempTip.setDuration(3000);
- tempTip.show('网络错误:' + err);
- });
- },
- isExistByOrderNos() {
- let orderNos = checkData;
- let data = {orderNos: orderNos};
- let _this = this;
- axios.post("{{url('apiLocal/order/issue/isExistByOrderNo')}}", data).then(function (res) {
- if (res.data.success) {
- _this.getTagOrder(orderNos);
- $("#exampleModal").modal('show')
- } else {
- _this.message.checkOrderIssueMessage = res.data.fail_info
- $("#checkModal").modal('show')
- }
- }).catch(function (error) {
- tempTip.setDuration(3000)
- tempTip.show('网络异常:' + error)
- })
- },
- replaceText(index) {
- this.$set(this.orders[index], "replaceText", true);
- },
- getTagOrder(orderNos) {
- this.tagOrders = [];
- if (orderNos.length === 0) {
- this.tagOrders = [];
- return;
- }
- if (this.orders.length === 0) {
- this.tagOrders = [];
- return;
- }
- for (let i = 0; i < this.orders.length; i++) {
- let order = this.orders[i];
- let orderno = order.orderno;
- if (orderNos.includes(orderno)) {
- this.tagOrders.push(this.orders[i])
- }
- }
- this.setLogisticInfo();
- this.setMerchantInfo();
- },
- setLogisticInfo() {
- let content = ''
- let _this = this
- this.tagOrders.forEach(order => {
- content += _this.getOrderLogisticNumbers(order);
- let tel = order.c_tel2 ? order.c_tel2 : order.c_tel1;
- content += ' ' + order.c_contact + tel + order.c_province + order.c_city + ' ' + order.c_district + order.c_address1 + '\n' + _this.result_explain + "\n"
- })
- this.tagOrder.logisticInfo = content
- },
- setMerchantInfo() {
- let content = ''
- let _this = this
- this.tagOrders.forEach(order => {
- content += order.issuepartyname + ' ' + order.customer_descr_c + ' ' + order.soreference1 + ' ' + _this.getOrderLogisticNumbers(order)
- content += '\n' + _this.result_explain + "\n"
- })
- this.tagOrder.merchantInfo = content
- },
- copyLogisticInfo() {
- this.copyText(this.tagOrder.logisticInfo)
- },
- copyLogisticNumber() {
- let text = "";
- checkData.forEach((code, i) => {
- if (this.picktotraceidMap[code] && this.picktotraceidMap[code].length > 1) {
- this.picktotraceidMap[code].forEach((number, j) => {
- text += number + "\r\n";
- });
- } else {
- this.orders.some(order => {
- if (order.orderno == code) {
- if (order.soreference5) {
- text += order.soreference5 + "\r\n";
- }
- return true;
- }
- });
- }
- });
- text.substring(0, text.lastIndexOf("\r\n", text));
- if (!text) text = " ";
- this.copyText(text)
- },
- copyMerchantInfo() {
- this.copyText(this.tagOrder.merchantInfo)
- },
- copyText(text) {
- try {
- $('#clipboardDiv').text(text).select().focus();
- document.execCommand("Copy");
- tempTip.setIndex(1052)
- tempTip.setDuration(2000)
- tempTip.showSuccess('复制成功')
- } catch (e) {
- tempTip.setIndex(1052)
- tempTip.setDuration(2000)
- tempTip.showSuccess('复制失败:' + e)
- }
- },
- getOrderLogisticNumbers(order) {
- let char = '';
- let picktotraceids = this.picktotraceidMap[order.orderno];
- if ($.type(picktotraceids) === 'array') {
- picktotraceids.forEach(function (picktotraceid, index, array) {
- if (array.length === index + 1) char += picktotraceid;
- else char += picktotraceid + ','
- });
- } else {
- char += order.soreference5
- }
- return char;
- },
- checkWorkOrderOrCreateWorkOrder(){
- window.tempTip.setIndex(1999);
- window.tempTip.waitingTip('校验是否有对应工单');
- this.checkWorkOrder().then(res=>{
- window.tempTip.cancelWaitingTip();
- if (res) {
- window.tempTip.confirm('当前勾选订单已有工单是否查看',()=>{
- this.workOrderInfo = this.workOrderInfos[0];
- this.workOrderIndex = 0;
- $('#work-order-info').modal('show');
- },()=>{
- this.showInterceptModel();
- },'查看','重新生成工单');
- } else {
- this.showInterceptModel();
- }
- }).catch(err=>{
- window.tempTip.cancelWaitingTip();
- })
- },
- showCreateWorkOrder(){
- $("#work-order-info").modal('hide');
- $("#intercept-modal").modal('show');
- },
- showInterceptModel() {
- if (checkData.length < 1) {
- window.tempTip.setDuration(1500);
- window.tempTip.show('未选中任何订单');
- return;
- }
- this.workOrder.orderIssueType = null;
- this.workOrder.price = null;
- this.workOrder.type = null;
- this.workOrder.refundImages = [];
- this.workOrder.packageImages = [];
- this.workOrder.commodityImages = [];
- this.workOrder.dealImages = [];
- this.workOrder.remark.info = '';
- this.workOrder.commodities = [];
- this.workOrder.logistic_number = null;
- $("#intercept-modal").modal('show');
- },
- checkOrderIssue(name) { //
- let types = this.orderIssueType.filter(item => {
- return item.name === name;
- });
- if (types.length === 0) return false;
- return this.workOrder.orderIssueType === types[0].id
- },
- pushImagesAndShow(e, images) {
- let map = [];
- for (let i = 0; i < e.target.files.length; i++) {
- let image = e.target.files[i];
- if (this.imageExist(image,images)) {
- map.push(image.name);
- continue;
- }
- let src = window.URL.createObjectURL(image);
- images.push({src: src, file: image});
- }
- e.target.value = '';
- if (map.length === 0)return ;
- window.tempTip.setIndex(1999);
- window.tempTip.show(map.join('\n,')+'图片重复');
- },
- imageExist(image,images) {
- let arr = images.filter(item => {
- return item.file.name === image.name;
- });
- return arr.length > 0;
- },
- spliceImage(i, images) {
- if (!confirm('是否取消选择该图片')) return;
- images.splice(i, 1);
- },
- buildWorkOrder() { // 生成工单
- if (['信息更改', '错漏发', '破损'].includes(this.workOrder.orderIssueType) && checkData.length !== 1) {
- window.tempTip.show('该类型不能批量操作');
- return;
- }
- if ('拦截' === this.workOrder.orderIssueType) {
- this.createInterceptWorkOrder();
- } else if ('信息更改' === this.workOrder.orderIssueType) {
- this.createInformationChangeWorkOrder();
- } else if ('快递丢件' === this.workOrder.orderIssueType) {
- this.createLossWorkOrder();
- } else if ('快递异常' === this.workOrder.orderIssueType) {
- this.createExpressAbnormalWorkOrder();
- } else if ('错漏发' === this.workOrder.orderIssueType) {
- this.createMistakeWorkOrder();
- } else if ('破损' === this.workOrder.orderIssueType) {
- this.createDamagedWorkOrder();
- } else if('取消拦截') {
- this.createCancelInterceptWorkOrder();
- }
- },
- createInterceptWorkOrder() { // 拦截
- let formData = new FormData();
- let url = null;
- if(checkData.length===1){
- formData.append('order_no',checkData[0]);
- formData.append('remark',this.workOrder ? (this.workOrder.remark ? this.workOrder.remark.info : '') : '');
- url = "{{route('workOrder.intercept.storeApi')}}";
- } else if (checkData.length > 1){
- checkData.forEach(e=>formData.append('order_nos[]',e));
- formData.append('remark',this.workOrder ? (this.workOrder.remark ? this.workOrder.remark.info : '') : '');
- url = "{{route('workOrder.intercept.BatchStoreApi')}}";
- }
- this.createWorkOrder(formData,url);
- },
- createCancelInterceptWorkOrder(){
- let formData = new FormData();
- formData.append('order_no',checkData[0]);
- formData.append('remark',this.workOrder ? (this.workOrder.remark ? this.workOrder.remark.info : '') : '');
- let url = "{{route('workOrder.cancelIntercept.storeApi')}}";
- this.createWorkOrder(formData,url);
- },
- createInformationChangeWorkOrder() { // 信息修改
- let data = this.getCreateWorkOrderData();
- if (data.length > 1){
- window.tempTip.setIndex(1999);
- window.tempTip.show('信息修改仅支持单个订单修改');
- return ;
- }
- data = data[0];
- if (!data.remark){
- window.tempTip.setIndex(1999);
- window.tempTip.show('收方信息不能为空');
- return ;
- }
- let url = "{{route('workOrder.informationChange.storeApi')}}";
- this.createWorkOrder(data,url);
- },
- createLossWorkOrder(){ // 快递丢件
- let data = this.getCreateWorkOrderData();
- let formData = new FormData();
- formData.append('order_no', data[0]['order_no']);
- formData.append('remark', this.workOrder.remark.info);
- let url = "{{route('workOrder.loss.storeApi')}}";
- this.createWorkOrder(formData,url);
- },
- createExpressAbnormalWorkOrder(){ // 快递异常
- if (!this.checkExpressAbnormalWorkOrder()) return;
- let data = this.getCreateWorkOrderData();
- let formData = new FormData();
- formData.append('order_no', data[0]['order_no']);
- formData.append('remark', this.workOrder.remark ? this.workOrder.remark.info : '');
- formData.append('type', this.workOrder.type);
- formData.append('process_progress', this.workOrder.type);
- let dealImages = this.getImages(this.workOrder.dealImages);
- this.setFormDataImagePrefix(formData, 'dealImages', dealImages);
- let res = this.setFormDataCommodities(formData);
- if (!res){
- window.tempTip.setIndex(2000);
- window.tempTip.setDuration(1500);
- window.tempTip.show('请勾选快递单号!');
- return
- }
- let url = "{{route('workOrder.expressAbnormal.storeApi')}}";
- this.createWorkOrder(formData, url);
- },
- createMistakeWorkOrder() { // 错漏发
- let data = this.getCreateWorkOrderData();
- let formData = new FormData();
- formData.append('order_no', data[0]['order_no']);
- formData.append('remark', data[0]['remark']);
- if (data[0]['logistic_number']){
- formData.append('logistic_number', data[0]['logistic_number']);
- }
- let dealImages = this.getImages(this.workOrder.dealImages);
- this.setFormDataImagePrefix(formData, 'dealImages', dealImages);
- let res = this.setFormDataCommodities(formData);
- if (!res){
- window.tempTip.setIndex(2000);
- window.tempTip.setDuration(1500);
- window.tempTip.show('检查是否所有商品为为错漏发');
- return
- }
- let url = "{{route('workOrder.mistake.storeApi')}}";
- this.createWorkOrder(formData, url);
- },
- createDefaultWorkOrder() { // 其他
- let data = this.getCreateWorkOrderData();
- this.createWorkOrder(data);
- },
- createDamagedWorkOrder() { //破损工单创建
- let packageImages = this.getImages(this.workOrder.packageImages); // 外包装破损图片
- let commodityImages = this.getImages(this.workOrder.commodityImages); // 内物破损图片
- let dealImages = this.getImages(this.workOrder.dealImages); // 交易截图
- if (!this.checkDamagedWorkOrder(packageImages,commodityImages,dealImages)) return;
- let formData = this.getDamagedFormData(packageImages,commodityImages,dealImages);
- if (this.workOrder.return_logistic_number){
- formData.append('return_logistic_number',this.workOrder.return_logistic_number);
- }
- let url = "{{route('workOrder.damage.storeApi')}}";
- this.createWorkOrder(formData, url);
- },
- checkWorkOrderImage(packageImages,commodityImages,dealImages) {
- let message = null;
- if (0 === packageImages.length) {
- message = '请选择外包图片';
- } else if (0 === commodityImages.length) {
- message = '请选择内物装破损图片';
- } else if (0 === dealImages.length && this.isBaoShi === false) {
- message = '请选择交易截图'
- }
- return message;
- },
- getDamagedFormData(packageImages,commodityImages,dealImages){
- let formData = new FormData();
- let data = this.getCreateWorkOrderData();
- formData.append('order_no', data[0]['order_no']);
- formData.append('remark', data[0]['remark']);
- if (data[0]['logistic_number']){
- formData.append('logistic_number', data[0]['logistic_number']);
- }
- formData.append('price', this.workOrder.price);
- this.setFormDataImagePrefix(formData,'packageImages',packageImages);
- this.setFormDataImagePrefix(formData,'commodityImages',commodityImages);
- this.setFormDataImagePrefix(formData,'dealImages',dealImages);
- this.workOrder.commodities = this.workOrder.commodities.filter(e=>{
- return Number(e.abnormal_amount) > 0;
- });
- this.setFormDataCommodities(formData);
- return formData;
- },
- setFormDataCommodities(formData){
- let {orderIssueType} = this.workOrder;
- let commodities= this.workOrder.commodities.filter(e=>{
- if('错漏发' === orderIssueType){
- return e.amount !== e.abnormal_amount;
- } else if('快递异常' === orderIssueType){
- return e.selected;
- }
- return true;
- }).map(e=>{
- let {abnormal_type,sku,amount,abnormal_amount,logistic_number,commodity_id,price} = e;
- return {
- sku:sku,
- amount:amount,
- commodity_id:commodity_id,
- logistic_number:logistic_number,
- abnormal_amount:abnormal_amount,
- abnormal_type:abnormal_type,
- price:price,
- };
- });
- if ('错漏发' === orderIssueType && commodities.length === 0) return false;
- else if ('快递异常' === orderIssueType && commodities.length === 0) return false;
- commodities.forEach(e=>{
- formData.append('commodities[]',JSON.stringify(e));
- })
- return true;
- },
- setFormDataImagePrefix(formData, prefix, images) {
- images.forEach((item) => {
- formData.append(`${prefix}[]`, item);
- });
- },
- getImages(images) {
- return images.map((item) => {
- return item.file;
- })
- },
- checkDamagedWorkOrder(packageImages,commodityImages,dealImages){
- let message = null;
- if (!this.checkPrice()){
- message = '商品价值需大于0';
- }
- if (!message){
- message = this.checkWorkOrderImage(packageImages,commodityImages,dealImages);
- }
- let filter = this.workOrder.commodities.filter(e=>{
- return Number(e.price) <=0 || Number(e.abnormal_amount) <= 0;
- })
- if (filter.length > 0 && !this.isBaoShi){
- message = '破损商品的数量和价格不能为0';
- }
- if (message){
- window.tempTip.setIndex(1999);
- window.tempTip.show(message);
- return false;
- }
- return true;
- },
- checkPrice(){
- return parseInt(this.workOrder.price) !== 0;
- },
- createWorkOrder(data, url) {
- window.tempTip.setIndex(1999);
- window.tempTip.waitingTip('生成工单中');
- window.axios.post(url, data, {'Content-Type': 'multipart/form-data'}).then(res => {
- window.tempTip.cancelWaitingTip();
- if (res.data.success) {
- window.tempTip.showSuccess('工单生成成功');
- $('#intercept-modal').modal('hide');
- this.tagWorkOrders(checkData);
- } else {
- if (res.data.errors){
- for (const resKey in res.data.errors) {
- window.tempTip.show(res.data.errors[resKey]);
- return ;
- }
- }else{
- window.tempTip.show(res.data.message ? res.data.message : '工单创建异常');
- }
- }
- }).catch(err => {
- window.tempTip.cancelWaitingTip();
- window.tempTip.show(err)
- });
- },
- tagWorkOrders(orderNos){
- this.orders.forEach((item)=>{
- if (orderNos.includes(item.orderno)){
- item['is_work_order'] = true;
- }
- })
- },
- clearWorkOrder(){
- this.workOrder.packageImages = [];
- this.workOrder.dealImages = [];
- this.workOrder.commodities = [];
- this.workOrder.price = '';
- this.workOrder.logisticNumber = '';
- this.workOrder.orderIssueType = 0;
- },
- getCreateWorkOrderData() {
- return checkData.map(item => {
- return {
- order_no: item,
- order_issue_type: this.workOrder.orderIssueType,
- remark: this.workOrder.remark.info,
- };
- });
- },
- changeReceiveInfo() {
- let url = '{{url('apiLocal/workOrder/editOrderReceiveInfo')}}';
- let data = {
- order_nos: checkData[0],
- remake: `${this.remark.name} ${this.remark.phone} ${this.remark.province} ${this.remark.city} ${this.remark.city} ${this.remark.district} ${this.remark.adder}`,
- };
- window.tempTip.setIndex('1999');
- window.axios.post(url, data).then(res => {
- if (res.data.success) {
- window.tempTip.showSuccess('生成修改工单成功');
- $('#intercept-modal').modal('hide');
- } else {
- window.tempTip.show(res.data.message);
- }
- }).catch(err => {
- window.tempTip.show(err);
- });
- },
- manualBack() {
- let _this = this;
- let orders = [];
- let fail = [];
- let isGreater = false;
- const start = new Date(new Date(new Date().toLocaleDateString()).getTime() + 16 * 60 * 60 * 1000 + 30 * 60 * 1000);
- if (checkData.length === 0) {
- tempTip.show('没有勾选记录');
- return;
- }
- _this.orders.forEach(function (order) {
- if (new Date(new Date(order.addtime).getTime()) > start) isGreater = true;
- checkData.forEach(function (checkedId) {
- if (order.orderno === checkedId) {
- if (order.soreference5 //存在快递单号
- && order.releasestatus != 'H' //订单未冻结
- && order.manualflag == 'N' //订单未回传
- && (order.sostatus == '00' ||
- order.sostatus == '10' ||
- order.sostatus == '20' ||
- order.sostatus == '40' ||
- order.sostatus == '50' ||
- order.sostatus == '60' ||
- order.sostatus == '61')//订单状态为 创建订单,部分预配,预配完成,分配完成,部分拣货,拣货完成,或播种完成
- ) {
- orders.push(order.orderno);
- } else {
- fail.push(order.orderno)
- }
- }
- });
- });
- let failText = '';
- fail.forEach(function (item) {
- failText += item + ','
- });
- if (isGreater) {
- if (!confirm('订单中包含16:30以后推送的订单,有超时揽收风险,是否确定操作?')) return;
- } else {
- if (!confirm('提前回传订单将无法取消,是否确定操作?')) return;
- }
- let url = '{{url('order/manualBack')}}';
- window.axios.post(url, {ordernos: orders})
- .then(res => {
- if (res.data.success) {
- _this.orders.forEach(function (order) {
- res.data.successNo.forEach(function (success_item) {
- if (order.orderno == success_item) {
- if (order.sostatus == '00'
- || order.sostatus == '10'
- || order.sostatus == '20') {
- order.ordercodename = '分配完成';
- }
- order.manualflag = 'Y';
- }
- })
- })
- res.data.failNo.forEach(function (item) {
- failText += item + ','
- });
- if (failText.length > 0) {
- failText = failText.substr(0, failText.length - 1);
- }
- window.tempTip.setDuration(4000);
- window.tempTip.showSuccess('回传成功!' + ' 单号:' + failText + '不满足回传条件,系统已自动筛除');
- this.$forceUpdate();
- return;
- }
- window.tempTip.setDuration(3000);
- window.tempTip.show('人工回传失败');
- }).catch(err => {
- window.tempTip.setDuration(3000);
- window.tempTip.show("网络错误:" + err);
- });
- },
- isDB(item) {
- if (item.indexOf('德邦') == -1 || item.indexOf('京东') == -1) return false;
- return true;
- },
- collectUpload(){
- if(checkData.length===0){tempTip.show('没有勾选记录');return;}
- const data = {
- 'orderno': checkData,
- 'strict': false,
- };
- window.axios.post("{{url('order/collectUpload')}}", data).then(res => {
- if (res.data.success) {
- tempTip.showSuccess(res.data.message)
- }else {
- tempTip.show(res.data.error_message);
- }
- });
- },
- fillWorkOrderCommodity(){
- let url = "{{route('order.commodity.getCommoditiesApi')}}";
- let data = {orderNo:checkData[0]};
- window.axios.post(url,data).then(res=>{
- if (res.data.success){
- if(this.workOrder.orderIssueType === '快递异常'){
- let logistic_numbers = res.data.data.map(e=>e.logistic_number);
- let array = Array.from(new Set(logistic_numbers));
- array = array.map(e=>{return {logistic_number:e,selected:false}});
- this.workOrder.commodities = array;
- return ;
- }
- let commodities = res.data.data.map(item=>{
- item.abnormal_amount = item.amount;
- item.abnormal_type = this.workOrder.orderIssueType === '错漏发' ? '未错漏发' : '';
- item.price = 0;
- return item;
- });
- this.groupByLogisticNumber(commodities);
- this.workOrder.commodities = commodities;
- } else {
- }
- }).catch(err=>{
- })
- },
- groupByLogisticNumber(commodities){
- let index = 0;
- let logistic_number = commodities[0]['logistic_number'];
- let count = 0;
- for(let i = 0; i < commodities.length;i++){
- let cur_logistic_number = commodities[i]['logistic_number'];
- if (cur_logistic_number === logistic_number){
- count ++;
- commodities[index]['count'] = count;
- } else if (cur_logistic_number !== logistic_number){
- logistic_number = cur_logistic_number;
- commodities[index]['count'] = count;
- index = i ;count = 1;
- commodities[index]['count'] = count;
- }
- }
- },
- pasteImage(event,imageArray){
- for (let i = 0; i < event.clipboardData.items.length; i++) {
- let item = event.clipboardData.items[i];
- if (item.kind === 'string') continue;
- if (item.type.indexOf('image') === -1) continue;
- if (item.kind === 'file'){
- let blob = item.getAsFile();
- let src = null;
- this.blobToBase64(blob).then(res => {
- src = res;
- imageArray.push({src:src,file:blob});
- });
- }
- }
- event.preventDefault();
- },
- blobToBase64(blob) {
- return new Promise((resolve, reject) => {
- const fileReader = new FileReader();
- fileReader.onload = (e) => {
- resolve(e.target.result);
- };
- fileReader.readAsDataURL(blob);
- fileReader.onerror = () => {
- reject(new Error('blobToBase64 error'));
- };
- });
- },
- checkWorkOrder(){
- return new Promise((resolve, reject)=>{
- let no = checkData;
- let url = '{{route('workOrder.checkApi')}}';
- window.axios.post(url,{no:no}).then(res=>{
- if (res.data.success){
- this.workOrderInfos = [];
- res.data.data.forEach(e=>{
- let array = this.conversionWorkOrder(e);
- this.workOrderInfos.push(...array);
- });
- if (this.workOrderInfos.length>0)resolve(true) ;
- else resolve(false);
- } else {
- this.workOrderInfos = [];
- resolve(false);
- }
- }).catch(err=>{
- reject(err);
- });
- });
- },
- conversionWorkOrder(workOrder){
- let items = [];
- workOrder.details.forEach(detail=>{
- let item = this.conversionDetail(detail);
- item.logistic_numbers = this.getLogisticNumbers(workOrder);
- item.clientCode = workOrder.order ? workOrder.order.client_code : '';
- items.push(item);
- });
- return items;
- },
- conversionDetail(detail){
- return {
- type: detail.issue_type ? detail.issue_type.name : '',
- detail:{
- price:detail.price,
- return_logistic_number:detail.return_logistic_number,
- reissue_logistic_number:detail.reissue_logistic_number,
- },
- commodities:this.getCommodities(detail),
- packagesImages:this.getImageList(detail.images,'外包装图片'),
- commodityImages:this.getImageList(detail.images,'内物破碎图片'),
- dealImages:this.getImageList(detail.images,'交易截图'),
- refundImages:this.getImageList(detail.images,'退款成功截图'),
- remark:detail.remark,
- issue_name : detail.issue_type ? detail.issue_type.name : '',
- };
- },
- getLogisticNumbers(workOrder){
- let packages = workOrder? (workOrder.order ? workOrder.order.packages : []) : [] ;
- return packages.map(e=>{return e.logistic_number});
- },
- getDetails(workOrder){
- let details = workOrder ? workOrder.details : [];
- return details.map(e=>{return e;});
- },
- getCommodities(detail){
- return (detail ? detail.commodities : []).map(item=>{
- item.name =item.commodity ? item.commodity.name :'';
- return item;
- });
- },
- getImageList(images,type){
- let filePrefix = "{{asset("/storage")}}";
- let imageList = images.filter(e=>{
- return parseInt(e.type) === parseInt(type);
- });
- return imageList.map(e=>{
- return {
- src:filePrefix+(e.upload_file ? e.upload_file.url : '')+'.'+(e.upload_file? e.upload_file.type : ''),
- };
- });
- },
- selectWorkOrderIndex(index){
- if (index < 0)index = this.workOrderInfos.length-1;
- if (index >= this.workOrderInfos.length) index = 0;
- this.workOrderIndex = index;
- this.workOrderInfo = this.workOrderInfos[index];
- },
- showParentWorkOrder(){
- if (parseInt(this.workOrderIndex) === 0) return false;
- return this.workOrderIndex < this.workOrderInfos -1;
- },
- showNextWorkOrder(){
- if (parseInt(this.workOrderIndex) === (this.workOrderInfos.length -1)) return false;
- return this.workOrderIndex < this.workOrderInfos.length -1;
- },
- addWorkOrderCommodity(){
- window.tempTip.setIndex(1999);
- window.tempTip.setDuration(1500);
- let sku = this.$refs['add-commodity-sku'].value;
- let logistic_number = this.$refs['add-commodity-logistic-number'].value;
- if (logistic_number.trim().length === 0){
- window.tempTip.show('填写快递单号');
- return ;
- }
- let {customerid} = this.orders.find((item)=>{
- return item.orderno === checkData[0];
- });
- this.getCommodity(customerid,sku).then(res => {
- if (res===null){
- window.tempTip.show('请检查商品条码');
- } else {
- this.workOrder.commodities.push({
- logistic_number:logistic_number,
- commodity_id:res.id,
- name:res.name,
- abnormal_type:"错发",
- amount:0,
- sku:this.$refs['add-commodity-sku'].value,
- abnormal_amount:this.$refs['add-commodity-number'].value,
- });
- this.countByCommodities(this.workOrder.commodities);
- this.$refs['add-commodity-logistic-number'].value = "";
- this.$refs['add-commodity-sku'].value = "";
- this.$refs['add-commodity-number'].value = "";
- window.tempTip.showSuccess("添加成功");
- }
- }).catch(err=>{
- window.tempTip.show("获取商品信息异常");
- });
- },
- getCommodity(owner,code){
- return new Promise((resolve, reject) => {
- let url = "{{route('commodity.getCommodityApi')}}";
- let data = {owner_code:owner,sku:code};
- console.log(data);
- window.axios.post(url,data).then(res=>{
- if (res.data.success){
- resolve(res.data.data);
- } else {
- resolve(null);
- }
- }).catch(err=>{
- reject(null);
- });
- });
- },
- computeAbnormalType(item){
- this.sunPrice();
- if (this.workOrder.orderIssueType !=='错漏发') return;
- let abnormal_amount = Number(item.abnormal_amount); // 客户实收数量
- let amount = Number(item.amount);
- item.abnormal_type = abnormal_amount === amount ? '未错漏发' : (amount < abnormal_amount ? '多发' : '少发')
- },
- sunPrice(){
- this.workOrder.price = this.workOrder.commodities.reduce((prev,cur)=>{
- return prev + Number(cur.price) * Number(cur.abnormal_amount);
- },0);
- },
- checkExpressAbnormalWorkOrder(){ // 校验 快递异常问题
- window.tempTip.setIndex(1999);
- window.tempTip.setDuration(1500);
- let message = null;
- if (this.workOrder.commodities.length === 0)message = '快递单号为空';
- if (this.workOrder.dealImages.length === 0 && this.isBaoShi === false) message = '交易截图为必须项!';
- if (!this.workOrder.type) message = '快递异常类型不能为空';
- if (message){
- window.tempTip.show(message);
- return false;
- }
- return true;
- },
- countByCommodities(commodities){
- if (commodities.length === 0) return;
- let index = 0;
- let logistic_number = commodities[0]['logistic_number'];
- let count = 0;
- for(let i = 0; i < commodities.length;i++){
- let cur_logistic_number = commodities[i]['logistic_number'];
- if (i === commodities.length - 1 && cur_logistic_number === logistic_number){
- count ++;
- commodities[index]['count'] = count;
- break;
- }
- if (logistic_number === cur_logistic_number){
- count++;
- } else if (logistic_number !== cur_logistic_number){
- commodities[index]['count'] = count;
- index = i;
- count = 1;
- }
- if (i === commodities.length - 1){
- commodities[index]['count'] = count;
- }
- }
- },
- },
- });
- </script>
- @endsection
|