order1.vue 73 KB

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