order1.vue 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="公司名" prop="companyId">
  5. <el-select filterable v-model="companyIds" placeholder="请选择公司名" multiple @change="companyChange" clearable size="small">
  6. <el-option
  7. v-for="item in companys"
  8. :key="item.companyId"
  9. :label="item.companyName"
  10. :value="item.companyId"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item v-if="deptOpen">
  15. <treeselect style="width: 220px" :clearable="false" v-model="queryParams.deptId" :options="deptOptions" clearable :show-count="true" placeholder="请选择归属部门" />
  16. </el-form-item>
  17. <el-form-item label="会员ID" prop="userId">
  18. <el-input
  19. v-model="queryParams.userId"
  20. placeholder="请输入会员ID"
  21. clearable
  22. size="small"
  23. @keyup.enter.native="handleQuery"
  24. />
  25. </el-form-item>
  26. <el-form-item label="店铺" prop="storeId">
  27. <el-select v-model="queryParams.storeId" placeholder="店铺" clearable size="small" filterable>
  28. <el-option
  29. v-for="dict in storeOPtions"
  30. :key="dict.dictValue"
  31. :label="dict.dictLabel"
  32. :value="dict.dictValue"
  33. />
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="订单号" prop="orderCodes">
  37. <div class="tag-input-container">
  38. <!-- 标签显示区域 -->
  39. <div class="tags-wrapper" @click="focusInput">
  40. <!-- 已添加的订单号标签 -->
  41. <el-tag
  42. v-for="(code, index) in queryParams.orderCodes"
  43. :key="index"
  44. closable
  45. size="small"
  46. @close="removeOrderCode(index)"
  47. class="order-tag"
  48. :class="{ 'tag-error': false }"
  49. >
  50. {{ code }}
  51. </el-tag>
  52. <!-- 输入框 -->
  53. <el-input
  54. ref="tagInput"
  55. v-model="currentInput"
  56. v-show="inputVisible || queryParams.orderCodes.length === 0"
  57. :placeholder="queryParams.orderCodes.length === 0 ? '请输入订单号,按回车或逗号分隔' : '继续输入...'"
  58. size="small"
  59. class="tag-input"
  60. @keydown.native="handleKeyDown"
  61. @keyup.native="handleKeyUp"
  62. @blur="handleInputConfirm"
  63. @focus="inputVisible = true"
  64. clearable
  65. />
  66. <!-- 添加按钮(当没有输入时显示) -->
  67. <el-button
  68. v-if="!inputVisible && queryParams.orderCodes.length > 0"
  69. class="button-new-tag"
  70. size="small"
  71. @click="showInput"
  72. icon="el-icon-plus"
  73. type="text"
  74. >
  75. 添加订单号
  76. </el-button>
  77. </div>
  78. <!-- 输入提示 -->
  79. <div class="input-tips">
  80. <span class="tip-text">
  81. 支持:回车、逗号、空格分隔 |
  82. 已添加 {{ queryParams.orderCodes.length }} 个订单号
  83. <span v-if="maxOrderCodes > 0"> (最多{{ maxOrderCodes }}个)</span>
  84. </span>
  85. </div>
  86. </div>
  87. </el-form-item>
  88. <el-form-item label="快递单号" prop="deliverySn">
  89. <el-input
  90. v-model="queryParams.deliverySn"
  91. placeholder="请输入快递单号"
  92. clearable
  93. size="small"
  94. @keyup.enter.native="handleQuery"
  95. />
  96. </el-form-item>
  97. <el-form-item label="处方单号" prop="prescribeCode">
  98. <el-input
  99. v-model="queryParams.prescribeCode"
  100. placeholder="请输入处方单号"
  101. clearable
  102. size="small"
  103. @keyup.enter.native="handleQuery"
  104. />
  105. </el-form-item>
  106. <el-form-item label="支付方式" prop="payType">
  107. <el-select multiple v-model="payTypeArr" placeholder="请选择支付方式" clearable filterable size="small" >
  108. <el-option
  109. v-for="item in PayOptions"
  110. :key="'type'+item.dictValue"
  111. :label="item.dictLabel"
  112. :value="item.dictValue"
  113. />
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item label="员工姓名" prop="companyUserNickName">
  117. <el-input
  118. v-model="queryParams.companyUserNickName"
  119. placeholder="请输入员工姓名"
  120. clearable
  121. size="small"
  122. @keyup.enter.native="handleQuery"
  123. />
  124. </el-form-item>
  125. <el-form-item label="套餐名称" prop="packageName">
  126. <el-input
  127. v-model="queryParams.packageName"
  128. placeholder="请输套餐名称"
  129. clearable
  130. size="small"
  131. @keyup.enter.native="handleQuery"
  132. />
  133. </el-form-item>
  134. <el-form-item label="套餐别名" prop="packageSecondName">
  135. <el-input
  136. v-model="queryParams.packageSecondName"
  137. placeholder="请输套餐别名"
  138. clearable
  139. size="small"
  140. @keyup.enter.native="handleQuery"
  141. />
  142. </el-form-item>
  143. <el-form-item label="收货人" prop="userName">
  144. <el-input
  145. v-model="queryParams.userName"
  146. placeholder="请输入收货人"
  147. clearable
  148. size="small"
  149. @keyup.enter.native="handleQuery"
  150. />
  151. </el-form-item>
  152. <el-form-item label="电话" prop="userPhone">
  153. <el-input
  154. v-model="queryParams.userPhone"
  155. placeholder="请输入收货人电话"
  156. clearable
  157. size="small"
  158. @keyup.enter.native="handleQuery"
  159. />
  160. </el-form-item>
  161. <el-form-item label="加密号码" prop="userPhoneMk">
  162. <el-input
  163. v-model="queryParams.userPhoneMk"
  164. placeholder="请输入收货人电话"
  165. clearable
  166. size="small"
  167. @keyup.enter.native="handleQuery"
  168. />
  169. </el-form-item>
  170. <el-form-item label="医生姓名" prop="doctorName">
  171. <el-input
  172. v-model="queryParams.doctorName"
  173. placeholder="请输入医生姓名"
  174. clearable
  175. size="small"
  176. @keyup.enter.native="handleQuery"
  177. />
  178. </el-form-item>
  179. <el-form-item label="患者姓名" prop="patientName">
  180. <el-input
  181. v-model="queryParams.patientName"
  182. placeholder="请输入患者姓名"
  183. clearable
  184. size="small"
  185. @keyup.enter.native="handleQuery"
  186. />
  187. </el-form-item>
  188. <el-form-item label="物流状态" prop="deliveryStatus">
  189. <el-select v-model="queryParams.deliveryStatus" placeholder="请选择物流状态" clearable size="small" >
  190. <el-option
  191. v-for="item in deliveryStatusOptions"
  192. :key="item.dictValue"
  193. :label="item.dictLabel"
  194. :value="item.dictValue"
  195. />
  196. </el-select>
  197. </el-form-item>
  198. <el-form-item label="结算状态" prop="deliveryPayStatus">
  199. <el-select style="width: 200px" v-model="queryParams.deliveryPayStatus" placeholder="请选择物流结算状态" clearable size="small" >
  200. <el-option
  201. v-for="item in deliveryPayStatusOptions"
  202. :key="item.dictValue"
  203. :label="item.dictLabel"
  204. :value="item.dictValue"
  205. />
  206. </el-select>
  207. </el-form-item>
  208. <el-form-item label="订单类型" prop="orderType">
  209. <el-select filterable v-model="queryParams.orderType" placeholder="状态" clearable size="small">
  210. <el-option
  211. v-for="dict in orderTypeOptions"
  212. :key="dict.dictValue"
  213. :label="dict.dictLabel"
  214. :value="dict.dictValue"
  215. />
  216. </el-select>
  217. </el-form-item>
  218. <el-form-item label="是否首次进线" prop="isFirst">
  219. <el-select filterable v-model="queryParams.isFirst" placeholder="状态" clearable size="small">
  220. <el-option
  221. v-for="dict in orOptions"
  222. :key="dict.dictValue"
  223. :label="dict.dictLabel"
  224. :value="dict.dictValue"
  225. />
  226. </el-select>
  227. </el-form-item>
  228. <el-form-item label="档期归属" prop="scheduleId" >
  229. <el-select multiple filterable style="width: 200px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
  230. <el-option
  231. v-for="item in scheduleOptions"
  232. :key="'scheduleId'+item.id"
  233. :label="item.name"
  234. :value="item.id"
  235. />
  236. </el-select>
  237. </el-form-item>
  238. <el-form-item label="订单购买类型" prop="orderBuyType">
  239. <el-select multiple filterable style="width: 200px" v-model="buyTypeArr" placeholder="请选择购买类型" clearable size="small" >
  240. <el-option
  241. v-for="item in orderBuyTypeOptions"
  242. :key="'bugType'+item.dictValue"
  243. :label="item.dictLabel"
  244. :value="item.dictValue"
  245. />
  246. </el-select>
  247. </el-form-item>
  248. <el-form-item label="渠道" prop="channel">
  249. <el-select multiple filterable style="width: 200px" v-model="channelArr" placeholder="请选择渠道" clearable size="small" >
  250. <el-option
  251. v-for="item in channelOptions"
  252. :key="'channel'+item.dictValue"
  253. :label="item.dictLabel"
  254. :value="item.dictValue"
  255. />
  256. </el-select>
  257. </el-form-item>
  258. <el-form-item label="企微主体" prop="qwSubject">
  259. <el-select multiple filterable style="width: 200px" v-model="qwSubjectArr" placeholder="请选择企微主体" clearable size="small" >
  260. <el-option
  261. v-for="item in qwSubjectOptions"
  262. :key="'qwSubject'+item.dictValue"
  263. :label="item.dictLabel"
  264. :value="item.dictValue"
  265. />
  266. </el-select>
  267. </el-form-item>
  268. <el-form-item label="推广佣金状态" prop="tuiMoneyStatus">
  269. <el-select filterable style="width: 200px" v-model="queryParams.tuiMoneyStatus" placeholder="请选择推广佣金状态" clearable size="small" >
  270. <el-option
  271. v-for="item in tuiOptions"
  272. :key="item.dictValue"
  273. :label="item.dictLabel"
  274. :value="item.dictValue"
  275. />
  276. </el-select>
  277. </el-form-item>
  278. <el-form-item label="订单来源" prop="source">
  279. <el-select v-model="queryParams.source" placeholder="请选择是否支付" clearable size="small">
  280. <el-option
  281. v-for="dict in sourceOptions"
  282. :key="dict.dictValue"
  283. :label="dict.dictLabel"
  284. :value="dict.dictValue"
  285. />
  286. </el-select>
  287. </el-form-item>
  288. <el-form-item label="下单时间" prop="createTime">
  289. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
  290. </el-form-item>
  291. <el-form-item label="支付时间" prop="payTime">
  292. <el-date-picker v-model="payTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changePayTime"></el-date-picker>
  293. </el-form-item>
  294. <el-form-item label="发货时间" prop="deliverySendTime">
  295. <el-date-picker v-model="deliverySendTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
  296. </el-form-item>
  297. <el-form-item label="回单时间" prop="deliveryImportTime">
  298. <el-date-picker v-model="deliveryImportTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
  299. </el-form-item>
  300. <el-form-item label="入账时间" prop="tuiMoneyTime">
  301. <el-date-picker v-model="tuiMoneyTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
  302. </el-form-item>
  303. <el-form-item label="ERP账户" prop="erpAccount" v-if="SFDFopen">
  304. <el-select v-model="queryParams.erpAccount" placeholder="ERP账户" clearable size="small">
  305. <el-option
  306. v-for="dict in erpAccountList"
  307. :key="dict"
  308. :label="dict"
  309. :value="dict"
  310. />
  311. </el-select>
  312. </el-form-item>
  313. <el-form-item label="ERP电话" prop="erpPhoneNumber" v-if="SFDFopen">
  314. <el-input
  315. v-model="queryParams.erpPhoneNumber"
  316. placeholder="ERP电话"
  317. clearable
  318. size="small"
  319. @keyup.enter.native="handleQuery"
  320. />
  321. </el-form-item>
  322. <el-form-item>
  323. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  324. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  325. </el-form-item>
  326. </el-form>
  327. <el-row :gutter="10" class="mb8">
  328. <el-col :span="1.5">
  329. <el-button
  330. type="warning"
  331. plain
  332. icon="el-icon-download"
  333. size="mini"
  334. :loading="exportLoading"
  335. @click="handleExport"
  336. v-hasPermi="['his:storeOrder:export']"
  337. >财务导出</el-button>
  338. </el-col>
  339. <el-col :span="1.5">
  340. <el-button
  341. type="warning"
  342. plain
  343. icon="el-icon-download"
  344. size="mini"
  345. :loading="exportLoading"
  346. @click="handleOrderExport"
  347. v-hasPermi="['store:storeOrder:export']"
  348. >导出订单</el-button>
  349. </el-col>
  350. <el-col :span="1.5">
  351. <el-button
  352. type="info"
  353. plain
  354. icon="el-icon-upload2"
  355. size="mini"
  356. @click="handleImport"
  357. v-hasPermi="['his:storeOrder:exportDeliver']"
  358. >导入发货</el-button>
  359. </el-col>
  360. <el-col :span="1.5">
  361. <el-button
  362. type="info"
  363. plain
  364. icon="el-icon-upload2"
  365. size="mini"
  366. @click="handleImportExpress"
  367. v-hasPermi="['store:storeOrder:importExpress']"
  368. >导入银行回单</el-button>
  369. </el-col>
  370. <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6"> <!--待推送erp-->
  371. <el-tooltip content="默认erp推送手机号" placement="top">
  372. <el-button
  373. type="warning"
  374. plain
  375. icon="el-icon-phone"
  376. size="mini"
  377. @click="handleErpPhone"
  378. v-hasPermi="['store:storeOrder:erpphone']"
  379. >推送手机号码</el-button>
  380. </el-tooltip>
  381. </el-col>
  382. <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
  383. <el-tooltip content="批量设置erp推送手机号" placement="top">
  384. <el-button
  385. type="warning"
  386. plain
  387. icon="el-icon-phone"
  388. size="mini"
  389. @click="setErpPhone"
  390. v-hasPermi="['his:storeOrder:createErpOrder']"
  391. >设置推送手机</el-button>
  392. </el-tooltip>
  393. </el-col>
  394. <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
  395. <el-tooltip content="批量设置erp账户" placement="top">
  396. <el-button
  397. type="warning"
  398. plain
  399. icon="el-icon-s-cooperation"
  400. size="mini"
  401. @click="showErpAccountSetDialog"
  402. v-hasPermi="['his:storeOrder:createErpOrder']"
  403. >数据分捡</el-button>
  404. </el-tooltip>
  405. </el-col>
  406. <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
  407. <el-tooltip content="批量推送erp" placement="top">
  408. <el-button
  409. type="warning"
  410. plain
  411. icon="el-icon-s-cooperation"
  412. size="mini"
  413. @click="showErpAccountDialog"
  414. v-hasPermi="['his:storeOrder:createErpOrder']"
  415. >创建erp</el-button>
  416. </el-tooltip>
  417. </el-col>
  418. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  419. </el-row>
  420. <el-tabs type="card" v-model="actName" @tab-click="handleClickX">
  421. <el-tab-pane label="全部订单" name="10"></el-tab-pane>
  422. <el-tab-pane v-for="(item,index) in orderOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  423. </el-tabs>
  424. <el-table ref="orderTable" height="500" v-loading="loading" border :data="orderList" @selection-change="handleSelectionChange"
  425. @sort-change="handleSortChange" :default-sort="{prop: 'createTime', order: 'descending'}">
  426. <el-table-column type="selection" width="55" align="center" />
  427. <el-table-column label="ERP电话" align="center" prop="erpPhone" v-if="SFDFopen && orderStatus!=null && orderStatus != 1"/>
  428. <el-table-column label="ERP账号" align="center" prop="erpAccount" v-if="SFDFopen && orderStatus!=null && orderStatus != 1"/>
  429. <el-table-column label="处方单编号" align="center" prop="prescribeCode" width="180px"/>
  430. <el-table-column label="药品订单号" align="center" prop="orderCode" width="180px"/>
  431. <el-table-column label="所属公司" align="center" prop="companyName" />
  432. <el-table-column label="员工" align="center" prop="companyUserName" sortable="custom" :sort-orders="['ascending', 'descending']">
  433. <template slot="header" slot-scope="scope">
  434. <span>员工</span>
  435. <el-tooltip content="按员工姓名排序" placement="top"/>
  436. </template>
  437. </el-table-column>
  438. <el-table-column label="店铺名称" align="center" prop="storeName" />
  439. <el-table-column label="就诊人" align="center" prop="patientName" />
  440. <el-table-column label="收货人" align="center" prop="userName" />
  441. <el-table-column label="套餐名称" align="center" prop="packageName" width="100px" sortable="custom" :sort-orders="['ascending', 'descending']">
  442. <template slot="header" slot-scope="scope">
  443. <span>套餐名称</span>
  444. <el-tooltip content="按套餐名称排序" placement="top"/>
  445. </template>
  446. </el-table-column>
  447. <el-table-column label="套餐别名" align="center" prop="packageSecondName" width="100px"/>
  448. <el-table-column label="应收金额" align="center" prop="payPrice" width="100px" sortable="custom" :sort-orders="['ascending', 'descending']">
  449. <template slot="header" slot-scope="scope">
  450. <span>应收金额</span>
  451. <el-tooltip content="按应收金额排序" placement="top"/>
  452. </template>
  453. </el-table-column>
  454. <el-table-column label="实收金额" align="center" prop="payMoney" width="100px" sortable="custom" :sort-orders="['ascending', 'descending']">
  455. <template slot="header" slot-scope="scope">
  456. <span>实收金额</span>
  457. <el-tooltip content="按实收金额排序" placement="top"/>
  458. </template>
  459. </el-table-column>
  460. <el-table-column label="支付方式" align="center" prop="payType" >
  461. <template slot-scope="scope">
  462. <dict-tag :options="PayOptions" :value="scope.row.payType"/>
  463. </template>
  464. </el-table-column>
  465. <el-table-column label="下单时间" align="center" prop="createTime" width="180" />
  466. <el-table-column label="支付时间" align="center" prop="payTime" width="180" />
  467. <el-table-column label="订单状态" align="center" prop="status" >
  468. <template slot-scope="scope">
  469. <dict-tag :options="orderOptions" :value="scope.row.status"/>
  470. </template>
  471. </el-table-column>
  472. <el-table-column label="订单来源" align="center" prop="source" >
  473. <template slot-scope="scope">
  474. <dict-tag :options="sourceOptions" :value="scope.row.source"/>
  475. </template>
  476. </el-table-column>
  477. <el-table-column label="物流状态" align="center" prop="deliveryStatus" >
  478. <template slot-scope="scope">
  479. <dict-tag :options="deliveryStatusOptions" :value="scope.row.deliveryStatus"/>
  480. </template>
  481. </el-table-column>
  482. <el-table-column label="结算状态" align="center" prop="deliveryPayStatus" >
  483. <template slot-scope="scope">
  484. <dict-tag :options="deliveryPayStatusOptions" :value="scope.row.deliveryPayStatus"/>
  485. </template>
  486. </el-table-column>
  487. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
  488. <template slot-scope="scope">
  489. <el-button
  490. size="mini"
  491. type="text"
  492. @click="handledetails(scope.row)"
  493. >查看
  494. </el-button>
  495. </template>
  496. </el-table-column>
  497. </el-table>
  498. <pagination
  499. v-show="total>0"
  500. :total="total"
  501. :page.sync="queryParams.pageNum"
  502. :limit.sync="queryParams.pageSize"
  503. @pagination="getList"
  504. />
  505. <!-- 排序状态显示 -->
  506. <div v-if="currentSort.prop" class="sort-info">
  507. <el-tag size="small" type="info" closable @close="clearSort">
  508. <i class="el-icon-sort"></i>
  509. 当前排序:{{ getSortLabel(currentSort.prop) }}
  510. {{ currentSort.order === 'ascending' ? '升序' : '降序' }}
  511. </el-tag>
  512. <el-button
  513. type="text"
  514. size="mini"
  515. @click="clearSort"
  516. style="margin-left: 8px; color: #909399;"
  517. >
  518. </el-button>
  519. </div>
  520. <el-drawer
  521. :with-header="false"
  522. size="75%"
  523. :title="show.title" :visible.sync="show.open">
  524. <storeOrderDetails ref="Details" />
  525. </el-drawer>
  526. <!-- 用户导入对话框 -->
  527. <el-dialog :title="importExpress.title" :visible.sync="importExpress.open" width="400px" append-to-body>
  528. <el-upload
  529. ref="importExpress"
  530. :limit="1"
  531. accept=".xlsx, .xls"
  532. :headers="importExpress.headers"
  533. :action="importExpress.url + '?updateSupport=' + importExpress.updateSupport"
  534. :disabled="importExpress.isUploading"
  535. :on-progress="handleFileUploadProgressExpress"
  536. :on-success="handleFileSuccessExpress"
  537. :auto-upload="false"
  538. drag
  539. >
  540. <i class="el-icon-upload"></i>
  541. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  542. <div class="el-upload__tip text-center" slot="tip">
  543. <div class="el-upload__tip" slot="tip">
  544. <!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的数据 -->
  545. </div>
  546. <span>仅允许导入xls、xlsx格式文件。</span>
  547. <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplateExpress">下载模板</el-link>
  548. </div>
  549. </el-upload>
  550. <div slot="footer" class="dialog-footer">
  551. <el-button type="primary" @click="submitFileFormExpress">确 定</el-button>
  552. <el-button @click="importExpress.open = false">取 消</el-button>
  553. </div>
  554. </el-dialog>
  555. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  556. <el-upload
  557. ref="upload"
  558. :limit="1"
  559. accept=".xlsx, .xls"
  560. :headers="upload.headers"
  561. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  562. :disabled="upload.isUploading"
  563. :on-progress="handleFileUploadProgress"
  564. :on-success="handleFileSuccess"
  565. :auto-upload="false"
  566. drag
  567. >
  568. <i class="el-icon-upload"></i>
  569. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  570. <div class="el-upload__tip text-center" slot="tip">
  571. <div class="el-upload__tip" slot="tip">
  572. </div>
  573. <span>仅允许导入xls、xlsx格式文件。</span>
  574. <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
  575. </div>
  576. </el-upload>
  577. <div slot="footer" class="dialog-footer">
  578. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  579. <el-button @click="upload.open = false">取 消</el-button>
  580. </div>
  581. </el-dialog>
  582. <!-- 设置推送手机对话框 -->
  583. <el-dialog :title="erpPhone.title" :visible.sync="erpPhone.open" width="600px" append-to-body>
  584. <div style="margin-bottom: 20px;">
  585. <el-button type="primary" size="small" @click="handleAddPhone">新增手机号</el-button>
  586. </div>
  587. <el-table :data="phoneList" border style="width: 100%">
  588. <el-table-column prop="phone" label="手机号" align="center">
  589. <template slot-scope="scope">
  590. <el-input
  591. v-if="scope.row.editing"
  592. v-model="scope.row.phone"
  593. placeholder="请输入手机号"
  594. @blur="validatePhone(scope.row)"
  595. @keyup.enter.native="handleSavePhone(scope.$index)"
  596. />
  597. <span v-else>{{ scope.row.phone }}</span>
  598. </template>
  599. </el-table-column>
  600. <el-table-column label="操作" align="center" width="300">
  601. <template slot-scope="scope">
  602. <el-button
  603. v-if="scope.row.editing"
  604. type="success"
  605. size="mini"
  606. @click="handleSavePhone(scope.$index)"
  607. >保存</el-button>
  608. <el-button
  609. v-if="scope.row.editing"
  610. type="info"
  611. size="mini"
  612. @click="handleCancelEdit(scope.$index)"
  613. >取消</el-button>
  614. <el-button
  615. v-if="!scope.row.editing"
  616. type="primary"
  617. size="mini"
  618. @click="handleEditPhone(scope.$index)"
  619. >修改</el-button>
  620. <el-button
  621. type="danger"
  622. size="mini"
  623. @click="handleDeletePhone(scope.$index)"
  624. >删除</el-button>
  625. </template>
  626. </el-table-column>
  627. </el-table>
  628. <div slot="footer" class="dialog-footer">
  629. <el-button type="primary" @click="handleSavePhoneList">确 定</el-button>
  630. <el-button @click="handleCancelPhoneDialog">取 消</el-button>
  631. </div>
  632. </el-dialog>
  633. <el-dialog :title="erpPhone.title" :visible.sync="setPhoneOpen" width="600px" append-to-body>
  634. <el-select v-model="erpPhoneValue" multiple placeholder="请选择">
  635. <el-option
  636. v-for="item in phoneList"
  637. :key="item.phone"
  638. :label="item.phone"
  639. :value="item.phone">
  640. </el-option>
  641. </el-select>
  642. <div slot="footer" class="dialog-footer">
  643. <el-button type="primary" @click="submitErpPhone">确 定</el-button>
  644. <el-button @click="handleCancelErpPhone">取 消</el-button>
  645. </div>
  646. </el-dialog>
  647. <!-- ERP账户选择对话框 -->
  648. <el-dialog :title="erpAccountDialog.title" :visible.sync="erpAccountDialog.open" width="600px" append-to-body>
  649. <div v-loading="erpAccountDialog.loading">
  650. <el-form :model="erpAccountForm" label-width="100px">
  651. <el-form-item label="ERP账户" required>
  652. <el-select
  653. v-model="erpAccountForm.selectedAccount"
  654. placeholder="请选择ERP账户"
  655. style="width: 100%"
  656. filterable
  657. >
  658. <el-option
  659. v-for="account in erpAccountList"
  660. :key="account"
  661. :label="account"
  662. :value="account"
  663. >
  664. <span style="float: left">{{ account}}</span>
  665. <span style="float: right; color: #8492a6; font-size: 13px">{{ account.accountCode }}</span>
  666. </el-option>
  667. </el-select>
  668. </el-form-item>
  669. </el-form>
  670. <!-- 订单统计信息 -->
  671. <div class="order-summary" v-if="orderSummary">
  672. <el-divider content-position="left">订单统计</el-divider>
  673. <el-row :gutter="20">
  674. <el-col :span="8">
  675. <div class="summary-item">
  676. <span class="label">选中订单数:</span>
  677. <span class="value">{{ orderSummary.selectedCount }}</span>
  678. </div>
  679. </el-col>
  680. <el-col :span="8">
  681. <div class="summary-item">
  682. <span class="label">总金额:</span>
  683. <span class="value">¥{{ orderSummary.totalAmount }}</span>
  684. </div>
  685. </el-col>
  686. <el-col :span="8">
  687. <div class="summary-item">
  688. <span class="label">查询条件订单:</span>
  689. <span class="value">{{ orderSummary.queryCount }}</span>
  690. </div>
  691. </el-col>
  692. </el-row>
  693. </div>
  694. </div>
  695. <div slot="footer" class="dialog-footer">
  696. <el-button @click="cancelErpAccountDialog">取 消</el-button>
  697. <el-button
  698. type="primary"
  699. @click="confirmCreateErpOrder"
  700. :disabled="!erpAccountForm.selectedAccount"
  701. :loading="erpAccountDialog.submitting"
  702. >确认</el-button>
  703. </div>
  704. </el-dialog>
  705. </div>
  706. </template>
  707. <script>
  708. import { listOrder, getOrder, delOrder, addOrder,importExpressTemplate, updateOrder, exportOrder,importTemplate,exportOrder2,queryErpPhone,
  709. saveErpPhone,editErpPhone,batchCreateErpOrder,getErpAccount,batchSetErpOrder } from "@/api/his/storeOrder";
  710. import storeOrderDetails from '../../components/his/storeOrderDetails.vue';
  711. import { getToken } from "@/utils/auth";
  712. import {listStore} from "@/api/his/storeProduct";
  713. import { getCompanyList } from "@/api/company/company";
  714. import { getTcmScheduleList } from "@/api/company/schedule";
  715. import { treeselect } from "@/api/company/companyDept";
  716. import Treeselect from "@riophae/vue-treeselect";
  717. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  718. import { getTask } from "@/api/common";
  719. export default {
  720. name: "Order",
  721. components: { storeOrderDetails,Treeselect },
  722. watch: {
  723. // 监听deptId
  724. 'deptId': 'currDeptChange'
  725. },
  726. // computed: {
  727. // // 计算选中账户的详细信息
  728. // selectedAccountInfo() {
  729. // if (!this.erpAccountForm.selectedAccount) return null;
  730. // return this.erpAccountList.find(account => account.id === this.erpAccountForm.selectedAccount);
  731. // }
  732. // },
  733. data() {
  734. return {
  735. // 新增排序相关数据
  736. currentSort: {
  737. prop: null,
  738. order: null
  739. },
  740. // 排序字段映射
  741. sortFieldMap: {
  742. 'companyUserName': '员工',
  743. 'packageName': '套餐名称',
  744. 'payPrice': '应收金额',
  745. 'payMoney': '实收金额',
  746. 'createTime': '下单时间'
  747. },
  748. erpSettingType:'set',
  749. SFDFopen:false,
  750. // 最大订单号数量限制
  751. maxOrderCodes: {
  752. type: Number,
  753. default: 50
  754. },
  755. // 输入框是否可见
  756. inputVisible: false,
  757. // 无效订单号对话框
  758. showInvalidDialog: false,
  759. // 当前输入值
  760. currentInput: '',
  761. deptOpen:true,
  762. // ERP账户相关数据
  763. erpAccountDialog: {
  764. open: false,
  765. title: "选择ERP账户",
  766. loading: false,
  767. submitting: false
  768. },
  769. erpAccountList: [], // ERP账户列表
  770. erpAccountForm: {
  771. selectedAccount: null // 选中的账户ID
  772. },
  773. orderSummary: null, // 订单统计信息
  774. erpPhoneValue:[],
  775. setPhoneOpen:false,
  776. erpPhone:{
  777. open:false,
  778. title:"设置推送手机号"
  779. },
  780. phoneList: [], // 手机号列表
  781. originalPhoneList: [], // 原始手机号列表,用于取消时恢复
  782. orderStatus:null,
  783. scheduleOptions:[],
  784. companys:[],
  785. deptOptions:[],
  786. companyId:undefined,
  787. companyIds:[],
  788. deptId:undefined,
  789. actName:"10",
  790. show:{
  791. title:"订单详情",
  792. open:false,
  793. },
  794. sourceOptions:[],
  795. importExpress: {
  796. // 是否显示弹出层
  797. open: false,
  798. // 弹出层标题
  799. title: "",
  800. // 是否禁用上传
  801. isUploading: false,
  802. // 是否更新已经存在的用户数据
  803. updateSupport: 0,
  804. // 设置上传的请求头部
  805. headers: { Authorization: "Bearer " + getToken() },
  806. // 上传的地址
  807. url: process.env.VUE_APP_BASE_API + "/his/storeOrder/importExpress"
  808. },
  809. upload: {
  810. // 是否显示弹出层
  811. open: false,
  812. // 弹出层标题
  813. title: "",
  814. // 是否禁用上传
  815. isUploading: false,
  816. // 是否更新已经存在的用户数据
  817. updateSupport: 0,
  818. // 设置上传的请求头部
  819. headers: { Authorization: "Bearer " + getToken() },
  820. // 上传的地址
  821. url: process.env.VUE_APP_BASE_API + "/his/storeOrder/importData"
  822. },
  823. // 遮罩层
  824. loading: true,
  825. // 导出遮罩层
  826. exportLoading: false,
  827. // 选中数组
  828. ids: [],
  829. // 非单个禁用
  830. single: true,
  831. // 非多个禁用
  832. multiple: true,
  833. // 显示搜索条件
  834. showSearch: true,
  835. // 总条数
  836. total: 0,
  837. // 订单表格数据
  838. orderList: [],
  839. payTypeArr:[],
  840. scheduleIdArr:[],
  841. buyTypeArr:[],
  842. channelArr:[],
  843. qwSubjectArr:[],
  844. // 弹出层标题
  845. title: "",
  846. createTime:null,
  847. payTime:null,
  848. deliveryImportTime:null,
  849. deliverySendTime:null,
  850. tuiMoneyTime:null,
  851. // 是否显示弹出层
  852. open: false,
  853. // 查询参数
  854. queryParams: {
  855. pageNum: 1,
  856. pageSize: 10,
  857. storeId: null,
  858. orderCode: null,
  859. orderCodes: [],
  860. userId: null,
  861. userName: null,
  862. userPhone: null,
  863. userPhoneMk: null,
  864. userAddress: null,
  865. cartId: null,
  866. totalNum: null,
  867. totalPrice: null,
  868. payPrice: null,
  869. payMoney: null,
  870. isPay: null,
  871. payTime: null,
  872. payType: null,
  873. status: null,
  874. refundStatus: null,
  875. refundImg: null,
  876. refundExplain: null,
  877. refundTime: null,
  878. refundReason: null,
  879. refundMoney: null,
  880. deliveryCode: null,
  881. deliveryName: null,
  882. deliverySn: null,
  883. isDel: null,
  884. costPrice: null,
  885. verifyCode: null,
  886. shippingType: null,
  887. isChannel: null,
  888. isPrescribe: null,
  889. prescribeId: null,
  890. finishTime: null,
  891. patientName: null,
  892. doctorName: null,
  893. sTime:null,
  894. eTime:null,
  895. paysTime:null,
  896. payeTime:null,
  897. deliveryTime: null,
  898. tuiMoney: null,
  899. tuiMoneyStatus: null,
  900. tuisTime:null,
  901. tuieTime:null,
  902. tuiUserId: null,
  903. orderCreateType: null,
  904. companyUserName:null,
  905. companyName:null,
  906. packageSecondName:null,
  907. isFirst:null,
  908. source:null,
  909. companyId:null,
  910. companyIds:null
  911. },
  912. // 表单参数
  913. form: {},
  914. // 表单校验
  915. rules: {
  916. },
  917. PayOptions:[],
  918. orderOptions:[],
  919. payStatusOptions:[],
  920. refundOptions:[],
  921. channelOptions:[],
  922. qwSubjectOptions:[],
  923. orderTypeOptions:[],
  924. orderBuyTypeOptions:[],
  925. tuiOptions:[],
  926. orOptions:[],
  927. storeOPtions:[],
  928. deliveryPayStatusOptions:[],
  929. deliveryStatusOptions:[],
  930. };
  931. },
  932. created() {
  933. getCompanyList().then(response => {
  934. this.companys = response.data;
  935. if(this.companys!=null&&this.companys.length>0){
  936. // this.companyId=this.companys[0].companyId;
  937. this.getTreeselect();
  938. }
  939. this.companys.push({companyId:"-1",companyName:"无"})
  940. });
  941. getTcmScheduleList().then(response => {
  942. this.scheduleOptions = response.data;
  943. this.scheduleOptions.push({id: "-1",
  944. name: "无"})
  945. });
  946. this.getstoreList();
  947. this.getList();
  948. this.getDicts("sys_store_order_buy_type").then(response => {
  949. this.orderBuyTypeOptions = response.data;
  950. this.orderBuyTypeOptions.push({dictLabel: "无",
  951. dictValue: "-1"})
  952. });
  953. this.getDicts("sys_store_pay_type").then(response => {
  954. this.PayOptions = response.data;
  955. });
  956. this.getDicts("sys_order_source").then(response => {
  957. this.sourceOptions = response.data;
  958. });
  959. this.getDicts("sys_store_order_type").then(response => {
  960. this.orderTypeOptions = response.data;
  961. });
  962. this.getDicts("sys_order_status").then(response => {
  963. this.orderOptions = response.data;
  964. });
  965. this.getDicts("sys_order_pay").then(response => {
  966. this.payStatusOptions = response.data;
  967. });
  968. this.getDicts("sys_refund_status").then(response => {
  969. this.refundOptions = response.data;
  970. });
  971. this.getDicts("sys_store_channel").then(response => {
  972. this.channelOptions = response.data;
  973. this.channelOptions.push({dictLabel: "无",
  974. dictValue: "-1"})
  975. });
  976. this.getDicts("sys_store_qw_subject").then(response => {
  977. this.qwSubjectOptions = response.data;
  978. this.qwSubjectOptions.push({dictLabel: "无",
  979. dictValue: "-1"})
  980. });
  981. this.getDicts("sys_tui_money_status").then(response => {
  982. this.tuiOptions = response.data;
  983. });
  984. this.getDicts("sys_company_or").then(response => {
  985. this.orOptions = response.data;
  986. });
  987. this.getDicts("sys_store_delivery_pay_status").then(response => {
  988. this.deliveryPayStatusOptions = response.data;
  989. });
  990. this.getDicts("sys_store_order_delivery_status").then(response => {
  991. this.deliveryStatusOptions = response.data;
  992. });
  993. this.getErpAccountList();
  994. },
  995. methods: {
  996. // 新增排序处理方法
  997. handleSortChange({ column, prop, order }) {
  998. console.log('排序变化:', { column, prop, order });
  999. // 更新当前排序状态
  1000. this.currentSort = {
  1001. prop: prop,
  1002. order: order
  1003. };
  1004. // 更新查询参数
  1005. if (order) {
  1006. this.queryParams.sortField = prop;
  1007. this.queryParams.sortOrder = order === 'ascending' ? 'asc' : 'desc';
  1008. } else {
  1009. this.queryParams.sortField = null;
  1010. this.queryParams.sortOrder = null;
  1011. }
  1012. // 重新查询数据
  1013. this.queryParams.pageNum = 1; // 重置到第一页
  1014. this.getList();
  1015. // 显示排序提示
  1016. if (order) {
  1017. const fieldLabel = this.getSortLabel(prop);
  1018. const orderLabel = order === 'ascending' ? '升序' : '降序';
  1019. this.$message.success(`已按${fieldLabel}${orderLabel}排序`);
  1020. }
  1021. },
  1022. // 获取排序字段的中文标签
  1023. getSortLabel(prop) {
  1024. return this.sortFieldMap[prop] || prop;
  1025. },
  1026. // 清除排序
  1027. clearSort() {
  1028. this.currentSort = {
  1029. prop: null,
  1030. order: null
  1031. };
  1032. this.queryParams.sortField = null;
  1033. this.queryParams.sortOrder = null;
  1034. this.queryParams.pageNum = 1;
  1035. // 重置表格排序状态 - 关键代码
  1036. this.$nextTick(() => {
  1037. if (this.$refs.orderTable) {
  1038. this.$refs.orderTable.clearSort();
  1039. }
  1040. });
  1041. this.getList();
  1042. this.$message.success('已清除排序');
  1043. },
  1044. // 修改查询列表方法,添加排序参数
  1045. getList() {
  1046. this.loading = true;
  1047. // 处理多选参数
  1048. if(this.payTypeArr.length>0){
  1049. this.queryParams.payType=this.payTypeArr.toString();
  1050. } else {
  1051. this.queryParams.payType=null
  1052. }
  1053. if(this.scheduleIdArr.length>0){
  1054. this.queryParams.scheduleId=this.scheduleIdArr.toString();
  1055. } else {
  1056. this.queryParams.scheduleId=null
  1057. }
  1058. if(this.buyTypeArr.length>0){
  1059. this.queryParams.orderBuyType=this.buyTypeArr.toString();
  1060. } else {
  1061. this.queryParams.orderbuyType=null
  1062. }
  1063. if(this.channelArr.length>0){
  1064. this.queryParams.orderChannel=this.channelArr.toString();
  1065. } else {
  1066. this.queryParams.orderChannel=null
  1067. }
  1068. if(this.qwSubjectArr.length>0){
  1069. this.queryParams.qwSubject=this.qwSubjectArr.toString();
  1070. } else {
  1071. this.queryParams.qwSubject=null
  1072. }
  1073. // 处理公司参数
  1074. if(this.companyIds && this.companyIds.length>1){
  1075. this.queryParams.companyIds = this.companyIds
  1076. this.queryParams.companyId = null;
  1077. this.queryParams.deptId = null;
  1078. } else {
  1079. this.queryParams.companyId = this.companyId
  1080. this.queryParams.companyIds = null;
  1081. }
  1082. // 处理订单号数组
  1083. if (this.queryParams.orderCodes && this.queryParams.orderCodes.length > 0) {
  1084. this.queryParams.orderCodeList = this.queryParams.orderCodes.join(',');
  1085. } else {
  1086. this.queryParams.orderCodeList = null;
  1087. }
  1088. console.log('查询参数:', this.queryParams);
  1089. listOrder(this.queryParams).then(response => {
  1090. this.orderList = response.rows;
  1091. this.total = response.total;
  1092. this.loading = false;
  1093. if(response.msg == 'jnmy'){
  1094. this.SFDFopen = true;
  1095. } else{
  1096. this.SFDFopen = false;
  1097. }
  1098. // 如果有排序,显示排序结果提示
  1099. if (this.currentSort.prop) {
  1100. const fieldLabel = this.getSortLabel(this.currentSort.prop);
  1101. const orderLabel = this.currentSort.order === 'ascending' ? '升序' : '降序';
  1102. console.log(`数据已按${fieldLabel}${orderLabel}加载`);
  1103. }
  1104. }).catch(error => {
  1105. console.error('查询失败:', error);
  1106. this.loading = false;
  1107. this.$message.error('查询数据失败');
  1108. });
  1109. },
  1110. // 处理键盘按下事件
  1111. handleKeyDown(event) {
  1112. const { key, target } = event
  1113. // 处理退格键删除标签
  1114. if (key === 'Backspace' && !target.value && this.queryParams.orderCodes.length > 0) {
  1115. event.preventDefault()
  1116. this.removeOrderCode(this.queryParams.orderCodes.length - 1)
  1117. }
  1118. // 处理分隔符
  1119. if ([',', ',', ' ', 'Enter'].includes(key)) {
  1120. event.preventDefault()
  1121. this.handleInputConfirm()
  1122. }
  1123. },
  1124. // 处理键盘抬起事件(实时分割输入)
  1125. handleKeyUp(event) {
  1126. const value = event.target.value
  1127. // 检查是否包含分隔符
  1128. if (/[,,\s]/.test(value)) {
  1129. this.handleInputConfirm()
  1130. }
  1131. },
  1132. // 确认输入
  1133. handleInputConfirm() {
  1134. const inputValue = this.currentInput.trim()
  1135. if (inputValue) {
  1136. // 分割多个订单号
  1137. const codes = inputValue.split(/[,,\s]+/).filter(code => code.trim())
  1138. codes.forEach(code => {
  1139. this.addOrderCode(code.trim())
  1140. })
  1141. }
  1142. this.currentInput = ''
  1143. },
  1144. // 添加订单号
  1145. addOrderCode(code) {
  1146. if (!code) return
  1147. // 检查数量限制
  1148. if (this.maxOrderCodes > 0 && this.queryParams.orderCodes.length >= this.maxOrderCodes) {
  1149. this.$message.warning(`最多只能添加 ${this.maxOrderCodes} 个订单号`)
  1150. return
  1151. }
  1152. // 检查重复
  1153. if (this.queryParams.orderCodes.includes(code)) {
  1154. this.$message.warning(`订单号 "${code}" 已存在`)
  1155. return
  1156. }
  1157. // 添加到列表
  1158. this.queryParams.orderCodes.push(code)
  1159. },
  1160. // 删除订单号
  1161. removeOrderCode(index) {
  1162. this.queryParams.orderCodes.splice(index, 1)
  1163. },
  1164. // 清空所有标签
  1165. clearAllTags() {
  1166. this.$confirm('确认清空所有订单号吗?', '提示', {
  1167. confirmButtonText: '确定',
  1168. cancelButtonText: '取消',
  1169. type: 'warning'
  1170. }).then(() => {
  1171. this.queryParams.orderCodes = []
  1172. this.$message.success('已清空所有订单号')
  1173. })
  1174. },
  1175. // 显示输入框
  1176. showInput() {
  1177. this.inputVisible = true
  1178. this.$nextTick(() => {
  1179. this.$refs.tagInput.focus()
  1180. })
  1181. },
  1182. // 删除订单号
  1183. removeOrderCode(index) {
  1184. this.queryParams.orderCodes.splice(index, 1)
  1185. },
  1186. // 聚焦输入框
  1187. focusInput() {
  1188. if (!this.inputVisible) {
  1189. this.showInput()
  1190. }
  1191. },
  1192. // 设置erp账户
  1193. showErpAccountSetDialog() {
  1194. this.erpAccountDialog.open = true;
  1195. // this.erpAccountDialog.loading = true;
  1196. this.erpSettingType = 'set'
  1197. // this.getErpAccountList();
  1198. this.calculateOrderSummary();
  1199. },
  1200. //显示ERP账户选择对话框
  1201. showErpAccountDialog() {
  1202. this.erpAccountDialog.open = true;
  1203. // this.erpAccountDialog.loading = true;
  1204. this.erpSettingType = 'push'
  1205. // this.getErpAccountList();
  1206. this.calculateOrderSummary();
  1207. },
  1208. //获取ERP账户列表
  1209. async getErpAccountList() {
  1210. // getErpAccountList() {
  1211. try {
  1212. const response = await getErpAccount();
  1213. // const response = getErpAccount();
  1214. if (response.code === 200) {
  1215. this.erpAccountList = response.data || [];
  1216. } else {
  1217. this.$message.error(response.msg || '获取ERP账户列表失败');
  1218. this.erpAccountList = [];
  1219. }
  1220. } catch (error) {
  1221. console.error('获取ERP账户列表失败:', error);
  1222. this.$message.error('获取ERP账户列表失败');
  1223. this.erpAccountList = [];
  1224. } finally {
  1225. this.erpAccountDialog.loading = false;
  1226. }
  1227. },
  1228. // 新增:计算订单统计信息
  1229. calculateOrderSummary() {
  1230. let selectedCount = 0;
  1231. let totalAmount = 0;
  1232. let queryCount = this.total || 0;
  1233. if (this.ids.length > 0) {
  1234. // 如果有选中的订单,统计选中的订单
  1235. selectedCount = this.ids.length;
  1236. this.orderList.forEach(order => {
  1237. if (this.ids.includes(order.orderId)) {
  1238. totalAmount += parseFloat(order.payMoney || 0);
  1239. }
  1240. });
  1241. } else {
  1242. // 如果没有选中订单,统计当前查询条件下的所有订单
  1243. selectedCount = queryCount;
  1244. this.orderList.forEach(order => {
  1245. totalAmount += parseFloat(order.payMoney || 0);
  1246. });
  1247. }
  1248. this.orderSummary = {
  1249. selectedCount,
  1250. totalAmount: totalAmount.toFixed(2),
  1251. queryCount
  1252. };
  1253. },
  1254. //确认创建ERP订单
  1255. confirmCreateErpOrder() {
  1256. if (!this.erpAccountForm.selectedAccount) {
  1257. this.$message.warning('请选择ERP账户');
  1258. return;
  1259. }
  1260. console.log("-----------------",this.erpSettingType)
  1261. if(this.erpSettingType == 'set'){
  1262. this.$confirm(
  1263. `确认将订单设置ERP账户为"${this.erpAccountForm.selectedAccount}"吗?`,
  1264. '确认',
  1265. {
  1266. confirmButtonText: '确定',
  1267. cancelButtonText: '取消',
  1268. type: 'warning'
  1269. }
  1270. ).then(() => {
  1271. this.executSetErpOrder();
  1272. });
  1273. } else if(this.erpSettingType == 'push'){
  1274. this.$confirm(
  1275. `确认将订单推送到ERP账户"${this.erpAccountForm.selectedAccount}"吗?`,
  1276. '确认推送',
  1277. {
  1278. confirmButtonText: '确定推送',
  1279. cancelButtonText: '取消',
  1280. type: 'warning'
  1281. }
  1282. ).then(() => {
  1283. this.executeCreateErpOrder();
  1284. });
  1285. }
  1286. },
  1287. async executSetErpOrder() {
  1288. this.erpAccountDialog.submitting = true;
  1289. try {
  1290. let param = {
  1291. loginAccount: this.erpAccountForm.selectedAccount
  1292. };
  1293. if (this.ids.length > 0) {
  1294. // 如果有选中的订单,只推送选中的
  1295. param.orderIds = this.ids;
  1296. } else {
  1297. // 如果没有选中订单,推送查询条件下的所有订单
  1298. if (this.payTypeArr.length > 0) {
  1299. this.queryParams.payType = this.payTypeArr.toString();
  1300. } else {
  1301. this.queryParams.payType = null;
  1302. }
  1303. if (this.scheduleIdArr.length > 0) {
  1304. this.queryParams.scheduleId = this.scheduleIdArr.toString();
  1305. } else {
  1306. this.queryParams.scheduleId = null;
  1307. }
  1308. if (this.buyTypeArr.length > 0) {
  1309. this.queryParams.orderBuyType = this.buyTypeArr.toString();
  1310. } else {
  1311. this.queryParams.orderBuyType = null;
  1312. }
  1313. if (this.channelArr.length > 0) {
  1314. this.queryParams.orderChannel = this.channelArr.toString();
  1315. } else {
  1316. this.queryParams.orderChannel = null;
  1317. }
  1318. if (this.qwSubjectArr.length > 0) {
  1319. this.queryParams.qwSubject = this.qwSubjectArr.toString();
  1320. } else {
  1321. this.queryParams.qwSubject = null;
  1322. }
  1323. // 合并查询参数
  1324. param = { ...param, ...this.queryParams };
  1325. }
  1326. const response = await batchSetErpOrder(param);
  1327. if (response.code === 200) {
  1328. this.$message.success('订单ERP账号设置成功');
  1329. this.cancelErpAccountDialog();
  1330. this.getList(); // 刷新列表
  1331. } else {
  1332. this.$message.error(response.msg || 'ERP账号设置失败');
  1333. }
  1334. } catch (error) {
  1335. console.error('ERP账号设置失败:', error);
  1336. this.$message.error('ERP账号设置失败');
  1337. } finally {
  1338. this.erpAccountDialog.submitting = false;
  1339. }
  1340. },
  1341. //执行创建ERP订单
  1342. async executeCreateErpOrder() {
  1343. this.erpAccountDialog.submitting = true;
  1344. try {
  1345. let param = {
  1346. loginAccount: this.erpAccountForm.selectedAccount
  1347. };
  1348. if (this.ids.length > 0) {
  1349. // 如果有选中的订单,只推送选中的
  1350. param.orderIds = this.ids;
  1351. } else {
  1352. // 如果没有选中订单,推送查询条件下的所有订单
  1353. if (this.payTypeArr.length > 0) {
  1354. this.queryParams.payType = this.payTypeArr.toString();
  1355. } else {
  1356. this.queryParams.payType = null;
  1357. }
  1358. if (this.scheduleIdArr.length > 0) {
  1359. this.queryParams.scheduleId = this.scheduleIdArr.toString();
  1360. } else {
  1361. this.queryParams.scheduleId = null;
  1362. }
  1363. if (this.buyTypeArr.length > 0) {
  1364. this.queryParams.orderBuyType = this.buyTypeArr.toString();
  1365. } else {
  1366. this.queryParams.orderBuyType = null;
  1367. }
  1368. if (this.channelArr.length > 0) {
  1369. this.queryParams.orderChannel = this.channelArr.toString();
  1370. } else {
  1371. this.queryParams.orderChannel = null;
  1372. }
  1373. if (this.qwSubjectArr.length > 0) {
  1374. this.queryParams.qwSubject = this.qwSubjectArr.toString();
  1375. } else {
  1376. this.queryParams.qwSubject = null;
  1377. }
  1378. // 合并查询参数
  1379. param = { ...param, ...this.queryParams };
  1380. }
  1381. const response = await batchCreateErpOrder(param);
  1382. if (response.code === 200) {
  1383. this.$message.success('ERP订单创建成功');
  1384. this.cancelErpAccountDialog();
  1385. this.getList(); // 刷新列表
  1386. } else {
  1387. this.$message.error(response.msg || 'ERP订单创建失败');
  1388. }
  1389. } catch (error) {
  1390. console.error('创建ERP订单失败:', error);
  1391. this.$message.error('创建ERP订单失败');
  1392. } finally {
  1393. this.erpAccountDialog.submitting = false;
  1394. }
  1395. },
  1396. // 新增:取消ERP账户选择对话框
  1397. cancelErpAccountDialog() {
  1398. this.erpAccountDialog.open = false;
  1399. this.erpAccountForm.selectedAccount = null;
  1400. this.orderSummary = null;
  1401. this.erpAccountList = [];
  1402. },
  1403. handleCancelErpPhone(){
  1404. this.erpPhoneValue = [];
  1405. this.setPhoneOpen = false;
  1406. },
  1407. submitErpPhone(){
  1408. let param = {};
  1409. if(this.ids.length>0){
  1410. param = {orderIds:this.ids,erpPhone:this.erpPhoneValue};
  1411. } else {
  1412. if(this.payTypeArr.length>0){
  1413. this.queryParams.payType=this.payTypeArr.toString();
  1414. }
  1415. else{
  1416. this.queryParams.payType=null
  1417. }
  1418. if(this.scheduleIdArr.length>0){
  1419. this.queryParams.scheduleId=this.scheduleIdArr.toString();
  1420. }
  1421. else{
  1422. this.queryParams.scheduleId=null
  1423. }
  1424. if(this.buyTypeArr.length>0){
  1425. this.queryParams.orderBuyType=this.buyTypeArr.toString();
  1426. }
  1427. else{
  1428. this.queryParams.orderbuyType=null
  1429. }
  1430. if(this.channelArr.length>0){
  1431. this.queryParams.orderChannel=this.channelArr.toString();
  1432. }
  1433. else{
  1434. this.queryParams.orderChannel=null
  1435. }
  1436. if(this.qwSubjectArr.length>0){
  1437. this.queryParams.qwSubject=this.qwSubjectArr.toString();
  1438. }
  1439. else{
  1440. this.queryParams.qwSubject=null
  1441. }
  1442. param = this.queryParams;
  1443. param.erpPhone=this.erpPhoneValue;
  1444. }
  1445. editErpPhone(param).then(response=>{
  1446. this.msgSuccess("修改成功");
  1447. this.setPhoneOpen = false;
  1448. this.getList();
  1449. })
  1450. },
  1451. setErpPhone(){
  1452. this.getErpPhoneList();
  1453. this.setPhoneOpen = true;
  1454. },
  1455. // 设置推送手机相关方法
  1456. handleErpPhone(){
  1457. //查询配置手机号
  1458. this.getErpPhoneList();
  1459. this.erpPhone.open = true
  1460. },
  1461. getErpPhoneList(){
  1462. queryErpPhone().then(response =>{
  1463. if(response.data && response.data != null && response.data.length >0){
  1464. const phones = response.data.filter(phone => phone.trim());
  1465. this.phoneList = phones.map(phone => ({
  1466. phone: phone.trim(),
  1467. editing: false,
  1468. originalPhone: phone.trim()
  1469. }));
  1470. }
  1471. // 保存原始数据用于取消操作
  1472. this.originalPhoneList = this.phoneList;
  1473. });
  1474. },
  1475. // 新增手机号
  1476. handleAddPhone() {
  1477. this.phoneList.push({
  1478. phone: '',
  1479. editing: true,
  1480. originalPhone: '',
  1481. isNew: true
  1482. });
  1483. },
  1484. // 编辑手机号
  1485. handleEditPhone(index) {
  1486. this.$set(this.phoneList[index], 'editing', true);
  1487. this.$set(this.phoneList[index], 'originalPhone', this.phoneList[index].phone);
  1488. },
  1489. // 保存手机号
  1490. handleSavePhone(index) {
  1491. const phone = this.phoneList[index].phone.trim();
  1492. if (!phone) {
  1493. this.$message.error('手机号不能为空');
  1494. return;
  1495. }
  1496. if (!this.validatePhoneFormat(phone)) {
  1497. this.$message.error('请输入正确的手机号格式');
  1498. return;
  1499. }
  1500. // 检查是否重复
  1501. const duplicateIndex = this.phoneList.findIndex((item, idx) =>
  1502. idx !== index && item.phone === phone
  1503. );
  1504. if (duplicateIndex !== -1) {
  1505. this.$message.error('手机号已存在');
  1506. return;
  1507. }
  1508. this.$set(this.phoneList[index], 'editing', false);
  1509. this.$set(this.phoneList[index], 'isNew', false);
  1510. },
  1511. // 取消编辑
  1512. handleCancelEdit(index) {
  1513. if (this.phoneList[index].isNew) {
  1514. // 如果是新增的,直接删除
  1515. this.phoneList.splice(index, 1);
  1516. } else {
  1517. // 如果是编辑的,恢复原值
  1518. this.$set(this.phoneList[index], 'phone', this.phoneList[index].originalPhone);
  1519. this.$set(this.phoneList[index], 'editing', false);
  1520. }
  1521. },
  1522. // 删除手机号
  1523. handleDeletePhone(index) {
  1524. this.$confirm('确认删除该手机号?', '提示', {
  1525. confirmButtonText: '确定',
  1526. cancelButtonText: '取消',
  1527. type: 'warning'
  1528. }).then(() => {
  1529. this.phoneList.splice(index, 1);
  1530. this.$message.success('删除成功');
  1531. });
  1532. },
  1533. // 验证手机号格式
  1534. validatePhoneFormat(phone) {
  1535. const phoneRegex = /^1[3-9]\d{9}$/;
  1536. return phoneRegex.test(phone);
  1537. },
  1538. // 验证手机号
  1539. validatePhone(row) {
  1540. if (row.phone && !this.validatePhoneFormat(row.phone)) {
  1541. this.$message.error('请输入正确的手机号格式');
  1542. }
  1543. },
  1544. // 保存手机号列表
  1545. handleSavePhoneList() {
  1546. // 检查是否有正在编辑的项
  1547. const editingItem = this.phoneList.find(item => item.editing);
  1548. if (editingItem) {
  1549. this.$message.error('请先保存正在编辑的手机号');
  1550. return;
  1551. }
  1552. // 检查是否有空的手机号
  1553. const emptyPhone = this.phoneList.find(item => !item.phone.trim());
  1554. if (emptyPhone) {
  1555. this.$message.error('存在空的手机号,请删除或填写完整');
  1556. return;
  1557. }
  1558. // 构造手机号列表
  1559. const phoneList = this.phoneList.map(item => item.phone);
  1560. // 调用保存接口
  1561. saveErpPhone(phoneList).then(response => {
  1562. if (response.code === 200) {
  1563. this.$message.success('保存成功');
  1564. this.erpPhone.open = false;
  1565. } else {
  1566. this.$message.error(response.msg || '保存失败');
  1567. }
  1568. }).catch(() => {
  1569. this.$message.error('保存失败');
  1570. });
  1571. },
  1572. // 取消手机号对话框
  1573. handleCancelPhoneDialog() {
  1574. // 恢复原始数据
  1575. this.phoneList = JSON.parse(JSON.stringify(this.originalPhoneList));
  1576. this.erpPhone.open = false;
  1577. },
  1578. handleImportExpress() {
  1579. this.importExpress.title = "导入";
  1580. this.importExpress.open = true;
  1581. },
  1582. /** 下载模板操作 */
  1583. importTemplateExpress() {
  1584. importExpressTemplate().then(response => {
  1585. this.download(response.msg);
  1586. });
  1587. },
  1588. // 文件上传中处理
  1589. handleFileUploadProgressExpress(event, file, fileList) {
  1590. this.upload.isUploading = true;
  1591. },
  1592. // 文件上传成功处理
  1593. handleFileSuccessExpress(response, file, fileList) {
  1594. this.importExpress.open = false;
  1595. this.importExpress.isUploading = false;
  1596. this.$refs.importExpress.clearFiles();
  1597. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  1598. this.getList();
  1599. },
  1600. // 提交上传文件
  1601. submitFileFormExpress() {
  1602. this.$refs.importExpress.submit();
  1603. },
  1604. /** 导入按钮操作 */
  1605. handleImport() {
  1606. this.upload.title = "导入";
  1607. this.upload.open = true;
  1608. },
  1609. /** 下载模板操作 */
  1610. importTemplate() {
  1611. importTemplate().then(response => {
  1612. this.download(response.msg);
  1613. });
  1614. },
  1615. // 文件上传中处理
  1616. handleFileUploadProgress(event, file, fileList) {
  1617. this.upload.isUploading = true;
  1618. },
  1619. // 文件上传成功处理
  1620. handleFileSuccess(response, file, fileList) {
  1621. this.upload.open = false;
  1622. this.upload.isUploading = false;
  1623. this.$refs.upload.clearFiles();
  1624. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  1625. this.getList();
  1626. },
  1627. // 提交上传文件
  1628. submitFileForm() {
  1629. this.$refs.upload.submit();
  1630. },
  1631. handledetails(row){
  1632. this.show.open=true;
  1633. setTimeout(() => {
  1634. this.$refs.Details.getDetails(row.orderId,row.nickName,row.storeName);
  1635. }, 1);
  1636. },
  1637. getstoreList() {
  1638. listStore().then(response => {
  1639. this.storeOPtions = response.rows;
  1640. });
  1641. },
  1642. /** 查询订单列表 */
  1643. getList() {
  1644. this.loading = true;
  1645. if(this.payTypeArr.length>0){
  1646. this.queryParams.payType=this.payTypeArr.toString();
  1647. }
  1648. else{
  1649. this.queryParams.payType=null
  1650. }
  1651. if(this.scheduleIdArr.length>0){
  1652. this.queryParams.scheduleId=this.scheduleIdArr.toString();
  1653. }
  1654. else{
  1655. this.queryParams.scheduleId=null
  1656. }
  1657. if(this.buyTypeArr.length>0){
  1658. this.queryParams.orderBuyType=this.buyTypeArr.toString();
  1659. }
  1660. else{
  1661. this.queryParams.orderbuyType=null
  1662. }
  1663. if(this.channelArr.length>0){
  1664. this.queryParams.orderChannel=this.channelArr.toString();
  1665. }
  1666. else{
  1667. this.queryParams.orderChannel=null
  1668. }
  1669. if(this.qwSubjectArr.length>0){
  1670. this.queryParams.qwSubject=this.qwSubjectArr.toString();
  1671. }
  1672. else{
  1673. this.queryParams.qwSubject=null
  1674. }
  1675. if(this.companyIds && this.companyIds.length>1){
  1676. this.queryParams.companyIds = this.companyIds
  1677. this.queryParams.companyId = null;
  1678. this.queryParams.deptId = null;
  1679. } else {
  1680. this.queryParams.companyId = this.companyId
  1681. this.queryParams.companyIds = null;
  1682. }
  1683. listOrder(this.queryParams).then(response => {
  1684. this.orderList = response.rows;
  1685. this.total = response.total;
  1686. this.loading = false;
  1687. if(response.msg == 'jnmy'){
  1688. this.SFDFopen = true;
  1689. } else{
  1690. this.SFDFopen = false;
  1691. }
  1692. });
  1693. },
  1694. // 取消按钮
  1695. cancel() {
  1696. this.open = false;
  1697. this.reset();
  1698. },
  1699. // 表单重置
  1700. reset() {
  1701. this.form = {
  1702. orderId: null,
  1703. storeId: null,
  1704. orderCode: null,
  1705. userId: null,
  1706. userName: null,
  1707. userPhone: null,
  1708. userAddress: null,
  1709. cartId: null,
  1710. totalNum: null,
  1711. totalPrice: null,
  1712. payPrice: null,
  1713. payMoney: null,
  1714. isPay: null,
  1715. payTime: null,
  1716. payType: null,
  1717. createTime: null,
  1718. updateTime: null,
  1719. status: null,
  1720. refundStatus: "0",
  1721. refundImg: null,
  1722. refundExplain: null,
  1723. refundTime: null,
  1724. refundReason: null,
  1725. refundMoney: null,
  1726. deliveryCode: null,
  1727. deliveryName: null,
  1728. deliverySn: null,
  1729. remark: null,
  1730. isDel: null,
  1731. costPrice: null,
  1732. verifyCode: null,
  1733. shippingType: null,
  1734. isChannel: null,
  1735. isPrescribe: null,
  1736. prescribeId: null,
  1737. finishTime: null,
  1738. deliveryTime: null,
  1739. tuiMoney: null,
  1740. tuiMoneyStatus: 0,
  1741. tuiUserId: null,
  1742. orderCreateType: null
  1743. };
  1744. this.resetForm("form");
  1745. this.payTypeArr = null;
  1746. this.scheduleIdArr = null;
  1747. this.buyTypeArr = null;
  1748. this.channelArr = null;
  1749. this.qwSubjectArr = null;
  1750. },
  1751. /** 搜索按钮操作 */
  1752. handleQuery() {
  1753. this.queryParams.pageNum = 1;
  1754. this.getList();
  1755. },
  1756. handleClickX(tab, event) {
  1757. this.orderStatus = tab.name;
  1758. if(tab.name=="10"){
  1759. this.queryParams.status=null;
  1760. }else{
  1761. this.queryParams.status=tab.name;
  1762. }
  1763. this.handleQuery();
  1764. },
  1765. changeTime(){
  1766. if(this.createTime!=null){
  1767. this.queryParams.sTime=this.createTime[0];
  1768. this.queryParams.eTime=this.createTime[1];
  1769. }else{
  1770. this.queryParams.sTime=null;
  1771. this.queryParams.eTime=null;
  1772. }
  1773. if(this.deliverySendTime!=null){
  1774. this.queryParams.deliverySendsTime=this.deliverySendTime[0];
  1775. this.queryParams.deliverySendeTime=this.deliverySendTime[1];
  1776. }else{
  1777. this.queryParams.deliverySendsTime=null;
  1778. this.queryParams.deliverySendeTime=null;
  1779. }
  1780. if(this.deliveryImportTime!=null){
  1781. this.queryParams.deliveryImportsTime=this.deliveryImportTime[0];
  1782. this.queryParams.deliveryImporteTime=this.deliveryImportTime[1];
  1783. }else{
  1784. this.queryParams.deliveryImportsTime=null;
  1785. this.queryParams.deliveryImporteTime=null;
  1786. }
  1787. if(this.tuiMoneyTime!=null){
  1788. this.queryParams.tuisTime=this.tuiMoneyTime[0];
  1789. this.queryParams.tuieTime=this.tuiMoneyTime[1];
  1790. }else{
  1791. this.queryParams.tuisTime=null;
  1792. this.queryParams.tuieTime=null;
  1793. }
  1794. },
  1795. changePayTime(){
  1796. if(this.payTime!=null){
  1797. this.queryParams.sTime=this.payTime[0];
  1798. this.queryParams.eTime=this.payTime[1];
  1799. }else{
  1800. this.queryParams.paysTime=null;
  1801. this.queryParams.payeTime=null;
  1802. }
  1803. },
  1804. /** 重置按钮操作 */
  1805. resetQuery() {
  1806. this.resetForm("queryForm");
  1807. this.createTime=null;
  1808. this.queryParams.sTime=null;
  1809. this.queryParams.eTime=null;
  1810. this.payTime=null;
  1811. this.queryParams.paysTime=null;
  1812. this.queryParams.payeTime=null;
  1813. this.queryParams.deliveryImportTime = null;
  1814. this.queryParams.deliveryImportsTime = null;
  1815. this.queryParams.deliveryImporteTime = null;
  1816. this.queryParams.deliverySendTime = null;
  1817. this.queryParams.deliverySendsTime = null;
  1818. this.queryParams.deliverySendeTime = null;
  1819. this.queryParams.tuisTIme = null;
  1820. this.queryParams.tuieTIme = null;
  1821. this.companyIds = null;
  1822. this.companyId = null;
  1823. // 清除排序
  1824. this.currentSort = {
  1825. prop: null,
  1826. order: null
  1827. };
  1828. this.queryParams.sortField = null;
  1829. this.queryParams.sortOrder = null;
  1830. // 清除订单号标签
  1831. this.queryParams.orderCodes = [];
  1832. this.currentInput = '';
  1833. this.inputVisible = false;
  1834. // 重置表格排序状态 - 关键代码
  1835. this.$nextTick(() => {
  1836. if (this.$refs.orderTable) {
  1837. this.$refs.orderTable.clearSort();
  1838. }
  1839. });
  1840. this.handleQuery();
  1841. },
  1842. // 多选框选中数据
  1843. handleSelectionChange(selection) {
  1844. this.ids = selection.map(item => item.orderId)
  1845. this.single = selection.length!==1
  1846. this.multiple = !selection.length
  1847. },
  1848. /** 新增按钮操作 */
  1849. handleAdd() {
  1850. this.reset();
  1851. this.open = true;
  1852. this.title = "添加订单";
  1853. },
  1854. /** 修改按钮操作 */
  1855. handleUpdate(row) {
  1856. this.reset();
  1857. const orderId = row.orderId || this.ids
  1858. getOrder(orderId).then(response => {
  1859. this.form = response.data;
  1860. this.open = true;
  1861. this.title = "修改订单";
  1862. });
  1863. },
  1864. /** 提交按钮 */
  1865. submitForm() {
  1866. this.$refs["form"].validate(valid => {
  1867. if (valid) {
  1868. if (this.form.orderId != null) {
  1869. updateOrder(this.form).then(response => {
  1870. this.msgSuccess("修改成功");
  1871. this.open = false;
  1872. this.getList();
  1873. });
  1874. } else {
  1875. addOrder(this.form).then(response => {
  1876. this.msgSuccess("新增成功");
  1877. this.open = false;
  1878. this.getList();
  1879. });
  1880. }
  1881. }
  1882. });
  1883. },
  1884. /** 删除按钮操作 */
  1885. handleDelete(row) {
  1886. const orderIds = row.orderId || this.ids;
  1887. this.$confirm('是否确认删除订单编号为"' + orderIds + '"的数据项?', "警告", {
  1888. confirmButtonText: "确定",
  1889. cancelButtonText: "取消",
  1890. type: "warning"
  1891. }).then(function() {
  1892. return delOrder(orderIds);
  1893. }).then(() => {
  1894. this.getList();
  1895. this.msgSuccess("删除成功");
  1896. }).catch(() => {});
  1897. },
  1898. /** 导出按钮操作 */
  1899. handleExport() {
  1900. var that=this;
  1901. if(this.payTypeArr.length>0){
  1902. this.queryParams.payType=this.payTypeArr.toString();
  1903. }
  1904. else{
  1905. this.queryParams.payType=null
  1906. }
  1907. if(this.scheduleIdArr.length>0){
  1908. this.queryParams.scheduleId=this.scheduleIdArr.toString();
  1909. }
  1910. else{
  1911. this.queryParams.scheduleId=null
  1912. }
  1913. if(this.buyTypeArr.length>0){
  1914. this.queryParams.orderBuyType=this.buyTypeArr.toString();
  1915. }
  1916. else{
  1917. this.queryParams.orderbuyType=null
  1918. }
  1919. if(this.channelArr.length>0){
  1920. this.queryParams.orderChannel=this.channelArr.toString();
  1921. }
  1922. else{
  1923. this.queryParams.orderChannel=null
  1924. }
  1925. if(this.qwSubjectArr.length>0){
  1926. this.queryParams.qwSubject=this.qwSubjectArr.toString();
  1927. }
  1928. else{
  1929. this.queryParams.qwSubject=null
  1930. }
  1931. const queryParams = this.queryParams;
  1932. this.$confirm('是否确认导出所有订单数据项?', "警告", {
  1933. confirmButtonText: "确定",
  1934. cancelButtonText: "取消",
  1935. type: "warning"
  1936. }).then(() => {
  1937. this.exportLoading = true;
  1938. return exportOrder(queryParams);
  1939. }).then(response => {
  1940. console.log(response)
  1941. if(response.code==200){
  1942. that.msgSuccess(response.msg);
  1943. that.taskId=response.data;
  1944. that.time=setInterval(function(){
  1945. //查订单
  1946. getTask(that.taskId).then(res => {
  1947. if(res.data.status==1){
  1948. that.exportLoading = false;
  1949. clearTimeout(that.time)
  1950. that.time=null;
  1951. that.download(res.data.fileUrl);
  1952. }
  1953. });
  1954. },10000);
  1955. }
  1956. }).catch(() => {});
  1957. },
  1958. /** 导出按钮操作 */
  1959. handleOrderExport() {
  1960. var that=this;
  1961. if(this.payTypeArr.length>0){
  1962. this.queryParams.payType=this.payTypeArr.toString();
  1963. }
  1964. else{
  1965. this.queryParams.payType=null
  1966. }
  1967. if(this.scheduleIdArr.length>0){
  1968. this.queryParams.scheduleId=this.scheduleIdArr.toString();
  1969. }
  1970. else{
  1971. this.queryParams.scheduleId=null
  1972. }
  1973. if(this.buyTypeArr.length>0){
  1974. this.queryParams.orderBuyType=this.buyTypeArr.toString();
  1975. }
  1976. else{
  1977. this.queryParams.orderbuyType=null
  1978. }
  1979. if(this.channelArr.length>0){
  1980. this.queryParams.orderChannel=this.channelArr.toString();
  1981. }
  1982. else{
  1983. this.queryParams.orderChannel=null
  1984. }
  1985. if(this.qwSubjectArr.length>0){
  1986. this.queryParams.qwSubject=this.qwSubjectArr.toString();
  1987. }
  1988. else{
  1989. this.queryParams.qwSubject=null
  1990. }
  1991. const queryParams = this.queryParams;
  1992. this.$confirm('是否确认导出所有订单数据项?', "警告", {
  1993. confirmButtonText: "确定",
  1994. cancelButtonText: "取消",
  1995. type: "warning"
  1996. }).then(() => {
  1997. this.exportLoading = true;
  1998. return exportOrder2(queryParams);
  1999. }).then(response => {
  2000. console.log(response)
  2001. if(response.code==200){
  2002. console.log(response.msg)
  2003. that.msgSuccess(response.msg);
  2004. that.taskId=response.data;
  2005. that.time=setInterval(function(){
  2006. //查订单
  2007. getTask(that.taskId).then(res => {
  2008. if(res.data.status==1){
  2009. that.exportLoading = false;
  2010. clearTimeout(that.time)
  2011. that.time=null;
  2012. that.download(res.data.fileUrl);
  2013. }
  2014. });
  2015. },10000);
  2016. }
  2017. }).catch(() => {});
  2018. },
  2019. /** 查询部门下拉树结构 */
  2020. getTreeselect() {
  2021. var that=this;
  2022. var param={companyId:this.companyId}
  2023. treeselect(param).then((response) => {
  2024. this.deptOptions = response.data;
  2025. console.log(this.deptOptions)
  2026. if(response.data!=null&&response.data.length>0){
  2027. //this.queryParams.deptId=response.data[0].id;
  2028. }
  2029. });
  2030. },
  2031. companyChange(val){
  2032. console.log(this.companyIds);
  2033. if(this.companyIds.length>1){
  2034. this.deptOpen = false;
  2035. } else {
  2036. this.deptOpen = true
  2037. if(this.companyIds.length=1){
  2038. this.companyId=this.companyIds[0];
  2039. this.getTreeselect();
  2040. }
  2041. }
  2042. },
  2043. // companyChange(val){
  2044. // console.log(val);
  2045. // this.companyId=val;
  2046. // this.getTreeselect();
  2047. // },
  2048. currDeptChange(val){
  2049. console.log(val)
  2050. this.queryParams.deptId=val;
  2051. this.getList();
  2052. },
  2053. }
  2054. };
  2055. </script>
  2056. <style scoped>
  2057. .tag-input-order-search {
  2058. padding: 20px;
  2059. background: #fff;
  2060. border-radius: 4px;
  2061. }
  2062. .tag-input-container {
  2063. min-width: 445px;
  2064. }
  2065. .tags-wrapper {
  2066. min-height: 32px;
  2067. padding: 4px 8px;
  2068. border: 1px solid #dcdfe6;
  2069. border-radius: 4px;
  2070. cursor: text;
  2071. display: flex;
  2072. flex-wrap: wrap;
  2073. align-items: center;
  2074. gap: 4px;
  2075. transition: border-color 0.2s;
  2076. }
  2077. .tags-wrapper:hover {
  2078. border-color: #c0c4cc;
  2079. }
  2080. .tags-wrapper:focus-within {
  2081. border-color: #409eff;
  2082. box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
  2083. }
  2084. .order-tag {
  2085. margin: 2px;
  2086. flex-shrink: 0;
  2087. }
  2088. .tag-error {
  2089. background-color: #fef0f0;
  2090. border-color: #fbc4c4;
  2091. color: #f56c6c;
  2092. }
  2093. .tag-input {
  2094. border: none;
  2095. outline: none;
  2096. flex: 1;
  2097. min-width: 120px;
  2098. }
  2099. .tag-input >>> .el-input__inner {
  2100. border: none;
  2101. padding: 0;
  2102. height: 24px;
  2103. line-height: 24px;
  2104. }
  2105. .button-new-tag {
  2106. height: 24px;
  2107. line-height: 22px;
  2108. padding: 0 8px;
  2109. margin: 2px;
  2110. }
  2111. .input-tips {
  2112. margin-top: 4px;
  2113. font-size: 12px;
  2114. color: #909399;
  2115. }
  2116. /* 新增排序相关样式 */
  2117. .sort-info {
  2118. margin-top: 10px;
  2119. padding: 8px 0;
  2120. }
  2121. .tip-text {
  2122. display: flex;
  2123. align-items: center;
  2124. gap: 8px;
  2125. }
  2126. .quick-actions {
  2127. margin-top: 12px;
  2128. display: flex;
  2129. justify-content: space-between;
  2130. align-items: center;
  2131. padding: 8px 0;
  2132. border-top: 1px solid #ebeef5;
  2133. }
  2134. .stats-info {
  2135. font-size: 12px;
  2136. color: #909399;
  2137. display: flex;
  2138. align-items: center;
  2139. gap: 4px;
  2140. }
  2141. .invalid-codes-list {
  2142. margin: 16px 0;
  2143. max-height: 200px;
  2144. overflow-y: auto;
  2145. }
  2146. .invalid-tag {
  2147. margin: 4px;
  2148. }
  2149. .debug-preview {
  2150. margin-top: 20px;
  2151. }
  2152. .debug-content {
  2153. font-size: 12px;
  2154. }
  2155. .debug-content code {
  2156. display: block;
  2157. background: #f5f5f5;
  2158. padding: 8px;
  2159. border-radius: 4px;
  2160. margin: 4px 0 12px 0;
  2161. white-space: pre-wrap;
  2162. }
  2163. /* 响应式设计 */
  2164. @media (max-width: 768px) {
  2165. .tag-input-container {
  2166. min-width: auto;
  2167. width: 100%;
  2168. }
  2169. .tags-wrapper {
  2170. min-height: 40px;
  2171. }
  2172. .quick-actions {
  2173. flex-direction: column;
  2174. align-items: flex-start;
  2175. gap: 8px;
  2176. }
  2177. }
  2178. </style>