delivering.blade.php 106 KB

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