delivering.blade.php 105 KB

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