delivering.blade.php 106 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952
  1. @extends('layouts.app')
  2. @section('title')查询-订单管理@endsection
  3. @section('content')
  4. <div class="container-fluid">
  5. <div style="min-width: 4120px;">{{--4070--}}
  6. <div id="list" class="d-none">
  7. <div id="form_div"></div>
  8. <div class="ml-3 form-inline" id="btn">
  9. <div class="dropdown">
  10. <button type="button"
  11. class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  12. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  13. 导出Excel
  14. </button>
  15. <div class="dropdown-menu">
  16. <a class="dropdown-item" @click="orderExport(false)" href="javascript:">导出勾选内容</a>
  17. <a class="dropdown-item" @click="orderExport(true)" href="javascript:">导出所有页</a>
  18. </div>
  19. </div>
  20. <div class="custom-control custom-checkbox ml-1">
  21. <input type="checkbox" class="custom-control-input" id="customCheck" name="is_merge"
  22. v-model="is_merge">
  23. <label class="custom-control-label" for="customCheck">导出是否格式化</label>
  24. </div>
  25. @can('订单管理-批量备注')
  26. <button @click="modal()" type="button" class="btn btn-sm ml-2 btn-outline-primary">批量备注追加
  27. </button>@endcan
  28. @can('订单管理-编辑')
  29. <span class="btn btn-sm btn-outline-dark tooltipTarget ml-1" @click="freezeAll"
  30. style="cursor: pointer" title="订单的冻结条件要只局限在“创建订单”,“分配完成”,“拣货完成”,“播种完成”">冻结</span>
  31. <button type="button" @click="thaw(null,true)"
  32. class="btn btn-sm btn-outline-danger tooltipTarget ml-1" title="解除已冻结订单"
  33. style="opacity: 0.7">解冻
  34. </button>
  35. <span class="btn btn-sm btn-outline-dark tooltipTarget ml-1" @click="deAllocationAll"
  36. style="cursor: pointer" title="订单的取消分配条件要只局限在“分配完成”或“部分分配”">取消分配</span>
  37. <span class="btn btn-sm btn-outline-primary tooltipTarget ml-1" @click="allocation()"
  38. style="cursor: pointer" title="仅能分配未分配订单">订单分配</span>
  39. <button type="button" @click="resetLogisticsGetMark()"
  40. class="btn btn-sm ml-1 btn-outline-success">重置快递获取标记
  41. </button>
  42. <button type="button" @click="resetInterfaceReturnMark()"
  43. class="btn btn-sm ml-1 btn-outline-secondary">重置接口回传标记
  44. </button>
  45. @endcan
  46. @can('订单管理-订单-生成问题件')
  47. <button @click="orderIssueTag()" type="button" class="btn btn-sm ml-1 btn-outline-primary">
  48. 标记问题件
  49. </button>
  50. @endcan
  51. @can('订单管理-订单-生成退货单')
  52. <button class="btn btn-sm btn-outline-dark ml-1" @click="isRejectedBillExist()"
  53. style="opacity: 0.7">生成退货单
  54. </button>
  55. @endcan
  56. <button class="btn btn-sm ml-1 btn-primary" @click="copyLogisticNumber()">复制快递单号</button>
  57. @can('订单管理-订单-生成工单')
  58. <button class="btn btn-sm ml-1 btn-outline-success" @click="checkWorkOrderOrCreateWorkOrder">生成工单</button>
  59. @endcan
  60. @can('订单管理-订单-一键回传')
  61. <button class="btn btn-sm ml-1 btn-success tooltipTarget"
  62. title="订单一键回传必须满足条件:订单状态为“分配完成,部分拣货,拣货完成,播种完成”;订单未冻结;订单有快递单号"
  63. @click="manualBack()">一键回传
  64. </button>
  65. @endcan
  66. @can('订单管理-订单-一键揽收')
  67. <button class="btn btn-sm ml-1 btn-success tooltipTarget" title="目前仅中通可用,默认重量0.01kg,默认揽收不需要任何条件"
  68. @click="collectUpload()">一键揽收</button>
  69. @endcan
  70. </div>
  71. <div class="modal fade " style="top: 20%" id="myModal" tabindex="-1" role="dialog"
  72. aria-labelledby="myModalLabel" aria-hidden="true">
  73. <div class="modal-dialog">
  74. <div class="modal-content">
  75. <div class="modal-header">
  76. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;
  77. </button>
  78. </div>
  79. <div class="modal-body">
  80. <input class="form-control" v-model="content" placeholder="注释内容">
  81. </div>
  82. <div class="modal-footer">
  83. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  84. <button type="button" @click="batchComments()" class="btn btn-primary">批量备注追加</button>
  85. </div>
  86. </div><!-- /.modal-content -->
  87. </div><!-- /.modal -->
  88. </div>
  89. <table class="table table-striped table-bordered table-hover card-body td-min-width-80" id="table">
  90. <tr v-for="(order,i) in orders" @click="selectedColor(order.orderno)"
  91. :style="{'background-color': order.orderno==selectedStyle?'#aac7ea':''}">
  92. <td>
  93. <input class="checkItem" type="checkbox" :value="order.orderno">
  94. </td>
  95. <td class="text-nowrap">
  96. <span >@{{ i+1 }}</span>
  97. @can('订单管理-问题件')
  98. <a :href="'{{url("order/issue/index")}}'+'?orderCode='+order.orderno"
  99. target="order/issue/index?addtime=15">
  100. <span v-show="order.is_order_issue" class="badge badge-pill badge-danger">问题件</span>
  101. </a>
  102. @else
  103. <span v-show="order.is_order_issue" class="badge badge-pill badge-danger">问题件</span>
  104. @endcan
  105. <br v-show="order.is_order_issue">
  106. @can('订单管理-工单处理')
  107. <a :href="'{{url("order/workOrder/index")}}'+'?client_code='+order.soreference1" target="order/workOrder/index">
  108. <span v-show="order['is_work_order']" class="badge badge-pill badge-primary">工单</span>
  109. </a>
  110. @else
  111. <span v-show="order['is_work_order']" class="badge badge-pill badge-primary">工单</span>
  112. @endcan
  113. </td>
  114. <td class="text-dark font-weight-bold text-nowrap"><span>@{{ order.orderno }}</span></td>
  115. <td class="text-muted text-nowrap"><span>@{{ order.ordercodename }}</span></td>
  116. <td class="text-nowrap"><span>@{{ order.addtime }}</span></td>
  117. <td class="text-nowrap"><span>@{{ order.issuepartyname }}</span></td>
  118. <td class="text-nowrap"><span>@{{ order.customer_descr_c }}</span></td>
  119. <td class="text-nowrap"><span>@{{ order.soreference1 }}</span></td>
  120. <td class="text-muted text-nowrap"><span>@{{ order.carriername }}</span></td>
  121. <td class="text-nowrap">
  122. <div v-if="picktotraceidMap[order.orderno] && picktotraceidMap[order.orderno].length>1"
  123. class="text-center">
  124. <span v-for="(picktotraceid,key) in picktotraceidMap[order.orderno]"
  125. v-if="order.is_unfold">
  126. @{{ isDB(order.carriername) ? (order.code5+'#'+(key+1)) : picktotraceid }}<br>
  127. </span>
  128. <button class="btn btn-sm btn-outline-info"
  129. :style="order.is_unfold ? 'opacity:0.7' : ''" @click="isUnfold(order)">
  130. <span v-if="order.is_unfold" class="mt-1">收起</span>
  131. <span v-else>分箱 @{{ picktotraceidMap[order.orderno].length }} 件,展开单号</span>
  132. </button>
  133. </div>
  134. <span v-else v-text="(order.carriername !==null && order.carriername.includes('唯品顺丰')) ? order.code5 : order.soreference5"></span>
  135. </td>
  136. <td class="text-muted text-wrap text-letter">
  137. <div class="text-overflow-warp-200 warp-min-200"
  138. :class="order.is_encryption ? 'text-danger' : ''"><span
  139. v-if="order.is_encryption">*加密*</span><span v-else>@{{ order.c_contact }}</span>
  140. </div>
  141. </td>
  142. <td class="text-muted text-wrap text-letter">
  143. <div class="text-overflow-warp-200 warp-min-200"
  144. :class="order.is_encryption ? 'text-danger' : ''"><span
  145. v-if="order.is_encryption">*加密*</span><span v-else>@{{ order.c_tel2?order.c_tel2:order.c_tel1 }}</span>
  146. </div>
  147. </td>
  148. <td class="text-nowrap"><span> @{{ order.c_province }}</span></td>
  149. <td class="text-nowrap"><span> @{{ order.c_city }}</span></td>
  150. <td class="text-nowrap">
  151. <div class="text-overflow-warp-200 warp-min-200">@{{ order.c_district }}</div>
  152. </td>
  153. <td class="text-muted text-wrap text-letter">
  154. <div class="text-overflow-warp-200 warp-min-200"
  155. :class="order.is_encryption ? 'text-danger' : ''"><span
  156. v-if="order.is_encryption">*加密*</span><span v-else>@{{ order.c_address1 }}</span>
  157. </div>
  158. </td>
  159. <td class="text-nowrap"><span>@{{ order.waveno }}</span></td>
  160. <td class="text-nowrap"><span> @{{ order.warehouseid }}</span></td>
  161. <td class="text-nowrap"><span v-if="order.edisendflag2=='Y'">是</span><span
  162. v-if="order.edisendflag2=='N'">否</span><span v-if="order.edisendflag2=='W'">错误</span>
  163. </td>
  164. <td class="text-nowrap"><span>@{{ order.edisendtime2 }}</span></td>
  165. <td class="text-center" style="min-width: 900px">
  166. <div :class="commodities[order.orderno]&&commodities[order.orderno].length==1 ? '' : 'up'"
  167. :id="'order-'+i">
  168. <div v-for="oracleDOCOrderDetail in commodities[order.orderno]" class="row">
  169. <div class="col-2 border border-1">@{{ oracleDOCOrderDetail.sku }}</div>
  170. <div class="col-2 border border-1">@{{ oracleDOCOrderDetail.alternate_sku1 }}</div>
  171. <div class="col-2 border border-1" @dblclick.stop="replaceText(i)">
  172. <div class="w-100"
  173. :class="order.replaceText ? 'text-overflow-warp-100' : 'text-overflow-replace-100 cursor-pointer'">
  174. @{{ oracleDOCOrderDetail.descr_c }}
  175. </div>
  176. </div>
  177. <div class="col-1 border border-1">@{{ oracleDOCOrderDetail.qtyordered }}</div>
  178. <div class="col-2 border border-1">@{{ oracleDOCOrderDetail.lotnum }}</div>
  179. <div class="col-1 m-0 p-0 border border-1">@{{
  180. oracleDOCOrderDetail.orderdetailcodename }}
  181. </div>
  182. <div class="col-2 border border-1">@{{ oracleDOCOrderDetail.checktime }}</div>
  183. </div>
  184. </div>
  185. <div class="row text-center cursor-pointer"
  186. v-if="commodities[order.orderno]&&commodities[order.orderno].length>1">
  187. <b @click="unfold(i)" class="col-12 cursor-pointer" v-if="!upList[i]">共有 @{{
  188. commodities[order.orderno].length }} 件商品,点击展开</b>
  189. <b class="col-12" @click="unfold(i)" v-else>点击收起明细</b>
  190. </div>
  191. </td>
  192. <td><span>@{{ order.notes }}</span></td>
  193. <td><span>@{{ order.manualflag}}</span></td>
  194. <td><span>@{{ order.erpcancelflag }}</span></td>
  195. <td><span>@{{ order.picking_print_flag }}</span></td>
  196. <td><span>@{{ order.edisendflag }}</span></td>
  197. <td><span>@{{ order.ediremarks2}}</span></td>
  198. <td>
  199. @can('订单管理-编辑')
  200. <button v-if="order.releasestatus!=='H'" @click="freeze(order.orderno,order.waveno)"
  201. class="btn btn-sm btn-outline-dark text-nowrap"
  202. :disabled="!(order.ordercodename==='创建订单'||order.ordercodename==='分配完成'||order.ordercodename==='拣货完成'||order.ordercodename==='播种完成')">
  203. 冻结
  204. </button>
  205. <button v-else @click="thaw(order.orderno,false,order)"
  206. class="btn btn-sm btn-outline-danger text-nowrap"
  207. :disabled="!(order.ordercodename==='创建订单'||order.ordercodename==='分配完成'||order.ordercodename==='拣货完成'||order.ordercodename==='播种完成')">
  208. 解冻
  209. </button>
  210. @else
  211. <span>@{{ order.releasestatus }}</span>
  212. @endcan
  213. </td>
  214. <td>
  215. @can('订单管理-编辑')
  216. <button v-if="order.sostatus=='40'||'30'"
  217. @click="deAllocation(order.orderno,order.waveno)"
  218. class="btn btn-sm btn-outline-dark text-nowrap"
  219. :disabled="!(order.sostatus==='40'|| order.sostatus==='30')">取消分配
  220. </button>
  221. @else
  222. <span>@{{ order.sostatus }}</span>
  223. @endcan
  224. </td>
  225. </tr>
  226. </table>
  227. <button type="button" @click="pageUp()" :readonly="page>1?false:true" class="btn btn-sm "
  228. :class="page>1?'btn-outline-info':''">上一页
  229. </button>
  230. <button type="button" @click="pageDown()" :readonly="maxPage == 0 ? false : (page<maxPage?false:true)"
  231. class="btn btn-sm m-3"
  232. :class="maxPage == 0 ? 'btn-outline-info' : (page<maxPage?'btn-outline-info':'')">下一页
  233. </button>
  234. <input @keyup.enter="pageSkip($event)" class="form-control-sm ml-3 tooltipTarget" placeholder="此处输入页数"
  235. title="去往指定页">
  236. <span class="text-muted m-1">@{{ pagePlaceholder }}</span>
  237. <span class="text-muted m-1" v-if="maxPage != 0">共 @{{ sum }} 条</span>
  238. <div class="modal fade " id="checkModal" tabindex="-1" role="dialog" aria-labelledby="checkModalLabel"
  239. aria-hidden="true">
  240. <div class="modal-dialog modal-dialog-centered">
  241. <div class="modal-content">
  242. <div class="modal-header">
  243. <h5 class="modal-title" id="checkModalLabel">标记问题件提示</h5>
  244. <button type="button" class="close" data-dismiss="modal" aria-label="Close"
  245. @click="changeRemark">
  246. <span aria-hidden="true">&times;</span>
  247. </button>
  248. </div>
  249. <div class="modal-body">
  250. <div class="alert" id="alert-message">
  251. @{{ message.checkOrderIssueMessage }}
  252. </div>
  253. </div>
  254. <div class="modal-footer">
  255. <button type="button" class="btn btn-secondary" data-dismiss="modal"
  256. @click="message.checkOrderIssueMessage=''">关闭
  257. </button>
  258. </div>
  259. </div>
  260. </div>
  261. </div>
  262. <div class="modal fade " id="exampleModal" tabindex="-1" role="dialog"
  263. aria-labelledby="exampleModalLabel"
  264. aria-hidden="true">
  265. <div class="modal-dialog modal-dialog-centered modal-xl">
  266. <div class="modal-content">
  267. <div class="modal-header">
  268. <h5 class="modal-title" id="exampleModalLabel">输入问题件信息</h5>
  269. <button type="button" class="close" data-dismiss="modal" aria-label="Close"
  270. @click="changeRemark">
  271. <span aria-hidden="true">&times;</span>
  272. </button>
  273. </div>
  274. <div class="modal-body">
  275. <div class="form-group row m-0 p-0">
  276. <label class="col-md-1 col-sm-2 text-right">问题类别</label>
  277. <select name="order_issues_type_id" v-model="typeId" class="form-control col-4"
  278. id="orderIssueType" @focus="focusOnModal($event)">
  279. <option value></option>
  280. <option v-for="type in orderIssueType" :value="type.id">@{{ type.name }}
  281. </option>
  282. </select>
  283. <label class="col-md-1 col-sm-2 text-right">
  284. 快递
  285. </label>
  286. <div class="col-4">
  287. <textarea class="form-control m-0">@{{ tagOrder.logisticInfo }}</textarea>
  288. <button type="button" class="btn btn-sm btn-outline-primary"
  289. @click="copyLogisticInfo">复制
  290. </button>
  291. </div>
  292. </div>
  293. <div class="form-group row m-0">
  294. <label class="col-md-1 col-sm-2 text-right">情况说明</label>
  295. <label for="result_explain"></label>
  296. <textarea name="result_explain" v-model="result_explain" class="form-control col-4"
  297. id="result_explain"></textarea>
  298. <label class="col-md-1 col-sm-2 text-right">
  299. 商家
  300. </label>
  301. <div class="col-4">
  302. <textarea class="form-control m-0 row">@{{ tagOrder.merchantInfo }}</textarea>
  303. <button type="button" class="btn btn-sm btn-outline-primary"
  304. @click="copyMerchantInfo">复制
  305. </button>
  306. </div>
  307. </div>
  308. </div>
  309. <div class="modal-footer">
  310. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal"
  311. @click="changeRemark">关闭
  312. </button>
  313. <button type="button" class="btn btn-sm btn-primary" @click="orderIssueTagSubmit">提交
  314. </button>
  315. </div>
  316. </div>
  317. </div>
  318. </div>
  319. @can('订单管理-订单-生成工单')
  320. @include('order.index._work_order_modal')
  321. @include('order.index._work_order_info_modal')
  322. @endcan
  323. <textarea id="clipboardDiv" style="opacity:0"></textarea>
  324. </div>
  325. </div>
  326. </div>
  327. @endsection
  328. @section('lastScript')
  329. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  330. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  331. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  332. <script>
  333. let vue = new Vue({
  334. el: "#list",
  335. data: {
  336. page: Number('{{$page}}'),
  337. paginate: Number('{{$request['paginate'] ?? 50}}'),
  338. maxPage: 1,
  339. sum: 0,
  340. owners: [
  341. @foreach($customers as $customer)
  342. {
  343. name: '{{$customer->code}}', value: '{{$customer->name}}'
  344. },
  345. @endforeach
  346. ],
  347. logistics: [
  348. @foreach($logistics as $logistic)
  349. {
  350. name: '{{$logistic->name}}', value: '{{$logistic->name}}'
  351. },
  352. @endforeach
  353. ],
  354. orders: {!! $orders !!},
  355. commodities: {!! $commodities !!},
  356. content: '',
  357. codes: [
  358. @foreach($codes as $code)
  359. {
  360. name: '{{$code->code}}', value: '{{$code->codename_c}}'
  361. },
  362. @endforeach
  363. ],
  364. selectedStyle: '',
  365. picktotraceidMap: {!! $picktotraceids !!},
  366. pagePlaceholder: "",
  367. typeId: '',
  368. result_explain: '',
  369. orderIssueType: {!! $orderIssueType !!},
  370. is_merge: false,
  371. message: {
  372. checkOrderIssueMessage: '',
  373. },
  374. tagOrders: [],
  375. tagOrder: {
  376. logisticInfo: '',
  377. merchantInfo: '',
  378. },
  379. upList: {},
  380. workOrder: {
  381. types:
  382. @can("订单管理-工单处理-客服编辑")
  383. ['拦截','取消拦截', '信息更改', '快递异常', '错漏发', '破损', '快递丢件']
  384. @elsecan("订单管理-工单处理-货主编辑")
  385. ['拦截','取消拦截','信息更改', '快递异常', '错漏发', '破损']
  386. @else
  387. ['']
  388. @endcan
  389. ,
  390. orderIssueType: 0,
  391. type:null, // 快递异常时填写
  392. remark: {
  393. name: null, // 联系人
  394. phone: null, // 联系号码
  395. province: null, // 省
  396. city: null, // 市
  397. district: null, // 区
  398. adder: null, // 详细地址
  399. info: null,
  400. },
  401. packageImages: [], // 外包装图片
  402. commodityImages: [], // 内物破损图片
  403. dealImages: [], // 交易截图
  404. commodities: [],
  405. logistic_number: null, // 快递单号
  406. price: null,
  407. },
  408. expressAbnormalTypes:['在途异常','签收未收到'],
  409. exeSign: {},
  410. workOrderInfos:[],
  411. workOrderIndex:null,
  412. workOrderInfo:{
  413. id:'',
  414. type:'',
  415. clientCode:'',
  416. logistic_numbers:[],
  417. detail:{
  418. price:'',
  419. return_logistic_number:'',
  420. reissue_logistic_number:'',
  421. },
  422. commodities:[],
  423. packagesImages:[],
  424. commodityImages:[],
  425. dealImages:[],
  426. refundImages:[],
  427. remark:'',
  428. issue_name:'',
  429. },
  430. isBaoShi:@can('订单管理-工单处理-宝时编辑') true @else false @endcan,
  431. },
  432. mounted: function () {
  433. this.initData();
  434. $(".up").slideUp();
  435. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  436. $("#list").removeClass('d-none');
  437. if (this.orders.length > 0) {
  438. this.maxPage = Math.ceil(this.orders[0].counted / this.paginate);
  439. this.sum = this.orders[0].counted;
  440. }
  441. if (this.getQueryVariable('alternate_sku1')) {
  442. this.maxPage = 0;
  443. this.pagePlaceholder = '当前页数:' + this.page;
  444. } else {
  445. this.pagePlaceholder = '当前页数:' + this.page + '/' + this.maxPage;
  446. }
  447. let data = [
  448. [{name: 'codename_c', type: 'select', placeholder: '订单状态', data: this.codes},
  449. {
  450. name: 'orderdate_start', type: 'time', tip: ['选择显示日期的起始时间', '选择显示日期的起始时间'],
  451. rules: {
  452. date_relevance: {
  453. date: ['orderdate_start', 'orderdate_end'],
  454. relevance: 'addtime',
  455. killing: 'relevance',
  456. default: [31, 92, 183, 366]
  457. }
  458. }
  459. },
  460. {name: 'orderno', type: 'input', tip: '可支持多SO号,糊模查找需要在左边打上%符号', placeholder: 'SO号'},
  461. {
  462. name: 'carriername',
  463. type: 'select_multiple_select',
  464. tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的承运人'],
  465. placeholder: ['承运人', '定位或多选承运人'],
  466. data: this.logistics
  467. },
  468. {
  469. name: ['notes', 'addtime'],
  470. type: 'input_select',
  471. tip: ['右侧选择查询范围,默认为一月内', '查询范围,范围越短搜索越快'],
  472. placeholder: ['备注', ''],
  473. data: [{name: '31', value: '近一月'}, {name: '92', value: '近三月'}, {
  474. name: '183',
  475. value: '近半年'
  476. }, {name: '366', value: '近一年'}, {name: '0', value: '不限'},],
  477. rules: {
  478. son: {
  479. addtime: {
  480. default: '31',
  481. required_without_all_if: ['orderdate_start', 'orderdate_end']
  482. }
  483. },
  484. date_relevance: {
  485. date: ['orderdate_start', 'orderdate_end'],
  486. relevance: 'addtime',
  487. killing: 'date',
  488. default: [31, 92, 183, 366]
  489. }
  490. }
  491. },
  492. {name: 'issuepartyname', type: 'input', tip: '糊模查找需要在左边打上%符号', placeholder: '店铺名称'},
  493. {
  494. name: 'edisendflag2',
  495. type: 'select',
  496. tip: '快递获取标记',
  497. placeholder: '快递获取标记',
  498. data: [{name: 'Y', value: '是'}, {name: 'N', value: '否'}, {name: 'W', value: '错误'},]
  499. },
  500. {
  501. name: 'edisendflag',
  502. type: 'select',
  503. tip: '接口回传标记',
  504. placeholder: '接口回传标记',
  505. data: [{name: 'Y', value: 'Y'}, {name: 'N', value: 'N'}, {
  506. name: 'W',
  507. value: 'W'
  508. }, {name: 'R', value: 'R'},]
  509. }
  510. ],
  511. [
  512. {name: 'codename_c_end', type: 'select', placeholder: '订单状态范围', data: this.codes},
  513. {
  514. name: 'orderdate_end', type: 'time', tip: ['选择显示指定日期的结束时间', '选择显示指定日期的结束时间'],
  515. rules: {
  516. date_relevance: {
  517. date: ['orderdate_start', 'orderdate_end'],
  518. relevance: 'addtime',
  519. killing: 'relevance',
  520. default: [31, 92, 183, 366]
  521. }
  522. }
  523. },
  524. {
  525. name: 'customerid', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的客户'],
  526. placeholder: ['货主', '定位或多选货主'], data: this.owners
  527. },
  528. {name: 'soreference5', type: 'input', tip: '可支持多快递单号,糊模查找需要在左边打上%符号', placeholder: '多快递单号'},
  529. {
  530. name: 'soreference1',
  531. type: 'input',
  532. tip: '支持多客户订单号精确和模糊查找,糊模查找需要在右边打上%符号,多单号可用逗号或者空格分隔',
  533. placeholder: '客户订单号'
  534. },
  535. {name: 'waveno', type: 'input', tip: '可支持多波次编号,模糊查找需要在左边打上%的符号', placeholder: '波次编号'},
  536. {name: 'alternate_sku1', type: 'input', tip: '产品条码,模糊查找需要在左边打上%的符号', placeholder: '产品条码'},
  537. {name: 'c_contact', type: 'input', tip: '可支持多收货人名称:15天以内模糊搜索,15天以外精确搜索', placeholder: '收货人名称'},
  538. ],
  539. [
  540. {name: 'c_tel2', type: 'input', tip: '收货人电话:15天以内模糊搜索,15天以外精确搜索', placeholder: '收货人电话'},
  541. {name: 'c_province', type: 'input', tip: '省:15天以内模糊搜索,15天以外精确搜索', placeholder: '省'},
  542. {name: 'c_city', type: 'input', tip: '市:15天以内模糊搜索,15天以外精确搜索', placeholder: '市'},
  543. {name: 'c_district', type: 'input', tip: '区:15天以内模糊搜索,15天以外精确搜索', placeholder: '区'},
  544. {
  545. name: 'releasestatus',
  546. type: 'select',
  547. tip: '是否冻结冻结',
  548. placeholder: '是否冻结',
  549. data: [{name: 'H', value: '是'}, {name: 'N', value: '否'}]
  550. },
  551. {name: 'checktime_start', type: 'time', tip: ['选择显示复核时间的起始日期', "选择显示复核时间的起始时间"]},
  552. {name: 'checktime_end', type: 'time', tip: ['选择显示复核时间的结束日期', '选择显示复核时间的结束时间']},
  553. {
  554. name: 'is_display_all',
  555. type: 'checkbox',
  556. tip: '是否隐藏装箱完成以后的状态',
  557. data: [{name: 'ture', value: '隐藏完成状态'}]
  558. },
  559. ],
  560. [
  561. {
  562. name: 'restrict_time',
  563. type: 'select',
  564. tip: '查询限定时间范围',
  565. placeholder: '查询时间范围',
  566. data: [{name: '1', value: '一天内'}, {name: '7', value: '一周内'}, {
  567. name: "30",
  568. value: "一月内"
  569. }, {name: "90", value: "本季度"}]
  570. },
  571. {
  572. name: 'manualflag',
  573. type: 'select',
  574. tip: '是否人工回传',
  575. placeholder: '是否人工回传',
  576. data: [{name: 'Y', value: '是'}, {name: 'N', value: '否'}]
  577. },
  578. /*{name: 'delayedDeliver', type: 'input', tip: 'M:延时发货,填写整数,单位/时', placeholder: '历史延时发货'},*/
  579. {name: 'presentDelayed', type: 'input', tip: 'M:延时发货,填写整数,单位/时', placeholder: '延时发货'},
  580. ],
  581. ];
  582. this.form = new query({
  583. el: "#form_div",
  584. condition: data,
  585. appendDom: "btn",
  586. });
  587. this.form.init();
  588. let column = [
  589. {name: 'index', value: '序号', neglect: true},
  590. {name: 'orderno', value: '编号'},
  591. {name: 'ordercodename', value: '订单状态'},
  592. {name: 'addtime', value: '接口下发时间'},
  593. {name: 'issuepartyname', value: '店铺名称'},
  594. {name: 'customer_descr_c', value: '客户'},
  595. {name: 'soreference1', value: '客户订单号'},
  596. {name: 'carriername', value: '承运人'},
  597. {name: 'soreference5', value: '快递单号'},
  598. {name: 'c_contact', value: '收货人名称'},
  599. {name: 'c_tel2', value: '收货人电话'},
  600. {name: 'c_province', value: '省'},
  601. {name: 'c_city', value: '市'},
  602. {name: 'c_district', value: '区'},
  603. {name: 'c_address1', value: '收货人地址'},
  604. {name: 'waveno', value: '波次编号'},
  605. {name: 'warehouseid', value: '仓库'},
  606. {name: 'edisendflag2', value: '快递获取标记'},
  607. {name: 'edisendtime2', value: '快递获取时间'},
  608. {
  609. name: "commodity", type: "multi", title: "商品信息", rows: [
  610. {value: "商品编码", col: "2"},
  611. {value: "商品条码", col: "2"},
  612. {value: "商品名称", col: "2"},
  613. {value: "订单数量", col: "1"},
  614. {value: "批次号", col: "2"},
  615. {value: "明细状态", col: "1"},
  616. {value: "复核时间", col: "2"}
  617. ]
  618. },
  619. {name: 'notes', value: '备注'},
  620. {name: 'manualflag', value: '人工回传标记'},
  621. {name: 'erpcancelflag', value: '接口取消标记'},
  622. {name: 'picking_print_flag', value: '拣货单打印标记'},
  623. {name: 'edisendflag', value: '接口回传标记'},
  624. {name: 'ediremarks2', value: '接口回传异常备注'},
  625. {name: 'update', value: '订单冻结', neglect: true},
  626. {name: 'remove', value: '取消分配', neglect: true},
  627. ];
  628. new Header({
  629. el: "table",
  630. name: "order",
  631. column: column,
  632. data: this.orders,
  633. restorationColumn: 'addtime',
  634. fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
  635. }).init();
  636. },
  637. watch: {
  638. result_explain: function () {
  639. this.setLogisticInfo();
  640. this.setMerchantInfo();
  641. },
  642. 'workOrder.orderIssueType':function(newValue){
  643. if (newValue === null) return;
  644. if (['破损','错漏发','快递异常'].includes(newValue)){
  645. this.fillWorkOrderCommodity();
  646. }
  647. },
  648. },
  649. computed:{
  650. },
  651. methods: {
  652. initData() {
  653. this.orders.forEach((order) => {
  654. if (order.c_contact && order.c_contact.length > 50 && order.c_contact.substring(0, 3) === '~Ag') order.is_encryption = true;
  655. });
  656. let start = "{{$request["orderdate_start"] ?? ''}}";
  657. let end = "{{$request["orderdate_end"] ?? ''}}";
  658. let time = "{{$request["restrict_time"] ?? ''}}";
  659. if (time)this.changeURLParam("restrict_time", time);
  660. if (start)this.changeURLParam("orderdate_start", start);
  661. if (end)this.changeURLParam("orderdate_end", end);
  662. },
  663. changeURLParam(name, value) {
  664. let url = document.URL, resultUrl = ''
  665. let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
  666. let r = window.location.search.substr(1).match(reg);
  667. let replaceText = name + '=' + value;
  668. if (r != null) {
  669. let tmp = url.replace(name + '=' + r[2], replaceText);
  670. resultUrl = (tmp);
  671. } else {
  672. if (url.match('[\?]')) {
  673. resultUrl = url + '&' + replaceText;
  674. } else {
  675. resultUrl = url + '?' + replaceText;
  676. }
  677. }
  678. history.replaceState(null, null, resultUrl)
  679. },
  680. getQueryVariable(variable) {
  681. let query = window.location.search.substring(1);
  682. let vars = query.split("&");
  683. for (let i = 0; i < vars.length; i++) {
  684. let pair = vars[i].split("=");
  685. if (pair[0] == variable) {
  686. return pair[1];
  687. }
  688. }
  689. return (false);
  690. },
  691. pageUp() {
  692. if (this.page <= 1) return;
  693. this.href(this.page - 1);
  694. },
  695. pageDown() {
  696. if (this.page >= this.maxPage && this.maxPage !== 0) return;
  697. this.href(this.page + 1);
  698. },
  699. pageSkip(e) {
  700. if (Number(e.target.value) <= 0 || Number(e.target.value) > this.maxPage) {
  701. tempTip.setDuration(2000);
  702. tempTip.show('页数不存在! ');
  703. return
  704. }
  705. this.href(e.target.value);
  706. },
  707. href(page) {
  708. let url = document.URL;
  709. if (url.indexOf('page=' + this.page) !== -1) {
  710. url = url.replace("page=" + this.page, "page=" + page);
  711. } else {
  712. if (url.indexOf('?') === -1) url += "?page=" + page;
  713. else url += "&page=" + page;
  714. }
  715. window.location.href = url;
  716. },
  717. unfold(index) {
  718. this.$set(this.upList, index, this.upList[index] ? !this.upList[index] : true);
  719. $("#order-" + index).slideToggle();
  720. },
  721. orderExport(checkAllSign) {
  722. let url = '{{url('order/index/export')}}';
  723. let token = '{{ csrf_token() }}';
  724. excelExport(checkAllSign, checkData, url, this.sum, token, {is_merge: this.is_merge});
  725. },
  726. modal() {
  727. $("#myModal").modal('show');
  728. },
  729. //批量冻结
  730. freezeAll: function () {
  731. let _this = this;
  732. if (checkData.length === 0) {
  733. tempTip.show('没有勾选记录');
  734. return
  735. }
  736. if (!confirm("确定要标记所有勾选内容为'冻结'吗")) {
  737. return;
  738. }
  739. axios.post('{{url('order/freezeAll')}}', {checkData: checkData}).then(function (response) {
  740. if (response.data.success) {
  741. _this.orders.forEach(function (order) {
  742. checkData.forEach(function (checkedId) {
  743. if (order.orderno === checkedId) {
  744. order.releasestatus = 'H';
  745. order.waveno = '*';
  746. }
  747. });
  748. });
  749. tempTip.setDuration(1000);
  750. tempTip.showSuccess('标记勾选内容为冻结成功');
  751. } else {
  752. tempTip.setDuration(2500);
  753. tempTip.show('标记勾选内容冻结失败,错误:' + response.data.fail_info);
  754. }
  755. }).catch(function (e) {
  756. tempTip.setDuration(2500);
  757. tempTip.show('标记勾选内容冻结失败,网络连接错误:' + e);
  758. })
  759. },
  760. //订单分配
  761. allocation() {
  762. if (this.exeSign.allocation) return;
  763. if (checkData.length === 0) {
  764. tempTip.show('没有勾选记录');
  765. return;
  766. }
  767. let arr = [];
  768. checkData.forEach(no => {
  769. this.orders.some(order => {
  770. if (order.orderno === no) {
  771. let obj = {
  772. "status": order.sostatus,
  773. "number": order.soreference5,
  774. "warehouse": order.warehouseid,
  775. "code": order.orderno,
  776. };
  777. arr.push(obj);
  778. return true;
  779. }
  780. });
  781. });
  782. window.tempTip.confirm("确定要分配这些订单吗?", () => {
  783. this.exeSign.allocation = true;
  784. axios.post("{{url('order/allocation')}}", {list: arr}).then((res) => {
  785. tempTip.setDuration(3000);
  786. this.exeSign.allocation = false;
  787. switch (res.data.status) {
  788. case "success":
  789. tempTip.showSuccess('订单分配成功');
  790. setTimeout(function () {
  791. window.location.reload();
  792. }, 3000);
  793. break;
  794. case "fail":
  795. tempTip.show(res.data.msg);
  796. break;
  797. default:
  798. tempTip.confirm(res.data.msg, function () {
  799. window.location.reload();
  800. });
  801. }
  802. }).catch((e) => {
  803. this.exeSign.allocation = false;
  804. tempTip.setDuration(2500);
  805. tempTip.show('分配失败,预期之外的错误:' + e);
  806. })
  807. })
  808. },
  809. //批量取消分配
  810. deAllocationAll() {
  811. let _this = this;
  812. if (checkData.length === 0) {
  813. tempTip.show('没有勾选记录');
  814. return
  815. }
  816. if (!confirm("确定要所有勾选内容'取消分配'吗")) {
  817. return;
  818. }
  819. axios.post('{{url('order/deAllocationAll')}}', {checkData: checkData}).then(function (response) {
  820. if (response.data.success) {
  821. _this.orders.forEach(function (order) {
  822. checkData.forEach(function (checkedId) {
  823. if (order.orderno === checkedId) {
  824. order.sostatus = '00';
  825. order.waveno = '*';
  826. }
  827. });
  828. });
  829. tempTip.setDuration(1000);
  830. tempTip.showSuccess('标记勾选内容取消分配成功');
  831. window.location.reload();
  832. } else {
  833. tempTip.setDuration(2500);
  834. tempTip.show('标记勾选内容取消分配失败,错误:' + response.data.fail_info);
  835. }
  836. }).catch(function (e) {
  837. tempTip.setDuration(2500);
  838. tempTip.show('标记勾选内容取消分配失败,网络连接错误:' + e);
  839. })
  840. },
  841. batchComments() {
  842. let _this = this;
  843. if (checkData.length < 1 || !this.content) {
  844. $("#myModal").modal('hide');
  845. tempTip.setDuration(3000);
  846. if (checkData.length < 1) tempTip.showSuccess('没有勾选任何记录');
  847. else tempTip.showSuccess('没有输入任何内容');
  848. return;
  849. }
  850. axios.post('{{url('order/create/batchComments')}}', {checkData: checkData, content: this.content})
  851. .then(function (response) {
  852. let sign = [];
  853. _this.orders.every(function (order) {
  854. if (sign.length === response.data.length) return false;
  855. response.data.every(function (data) {
  856. if (order.orderno === data.orderno) {
  857. order.notes = data.notes;
  858. sign.push(order.orderno);
  859. return false;
  860. }
  861. return true;
  862. });
  863. return true;
  864. });
  865. tempTip.setDuration(3000);
  866. tempTip.showSuccess('注释完毕!')
  867. _this.content = '';
  868. }).catch(function (err) {
  869. tempTip.setDuration(4000);
  870. tempTip.show('网络错误:' + err)
  871. });
  872. $("#myModal").modal('hide');
  873. },
  874. selectedColor(orderno) {
  875. if (orderno == this.selectedStyle) return;
  876. this.selectedStyle = orderno;
  877. },
  878. freeze(orderno, waveno) {
  879. if (!confirm('确定要冻结“' + orderno + '”吗?')) return;
  880. let _this = this;
  881. axios.post('{{url('order/freeze')}}', {orderno: orderno, waveno: waveno})
  882. .then(function (response) {
  883. if (response.data.success) {
  884. _this.orders.some(function (order) {
  885. if (order.orderno === orderno) {
  886. order.releasestatus = 'H';
  887. order.waveno = '*';
  888. return true;
  889. }
  890. });
  891. tempTip.setDuration(3000);
  892. tempTip.showSuccess('订单已被冻结!');
  893. }
  894. }).catch(function (err) {
  895. tempTip.setDuration(3000);
  896. tempTip.show('网络异常:' + err);
  897. });
  898. },
  899. thaw(orderno = null, is_batch = false, order = null) {
  900. if (!orderno) orderno = checkData;
  901. if (!confirm('确定要解冻“' + orderno + '”吗?')) return;
  902. let _this = this;
  903. axios.post('{{url('order/thaw')}}', {orderno: orderno})
  904. .then(function (response) {
  905. if (response.data.success) {
  906. if (is_batch) {
  907. orderno.forEach(order_no => {
  908. _this.orders.some(function (order) {
  909. if (order.orderno === order_no) {
  910. order.releasestatus = 'N';
  911. return true;
  912. }
  913. });
  914. });
  915. } else {
  916. order.releasestatus = 'N';
  917. }
  918. tempTip.setDuration(3000);
  919. tempTip.showSuccess('订单已成功解冻!');
  920. }
  921. }).catch(function (err) {
  922. tempTip.setDuration(3000);
  923. tempTip.show('网络异常:' + err);
  924. });
  925. },
  926. deAllocation(orderno, waveno) {
  927. if (!confirm('确定要取消分配“' + orderno + '”吗?')) return;
  928. let _this = this;
  929. axios.post('{{url('order/deAllocation')}}', {orderno: orderno, waveno: waveno})
  930. .then(function (response) {
  931. if (response.data.success) {
  932. _this.orders.some(function (order) {
  933. if (order.orderno === orderno) {
  934. order.sostatus = '00';
  935. order.waveno = '*';
  936. return true;
  937. }
  938. });
  939. tempTip.setDuration(3000);
  940. tempTip.showSuccess('订单已被取消分配!');
  941. window.location.reload();
  942. }
  943. }).catch(function (err) {
  944. tempTip.setDuration(3000);
  945. tempTip.show('网络异常:' + err);
  946. });
  947. },
  948. isUnfold(order) {
  949. if (!order.is_unfold) {
  950. this.$set(order, 'is_unfold', true);
  951. return;
  952. }
  953. order.is_unfold = false;
  954. },
  955. orderIssueTag() {
  956. if (checkData.length === 0) {
  957. tempTip.setDuration(2000);
  958. tempTip.show('没有勾选记录');
  959. return;
  960. }
  961. this.isExistByOrderNos();
  962. },
  963. orderIssueTagSubmit() {
  964. if (this.typeId === '') {
  965. $("#orderIssueType").addClass('is-invalid');
  966. return;
  967. } else {
  968. $("#result_explain #result_explain").removeClass('is-invalid');
  969. $("#exampleModal").modal('hide');
  970. }
  971. let _this = this;
  972. tempTip.setDuration(1999);
  973. tempTip.waitingTip('处理中,请稍候');
  974. let data = {orderNos: checkData, typeId: this.typeId, result_explain: this.result_explain};
  975. axios.post("{{url('apiLocal/order/issue/orderIssueTag')}}", data).then(function (res) {
  976. tempTip.setDuration(5000);
  977. tempTip.cancelWaitingTip();
  978. if (res.data.success) {
  979. tempTip.setDuration(3000);
  980. tempTip.showSuccess('已标记为问题件');
  981. _this.orders.forEach(item => {
  982. if (checkData.includes(item.orderno)) item.is_order_issue = true;
  983. });
  984. } else {
  985. if (res.data.exitsOrderNos) {
  986. _this.message.checkOrderIssueMessage = res.data.fail_info + res.data.exitsOrderNos;
  987. $("#checkModal").modal('show');
  988. } else {
  989. tempTip.setDuration(3000);
  990. tempTip.show(res.data.fail_info);
  991. }
  992. }
  993. }).catch(function (err) {
  994. tempTip.setDuration(3000);
  995. tempTip.cancelWaitingTip();
  996. tempTip.show('网络链接异常' + err);
  997. })
  998. },
  999. //重置快递获取标记
  1000. resetLogisticsGetMark() {
  1001. if (checkData.length < 1) {
  1002. tempTip.setDuration(3000);
  1003. tempTip.showSuccess('未选择任何单号');
  1004. return
  1005. }
  1006. if (!confirm('确定要重置这些单的快递获取标记吗?')) return;
  1007. let url = '{{url('order/resetLogisticsGetMark')}}';
  1008. let _this = this;
  1009. axios.post(url, {orderno: checkData})
  1010. .then(function (response) {
  1011. if (response.data.success) {
  1012. checkData.forEach(orderno => {
  1013. _this.orders.some(order => {
  1014. if (order.orderno === orderno && order.edisendflag2 === 'W') {
  1015. order.edisendflag2 = "N";
  1016. return true;
  1017. }
  1018. });
  1019. });
  1020. tempTip.setDuration(2000);
  1021. tempTip.showSuccess('重置快递获取标记成功!');
  1022. } else {
  1023. tempTip.setDuration(3000);
  1024. tempTip.show(response.data.data);
  1025. }
  1026. }).catch(function (err) {
  1027. tempTip.setDuration(3000);
  1028. tempTip.show("网络错误:" + err)
  1029. })
  1030. },
  1031. resetInterfaceReturnMark() {
  1032. if (checkData.length < 1) {
  1033. tempTip.setDuration(3000);
  1034. tempTip.showSuccess('未选择任何单号');
  1035. return
  1036. }
  1037. if (!confirm('确定要重置接口回传标记吗?')) return;
  1038. let url = '{{url('order/resetInterfaceReturnMark')}}';
  1039. let _this = this;
  1040. axios.post(url, {orderno: checkData}).then(function (response) {
  1041. if (response.data.success) {
  1042. checkData.forEach(orderno => {
  1043. _this.orders.some(order => {
  1044. if (order.orderno === orderno) {
  1045. order.edisendflag = "N";
  1046. return true;
  1047. }
  1048. });
  1049. });
  1050. tempTip.setDuration(2000);
  1051. tempTip.showSuccess('重置接口回传标记成功!');
  1052. } else {
  1053. tempTip.setDuration(5000);
  1054. tempTip.show(response.data.fail_info);
  1055. }
  1056. }).catch(function (err) {
  1057. tempTip.setDuration(3000);
  1058. tempTip.show("网络错误:" + err)
  1059. });
  1060. },
  1061. changeRemark() {
  1062. this.typeId = '';
  1063. this.result_explain = '';
  1064. },
  1065. focusOnModal(e) {
  1066. $(e.target).removeClass('is-invalid');
  1067. },
  1068. isRejectedBillExist() {
  1069. if (checkData.length === 0) {
  1070. tempTip.show('没有勾选记录');
  1071. return
  1072. }
  1073. tempTip.confirm("是否要生成“" + checkData + "”的退货单?", () => {
  1074. let _this = this;
  1075. let arr = [];
  1076. window.tempTip.setDuration(9999);
  1077. window.tempTip.waitingTip("生成中,请稍等......")
  1078. this.orders.forEach(order => {
  1079. if (checkData.includes(order.orderno)) arr.push(order.soreference1);
  1080. });
  1081. axios.post('{{url('order/isRejectedBillExist')}}', {data: arr})
  1082. .then(function (response) {
  1083. if (!response.data.success) {
  1084. tempTip.confirm(response.data.data + ',已存在,是否仍要生成退货单?', function () {
  1085. _this.createRejectedBill();
  1086. window.tempTip.cancelWaitingTip();
  1087. }, function () {
  1088. window.tempTip.cancelWaitingTip();
  1089. });
  1090. return;
  1091. }
  1092. _this.createRejectedBill();
  1093. }).catch(function (error) {
  1094. tempTip.setDuration(3000);
  1095. tempTip.cancelWaitingTip();
  1096. tempTip.show('网络错误:' + error);
  1097. });
  1098. });
  1099. },
  1100. createRejectedBill() {
  1101. let url = '{{url('order/createRejectedBill')}}';
  1102. axios.post(url, {data: checkData})
  1103. .then(res => {
  1104. if (res.data.success) {
  1105. tempTip.cancelWaitingTip();
  1106. tempTip.setDuration(2000);
  1107. tempTip.showSuccess("生成退货单成功!");
  1108. } else {
  1109. tempTip.cancelWaitingTip();
  1110. tempTip.setDuration(3000);
  1111. tempTip.show(res.data.data);
  1112. }
  1113. })
  1114. .catch(err => {
  1115. tempTip.cancelWaitingTip();
  1116. tempTip.setDuration(3000);
  1117. tempTip.show('网络错误:' + err);
  1118. });
  1119. },
  1120. isExistByOrderNos() {
  1121. let orderNos = checkData;
  1122. let data = {orderNos: orderNos};
  1123. let _this = this;
  1124. axios.post("{{url('apiLocal/order/issue/isExistByOrderNo')}}", data).then(function (res) {
  1125. if (res.data.success) {
  1126. _this.getTagOrder(orderNos);
  1127. $("#exampleModal").modal('show')
  1128. } else {
  1129. _this.message.checkOrderIssueMessage = res.data.fail_info
  1130. $("#checkModal").modal('show')
  1131. }
  1132. }).catch(function (error) {
  1133. tempTip.setDuration(3000)
  1134. tempTip.show('网络异常:' + error)
  1135. })
  1136. },
  1137. replaceText(index) {
  1138. this.$set(this.orders[index], "replaceText", true);
  1139. },
  1140. getTagOrder(orderNos) {
  1141. this.tagOrders = [];
  1142. if (orderNos.length === 0) {
  1143. this.tagOrders = [];
  1144. return;
  1145. }
  1146. if (this.orders.length === 0) {
  1147. this.tagOrders = [];
  1148. return;
  1149. }
  1150. for (let i = 0; i < this.orders.length; i++) {
  1151. let order = this.orders[i];
  1152. let orderno = order.orderno;
  1153. if (orderNos.includes(orderno)) {
  1154. this.tagOrders.push(this.orders[i])
  1155. }
  1156. }
  1157. this.setLogisticInfo();
  1158. this.setMerchantInfo();
  1159. },
  1160. setLogisticInfo() {
  1161. let content = ''
  1162. let _this = this
  1163. this.tagOrders.forEach(order => {
  1164. content += _this.getOrderLogisticNumbers(order);
  1165. let tel = order.c_tel2 ? order.c_tel2 : order.c_tel1;
  1166. content += ' ' + order.c_contact + tel + order.c_province + order.c_city + ' ' + order.c_district + order.c_address1 + '\n' + _this.result_explain + "\n"
  1167. })
  1168. this.tagOrder.logisticInfo = content
  1169. },
  1170. setMerchantInfo() {
  1171. let content = ''
  1172. let _this = this
  1173. this.tagOrders.forEach(order => {
  1174. content += order.issuepartyname + ' ' + order.customer_descr_c + ' ' + order.soreference1 + ' ' + _this.getOrderLogisticNumbers(order)
  1175. content += '\n' + _this.result_explain + "\n"
  1176. })
  1177. this.tagOrder.merchantInfo = content
  1178. },
  1179. copyLogisticInfo() {
  1180. this.copyText(this.tagOrder.logisticInfo)
  1181. },
  1182. copyLogisticNumber() {
  1183. let text = "";
  1184. checkData.forEach((code, i) => {
  1185. if (this.picktotraceidMap[code] && this.picktotraceidMap[code].length > 1) {
  1186. this.picktotraceidMap[code].forEach((number, j) => {
  1187. text += number + "\r\n";
  1188. });
  1189. } else {
  1190. this.orders.some(order => {
  1191. if (order.orderno == code) {
  1192. if (order.soreference5) {
  1193. text += order.soreference5 + "\r\n";
  1194. }
  1195. return true;
  1196. }
  1197. });
  1198. }
  1199. });
  1200. text.substring(0, text.lastIndexOf("\r\n", text));
  1201. if (!text) text = " ";
  1202. this.copyText(text)
  1203. },
  1204. copyMerchantInfo() {
  1205. this.copyText(this.tagOrder.merchantInfo)
  1206. },
  1207. copyText(text) {
  1208. try {
  1209. $('#clipboardDiv').text(text).select().focus();
  1210. document.execCommand("Copy");
  1211. tempTip.setIndex(1052)
  1212. tempTip.setDuration(2000)
  1213. tempTip.showSuccess('复制成功')
  1214. } catch (e) {
  1215. tempTip.setIndex(1052)
  1216. tempTip.setDuration(2000)
  1217. tempTip.showSuccess('复制失败:' + e)
  1218. }
  1219. },
  1220. getOrderLogisticNumbers(order) {
  1221. let char = '';
  1222. let picktotraceids = this.picktotraceidMap[order.orderno];
  1223. if ($.type(picktotraceids) === 'array') {
  1224. picktotraceids.forEach(function (picktotraceid, index, array) {
  1225. if (array.length === index + 1) char += picktotraceid;
  1226. else char += picktotraceid + ','
  1227. });
  1228. } else {
  1229. char += order.soreference5
  1230. }
  1231. return char;
  1232. },
  1233. checkWorkOrderOrCreateWorkOrder(){
  1234. window.tempTip.setIndex(1999);
  1235. window.tempTip.waitingTip('校验是否有对应工单');
  1236. this.checkWorkOrder().then(res=>{
  1237. window.tempTip.cancelWaitingTip();
  1238. if (res) {
  1239. window.tempTip.confirm('当前勾选订单已有工单是否查看',()=>{
  1240. this.workOrderInfo = this.workOrderInfos[0];
  1241. this.workOrderIndex = 0;
  1242. $('#work-order-info').modal('show');
  1243. },()=>{
  1244. this.showInterceptModel();
  1245. },'查看','重新生成工单');
  1246. } else {
  1247. this.showInterceptModel();
  1248. }
  1249. }).catch(err=>{
  1250. window.tempTip.cancelWaitingTip();
  1251. })
  1252. },
  1253. showCreateWorkOrder(){
  1254. $("#work-order-info").modal('hide');
  1255. $("#intercept-modal").modal('show');
  1256. },
  1257. showInterceptModel() {
  1258. if (checkData.length < 1) {
  1259. window.tempTip.setDuration(1500);
  1260. window.tempTip.show('未选中任何订单');
  1261. return;
  1262. }
  1263. this.workOrder.orderIssueType = null;
  1264. this.workOrder.price = null;
  1265. this.workOrder.type = null;
  1266. this.workOrder.refundImages = [];
  1267. this.workOrder.packageImages = [];
  1268. this.workOrder.commodityImages = [];
  1269. this.workOrder.dealImages = [];
  1270. this.workOrder.remark.info = '';
  1271. this.workOrder.commodities = [];
  1272. this.workOrder.logistic_number = null;
  1273. $("#intercept-modal").modal('show');
  1274. },
  1275. checkOrderIssue(name) { //
  1276. let types = this.orderIssueType.filter(item => {
  1277. return item.name === name;
  1278. });
  1279. if (types.length === 0) return false;
  1280. return this.workOrder.orderIssueType === types[0].id
  1281. },
  1282. pushImagesAndShow(e, images) {
  1283. let map = [];
  1284. for (let i = 0; i < e.target.files.length; i++) {
  1285. let image = e.target.files[i];
  1286. if (this.imageExist(image,images)) {
  1287. map.push(image.name);
  1288. continue;
  1289. }
  1290. let src = window.URL.createObjectURL(image);
  1291. images.push({src: src, file: image});
  1292. }
  1293. e.target.value = '';
  1294. if (map.length === 0)return ;
  1295. window.tempTip.setIndex(1999);
  1296. window.tempTip.show(map.join('\n,')+'图片重复');
  1297. },
  1298. imageExist(image,images) {
  1299. let arr = images.filter(item => {
  1300. return item.file.name === image.name;
  1301. });
  1302. return arr.length > 0;
  1303. },
  1304. spliceImage(i, images) {
  1305. if (!confirm('是否取消选择该图片')) return;
  1306. images.splice(i, 1);
  1307. },
  1308. buildWorkOrder() { // 生成工单
  1309. if (['信息更改', '错漏发', '破损'].includes(this.workOrder.orderIssueType) && checkData.length !== 1) {
  1310. window.tempTip.show('该类型不能批量操作');
  1311. return;
  1312. }
  1313. if ('拦截' === this.workOrder.orderIssueType) {
  1314. this.createInterceptWorkOrder();
  1315. } else if ('信息更改' === this.workOrder.orderIssueType) {
  1316. this.createInformationChangeWorkOrder();
  1317. } else if ('快递丢件' === this.workOrder.orderIssueType) {
  1318. this.createLossWorkOrder();
  1319. } else if ('快递异常' === this.workOrder.orderIssueType) {
  1320. this.createExpressAbnormalWorkOrder();
  1321. } else if ('错漏发' === this.workOrder.orderIssueType) {
  1322. this.createMistakeWorkOrder();
  1323. } else if ('破损' === this.workOrder.orderIssueType) {
  1324. this.createDamagedWorkOrder();
  1325. } else if('取消拦截') {
  1326. this.createCancelInterceptWorkOrder();
  1327. }
  1328. },
  1329. createInterceptWorkOrder() { // 拦截
  1330. let formData = new FormData();
  1331. let url = null;
  1332. if(checkData.length===1){
  1333. formData.append('order_no',checkData[0]);
  1334. formData.append('remark',this.workOrder ? (this.workOrder.remark ? this.workOrder.remark.info : '') : '');
  1335. url = "{{route('workOrder.intercept.storeApi')}}";
  1336. } else if (checkData.length > 1){
  1337. checkData.forEach(e=>formData.append('order_nos[]',e));
  1338. formData.append('remark',this.workOrder ? (this.workOrder.remark ? this.workOrder.remark.info : '') : '');
  1339. url = "{{route('workOrder.intercept.BatchStoreApi')}}";
  1340. }
  1341. this.createWorkOrder(formData,url);
  1342. },
  1343. createCancelInterceptWorkOrder(){
  1344. let formData = new FormData();
  1345. formData.append('order_no',checkData[0]);
  1346. formData.append('remark',this.workOrder ? (this.workOrder.remark ? this.workOrder.remark.info : '') : '');
  1347. let url = "{{route('workOrder.cancelIntercept.storeApi')}}";
  1348. this.createWorkOrder(formData,url);
  1349. },
  1350. createInformationChangeWorkOrder() { // 信息修改
  1351. let data = this.getCreateWorkOrderData();
  1352. if (data.length > 1){
  1353. window.tempTip.setIndex(1999);
  1354. window.tempTip.show('信息修改仅支持单个订单修改');
  1355. return ;
  1356. }
  1357. data = data[0];
  1358. if (!data.remark){
  1359. window.tempTip.setIndex(1999);
  1360. window.tempTip.show('收方信息不能为空');
  1361. return ;
  1362. }
  1363. let url = "{{route('workOrder.informationChange.storeApi')}}";
  1364. this.createWorkOrder(data,url);
  1365. },
  1366. createLossWorkOrder(){ // 快递丢件
  1367. let data = this.getCreateWorkOrderData();
  1368. let formData = new FormData();
  1369. formData.append('order_no', data[0]['order_no']);
  1370. formData.append('remark', this.workOrder.remark.info);
  1371. let url = "{{route('workOrder.loss.storeApi')}}";
  1372. this.createWorkOrder(formData,url);
  1373. },
  1374. createExpressAbnormalWorkOrder(){ // 快递异常
  1375. if (!this.checkExpressAbnormalWorkOrder()) return;
  1376. let data = this.getCreateWorkOrderData();
  1377. let formData = new FormData();
  1378. formData.append('order_no', data[0]['order_no']);
  1379. formData.append('remark', this.workOrder.remark ? this.workOrder.remark.info : '');
  1380. formData.append('type', this.workOrder.type);
  1381. formData.append('process_progress', this.workOrder.type);
  1382. let dealImages = this.getImages(this.workOrder.dealImages);
  1383. this.setFormDataImagePrefix(formData, 'dealImages', dealImages);
  1384. let res = this.setFormDataCommodities(formData);
  1385. if (!res){
  1386. window.tempTip.setIndex(2000);
  1387. window.tempTip.setDuration(1500);
  1388. window.tempTip.show('请勾选快递单号!');
  1389. return
  1390. }
  1391. let url = "{{route('workOrder.expressAbnormal.storeApi')}}";
  1392. this.createWorkOrder(formData, url);
  1393. },
  1394. createMistakeWorkOrder() { // 错漏发
  1395. let data = this.getCreateWorkOrderData();
  1396. let formData = new FormData();
  1397. formData.append('order_no', data[0]['order_no']);
  1398. formData.append('remark', data[0]['remark']);
  1399. if (data[0]['logistic_number']){
  1400. formData.append('logistic_number', data[0]['logistic_number']);
  1401. }
  1402. let dealImages = this.getImages(this.workOrder.dealImages);
  1403. this.setFormDataImagePrefix(formData, 'dealImages', dealImages);
  1404. let res = this.setFormDataCommodities(formData);
  1405. if (!res){
  1406. window.tempTip.setIndex(2000);
  1407. window.tempTip.setDuration(1500);
  1408. window.tempTip.show('检查是否所有商品为为错漏发');
  1409. return
  1410. }
  1411. let url = "{{route('workOrder.mistake.storeApi')}}";
  1412. this.createWorkOrder(formData, url);
  1413. },
  1414. createDefaultWorkOrder() { // 其他
  1415. let data = this.getCreateWorkOrderData();
  1416. this.createWorkOrder(data);
  1417. },
  1418. createDamagedWorkOrder() { //破损工单创建
  1419. let packageImages = this.getImages(this.workOrder.packageImages); // 外包装破损图片
  1420. let commodityImages = this.getImages(this.workOrder.commodityImages); // 内物破损图片
  1421. let dealImages = this.getImages(this.workOrder.dealImages); // 交易截图
  1422. if (!this.checkDamagedWorkOrder(packageImages,commodityImages,dealImages)) return;
  1423. let formData = this.getDamagedFormData(packageImages,commodityImages,dealImages);
  1424. if (this.workOrder.return_logistic_number){
  1425. formData.append('return_logistic_number',this.workOrder.return_logistic_number);
  1426. }
  1427. let url = "{{route('workOrder.damage.storeApi')}}";
  1428. this.createWorkOrder(formData, url);
  1429. },
  1430. checkWorkOrderImage(packageImages,commodityImages,dealImages) {
  1431. let message = null;
  1432. if (0 === packageImages.length) {
  1433. message = '请选择外包图片';
  1434. } else if (0 === commodityImages.length) {
  1435. message = '请选择内物装破损图片';
  1436. } else if (0 === dealImages.length && this.isBaoShi === false) {
  1437. message = '请选择交易截图'
  1438. }
  1439. return message;
  1440. },
  1441. getDamagedFormData(packageImages,commodityImages,dealImages){
  1442. let formData = new FormData();
  1443. let data = this.getCreateWorkOrderData();
  1444. formData.append('order_no', data[0]['order_no']);
  1445. formData.append('remark', data[0]['remark']);
  1446. if (data[0]['logistic_number']){
  1447. formData.append('logistic_number', data[0]['logistic_number']);
  1448. }
  1449. formData.append('price', this.workOrder.price);
  1450. this.setFormDataImagePrefix(formData,'packageImages',packageImages);
  1451. this.setFormDataImagePrefix(formData,'commodityImages',commodityImages);
  1452. this.setFormDataImagePrefix(formData,'dealImages',dealImages);
  1453. this.workOrder.commodities = this.workOrder.commodities.filter(e=>{
  1454. return Number(e.abnormal_amount) > 0;
  1455. });
  1456. this.setFormDataCommodities(formData);
  1457. return formData;
  1458. },
  1459. setFormDataCommodities(formData){
  1460. let {orderIssueType} = this.workOrder;
  1461. let commodities= this.workOrder.commodities.filter(e=>{
  1462. if('错漏发' === orderIssueType){
  1463. return e.amount !== e.abnormal_amount;
  1464. } else if('快递异常' === orderIssueType){
  1465. return e.selected;
  1466. }
  1467. return true;
  1468. }).map(e=>{
  1469. let {abnormal_type,sku,amount,abnormal_amount,logistic_number,commodity_id,price} = e;
  1470. return {
  1471. sku:sku,
  1472. amount:amount,
  1473. commodity_id:commodity_id,
  1474. logistic_number:logistic_number,
  1475. abnormal_amount:abnormal_amount,
  1476. abnormal_type:abnormal_type,
  1477. price:price,
  1478. };
  1479. });
  1480. if ('错漏发' === orderIssueType && commodities.length === 0) return false;
  1481. else if ('快递异常' === orderIssueType && commodities.length === 0) return false;
  1482. commodities.forEach(e=>{
  1483. formData.append('commodities[]',JSON.stringify(e));
  1484. })
  1485. return true;
  1486. },
  1487. setFormDataImagePrefix(formData, prefix, images) {
  1488. images.forEach((item) => {
  1489. formData.append(`${prefix}[]`, item);
  1490. });
  1491. },
  1492. getImages(images) {
  1493. return images.map((item) => {
  1494. return item.file;
  1495. })
  1496. },
  1497. checkDamagedWorkOrder(packageImages,commodityImages,dealImages){
  1498. let message = null;
  1499. if (!this.checkPrice()){
  1500. message = '商品价值需大于0';
  1501. }
  1502. if (!message){
  1503. message = this.checkWorkOrderImage(packageImages,commodityImages,dealImages);
  1504. }
  1505. let filter = this.workOrder.commodities.filter(e=>{
  1506. return Number(e.price) <=0 || Number(e.abnormal_amount) <= 0;
  1507. })
  1508. if (filter.length > 0 && !this.isBaoShi){
  1509. message = '破损商品的数量和价格不能为0';
  1510. }
  1511. if (message){
  1512. window.tempTip.setIndex(1999);
  1513. window.tempTip.show(message);
  1514. return false;
  1515. }
  1516. return true;
  1517. },
  1518. checkPrice(){
  1519. return parseInt(this.workOrder.price) !== 0;
  1520. },
  1521. createWorkOrder(data, url) {
  1522. window.tempTip.setIndex(1999);
  1523. window.tempTip.waitingTip('生成工单中');
  1524. window.axios.post(url, data, {'Content-Type': 'multipart/form-data'}).then(res => {
  1525. window.tempTip.cancelWaitingTip();
  1526. if (res.data.success) {
  1527. window.tempTip.showSuccess('工单生成成功');
  1528. $('#intercept-modal').modal('hide');
  1529. this.tagWorkOrders(checkData);
  1530. } else {
  1531. if (res.data.errors){
  1532. for (const resKey in res.data.errors) {
  1533. window.tempTip.show(res.data.errors[resKey]);
  1534. return ;
  1535. }
  1536. }else{
  1537. window.tempTip.show(res.data.message ? res.data.message : '工单创建异常');
  1538. }
  1539. }
  1540. }).catch(err => {
  1541. window.tempTip.cancelWaitingTip();
  1542. window.tempTip.show(err)
  1543. });
  1544. },
  1545. tagWorkOrders(orderNos){
  1546. this.orders.forEach((item)=>{
  1547. if (orderNos.includes(item.orderno)){
  1548. item['is_work_order'] = true;
  1549. }
  1550. })
  1551. },
  1552. clearWorkOrder(){
  1553. this.workOrder.packageImages = [];
  1554. this.workOrder.dealImages = [];
  1555. this.workOrder.commodities = [];
  1556. this.workOrder.price = '';
  1557. this.workOrder.logisticNumber = '';
  1558. this.workOrder.orderIssueType = 0;
  1559. },
  1560. getCreateWorkOrderData() {
  1561. return checkData.map(item => {
  1562. return {
  1563. order_no: item,
  1564. order_issue_type: this.workOrder.orderIssueType,
  1565. remark: this.workOrder.remark.info,
  1566. };
  1567. });
  1568. },
  1569. changeReceiveInfo() {
  1570. let url = '{{url('apiLocal/workOrder/editOrderReceiveInfo')}}';
  1571. let data = {
  1572. order_nos: checkData[0],
  1573. remake: `${this.remark.name} ${this.remark.phone} ${this.remark.province} ${this.remark.city} ${this.remark.city} ${this.remark.district} ${this.remark.adder}`,
  1574. };
  1575. window.tempTip.setIndex('1999');
  1576. window.axios.post(url, data).then(res => {
  1577. if (res.data.success) {
  1578. window.tempTip.showSuccess('生成修改工单成功');
  1579. $('#intercept-modal').modal('hide');
  1580. } else {
  1581. window.tempTip.show(res.data.message);
  1582. }
  1583. }).catch(err => {
  1584. window.tempTip.show(err);
  1585. });
  1586. },
  1587. manualBack() {
  1588. let _this = this;
  1589. let orders = [];
  1590. let fail = [];
  1591. let isGreater = false;
  1592. const start = new Date(new Date(new Date().toLocaleDateString()).getTime() + 16 * 60 * 60 * 1000 + 30 * 60 * 1000);
  1593. if (checkData.length === 0) {
  1594. tempTip.show('没有勾选记录');
  1595. return;
  1596. }
  1597. _this.orders.forEach(function (order) {
  1598. if (new Date(new Date(order.addtime).getTime()) > start) isGreater = true;
  1599. checkData.forEach(function (checkedId) {
  1600. if (order.orderno === checkedId) {
  1601. if (order.soreference5 //存在快递单号
  1602. && order.releasestatus != 'H' //订单未冻结
  1603. && order.manualflag == 'N' //订单未回传
  1604. && (order.sostatus == '00' ||
  1605. order.sostatus == '10' ||
  1606. order.sostatus == '20' ||
  1607. order.sostatus == '40' ||
  1608. order.sostatus == '50' ||
  1609. order.sostatus == '60' ||
  1610. order.sostatus == '61')//订单状态为 创建订单,部分预配,预配完成,分配完成,部分拣货,拣货完成,或播种完成
  1611. ) {
  1612. orders.push(order.orderno);
  1613. } else {
  1614. fail.push(order.orderno)
  1615. }
  1616. }
  1617. });
  1618. });
  1619. let failText = '';
  1620. fail.forEach(function (item) {
  1621. failText += item + ','
  1622. });
  1623. if (isGreater) {
  1624. if (!confirm('订单中包含16:30以后推送的订单,有超时揽收风险,是否确定操作?')) return;
  1625. } else {
  1626. if (!confirm('提前回传订单将无法取消,是否确定操作?')) return;
  1627. }
  1628. let url = '{{url('order/manualBack')}}';
  1629. window.axios.post(url, {ordernos: orders})
  1630. .then(res => {
  1631. if (res.data.success) {
  1632. _this.orders.forEach(function (order) {
  1633. res.data.successNo.forEach(function (success_item) {
  1634. if (order.orderno == success_item) {
  1635. if (order.sostatus == '00'
  1636. || order.sostatus == '10'
  1637. || order.sostatus == '20') {
  1638. order.ordercodename = '分配完成';
  1639. }
  1640. order.manualflag = 'Y';
  1641. }
  1642. })
  1643. })
  1644. res.data.failNo.forEach(function (item) {
  1645. failText += item + ','
  1646. });
  1647. if (failText.length > 0) {
  1648. failText = failText.substr(0, failText.length - 1);
  1649. }
  1650. window.tempTip.setDuration(4000);
  1651. window.tempTip.showSuccess('回传成功!' + ' 单号:' + failText + '不满足回传条件,系统已自动筛除');
  1652. this.$forceUpdate();
  1653. return;
  1654. }
  1655. window.tempTip.setDuration(3000);
  1656. window.tempTip.show('人工回传失败');
  1657. }).catch(err => {
  1658. window.tempTip.setDuration(3000);
  1659. window.tempTip.show("网络错误:" + err);
  1660. });
  1661. },
  1662. isDB(item) {
  1663. if (item.indexOf('德邦') == -1 || item.indexOf('京东') == -1) return false;
  1664. return true;
  1665. },
  1666. collectUpload(){
  1667. if(checkData.length===0){tempTip.show('没有勾选记录');return;}
  1668. const data = {
  1669. 'orderno': checkData,
  1670. 'strict': false,
  1671. };
  1672. window.axios.post("{{url('order/collectUpload')}}", data).then(res => {
  1673. if (res.data.success) {
  1674. tempTip.showSuccess(res.data.message)
  1675. }else {
  1676. tempTip.show(res.data.error_message);
  1677. }
  1678. });
  1679. },
  1680. fillWorkOrderCommodity(){
  1681. let url = "{{route('order.commodity.getCommoditiesApi')}}";
  1682. let data = {orderNo:checkData[0]};
  1683. window.axios.post(url,data).then(res=>{
  1684. if (res.data.success){
  1685. if(this.workOrder.orderIssueType === '快递异常'){
  1686. let logistic_numbers = res.data.data.map(e=>e.logistic_number);
  1687. let array = Array.from(new Set(logistic_numbers));
  1688. array = array.map(e=>{return {logistic_number:e,selected:false}});
  1689. this.workOrder.commodities = array;
  1690. return ;
  1691. }
  1692. let commodities = res.data.data.map(item=>{
  1693. item.abnormal_amount = item.amount;
  1694. item.abnormal_type = this.workOrder.orderIssueType === '错漏发' ? '未错漏发' : '';
  1695. item.price = 0;
  1696. return item;
  1697. });
  1698. this.groupByLogisticNumber(commodities);
  1699. this.workOrder.commodities = commodities;
  1700. } else {
  1701. }
  1702. }).catch(err=>{
  1703. })
  1704. },
  1705. groupByLogisticNumber(commodities){
  1706. let index = 0;
  1707. let logistic_number = commodities[0]['logistic_number'];
  1708. let count = 0;
  1709. for(let i = 0; i < commodities.length;i++){
  1710. let cur_logistic_number = commodities[i]['logistic_number'];
  1711. if (cur_logistic_number === logistic_number){
  1712. count ++;
  1713. commodities[index]['count'] = count;
  1714. } else if (cur_logistic_number !== logistic_number){
  1715. logistic_number = cur_logistic_number;
  1716. commodities[index]['count'] = count;
  1717. index = i ;count = 1;
  1718. commodities[index]['count'] = count;
  1719. }
  1720. }
  1721. },
  1722. pasteImage(event,imageArray){
  1723. for (let i = 0; i < event.clipboardData.items.length; i++) {
  1724. let item = event.clipboardData.items[i];
  1725. if (item.kind === 'string') continue;
  1726. if (item.type.indexOf('image') === -1) continue;
  1727. if (item.kind === 'file'){
  1728. let blob = item.getAsFile();
  1729. let src = null;
  1730. this.blobToBase64(blob).then(res => {
  1731. src = res;
  1732. imageArray.push({src:src,file:blob});
  1733. });
  1734. }
  1735. }
  1736. event.preventDefault();
  1737. },
  1738. blobToBase64(blob) {
  1739. return new Promise((resolve, reject) => {
  1740. const fileReader = new FileReader();
  1741. fileReader.onload = (e) => {
  1742. resolve(e.target.result);
  1743. };
  1744. fileReader.readAsDataURL(blob);
  1745. fileReader.onerror = () => {
  1746. reject(new Error('blobToBase64 error'));
  1747. };
  1748. });
  1749. },
  1750. checkWorkOrder(){
  1751. return new Promise((resolve, reject)=>{
  1752. let no = checkData;
  1753. let url = '{{route('workOrder.checkApi')}}';
  1754. window.axios.post(url,{no:no}).then(res=>{
  1755. if (res.data.success){
  1756. this.workOrderInfos = [];
  1757. res.data.data.forEach(e=>{
  1758. let array = this.conversionWorkOrder(e);
  1759. this.workOrderInfos.push(...array);
  1760. });
  1761. if (this.workOrderInfos.length>0)resolve(true) ;
  1762. else resolve(false);
  1763. } else {
  1764. this.workOrderInfos = [];
  1765. resolve(false);
  1766. }
  1767. }).catch(err=>{
  1768. reject(err);
  1769. });
  1770. });
  1771. },
  1772. conversionWorkOrder(workOrder){
  1773. let items = [];
  1774. workOrder.details.forEach(detail=>{
  1775. let item = this.conversionDetail(detail);
  1776. item.logistic_numbers = this.getLogisticNumbers(workOrder);
  1777. item.clientCode = workOrder.order ? workOrder.order.client_code : '';
  1778. items.push(item);
  1779. });
  1780. return items;
  1781. },
  1782. conversionDetail(detail){
  1783. return {
  1784. type: detail.issue_type ? detail.issue_type.name : '',
  1785. detail:{
  1786. price:detail.price,
  1787. return_logistic_number:detail.return_logistic_number,
  1788. reissue_logistic_number:detail.reissue_logistic_number,
  1789. },
  1790. commodities:this.getCommodities(detail),
  1791. packagesImages:this.getImageList(detail.images,'外包装图片'),
  1792. commodityImages:this.getImageList(detail.images,'内物破碎图片'),
  1793. dealImages:this.getImageList(detail.images,'交易截图'),
  1794. refundImages:this.getImageList(detail.images,'退款成功截图'),
  1795. remark:detail.remark,
  1796. issue_name : detail.issue_type ? detail.issue_type.name : '',
  1797. };
  1798. },
  1799. getLogisticNumbers(workOrder){
  1800. let packages = workOrder? (workOrder.order ? workOrder.order.packages : []) : [] ;
  1801. return packages.map(e=>{return e.logistic_number});
  1802. },
  1803. getDetails(workOrder){
  1804. let details = workOrder ? workOrder.details : [];
  1805. return details.map(e=>{return e;});
  1806. },
  1807. getCommodities(detail){
  1808. return (detail ? detail.commodities : []).map(item=>{
  1809. item.name =item.commodity ? item.commodity.name :'';
  1810. return item;
  1811. });
  1812. },
  1813. getImageList(images,type){
  1814. let filePrefix = "{{asset("/storage")}}";
  1815. let imageList = images.filter(e=>{
  1816. return parseInt(e.type) === parseInt(type);
  1817. });
  1818. return imageList.map(e=>{
  1819. return {
  1820. src:filePrefix+(e.upload_file ? e.upload_file.url : '')+'.'+(e.upload_file? e.upload_file.type : ''),
  1821. };
  1822. });
  1823. },
  1824. selectWorkOrderIndex(index){
  1825. if (index < 0)index = this.workOrderInfos.length-1;
  1826. if (index >= this.workOrderInfos.length) index = 0;
  1827. this.workOrderIndex = index;
  1828. this.workOrderInfo = this.workOrderInfos[index];
  1829. },
  1830. showParentWorkOrder(){
  1831. if (parseInt(this.workOrderIndex) === 0) return false;
  1832. return this.workOrderIndex < this.workOrderInfos -1;
  1833. },
  1834. showNextWorkOrder(){
  1835. if (parseInt(this.workOrderIndex) === (this.workOrderInfos.length -1)) return false;
  1836. return this.workOrderIndex < this.workOrderInfos.length -1;
  1837. },
  1838. addWorkOrderCommodity(){
  1839. window.tempTip.setIndex(1999);
  1840. window.tempTip.setDuration(1500);
  1841. let sku = this.$refs['add-commodity-sku'].value;
  1842. let logistic_number = this.$refs['add-commodity-logistic-number'].value;
  1843. if (logistic_number.trim().length === 0){
  1844. window.tempTip.show('填写快递单号');
  1845. return ;
  1846. }
  1847. let {customerid} = this.orders.find((item)=>{
  1848. return item.orderno === checkData[0];
  1849. });
  1850. this.getCommodity(customerid,sku).then(res => {
  1851. if (res===null){
  1852. window.tempTip.show('请检查商品条码');
  1853. } else {
  1854. this.workOrder.commodities.push({
  1855. logistic_number:logistic_number,
  1856. commodity_id:res.id,
  1857. name:res.name,
  1858. abnormal_type:"错发",
  1859. amount:0,
  1860. sku:this.$refs['add-commodity-sku'].value,
  1861. abnormal_amount:this.$refs['add-commodity-number'].value,
  1862. });
  1863. this.countByCommodities(this.workOrder.commodities);
  1864. this.$refs['add-commodity-logistic-number'].value = "";
  1865. this.$refs['add-commodity-sku'].value = "";
  1866. this.$refs['add-commodity-number'].value = "";
  1867. window.tempTip.showSuccess("添加成功");
  1868. }
  1869. }).catch(err=>{
  1870. window.tempTip.show("获取商品信息异常");
  1871. });
  1872. },
  1873. getCommodity(owner,code){
  1874. return new Promise((resolve, reject) => {
  1875. let url = "{{route('commodity.getCommodityApi')}}";
  1876. let data = {owner_code:owner,sku:code};
  1877. console.log(data);
  1878. window.axios.post(url,data).then(res=>{
  1879. if (res.data.success){
  1880. resolve(res.data.data);
  1881. } else {
  1882. resolve(null);
  1883. }
  1884. }).catch(err=>{
  1885. reject(null);
  1886. });
  1887. });
  1888. },
  1889. computeAbnormalType(item){
  1890. this.sunPrice();
  1891. if (this.workOrder.orderIssueType !=='错漏发') return;
  1892. let abnormal_amount = Number(item.abnormal_amount); // 客户实收数量
  1893. let amount = Number(item.amount);
  1894. item.abnormal_type = abnormal_amount === amount ? '未错漏发' : (amount < abnormal_amount ? '多发' : '少发')
  1895. },
  1896. sunPrice(){
  1897. this.workOrder.price = this.workOrder.commodities.reduce((prev,cur)=>{
  1898. return prev + Number(cur.price) * Number(cur.abnormal_amount);
  1899. },0);
  1900. },
  1901. checkExpressAbnormalWorkOrder(){ // 校验 快递异常问题
  1902. window.tempTip.setIndex(1999);
  1903. window.tempTip.setDuration(1500);
  1904. let message = null;
  1905. if (this.workOrder.commodities.length === 0)message = '快递单号为空';
  1906. if (this.workOrder.dealImages.length === 0 && this.isBaoShi === false) message = '交易截图为必须项!';
  1907. if (!this.workOrder.type) message = '快递异常类型不能为空';
  1908. if (message){
  1909. window.tempTip.show(message);
  1910. return false;
  1911. }
  1912. return true;
  1913. },
  1914. countByCommodities(commodities){
  1915. if (commodities.length === 0) return;
  1916. let index = 0;
  1917. let logistic_number = commodities[0]['logistic_number'];
  1918. let count = 0;
  1919. for(let i = 0; i < commodities.length;i++){
  1920. let cur_logistic_number = commodities[i]['logistic_number'];
  1921. if (i === commodities.length - 1 && cur_logistic_number === logistic_number){
  1922. count ++;
  1923. commodities[index]['count'] = count;
  1924. break;
  1925. }
  1926. if (logistic_number === cur_logistic_number){
  1927. count++;
  1928. } else if (logistic_number !== cur_logistic_number){
  1929. commodities[index]['count'] = count;
  1930. index = i;
  1931. count = 1;
  1932. }
  1933. if (i === commodities.length - 1){
  1934. commodities[index]['count'] = count;
  1935. }
  1936. }
  1937. },
  1938. },
  1939. });
  1940. </script>
  1941. @endsection