delivering.blade.php 106 KB

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